@attalabs/vinaya 0.31.0 → 0.33.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 (212) hide show
  1. package/README.md +2 -3
  2. package/aeg-root/contracts/principal-operator.md +18 -5
  3. package/aeg-root/roles/developer/reference.md +3 -3
  4. package/aeg-root/roles/operator.md +69 -16
  5. package/aeg-root/roles/planner/reference.md +1 -1
  6. package/aeg-root/roles/tranche-archivist.md +1 -0
  7. package/aeg-root/skills/aeg-context-packets/SKILL.md +1 -1
  8. package/aeg-root/skills/aeg-context-packets/examples/operator-start.md +1 -1
  9. package/aeg-root/templates/pr-report-template.md +7 -2
  10. package/dist/checks/bin/check-body-bare-digits.js +340 -101
  11. package/dist/checks/bin/check-branch-topology.js +184 -105
  12. package/dist/checks/bin/check-brief-shape.js +333 -94
  13. package/dist/checks/bin/check-changeset-coverage.js +1028 -248
  14. package/dist/checks/bin/check-ci-shard-coverage.js +82 -0
  15. package/dist/checks/bin/check-closes-n.js +184 -105
  16. package/dist/checks/bin/check-coherence.js +345 -145
  17. package/dist/checks/bin/check-dead-branch-push.js +179 -59
  18. package/dist/checks/bin/check-dispatch-readiness.js +350 -150
  19. package/dist/checks/bin/check-doc-coverage-push.js +1011 -231
  20. package/dist/checks/bin/check-doc-coverage.js +1015 -235
  21. package/dist/checks/bin/check-doctrine-no-procedures.js +333 -94
  22. package/dist/checks/bin/check-doctrine-portability.js +1013 -233
  23. package/dist/checks/bin/check-evidence-fresh.js +1010 -222
  24. package/dist/checks/bin/check-exec-bits.js +1009 -229
  25. package/dist/checks/bin/check-first-push-dispatch.js +343 -145
  26. package/dist/checks/bin/check-issue-assignment.js +186 -107
  27. package/dist/checks/bin/check-issue-milestone-attach.js +176 -56
  28. package/dist/checks/bin/check-issue-objectives-numbering.js +176 -56
  29. package/dist/checks/bin/check-issue-parts-coverage.js +176 -56
  30. package/dist/checks/bin/check-issue-surface-globs.js +363 -143
  31. package/dist/checks/bin/check-issue-title-grammar.js +176 -56
  32. package/dist/checks/bin/check-issue-tranche-label.js +176 -56
  33. package/dist/checks/bin/check-main-branch-refusal.js +176 -56
  34. package/dist/checks/bin/check-no-disk-state.js +176 -56
  35. package/dist/checks/bin/check-pr-premise-reassert.js +333 -92
  36. package/dist/checks/bin/check-pr-report-density.js +176 -56
  37. package/dist/checks/bin/check-principal-test-plan-wait.js +176 -54
  38. package/dist/checks/bin/check-quoted-command.js +999 -217
  39. package/dist/checks/bin/check-reader-resolvable-prose.js +1011 -229
  40. package/dist/checks/bin/check-registry-gates.js +186 -56
  41. package/dist/checks/bin/check-retired-vocabulary.js +997 -215
  42. package/dist/checks/bin/check-review-gate.js +403 -203
  43. package/dist/checks/bin/check-single-plan-pr.js +176 -56
  44. package/dist/checks/bin/check-surface-scope.js +184 -105
  45. package/dist/checks/bin/check-test-plan.js +176 -54
  46. package/dist/checks/bin/check-token-collection-wired.js +182 -57
  47. package/dist/checks/bin/check-token-report.js +178 -58
  48. package/dist/checks/bin/check-workspace-escape.js +1011 -229
  49. package/dist/index.js +5971 -3489
  50. package/dist/lib/pre-push-cache-test-run.js +4431 -0
  51. package/dist/lib/pre-push-select-tests.js +799 -110
  52. package/package.json +3 -2
  53. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/actions.ts +10 -12
  54. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +5 -5
  55. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/archive-task.ts +42 -17
  56. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/baseline-capture.ts +1 -2
  57. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/branch-topology-gate.ts +3 -3
  58. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +554 -95
  59. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +264 -44
  60. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/claude-code-transcript.ts +9 -9
  61. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +211 -30
  62. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/consumer-enumeration.ts +2 -2
  63. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +75 -0
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +961 -0
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/migration.ts +212 -0
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/outcomes.ts +135 -0
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +394 -0
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-audit.ts +1 -2
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-guard.ts +1 -1
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/derive-section7.ts +2 -2
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +514 -0
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +110 -0
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +27 -0
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +123 -0
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +27 -0
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +240 -0
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/diagram-model.ts +1 -1
  78. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/direct-main-push.ts +1 -2
  79. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +65 -22
  80. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +238 -0
  81. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-owners.ts +14 -1
  82. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/docs-coherence.ts +1 -1
  83. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/legacy-anchors.ts +1 -1
  84. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/node-route.ts +1 -1
  85. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/surfaced-manifest.ts +1 -1
  86. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-no-procedures.ts +1 -1
  87. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +5 -5
  88. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ensure-label.ts +1 -1
  89. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/first-push-dispatch-gate.ts +1 -1
  90. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +14 -3
  91. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +379 -11
  92. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +3 -4
  93. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +1450 -33
  94. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +1 -2
  95. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/local-anchor-coverage.ts +2 -2
  96. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +119 -0
  97. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +75 -0
  98. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/redact.ts +87 -0
  99. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +801 -0
  100. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +373 -0
  101. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +2 -2
  102. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/metering-io-guard.ts +1 -1
  103. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/milestone-validation.ts +2 -3
  104. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/no-disk-state.ts +2 -2
  105. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives.ts +288 -0
  106. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-token-report.ts +3 -3
  107. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-tranche.ts +1 -1
  108. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +30 -16
  109. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-tier.ts +17 -1
  110. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/premise-check.ts +1 -1
  111. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/quoted-command.ts +1 -1
  112. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +267 -19
  113. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +91 -24
  114. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-scaffold.ts +6 -6
  115. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/report-tokens.ts +4 -4
  116. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +239 -110
  117. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +384 -0
  118. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +184 -0
  119. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +65 -18
  120. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +76 -0
  121. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/single-plan-pr.ts +4 -4
  122. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/state-machine-model.ts +40 -27
  123. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/symbol-collisions.ts +2 -2
  124. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +38 -0
  125. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +488 -0
  126. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +7 -9
  127. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-section.ts +5 -5
  128. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/types.ts +4 -4
  129. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +314 -56
  130. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +2 -3
  131. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/workspace-escape.ts +3 -3
  132. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  133. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  134. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  138. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  143. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +1 -1
  146. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +1 -1
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  151. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +1 -1
  152. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  153. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  154. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  155. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +1 -1
  156. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  157. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  158. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  159. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +1 -1
  160. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  161. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  162. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  163. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +2 -2
  164. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  165. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  166. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  167. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +1 -1
  168. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  169. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  170. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  171. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +1 -1
  172. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  173. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  174. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  175. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +1 -1
  176. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  177. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  178. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/{[externals]__1agj1ww._.js → [externals]__0cki-x_._.js} +2 -2
  179. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +6 -6
  180. 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
  181. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +3 -0
  182. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  183. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0r7e54g._.js → [root-of-the-server]__18paley._.js} +1 -1
  184. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  185. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
  186. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1r47dr7._.js → _08onyya._.js} +3 -3
  187. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  188. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  189. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  190. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  191. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +1 -1
  192. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  193. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  194. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_15gdg48._.js +5 -5
  195. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  196. 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
  197. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  198. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  199. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  200. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  201. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +1 -0
  202. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1dc2_-c_gavj1.js → 1ce2dj27_cgbj.js} +4 -4
  203. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3xg6-flovrcx-.js → 22s44f5k3ecmj.js} +1 -1
  204. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/34hhdtbp20krb.js +1 -0
  205. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  206. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0hstap0._.js +0 -3
  207. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2t_rfsztmwu6y.js +0 -1
  208. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3ua4rm5f-a9k6.js +0 -1
  209. /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/aeg-core}/bin/verify-coherence.ts +0 -0
  210. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_buildManifest.js +0 -0
  211. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_clientMiddlewareManifest.js +0 -0
  212. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_ssgManifest.js +0 -0
