@attalabs/vinaya 0.36.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 (243) 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 +4 -4
  13. package/aeg-root/roles/principal.md +6 -1
  14. package/aeg-root/roles/reviewer.md +9 -3
  15. package/aeg-root/roles/security.md +19 -9
  16. package/aeg-root/roles/tranche-archivist.md +14 -2
  17. package/aeg-root/state-machine.md +11 -10
  18. package/aeg-root/templates/brief-template.md +6 -4
  19. package/aeg-root/templates/pr-report-template.md +1 -9
  20. package/aeg-root/tranche-model.md +4 -4
  21. package/dist/checks/bin/check-body-bare-digits.js +685 -584
  22. package/dist/checks/bin/check-branch-topology.js +626 -466
  23. package/dist/checks/bin/check-brief-shape.js +686 -585
  24. package/dist/checks/bin/check-changeset-coverage.js +1161 -731
  25. package/dist/checks/bin/check-closes-n.js +626 -466
  26. package/dist/checks/bin/check-coherence.js +744 -599
  27. package/dist/checks/bin/check-dead-branch-push.js +567 -451
  28. package/dist/checks/bin/check-dispatch-readiness.js +747 -602
  29. package/dist/checks/bin/check-doc-coverage-push.js +1160 -730
  30. package/dist/checks/bin/check-doc-coverage.js +1160 -730
  31. package/dist/checks/bin/check-doctrine-no-procedures.js +683 -582
  32. package/dist/checks/bin/check-doctrine-portability.js +1160 -730
  33. package/dist/checks/bin/check-evidence-fresh.js +1167 -906
  34. package/dist/checks/bin/check-exec-bits.js +1159 -729
  35. package/dist/checks/bin/check-first-push-dispatch.js +747 -602
  36. package/dist/checks/bin/check-issue-assignment.js +626 -466
  37. package/dist/checks/bin/check-issue-milestone-attach.js +567 -451
  38. package/dist/checks/bin/check-issue-objectives-numbering.js +683 -582
  39. package/dist/checks/bin/check-issue-parts-coverage.js +567 -451
  40. package/dist/checks/bin/check-issue-surface-globs.js +755 -601
  41. package/dist/checks/bin/check-issue-title-grammar.js +567 -451
  42. package/dist/checks/bin/check-issue-tranche-label.js +567 -451
  43. package/dist/checks/bin/check-main-branch-refusal.js +567 -451
  44. package/dist/checks/bin/check-no-disk-state.js +567 -451
  45. package/dist/checks/bin/check-pr-premise-reassert.js +683 -582
  46. package/dist/checks/bin/check-pr-report-density.js +567 -451
  47. package/dist/checks/bin/check-principal-test-plan-wait.js +567 -451
  48. package/dist/checks/bin/check-quoted-command.js +1644 -1216
  49. package/dist/checks/bin/check-reader-resolvable-prose.js +1663 -1223
  50. package/dist/checks/bin/check-registry-gates.js +610 -481
  51. package/dist/checks/bin/check-retired-vocabulary.js +1638 -1210
  52. package/dist/checks/bin/check-review-gate.js +694 -593
  53. package/dist/checks/bin/check-single-plan-pr.js +567 -451
  54. package/dist/checks/bin/check-surface-scope.js +626 -466
  55. package/dist/checks/bin/check-test-plan.js +567 -451
  56. package/dist/checks/bin/check-token-collection-wired.js +567 -451
  57. package/dist/checks/bin/check-workspace-escape.js +1160 -730
  58. package/dist/index.js +13507 -7975
  59. package/dist/lib/pre-push-cache-test-run.js +1004 -681
  60. package/dist/lib/pre-push-select-tests.js +609 -480
  61. package/package.json +2 -2
  62. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +38 -0
  63. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +19 -0
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +233 -8
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +7 -2
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +1 -0
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +38 -3
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +113 -4
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +32 -6
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +26 -1
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +747 -0
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +8 -1
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +52 -4
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +163 -21
  75. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  76. package/studio-standalone/apps/vinaya-studio/web/.next/app-path-routes-manifest.json +0 -1
  77. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  78. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  79. package/studio-standalone/apps/vinaya-studio/web/.next/required-server-files.json +0 -5
  80. package/studio-standalone/apps/vinaya-studio/web/.next/routes-manifest.json +0 -6
  81. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js +1 -1
  82. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js.nft.json +1 -1
  83. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  84. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  85. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  86. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  87. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  88. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  89. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  90. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  91. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js +1 -1
  92. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  93. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  94. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  95. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js +1 -1
  96. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  97. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  98. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  99. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +3 -3
  100. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  101. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  102. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  103. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +3 -3
  104. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  105. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  106. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  107. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +3 -3
  108. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  109. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  110. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  111. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +5 -5
  112. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  113. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  114. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  115. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +3 -3
  116. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  117. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  118. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  119. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +3 -3
  120. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  121. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  122. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  123. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +3 -3
  124. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  125. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  126. package/studio-standalone/apps/vinaya-studio/web/.next/server/app-paths-manifest.json +0 -1
  127. 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
  128. 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
  129. 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
  130. 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
  131. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_15gdg48._.js → [root-of-the-server]__04adkz-._.js} +3 -3
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__05zwn98._.js +14 -0
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +3 -0
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__10riywf._.js +3 -0
  136. 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
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1wy7w66._.js → [root-of-the-server]__14ui9sz._.js} +2 -2
  138. 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
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1f4bb3_._.js +3 -0
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  141. 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
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1ng2x88._.js +3 -0
  143. 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
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +56 -0
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +2 -2
  146. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_06h3wbl._.js +3 -0
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  151. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0gs4gvl._.js +3 -0
  152. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  153. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  154. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  155. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_121lrn5._.js +3 -0
  156. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  157. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1o4v6lb._.js +3 -0
  158. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1q7h5mz._.js +1 -1
  159. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1ztd4i3._.js +3 -0
  160. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_209-ugd._.js +3 -0
  161. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_214d71c._.js +3 -0
  162. 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
  163. 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
  164. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_next_dist_1lzmr5o._.js +1 -1
  165. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_animate_components_index_ts_186fje1._.js +1 -1
  166. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_index_ts_0xk1vda._.js +1 -1
  167. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  168. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  169. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  170. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  171. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/09fcolor69bun.js +1 -0
  172. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0lcwmwzxacdie.js +1 -0
  173. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ojry7lrbzkfd.css +1 -0
  174. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{00z3-ljjd1gj9.js → 0vtfb0g813gki.js} +1 -1
  175. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1giu47hrbhroj.js +1 -0
  176. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1shz6lwruld25.js +1 -0
  177. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1ytvuy1mmnc6j.js +1 -0
  178. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3oxhhhm_psozq.js → 21a6_5cr956wj.js} +1 -1
  179. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2g8mwnydod96u.js +1 -0
  180. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3li0ueedy-ozv.js → 2nrnuawd5fwpv.js} +1 -1
  181. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2nw47832_uvfe.js +1 -0
  182. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qdxnj8wk2h0s.js +1 -0
  183. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3b9q75p-z5ma5.js +1 -0
  184. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3cv-oe7153242.js +1 -0
  185. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3lqjwjrcvq481.js → 3l56x8wjdzvaw.js} +5 -5
  186. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3m310lbjj4p5u.js +1 -0
  187. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2o9l0b7eqbr57.js → 3qtt1v3ya-ofe.js} +1 -1
  188. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  189. package/studio-standalone/apps/vinaya-studio/web/server.js +1 -1
  190. package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core/bin/verify-coherence.ts +0 -1089
  191. package/studio-standalone/_node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +0 -6
  192. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/app-paths-manifest.json +0 -3
  193. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/build-manifest.json +0 -9
  194. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/server-reference-manifest.json +0 -4
  195. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +0 -6
  196. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.map +0 -5
  197. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +0 -1
  198. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route_client-reference-manifest.js +0 -3
  199. 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
  200. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[externals]__0cki-x_._.js +0 -3
  201. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +0 -15
  202. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[turbopack]_runtime.js +0 -903
  203. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +0 -3
  204. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ln09ua._.js +0 -3
  205. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0oegopp._.js +0 -3
  206. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__13yxbjd._.js +0 -51
  207. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1duqmtm._.js +0 -3
  208. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1z7dml9._.js +0 -9
  209. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0bfs_u4._.js +0 -3
  210. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0g8_eot._.js +0 -3
  211. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0hrh_v-._.js +0 -181
  212. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0i4-dea._.js +0 -3
  213. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0o54suy._.js +0 -3
  214. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0rxd7s0._.js +0 -3
  215. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +0 -3
  216. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_151m4rz._.js +0 -3
  217. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1a9dieq._.js +0 -3
  218. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sxsf5q._.js +0 -3
  219. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sy_yfr._.js +0 -3
  220. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_219v2an._.js +0 -3
  221. 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
  222. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_form_input_tsx_0es8d8b._.js +0 -3
  223. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_brutal_components_index_ts_0n_lcc4._.js +0 -3
  224. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_0wvpm_z._.js +0 -3
  225. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +0 -1
  226. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0c8uwz_-m8s99.js +0 -165
  227. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ct0c-xj0baf6.js +0 -1
  228. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +0 -1
  229. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0t5n_r4xm__t-.js +0 -1
  230. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vc2u252q5q6o.js +0 -1
  231. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/16r_o07lw0vm0.js +0 -1
  232. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1cah7_e5a1zvu.js +0 -1
  233. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1gjo9-6dz7nup.js +0 -1
  234. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/24tz8aro1uto4.js +0 -1
  235. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ef2g5fozszw7.js +0 -1
  236. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ka8dg687auhj.js +0 -1
  237. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2pf3f50gbrkyv.js +0 -1
  238. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qq49pct3q51-.js +0 -1
  239. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3et66z7glk65w.js +0 -1
  240. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3y6u3prmrkea-.js +0 -1
  241. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yR5RsCxb1OGnYggiaO09S}/_buildManifest.js +0 -0
  242. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yR5RsCxb1OGnYggiaO09S}/_clientMiddlewareManifest.js +0 -0
  243. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → 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";
