@attalabs/vinaya 0.32.0 → 0.34.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 (218) hide show
  1. package/README.md +1 -1
  2. package/aeg-root/contracts/principal-operator.md +18 -5
  3. package/aeg-root/enforcement.md +1 -1
  4. package/aeg-root/glossary.md +4 -0
  5. package/aeg-root/roles/developer.md +3 -0
  6. package/aeg-root/roles/operator.md +89 -16
  7. package/aeg-root/roles/planner/reference.md +3 -2
  8. package/aeg-root/roles/planner.md +3 -1
  9. package/aeg-root/roles/tranche-archivist.md +1 -0
  10. package/aeg-root/skills/aeg-context-packets/SKILL.md +1 -1
  11. package/aeg-root/skills/aeg-context-packets/examples/operator-start.md +1 -1
  12. package/aeg-root/templates/brief-template.md +9 -7
  13. package/aeg-root/templates/pr-report-template.md +3 -1
  14. package/dist/checks/bin/check-body-bare-digits.js +213 -41
  15. package/dist/checks/bin/check-branch-topology.js +164 -41
  16. package/dist/checks/bin/check-brief-shape.js +219 -46
  17. package/dist/checks/bin/check-changeset-coverage.js +669 -152
  18. package/dist/checks/bin/check-closes-n.js +164 -41
  19. package/dist/checks/bin/check-coherence.js +220 -43
  20. package/dist/checks/bin/check-dead-branch-push.js +159 -40
  21. package/dist/checks/bin/check-dispatch-readiness.js +218 -42
  22. package/dist/checks/bin/check-doc-coverage-push.js +665 -148
  23. package/dist/checks/bin/check-doc-coverage.js +667 -150
  24. package/dist/checks/bin/check-doctrine-no-procedures.js +213 -41
  25. package/dist/checks/bin/check-doctrine-portability.js +666 -149
  26. package/dist/checks/bin/check-evidence-fresh.js +643 -125
  27. package/dist/checks/bin/check-exec-bits.js +663 -146
  28. package/dist/checks/bin/check-first-push-dispatch.js +218 -42
  29. package/dist/checks/bin/check-issue-assignment.js +164 -41
  30. package/dist/checks/bin/check-issue-milestone-attach.js +159 -40
  31. package/dist/checks/bin/check-issue-objectives-numbering.js +685 -41
  32. package/dist/checks/bin/check-issue-parts-coverage.js +159 -40
  33. package/dist/checks/bin/check-issue-surface-globs.js +258 -48
  34. package/dist/checks/bin/check-issue-title-grammar.js +159 -40
  35. package/dist/checks/bin/check-issue-tranche-label.js +159 -40
  36. package/dist/checks/bin/check-main-branch-refusal.js +159 -40
  37. package/dist/checks/bin/check-no-disk-state.js +159 -40
  38. package/dist/checks/bin/check-pr-premise-reassert.js +213 -41
  39. package/dist/checks/bin/check-pr-report-density.js +159 -40
  40. package/dist/checks/bin/check-principal-test-plan-wait.js +159 -40
  41. package/dist/checks/bin/check-quoted-command.js +586 -103
  42. package/dist/checks/bin/check-reader-resolvable-prose.js +637 -111
  43. package/dist/checks/bin/check-registry-gates.js +159 -40
  44. package/dist/checks/bin/check-retired-vocabulary.js +586 -103
  45. package/dist/checks/bin/check-review-gate.js +284 -152
  46. package/dist/checks/bin/check-single-plan-pr.js +159 -40
  47. package/dist/checks/bin/check-surface-scope.js +164 -41
  48. package/dist/checks/bin/check-test-plan.js +159 -40
  49. package/dist/checks/bin/check-token-collection-wired.js +159 -40
  50. package/dist/checks/bin/check-token-report.js +159 -40
  51. package/dist/checks/bin/check-workspace-escape.js +664 -147
  52. package/dist/index.js +3932 -1118
  53. package/dist/lib/pre-push-cache-test-run.js +507 -72
  54. package/dist/lib/pre-push-select-tests.js +136 -13
  55. package/package.json +1 -1
  56. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/actions.ts +10 -12
  57. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +5 -5
  58. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/archive-task.ts +42 -17
  59. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/baseline-capture.ts +1 -2
  60. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/branch-topology-gate.ts +3 -3
  61. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +554 -95
  62. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +264 -44
  63. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/claude-code-transcript.ts +9 -9
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +211 -30
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/consumer-enumeration.ts +2 -2
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +75 -0
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +961 -0
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/migration.ts +222 -0
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/outcomes.ts +135 -0
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +394 -0
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-audit.ts +1 -2
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-guard.ts +1 -1
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/derive-section7.ts +2 -2
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +514 -0
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +110 -0
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +30 -0
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +219 -0
  78. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +97 -0
  79. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +240 -0
  80. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/diagram-model.ts +1 -1
  81. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/direct-main-push.ts +1 -2
  82. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +65 -22
  83. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +238 -0
  84. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-owners.ts +14 -1
  85. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/docs-coherence.ts +1 -1
  86. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/legacy-anchors.ts +1 -1
  87. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/node-route.ts +1 -1
  88. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/surfaced-manifest.ts +1 -1
  89. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-no-procedures.ts +1 -1
  90. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +5 -5
  91. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ensure-label.ts +1 -1
  92. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/first-push-dispatch-gate.ts +1 -1
  93. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +14 -3
  94. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +425 -11
  95. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +3 -4
  96. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +1450 -33
  97. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +1 -2
  98. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/local-anchor-coverage.ts +2 -2
  99. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +119 -0
  100. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +75 -0
  101. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/redact.ts +87 -0
  102. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +801 -0
  103. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +373 -0
  104. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +2 -2
  105. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/metering-io-guard.ts +1 -1
  106. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/milestone-validation.ts +2 -3
  107. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/no-disk-state.ts +2 -2
  108. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives.ts +288 -0
  109. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-token-report.ts +3 -3
  110. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-tranche.ts +1 -1
  111. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +30 -16
  112. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-tier.ts +17 -1
  113. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/premise-check.ts +1 -1
  114. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/quoted-command.ts +1 -1
  115. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +267 -19
  116. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +91 -24
  117. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-scaffold.ts +6 -6
  118. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/report-tokens.ts +4 -4
  119. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +254 -110
  120. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +384 -0
  121. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +208 -0
  122. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +80 -28
  123. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +92 -0
  124. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/single-plan-pr.ts +4 -4
  125. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/state-machine-model.ts +40 -27
  126. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/symbol-collisions.ts +2 -2
  127. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +38 -0
  128. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-phase-history.ts +194 -0
  129. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +712 -0
  130. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +7 -9
  131. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-section.ts +5 -5
  132. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/types.ts +4 -4
  133. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +368 -56
  134. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +2 -3
  135. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/workspace-escape.ts +3 -3
  136. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  137. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  138. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  143. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  146. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +1 -1
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +1 -1
  151. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  152. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  153. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  154. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  155. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +1 -1
  156. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  157. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  158. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  159. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +1 -1
  160. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  161. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  162. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  163. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +1 -1
  164. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  165. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  166. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  167. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +2 -2
  168. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  169. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  170. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  171. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +1 -1
  172. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  173. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  174. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  175. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +1 -1
  176. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  177. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  178. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  179. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +1 -1
  180. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  181. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  182. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/{[externals]__1agj1ww._.js → [externals]__0cki-x_._.js} +2 -2
  183. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +6 -6
  184. 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
  185. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +3 -0
  186. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0r7e54g._.js → [root-of-the-server]__07uhu5z._.js} +1 -1
  187. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  188. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  189. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
  190. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1r47dr7._.js → _08onyya._.js} +3 -3
  191. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  192. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  193. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  194. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  195. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +1 -1
  196. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  197. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  198. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_15gdg48._.js +5 -5
  199. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  200. 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
  201. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  202. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  203. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  204. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  205. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +1 -0
  206. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +1 -0
  207. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1dc2_-c_gavj1.js → 0q9p7c6vn-x2w.js} +4 -4
  208. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3xg6-flovrcx-.js → 2174nz5he_oc4.js} +1 -1
  209. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3xnma0-359j17.js +1 -0
  210. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  211. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0hstap0._.js +0 -3
  212. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bm4nrrzwc7zi.css +0 -1
  213. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2t_rfsztmwu6y.js +0 -1
  214. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3ua4rm5f-a9k6.js +0 -1
  215. /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/{aeg-core → vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core}/bin/verify-coherence.ts +0 -0
  216. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_buildManifest.js +0 -0
  217. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_clientMiddlewareManifest.js +0 -0
  218. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → HmoeqXdX1E4drt7GReFOO}/_ssgManifest.js +0 -0
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/checks/bin/check-exec-bits.ts
4
- import { execFileSync as execFileSync6 } from "node:child_process";
5
- import { readFileSync as readFileSync6 } from "node:fs";
4
+ import { execFileSync as execFileSync7 } from "node:child_process";
5
+ import { readFileSync as readFileSync7 } from "node:fs";
6
6
 
7
7
  // src/checks/contract.ts
8
8
  var CHECK_SCHEMA_VERSION = 1;
@@ -12,8 +12,8 @@ function emitCheckError(error) {
12
12
  }
13
13
 
14
14
  // src/lib/diff-evidence.ts
15
- import { execFileSync as execFileSync5 } from "node:child_process";
16
- import { join as join8, relative, resolve as resolve2 } from "node:path";
15
+ import { execFileSync as execFileSync6 } from "node:child_process";
16
+ import { join as join9, relative, resolve as resolve2 } from "node:path";
17
17
  // ../../packages/aeg-core/src/gate-audience.ts