@@ -1,6 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { createRequire } from "node:module";
3
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
4
2
  // ../../packages/aeg-core/src/gate-audience.ts
5
3
  var GATE_AUDIENCE = {
6
4
  "check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
@@ -1034,7 +1032,7 @@ function withDefaults(oldDefaults, newDefaults) {
1034
1032
  var endpoint = withDefaults(null, DEFAULTS);
1035
1033
 
1036
1034
  // ../../node_modules/fast-content-type-parse/index.js
1037
- var NullObject = function NullObject2() {};
1035
+ var NullObject = function NullObject() {};
1038
1036
  NullObject.prototype = Object.create(null);
1039
1037
  var paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu;
1040
1038
  var quotedPairRE = /\\([\v\u0020-\u00ff])/gu;
@@ -1778,27 +1776,27 @@ function splitTableRow(row) {
1778
1776
  return parts.map((p) => p.split(PLACEHOLDER).join("|"));
1779
1777
  }
1780
1778
  // ../../packages/aeg-core/src/blast-radius-domains.ts
1781
- function resolveWorkspaceEntry(entry2, listDirs) {
1782
- if (entry2.endsWith("/*")) {
1783
- const baseDir = entry2.slice(0, -2);
1779
+ function resolveWorkspaceEntry(entry, listDirs) {
1780
+ if (entry.endsWith("/*")) {
1781
+ const baseDir = entry.slice(0, -2);
1784
1782
  return listDirs(baseDir).map((name) => `${baseDir}/${name}`);
1785
1783
  }
1786
- if (entry2.includes("*"))
1784
+ if (entry.includes("*"))
1787
1785
  return [];
1788
- return [entry2];
1786
+ return [entry];
1789
1787
  }
1790
1788
  // ../../packages/aeg-core/src/consumer-enumeration.ts
1791
1789
  function deriveWorkspaceMemberDirs(workspaces, listDirs) {
1792
- const positive = workspaces.filter((entry2) => !entry2.startsWith("!"));
1793
- const negative = workspaces.filter((entry2) => entry2.startsWith("!")).map((entry2) => entry2.slice(1));
1790
+ const positive = workspaces.filter((entry) => !entry.startsWith("!"));
1791
+ const negative = workspaces.filter((entry) => entry.startsWith("!")).map((entry) => entry.slice(1));
1794
1792
  const excluded = new Set;
1795
- for (const entry2 of negative) {
1796
- for (const member of resolveWorkspaceEntry(entry2, listDirs))
1793
+ for (const entry of negative) {
1794
+ for (const member of resolveWorkspaceEntry(entry, listDirs))
1797
1795
  excluded.add(member);
1798
1796
  }
1799
1797
  const members = new Set;
1800
- for (const entry2 of positive) {
1801
- for (const member of resolveWorkspaceEntry(entry2, listDirs)) {
1798
+ for (const entry of positive) {
1799
+ for (const member of resolveWorkspaceEntry(entry, listDirs)) {
1802
1800
  if (!excluded.has(member))
1803
1801
  members.add(member);
1804
1802
  }
@@ -2044,12 +2042,24 @@ function extractBaseSha(comment) {
2044
2042
  const m = firstThirteenLines(comment).match(BASE_SHA_PATTERN);
2045
2043
  return m ? m[1].toLowerCase() : null;
2046
2044
  }
2047
- var FINDING_SEVERITY_LINE = /^\d+\.\s+\[([A-Z][A-Z]*)\]\s+(.+?)\s+—/gm;
2045
+ var FINDING_DESCRIPTION_STATE = /^F(\d+)(?:\s+\S+)?(?:\s+(open|fix-claimed|reproduced|resolved))?:/;
2046
+ function parseFindingState(description) {
2047
+ const m = FINDING_DESCRIPTION_STATE.exec(description.trim());
2048
+ if (!m)
2049
+ return { id: null, state: null };
2050
+ return { id: `F${m[1]}`, state: m[2] ?? null };
2051
+ }
2052
+ var FINDING_SEVERITY_LINE = /^\d+\.\s+\[([A-Z][A-Z]*)\]\s+(.+?)\s+—(?:\s+(.*))?$/gm;
2048
2053
  function extractFindingSeverities(comment) {
2049
- return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) => ({
2050
- severity: m[1],
2051
- location: m[2]
2052
- }));
2054
+ return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) => {
2055
+ const { id, state } = parseFindingState(m[3] ?? "");
2056
+ return {
2057
+ severity: m[1],
2058
+ location: m[2],
2059
+ id,
2060
+ state
2061
+ };
2062
+ });
2053
2063
  }
2054
2064
  function extractVerdict(comments, valuePattern, missingLabel) {
2055
2065
  const candidates = comments.filter((c) => valuePattern.test(c));
@@ -2122,15 +2132,15 @@ function summarizeTranscript(jsonl) {
2122
2132
  const line = rawLine.trim();
2123
2133
  if (!line)
2124
2134
  continue;
2125
- let entry2;
2135
+ let entry;
2126
2136
  try {
2127
- entry2 = JSON.parse(line);
2137
+ entry = JSON.parse(line);
2128
2138
  } catch {
2129
2139
  continue;
2130
2140
  }
2131
- if (!entry2 || typeof entry2 !== "object")
2141
+ if (!entry || typeof entry !== "object")
2132
2142
  continue;
2133
- const obj = entry2;
2143
+ const obj = entry;
2134
2144
  if (obj.type !== "assistant")
2135
2145
  continue;
2136
2146
  const message = obj.message;
@@ -2463,6 +2473,12 @@ function evaluateReviewFindings(findings, scale, threshold) {
2463
2473
  });
2464
2474
  return { outcome: blockingFindings.length > 0 ? "blocked" : "clean", blockingFindings };
2465
2475
  }
2476
+ function isConsequentialFinding(finding) {
2477
+ return finding.state !== "resolved";
2478
+ }
2479
+ function consequentialFindings(findings) {
2480
+ return findings.filter((f) => isConsequentialFinding(f));
2481
+ }
2466
2482
  function evaluateCodeReview(findings, policy) {
2467
2483
  return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold);
2468
2484
  }
@@ -2978,7 +2994,7 @@ function isStep0Block(content) {
2978
2994
  }
2979
2995
  function checkCommandsCarryOutput(prBody) {
2980
2996
  const errors = [];
2981
- for (const [label2, num] of [
2997
+ for (const [label, num] of [
2982
2998
  ["5", 5],
2983
2999
  ["6", 6]
2984
3000
  ]) {
@@ -2992,7 +3008,7 @@ function checkCommandsCarryOutput(prBody) {
2992
3008
  continue;
2993
3009
  const next = blocks[i + 1];
2994
3010
  if (!next || isCommandBlock(next.content)) {
2995
- errors.push(`brief-validation commands carry output: §${label2} has a command block ("${firstNonBlankLine(block.content)}") not immediately followed by a non-command output block — the very next fenced block must hold that command's actual output, not another command.`);
3011
+ errors.push(`brief-validation commands carry output: §${label} has a command block ("${firstNonBlankLine(block.content)}") not immediately followed by a non-command output block — the very next fenced block must hold that command's actual output, not another command.`);
2996
3012
  }
2997
3013
  }
2998
3014
  }
@@ -3429,8 +3445,8 @@ function stripPartBackticks(text) {
3429
3445
  function partWordCount(text) {
3430
3446
  return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
3431
3447
  }
3432
- function looksLikeFilePath(entry2) {
3433
- const stripped = entry2.replace(/\/\*\*?$/, "");
3448
+ function looksLikeFilePath(entry) {
3449
+ const stripped = entry.replace(/\/\*\*?$/, "");
3434
3450
  const lastSegment = stripped.split("/").pop() ?? stripped;
3435
3451
  const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
3436
3452
  return extMatch !== null && extMatch.index > 0;
@@ -3916,14 +3932,14 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
3916
3932
  const referenced = extractClosesReferences(prBody);
3917
3933
  if (taskIssueRefs) {
3918
3934
  for (const n of referenced) {
3919
- const ref2 = taskIssueRefs.get(n);
3920
- if (!ref2)
3935
+ const ref = taskIssueRefs.get(n);
3936
+ if (!ref)
3921
3937
  continue;
3922
- const expectedBranch = `task/${ref2.trancheSlug}/${ref2.taskId}`;
3938
+ const expectedBranch = `task/${ref.trancheSlug}/${ref.taskId}`;
3923
3939
  if (branch !== expectedBranch) {
3924
3940
  return {
3925
3941
  ok: false,
3926
- message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${ref2.taskId} of tranche "${ref2.trancheSlug}") but is not named "${expectedBranch}" — rename the branch and re-push, or if this work is intentionally outside AEG's dispatch flow, remove the Closes reference.`
3942
+ message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${ref.taskId} of tranche "${ref.trancheSlug}") but is not named "${expectedBranch}" — rename the branch and re-push, or if this work is intentionally outside AEG's dispatch flow, remove the Closes reference.`
3927
3943
  };
3928
3944
  }
3929
3945
  }
@@ -3932,15 +3948,15 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
3932
3948
  if (!ref)
3933
3949
  return { ok: true };
3934
3950
  if (ref.kind === "issue") {
3935
- const expectedIssue2 = ref.issueNumber;
3936
- if (!referenced.has(expectedIssue2)) {
3951
+ const expectedIssue = ref.issueNumber;
3952
+ if (!referenced.has(expectedIssue)) {
3937
3953
  return {
3938
3954
  ok: false,
3939
- expectedIssue: expectedIssue2,
3940
- message: `closes-n: PR body does not contain \`Closes #${expectedIssue2}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
3955
+ expectedIssue,
3956
+ message: `closes-n: PR body does not contain \`Closes #${expectedIssue}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
3941
3957
  };
3942
3958
  }
3943
- return { ok: true, expectedIssue: expectedIssue2 };
3959
+ return { ok: true, expectedIssue };
3944
3960
  }
3945
3961
  const trancheSlug = ref.tranche;
3946
3962
  const taskId = ref.taskId;
@@ -3986,8 +4002,8 @@ function extractIssue(body) {
3986
4002
  const anchorNums = closesRefs(anchored);
3987
4003
  if (anchorNums.length === 0)
3988
4004
  return { issue: null, extraIssues: bodyNums, outsideHeader: false };
3989
- const issue2 = anchorNums[0];
3990
- return { issue: issue2, extraIssues: bodyNums.filter((n) => n !== issue2), outsideHeader: false };
4005
+ const issue = anchorNums[0];
4006
+ return { issue, extraIssues: bodyNums.filter((n) => n !== issue), outsideHeader: false };
3991
4007
  }
3992
4008
  const headerNums = closesRefs(headerRegion(stripped));
3993
4009
  if (bodyNums.length === 0)
@@ -4056,15 +4072,15 @@ function compareManifest(echoed, current, patchIdOf) {
4056
4072
  const bothFullShas = echoedShaLen >= 40 && currentShaLen >= 40;
4057
4073
  const base = patchHead || exactHead && bothFullShas ? true : isBoundToBase(echoed, current.baseSha);
4058
4074
  const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
4059
- const objectivesVersion2 = isBoundToObjectives(echoed, current.objectivesVersion);
4075
+ const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
4060
4076
  const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
4061
4077
  const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
4062
4078
  return {
4063
- bound: head && base && briefHashBound && objectivesVersion2 && rulingOrdinal && policyDigestBound,
4079
+ bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
4064
4080
  head,
4065
4081
  base,
4066
4082
  briefHash: briefHashBound,
4067
- objectivesVersion: objectivesVersion2,
4083
+ objectivesVersion,
4068
4084
  rulingOrdinal,
4069
4085
  policyDigest: policyDigestBound
4070
4086
  };
@@ -4095,8 +4111,8 @@ function checkReviewGate(input) {
4095
4111
  let codeReviewPolicyEvaluation;
4096
4112
  let securityPolicyEvaluation;
4097
4113
  try {
4098
- codeReviewPolicyEvaluation = evaluateCodeReview(codeReview.findingSeverities, policy);
4099
- securityPolicyEvaluation = evaluateSecurityReview(security.findingSeverities, policy);
4114
+ codeReviewPolicyEvaluation = evaluateCodeReview(consequentialFindings(codeReview.findingSeverities), policy);
4115
+ securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy);
4100
4116
  } catch (err) {
4101
4117
  return {
4102
4118
  verdict: "fail",
@@ -5177,11 +5193,27 @@ var ObservedSchema = z.object({
5177
5193
  var TaskStatusInputSchema = z.object({
5178
5194
  task: TaskToolRefSchema.optional()
5179
5195
  }).merge(PageRequestSchema).strict();
5196
+ var TaskConfidenceSchema = z.object({
5197
+ round: z.number().int().positive(),
5198
+ percent: z.number().int().min(0).max(100).nullable(),
5199
+ source: z.enum(["stated", "published-summary"])
5200
+ }).strict();
5201
+ var TaskPhaseHistorySchema = z.object({
5202
+ typicalPhaseMinutes: z.number().nonnegative(),
5203
+ typicalPhaseSamples: z.number().int().positive()
5204
+ }).strict();
5180
5205
  var TaskStatusItemSchema = z.object({
5181
5206
  task: TaskToolRefSchema,
5182
5207
  issue: z.number().int().positive(),
5183
5208
  pr: z.number().int().positive().nullable(),
5184
- state: z.string()
5209
+ state: z.string(),
5210
+ round: z.number().int().positive().nullable().optional(),
5211
+ phase: z.string().min(1).nullable().optional(),
5212
+ minutesInPhase: z.number().nonnegative().nullable().optional(),
5213
+ phaseIsCurrent: z.boolean().nullable().optional(),
5214
+ lastConfidence: TaskConfidenceSchema.nullable().optional(),
5215
+ lastConfidenceUnread: z.boolean().optional(),
5216
+ phaseHistory: TaskPhaseHistorySchema.nullable().optional()
5185
5217
  }).merge(ObservedSchema);
5186
5218
  var TaskStatusResultSchema = z.object({
5187
5219
  items: z.array(TaskStatusItemSchema),
@@ -5193,7 +5225,7 @@ var EscalationInputsSchema = z.object({
5193
5225
  round: z.number().int().nonnegative(),
5194
5226
  head: z.string(),
5195
5227
  branch: z.string(),
5196
- prNumber: z.number().int().positive()
5228
+ prNumber: z.number().int().positive().nullable()
5197
5229
  });
5198
5230
  var EscalationEvidenceSchema = z.object({
5199
5231
  round: z.number().int().nonnegative(),
@@ -5229,13 +5261,45 @@ var TaskEscalationReadResultSchema = z.object({
5229
5261
  items: z.array(TaskEscalationPacketSchema),
5230
5262
  nextCursor: z.string().nullable()
5231
5263
  }).merge(ObservedSchema);
5232
- var TaskStartInputSchema = z.object({
5233
- tranche: z.string().min(1),
5234
- id: z.string().min(1)
5264
+ var TaskPrCheckSchema = z.object({
5265
+ name: z.string(),
5266
+ required: z.boolean(),
5267
+ status: z.string(),
5268
+ conclusion: z.string().nullable(),
5269
+ detailsUrl: z.string().nullable(),
5270
+ failureSummary: z.string().nullable()
5271
+ });
5272
+ var TaskPrVerdictSchema = z.object({
5273
+ role: z.enum(["code-review", "security"]),
5274
+ value: z.string(),
5275
+ judgedHead: z.string().nullable(),
5276
+ objectivesVersion: z.string().nullable()
5277
+ });
5278
+ var TaskPrPauseSchema = z.object({
5279
+ reason: z.string(),
5280
+ body: z.string()
5281
+ });
5282
+ var TaskPrReviewRecordSchema = z.object({
5283
+ verdicts: z.array(TaskPrVerdictSchema),
5284
+ roundMarkers: z.array(z.number().int().nonnegative()),
5285
+ summaryTable: z.string().nullable(),
5286
+ pause: TaskPrPauseSchema.nullable()
5287
+ });
5288
+ var TaskPrReadInputSchema = z.object({
5289
+ task: TaskToolRefSchema,
5290
+ pr: z.number().int().positive().optional()
5235
5291
  }).strict();
5292
+ var TaskPrReadResultSchema = z.object({
5293
+ task: TaskToolRefSchema,
5294
+ issue: z.number().int().positive(),
5295
+ pr: z.number().int().positive(),
5296
+ head: z.string().nullable(),
5297
+ checks: z.array(TaskPrCheckSchema),
5298
+ review: TaskPrReviewRecordSchema
5299
+ }).merge(ObservedSchema);
5236
5300
  var TaskStartResultSchema = z.object({
5237
5301
  requestId: z.string().min(1),
5238
- run: z.object({ tranche: z.string().min(1), id: z.string().min(1) }),
5302
+ run: TaskToolRefSchema,
5239
5303
  started: z.boolean(),
5240
5304
  startedAt: z.string(),
5241
5305
  mode: z.literal("attended")
@@ -5249,7 +5313,7 @@ var TaskCancelInputSchema = z.object({
5249
5313
  }).strict();
5250
5314
  var TaskResumeResultSchema = z.object({
5251
5315
  task: z.number().int().positive(),
5252
- pr: z.number().int().positive(),
5316
+ pr: z.number().int().positive().nullable(),
5253
5317
  escalationId: z.string().min(1),
5254
5318
  outcome: z.enum(["started", "already_resumed"]),
5255
5319
  authenticatedBy: z.string().min(1),
@@ -5258,7 +5322,7 @@ var TaskResumeResultSchema = z.object({
5258
5322
  var TaskCancelOutcomeSchema = z.enum(["confirmed", "pending", "uncertain"]);
5259
5323
  var TaskCancelResultSchema = z.object({
5260
5324
  task: z.number().int().positive(),
5261
- pr: z.number().int().positive(),
5325
+ pr: z.number().int().positive().nullable(),
5262
5326
  escalationId: z.string().min(1),
5263
5327
  outcome: TaskCancelOutcomeSchema,
5264
5328
  authenticatedBy: z.string().min(1),
@@ -5269,6 +5333,7 @@ var TASK_TOOL_NAMES = [
5269
5333
  "task_start",
5270
5334
  "task_status",
5271
5335
  "task_escalation_read",
5336
+ "task_pr_read",
5272
5337
  "task_resume",
5273
5338
  "task_cancel"
5274
5339
  ];
@@ -5496,6 +5561,10 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
5496
5561
  }
5497
5562
  return findings;
5498
5563
  }
5564
+ // ../../packages/aeg-core/src/dev-review-loop/types.ts
5565
+ var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
5566
+ // ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
5567
+ var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
5499
5568
  // ../../packages/aeg-core/src/log/envelope.ts
5500
5569
  import { createHash as createHash5 } from "node:crypto";
5501
5570
 
@@ -6034,6 +6103,7 @@ function redact(value, home) {
6034
6103
  return value;
6035
6104
  }
6036
6105
  // ../../packages/aeg-core/src/log/store.ts
6106
+ var KNOWN_SCHEMA_VERSIONS = [1, 2];
6037
6107
  function metaOf(obj) {
6038
6108
  if (obj === null || typeof obj !== "object")
6039
6109
  return null;
@@ -6056,11 +6126,61 @@ function recordIdentity(obj) {
6056
6126
  }
6057
6127
  return null;
6058
6128
  }
6059
-
6060
- // ../../packages/aeg-core/src/log/artifact.ts
6061
- var TASK_LOG_ARTIFACT_MAX_BYTES = 8 * 1024 * 1024;
6062
- // ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
6063
- var STOPPED_CONDITIONS = new Set(["confidence", "reappearance", "no_progress", "max_rounds"]);
6129
+ function schemaVersionOf(obj) {
6130
+ const meta = metaOf(obj);
6131
+ const schema = meta?.schema;
6132
+ return typeof schema === "number" ? schema : null;
6133
+ }
6134
+ function isKnownSchema(version) {
6135
+ return version !== null && KNOWN_SCHEMA_VERSIONS.includes(version);
6136
+ }
6137
+ function classifyStoredLine(raw, home) {
6138
+ let obj;
6139
+ try {
6140
+ obj = JSON.parse(raw);
6141
+ } catch {
6142
+ return { status: "invalid", identity: null, raw, reason: "not valid JSON" };
6143
+ }
6144
+ const version = schemaVersionOf(obj);
6145
+ if (version === null) {
6146
+ return { status: "invalid", identity: recordIdentity(obj), raw, reason: "no readable meta.schema" };
6147
+ }
6148
+ if (!isKnownSchema(version)) {
6149
+ return {
6150
+ status: "unknown_version",
6151
+ identity: recordIdentity(obj),
6152
+ schema: version,
6153
+ raw,
6154
+ reason: `schema version ${version} is not one this build validates (${KNOWN_SCHEMA_VERSIONS.join(", ")}) — kept for diagnosis`
6155
+ };
6156
+ }
6157
+ const result = LogEventSchema.safeParse(obj);
6158
+ if (!result.success) {
6159
+ return {
6160
+ status: "invalid",
6161
+ identity: recordIdentity(obj),
6162
+ raw,
6163
+ reason: result.error.issues[0]?.message ?? "schema violation"
6164
+ };
6165
+ }
6166
+ const event = result.data;
6167
+ const identity = recordIdentity(event);
6168
+ if (identity === null) {
6169
+ return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
6170
+ }
6171
+ const redacted = redact(event, home);
6172
+ const provenance = version === 2 ? event.meta.provenance ?? null : null;
6173
+ return {
6174
+ status: "ok",
6175
+ identity,
6176
+ runId: event.meta.run_id,
6177
+ seq: event.meta.seq,
6178
+ schema: version,
6179
+ provenance,
6180
+ event,
6181
+ postLine: JSON.stringify(redacted)
6182
+ };
6183
+ }
6064
6184
  // ../../packages/aeg-core/src/control-store/records.ts
6065
6185
  import { z as z3 } from "zod";
6066
6186
  var isoTimestamp = z3.string().min(1);
@@ -6217,6 +6337,8 @@ function readIssueCheckEnv(env = process.env) {
6217
6337
 
6218
6338
  // src/lib/brief-assembly.ts
6219
6339
  import { execFileSync as execFileSync4 } from "node:child_process";
6340
+ import { existsSync as existsSync3, readFileSync as readFileSync3, readdirSync } from "node:fs";
6341
+ import { join as join3 } from "node:path";
6220
6342
 
6221
6343
  // ../../packages/sources/src/commands.ts
6222
6344
  var COMMANDS = [
@@ -6369,10 +6491,10 @@ var COMMANDS = [
6369
6491
  }
6370
6492
  ],
6371
6493
  details: [
6372
- "Composes `task brief`'s own preparation (`prepareTask`) with `dev-review-loop` (`devReviewLoop`) — 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.",
6494
+ "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.",
6373
6495
  "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.",
6374
- "Refuses when the frozen brief's developer branch already has an open pull request — the old `task dispatch` followed by `task run` cannot start two developers this way.",
6375
- "Exit and printed summary distinguish a published, reviewed pull request (exit `0`, the PR URL) from a pause (exit `1`, with the exact `vinaya dev-review-loop --resume <pr>` command to continue), a usage/argv error (exit `2`), and any other failure (exit `3`) — never sharing `1` with a pause, so an unattended host tells them apart from the exit code alone. A run that pauses is resumed with the loop's own existing `--resume <pr>` flag, never a flag on this command."
6496
+ "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.",
6497
+ "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`)."
6376
6498
  ],
6377
6499
  status: "shipped"
6378
6500
  },
@@ -6411,7 +6533,7 @@ var COMMANDS = [
6411
6533
  details: [
6412
6534
  "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.",
6413
6535
  "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.",
6414
- "`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."
6536
+ "`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."
6415
6537
  ],
6416
6538
  status: "shipped"
6417
6539
  },
@@ -6541,48 +6663,6 @@ var COMMANDS = [
6541
6663
  ],
6542
6664
  status: "shipped"
6543
6665
  },
6544
- {
6545
- name: "log flush",
6546
- description: "Post a target Issue or PR's outbox as one or more marked comments, then truncate what the forge confirmed",
6547
- flags: [
6548
- { flag: "--issue", description: "Flush this Issue's outbox (`~/.vinaya/outbox/<owner>-<repo>/<n>.ndjson`)" },
6549
- {
6550
- flag: "--pr",
6551
- description: "Flush the Issue named by this PR's `Closes #N` line, posting the comments on the PR"
6552
- },
6553
- { flag: "--json", description: "Enveloped JSON output (schema: 1)" }
6554
- ],
6555
- details: [
6556
- "Exactly one of `--issue`/`--pr` is required. `--pr` resolves the Issue from the PR body's `Closes #N` line — the same anchor every gate reads — and refuses with a check error naming the missing line when the body carries none.",
6557
- "Splits the outbox first at `run_id` boundaries (a maximal run of consecutive lines sharing one `run_id`, never a global group-by, so an interleaved outbox never produces a range spanning a gap), then at `FORGE_COMMENT_MAX_CHARS` (65536) within each run. Each comment opens with `<!-- aeg:log:<run_id>:<seq_from>-<seq_to> -->` on its own line, then one fenced `ndjson` block, one outbox line per line, verbatim. A single line too large to fit alone is refused by name, never split across two comments.",
6558
- "Logs its own `forge_write` line — `validated` before posting, `written` (with every returned comment id) after the last post succeeds, or `refused` (with gh's error) on any failure — through the same `log()` every other family uses, into the same outbox, before truncating. The outbox is truncated only to the lines confirmed posted; a failed chunk's lines, and anything appended to the outbox during the flush (including the flush's own `validated`/`written`/`refused` line), always survive to ride the next flush."
6559
- ],
6560
- status: "shipped"
6561
- },
6562
- {
6563
- name: "log export-artifact",
6564
- description: "Copy this run's own local outbox into a file, for the generated task-path workflow's own upload step",
6565
- flags: [],
6566
- details: [
6567
- "Concatenates every `*.ndjson` file under `~/.vinaya/outbox/` into `<dest>`, verbatim — no filtering, no second redaction pass (lines are already redacted at `log()`'s own write boundary). Writes nothing when the outbox is empty, and exits 0 either way: no gate events this run is a legitimate outcome, never a failure.",
6568
- "Runs inside the generated `vinaya-checks.yml` job, which holds no forge-write credential — this command never calls the forge. Both this step and the `actions/upload-artifact` step after it run `if: always()`, so a cancelled or failed job still exports whatever partial outbox it has."
6569
- ],
6570
- status: "shipped"
6571
- },
6572
- {
6573
- name: "log collect-artifact",
6574
- description: "Validate a downloaded task-log artifact and publish the valid records through the existing flush path",
6575
- flags: [
6576
- { flag: "--pr", description: "The pull request this artifact belongs to" },
6577
- { flag: "--repo", description: "Expected `owner/repo` — a provenance cross-check against each record" }
6578
- ],
6579
- details: [
6580
- "Runs inside the generated `vinaya-task-log-collector.yml` workflow — a `workflow_run`-triggered job on the default branch, holding the write credential the task-path job that produced the artifact never gets. `<path>` is already downloaded by that workflow, scoped to a specific, API-verified run id — a provenance guarantee this command never re-derives from the artifact bytes.",
6581
- "Never executes, imports, or evaluates the artifact's content: every line is read as text and validated (schema, an 8 MiB whole-artifact size cap, redaction, and a repo cross-check) before anything is trusted. A rejected line becomes a named gap — printed, never a silent drop — and the artifact is never partially trusted past that check into executing anything.",
6582
- "The valid, re-redacted survivors are appended into the same local outbox `vinaya log flush` would read for that PR's Issue, then published through the existing `flushOutbox` unmodified — reusing its chunking, its `<!-- aeg:log:… -->` marker, and its idempotent-retry read, rather than a second publisher. A retried collector run (a fresh runner, the same forge state) therefore dedupes for free: the marker already on the forge is acknowledged, never re-posted."
6583
- ],
6584
- status: "shipped"
6585
- },
6586
6666
  {
6587
6667
  name: "milestone create",
6588
6668
  description: "Create a GitHub Milestone from a validated body",
@@ -6912,7 +6992,7 @@ var COMMANDS = [
6912
6992
  { flag: "--task", description: "This dispatch's task Issue number — mutually exclusive with `--pr`" },
6913
6993
  {
6914
6994
  flag: "--pr",
6915
- description: "Flush the outbox to this PR's Issue after the dispatch — mutually exclusive with `--task`"
6995
+ description: "This dispatch's pull request number, for attribution — mutually exclusive with `--task`"
6916
6996
  },
6917
6997
  { flag: "--round", description: "Round number, for a dispatch inside a review loop" },
6918
6998
  {
@@ -6924,7 +7004,7 @@ var COMMANDS = [
6924
7004
  details: [
6925
7005
  "Sets `VINAYA_RUN_ID`/`VINAYA_ROLE`/`VINAYA_TASK`/`VINAYA_ROUND` on the child only — never on this process's own environment — and refuses by name, before any spawn attempt, when the named vendor binary is absent from `PATH` or present but not executable.",
6926
7006
  "Records `dispatched` (with the prompt's sha256), `outcome_received` (duration, the vendor's own usage when its stdout prints a recognizable shape), or `dispatch_failed` (`timeout`, `crash`, or `refused`) through the Vinaya Log's one `dispatch` family writer, `dispatchRole`. A wall-time ceiling (`dispatch.timeoutMs` in config, default one hour) sends `SIGTERM` then, after a grace window, `SIGKILL`.",
6927
- "When `--task` or `--pr` is given, flushes that outbox via `vinaya log flush` immediately after the child settles — `--task` and `--pr` are mutually exclusive here, matching `log flush`'s own single-target rule. Without either, the dispatch still runs and logs; nothing is flushed, and the lines ride to the next flush.",
7007
+ "Runs no flush of its own after the dispatch returns: every log line `dispatchRole` emits reaches its configured `logs` destination live, as it is emitted, so there is nothing left to ship in a trailing step. `--task`/`--pr` are attribution only, and remain mutually exclusive.",
6928
7008
  "A successful dispatch's `DispatchHandle` carries `resumeId` — the vendor's own session/thread identifier (claude/gemini: `session_id`; codex: `thread_id`), parsed from its stdout, `null` on any failure. Passing that value as `--resume <id>` on a later call swaps in that vendor's own resume invocation (`claude -p -r <id> ...`; `codex exec resume <id> ...`; `gemini ... --resume <id> ...`) in place of its first-dispatch args."
6929
7009
  ],
6930
7010
  status: "shipped"
@@ -6944,7 +7024,8 @@ var COMMANDS = [
6944
7024
  "Dispatches the developer through `dispatchRole` with the brief read from the Issue, waits for the PR it opens, then runs `assessRound` (`@attalabs/aeg-core`) — the entire policy — against observations this command reads from the forge: the head via `git ls-remote` only (never `gh pr view headRefOid`, which can lag a push), CI conclusion via the check-runs API (never run locally), and ruling comments matching `<!-- aeg:principal:ruling:<pr>-<k> -->`.",
6945
7025
  "Nothing is posted to the PR before the policy decides `publish`: each round's reviewer and security verdicts are dispatched fresh (never a resumed session) through `dispatchRole`, rendered through `review post`'s own render functions, and written to a local file under the outbox — never `gh pr comment`/`gh pr review`. Posting the held verdicts is a separate, later task.",
6946
7026
  "The developer's session is resumed every round via `dispatchRole`'s `resumeId` — never a fresh session — for every vendor; a round whose resume fails for a vendor that resumed successfully the round before stops the loop rather than silently falling back to a fresh developer session.",
6947
- "Every dispatch and round transition is a log line through the Vinaya Log, flushed to the forge at each round boundary."
7027
+ "Every dispatch and round transition is a log line through the Vinaya Log, delivered live to its configured `logs` destination as it is emitted — never a tracker comment.",
7028
+ "issue-711 O4: this command — `--task <n>`, `--resume <pr>`, `--cancel <pr>` alike — stays `task run`'s own one-shot debug/direct entry; the watching driver that survives a pause and continues on its own is `task run`'s (see that command's own entry)."
6948
7029
  ],
6949
7030
  status: "shipped"
6950
7031
  }
@@ -7082,7 +7163,8 @@ async function resolveEdge(id, taskById, factsByTaskId, repo, resolveSibling = d
7082
7163
  }
7083
7164
 
7084
7165
  // src/lib/config.ts
7085
- import { execFileSync as execFileSync3 } from "node:child_process";
7166
+ import { execFile as execFile4, execFileSync as execFileSync3 } from "node:child_process";
7167
+ import { promisify as promisify4 } from "node:util";
7086
7168
  import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
7087
7169
  import { homedir } from "node:os";
7088
7170
  import { dirname, isAbsolute, join, resolve } from "node:path";
@@ -7109,10 +7191,10 @@ var CheckEntrySchema = z5.object({
7109
7191
  ownWorkflow: z5.boolean().optional(),
7110
7192
  principalOwed: z5.literal(true).optional(),
7111
7193
  validates: z5.enum(["body", "issue"]).optional()
7112
- }).superRefine((entry2, ctx) => {
7113
- if (!entry2.env)
7194
+ }).superRefine((entry, ctx) => {
7195
+ if (!entry.env)
7114
7196
  return;
7115
- for (const [key, value] of Object.entries(entry2.env)) {
7197
+ for (const [key, value] of Object.entries(entry.env)) {
7116
7198
  if (typeof value !== "object" || value === null || !("anyOf" in value))
7117
7199
  continue;
7118
7200
  const members = value.anyOf;
@@ -7269,18 +7351,19 @@ var VinayaConfigSchema = z5.object({
7269
7351
  });
7270
7352
  }
7271
7353
  }).optional(),
7272
- logPublish: z5.object({
7273
- issue: z5.number().int().positive().optional(),
7274
- pr: z5.number().int().positive().optional(),
7275
- webhookUrl: z5.string().url().optional(),
7276
- headers: z5.record(z5.string()).optional(),
7277
- maxChunksPerFlush: z5.number().int().positive().optional()
7278
- }).refine((v) => [v.issue, v.pr, v.webhookUrl].filter((x) => x !== undefined).length <= 1, {
7279
- message: "logPublish: set at most one of issue/pr/webhookUrl"
7280
- }).refine((v) => v.headers === undefined || v.webhookUrl !== undefined, {
7281
- message: "logPublish: headers requires webhookUrl"
7282
- }).optional(),
7283
- runtimeDir: z5.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional()
7354
+ logPublish: z5.unknown().refine((v) => v === undefined, {
7355
+ message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
7356
+ }),
7357
+ runtimeDir: z5.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
7358
+ logs: z5.object({
7359
+ folder: z5.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
7360
+ url: z5.string().url().optional(),
7361
+ headers: z5.record(z5.string()).optional()
7362
+ }).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
7363
+ message: "logs: set at most one of folder/url"
7364
+ }).refine((v) => v.headers === undefined || v.url !== undefined, {
7365
+ message: "logs: headers requires url"
7366
+ }).optional()
7284
7367
  });
7285
7368
  var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
7286
7369
  var GLOBAL_CONFIG_PATH = join(GLOBAL_VINAYA_HOME, "config.json");
@@ -7325,32 +7408,39 @@ function globalTokensCollectIgnoredWarning(path) {
7325
7408
  function globalRuntimeDirIgnoredWarning(path) {
7326
7409
  return `${path}: "runtimeDir" in the global config is ignored — it carries no repository segment, so a machine-wide value would collapse every repository's task folders into one tree. Declare it from a repo-local vinaya.config.json.`;
7327
7410
  }
7411
+ var emittedGlobalKeyWarnings = new Set;
7412
+ function warnGlobalKeyIgnoredOnce(message) {
7413
+ if (emittedGlobalKeyWarnings.has(message))
7414
+ return;
7415
+ emittedGlobalKeyWarnings.add(message);
7416
+ console.error(`⚠ ${message}`);
7417
+ }
7328
7418
  function stripGlobalOnlyKeys(config, path) {
7329
7419
  if (path !== GLOBAL_CONFIG_PATH)
7330
7420
  return config;
7331
7421
  let result = config;
7332
7422
  if (result.checks && Object.keys(result.checks).length > 0) {
7333
- console.error(`⚠ ${globalChecksIgnoredWarning(path)}`);
7423
+ warnGlobalKeyIgnoredOnce(globalChecksIgnoredWarning(path));
7334
7424
  result = { ...result, checks: undefined };
7335
7425
  }
7336
7426
  if (result.roles && Object.keys(result.roles).length > 0) {
7337
- console.error(`⚠ ${globalRolesIgnoredWarning(path)}`);
7427
+ warnGlobalKeyIgnoredOnce(globalRolesIgnoredWarning(path));
7338
7428
  result = { ...result, roles: undefined };
7339
7429
  }
7340
7430
  if (result.principals && result.principals.length > 0) {
7341
- console.error(`⚠ ${globalPrincipalsIgnoredWarning(path)}`);
7431
+ warnGlobalKeyIgnoredOnce(globalPrincipalsIgnoredWarning(path));
7342
7432
  result = { ...result, principals: undefined };
7343
7433
  }
7344
7434
  if (result.releaseActor) {
7345
- console.error(`⚠ ${globalReleaseActorIgnoredWarning(path)}`);
7435
+ warnGlobalKeyIgnoredOnce(globalReleaseActorIgnoredWarning(path));
7346
7436
  result = { ...result, releaseActor: undefined };
7347
7437
  }
7348
7438
  if (result.tokens) {
7349
- console.error(`⚠ ${globalTokensCollectIgnoredWarning(path)}`);
7439
+ warnGlobalKeyIgnoredOnce(globalTokensCollectIgnoredWarning(path));
7350
7440
  result = { ...result, tokens: undefined };
7351
7441
  }
7352
7442
  if (result.runtimeDir) {
7353
- console.error(`⚠ ${globalRuntimeDirIgnoredWarning(path)}`);
7443
+ warnGlobalKeyIgnoredOnce(globalRuntimeDirIgnoredWarning(path));
7354
7444
  result = { ...result, runtimeDir: undefined };
7355
7445
  }
7356
7446
  return result;
@@ -7383,26 +7473,102 @@ function resolveReviewPolicy(config) {
7383
7473
  maxRounds
7384
7474
  };
7385
7475
  }
7386
- function trustAnchorRepo() {
7387
- const wellFormed = (slug) => /^[^/\s]+\/[^/\s]+$/.test(slug) ? slug : null;
7388
- const fromRunner = process.env.GITHUB_REPOSITORY?.trim();
7389
- if (fromRunner) {
7390
- const validated = wellFormed(fromRunner);
7391
- if (validated)
7392
- return validated;
7476
+ function resolveRuntimeDirSetting(config) {
7477
+ return config?.runtimeDir ?? null;
7478
+ }
7479
+ function resolveTrustAnchorRuntimeDir(localRuntimeDir, trustAnchorConfig) {
7480
+ const anchored = resolveRuntimeDirSetting(trustAnchorConfig);
7481
+ return anchored !== null && anchored === localRuntimeDir ? anchored : null;
7482
+ }
7483
+ function resolveLogsSetting(config) {
7484
+ const raw = config?.logs;
7485
+ if (!raw)
7486
+ return null;
7487
+ if (raw.url !== undefined)
7488
+ return { url: raw.url, headers: raw.headers };
7489
+ if (raw.folder !== undefined)
7490
+ return { folder: raw.folder };
7491
+ return null;
7492
+ }
7493
+ function resolveTrustAnchorLogsDestination(local, trustAnchorConfig) {
7494
+ const anchored = resolveLogsSetting(trustAnchorConfig);
7495
+ if (!anchored)
7496
+ return null;
7497
+ if ("url" in local)
7498
+ return "url" in anchored && anchored.url === local.url ? anchored : null;
7499
+ return "folder" in anchored && anchored.folder === local.folder ? anchored : null;
7500
+ }
7501
+ function resolveLogsHeaderValues(headers, env) {
7502
+ if (!headers)
7503
+ return;
7504
+ const resolved = {};
7505
+ for (const [key, value] of Object.entries(headers)) {
7506
+ resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => env[name] ?? "");
7393
7507
  }
7508
+ return resolved;
7509
+ }
7510
+ function trustAnchorRepo() {
7511
+ const fromRunner = trustAnchorRepoFromRunner();
7512
+ if (fromRunner)
7513
+ return fromRunner;
7394
7514
  try {
7395
7515
  const url = execFileSync3("git", ["remote", "get-url", "origin"], {
7396
7516
  encoding: "utf-8",
7397
7517
  stdio: ["ignore", "pipe", "pipe"]
7398
- }).trim();
7399
- const m = url.match(/github\.com[:/]([^/]+)\/(.+?)(?:\.git)?\/?$/);
7400
- return m?.[1] && m[2] ? wellFormed(`${m[1]}/${m[2]}`) : null;
7518
+ });
7519
+ return trustAnchorRepoFromRemoteUrl(url);
7520
+ } catch {
7521
+ return null;
7522
+ }
7523
+ }
7524
+ async function trustAnchorRepoAsync() {
7525
+ const fromRunner = trustAnchorRepoFromRunner();
7526
+ if (fromRunner)
7527
+ return fromRunner;
7528
+ try {
7529
+ const { stdout } = await execFileAsync4("git", ["remote", "get-url", "origin"], {
7530
+ encoding: "utf-8",
7531
+ timeout: 1e4
7532
+ });
7533
+ return trustAnchorRepoFromRemoteUrl(stdout);
7401
7534
  } catch {
7402
7535
  return null;
7403
7536
  }
7404
7537
  }
7538
+ function wellFormedRepoSlug(slug) {
7539
+ return /^[^/\s]+\/[^/\s]+$/.test(slug) ? slug : null;
7540
+ }
7541
+ function trustAnchorRepoFromRunner() {
7542
+ const fromRunner = process.env.GITHUB_REPOSITORY?.trim();
7543
+ return fromRunner ? wellFormedRepoSlug(fromRunner) : null;
7544
+ }
7545
+ function trustAnchorRepoFromRemoteUrl(url) {
7546
+ const m = url.trim().match(/github\.com[:/]([^/]+)\/(.+?)(?:\.git)?\/?$/);
7547
+ return m?.[1] && m[2] ? wellFormedRepoSlug(`${m[1]}/${m[2]}`) : null;
7548
+ }
7549
+ var execFileAsync4 = promisify4(execFile4);
7550
+ function resolveCiTrustAnchorProbeRef(env = process.env) {
7551
+ const ref = env.VINAYA_CI_CONFIG_PROBE_REF?.trim();
7552
+ if (!ref)
7553
+ return null;
7554
+ if (env.GITHUB_ACTIONS !== "true")
7555
+ return null;
7556
+ if ((env.GH_TOKEN ?? "").length > 0 || (env.GITHUB_TOKEN ?? "").length > 0)
7557
+ return null;
7558
+ return ref;
7559
+ }
7560
+ function readTrustAnchorConfigAtRef(ref) {
7561
+ const raw = execFileSync3("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
7562
+ encoding: "utf-8",
7563
+ stdio: ["ignore", "pipe", "pipe"],
7564
+ timeout: 1e4
7565
+ });
7566
+ return Buffer.from(raw, "utf-8").toString("base64");
7567
+ }
7405
7568
  function ghFetchTrustAnchorConfig() {
7569
+ const probeRef = resolveCiTrustAnchorProbeRef();
7570
+ if (probeRef)
7571
+ return readTrustAnchorConfigAtRef(probeRef);
7406
7572
  const repo = trustAnchorRepo();
7407
7573
  if (!repo)
7408
7574
  throw new Error("could not resolve repo identity for the trust-anchor read");
@@ -7411,6 +7577,21 @@ function ghFetchTrustAnchorConfig() {
7411
7577
  stdio: ["ignore", "pipe", "pipe"]
7412
7578
  });
7413
7579
  }
7580
+ async function ghFetchTrustAnchorConfigAsync() {
7581
+ const probeRef = resolveCiTrustAnchorProbeRef();
7582
+ if (probeRef) {
7583
+ const { stdout } = await execFileAsync4("git", ["show", `${probeRef}:${LOCAL_CONFIG_FILENAME}`], {
7584
+ encoding: "utf-8",
7585
+ timeout: 1e4
7586
+ });
7587
+ return Buffer.from(stdout, "utf-8").toString("base64");
7588
+ }
7589
+ const repo = await trustAnchorRepoAsync();
7590
+ if (!repo)
7591
+ throw new Error("could not resolve repo identity for the trust-anchor read");
7592
+ const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4 });
7593
+ return stdout;
7594
+ }
7414
7595
  function firstLine(err) {
7415
7596
  return err?.message?.split(`
7416
7597
  `)[0] ?? "unknown error";
@@ -7425,16 +7606,35 @@ function isMissingFileError(err) {
7425
7606
  return /\b404\b|not found/i.test(haystack);
7426
7607
  }
7427
7608
  function loadTrustAnchorConfig(fetcher = ghFetchTrustAnchorConfig) {
7428
- const warn = (why) => process.stdout.write(`⚠ could not read the trust-anchor config (\`principals\`/\`releaseActor\`) from the default branch (${why}) — falling back to vinaya's built-in defaults.
7429
- `);
7430
7609
  let base64;
7431
7610
  try {
7432
- base64 = fetcher().trim();
7611
+ base64 = fetcher();
7433
7612
  } catch (err) {
7434
- if (!isMissingFileError(err))
7435
- warn(firstLine(err));
7436
- return null;
7613
+ return trustAnchorFetchFailed(err);
7614
+ }
7615
+ return parseTrustAnchorContent(base64);
7616
+ }
7617
+ async function loadTrustAnchorConfigAsync(fetcher = ghFetchTrustAnchorConfigAsync, options = {}) {
7618
+ const warn = options.quiet ? () => {} : warnTrustAnchorFallback;
7619
+ let base64;
7620
+ try {
7621
+ base64 = await fetcher();
7622
+ } catch (err) {
7623
+ return trustAnchorFetchFailed(err, warn);
7437
7624
  }
7625
+ return parseTrustAnchorContent(base64, warn);
7626
+ }
7627
+ function warnTrustAnchorFallback(why) {
7628
+ process.stdout.write(`⚠ could not read the trust-anchor config (\`principals\`/\`releaseActor\`) from the default branch (${why}) — falling back to vinaya's built-in defaults.
7629
+ `);
7630
+ }
7631
+ function trustAnchorFetchFailed(err, warn = warnTrustAnchorFallback) {
7632
+ if (!isMissingFileError(err))
7633
+ warn(firstLine(err));
7634
+ return null;
7635
+ }
7636
+ function parseTrustAnchorContent(content, warn = warnTrustAnchorFallback) {
7637
+ const base64 = content.trim();
7438
7638
  if (!base64)
7439
7639
  return null;
7440
7640
  try {
@@ -7462,7 +7662,27 @@ function loadConfig() {
7462
7662
  }
7463
7663
  var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
7464
7664
 
7665
+ // src/lib/package-root.ts
7666
+ import { existsSync as existsSync2 } from "node:fs";
7667
+ import { dirname as dirname2, join as join2 } from "node:path";
7668
+ import { fileURLToPath } from "node:url";
7669
+ function packageRoot(moduleUrl) {
7670
+ let dir = dirname2(fileURLToPath(moduleUrl));
7671
+ while (!existsSync2(join2(dir, "package.json"))) {
7672
+ if (existsSync2(join2(dir, ".git")))
7673
+ break;
7674
+ const parent = dirname2(dir);
7675
+ if (parent === dir)
7676
+ break;
7677
+ dir = parent;
7678
+ }
7679
+ return dir;
7680
+ }
7681
+
7465
7682
  // src/lib/brief-assembly.ts
7683
+ var PACKAGE_ROOT = packageRoot(import.meta.url);
7684
+ var PACKAGED_TEMPLATE_PATH = join3(PACKAGE_ROOT, "aeg-root", "templates", "brief-template.md");
7685
+ var TEMPLATE_PATH = existsSync3(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join3(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
7466
7686
  function git(args) {
7467
7687
  try {
7468
7688
  return execFileSync4("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();