@@ -677,7 +677,6 @@ var TaskPrPauseSchema = z.object({
677
677
  var TaskPrReviewRecordSchema = z.object({
678
678
  verdicts: z.array(TaskPrVerdictSchema),
679
679
  roundMarkers: z.array(z.number().int().nonnegative()),
680
- summaryTable: z.string().nullable(),
681
680
  pause: TaskPrPauseSchema.nullable()
682
681
  });
683
682
  var TaskPrReadInputSchema = z.object({
@@ -724,25 +723,69 @@ var TaskCancelResultSchema = z.object({
724
723
  authenticatedFrom: z.string().min(1),
725
724
  fencedEffectKeys: z.array(z.string())
726
725
  });
727
- var TASK_TOOL_NAMES = [
728
- "task_start",
729
- "task_status",
730
- "task_escalation_read",
731
- "task_pr_read",
732
- "task_resume",
733
- "task_cancel"
734
- ];
735
- var OPERATOR_STATUS_FOLLOW = "task_status_follow";
736
- var OPERATOR_TOOL_GRANT = [...TASK_TOOL_NAMES, OPERATOR_STATUS_FOLLOW];
737
- // ../../packages/aeg-core/src/dev-review-loop/types.ts
738
- var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
739
- // ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
740
- var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
741
- // ../../packages/aeg-core/src/log/envelope.ts
742
- import { createHash } from "node:crypto";
743
-
744
726
  // ../../packages/aeg-core/src/log/schema.ts
727
+ import { z as z3 } from "zod";
728
+
729
+ // ../../packages/aeg-core/src/log/custom.ts
745
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
746
789
  var CONFIDENCE_REASON_MAX_LENGTH = 280;
747
790
  var ROLE_VALUES = [
748
791
  "planner",
@@ -753,178 +796,210 @@ var ROLE_VALUES = [
753
796
  "archivist",
754
797
  "architect"
755
798
  ];
756
- var RoleSchema = z2.enum(ROLE_VALUES);
799
+ var RoleSchema = z3.enum(ROLE_VALUES);
757
800
  var HOST_VALUES = ["hook", "ci", "cli", "loop"];
758
- var HostSchema = z2.enum(HOST_VALUES);
801
+ var HostSchema = z3.enum(HOST_VALUES);
759
802
  var RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
760
803
  var headerMetaCore = {
761
- ts: z2.string(),
762
- run_id: z2.string().regex(RUN_ID_PATTERN),
763
- seq: z2.number().int().nonnegative(),
764
- repo: z2.string().nullable(),
765
- vinaya: z2.string(),
766
- 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(),
767
810
  host: HostSchema,
768
- machine: z2.string()
811
+ machine: z3.string()
769
812
  };
770
- var HeaderMetaV1Schema = z2.object({
771
- schema: z2.literal(1),
813
+ var HeaderMetaV1Schema = z3.object({
814
+ schema: z3.literal(1),
772
815
  ...headerMetaCore
773
816
  }).strict();
774
- var LineageSchema = z2.object({
775
- run: z2.string().nullable(),
776
- attempt: z2.number().int().nullable(),
777
- 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()
778
821
  }).strict();
779
- var InputVersionsSchema = z2.object({
780
- objectives_version: z2.string().nullable(),
781
- brief_hash: z2.string().nullable(),
782
- ruling_ordinal: z2.number().int().nullable(),
783
- 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()
784
827
  }).strict();
785
- var ProvenanceSchema = z2.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
786
- var HeaderMetaV2Schema = z2.object({
787
- 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),
788
831
  ...headerMetaCore,
789
- event_id: z2.string().min(1),
790
- process_id: z2.string().min(1),
791
- 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(),
792
835
  lineage: LineageSchema,
793
836
  input_versions: InputVersionsSchema,
794
837
  provenance: ProvenanceSchema
795
838
  }).strict();
796
- var HeaderMetaSchema = z2.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema]);
797
- var SubjectSchema = z2.object({
798
- issue: z2.number().int().nullable(),
799
- pr: z2.number().int().optional(),
800
- sha: z2.string().optional(),
801
- role: z2.union([RoleSchema, z2.literal("unattributed")]),
802
- round: z2.number().int().optional(),
803
- 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()
804
871
  }).strict();
805
- var HeaderSchema = z2.object({
872
+ var HeaderSchema = z3.object({
806
873
  meta: HeaderMetaSchema,
807
874
  subject: SubjectSchema
808
875
  }).strict();
809
876
  var envelopeTail = {
810
- duration_ms: z2.number().nonnegative().optional(),
811
- payload: z2.object({}).strict()
877
+ duration_ms: z3.number().nonnegative().optional(),
878
+ payload: z3.object({}).strict()
812
879
  };
813
- var ReviewFindingSchema = z2.object({
814
- id: z2.string(),
815
- severity: z2.string(),
816
- state: z2.string().optional(),
817
- severity_scale: z2.string().optional(),
818
- policy_treatment: z2.enum(["blocking", "non_blocking", "unavailable"]).optional(),
819
- confidence: z2.number().min(0).max(1).optional(),
820
- confidence_scale: z2.string().optional(),
821
- 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()
822
889
  }).strict();
823
- var DispatchOutcomeSchema = z2.discriminatedUnion("type", [
824
- z2.object({ type: z2.literal("pr_opened"), pr: z2.number().int(), head: z2.string() }).strict(),
825
- z2.object({
826
- type: z2.literal("round_pushed"),
827
- pr: z2.number().int(),
828
- head: z2.string(),
829
- 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()
830
897
  }).strict(),
831
- z2.object({
832
- type: z2.literal("verdict"),
833
- verdict: z2.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
834
- head: z2.string(),
835
- comment_id: z2.number().int(),
836
- objectives: z2.array(z2.object({ id: z2.string(), met: z2.boolean() }).strict()),
837
- 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)
838
905
  }).strict(),
839
- z2.object({
840
- type: z2.literal("escalation"),
841
- class: z2.enum(["authority", "strategy", "product"]),
842
- 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()
843
910
  }).strict(),
844
- z2.object({ type: z2.literal("brief"), comment_id: z2.number().int(), hash: z2.string() }).strict(),
845
- z2.object({ type: z2.literal("plan"), issues: z2.array(z2.number().int()) }).strict(),
846
- z2.object({ type: z2.literal("archive"), provenance_comment_id: z2.number().int() }).strict(),
847
- 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()
848
915
  ]);
849
916
  var dispatchShared = {
850
917
  meta: HeaderMetaSchema,
851
918
  subject: SubjectSchema,
852
- kind: z2.literal("dispatch"),
919
+ kind: z3.literal("dispatch"),
853
920
  ...envelopeTail,
854
921
  target_role: RoleSchema,
855
- model: z2.string(),
856
- round: z2.number().int().optional(),
857
- effect_id: z2.string()
922
+ model: z3.string(),
923
+ round: z3.number().int().optional(),
924
+ effect_id: z3.string()
858
925
  };
859
- var dispatchUsageField = z2.object({ input: z2.number().nonnegative(), output: z2.number().nonnegative() }).strict().nullable();
860
- var DispatchEventSchema = z2.discriminatedUnion("event", [
861
- z2.object({ ...dispatchShared, event: z2.literal("dispatched"), prompt_hash: z2.string() }).strict(),
862
- 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({
863
930
  ...dispatchShared,
864
- event: z2.literal("outcome_received"),
931
+ event: z3.literal("outcome_received"),
865
932
  outcome: DispatchOutcomeSchema,
866
933
  usage: dispatchUsageField
867
934
  }).strict(),
868
- z2.object({
935
+ z3.object({
869
936
  ...dispatchShared,
870
- event: z2.literal("dispatch_failed"),
871
- reason: z2.enum(["timeout", "crash", "refused", "unattributed_write"]),
937
+ event: z3.literal("dispatch_failed"),
938
+ reason: z3.enum(["timeout", "crash", "refused", "unattributed_write"]),
872
939
  usage: dispatchUsageField
873
940
  }).strict()
874
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();
875
949
  var loopShared = {
876
950
  meta: HeaderMetaSchema,
877
951
  subject: SubjectSchema,
878
- kind: z2.literal("dev_review_loop"),
952
+ kind: z3.literal("dev_review_loop"),
879
953
  ...envelopeTail,
880
- loop_id: z2.string()
954
+ loop_id: z3.string()
881
955
  };
882
- var DevReviewLoopEventSchema = z2.discriminatedUnion("event", [
883
- z2.object({
956
+ var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
957
+ z3.object({
884
958
  ...loopShared,
885
- event: z2.literal("loop_started"),
886
- task: z2.number().int(),
887
- policy: z2.object({
888
- max_rounds: z2.number().int().nonnegative(),
889
- reviewers: z2.array(RoleSchema),
890
- 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())
891
965
  }).strict()
892
966
  }).strict(),
893
- z2.object({ ...loopShared, event: z2.literal("round_started"), round: z2.number().int(), base_head: z2.string() }).strict(),
894
- z2.object({
967
+ z3.object({ ...loopShared, event: z3.literal("round_started"), round: z3.number().int(), base_head: z3.string() }).strict(),
968
+ z3.object({
895
969
  ...loopShared,
896
- event: z2.literal("gate_result_read"),
897
- round: z2.number().int(),
898
- head: z2.string(),
899
- green: z2.boolean(),
900
- confidence_value: z2.number().int().min(0).max(100).optional(),
901
- confidence_reason: z2.string().max(CONFIDENCE_REASON_MAX_LENGTH).optional(),
902
- confidence_unavailable: z2.boolean().optional(),
903
- 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()
904
978
  }).strict(),
905
- z2.object({
979
+ z3.object({
906
980
  ...loopShared,
907
- event: z2.literal("verdicts_read"),
908
- round: z2.number().int(),
909
- head: z2.string(),
910
- all_approve: z2.boolean(),
911
- blockers: z2.number().int().nonnegative(),
912
- 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()
913
988
  }).strict(),
914
- z2.object({
989
+ z3.object({
915
990
  ...loopShared,
916
- event: z2.literal("findings_compared"),
917
- round: z2.number().int(),
918
- open: z2.array(z2.string()),
919
- resolved: z2.array(z2.string()),
920
- new: z2.array(z2.string()),
921
- 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())
922
997
  }).strict(),
923
- z2.object({
998
+ z3.object({
924
999
  ...loopShared,
925
- event: z2.literal("stop_condition_met"),
926
- round: z2.number().int(),
927
- condition: z2.enum([
1000
+ event: z3.literal("stop_condition_met"),
1001
+ round: z3.number().int(),
1002
+ condition: z3.enum([
928
1003
  "green",
929
1004
  "max_rounds",
930
1005
  "no_progress",
@@ -933,66 +1008,85 @@ var DevReviewLoopEventSchema = z2.discriminatedUnion("event", [
933
1008
  "confidence",
934
1009
  "reappearance",
935
1010
  "repeat_finding",
936
- "repeat_failure"
1011
+ "repeat_failure",
1012
+ "time_budget"
937
1013
  ])
938
1014
  }).strict(),
939
- 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({
1023
+ ...loopShared,
1024
+ event: z3.literal("resumed"),
1025
+ round: z3.number().int(),
1026
+ by: z3.enum(["principal", "driver"])
1027
+ }).strict(),
1028
+ z3.object({
940
1029
  ...loopShared,
941
- event: z2.literal("paused"),
942
- round: z2.number().int(),
943
- reason: z2.enum(["escalation", "principal_item", "refreeze_needed"])
1030
+ event: z3.literal("cancelled"),
1031
+ round: z3.number().int(),
1032
+ by: z3.literal("principal")
944
1033
  }).strict(),
945
- z2.object({
1034
+ z3.object({
946
1035
  ...loopShared,
947
- event: z2.literal("resumed"),
948
- round: z2.number().int(),
949
- by: z2.enum(["principal", "driver"])
1036
+ event: z3.literal("unpushed_work_resume"),
1037
+ round: z3.number().int(),
1038
+ branch: z3.string(),
1039
+ detail: z3.string()
950
1040
  }).strict(),
951
- z2.object({
1041
+ z3.object({
952
1042
  ...loopShared,
953
- event: z2.literal("cancelled"),
954
- round: z2.number().int(),
955
- by: z2.literal("principal")
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"])
956
1052
  }).strict(),
957
- z2.object({
1053
+ z3.object({
958
1054
  ...loopShared,
959
- event: z2.literal("unpushed_work_resume"),
960
- round: z2.number().int(),
961
- branch: z2.string(),
962
- detail: z2.string()
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"])
963
1062
  }).strict(),
964
- z2.object({
1063
+ z3.object({
965
1064
  ...loopShared,
966
- event: z2.literal("round_ended"),
967
- round: z2.number().int(),
968
- base_head: z2.string(),
969
- head: z2.string(),
970
- files_changed: z2.number().int().nonnegative(),
971
- insertions: z2.number().int().nonnegative(),
972
- deletions: z2.number().int().nonnegative(),
973
- wall_ms: z2.number().nonnegative(),
974
- outcome: z2.enum(["green", "changes_requested", "escalated"])
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"])
975
1070
  }).strict(),
976
- z2.object({
1071
+ z3.object({
977
1072
  ...loopShared,
978
- event: z2.literal("journal_finalized"),
979
- rounds: z2.number().int().nonnegative(),
980
- total_wall_ms: z2.number().nonnegative(),
981
- time_to_green_ms: z2.number().nonnegative().nullable(),
982
- files_changed_total: z2.number().int().nonnegative(),
983
- final_head: z2.string(),
984
- result: z2.enum(["merged_ready", "stopped"])
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()
985
1078
  }).strict(),
986
- z2.object({
1079
+ z3.object({
987
1080
  ...loopShared,
988
- event: z2.literal("infrastructure_retry"),
989
- round: z2.number().int(),
990
- failure_kind: z2.enum(["pause_comment_post", "developer_connection"]),
991
- attempts: z2.number().int().positive(),
992
- outcome: z2.enum(["recovered", "exhausted"])
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()
993
1087
  }).strict()
994
1088
  ]);
995
- var ForgeOpSchema = z2.enum([
1089
+ var ForgeOpSchema = z3.enum([
996
1090
  "pr.create",
997
1091
  "pr.comment",
998
1092
  "pr.body.replace",
@@ -1006,24 +1100,24 @@ var ForgeOpSchema = z2.enum([
1006
1100
  "label.add",
1007
1101
  "label.remove"
1008
1102
  ]);
1009
- var ForgeWriteTargetSchema = z2.object({
1010
- issue: z2.number().int().optional(),
1011
- pr: z2.number().int().optional()
1103
+ var ForgeWriteTargetSchema = z3.object({
1104
+ issue: z3.number().int().optional(),
1105
+ pr: z3.number().int().optional()
1012
1106
  }).strict();
1013
1107
  var forgeWriteShared = {
1014
1108
  meta: HeaderMetaSchema,
1015
1109
  subject: SubjectSchema,
1016
- kind: z2.literal("forge_write"),
1110
+ kind: z3.literal("forge_write"),
1017
1111
  ...envelopeTail,
1018
1112
  op: ForgeOpSchema,
1019
1113
  target: ForgeWriteTargetSchema
1020
1114
  };
1021
- var ForgeWriteEventSchema = z2.discriminatedUnion("event", [
1022
- z2.object({ ...forgeWriteShared, event: z2.literal("validated") }).strict(),
1023
- z2.object({ ...forgeWriteShared, event: z2.literal("refused"), reason: z2.string() }).strict(),
1024
- 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()
1025
1119
  ]);
1026
- var GateOutcomeSchema = z2.enum([
1120
+ var GateOutcomeSchema = z3.enum([
1027
1121
  "pass",
1028
1122
  "fail",
1029
1123
  "wait",
@@ -1036,61 +1130,74 @@ var GateOutcomeSchema = z2.enum([
1036
1130
  var gateShared = {
1037
1131
  meta: HeaderMetaSchema,
1038
1132
  subject: SubjectSchema,
1039
- kind: z2.literal("gate"),
1133
+ kind: z3.literal("gate"),
1040
1134
  ...envelopeTail,
1041
- check: z2.string(),
1042
- check_version: z2.string().nullable(),
1043
- policy_version: z2.string().nullable(),
1044
- 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()
1045
1139
  };
1046
- var GateEventSchema = z2.discriminatedUnion("event", [
1047
- z2.object({
1140
+ var GateEventSchema = z3.discriminatedUnion("event", [
1141
+ z3.object({
1048
1142
  ...gateShared,
1049
- event: z2.literal("checked"),
1143
+ event: z3.literal("checked"),
1050
1144
  outcome: GateOutcomeSchema,
1051
- 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())
1052
1158
  }).strict()
1053
1159
  ]);
1054
- var OperationResultSchema = z2.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
1160
+ var OperationResultSchema = z3.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
1055
1161
  var operationShared = {
1056
1162
  meta: HeaderMetaSchema,
1057
1163
  subject: SubjectSchema,
1058
- kind: z2.literal("operation"),
1164
+ kind: z3.literal("operation"),
1059
1165
  ...envelopeTail,
1060
- operation: z2.string(),
1061
- target: z2.string().nullable()
1166
+ operation: z3.string(),
1167
+ target: z3.string().nullable()
1062
1168
  };
1063
- var OperationEventSchema = z2.discriminatedUnion("event", [
1064
- z2.object({
1169
+ var OperationEventSchema = z3.discriminatedUnion("event", [
1170
+ z3.object({
1065
1171
  ...operationShared,
1066
- event: z2.literal("completed"),
1172
+ event: z3.literal("completed"),
1067
1173
  result: OperationResultSchema,
1068
- 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()
1069
1176
  }).strict()
1070
1177
  ]);
1071
- var UsageUnitsSchema = z2.object({
1072
- input: z2.number().nonnegative().nullable(),
1073
- output: z2.number().nonnegative().nullable(),
1074
- 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()
1075
1182
  }).strict();
1076
1183
  var usageShared = {
1077
1184
  meta: HeaderMetaSchema,
1078
1185
  subject: SubjectSchema,
1079
- kind: z2.literal("usage"),
1186
+ kind: z3.literal("usage"),
1080
1187
  ...envelopeTail,
1081
- model: z2.string().nullable(),
1082
- source: z2.string(),
1083
- semantics: z2.enum(["cumulative", "delta"])
1188
+ model: z3.string().nullable(),
1189
+ source: z3.string(),
1190
+ semantics: z3.enum(["cumulative", "delta"])
1084
1191
  };
1085
- var UsageEventSchema = z2.discriminatedUnion("event", [
1086
- z2.object({
1192
+ var UsageEventSchema = z3.discriminatedUnion("event", [
1193
+ z3.object({
1087
1194
  ...usageShared,
1088
- event: z2.literal("observed"),
1195
+ event: z3.literal("observed"),
1089
1196
  units: UsageUnitsSchema,
1090
- unknown_reason: z2.string().nullable()
1197
+ unknown_reason: z3.string().nullable()
1091
1198
  }).strict()
1092
1199
  ]);
1093
- var RoleAttemptOutcomeSchema = z2.enum([
1200
+ var RoleAttemptOutcomeSchema = z3.enum([
1094
1201
  "completed",
1095
1202
  "incomplete",
1096
1203
  "infrastructure_failed",
@@ -1101,17 +1208,17 @@ var RoleAttemptOutcomeSchema = z2.enum([
1101
1208
  var roleAttemptShared = {
1102
1209
  meta: HeaderMetaSchema,
1103
1210
  subject: SubjectSchema,
1104
- kind: z2.literal("role_attempt"),
1211
+ kind: z3.literal("role_attempt"),
1105
1212
  ...envelopeTail,
1106
- actor: z2.string().nullable(),
1107
- attempt: z2.number().int().nullable(),
1108
- effect_id: z2.string(),
1109
- 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()
1110
1217
  };
1111
- var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
1112
- z2.object({
1218
+ var RoleAttemptEventSchema = z3.discriminatedUnion("event", [
1219
+ z3.object({
1113
1220
  ...roleAttemptShared,
1114
- event: z2.literal("attempted"),
1221
+ event: z3.literal("attempted"),
1115
1222
  outcome: RoleAttemptOutcomeSchema,
1116
1223
  usage: dispatchUsageField
1117
1224
  }).strict()
@@ -1119,42 +1226,59 @@ var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
1119
1226
  var handoffShared = {
1120
1227
  meta: HeaderMetaSchema,
1121
1228
  subject: SubjectSchema,
1122
- kind: z2.literal("handoff"),
1229
+ kind: z3.literal("handoff"),
1123
1230
  ...envelopeTail,
1124
- class: z2.enum(["authority", "strategy", "product"]),
1125
- reason: z2.string()
1231
+ class: z3.enum(["authority", "strategy", "product"]),
1232
+ reason: z3.string()
1126
1233
  };
1127
- var HandoffEventSchema = z2.discriminatedUnion("event", [
1128
- z2.object({
1234
+ var HandoffEventSchema = z3.discriminatedUnion("event", [
1235
+ z3.object({
1129
1236
  ...handoffShared,
1130
- event: z2.literal("raised"),
1131
- requested_decision: z2.string().nullable()
1237
+ event: z3.literal("raised"),
1238
+ requested_decision: z3.string().nullable()
1132
1239
  }).strict(),
1133
- z2.object({
1240
+ z3.object({
1134
1241
  ...handoffShared,
1135
- event: z2.literal("resolved"),
1136
- resolution: z2.string().nullable(),
1137
- resolved_by: z2.string().nullable()
1242
+ event: z3.literal("resolved"),
1243
+ resolution: z3.string().nullable(),
1244
+ resolved_by: z3.string().nullable()
1138
1245
  }).strict()
1139
1246
  ]);
1140
- var EffectTargetSchema = z2.object({
1141
- kind: z2.string(),
1142
- ref: z2.string()
1247
+ var EffectTargetSchema = z3.object({
1248
+ kind: z3.string(),
1249
+ ref: z3.string()
1143
1250
  }).strict();
1144
1251
  var effectShared = {
1145
1252
  meta: HeaderMetaSchema,
1146
1253
  subject: SubjectSchema,
1147
- kind: z2.literal("effect"),
1254
+ kind: z3.literal("effect"),
1148
1255
  ...envelopeTail,
1149
- effect_id: z2.string(),
1256
+ effect_id: z3.string(),
1150
1257
  target: EffectTargetSchema
1151
1258
  };
1152
- var EffectEventSchema = z2.discriminatedUnion("event", [
1153
- z2.object({ ...effectShared, event: z2.literal("attempted") }).strict(),
1154
- z2.object({ ...effectShared, event: z2.literal("observed"), outcome: z2.enum(["success", "failure", "uncertain"]) }).strict(),
1155
- 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()
1263
+ ]);
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()
1156
1280
  ]);
1157
- var LogEventSchema = z2.union([
1281
+ var LogEventSchema = z3.union([
1158
1282
  DispatchEventSchema,
1159
1283
  DevReviewLoopEventSchema,
1160
1284
  ForgeWriteEventSchema,
@@ -1163,10 +1287,11 @@ var LogEventSchema = z2.union([
1163
1287
  UsageEventSchema,
1164
1288
  RoleAttemptEventSchema,
1165
1289
  HandoffEventSchema,
1166
- EffectEventSchema
1290
+ EffectEventSchema,
1291
+ CustomEventSchema
1167
1292
  ]);
1168
-
1169
1293
  // ../../packages/aeg-core/src/log/envelope.ts
1294
+ import { createHash } from "node:crypto";
1170
1295
  function isRole(value) {
1171
1296
  return value !== undefined && ROLE_VALUES.includes(value);
1172
1297
  }
@@ -1203,18 +1328,27 @@ function roundFromEnv(round) {
1203
1328
  const n = Number(round);
1204
1329
  return Number.isInteger(n) ? n : undefined;
1205
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
+ }
1206
1337
  function buildHeader(input) {
1207
1338
  const role = isRole(input.env.role) ? input.env.role : "unattributed";
1208
1339
  const round = roundFromEnv(input.env.round);
1340
+ const pr = prFromEnv(input.env.pr);
1209
1341
  const subject = {
1210
1342
  issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
1211
1343
  role,
1212
1344
  ...round !== undefined ? { round } : {},
1345
+ ...pr !== undefined ? { pr } : {},
1213
1346
  ...input.subject ?? {}
1214
1347
  };
1348
+ const issue = subject.issue;
1215
1349
  return {
1216
1350
  meta: {
1217
- schema: 2,
1351
+ schema: 3,
1218
1352
  ts: input.now.toISOString(),
1219
1353
  run_id: input.runId,
1220
1354
  seq: input.seq,
@@ -1237,7 +1371,19 @@ function buildHeader(input) {
1237
1371
  ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
1238
1372
  policy_digest: input.inputVersions?.policyDigest ?? null
1239
1373
  },
1240
- 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)
1241
1387
  },
1242
1388
  subject
1243
1389
  };
@@ -1280,7 +1426,7 @@ function redact(value, home) {
1280
1426
  return value;
1281
1427
  }
1282
1428
  // ../../packages/aeg-core/src/log/store.ts
1283
- var KNOWN_SCHEMA_VERSIONS = [1, 2];
1429
+ var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
1284
1430
  function metaOf(obj) {
1285
1431
  if (obj === null || typeof obj !== "object")
1286
1432
  return null;
@@ -1346,7 +1492,7 @@ function classifyStoredLine(raw, home) {
1346
1492
  return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
1347
1493
  }
1348
1494
  const redacted = redact(event, home);
1349
- const provenance = version === 2 ? event.meta.provenance ?? null : null;
1495
+ const provenance = version >= 2 ? event.meta.provenance ?? null : null;
1350
1496
  return {
1351
1497
  status: "ok",
1352
1498
  identity,
@@ -1359,136 +1505,139 @@ function classifyStoredLine(raw, home) {
1359
1505
  };
1360
1506
  }
1361
1507
  // ../../packages/aeg-core/src/control-store/records.ts
1362
- import { z as z3 } from "zod";
1363
- var isoTimestamp = z3.string().min(1);
1364
- var taskId = z3.number().int().positive();
1365
- var epochNumber = z3.number().int().nonnegative();
1366
- var RunRecordSchema = z3.object({
1367
- version: z3.literal(1),
1368
- 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"),
1369
1515
  task: taskId,
1370
- runId: z3.string().min(1),
1371
- pid: z3.number().int().positive(),
1372
- host: z3.string().min(1),
1516
+ runId: z4.string().min(1),
1517
+ pid: z4.number().int().positive(),
1518
+ host: z4.string().min(1),
1373
1519
  startedAt: isoTimestamp,
1374
- childStartedAt: z3.string().min(1).nullable().optional(),
1375
- childCommand: z3.string().min(1).nullable().optional()
1520
+ childStartedAt: z4.string().min(1).nullable().optional(),
1521
+ childCommand: z4.string().min(1).nullable().optional()
1376
1522
  }).strict();
1377
- var InputRecordSchema = z3.object({
1378
- version: z3.literal(1),
1379
- kind: z3.literal("input"),
1523
+ var InputRecordSchema = z4.object({
1524
+ version: z4.literal(1),
1525
+ kind: z4.literal("input"),
1380
1526
  task: taskId,
1381
- runId: z3.string().min(1),
1382
- source: z3.union([z3.literal("fresh"), z3.literal("resume")]),
1383
- pr: z3.number().int().positive().nullable(),
1384
- 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(),
1385
1531
  recordedAt: isoTimestamp
1386
1532
  }).strict();
1387
- var OwnershipRecordSchema = z3.object({
1388
- version: z3.literal(1),
1389
- kind: z3.literal("ownership"),
1533
+ var OwnershipRecordSchema = z4.object({
1534
+ version: z4.literal(1),
1535
+ kind: z4.literal("ownership"),
1390
1536
  task: taskId,
1391
1537
  epoch: epochNumber,
1392
- ownerId: z3.string().min(1),
1393
- pid: z3.number().int().positive(),
1394
- host: z3.string().min(1),
1538
+ ownerId: z4.string().min(1),
1539
+ pid: z4.number().int().positive(),
1540
+ host: z4.string().min(1),
1395
1541
  acquiredAt: isoTimestamp
1396
1542
  }).strict();
1397
- var TransitionRecordSchema = z3.object({
1398
- version: z3.literal(1),
1399
- kind: z3.literal("transition"),
1543
+ var TransitionRecordSchema = z4.object({
1544
+ version: z4.literal(1),
1545
+ kind: z4.literal("transition"),
1400
1546
  task: taskId,
1401
1547
  epoch: epochNumber,
1402
- seq: z3.number().int().nonnegative(),
1403
- from: z3.string().min(1),
1404
- to: z3.string().min(1),
1405
- 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(),
1406
1552
  at: isoTimestamp
1407
1553
  }).strict();
1408
- var ManifestRecordSchema = z3.object({
1409
- version: z3.literal(1),
1410
- kind: z3.literal("manifest"),
1554
+ var ManifestRecordSchema = z4.object({
1555
+ version: z4.literal(1),
1556
+ kind: z4.literal("manifest"),
1411
1557
  task: taskId,
1412
1558
  round: epochNumber,
1413
- repository: z3.string().min(1),
1414
- pr: z3.number().int().positive(),
1415
- branch: z3.string().min(1),
1416
- baseSha: z3.string().min(1).nullable(),
1417
- headSha: z3.string().min(1),
1418
- briefHash: z3.string().min(1).nullable(),
1419
- 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(),
1420
1566
  rulingOrdinal: epochNumber,
1421
- policyDigest: z3.string().min(1),
1567
+ policyDigest: z4.string().min(1),
1422
1568
  recordedAt: isoTimestamp
1423
1569
  }).strict();
1424
- var roundHeadIdentity = z3.object({ round: z3.number().int().positive(), head: z3.string().min(1) }).strict();
1425
- var LoopBudgetsSchema = z3.object({
1426
- mechanicalRetries: z3.number().int().nonnegative(),
1427
- reviewRounds: z3.number().int().nonnegative(),
1428
- 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()
1429
1575
  }).strict();
1430
- var LoopStateRecordSchema = z3.object({
1431
- version: z3.literal(1),
1432
- kind: z3.literal("loop_state"),
1576
+ var LoopStateRecordSchema = z4.object({
1577
+ version: z4.literal(1),
1578
+ kind: z4.literal("loop_state"),
1433
1579
  task: taskId,
1434
- round: z3.number().int().positive(),
1435
- phase: z3.string().min(1),
1436
- 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(),
1437
1583
  budgets: LoopBudgetsSchema,
1438
1584
  heldResult: roundHeadIdentity.nullable(),
1439
1585
  deliveredFindings: roundHeadIdentity.nullable(),
1440
- repeatMemory: z3.object({
1441
- blockingFindings: z3.array(z3.string()),
1442
- lastFailure: z3.object({ signature: z3.string(), message: z3.string() }).nullable()
1586
+ repeatMemory: z4.object({
1587
+ blockingFindings: z4.array(z4.string()),
1588
+ lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
1443
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(),
1444
1593
  recordedAt: isoTimestamp
1445
1594
  }).strict();
1446
- var EffectRecordSchema = z3.object({
1447
- version: z3.literal(1),
1448
- kind: z3.literal("effect"),
1595
+ var EffectRecordSchema = z4.object({
1596
+ version: z4.literal(1),
1597
+ kind: z4.literal("effect"),
1449
1598
  task: taskId,
1450
- key: z3.string().min(1),
1451
- operation: z3.string().min(1),
1452
- target: z3.string().min(1),
1453
- inputVersion: z3.number().int().nonnegative(),
1454
- payloadDigest: z3.string().min(1),
1455
- status: z3.union([z3.literal("started"), z3.literal("verified"), z3.literal("uncertain")]),
1456
- 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(),
1457
1606
  recordedAt: isoTimestamp
1458
1607
  }).strict();
1459
- var EscalationRecordSchema = z3.object({
1460
- version: z3.literal(1),
1461
- kind: z3.literal("escalation"),
1608
+ var EscalationRecordSchema = z4.object({
1609
+ version: z4.literal(1),
1610
+ kind: z4.literal("escalation"),
1462
1611
  task: taskId,
1463
- escalationId: z3.string().min(1),
1612
+ escalationId: z4.string().min(1),
1464
1613
  round: epochNumber,
1465
- head: z3.string().min(1),
1466
- branch: z3.string().min(1),
1467
- pr: z3.number().int().positive().nullable(),
1468
- runId: z3.string().min(1),
1469
- pid: z3.number().int().positive(),
1470
- host: z3.string().min(1),
1471
- agent: z3.string().min(1).optional(),
1472
- reason: z3.string().min(1),
1473
- detail: z3.string().optional(),
1474
- evidence: z3.string().optional(),
1475
- attemptedRecovery: z3.string().min(1),
1476
- requestedDecision: z3.string().min(1),
1477
- recipient: z3.string().min(1),
1478
- briefHash: z3.string().min(1).nullable(),
1479
- 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(),
1480
1629
  rulingOrdinal: epochNumber,
1481
- policyDigest: z3.string().min(1),
1630
+ policyDigest: z4.string().min(1),
1482
1631
  recordedAt: isoTimestamp
1483
1632
  }).strict();
1484
- var ResolutionRecordSchema = z3.object({
1485
- version: z3.literal(1),
1486
- kind: z3.literal("resolution"),
1633
+ var ResolutionRecordSchema = z4.object({
1634
+ version: z4.literal(1),
1635
+ kind: z4.literal("resolution"),
1487
1636
  task: taskId,
1488
- escalationId: z3.string().min(1),
1489
- decision: z3.union([z3.literal("resume"), z3.literal("cancel")]),
1490
- authenticatedBy: z3.string().min(1),
1491
- 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),
1492
1641
  consumedAt: isoTimestamp
1493
1642
  }).strict();
1494
1643
  // ../../packages/aeg-core/src/control-store/local.ts
@@ -1568,8 +1717,8 @@ function mkdirNoSymlinks(dir, mode, trustedRoot) {
1568
1717
  }
1569
1718
  var CONTROL_AREA_DIRNAME = "control";
1570
1719
  // src/checks/registry.ts
1571
- import { existsSync as existsSync3 } from "node:fs";
1572
- 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";
1573
1722
 
1574
1723
  // src/lib/package-root.ts
1575
1724
  import { existsSync as existsSync2 } from "node:fs";
@@ -1589,10 +1738,14 @@ function packageRoot(moduleUrl) {
1589
1738
  }
1590
1739
 
1591
1740
  // src/checks/registry.ts
1592
- var DIST_BIN_DIR = join3(packageRoot(import.meta.url), "dist", "checks", "bin");
1593
- var SRC_BIN_DIR = join3(packageRoot(import.meta.url), "src", "checks", "bin");
1594
- var BIN_DIR = existsSync3(DIST_BIN_DIR) ? DIST_BIN_DIR : SRC_BIN_DIR;
1595
- 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;
1596
1749
  function bin(name) {
1597
1750
  return join3(BIN_DIR, `${name}${BIN_EXT}`);
1598
1751
  }
@@ -1790,23 +1943,6 @@ var REGISTRY = [
1790
1943
  },
1791
1944
  1
1792
1945
  ],
1793
- [
1794
- {
1795
- name: "token-report",
1796
- validates: "body",
1797
- run: bin("check-token-report"),
1798
- scope: "diff",
1799
- timeoutMs: 15000,
1800
- requiresOpenPr: true,
1801
- env: {
1802
- PR_BODY: { optional: true },
1803
- BRANCH: { optional: true },
1804
- CLAUDE_PROJECT_DIR: { optional: true },
1805
- CLAUDE_CODE_SESSION_ID: { optional: true }
1806
- }
1807
- },
1808
- 1
1809
- ],
1810
1946
  [
1811
1947
  {
1812
1948
  name: "no-disk-state",
@@ -2156,71 +2292,52 @@ var CORE_CHECK_RING = Object.fromEntries(REGISTRY.map(([spec, ring]) => [spec.na
2156
2292
  import { execFile as execFile5 } from "node:child_process";
2157
2293
  import { randomUUID as randomUUID2 } from "node:crypto";
2158
2294
  import {
2159
- closeSync as closeSync4,
2160
- constants as fsConstants4,
2295
+ appendFileSync,
2296
+ closeSync as closeSync5,
2297
+ constants as fsConstants5,
2161
2298
  existsSync as existsSync6,
2162
- fstatSync as fstatSync2,
2163
- mkdirSync as mkdirSync4,
2164
- openSync as openSync4,
2165
- readFileSync as readFileSync5,
2299
+ fstatSync as fstatSync3,
2300
+ mkdirSync as mkdirSync5,
2301
+ lstatSync as lstatSync3,
2302
+ openSync as openSync5,
2303
+ readFileSync as readFileSync6,
2166
2304
  renameSync as renameSync3,
2167
- writeSync as writeSync3
2305
+ writeFileSync as writeFileSync3,
2306
+ writeSync as writeSync4
2168
2307
  } from "node:fs";
2169
2308
  import { hostname as osHostname, homedir as homedir3 } from "node:os";
2170
- import { dirname as dirname6, join as join7 } from "node:path";
2309
+ import { dirname as dirname7, join as join7 } from "node:path";
2171
2310
  import { promisify as promisify5 } from "node:util";
2172
2311
 
2173
2312
  // src/lib/config.ts
2174
- import { execFile as execFile4, execFileSync as execFileSync3 } from "node:child_process";
2313
+ import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
2175
2314
  import { promisify as promisify4 } from "node:util";
2176
- 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";
2177
2316
  import { homedir } from "node:os";
2178
2317
  import { dirname as dirname3, isAbsolute, join as join4, resolve as resolve2 } from "node:path";
2179
- import { z as z4 } from "zod";
2318
+ import { z as z5 } from "zod";
2180
2319
 
2181
2320
  // src/lib/agent-vendors.ts
2182
2321
  var AGENT_VENDORS = ["skills", "claude", "gemini"];
2183
2322
 
2184
- // src/lib/worker-boundary.ts
2185
- import { execFileSync as execFileSync2 } from "node:child_process";
2186
- var LOG_HEADER_KEYCHAIN_SERVICE = "Vinaya Log";
2187
- var logHeaderKeychainCache = new Map;
2188
- function readRealLogHeaderKeychainCredential(variable) {
2189
- if (process.platform !== "darwin")
2190
- return null;
2191
- try {
2192
- return execFileSync2("/usr/bin/security", ["find-generic-password", "-s", LOG_HEADER_KEYCHAIN_SERVICE, "-a", variable, "-w"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 5000, maxBuffer: 1024 * 1024 }).replace(/\n$/, "");
2193
- } catch {
2194
- return null;
2195
- }
2196
- }
2197
- function readLogHeaderKeychainCredential(variable) {
2198
- const cached = logHeaderKeychainCache.get(variable);
2199
- if (cached !== undefined)
2200
- return cached;
2201
- const value = readRealLogHeaderKeychainCredential(variable);
2202
- logHeaderKeychainCache.set(variable, value);
2203
- return value;
2204
- }
2205
-
2206
2323
  // src/lib/config.ts
2207
- var EnvEntrySchema = z4.union([
2208
- z4.literal(true),
2209
- z4.object({ optional: z4.literal(true) }),
2210
- z4.object({ anyOf: z4.array(z4.string()).min(2) }),
2211
- 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()
2212
2329
  ]);
2213
- var CheckEntrySchema = z4.object({
2214
- run: z4.string(),
2215
- scope: z4.enum(["diff", "full"]),
2216
- include: z4.array(z4.string()).optional(),
2217
- args: z4.array(z4.string()).optional(),
2218
- timeoutMs: z4.number().optional(),
2219
- env: z4.record(z4.string(), EnvEntrySchema).optional(),
2220
- requiresOpenPr: z4.boolean().optional(),
2221
- ownWorkflow: z4.boolean().optional(),
2222
- principalOwed: z4.literal(true).optional(),
2223
- 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()
2224
2341
  }).superRefine((entry, ctx) => {
2225
2342
  if (!entry.env)
2226
2343
  return;
@@ -2230,22 +2347,22 @@ var CheckEntrySchema = z4.object({
2230
2347
  const members = value.anyOf;
2231
2348
  if (new Set(members).size !== members.length) {
2232
2349
  ctx.addIssue({
2233
- code: z4.ZodIssueCode.custom,
2350
+ code: z5.ZodIssueCode.custom,
2234
2351
  message: `env.${key}.anyOf has duplicate members`,
2235
2352
  path: ["env", key, "anyOf"]
2236
2353
  });
2237
2354
  }
2238
2355
  if (!members.includes(key)) {
2239
2356
  ctx.addIssue({
2240
- code: z4.ZodIssueCode.custom,
2357
+ code: z5.ZodIssueCode.custom,
2241
2358
  message: `env.${key}.anyOf must include "${key}" itself as a member`,
2242
2359
  path: ["env", key, "anyOf"]
2243
2360
  });
2244
2361
  }
2245
2362
  }
2246
2363
  });
2247
- var RoleEntrySchema = z4.object({
2248
- contract: z4.string().refine((p) => p.includes("/"), {
2364
+ var RoleEntrySchema = z5.object({
2365
+ contract: z5.string().refine((p) => p.includes("/"), {
2249
2366
  message: 'must be a path (contain at least one "/"), not a bare filename'
2250
2367
  })
2251
2368
  });
@@ -2269,17 +2386,17 @@ var BRIEF_BUILTINS = [
2269
2386
  "briefSections",
2270
2387
  "milestoneShape"
2271
2388
  ];
2272
- var BriefSectionSchema = z4.union([
2273
- z4.object({ builtin: z4.enum(BRIEF_BUILTINS) }),
2274
- z4.object({ heading: z4.string().min(1), name: z4.string().optional() }),
2275
- z4.object({ field: z4.string().min(1), name: z4.string().optional() }),
2276
- 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() })
2277
2394
  ]);
2278
- var BriefSchemaSchema = z4.object({
2279
- pr: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
2280
- issue: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
2281
- milestone: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
2282
- 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()
2283
2400
  });
2284
2401
  function isSafeRepoRelPath(p) {
2285
2402
  if (p.length === 0)
@@ -2288,7 +2405,7 @@ function isSafeRepoRelPath(p) {
2288
2405
  return false;
2289
2406
  return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
2290
2407
  }
2291
- var SafeRepoRelPath = z4.string().refine(isSafeRepoRelPath, {
2408
+ var SafeRepoRelPath = z5.string().refine(isSafeRepoRelPath, {
2292
2409
  message: "must be a repo-root-relative path with no `..` segment or absolute root"
2293
2410
  });
2294
2411
  var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
@@ -2298,22 +2415,22 @@ function isCanonicalHookBlockPath(p) {
2298
2415
  var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
2299
2416
  message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
2300
2417
  });
2301
- var ManagedBlockRecordSchema = z4.object({
2418
+ var ManagedBlockRecordSchema = z5.object({
2302
2419
  path: ManagedHookBlockPath,
2303
- marker: z4.string(),
2304
- comment: z4.enum(["hash", "html"])
2420
+ marker: z5.string(),
2421
+ comment: z5.enum(["hash", "html"])
2305
2422
  });
2306
- var ManagedManifestSchema = z4.object({
2307
- version: z4.number().int().positive(),
2308
- files: z4.array(SafeRepoRelPath),
2309
- blocks: z4.array(ManagedBlockRecordSchema),
2310
- labels: z4.array(z4.string()),
2311
- 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()
2312
2429
  });
2313
- var ProjectEntrySchema = z4.object({
2314
- name: z4.string().min(1),
2315
- description: z4.string().min(1).optional(),
2316
- 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()
2317
2434
  });
2318
2435
  function parseTokensCollectDeclaration(value) {
2319
2436
  const m = value.trim().match(/^(\S+)\s+(\S+)$/);
@@ -2324,90 +2441,97 @@ function parseTokensCollectDeclaration(value) {
2324
2441
  return null;
2325
2442
  return { interpreter, script };
2326
2443
  }
2327
- var VinayaConfigSchema = z4.object({
2328
- rings: z4.object({
2329
- ring1_forgeWriteInterception: z4.boolean(),
2330
- ring2_asyncAudits: z4.boolean()
2444
+ var VinayaConfigSchema = z5.object({
2445
+ rings: z5.object({
2446
+ ring1_forgeWriteInterception: z5.boolean(),
2447
+ ring2_asyncAudits: z5.boolean()
2331
2448
  }).optional(),
2332
- checks: z4.record(z4.string(), CheckEntrySchema).optional(),
2333
- roles: z4.record(z4.string(), RoleEntrySchema).optional(),
2449
+ checks: z5.record(z5.string(), CheckEntrySchema).optional(),
2450
+ roles: z5.record(z5.string(), RoleEntrySchema).optional(),
2334
2451
  briefSchema: BriefSchemaSchema.optional(),
2335
2452
  managed: ManagedManifestSchema.optional(),
2336
- principals: z4.array(z4.string()).min(1).optional(),
2337
- releaseActor: z4.string().min(1).optional(),
2338
- ci: z4.object({ setup: z4.string().min(1) }).optional(),
2339
- tokens: z4.object({
2340
- 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, {
2341
2458
  message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
2342
2459
  })
2343
2460
  }).optional(),
2344
- blastRadius: z4.object({ extraDomains: z4.array(z4.string()).optional() }).optional(),
2345
- proseGates: z4.object({
2346
- doctrineRoot: z4.string().min(1).optional(),
2347
- readerFacingPrefix: z4.string().min(1).optional(),
2348
- readerFacingSuffix: z4.string().min(1).optional(),
2349
- legacySlugDir: z4.string().min(1).optional(),
2350
- sourceComments: z4.object({
2351
- globs: z4.array(z4.string().min(1)).optional(),
2352
- allowlist: z4.array(z4.string().min(1)).optional(),
2353
- 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()
2354
2471
  }).optional(),
2355
- specGrandfather: z4.array(z4.string().min(1)).optional(),
2356
- 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), {
2357
2474
  message: "must be a repository-relative path, not an absolute one"
2358
2475
  }).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
2359
2476
  message: "must stay inside the repository — no `..` segment"
2360
2477
  })).optional()
2361
2478
  }).optional(),
2362
- projects: z4.array(ProjectEntrySchema).optional(),
2363
- dispatch: z4.object({
2364
- timeoutMs: z4.number().int().positive().optional(),
2365
- killGraceMs: z4.number().int().positive().optional(),
2366
- agent: z4.enum(["claude", "codex", "gemini"]).optional(),
2367
- 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()
2368
2490
  }).optional(),
2369
- reviewPolicy: z4.object({
2370
- codeReviewThreshold: z4.string().min(1).optional(),
2371
- securityThreshold: z4.string().min(1).optional(),
2372
- maxRounds: z4.number().optional()
2491
+ securityScan: z5.object({
2492
+ command: z5.array(z5.string().min(1)).min(1)
2373
2493
  }).optional(),
2374
- gateCutovers: z4.object({
2375
- objectivesSinceIssue: z4.number().int().nonnegative().optional(),
2376
- briefSectionsSinceIssue: z4.number().int().nonnegative().optional(),
2377
- documentationSinceIssue: z4.number().int().nonnegative().optional(),
2378
- briefRulesSincePr: z4.number().int().nonnegative().optional(),
2379
- 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()
2380
2500
  }).optional(),
2381
- planning: z4.object({
2382
- collisionThreshold: z4.number().int().nonnegative().optional()
2501
+ planning: z5.object({
2502
+ collisionThreshold: z5.number().int().nonnegative().optional()
2383
2503
  }).optional(),
2384
- prePush: z4.object({
2385
- alwaysRun: z4.array(z4.string()).optional()
2504
+ prePush: z5.object({
2505
+ alwaysRun: z5.array(z5.string()).optional()
2386
2506
  }).optional(),
2387
- report: z4.object({
2388
- commandTimeoutMs: z4.number().int().positive().optional()
2507
+ report: z5.object({
2508
+ commandTimeoutMs: z5.number().int().positive().optional()
2389
2509
  }).superRefine((report, ctx) => {
2390
2510
  const commandTimeoutMs = report.commandTimeoutMs;
2391
2511
  if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
2392
2512
  ctx.addIssue({
2393
- code: z4.ZodIssueCode.custom,
2513
+ code: z5.ZodIssueCode.custom,
2394
2514
  path: ["commandTimeoutMs"],
2395
2515
  message: "must be at most 3600000 (1 hour)"
2396
2516
  });
2397
2517
  }
2398
2518
  }).optional(),
2399
- logPublish: z4.unknown().refine((v) => v === undefined, {
2519
+ logPublish: z5.unknown().refine((v) => v === undefined, {
2400
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)"
2401
2521
  }),
2402
- runtimeDir: z4.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
2403
- logs: z4.object({
2404
- folder: z4.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
2405
- url: z4.string().url().optional(),
2406
- 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()
2407
2529
  }).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
2408
2530
  message: "logs: set at most one of folder/url"
2409
2531
  }).refine((v) => v.headers === undefined || v.url !== undefined, {
2410
2532
  message: "logs: headers requires url"
2533
+ }).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
2534
+ message: "logs: readHeaders requires url"
2411
2535
  }).optional()
2412
2536
  });
2413
2537
  var GLOBAL_VINAYA_HOME = join4(homedir(), ".vinaya");
@@ -2417,9 +2541,9 @@ function findLocalConfig() {
2417
2541
  let dir = process.cwd();
2418
2542
  while (true) {
2419
2543
  const candidate = join4(dir, LOCAL_CONFIG_FILENAME);
2420
- if (existsSync4(candidate))
2544
+ if (existsSync3(candidate))
2421
2545
  return candidate;
2422
- if (existsSync4(join4(dir, ".git")))
2546
+ if (existsSync3(join4(dir, ".git")))
2423
2547
  return null;
2424
2548
  const parent = dirname3(dir);
2425
2549
  if (parent === dir)
@@ -2431,7 +2555,7 @@ function configPath() {
2431
2555
  const local = findLocalConfig();
2432
2556
  if (local)
2433
2557
  return local;
2434
- if (existsSync4(GLOBAL_CONFIG_PATH))
2558
+ if (existsSync3(GLOBAL_CONFIG_PATH))
2435
2559
  return GLOBAL_CONFIG_PATH;
2436
2560
  return null;
2437
2561
  }
@@ -2515,17 +2639,12 @@ function resolveTrustAnchorLogsDestination(local, trustAnchorConfig) {
2515
2639
  return "url" in anchored && anchored.url === local.url ? anchored : null;
2516
2640
  return "folder" in anchored && anchored.folder === local.folder ? anchored : null;
2517
2641
  }
2518
- function resolveLogsHeaderValues(headers, env, readKeychain = readLogHeaderKeychainCredential) {
2642
+ function resolveLogsHeaderValues(headers, env) {
2519
2643
  if (!headers)
2520
2644
  return;
2521
2645
  const resolved = {};
2522
2646
  for (const [key, value] of Object.entries(headers)) {
2523
- resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => {
2524
- const fromEnv = env[name];
2525
- if (fromEnv !== undefined)
2526
- return fromEnv;
2527
- return readKeychain(name) ?? "";
2528
- });
2647
+ resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => env[name] ?? "");
2529
2648
  }
2530
2649
  return resolved;
2531
2650
  }
@@ -2534,7 +2653,7 @@ function trustAnchorRepo() {
2534
2653
  if (fromRunner)
2535
2654
  return fromRunner;
2536
2655
  try {
2537
- const url = execFileSync3("git", ["remote", "get-url", "origin"], {
2656
+ const url = execFileSync2("git", ["remote", "get-url", "origin"], {
2538
2657
  encoding: "utf-8",
2539
2658
  stdio: ["ignore", "pipe", "pipe"]
2540
2659
  });
@@ -2581,7 +2700,7 @@ function resolveCiTrustAnchorProbeRef(env = process.env) {
2581
2700
  return ref;
2582
2701
  }
2583
2702
  function readTrustAnchorConfigAtRef(ref) {
2584
- const raw = execFileSync3("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
2703
+ const raw = execFileSync2("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
2585
2704
  encoding: "utf-8",
2586
2705
  stdio: ["ignore", "pipe", "pipe"],
2587
2706
  timeout: 1e4
@@ -2595,7 +2714,7 @@ function ghFetchTrustAnchorConfig() {
2595
2714
  const repo = trustAnchorRepo();
2596
2715
  if (!repo)
2597
2716
  throw new Error("could not resolve repo identity for the trust-anchor read");
2598
- return execFileSync3("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], {
2717
+ return execFileSync2("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], {
2599
2718
  encoding: "utf-8",
2600
2719
  stdio: ["ignore", "pipe", "pipe"]
2601
2720
  });
@@ -2686,8 +2805,8 @@ function loadConfig() {
2686
2805
  var TOKENS_COLLECT_TRUST_PATH = join4(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
2687
2806
 
2688
2807
  // src/lib/run-paths.ts
2689
- import { execFileSync as execFileSync4 } from "node:child_process";
2690
- import { chmodSync, existsSync as existsSync5, realpathSync as realpathSync2 } from "node:fs";
2808
+ import { execFileSync as execFileSync3 } from "node:child_process";
2809
+ import { chmodSync, existsSync as existsSync4, realpathSync as realpathSync2 } from "node:fs";
2691
2810
  import { dirname as dirname4, join as join5, resolve as resolvePath } from "node:path";
2692
2811
  var TASKS_EXECUTION_DIRNAME = "tasks-execution";
2693
2812
  var RUN_AREA_DIRNAMES = {
@@ -2817,7 +2936,7 @@ function repoRootSync(start = process.cwd()) {
2817
2936
  return null;
2818
2937
  }
2819
2938
  for (;; ) {
2820
- if (existsSync5(join5(dir, ".git")))
2939
+ if (existsSync4(join5(dir, ".git")))
2821
2940
  return dir;
2822
2941
  const parent = dirname4(dir);
2823
2942
  if (parent === dir)
@@ -2834,7 +2953,7 @@ function resolveRepoSync() {
2834
2953
  }
2835
2954
  let url;
2836
2955
  try {
2837
- url = execFileSync4("git", ["remote", "get-url", "origin"], {
2956
+ url = execFileSync3("git", ["remote", "get-url", "origin"], {
2838
2957
  encoding: "utf-8",
2839
2958
  stdio: ["ignore", "pipe", "pipe"]
2840
2959
  }).trim();
@@ -2861,25 +2980,62 @@ function ensureRunDir(dir, runtimeDir) {
2861
2980
  chmodSync(dir, 448);
2862
2981
  }
2863
2982
 
2864
- // src/lib/log-webhook-drain.ts
2983
+ // src/lib/loop-log.ts
2865
2984
  import {
2866
2985
  closeSync as closeSync3,
2867
2986
  constants as fsConstants3,
2868
- lstatSync as lstatSync2,
2987
+ existsSync as existsSync5,
2988
+ fstatSync as fstatSync2,
2869
2989
  mkdirSync as mkdirSync3,
2870
2990
  openSync as openSync3,
2871
- linkSync as linkSync2,
2872
2991
  readFileSync as readFileSync4,
2873
- renameSync as renameSync2,
2992
+ readSync,
2874
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,
2875
3031
  unlinkSync as unlinkSync2,
2876
3032
  utimesSync,
2877
3033
  writeFileSync as writeFileSync2,
2878
- writeSync as writeSync2
3034
+ writeSync as writeSync3
2879
3035
  } from "node:fs";
2880
3036
  import { randomUUID } from "node:crypto";
2881
3037
  import { homedir as homedir2 } from "node:os";
2882
- import { dirname as dirname5, join as join6 } from "node:path";
3038
+ import { dirname as dirname6, join as join6 } from "node:path";
2883
3039
  var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
2884
3040
  var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
2885
3041
  var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
@@ -2895,13 +3051,13 @@ function isEnoent(err) {
2895
3051
  var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
2896
3052
  function tryCreateLock(lockPath, token) {
2897
3053
  try {
2898
- mkdirSync3(dirname5(lockPath), { recursive: true, mode: 448 });
2899
- 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);
2900
3056
  try {
2901
- writeSync2(fd, `${token}
3057
+ writeSync3(fd, `${token}
2902
3058
  `);
2903
3059
  } finally {
2904
- closeSync3(fd);
3060
+ closeSync4(fd);
2905
3061
  }
2906
3062
  return true;
2907
3063
  } catch (err) {
@@ -2916,7 +3072,7 @@ function acquireDrainLock(lockPath) {
2916
3072
  return token;
2917
3073
  let observedMtimeMs;
2918
3074
  try {
2919
- observedMtimeMs = statSync2(lockPath).mtimeMs;
3075
+ observedMtimeMs = statSync3(lockPath).mtimeMs;
2920
3076
  } catch (err) {
2921
3077
  if (!isEnoent(err))
2922
3078
  throw err;
@@ -2934,7 +3090,7 @@ function acquireDrainLock(lockPath) {
2934
3090
  }
2935
3091
  let claimedMtimeMs = null;
2936
3092
  try {
2937
- claimedMtimeMs = statSync2(claimed).mtimeMs;
3093
+ claimedMtimeMs = statSync3(claimed).mtimeMs;
2938
3094
  } catch (err) {
2939
3095
  if (!isEnoent(err))
2940
3096
  throw err;
@@ -2960,7 +3116,7 @@ function acquireDrainLock(lockPath) {
2960
3116
  function renewDrainLock(lockPath, token) {
2961
3117
  let holder;
2962
3118
  try {
2963
- holder = readFileSync4(lockPath, "utf8").trim();
3119
+ holder = readFileSync5(lockPath, "utf8").trim();
2964
3120
  } catch (err) {
2965
3121
  if (!isEnoent(err))
2966
3122
  throw err;
@@ -2980,7 +3136,7 @@ function renewDrainLock(lockPath, token) {
2980
3136
  }
2981
3137
  function releaseDrainLock(lockPath, token) {
2982
3138
  try {
2983
- const holder = readFileSync4(lockPath, "utf8").trim();
3139
+ const holder = readFileSync5(lockPath, "utf8").trim();
2984
3140
  if (holder !== token)
2985
3141
  return;
2986
3142
  unlinkSync2(lockPath);
@@ -3030,7 +3186,7 @@ function queueLines(buf) {
3030
3186
  return lines;
3031
3187
  }
3032
3188
  function removeQueueHead(path, cut) {
3033
- const remaining = readFileSync4(path);
3189
+ const remaining = readFileSync5(path);
3034
3190
  writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
3035
3191
  }
3036
3192
  function queueBucketSize(path) {
@@ -3051,7 +3207,7 @@ function queueBucketSize(path) {
3051
3207
  function readQueueFile(path) {
3052
3208
  if (queueBucketSize(path) === null)
3053
3209
  return null;
3054
- return readFileSync4(path);
3210
+ return readFileSync5(path);
3055
3211
  }
3056
3212
  function rejectLine(rejectedPath, reason, status, identity, raw) {
3057
3213
  const record = JSON.stringify({
@@ -3233,13 +3389,19 @@ function logsCredentialMissing(headers, env) {
3233
3389
  const varPattern = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
3234
3390
  for (const value of Object.values(headers)) {
3235
3391
  for (const match of value.matchAll(varPattern)) {
3236
- if (!env[match[1]])
3237
- return true;
3392
+ const name = match[1];
3393
+ if (env[name])
3394
+ continue;
3395
+ return true;
3238
3396
  }
3239
3397
  }
3240
3398
  return false;
3241
3399
  }
3242
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
+ }
3243
3405
  const local = resolveLogsSetting(input.localConfig);
3244
3406
  let effective = null;
3245
3407
  let fallbackReason;
@@ -3279,24 +3441,73 @@ function resolveLogDestinationFrom(input) {
3279
3441
  const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
3280
3442
  return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
3281
3443
  }
3282
- var processTrustAnchorOnce;
3283
- function processTrustAnchor() {
3284
- if (processTrustAnchorOnce === undefined)
3285
- processTrustAnchorOnce = safeLoadTrustAnchorConfig();
3286
- 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;
3287
3452
  }
3288
3453
  async function defaultResolveLogDestination(repo, env) {
3289
3454
  const localConfig = loadConfig();
3290
3455
  const unattended = isUnattendedProcess(process.env);
3456
+ const repoRoot = repoRootSync();
3291
3457
  return resolveLogDestinationFrom({
3292
3458
  localConfig,
3293
- trustAnchorConfig: unattended ? await processTrustAnchor() : null,
3459
+ trustAnchorConfig: unattended ? await processTrustAnchor(repoRoot) : null,
3294
3460
  unattended,
3295
3461
  env,
3296
3462
  defaultFolder: join7(await runtimeDirForRepoAsync(repo), "logs"),
3297
- repoRoot: repoRootSync()
3463
+ repoRoot
3298
3464
  });
3299
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
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 {}
3510
+ }
3300
3511
  function isEnoent2(err) {
3301
3512
  return typeof err === "object" && err !== null && err.code === "ENOENT";
3302
3513
  }
@@ -3409,7 +3620,7 @@ async function resolveBranchIssue(cwd, env = process.env, repo = null) {
3409
3620
  }
3410
3621
  function readVinayaVersion() {
3411
3622
  try {
3412
- 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"));
3413
3624
  return pkg.version ?? "unknown";
3414
3625
  } catch {
3415
3626
  return "unknown";
@@ -3447,6 +3658,7 @@ function defaultStderr(message) {
3447
3658
  }
3448
3659
  var branchIssueFallbackEnabled = true;
3449
3660
  var branchIssueByCwd = new Map;
3661
+ var branchIssueSettledByCwd = new Map;
3450
3662
  function branchIssueRead(key, read, shared) {
3451
3663
  if (!shared)
3452
3664
  return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
@@ -3455,8 +3667,30 @@ function branchIssueRead(key, read, shared) {
3455
3667
  return cached;
3456
3668
  const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
3457
3669
  branchIssueByCwd.set(key, reading);
3670
+ reading.then((value) => branchIssueSettledByCwd.set(key, value));
3671
+ return reading;
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));
3458
3684
  return reading;
3459
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
+ }
3460
3694
  function defaultDeps() {
3461
3695
  return {
3462
3696
  outboxRoot: () => join7(GLOBAL_VINAYA_HOME, "outbox"),
@@ -3471,29 +3705,30 @@ function defaultDeps() {
3471
3705
  inputVersions: () => {
3472
3706
  return;
3473
3707
  },
3474
- resolveLogDestination: defaultResolveLogDestination
3708
+ resolveLogDestination: defaultResolveLogDestination,
3709
+ unresolvedLogDestination
3475
3710
  };
3476
3711
  }
3477
- 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;
3478
3713
  function guardedAppendOpen(path) {
3479
3714
  try {
3480
- return openSync4(path, APPEND_OPEN_FLAGS, 384);
3715
+ return openSync5(path, APPEND_OPEN_FLAGS, 384);
3481
3716
  } catch {
3482
3717
  return;
3483
3718
  }
3484
3719
  }
3485
3720
  function appendHardenedLine(path, line) {
3486
3721
  try {
3487
- mkdirSync4(dirname6(path), { recursive: true, mode: 448 });
3722
+ mkdirSync5(dirname7(path), { recursive: true, mode: 448 });
3488
3723
  const fd = guardedAppendOpen(path);
3489
3724
  if (fd === undefined)
3490
3725
  return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
3491
3726
  try {
3492
- if (!fstatSync2(fd).isFile())
3727
+ if (!fstatSync3(fd).isFile())
3493
3728
  return `target is not a regular file: ${path}`;
3494
- writeSync3(fd, line);
3729
+ writeSync4(fd, line);
3495
3730
  } finally {
3496
- closeSync4(fd);
3731
+ closeSync5(fd);
3497
3732
  }
3498
3733
  return null;
3499
3734
  } catch (err) {
@@ -3503,7 +3738,7 @@ function appendHardenedLine(path, line) {
3503
3738
  function reportRotationOverflow(backupPath, warn) {
3504
3739
  let raw;
3505
3740
  try {
3506
- raw = readFileSync5(backupPath, "utf8");
3741
+ raw = readFileSync6(backupPath, "utf8");
3507
3742
  } catch {
3508
3743
  return;
3509
3744
  }
@@ -3526,7 +3761,7 @@ function reportRotationOverflow(backupPath, warn) {
3526
3761
  }
3527
3762
  function appendLine(path, line, warn) {
3528
3763
  try {
3529
- mkdirSync4(dirname6(path), { recursive: true, mode: 448 });
3764
+ mkdirSync5(dirname7(path), { recursive: true, mode: 448 });
3530
3765
  let fd = guardedAppendOpen(path);
3531
3766
  if (fd === undefined) {
3532
3767
  warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
@@ -3535,14 +3770,14 @@ function appendLine(path, line, warn) {
3535
3770
  }
3536
3771
  let closed = false;
3537
3772
  try {
3538
- const stat = fstatSync2(fd);
3773
+ const stat = fstatSync3(fd);
3539
3774
  if (!stat.isFile()) {
3540
3775
  warn(`vinaya: log outbox target is not a regular file — refusing to write: ${path}
3541
3776
  `);
3542
3777
  return;
3543
3778
  }
3544
3779
  if (stat.size > OUTBOX_MAX_BYTES) {
3545
- closeSync4(fd);
3780
+ closeSync5(fd);
3546
3781
  closed = true;
3547
3782
  const backupPath = path.replace(/\.ndjson$/, ".1.ndjson");
3548
3783
  reportRotationOverflow(backupPath, warn);
@@ -3556,10 +3791,10 @@ function appendLine(path, line, warn) {
3556
3791
  fd = rotated;
3557
3792
  closed = false;
3558
3793
  }
3559
- writeSync3(fd, line);
3794
+ writeSync4(fd, line);
3560
3795
  } finally {
3561
3796
  if (!closed)
3562
- closeSync4(fd);
3797
+ closeSync5(fd);
3563
3798
  }
3564
3799
  } catch (err) {
3565
3800
  warn(`vinaya: log outbox write failed — ${err instanceof Error ? err.message : String(err)}
@@ -3570,12 +3805,14 @@ function createLogSink(overrides = {}) {
3570
3805
  const deps = {
3571
3806
  ...defaultDeps(),
3572
3807
  resolveBranchIssue: (repo) => resolveBranchIssue(deps.cwd(), deps.env(), repo),
3808
+ resolveHeadSha: () => resolveHeadSha(deps.cwd()),
3573
3809
  ...overrides
3574
3810
  };
3575
3811
  const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
3576
3812
  const processId = randomUUID2();
3577
3813
  let seq = 0;
3578
3814
  let warned = false;
3815
+ let folderFallbackRecorded = false;
3579
3816
  const warnOnce = (message) => {
3580
3817
  if (warned)
3581
3818
  return;
@@ -3593,6 +3830,7 @@ function createLogSink(overrides = {}) {
3593
3830
  };
3594
3831
  const readerIsReal = overrides.resolveBranchIssue === undefined;
3595
3832
  let ownBranchIssue;
3833
+ let ownBranchIssueSettled = null;
3596
3834
  const branchIssueOnce = (repo) => {
3597
3835
  if (!branchIssueFallbackEnabled)
3598
3836
  return Promise.resolve(null);
@@ -3600,10 +3838,36 @@ function createLogSink(overrides = {}) {
3600
3838
  const read = () => deps.resolveBranchIssue(slug);
3601
3839
  if (readerIsReal)
3602
3840
  return branchIssueRead(`${deps.cwd()}\x00${slug ?? ""}`, read, true);
3603
- if (ownBranchIssue === undefined)
3841
+ if (ownBranchIssue === undefined) {
3604
3842
  ownBranchIssue = branchIssueRead(deps.cwd(), read, false);
3843
+ ownBranchIssue.then((value) => {
3844
+ ownBranchIssueSettled = value;
3845
+ });
3846
+ }
3605
3847
  return ownBranchIssue;
3606
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;
3607
3871
  let resolveRepoCache;
3608
3872
  const resolveRepoOnce = () => {
3609
3873
  if (resolveRepoCache === undefined)
@@ -3611,6 +3875,7 @@ function createLogSink(overrides = {}) {
3611
3875
  return resolveRepoCache;
3612
3876
  };
3613
3877
  let contextCache;
3878
+ let settledContext;
3614
3879
  const context = () => {
3615
3880
  if (contextCache === undefined) {
3616
3881
  const env = deps.env();
@@ -3619,11 +3884,16 @@ function createLogSink(overrides = {}) {
3619
3884
  doctrine()
3620
3885
  ]).then(async ([resolved, doctrineValue]) => {
3621
3886
  const repo = resolved && isSafeRepoSegment3(resolved.owner) && isSafeRepoSegment3(resolved.repo) ? resolved : null;
3622
- return { repo, doctrine: doctrineValue, destination: await deps.resolveLogDestination(repo, env) };
3887
+ settledContext = { repo, doctrine: doctrineValue, destination: await deps.resolveLogDestination(repo, env) };
3888
+ return settledContext;
3623
3889
  });
3624
3890
  }
3625
3891
  return contextCache;
3626
3892
  };
3893
+ const resetContext = () => {
3894
+ contextCache = undefined;
3895
+ settledContext = undefined;
3896
+ };
3627
3897
  let drainChain = Promise.resolve();
3628
3898
  const pendingWrites = new Set;
3629
3899
  let writeChain = Promise.resolve();
@@ -3635,63 +3905,88 @@ function createLogSink(overrides = {}) {
3635
3905
  `);
3636
3906
  });
3637
3907
  };
3638
- function log(e) {
3639
- try {
3640
- const env = deps.env();
3641
- const host = hostFromEnv(env);
3642
- const now = deps.now();
3643
- const mySeq = seq++;
3644
- 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: {
3645
3915
  role: env.VINAYA_ROLE,
3646
3916
  task: env.VINAYA_TASK,
3647
3917
  round: env.VINAYA_ROUND,
3918
+ pr: env.VINAYA_PR,
3648
3919
  run: env.VINAYA_RUN || runId,
3649
3920
  attempt: env.VINAYA_ATTEMPT,
3650
- parent: env.VINAYA_PARENT_EVENT
3651
- };
3652
- const write = async () => {
3653
- const { repo, doctrine: doctrineValue, destination: resolvedDestination } = await context();
3654
- if (resolvedDestination.kind === "none") {
3655
- 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}
3656
3934
  `);
3657
- return;
3658
- }
3659
- if (resolvedDestination.kind === "folder" && resolvedDestination.fallbackReason) {
3660
- warnOnce(`vinaya: ${describeFolderFallback(resolvedDestination.fallbackReason)}
3935
+ return;
3936
+ }
3937
+ if (destination.kind === "folder" && destination.fallbackReason) {
3938
+ warnOnce(`vinaya: ${describeFolderFallback(destination.fallbackReason)}
3661
3939
  `);
3662
- }
3663
- const branchIssue = envFields.task ? null : await branchIssueOnce(repo);
3664
- const header = buildHeader({
3665
- now,
3666
- runId,
3667
- seq: mySeq,
3668
- repo: repo ? `${repo.owner}/${repo.repo}` : null,
3669
- vinaya: deps.vinayaVersion(),
3670
- doctrine: doctrineValue,
3671
- host,
3672
- hostname: deps.hostname(),
3673
- env: envFields,
3674
- branchIssue,
3675
- eventId: randomUUID2(),
3676
- processId,
3677
- inputVersions: deps.inputVersions()
3678
- });
3679
- const full = { ...e, ...header };
3680
- const parsed = LogEventSchema.safeParse(full);
3681
- if (!parsed.success) {
3682
- 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"}
3683
3965
  `);
3684
- return;
3685
- }
3686
- const line = `${JSON.stringify(redact(parsed.data, deps.home()))}
3966
+ return;
3967
+ }
3968
+ const line = `${JSON.stringify(redact(parsed.data, deps.home()))}
3687
3969
  `;
3688
- const destination = resolvedDestination;
3689
- if (destination.kind === "server") {
3690
- appendLine(outboxPathFor(deps, repo, header.subject.issue), line, warnOnce);
3691
- scheduleWebhookDrain(header.subject.issue, destination.url, destination.headers);
3692
- } else {
3693
- 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;
3694
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);
3695
3990
  };
3696
3991
  const written = writeChain.then(write).catch((err) => {
3697
3992
  warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
@@ -3702,6 +3997,26 @@ function createLogSink(overrides = {}) {
3702
3997
  written.finally(() => pendingWrites.delete(written));
3703
3998
  } catch (err) {
3704
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)}
3705
4020
  `);
3706
4021
  }
3707
4022
  }
@@ -3722,18 +4037,15 @@ function createLogSink(overrides = {}) {
3722
4037
  return;
3723
4038
  });
3724
4039
  };
3725
- return { log, runId, warmup, drain };
4040
+ return { log, logSync, runId, warmup, drain, resetContext };
3726
4041
  }
3727
4042
  var defaultSink = createLogSink();
3728
4043
 
3729
4044
  // src/checks/runner.ts
3730
4045
  var activeChecks = new Map;
3731
4046
 
3732
- // src/lib/loop-log.ts
3733
- var LOOP_LOG_MAX_BYTES = 8 * 1024 * 1024;
3734
-
3735
4047
  // src/lib/brief-assembly.ts
3736
- 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";
3737
4049
  import { join as join8 } from "node:path";
3738
4050
 
3739
4051
  // ../../packages/sources/src/commands.ts
@@ -3890,7 +4202,7 @@ var COMMANDS = [
3890
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.",
3891
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.",
3892
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.",
3893
- "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`)."
3894
4206
  ],
3895
4207
  status: "shipped"
3896
4208
  },
@@ -3975,13 +4287,14 @@ var COMMANDS = [
3975
4287
  },
3976
4288
  {
3977
4289
  flag: "--push",
3978
- 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."
3979
4291
  }
3980
4292
  ],
3981
4293
  details: [
3982
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.",
3983
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.",
3984
- "`--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."
3985
4298
  ],
3986
4299
  status: "shipped"
3987
4300
  },
@@ -4006,7 +4319,7 @@ var COMMANDS = [
4006
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.",
4007
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.",
4008
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.",
4009
- "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."
4010
4323
  ],
4011
4324
  status: "shipped"
4012
4325
  },
@@ -4177,7 +4490,7 @@ var COMMANDS = [
4177
4490
  { flag: "--secrets", description: "security only: the SECRETS line" },
4178
4491
  {
4179
4492
  flag: "--secrets-evidence-file",
4180
- 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'
4181
4494
  },
4182
4495
  { flag: "--task-id", description: "the closing `Tokens:` line's task id" },
4183
4496
  { flag: "--model", description: "the closing `Tokens:` line's model name" },
@@ -4285,7 +4598,20 @@ var COMMANDS = [
4285
4598
  flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
4286
4599
  details: [
4287
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.",
4288
- "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."
4289
4615
  ],
4290
4616
  status: "shipped"
4291
4617
  },
@@ -4429,6 +4755,29 @@ var COMMANDS = [
4429
4755
  ],
4430
4756
  status: "shipped"
4431
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
+ },
4432
4781
  {
4433
4782
  name: "log send",
4434
4783
  description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
@@ -4441,28 +4790,42 @@ var COMMANDS = [
4441
4790
  status: "shipped"
4442
4791
  },
4443
4792
  {
4444
- name: "log set-credential",
4445
- description: "Store a `logs.headers` delivery credential in the macOS login Keychain, read from standard input",
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
+ ],
4446
4802
  details: [
4447
- 'For a `logs.url` server whose `headers` reference a credential by variable name (`{ "authorization": "Bearer ${VINAYA_LOG_TOKEN}" }`) on a host where that variable is not in the process environment — the case an Operator the Claude desktop app starts on macOS hits, since the token lives in an interactive shell file the app never reads. It stores the value so header resolution finds it in the Keychain when the environment does not, with no token copied into any settings file.',
4448
- 'The value is read from STANDARD INPUT, never a command-line argument a `ps` listing could show — `printf %s "$TOKEN" | vinaya log set-credential VINAYA_LOG_TOKEN`. Only the variable NAME, which is not a secret, sits on the command line; the value is stored under the Keychain service `Vinaya Log` keyed by that name. The command prints a confirmation naming the variable and never echoes, returns, or logs the value.',
4449
- "macOS only (Linux keyrings are out of scope); it refuses with a clear message elsewhere. The environment still wins over the Keychain wherever the variable is set, so this changes nothing for a host that already exports it."
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."
4450
4806
  ],
4451
4807
  status: "shipped"
4452
4808
  }
4453
4809
  ];
4454
4810
  // ../../packages/sources/src/select-source.ts
4455
- import { z as z5 } from "zod";
4456
- var StateSourceConfigSchema = z5.discriminatedUnion("kind", [
4457
- z5.object({ kind: z5.literal("forge"), owner: z5.string(), repo: z5.string() }),
4458
- 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() })
4459
4815
  ]);
4460
4816
  // src/checks/edge-resolve.ts
4461
4817
  var issueCache = new Map;
4462
4818
  var siblingTrancheCache = new Map;
4463
4819
 
4464
4820
  // src/commands/doctrine.ts
4821
+ import matter4 from "gray-matter";
4822
+
4823
+ // ../../packages/aeg-core/src/docs/parse-doc.ts
4465
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";
4466
4829
 
4467
4830
  // src/lib/brief-assembly.ts
4468
4831
  var PACKAGE_ROOT = packageRoot(import.meta.url);
@@ -4478,31 +4841,6 @@ var INFORMATIONAL_DISPATCH_BLOCKER_CLASSES = new Set([
4478
4841
  "conflicts-with"
4479
4842
  ]);
4480
4843
 
4481
- // src/lib/dispatch.ts
4482
- var MAX_TEE_BYTES = 8 * 1024 * 1024;
4483
- var CLAUDE_MODEL_ALIASES = new Set(["fable", "opus", "sonnet", "haiku"]);
4484
- 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)";
4485
-
4486
- // src/commands/tokens.ts
4487
- var USAGE = [
4488
- 'Usage: vinaya tokens --phase "<task-id>: develop" --role Developer',
4489
- " [--model <id>] [--transcript <path>] [--in <tokens-in> --out <tokens-out>]",
4490
- "",
4491
- " --transcript Read this transcript directly. Supported primary route — use it whenever you know",
4492
- " which transcript is yours, and always in a repo with no track-transcript.sh hook.",
4493
- " (omitted) Resolve via the Stop-hook pointer file, if this repo installs that hook.",
4494
- " --in/--out Manual entry: the exact token figures, for a host whose usage arrives by some other",
4495
- " means than a Claude Code transcript. Both required together; skips transcript",
4496
- " resolution entirely.",
4497
- "",
4498
- "Usage: vinaya tokens --trust-collect",
4499
- " Approves this repo's declared tokens.collect command, pinned to the script's exact current",
4500
- " content, on this machine. Run this once before tokens.collect will ever execute — a changed",
4501
- " interpreter, script path, or script CONTENT needs its own fresh approval. Does not take",
4502
- " --phase/--role and never emits a Tokens: line."
4503
- ].join(`
4504
- `);
4505
-
4506
4844
  // src/lib/pr-report-engine.ts
4507
4845
  var execFileAsync6 = promisify6(execFile6);
4508
4846
  var BODY_READING_CHECK_NAMES = new Set(coreCheckRegistry().filter((spec) => {
@@ -4512,21 +4850,21 @@ var BODY_READING_CHECK_NAMES = new Set(coreCheckRegistry().filter((spec) => {
4512
4850
  var FAILING_STATUSES = new Set(["fail", "error", "timeout"]);
4513
4851
  function readTestRunCacheFile(path) {
4514
4852
  try {
4515
- if (!lstatSync3(path).isFile())
4853
+ if (!lstatSync4(path).isFile())
4516
4854
  return {};
4517
- return JSON.parse(readFileSync7(path, "utf8"));
4855
+ return JSON.parse(readFileSync8(path, "utf8"));
4518
4856
  } catch {
4519
4857
  return {};
4520
4858
  }
4521
4859
  }
4522
4860
  function writeTestRunCacheFile(path, all) {
4523
4861
  const tmp = `${path}.tmp-${process.pid}-${randomUUID3()}`;
4524
- 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);
4525
4863
  try {
4526
- writeSync4(fd, JSON.stringify(all, null, 2), null, "utf8");
4864
+ writeSync5(fd, JSON.stringify(all, null, 2), null, "utf8");
4527
4865
  fsyncSync2(fd);
4528
4866
  } finally {
4529
- closeSync5(fd);
4867
+ closeSync6(fd);
4530
4868
  }
4531
4869
  renameSync4(tmp, path);
4532
4870
  }
@@ -4536,7 +4874,7 @@ function fileBackedTestRunCache(path, runtimeDir) {
4536
4874
  set: (key, record) => {
4537
4875
  const all = readTestRunCacheFile(path);
4538
4876
  all[key] = record;
4539
- ensureRunDir(dirname7(path), runtimeDir);
4877
+ ensureRunDir(dirname8(path), runtimeDir);
4540
4878
  writeTestRunCacheFile(path, all);
4541
4879
  }
4542
4880
  };
@@ -4578,7 +4916,7 @@ async function collectStateFields(cwd) {
4578
4916
  for (const f of uncommitted) {
4579
4917
  fields.push(f);
4580
4918
  try {
4581
- fields.push(readFileSync7(join9(base, f)));
4919
+ fields.push(readFileSync8(join9(base, f)));
4582
4920
  } catch {
4583
4921
  fields.push("MISSING");
4584
4922
  }
@@ -4676,21 +5014,6 @@ async function recordGreenTestRun(command, output, cwd, source, cache = defaultT
4676
5014
  }
4677
5015
  return true;
4678
5016
  }
4679
- var TOKEN_ROW_REMEDY = [
4680
- "Nothing here established that this host cannot meter — only that this session resolved no",
4681
- "transcript of its own. Report real figures by naming your own transcript:",
4682
- "",
4683
- " vinaya pr report --write <body-file> --transcript <path>",
4684
- "",
4685
- "or, on a host whose usage arrives by some other means, format figures you already hold with:",
4686
- "",
4687
- ' vinaya tokens --phase "<task-id>: develop" --role Developer --in <tokens-in> --out <tokens-out>',
4688
- "",
4689
- "and transcribe them into the `## Token report` table. That command prints a `Tokens:` line, not",
4690
- "a table row — the table takes | Phase | Role | Agent/Model | Tokens in | Tokens out | Cost | Date |,",
4691
- "and a line inside the block that does not start with `|` truncates the table for every row after it."
4692
- ].join(`
4693
- `);
4694
5017
 
4695
5018
  // src/lib/pre-push-cache-test-run.ts
4696
5019
  async function main() {
@@ -4703,7 +5026,7 @@ async function main() {
4703
5026
  }
4704
5027
  let output;
4705
5028
  try {
4706
- output = readFileSync8(logPath, "utf8");
5029
+ output = readFileSync9(logPath, "utf8");
4707
5030
  } catch (err) {
4708
5031
  process.stderr.write(`vinaya pre-push: could not read ${logPath} to cache this run — nothing recorded (${err instanceof Error ? err.message : String(err)}).
4709
5032
  `);