18
18
  var GATE_AUDIENCE = {
19
19
  "check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
@@ -208,8 +208,8 @@ function maskIndentedCode(body, fill) {
208
208
  var SECTION_HEADER = /\*\*Dependency rationale\*\*/i;
209
209
  var NEXT_HEADER = /\*\*[A-Z][^*]*\*\*/;
210
210
  var FIELD_LABEL = /^(Depends-on|Conflicts-with)\s*:\s*(.*)$/i;
211
- var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d+[a-z]?$/i;
212
- var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+[a-z]?)$/i;
211
+ var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d+$/i;
212
+ var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+)$/i;
213
213
  function splitSlugQualifiedEdge(edge) {
214
214
  const m = edge.trim().match(SLUG_QUALIFIED_ID);
215
215
  if (!m)
@@ -2057,12 +2057,24 @@ function extractBaseSha(comment) {
2057
2057
  const m = firstThirteenLines(comment).match(BASE_SHA_PATTERN);
2058
2058
  return m ? m[1].toLowerCase() : null;
2059
2059
  }
2060
- var FINDING_SEVERITY_LINE = /^\d+\.\s+\[([A-Z][A-Z]*)\]\s+(.+?)\s+—/gm;
2060
+ var FINDING_DESCRIPTION_STATE = /^F(\d+)(?:\s+\S+)?(?:\s+(open|fix-claimed|reproduced|resolved))?:/;
2061
+ function parseFindingState(description) {
2062
+ const m = FINDING_DESCRIPTION_STATE.exec(description.trim());
2063
+ if (!m)
2064
+ return { id: null, state: null };
2065
+ return { id: `F${m[1]}`, state: m[2] ?? null };
2066
+ }
2067
+ var FINDING_SEVERITY_LINE = /^\d+\.\s+\[([A-Z][A-Z]*)\]\s+(.+?)\s+—(?:\s+(.*))?$/gm;
2061
2068
  function extractFindingSeverities(comment) {
2062
- return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) => ({
2063
- severity: m[1],
2064
- location: m[2]
2065
- }));
2069
+ return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) => {
2070
+ const { id, state } = parseFindingState(m[3] ?? "");
2071
+ return {
2072
+ severity: m[1],
2073
+ location: m[2],
2074
+ id,
2075
+ state
2076
+ };
2077
+ });
2066
2078
  }
2067
2079
  function extractVerdict(comments, valuePattern, missingLabel) {
2068
2080
  const candidates = comments.filter((c) => valuePattern.test(c));
@@ -2476,6 +2488,12 @@ function evaluateReviewFindings(findings, scale, threshold) {
2476
2488
  });
2477
2489
  return { outcome: blockingFindings.length > 0 ? "blocked" : "clean", blockingFindings };
2478
2490
  }
2491
+ function isConsequentialFinding(finding) {
2492
+ return finding.state !== "resolved";
2493
+ }
2494
+ function consequentialFindings(findings) {
2495
+ return findings.filter((f) => isConsequentialFinding(f));
2496
+ }
2479
2497
  function evaluateCodeReview(findings, policy) {
2480
2498
  return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold);
2481
2499
  }
@@ -2612,7 +2630,7 @@ function isIssueNotFoundError(err) {
2612
2630
  return /could not resolve to an (?:issue|pull request)|\b404\b|not found/i.test(haystack);
2613
2631
  }
2614
2632
  function resolveObjectivesSource(prBody, issue, cutoverIssue) {
2615
- if (issue !== null && issue < cutoverIssue)
2633
+ if (issue !== null && cutoverIssue !== null && issue < cutoverIssue)
2616
2634
  return { kind: "none" };
2617
2635
  if (issue !== null)
2618
2636
  return { kind: "issue", issue };
@@ -2888,9 +2906,18 @@ var COMMIT_TYPES = [
2888
2906
  ];
2889
2907
  var COMMIT_TYPE_STYLE = new RegExp(`^(${COMMIT_TYPES.join("|")})(\\([a-z0-9-]+\\))?: \\S`);
2890
2908
  function checkForgeTitle(title) {
2891
- const taskStyle = /^\[[a-z0-9._-]+\] \S+ — \S/;
2909
+ const taskStyle = /^\[[a-z0-9._-]+\] \d+ — \S/;
2892
2910
  if (COMMIT_TYPE_STYLE.test(title) || taskStyle.test(title))
2893
2911
  return { status: "pass", errors: [] };
2912
+ const letteredTaskId = /^\[[a-z0-9._-]+\] (\S+) — \S/.exec(title);
2913
+ if (letteredTaskId) {
2914
+ return {
2915
+ status: "fail",
2916
+ errors: [
2917
+ `brief-validation title: "${title}" names task id \`${letteredTaskId[1]}\` — task ids are whole numbers (\`1\`, \`2\`), never lettered (\`2a\`). \`vinaya task run\` and \`task dispatch\` refuse a non-numeric id, so a plan titled this way names a task that cannot be started.`
2918
+ ]
2919
+ };
2920
+ }
2894
2921
  return {
2895
2922
  status: "fail",
2896
2923
  errors: [
@@ -2923,19 +2950,31 @@ function checkNoAgentBoxes(prBody) {
2923
2950
  ]
2924
2951
  };
2925
2952
  }
2926
- function rolloutThresholdFor(message) {
2953
+ function rolloutRuleFor(message) {
2927
2954
  if (message.startsWith("brief-validation unpinned code claim:") || message.startsWith("brief-validation commands carry output:") || message.startsWith("brief-validation consumer tests:") || message.startsWith("brief-validation defeat cases:")) {
2928
- return BRIEF_RULES_SINCE_PR;
2955
+ return "briefRules";
2929
2956
  }
2930
2957
  if (message.startsWith("brief-validation no agent boxes:"))
2931
- return AGENT_BOXES_REFUSED_SINCE_PR;
2958
+ return "agentBoxes";
2959
+ return null;
2960
+ }
2961
+ var DEFAULT_BRIEF_ROLLOUT_CUTOVERS = {
2962
+ briefRulesSincePr: BRIEF_RULES_SINCE_PR,
2963
+ agentBoxesRefusedSincePr: AGENT_BOXES_REFUSED_SINCE_PR
2964
+ };
2965
+ function rolloutThresholdFor(message, cutovers) {
2966
+ const rule = rolloutRuleFor(message);
2967
+ if (rule === "briefRules")
2968
+ return cutovers.briefRulesSincePr;
2969
+ if (rule === "agentBoxes")
2970
+ return cutovers.agentBoxesRefusedSincePr;
2932
2971
  return null;
2933
2972
  }
2934
- function partitionBriefErrorsByRollout(errors, prNumber) {
2973
+ function partitionBriefErrorsByRollout(errors, prNumber, cutovers = DEFAULT_BRIEF_ROLLOUT_CUTOVERS) {
2935
2974
  const blocking = [];
2936
2975
  const info = [];
2937
2976
  for (const e of errors) {
2938
- const threshold = rolloutThresholdFor(e);
2977
+ const threshold = rolloutThresholdFor(e, cutovers);
2939
2978
  const grandfathered = threshold !== null && prNumber !== null && prNumber < threshold;
2940
2979
  (grandfathered ? info : blocking).push(e);
2941
2980
  }
@@ -3403,8 +3442,8 @@ function checkIssueRationale(body) {
3403
3442
  return { status: errors.length > 0 ? "fail" : "pass", errors };
3404
3443
  }
3405
3444
  var OBJECTIVES_SINCE_ISSUE = 404;
3406
- function checkIssueObjectives(body, issueNumber) {
3407
- if (issueNumber !== null && issueNumber < OBJECTIVES_SINCE_ISSUE)
3445
+ function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
3446
+ if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
3408
3447
  return { status: "pass", errors: [] };
3409
3448
  const result = objectivesOf(body);
3410
3449
  if (result.ok)
@@ -3849,7 +3888,7 @@ function resolveDepEntry(dep, trancheSlug, issueToEntry, taskToEntry) {
3849
3888
  return issueToEntry.get(Number(issueMatch[1]));
3850
3889
  return taskToEntry.get(`${trancheSlug}/${dep}`) ?? taskToEntry.get(dep);
3851
3890
  }
3852
- function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
3891
+ function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = [], objectivesSinceIssue) {
3853
3892
  const failures = [];
3854
3893
  for (const [slug, issues] of issuesBySlug) {
3855
3894
  for (const issue of issues) {
@@ -3858,7 +3897,7 @@ function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
3858
3897
  const errors = [
3859
3898
  ...checkIssueRationale(issue.body).errors,
3860
3899
  ...checkProjectsRegistered(issue.body, issue.labels, registeredNames).errors,
3861
- ...checkIssueObjectives(issue.body, issue.number).errors,
3900
+ ...checkIssueObjectives(issue.body, issue.number, objectivesSinceIssue).errors,
3862
3901
  ...checkPartsCiteDefinedObjectives(issue.body).errors
3863
3902
  ];
3864
3903
  if (errors.length === 0)
@@ -4108,8 +4147,8 @@ function checkReviewGate(input) {
4108
4147
  let codeReviewPolicyEvaluation;
4109
4148
  let securityPolicyEvaluation;
4110
4149
  try {
4111
- codeReviewPolicyEvaluation = evaluateCodeReview(codeReview.findingSeverities, policy);
4112
- securityPolicyEvaluation = evaluateSecurityReview(security.findingSeverities, policy);
4150
+ codeReviewPolicyEvaluation = evaluateCodeReview(consequentialFindings(codeReview.findingSeverities), policy);
4151
+ securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy);
4113
4152
  } catch (err) {
4114
4153
  return {
4115
4154
  verdict: "fail",
@@ -4481,13 +4520,27 @@ var SHIPS_PREFIX = "aeg-root/";
4481
4520
  function shipsArchivePrefix(shipsPrefix) {
4482
4521
  return `${shipsPrefix}tranches/completed/`;
4483
4522
  }
4484
- function isSpecFile2(path) {
4485
- return path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md");
4523
+ var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
4524
+ function normalizeSpecPath(entry) {
4525
+ let out = entry.replace(/\\/g, "/");
4526
+ while (out.startsWith("./"))
4527
+ out = out.slice(2);
4528
+ out = out.replace(/\/{2,}/g, "/");
4529
+ while (out.endsWith("/"))
4530
+ out = out.slice(0, -1);
4531
+ return out;
4532
+ }
4533
+ function isSpecFile2(path, specPaths) {
4534
+ if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
4535
+ return true;
4536
+ if (!path.endsWith(".md"))
4537
+ return false;
4538
+ return specPaths.some((entry) => isUnderOrEqual(path, normalizeSpecPath(entry)));
4486
4539
  }
4487
4540
  function isClaudeMdFile(path) {
4488
4541
  return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
4489
4542
  }
4490
- function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
4543
+ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
4491
4544
  if (path.startsWith(shipsPrefix)) {
4492
4545
  return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
4493
4546
  }
@@ -4496,7 +4549,7 @@ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPr
4496
4549
  }
4497
4550
  if (isClaudeMdFile(path))
4498
4551
  return "internal";
4499
- if (isSpecFile2(path))
4552
+ if (isSpecFile2(path, specPaths))
4500
4553
  return "spec";
4501
4554
  if (isProductScopeFile(path))
4502
4555
  return "product";
@@ -4525,13 +4578,14 @@ function lineAt(content, index) {
4525
4578
  }
4526
4579
  var FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g;
4527
4580
  var TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g;
4581
+ var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
4528
4582
  function legacySlugPattern(legacySlugs) {
4529
4583
  if (legacySlugs.length === 0)
4530
4584
  return null;
4531
4585
  const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
4532
4586
  return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
4533
4587
  }
4534
- function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
4588
+ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
4535
4589
  const findings = [];
4536
4590
  const legacyPattern = legacySlugPattern(legacySlugs);
4537
4591
  const grandfathered = new Set(specGrandfather);
@@ -4543,8 +4597,12 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
4543
4597
  const productPatterns = [
4544
4598
  { pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
4545
4599
  ];
4600
+ const specPatterns = [
4601
+ ...patterns,
4602
+ { pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
4603
+ ];
4546
4604
  for (const file of files) {
4547
- const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
4605
+ const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
4548
4606
  if (!cls || cls === "internal")
4549
4607
  continue;
4550
4608
  if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
@@ -4553,15 +4611,16 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
4553
4611
  continue;
4554
4612
  const blocking = cls === "product" || cls === "spec";
4555
4613
  const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
4556
- const patternsToRun = cls === "product" ? productPatterns : patterns;
4614
+ const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
4557
4615
  for (const { pattern, what, group } of patternsToRun) {
4558
4616
  pattern.lastIndex = 0;
4559
4617
  let match = pattern.exec(scrubbed);
4560
4618
  while (match !== null) {
4561
4619
  const cited = group !== undefined ? match[group] ?? match[0] : match[0];
4620
+ const citedIndex = match.index + match[0].indexOf(cited);
4562
4621
  findings.push({
4563
4622
  file: file.path,
4564
- line: lineAt(scrubbed, match.index),
4623
+ line: lineAt(scrubbed, citedIndex),
4565
4624
  message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
4566
4625
  blocking
4567
4626
  });
@@ -4747,9 +4806,9 @@ function checkSourceComments(files, allowlist = []) {
4747
4806
  }
4748
4807
  return findings;
4749
4808
  }
4750
- function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = []) {
4809
+ function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
4751
4810
  return [
4752
- ...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather),
4811
+ ...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
4753
4812
  ...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
4754
4813
  ];
4755
4814
  }
@@ -5190,15 +5249,32 @@ var ObservedSchema = z.object({
5190
5249
  var TaskStatusInputSchema = z.object({
5191
5250
  task: TaskToolRefSchema.optional()
5192
5251
  }).merge(PageRequestSchema).strict();
5252
+ var TaskConfidenceSchema = z.object({
5253
+ round: z.number().int().positive(),
5254
+ percent: z.number().int().min(0).max(100).nullable(),
5255
+ source: z.enum(["stated", "published-summary"])
5256
+ }).strict();
5257
+ var TaskPhaseHistorySchema = z.object({
5258
+ typicalPhaseMinutes: z.number().nonnegative(),
5259
+ typicalPhaseSamples: z.number().int().positive()
5260
+ }).strict();
5193
5261
  var TaskStatusItemSchema = z.object({
5194
5262
  task: TaskToolRefSchema,
5195
5263
  issue: z.number().int().positive(),
5196
5264
  pr: z.number().int().positive().nullable(),
5197
- state: z.string()
5265
+ state: z.string(),
5266
+ round: z.number().int().positive().nullable().optional(),
5267
+ phase: z.string().min(1).nullable().optional(),
5268
+ minutesInPhase: z.number().nonnegative().nullable().optional(),
5269
+ phaseIsCurrent: z.boolean().nullable().optional(),
5270
+ lastConfidence: TaskConfidenceSchema.nullable().optional(),
5271
+ lastConfidenceUnread: z.boolean().optional(),
5272
+ phaseHistory: TaskPhaseHistorySchema.nullable().optional()
5198
5273
  }).merge(ObservedSchema);
5199
5274
  var TaskStatusResultSchema = z.object({
5200
5275
  items: z.array(TaskStatusItemSchema),
5201
- nextCursor: z.string().nullable()
5276
+ nextCursor: z.string().nullable(),
5277
+ table: z.string()
5202
5278
  });
5203
5279
  var RequestedAuthoritySchema = z.enum(["planner", "principal", "operator", "self"]);
5204
5280
  var EscalationInputsSchema = z.object({
@@ -5206,7 +5282,7 @@ var EscalationInputsSchema = z.object({
5206
5282
  round: z.number().int().nonnegative(),
5207
5283
  head: z.string(),
5208
5284
  branch: z.string(),
5209
- prNumber: z.number().int().positive()
5285
+ prNumber: z.number().int().positive().nullable()
5210
5286
  });
5211
5287
  var EscalationEvidenceSchema = z.object({
5212
5288
  round: z.number().int().nonnegative(),
@@ -5242,13 +5318,45 @@ var TaskEscalationReadResultSchema = z.object({
5242
5318
  items: z.array(TaskEscalationPacketSchema),
5243
5319
  nextCursor: z.string().nullable()
5244
5320
  }).merge(ObservedSchema);
5245
- var TaskStartInputSchema = z.object({
5246
- tranche: z.string().min(1),
5247
- id: z.string().min(1)
5321
+ var TaskPrCheckSchema = z.object({
5322
+ name: z.string(),
5323
+ required: z.boolean(),
5324
+ status: z.string(),
5325
+ conclusion: z.string().nullable(),
5326
+ detailsUrl: z.string().nullable(),
5327
+ failureSummary: z.string().nullable()
5328
+ });
5329
+ var TaskPrVerdictSchema = z.object({
5330
+ role: z.enum(["code-review", "security"]),
5331
+ value: z.string(),
5332
+ judgedHead: z.string().nullable(),
5333
+ objectivesVersion: z.string().nullable()
5334
+ });
5335
+ var TaskPrPauseSchema = z.object({
5336
+ reason: z.string(),
5337
+ body: z.string()
5338
+ });
5339
+ var TaskPrReviewRecordSchema = z.object({
5340
+ verdicts: z.array(TaskPrVerdictSchema),
5341
+ roundMarkers: z.array(z.number().int().nonnegative()),
5342
+ summaryTable: z.string().nullable(),
5343
+ pause: TaskPrPauseSchema.nullable()
5344
+ });
5345
+ var TaskPrReadInputSchema = z.object({
5346
+ task: TaskToolRefSchema,
5347
+ pr: z.number().int().positive().optional()
5248
5348
  }).strict();
5349
+ var TaskPrReadResultSchema = z.object({
5350
+ task: TaskToolRefSchema,
5351
+ issue: z.number().int().positive(),
5352
+ pr: z.number().int().positive(),
5353
+ head: z.string().nullable(),
5354
+ checks: z.array(TaskPrCheckSchema),
5355
+ review: TaskPrReviewRecordSchema
5356
+ }).merge(ObservedSchema);
5249
5357
  var TaskStartResultSchema = z.object({
5250
5358
  requestId: z.string().min(1),
5251
- run: z.object({ tranche: z.string().min(1), id: z.string().min(1) }),
5359
+ run: TaskToolRefSchema,
5252
5360
  started: z.boolean(),
5253
5361
  startedAt: z.string(),
5254
5362
  mode: z.literal("attended")
@@ -5262,7 +5370,7 @@ var TaskCancelInputSchema = z.object({
5262
5370
  }).strict();
5263
5371
  var TaskResumeResultSchema = z.object({
5264
5372
  task: z.number().int().positive(),
5265
- pr: z.number().int().positive(),
5373
+ pr: z.number().int().positive().nullable(),
5266
5374
  escalationId: z.string().min(1),
5267
5375
  outcome: z.enum(["started", "already_resumed"]),
5268
5376
  authenticatedBy: z.string().min(1),
@@ -5271,7 +5379,7 @@ var TaskResumeResultSchema = z.object({
5271
5379
  var TaskCancelOutcomeSchema = z.enum(["confirmed", "pending", "uncertain"]);
5272
5380
  var TaskCancelResultSchema = z.object({
5273
5381
  task: z.number().int().positive(),
5274
- pr: z.number().int().positive(),
5382
+ pr: z.number().int().positive().nullable(),
5275
5383
  escalationId: z.string().min(1),
5276
5384
  outcome: TaskCancelOutcomeSchema,
5277
5385
  authenticatedBy: z.string().min(1),
@@ -5282,6 +5390,7 @@ var TASK_TOOL_NAMES = [
5282
5390
  "task_start",
5283
5391
  "task_status",
5284
5392
  "task_escalation_read",
5393
+ "task_pr_read",
5285
5394
  "task_resume",
5286
5395
  "task_cancel"
5287
5396
  ];
@@ -5509,6 +5618,14 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
5509
5618
  }
5510
5619
  return findings;
5511
5620
  }
5621
+ // ../../packages/aeg-core/src/gate-cutovers.ts
5622
+ var NO_GATE_CUTOVERS = {
5623
+ objectivesSinceIssue: null,
5624
+ briefSectionsSinceIssue: null,
5625
+ documentationSinceIssue: null,
5626
+ briefRulesSincePr: null,
5627
+ agentBoxesRefusedSincePr: null
5628
+ };
5512
5629
  // ../../packages/aeg-core/src/dev-review-loop/types.ts
5513
5630
  var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
5514
5631
  // ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
@@ -5958,6 +6075,8 @@ function attemptFromEnv(value) {
5958
6075
  function provenanceFor(input) {
5959
6076
  if (input.provenance)
5960
6077
  return input.provenance;
6078
+ if (issueFromTask(input.env.task) === null && (input.branchIssue ?? null) !== null)
6079
+ return "unavailable";
5961
6080
  if (input.env.role || input.env.task)
5962
6081
  return "env_correlated";
5963
6082
  return "unavailable";
@@ -5978,7 +6097,7 @@ function buildHeader(input) {
5978
6097
  const role = isRole(input.env.role) ? input.env.role : "unattributed";
5979
6098
  const round = roundFromEnv(input.env.round);
5980
6099
  const subject = {
5981
- issue: issueFromTask(input.env.task),
6100
+ issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
5982
6101
  role,
5983
6102
  ...round !== undefined ? { round } : {},
5984
6103
  ...input.subject ?? {}
@@ -6418,7 +6537,12 @@ var VinayaConfigSchema = z4.object({
6418
6537
  allowlist: z4.array(z4.string().min(1)).optional(),
6419
6538
  severity: z4.enum(["warning", "error"]).optional()
6420
6539
  }).optional(),
6421
- specGrandfather: z4.array(z4.string().min(1)).optional()
6540
+ specGrandfather: z4.array(z4.string().min(1)).optional(),
6541
+ specPaths: z4.array(z4.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
6542
+ message: "must be a repository-relative path, not an absolute one"
6543
+ }).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
6544
+ message: "must stay inside the repository — no `..` segment"
6545
+ })).optional()
6422
6546
  }).optional(),
6423
6547
  projects: z4.array(ProjectEntrySchema).optional(),
6424
6548
  dispatch: z4.object({
@@ -6432,6 +6556,13 @@ var VinayaConfigSchema = z4.object({
6432
6556
  securityThreshold: z4.string().min(1).optional(),
6433
6557
  maxRounds: z4.number().optional()
6434
6558
  }).optional(),
6559
+ gateCutovers: z4.object({
6560
+ objectivesSinceIssue: z4.number().int().nonnegative().optional(),
6561
+ briefSectionsSinceIssue: z4.number().int().nonnegative().optional(),
6562
+ documentationSinceIssue: z4.number().int().nonnegative().optional(),
6563
+ briefRulesSincePr: z4.number().int().nonnegative().optional(),
6564
+ agentBoxesRefusedSincePr: z4.number().int().nonnegative().optional()
6565
+ }).optional(),
6435
6566
  prePush: z4.object({
6436
6567
  alwaysRun: z4.array(z4.string()).optional()
6437
6568
  }).optional(),
@@ -6569,6 +6700,18 @@ function resolveReviewPolicy(config) {
6569
6700
  maxRounds
6570
6701
  };
6571
6702
  }
6703
+ function resolveGateCutovers(config) {
6704
+ const raw = config?.gateCutovers;
6705
+ if (!raw)
6706
+ return NO_GATE_CUTOVERS;
6707
+ return {
6708
+ objectivesSinceIssue: raw.objectivesSinceIssue ?? null,
6709
+ briefSectionsSinceIssue: raw.briefSectionsSinceIssue ?? null,
6710
+ documentationSinceIssue: raw.documentationSinceIssue ?? null,
6711
+ briefRulesSincePr: raw.briefRulesSincePr ?? null,
6712
+ agentBoxesRefusedSincePr: raw.agentBoxesRefusedSincePr ?? null
6713
+ };
6714
+ }
6572
6715
  function resolveRuntimeDirSetting(config) {
6573
6716
  return config?.runtimeDir ?? null;
6574
6717
  }
@@ -6643,7 +6786,28 @@ function trustAnchorRepoFromRemoteUrl(url) {
6643
6786
  return m?.[1] && m[2] ? wellFormedRepoSlug(`${m[1]}/${m[2]}`) : null;
6644
6787
  }
6645
6788
  var execFileAsync4 = promisify4(execFile4);
6789
+ function resolveCiTrustAnchorProbeRef(env = process.env) {
6790
+ const ref = env.VINAYA_CI_CONFIG_PROBE_REF?.trim();
6791
+ if (!ref)
6792
+ return null;
6793
+ if (env.GITHUB_ACTIONS !== "true")
6794
+ return null;
6795
+ if ((env.GH_TOKEN ?? "").length > 0 || (env.GITHUB_TOKEN ?? "").length > 0)
6796
+ return null;
6797
+ return ref;
6798
+ }
6799
+ function readTrustAnchorConfigAtRef(ref) {
6800
+ const raw = execFileSync2("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
6801
+ encoding: "utf-8",
6802
+ stdio: ["ignore", "pipe", "pipe"],
6803
+ timeout: 1e4
6804
+ });
6805
+ return Buffer.from(raw, "utf-8").toString("base64");
6806
+ }
6646
6807
  function ghFetchTrustAnchorConfig() {
6808
+ const probeRef = resolveCiTrustAnchorProbeRef();
6809
+ if (probeRef)
6810
+ return readTrustAnchorConfigAtRef(probeRef);
6647
6811
  const repo = trustAnchorRepo();
6648
6812
  if (!repo)
6649
6813
  throw new Error("could not resolve repo identity for the trust-anchor read");
@@ -6653,6 +6817,14 @@ function ghFetchTrustAnchorConfig() {
6653
6817
  });
6654
6818
  }
6655
6819
  async function ghFetchTrustAnchorConfigAsync() {
6820
+ const probeRef = resolveCiTrustAnchorProbeRef();
6821
+ if (probeRef) {
6822
+ const { stdout } = await execFileAsync4("git", ["show", `${probeRef}:${LOCAL_CONFIG_FILENAME}`], {
6823
+ encoding: "utf-8",
6824
+ timeout: 1e4
6825
+ });
6826
+ return Buffer.from(stdout, "utf-8").toString("base64");
6827
+ }
6656
6828
  const repo = await trustAnchorRepoAsync();
6657
6829
  if (!repo)
6658
6830
  throw new Error("could not resolve repo identity for the trust-anchor read");
@@ -6730,9 +6902,9 @@ function loadConfig() {
6730
6902
  var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
6731
6903
 
6732
6904
  // src/lib/brief-assembly.ts
6733
- import { execFileSync as execFileSync4 } from "node:child_process";
6734
- import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync } from "node:fs";
6735
- import { join as join3 } from "node:path";
6905
+ import { execFileSync as execFileSync5 } from "node:child_process";
6906
+ import { existsSync as existsSync4, readFileSync as readFileSync4, readdirSync as readdirSync2 } from "node:fs";
6907
+ import { join as join4 } from "node:path";
6736
6908
 
6737
6909
  // ../../packages/sources/src/commands.ts
6738
6910
  var COMMANDS = [
@@ -6927,7 +7099,7 @@ var COMMANDS = [
6927
7099
  details: [
6928
7100
  "Exposes the task-operator tool catalog (`packages/aeg-core/src/task-tools.ts`) to an agent runtime as one MCP server speaking newline-delimited JSON-RPC 2.0 (`initialize`/`tools/list`/`tools/call`). Claude registers it through the generated `.mcp.json`; Codex through its documented `~/.codex/config.toml` `[mcp_servers]` table — both point at this same command.",
6929
7101
  "stdout carries JSON-RPC and nothing else: any stray write from the CLI (a forge-read warning) is redirected to stderr, so the protocol stream is never corrupted.",
6930
- "`task_status`/`task_escalation_read` read; `task_start` starts a run in attended mode only, requiring an authenticated caller from the invocation context (`VINAYA_MCP_CALLER`) and refusing without one — MCP is a transport, not authorization. `task_resume`/`task_cancel` require the same authenticated caller, plus a current Principal ruling read fresh from the run's own PR — never a caller-supplied approval; `task_resume` triggers the existing `dev-review-loop --resume` continuation exactly once per escalation, and `task_cancel` reports a truthful `confirmed`/`pending`/`uncertain` outcome, idempotently, across repeated calls. No unattended start until the worker-isolation boundary and a capability flag land."
7102
+ "`task_status`/`task_escalation_read`/`task_pr_read` read; `task_pr_read` returns the selected task's OWN pull request — every required and reported check with its state, conclusion and failure summary, plus the principal-authored review record (newest verdicts and their judged head, round markers, published summary table, pause comment) — and refuses any other pull request; `task_start` starts a run in attended mode only, requiring an authenticated caller from the invocation context (`VINAYA_MCP_CALLER`) and refusing without one — MCP is a transport, not authorization. `task_resume`/`task_cancel` require the same authenticated caller, plus a current Principal ruling read fresh from the run's own PR — never a caller-supplied approval; `task_resume` triggers the existing `dev-review-loop --resume` continuation exactly once per escalation, and `task_cancel` reports a truthful `confirmed`/`pending`/`uncertain` outcome, idempotently, across repeated calls. No unattended start until the worker-isolation boundary and a capability flag land."
6931
7103
  ],
6932
7104
  status: "shipped"
6933
7105
  },
@@ -7238,6 +7410,10 @@ var COMMANDS = [
7238
7410
  flag: "--role <name>",
7239
7411
  description: "Resolve to a specific role file (roles/<name>.md) instead of the front door"
7240
7412
  },
7413
+ {
7414
+ flag: "--template <name>",
7415
+ description: "Print a template the package ships (templates/<name>-template.md) instead of the front door"
7416
+ },
7241
7417
  {
7242
7418
  flag: "--print",
7243
7419
  description: "Emit the resolved file's body (frontmatter stripped) instead of its path — the one-hop mode every generated skill and slash command invokes. A role file whose frontmatter carries an `ack-token` emits that token as the output's own first line."
@@ -7573,13 +7749,47 @@ function packageRoot(moduleUrl) {
7573
7749
  return dir;
7574
7750
  }
7575
7751
 
7752
+ // src/commands/doctrine.ts
7753
+ import { execFileSync as execFileSync4 } from "node:child_process";
7754
+ import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync3 } from "node:fs";
7755
+ import { dirname as dirname3, join as join3, sep } from "node:path";
7756
+ import matter2 from "gray-matter";
7757
+ var ENTRY_SEGMENTS = ["skills", "aeg", "SKILL.md"];
7758
+ function resolveDoctrineRoot(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
7759
+ return resolveDoctrineRootInfo(pkg, cwd)?.root ?? null;
7760
+ }
7761
+ function gitToplevel(cwd) {
7762
+ try {
7763
+ return execFileSync4("git", ["-C", cwd, "rev-parse", "--show-toplevel"], {
7764
+ encoding: "utf8",
7765
+ stdio: ["ignore", "pipe", "pipe"]
7766
+ }).trim();
7767
+ } catch {
7768
+ return null;
7769
+ }
7770
+ }
7771
+ function resolveDoctrineRootInfo(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
7772
+ const toplevel = gitToplevel(cwd);
7773
+ if (toplevel !== null) {
7774
+ const treeRoot = join3(toplevel, "aeg-root");
7775
+ if (existsSync3(join3(treeRoot, "roles")))
7776
+ return { root: treeRoot, source: "tree" };
7777
+ }
7778
+ const fromSource = !pkg.split(sep).includes("node_modules");
7779
+ const bundleRoot = fromSource ? join3(dirname3(dirname3(pkg)), "aeg-root") : join3(pkg, "aeg-root");
7780
+ return hasDoctrineEntry(bundleRoot) ? { root: bundleRoot, source: "bundle" } : null;
7781
+ }
7782
+ function hasDoctrineEntry(root) {
7783
+ return existsSync3(join3(root, ...ENTRY_SEGMENTS));
7784
+ }
7785
+
7576
7786
  // src/lib/brief-assembly.ts
7577
7787
  var PACKAGE_ROOT = packageRoot(import.meta.url);
7578
- var PACKAGED_TEMPLATE_PATH = join3(PACKAGE_ROOT, "aeg-root", "templates", "brief-template.md");
7579
- var TEMPLATE_PATH = existsSync3(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join3(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
7788
+ var PACKAGED_TEMPLATE_PATH = join4(PACKAGE_ROOT, "aeg-root", "templates", "brief-template.md");
7789
+ var TEMPLATE_PATH = existsSync4(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join4(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
7580
7790
  function git(args) {
7581
7791
  try {
7582
- return execFileSync4("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
7792
+ return execFileSync5("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
7583
7793
  } catch {
7584
7794
  return "";
7585
7795
  }
@@ -7592,14 +7802,14 @@ function expandGlob(glob) {
7592
7802
  var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
7593
7803
 
7594
7804
  // src/checks/registry.ts
7595
- import { existsSync as existsSync4 } from "node:fs";
7596
- import { join as join4 } from "node:path";
7597
- var DIST_BIN_DIR = join4(packageRoot(import.meta.url), "dist", "checks", "bin");
7598
- var SRC_BIN_DIR = join4(packageRoot(import.meta.url), "src", "checks", "bin");
7599
- var BIN_DIR = existsSync4(DIST_BIN_DIR) ? DIST_BIN_DIR : SRC_BIN_DIR;
7805
+ import { existsSync as existsSync5 } from "node:fs";
7806
+ import { join as join5 } from "node:path";
7807
+ var DIST_BIN_DIR = join5(packageRoot(import.meta.url), "dist", "checks", "bin");
7808
+ var SRC_BIN_DIR = join5(packageRoot(import.meta.url), "src", "checks", "bin");
7809
+ var BIN_DIR = existsSync5(DIST_BIN_DIR) ? DIST_BIN_DIR : SRC_BIN_DIR;
7600
7810
  var BIN_EXT = BIN_DIR === DIST_BIN_DIR ? ".js" : ".ts";
7601
7811
  function bin(name) {
7602
- return join4(BIN_DIR, `${name}${BIN_EXT}`);
7812
+ return join5(BIN_DIR, `${name}${BIN_EXT}`);
7603
7813
  }
7604
7814
  var REGISTRY = [
7605
7815
  [
@@ -8163,21 +8373,21 @@ import { randomUUID as randomUUID2 } from "node:crypto";
8163
8373
  import {
8164
8374
  closeSync as closeSync3,
8165
8375
  constants as fsConstants3,
8166
- existsSync as existsSync6,
8376
+ existsSync as existsSync7,
8167
8377
  fstatSync as fstatSync2,
8168
8378
  mkdirSync as mkdirSync3,
8169
8379
  openSync as openSync3,
8170
- readFileSync as readFileSync5,
8380
+ readFileSync as readFileSync6,
8171
8381
  renameSync as renameSync2,
8172
8382
  writeSync as writeSync2
8173
8383
  } from "node:fs";
8174
8384
  import { hostname as osHostname, homedir as homedir3 } from "node:os";
8175
- import { dirname as dirname5, join as join7 } from "node:path";
8385
+ import { dirname as dirname6, join as join8 } from "node:path";
8176
8386
  import { promisify as promisify5 } from "node:util";
8177
8387
 
8178
8388
  // src/lib/run-paths.ts
8179
- import { chmodSync, existsSync as existsSync5, realpathSync as realpathSync2 } from "node:fs";
8180
- import { dirname as dirname3, join as join5, resolve as resolvePath } from "node:path";
8389
+ import { chmodSync, existsSync as existsSync6, realpathSync as realpathSync2 } from "node:fs";
8390
+ import { dirname as dirname4, join as join6, resolve as resolvePath } from "node:path";
8181
8391
  var SAFE_PATH_SEGMENT = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
8182
8392
  function isSafeRepoSegment(segment) {
8183
8393
  return SAFE_PATH_SEGMENT.test(segment) && !segment.includes("..");
@@ -8188,7 +8398,7 @@ function repoSegment(repo) {
8188
8398
  return `${repo.owner}-${repo.repo}`;
8189
8399
  }
8190
8400
  function defaultRuntimeDir(repo, home = GLOBAL_VINAYA_HOME) {
8191
- return join5(home, "runtime", repoSegment(repo));
8401
+ return join6(home, "runtime", repoSegment(repo));
8192
8402
  }
8193
8403
  function resolveRuntimeDir(input) {
8194
8404
  const local = resolveRuntimeDirSetting(input.localConfig);
@@ -8248,9 +8458,9 @@ function repoRootSync(start = process.cwd()) {
8248
8458
  return null;
8249
8459
  }
8250
8460
  for (;; ) {
8251
- if (existsSync5(join5(dir, ".git")))
8461
+ if (existsSync6(join6(dir, ".git")))
8252
8462
  return dir;
8253
- const parent = dirname3(dir);
8463
+ const parent = dirname4(dir);
8254
8464
  if (parent === dir)
8255
8465
  return null;
8256
8466
  dir = parent;
@@ -8265,16 +8475,17 @@ import {
8265
8475
  mkdirSync as mkdirSync2,
8266
8476
  openSync as openSync2,
8267
8477
  linkSync,
8268
- readFileSync as readFileSync4,
8478
+ readFileSync as readFileSync5,
8269
8479
  renameSync,
8270
8480
  statSync,
8271
8481
  unlinkSync,
8482
+ utimesSync,
8272
8483
  writeFileSync as writeFileSync2,
8273
8484
  writeSync
8274
8485
  } from "node:fs";
8275
8486
  import { randomUUID } from "node:crypto";
8276
8487
  import { homedir as homedir2 } from "node:os";
8277
- import { dirname as dirname4, join as join6 } from "node:path";
8488
+ import { dirname as dirname5, join as join7 } from "node:path";
8278
8489
  var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
8279
8490
  var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
8280
8491
  var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
@@ -8290,7 +8501,7 @@ function isEnoent(err) {
8290
8501
  var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
8291
8502
  function tryCreateLock(lockPath, token) {
8292
8503
  try {
8293
- mkdirSync2(dirname4(lockPath), { recursive: true, mode: 448 });
8504
+ mkdirSync2(dirname5(lockPath), { recursive: true, mode: 448 });
8294
8505
  const fd = openSync2(lockPath, fsConstants2.O_WRONLY | fsConstants2.O_CREAT | fsConstants2.O_EXCL, 384);
8295
8506
  try {
8296
8507
  writeSync(fd, `${token}
@@ -8352,9 +8563,30 @@ function acquireDrainLock(lockPath) {
8352
8563
  unlinkSync(claimed);
8353
8564
  return tryCreateLock(lockPath, token) ? token : null;
8354
8565
  }
8566
+ function renewDrainLock(lockPath, token) {
8567
+ let holder;
8568
+ try {
8569
+ holder = readFileSync5(lockPath, "utf8").trim();
8570
+ } catch (err) {
8571
+ if (!isEnoent(err))
8572
+ throw err;
8573
+ return false;
8574
+ }
8575
+ if (holder !== token)
8576
+ return false;
8577
+ const now = new Date;
8578
+ try {
8579
+ utimesSync(lockPath, now, now);
8580
+ } catch (err) {
8581
+ if (!isEnoent(err))
8582
+ throw err;
8583
+ return false;
8584
+ }
8585
+ return true;
8586
+ }
8355
8587
  function releaseDrainLock(lockPath, token) {
8356
8588
  try {
8357
- const holder = readFileSync4(lockPath, "utf8").trim();
8589
+ const holder = readFileSync5(lockPath, "utf8").trim();
8358
8590
  if (holder !== token)
8359
8591
  return;
8360
8592
  unlinkSync(lockPath);
@@ -8371,68 +8603,205 @@ class WebhookDrainError extends Error {
8371
8603
  this.code = code;
8372
8604
  }
8373
8605
  }
8606
+ function backupPathFor(queuePath) {
8607
+ return queuePath.replace(/\.ndjson$/, ".1.ndjson");
8608
+ }
8609
+ function drainingPathFor(queuePath) {
8610
+ return queuePath.replace(/\.ndjson$/, ".draining.ndjson");
8611
+ }
8612
+ function rejectedPathFor(queuePath) {
8613
+ return queuePath.replace(/\.ndjson$/, ".rejected.ndjson");
8614
+ }
8615
+ var rejectionWarnedThisProcess = false;
8616
+ function warnRejectionOnce(message) {
8617
+ if (rejectionWarnedThisProcess)
8618
+ return;
8619
+ rejectionWarnedThisProcess = true;
8620
+ try {
8621
+ process.stderr.write(message);
8622
+ } catch {}
8623
+ }
8624
+ function queueLines(buf) {
8625
+ const lines = [];
8626
+ let start = 0;
8627
+ for (let i = 0;i < buf.byteLength; i++) {
8628
+ if (buf[i] !== 10)
8629
+ continue;
8630
+ if (i > start)
8631
+ lines.push({ raw: buf.toString("utf8", start, i), end: i + 1 });
8632
+ start = i + 1;
8633
+ }
8634
+ if (start < buf.byteLength)
8635
+ lines.push({ raw: buf.toString("utf8", start), end: buf.byteLength });
8636
+ return lines;
8637
+ }
8638
+ function removeQueueHead(path, cut) {
8639
+ const remaining = readFileSync5(path);
8640
+ writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
8641
+ }
8642
+ function queueBucketSize(path) {
8643
+ let lstat;
8644
+ try {
8645
+ lstat = lstatSync(path);
8646
+ } catch (err) {
8647
+ if (!isEnoent(err))
8648
+ throw err;
8649
+ }
8650
+ if (lstat === undefined)
8651
+ return null;
8652
+ if (!lstat.isFile()) {
8653
+ throw new WebhookDrainError("log-webhook-drain-symlink", `log webhook drain: outbox target is not a regular file (symlink, FIFO, or similar) — refusing to read: ${path}`);
8654
+ }
8655
+ return Number(lstat.size);
8656
+ }
8657
+ function readQueueFile(path) {
8658
+ if (queueBucketSize(path) === null)
8659
+ return null;
8660
+ return readFileSync5(path);
8661
+ }
8662
+ function rejectLine(rejectedPath, reason, status, identity, raw) {
8663
+ const record = JSON.stringify({
8664
+ rejected_at: new Date().toISOString(),
8665
+ status,
8666
+ reason,
8667
+ identity,
8668
+ bytes: Buffer.byteLength(raw, "utf8"),
8669
+ raw
8670
+ });
8671
+ const failure = appendHardenedLine(rejectedPath, `${record}
8672
+ `);
8673
+ if (failure !== null) {
8674
+ throw new WebhookDrainError("log-webhook-drain-rejected-write", `log webhook drain: a queued line failed re-validation (${reason}) and could not be set aside in ${rejectedPath} — ${failure}; the line stays queued`);
8675
+ }
8676
+ warnRejectionOnce(`vinaya: log delivery set a queued line aside in ${rejectedPath} — ${reason}; later lines keep delivering
8677
+ `);
8678
+ }
8679
+ async function postChunk(webhookUrl, headers, body, fetchTimeoutMs, chunksAlreadyDelivered) {
8680
+ const delivered = chunksAlreadyDelivered > 0 ? ` after delivering ${chunksAlreadyDelivered} chunk(s)` : "";
8681
+ let response;
8682
+ try {
8683
+ response = await fetch(webhookUrl, {
8684
+ method: "POST",
8685
+ headers: { "content-type": "application/x-ndjson", ...headers },
8686
+ body,
8687
+ signal: AbortSignal.timeout(fetchTimeoutMs)
8688
+ });
8689
+ } catch (err) {
8690
+ const reason = err instanceof Error && err.name === "TimeoutError" ? `timed out after ${fetchTimeoutMs}ms` : err instanceof Error ? err.message : String(err);
8691
+ throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} failed${delivered}: ${reason}`);
8692
+ }
8693
+ if (!response.ok) {
8694
+ throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} returned ${response.status} ${response.statusText}${delivered}`);
8695
+ }
8696
+ }
8697
+ async function drainQueueFile(args) {
8698
+ const { path, rejectedPath, webhookUrl, headers, fetchTimeoutMs, totals } = args;
8699
+ const buf = readQueueFile(path);
8700
+ if (buf === null || buf.byteLength === 0)
8701
+ return;
8702
+ const lines = queueLines(buf);
8703
+ if (lines.length === 0) {
8704
+ removeQueueHead(path, buf.byteLength);
8705
+ return;
8706
+ }
8707
+ let removed = 0;
8708
+ let pendingEnd = 0;
8709
+ let chunk = [];
8710
+ let chunkBytes = 0;
8711
+ const deliverChunk = async () => {
8712
+ const body = `${chunk.join(`
8713
+ `)}
8714
+ `;
8715
+ args.keepLock();
8716
+ await postChunk(webhookUrl, headers, body, fetchTimeoutMs, totals.chunks);
8717
+ totals.chunks += 1;
8718
+ totals.lineCount += chunk.length;
8719
+ totals.bytes += Buffer.byteLength(body, "utf8");
8720
+ removeQueueHead(path, pendingEnd - removed);
8721
+ removed = pendingEnd;
8722
+ chunk = [];
8723
+ chunkBytes = 0;
8724
+ };
8725
+ const setAside = async (reason, status, identity, line) => {
8726
+ if (chunk.length > 0)
8727
+ await deliverChunk();
8728
+ rejectLine(rejectedPath, reason, status, identity, line.raw);
8729
+ totals.rejected += 1;
8730
+ pendingEnd = line.end;
8731
+ removeQueueHead(path, pendingEnd - removed);
8732
+ removed = pendingEnd;
8733
+ };
8734
+ for (const line of lines) {
8735
+ const record = classifyStoredLine(line.raw, homedir2());
8736
+ if (record.status !== "ok") {
8737
+ await setAside(record.reason, record.status, record.identity, line);
8738
+ continue;
8739
+ }
8740
+ const lineBytes = Buffer.byteLength(record.postLine, "utf8") + 1;
8741
+ if (lineBytes > MAX_WEBHOOK_BODY_BYTES) {
8742
+ await setAside(`one line is ${lineBytes} byte(s), over the ${MAX_WEBHOOK_BODY_BYTES}-byte per-POST cap — no chunking can carry it`, "too_large", record.identity, line);
8743
+ continue;
8744
+ }
8745
+ if (chunk.length > 0 && chunkBytes + lineBytes > MAX_WEBHOOK_BODY_BYTES)
8746
+ await deliverChunk();
8747
+ chunk.push(record.postLine);
8748
+ chunkBytes += lineBytes;
8749
+ pendingEnd = line.end;
8750
+ }
8751
+ pendingEnd = buf.byteLength;
8752
+ if (chunk.length > 0) {
8753
+ await deliverChunk();
8754
+ return;
8755
+ }
8756
+ if (pendingEnd > removed)
8757
+ removeQueueHead(path, pendingEnd - removed);
8758
+ }
8759
+ async function drainRenamedAside(args, livePath, source) {
8760
+ args.keepLock();
8761
+ const draining = drainingPathFor(livePath);
8762
+ try {
8763
+ renameSync(source, draining);
8764
+ } catch (err) {
8765
+ if (isEnoent(err))
8766
+ return;
8767
+ throw err;
8768
+ }
8769
+ await drainQueueFile({ ...args, path: draining });
8770
+ unlinkSync(draining);
8771
+ }
8374
8772
  async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeoutMs = WEBHOOK_FETCH_TIMEOUT_MS) {
8375
8773
  const resolved = await resolveRepo();
8376
8774
  const repo = resolved && isSafeRepoSegment2(resolved.owner) && isSafeRepoSegment2(resolved.repo) ? resolved : null;
8377
- const outboxRoot = () => join6(GLOBAL_VINAYA_HOME, "outbox");
8775
+ const outboxRoot = () => join7(GLOBAL_VINAYA_HOME, "outbox");
8378
8776
  const path = outboxPathFor({ outboxRoot }, repo, outboxTask);
8379
8777
  const lockPath = `${path}.flush-lock`;
8380
8778
  const lockToken = acquireDrainLock(lockPath);
8779
+ const totals = { lineCount: 0, bytes: 0, chunks: 0, rejected: 0 };
8381
8780
  if (lockToken === null)
8382
- return { flushed: false };
8781
+ return { flushed: false, ...totals };
8383
8782
  try {
8384
- let lstat;
8385
- try {
8386
- lstat = lstatSync(path);
8387
- } catch (err) {
8388
- if (!isEnoent(err))
8389
- throw err;
8390
- }
8391
- if (lstat === undefined)
8392
- return { flushed: false };
8393
- if (!lstat.isFile()) {
8394
- throw new WebhookDrainError("log-webhook-drain-symlink", `log webhook drain: outbox target is not a regular file (symlink, FIFO, or similar) — refusing to read: ${path}`);
8395
- }
8396
- const buf = readFileSync4(path);
8397
- const startOffset = buf.byteLength;
8398
- const rawLines = buf.toString("utf8").split(`
8399
- `).filter((l) => l.length > 0);
8400
- if (rawLines.length === 0)
8401
- return { flushed: false };
8402
- const postLines = [];
8403
- for (let i = 0;i < rawLines.length; i++) {
8404
- const record = classifyStoredLine(rawLines[i], homedir2());
8405
- if (record.status !== "ok") {
8406
- throw new WebhookDrainError("log-webhook-drain-corrupt-line", `log webhook drain: outbox line ${i} failed schema re-validation — ${record.reason}`);
8407
- }
8408
- postLines.push(record.postLine);
8409
- }
8410
- const body = `${postLines.join(`
8411
- `)}
8412
- `;
8413
- const bytes = Buffer.byteLength(body, "utf8");
8414
- if (bytes > MAX_WEBHOOK_BODY_BYTES) {
8415
- throw new WebhookDrainError("log-webhook-drain-too-large", `log webhook drain: outbox body is ${bytes} byte(s), over the ${MAX_WEBHOOK_BODY_BYTES}-byte per-call cap — flush more often to drain it.`);
8416
- }
8417
- let response;
8418
- try {
8419
- response = await fetch(webhookUrl, {
8420
- method: "POST",
8421
- headers: { "content-type": "application/x-ndjson", ...headers },
8422
- body,
8423
- signal: AbortSignal.timeout(fetchTimeoutMs)
8424
- });
8425
- } catch (err) {
8426
- const reason = err instanceof Error && err.name === "TimeoutError" ? `timed out after ${fetchTimeoutMs}ms` : err instanceof Error ? err.message : String(err);
8427
- throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} failed: ${reason}`);
8428
- }
8429
- if (!response.ok) {
8430
- throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} returned ${response.status} ${response.statusText}`);
8431
- }
8432
- const liveNow = readFileSync4(path);
8433
- const tail = liveNow.subarray(Math.min(startOffset, liveNow.byteLength));
8434
- writeFileSync2(path, tail);
8435
- return { flushed: true, lineCount: postLines.length, bytes };
8783
+ const keepLock = () => {
8784
+ if (renewDrainLock(lockPath, lockToken))
8785
+ return;
8786
+ throw new WebhookDrainError("log-webhook-drain-lock-lost", `log webhook drain: this drain's lock on ${lockPath} was taken over by another process — stopping here; that process delivers the rest`);
8787
+ };
8788
+ const shared = {
8789
+ rejectedPath: rejectedPathFor(path),
8790
+ webhookUrl,
8791
+ headers,
8792
+ fetchTimeoutMs,
8793
+ totals,
8794
+ keepLock
8795
+ };
8796
+ const draining = drainingPathFor(path);
8797
+ if (queueBucketSize(draining) !== null) {
8798
+ keepLock();
8799
+ await drainQueueFile({ ...shared, path: draining });
8800
+ unlinkSync(draining);
8801
+ }
8802
+ await drainRenamedAside(shared, path, backupPathFor(path));
8803
+ await drainRenamedAside(shared, path, path);
8804
+ return { flushed: totals.chunks > 0 || totals.rejected > 0, ...totals };
8436
8805
  } finally {
8437
8806
  releaseDrainLock(lockPath, lockToken);
8438
8807
  }
@@ -8515,7 +8884,7 @@ async function defaultResolveLogDestination(repo, env) {
8515
8884
  trustAnchorConfig: unattended ? await processTrustAnchor() : null,
8516
8885
  unattended,
8517
8886
  env,
8518
- defaultFolder: join7(await runtimeDirForRepoAsync(repo), "logs"),
8887
+ defaultFolder: join8(await runtimeDirForRepoAsync(repo), "logs"),
8519
8888
  repoRoot: repoRootSync()
8520
8889
  });
8521
8890
  }
@@ -8530,7 +8899,7 @@ async function resolveDoctrine(cwd, vinayaVersion) {
8530
8899
  } catch (err) {
8531
8900
  return isEnoent2(err) ? "unknown" : vinayaVersion;
8532
8901
  }
8533
- if (!existsSync6(join7(toplevel, "aeg-root", "roles")))
8902
+ if (!existsSync7(join8(toplevel, "aeg-root", "roles")))
8534
8903
  return vinayaVersion;
8535
8904
  try {
8536
8905
  const sha = (await execFileAsync5("git", ["-C", toplevel, "rev-parse", "HEAD:aeg-root"], { encoding: "utf8" })).stdout.trim();
@@ -8539,9 +8908,99 @@ async function resolveDoctrine(cwd, vinayaVersion) {
8539
8908
  return vinayaVersion;
8540
8909
  }
8541
8910
  }
8911
+ var TRANCHE_SLUG_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
8912
+ function taskRefFromBranch2(branch) {
8913
+ const backlog = /^task\/issue-(\d+)$/.exec(branch);
8914
+ if (backlog) {
8915
+ const issue = Number(backlog[1]);
8916
+ return Number.isSafeInteger(issue) && issue > 0 ? { kind: "issue", issue } : null;
8917
+ }
8918
+ const tranche = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
8919
+ if (tranche && TRANCHE_SLUG_PATTERN.test(tranche[1] ?? "")) {
8920
+ return { kind: "tranche", tranche: tranche[1], taskId: tranche[2] };
8921
+ }
8922
+ return null;
8923
+ }
8924
+ var TRANCHE_ISSUE_LIST_LIMIT = 200;
8925
+ async function issueForTrancheTask(tranche, taskId, cwd, repo) {
8926
+ let stdout;
8927
+ try {
8928
+ ({ stdout } = await execFileAsync5("gh", [
8929
+ "issue",
8930
+ "list",
8931
+ "--state",
8932
+ "all",
8933
+ "--label",
8934
+ `vinaya/tranche:${tranche}`,
8935
+ "--json",
8936
+ "number,title,labels",
8937
+ "--limit",
8938
+ String(TRANCHE_ISSUE_LIST_LIMIT),
8939
+ ...repo === null ? [] : ["--repo", repo]
8940
+ ], {
8941
+ cwd,
8942
+ encoding: "utf8",
8943
+ maxBuffer: 8 * 1024 * 1024,
8944
+ timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
8945
+ killSignal: "SIGKILL"
8946
+ }));
8947
+ } catch {
8948
+ return null;
8949
+ }
8950
+ let issues;
8951
+ try {
8952
+ issues = JSON.parse(stdout);
8953
+ } catch {
8954
+ return null;
8955
+ }
8956
+ for (const issue of issues) {
8957
+ const ref = resolveTaskIssueRef(issue.title, issue.labels.map((l) => l.name));
8958
+ if (ref && ref.trancheSlug === tranche && ref.taskId === taskId)
8959
+ return issue.number;
8960
+ }
8961
+ return null;
8962
+ }
8963
+ async function confirmBacklogIssue(issue, cwd, repo) {
8964
+ let stdout;
8965
+ try {
8966
+ ({ stdout } = await execFileAsync5("gh", ["issue", "view", String(issue), "--json", "number", ...repo === null ? [] : ["--repo", repo]], {
8967
+ cwd,
8968
+ encoding: "utf8",
8969
+ timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
8970
+ killSignal: "SIGKILL"
8971
+ }));
8972
+ } catch (err) {
8973
+ const stderr = typeof err.stderr === "string" ? err.stderr : "";
8974
+ return /could not resolve|not found|no such|does not exist/i.test(stderr) ? "denied" : "unknown";
8975
+ }
8976
+ try {
8977
+ return JSON.parse(stdout).number === issue ? "confirmed" : "denied";
8978
+ } catch {
8979
+ return "unknown";
8980
+ }
8981
+ }
8982
+ async function resolveBranchIssue(cwd, env = process.env, repo = null) {
8983
+ let branch;
8984
+ try {
8985
+ branch = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "--abbrev-ref", "HEAD"], {
8986
+ encoding: "utf8",
8987
+ timeout: LOG_CONTEXT_LOOKUP_DEADLINE_MS,
8988
+ killSignal: "SIGKILL"
8989
+ })).stdout.trim();
8990
+ } catch {
8991
+ return null;
8992
+ }
8993
+ const named = branch === "HEAD" ? env.GITHUB_HEAD_REF ?? "" : branch;
8994
+ const ref = taskRefFromBranch2(named);
8995
+ if (ref === null)
8996
+ return null;
8997
+ if (ref.kind === "tranche")
8998
+ return await issueForTrancheTask(ref.tranche, ref.taskId, cwd, repo);
8999
+ return await confirmBacklogIssue(ref.issue, cwd, repo) === "denied" ? null : ref.issue;
9000
+ }
8542
9001
  function readVinayaVersion() {
8543
9002
  try {
8544
- const pkg = JSON.parse(readFileSync5(join7(packageRoot(import.meta.url), "package.json"), "utf8"));
9003
+ const pkg = JSON.parse(readFileSync6(join8(packageRoot(import.meta.url), "package.json"), "utf8"));
8545
9004
  return pkg.version ?? "unknown";
8546
9005
  } catch {
8547
9006
  return "unknown";
@@ -8551,10 +9010,15 @@ var SAFE_PATH_SEGMENT3 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
8551
9010
  function isSafeRepoSegment3(segment) {
8552
9011
  return SAFE_PATH_SEGMENT3.test(segment) && !segment.includes("..");
8553
9012
  }
9013
+ function safeRepoSlug(repo) {
9014
+ if (repo === null)
9015
+ return null;
9016
+ return isSafeRepoSegment3(repo.owner) && isSafeRepoSegment3(repo.repo) ? `${repo.owner}/${repo.repo}` : null;
9017
+ }
8554
9018
  function outboxPathFor(deps, repo, issue) {
8555
9019
  const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
8556
9020
  const fileName = `${issue ?? "none"}.ndjson`;
8557
- return join7(deps.outboxRoot(), dirName, fileName);
9021
+ return join8(deps.outboxRoot(), dirName, fileName);
8558
9022
  }
8559
9023
  function hostFromEnv(env) {
8560
9024
  if (env.GITHUB_ACTIONS)
@@ -8572,9 +9036,21 @@ function defaultStderr(message) {
8572
9036
  warnedThisProcess = true;
8573
9037
  process.stderr.write(message);
8574
9038
  }
9039
+ var branchIssueFallbackEnabled = true;
9040
+ var branchIssueByCwd = new Map;
9041
+ function branchIssueRead(key, read, shared) {
9042
+ if (!shared)
9043
+ return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
9044
+ const cached = branchIssueByCwd.get(key);
9045
+ if (cached !== undefined)
9046
+ return cached;
9047
+ const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
9048
+ branchIssueByCwd.set(key, reading);
9049
+ return reading;
9050
+ }
8575
9051
  function defaultDeps() {
8576
9052
  return {
8577
- outboxRoot: () => join7(GLOBAL_VINAYA_HOME, "outbox"),
9053
+ outboxRoot: () => join8(GLOBAL_VINAYA_HOME, "outbox"),
8578
9054
  home: () => homedir3(),
8579
9055
  hostname: () => osHostname(),
8580
9056
  cwd: () => process.cwd(),
@@ -8597,10 +9073,28 @@ function guardedAppendOpen(path) {
8597
9073
  return;
8598
9074
  }
8599
9075
  }
9076
+ function appendHardenedLine(path, line) {
9077
+ try {
9078
+ mkdirSync3(dirname6(path), { recursive: true, mode: 448 });
9079
+ const fd = guardedAppendOpen(path);
9080
+ if (fd === undefined)
9081
+ return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
9082
+ try {
9083
+ if (!fstatSync2(fd).isFile())
9084
+ return `target is not a regular file: ${path}`;
9085
+ writeSync2(fd, line);
9086
+ } finally {
9087
+ closeSync3(fd);
9088
+ }
9089
+ return null;
9090
+ } catch (err) {
9091
+ return err instanceof Error ? err.message : String(err);
9092
+ }
9093
+ }
8600
9094
  function reportRotationOverflow(backupPath, warn) {
8601
9095
  let raw;
8602
9096
  try {
8603
- raw = readFileSync5(backupPath, "utf8");
9097
+ raw = readFileSync6(backupPath, "utf8");
8604
9098
  } catch {
8605
9099
  return;
8606
9100
  }
@@ -8623,7 +9117,7 @@ function reportRotationOverflow(backupPath, warn) {
8623
9117
  }
8624
9118
  function appendLine(path, line, warn) {
8625
9119
  try {
8626
- mkdirSync3(dirname5(path), { recursive: true, mode: 448 });
9120
+ mkdirSync3(dirname6(path), { recursive: true, mode: 448 });
8627
9121
  let fd = guardedAppendOpen(path);
8628
9122
  if (fd === undefined) {
8629
9123
  warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
@@ -8664,7 +9158,11 @@ function appendLine(path, line, warn) {
8664
9158
  }
8665
9159
  }
8666
9160
  function createLogSink(overrides = {}) {
8667
- const deps = { ...defaultDeps(), ...overrides };
9161
+ const deps = {
9162
+ ...defaultDeps(),
9163
+ resolveBranchIssue: (repo) => resolveBranchIssue(deps.cwd(), deps.env(), repo),
9164
+ ...overrides
9165
+ };
8668
9166
  const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
8669
9167
  const processId = randomUUID2();
8670
9168
  let seq = 0;
@@ -8684,6 +9182,19 @@ function createLogSink(overrides = {}) {
8684
9182
  }
8685
9183
  return doctrineCache;
8686
9184
  };
9185
+ const readerIsReal = overrides.resolveBranchIssue === undefined;
9186
+ let ownBranchIssue;
9187
+ const branchIssueOnce = (repo) => {
9188
+ if (!branchIssueFallbackEnabled)
9189
+ return Promise.resolve(null);
9190
+ const slug = safeRepoSlug(repo);
9191
+ const read = () => deps.resolveBranchIssue(slug);
9192
+ if (readerIsReal)
9193
+ return branchIssueRead(`${deps.cwd()}\x00${slug ?? ""}`, read, true);
9194
+ if (ownBranchIssue === undefined)
9195
+ ownBranchIssue = branchIssueRead(deps.cwd(), read, false);
9196
+ return ownBranchIssue;
9197
+ };
8687
9198
  let resolveRepoCache;
8688
9199
  const resolveRepoOnce = () => {
8689
9200
  if (resolveRepoCache === undefined)
@@ -8706,6 +9217,7 @@ function createLogSink(overrides = {}) {
8706
9217
  };
8707
9218
  let drainChain = Promise.resolve();
8708
9219
  const pendingWrites = new Set;
9220
+ let writeChain = Promise.resolve();
8709
9221
  const scheduleWebhookDrain = (issue, url, headers) => {
8710
9222
  drainChain = drainChain.then(() => drainOutboxToWebhook(issue, url, headers)).then(() => {
8711
9223
  return;
@@ -8728,7 +9240,14 @@ function createLogSink(overrides = {}) {
8728
9240
  attempt: env.VINAYA_ATTEMPT,
8729
9241
  parent: env.VINAYA_PARENT_EVENT
8730
9242
  };
8731
- const written = context().then(({ repo, doctrine: doctrineValue, destination: resolvedDestination }) => {
9243
+ const write = async () => {
9244
+ const { repo, doctrine: doctrineValue, destination: resolvedDestination } = await context();
9245
+ if (resolvedDestination.kind === "none") {
9246
+ warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
9247
+ `);
9248
+ return;
9249
+ }
9250
+ const branchIssue = envFields.task ? null : await branchIssueOnce(repo);
8732
9251
  const header = buildHeader({
8733
9252
  now,
8734
9253
  runId,
@@ -8739,15 +9258,11 @@ function createLogSink(overrides = {}) {
8739
9258
  host,
8740
9259
  hostname: deps.hostname(),
8741
9260
  env: envFields,
9261
+ branchIssue,
8742
9262
  eventId: randomUUID2(),
8743
9263
  processId,
8744
9264
  inputVersions: deps.inputVersions()
8745
9265
  });
8746
- if (resolvedDestination.kind === "none") {
8747
- warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
8748
- `);
8749
- return;
8750
- }
8751
9266
  const full = { ...e, ...header };
8752
9267
  const parsed = LogEventSchema.safeParse(full);
8753
9268
  if (!parsed.success) {
@@ -8764,10 +9279,12 @@ function createLogSink(overrides = {}) {
8764
9279
  } else {
8765
9280
  appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
8766
9281
  }
8767
- }).catch((err) => {
9282
+ };
9283
+ const written = writeChain.then(write).catch((err) => {
8768
9284
  warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
8769
9285
  `);
8770
9286
  });
9287
+ writeChain = written;
8771
9288
  pendingWrites.add(written);
8772
9289
  written.finally(() => pendingWrites.delete(written));
8773
9290
  } catch (err) {
@@ -8836,7 +9353,7 @@ function parseChangedLineRanges(diffOutput) {
8836
9353
  function fileDiffAgainst(ref, path) {
8837
9354
  let out;
8838
9355
  try {
8839
- out = execFileSync5("git", ["diff", `${ref}...HEAD`, "--", path], {
9356
+ out = execFileSync6("git", ["diff", `${ref}...HEAD`, "--", path], {
8840
9357
  encoding: "utf8",
8841
9358
  stdio: ["ignore", "pipe", "pipe"]
8842
9359
  }).trim();
@@ -8847,7 +9364,7 @@ function fileDiffAgainst(ref, path) {
8847
9364
  }
8848
9365
  function revParse(ref) {
8849
9366
  try {
8850
- return execFileSync5("git", ["rev-parse", "--verify", ref], {
9367
+ return execFileSync6("git", ["rev-parse", "--verify", ref], {
8851
9368
  encoding: "utf8",
8852
9369
  stdio: ["ignore", "pipe", "pipe"]
8853
9370
  }).trim();
@@ -8857,7 +9374,7 @@ function revParse(ref) {
8857
9374
  }
8858
9375
  function repoRoot() {
8859
9376
  try {
8860
- return execFileSync5("git", ["rev-parse", "--show-toplevel"], {
9377
+ return execFileSync6("git", ["rev-parse", "--show-toplevel"], {
8861
9378
  encoding: "utf8",
8862
9379
  stdio: ["ignore", "pipe", "pipe"]
8863
9380
  }).trim();
@@ -8868,7 +9385,7 @@ function repoRoot() {
8868
9385
  function changedFiles(base) {
8869
9386
  let out;
8870
9387
  try {
8871
- out = execFileSync5("git", ["diff", "--name-only", `${base}...HEAD`], {
9388
+ out = execFileSync6("git", ["diff", "--name-only", `${base}...HEAD`], {
8872
9389
  encoding: "utf8",
8873
9390
  stdio: ["ignore", "pipe", "pipe"]
8874
9391
  }).trim();
@@ -8893,7 +9410,7 @@ function resolveDiff(base = process.env.BASE_SHA || "origin/main") {
8893
9410
  const relPaths = changedFiles(ref);
8894
9411
  if (relPaths === null)
8895
9412
  continue;
8896
- return { base: ref, root, files: relPaths.map((p) => join8(root, p)) };
9413
+ return { base: ref, root, files: relPaths.map((p) => join9(root, p)) };
8897
9414
  }
8898
9415
  return null;
8899
9416
  }
@@ -8929,7 +9446,7 @@ var CHECK_NAME = "exec-bits";
8929
9446
  var EXECUTABLE_MODE = "100755";
8930
9447
  function git2(args) {
8931
9448
  try {
8932
- return execFileSync6("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
9449
+ return execFileSync7("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
8933
9450
  } catch {
8934
9451
  return null;
8935
9452
  }
@@ -8943,7 +9460,7 @@ function indexMode(path) {
8943
9460
  }
8944
9461
  function hasShebang(path) {
8945
9462
  try {
8946
- return readFileSync6(path, "utf8").startsWith("#!");
9463
+ return readFileSync7(path, "utf8").startsWith("#!");
8947
9464
  } catch {
8948
9465
  return false;
8949
9466
  }