@attalabs/vinaya 0.32.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 (209) hide show
  1. package/README.md +1 -1
  2. package/aeg-root/contracts/principal-operator.md +18 -5
  3. package/aeg-root/roles/operator.md +69 -16
  4. package/aeg-root/roles/planner/reference.md +1 -1
  5. package/aeg-root/roles/tranche-archivist.md +1 -0
  6. package/aeg-root/skills/aeg-context-packets/SKILL.md +1 -1
  7. package/aeg-root/skills/aeg-context-packets/examples/operator-start.md +1 -1
  8. package/dist/checks/bin/check-body-bare-digits.js +111 -15
  9. package/dist/checks/bin/check-branch-topology.js +83 -16
  10. package/dist/checks/bin/check-brief-shape.js +111 -15
  11. package/dist/checks/bin/check-changeset-coverage.js +342 -69
  12. package/dist/checks/bin/check-closes-n.js +83 -16
  13. package/dist/checks/bin/check-coherence.js +112 -16
  14. package/dist/checks/bin/check-dead-branch-push.js +82 -15
  15. package/dist/checks/bin/check-dispatch-readiness.js +112 -16
  16. package/dist/checks/bin/check-doc-coverage-push.js +342 -69
  17. package/dist/checks/bin/check-doc-coverage.js +342 -69
  18. package/dist/checks/bin/check-doctrine-no-procedures.js +111 -15
  19. package/dist/checks/bin/check-doctrine-portability.js +342 -69
  20. package/dist/checks/bin/check-evidence-fresh.js +343 -69
  21. package/dist/checks/bin/check-exec-bits.js +342 -69
  22. package/dist/checks/bin/check-first-push-dispatch.js +112 -16
  23. package/dist/checks/bin/check-issue-assignment.js +83 -16
  24. package/dist/checks/bin/check-issue-milestone-attach.js +82 -15
  25. package/dist/checks/bin/check-issue-objectives-numbering.js +82 -15
  26. package/dist/checks/bin/check-issue-parts-coverage.js +82 -15
  27. package/dist/checks/bin/check-issue-surface-globs.js +112 -16
  28. package/dist/checks/bin/check-issue-title-grammar.js +82 -15
  29. package/dist/checks/bin/check-issue-tranche-label.js +82 -15
  30. package/dist/checks/bin/check-main-branch-refusal.js +82 -15
  31. package/dist/checks/bin/check-no-disk-state.js +82 -15
  32. package/dist/checks/bin/check-pr-premise-reassert.js +111 -15
  33. package/dist/checks/bin/check-pr-report-density.js +82 -15
  34. package/dist/checks/bin/check-principal-test-plan-wait.js +82 -15
  35. package/dist/checks/bin/check-quoted-command.js +342 -69
  36. package/dist/checks/bin/check-reader-resolvable-prose.js +342 -69
  37. package/dist/checks/bin/check-registry-gates.js +82 -15
  38. package/dist/checks/bin/check-retired-vocabulary.js +342 -69
  39. package/dist/checks/bin/check-review-gate.js +179 -124
  40. package/dist/checks/bin/check-single-plan-pr.js +82 -15
  41. package/dist/checks/bin/check-surface-scope.js +83 -16
  42. package/dist/checks/bin/check-test-plan.js +82 -15
  43. package/dist/checks/bin/check-token-collection-wired.js +82 -15
  44. package/dist/checks/bin/check-token-report.js +82 -15
  45. package/dist/checks/bin/check-workspace-escape.js +342 -69
  46. package/dist/index.js +2495 -590
  47. package/dist/lib/pre-push-cache-test-run.js +317 -61
  48. package/dist/lib/pre-push-select-tests.js +91 -10
  49. package/package.json +1 -1
  50. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/actions.ts +10 -12
  51. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +5 -5
  52. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/archive-task.ts +42 -17
  53. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/baseline-capture.ts +1 -2
  54. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/branch-topology-gate.ts +3 -3
  55. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +554 -95
  56. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +264 -44
  57. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/claude-code-transcript.ts +9 -9
  58. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +211 -30
  59. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/consumer-enumeration.ts +2 -2
  60. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +75 -0
  61. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +961 -0
  62. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/migration.ts +212 -0
  63. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/outcomes.ts +135 -0
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +394 -0
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-audit.ts +1 -2
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-guard.ts +1 -1
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/derive-section7.ts +2 -2
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +514 -0
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +110 -0
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +27 -0
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +123 -0
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +27 -0
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +240 -0
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/diagram-model.ts +1 -1
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/direct-main-push.ts +1 -2
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +65 -22
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +238 -0
  78. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-owners.ts +14 -1
  79. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/docs-coherence.ts +1 -1
  80. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/legacy-anchors.ts +1 -1
  81. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/node-route.ts +1 -1
  82. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/surfaced-manifest.ts +1 -1
  83. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-no-procedures.ts +1 -1
  84. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +5 -5
  85. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ensure-label.ts +1 -1
  86. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/first-push-dispatch-gate.ts +1 -1
  87. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +14 -3
  88. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +379 -11
  89. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +3 -4
  90. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +1450 -33
  91. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +1 -2
  92. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/local-anchor-coverage.ts +2 -2
  93. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +119 -0
  94. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +75 -0
  95. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/redact.ts +87 -0
  96. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +801 -0
  97. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +373 -0
  98. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +2 -2
  99. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/metering-io-guard.ts +1 -1
  100. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/milestone-validation.ts +2 -3
  101. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/no-disk-state.ts +2 -2
  102. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives.ts +288 -0
  103. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-token-report.ts +3 -3
  104. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-tranche.ts +1 -1
  105. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +30 -16
  106. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-tier.ts +17 -1
  107. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/premise-check.ts +1 -1
  108. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/quoted-command.ts +1 -1
  109. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +267 -19
  110. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +91 -24
  111. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-scaffold.ts +6 -6
  112. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/report-tokens.ts +4 -4
  113. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +239 -110
  114. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +384 -0
  115. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +184 -0
  116. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +65 -18
  117. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +76 -0
  118. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/single-plan-pr.ts +4 -4
  119. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/state-machine-model.ts +40 -27
  120. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/symbol-collisions.ts +2 -2
  121. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +38 -0
  122. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +488 -0
  123. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +7 -9
  124. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-section.ts +5 -5
  125. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/types.ts +4 -4
  126. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +314 -56
  127. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +2 -3
  128. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/workspace-escape.ts +3 -3
  129. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  130. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  131. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  138. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +1 -1
  143. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +1 -1
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  146. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +1 -1
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  151. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  152. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +1 -1
  153. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  154. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  155. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  156. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +1 -1
  157. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  158. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  159. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  160. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +2 -2
  161. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  162. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  163. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  164. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +1 -1
  165. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  166. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  167. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  168. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +1 -1
  169. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  170. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  171. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  172. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +1 -1
  173. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  174. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  175. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/{[externals]__1agj1ww._.js → [externals]__0cki-x_._.js} +2 -2
  176. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +6 -6
  177. 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
  178. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +3 -0
  179. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  180. 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
  181. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  182. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
  183. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1r47dr7._.js → _08onyya._.js} +3 -3
  184. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  185. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  186. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  187. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  188. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +1 -1
  189. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  190. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  191. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_15gdg48._.js +5 -5
  192. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  193. 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
  194. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  195. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  196. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  197. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  198. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +1 -0
  199. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1dc2_-c_gavj1.js → 1ce2dj27_cgbj.js} +4 -4
  200. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3xg6-flovrcx-.js → 22s44f5k3ecmj.js} +1 -1
  201. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/34hhdtbp20krb.js +1 -0
  202. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  203. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0hstap0._.js +0 -3
  204. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2t_rfsztmwu6y.js +0 -1
  205. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3ua4rm5f-a9k6.js +0 -1
  206. /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
  207. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_buildManifest.js +0 -0
  208. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_clientMiddlewareManifest.js +0 -0
  209. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_ssgManifest.js +0 -0
@@ -1,9 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from "node:module";
3
3
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
4
-
5
- // src/checks/bin/check-review-gate.ts
6
- import { execFileSync as execFileSync4 } from "node:child_process";
7
4
  // ../../packages/aeg-core/src/gate-audience.ts
8
5
  var GATE_AUDIENCE = {
9
6
  "check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
@@ -2047,12 +2044,24 @@ function extractBaseSha(comment) {
2047
2044
  const m = firstThirteenLines(comment).match(BASE_SHA_PATTERN);
2048
2045
  return m ? m[1].toLowerCase() : null;
2049
2046
  }
2050
- var FINDING_SEVERITY_LINE = /^\d+\.\s+\[([A-Z][A-Z]*)\]\s+(.+?)\s+—/gm;
2047
+ var FINDING_DESCRIPTION_STATE = /^F(\d+)(?:\s+\S+)?(?:\s+(open|fix-claimed|reproduced|resolved))?:/;
2048
+ function parseFindingState(description) {
2049
+ const m = FINDING_DESCRIPTION_STATE.exec(description.trim());
2050
+ if (!m)
2051
+ return { id: null, state: null };
2052
+ return { id: `F${m[1]}`, state: m[2] ?? null };
2053
+ }
2054
+ var FINDING_SEVERITY_LINE = /^\d+\.\s+\[([A-Z][A-Z]*)\]\s+(.+?)\s+—(?:\s+(.*))?$/gm;
2051
2055
  function extractFindingSeverities(comment) {
2052
- return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) => ({
2053
- severity: m[1],
2054
- location: m[2]
2055
- }));
2056
+ return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) => {
2057
+ const { id, state } = parseFindingState(m[3] ?? "");
2058
+ return {
2059
+ severity: m[1],
2060
+ location: m[2],
2061
+ id,
2062
+ state
2063
+ };
2064
+ });
2056
2065
  }
2057
2066
  function extractVerdict(comments, valuePattern, missingLabel) {
2058
2067
  const candidates = comments.filter((c) => valuePattern.test(c));
@@ -2466,6 +2475,12 @@ function evaluateReviewFindings(findings, scale, threshold) {
2466
2475
  });
2467
2476
  return { outcome: blockingFindings.length > 0 ? "blocked" : "clean", blockingFindings };
2468
2477
  }
2478
+ function isConsequentialFinding(finding) {
2479
+ return finding.state !== "resolved";
2480
+ }
2481
+ function consequentialFindings(findings) {
2482
+ return findings.filter((f) => isConsequentialFinding(f));
2483
+ }
2469
2484
  function evaluateCodeReview(findings, policy) {
2470
2485
  return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold);
2471
2486
  }
@@ -4098,8 +4113,8 @@ function checkReviewGate(input) {
4098
4113
  let codeReviewPolicyEvaluation;
4099
4114
  let securityPolicyEvaluation;
4100
4115
  try {
4101
- codeReviewPolicyEvaluation = evaluateCodeReview(codeReview.findingSeverities, policy);
4102
- securityPolicyEvaluation = evaluateSecurityReview(security.findingSeverities, policy);
4116
+ codeReviewPolicyEvaluation = evaluateCodeReview(consequentialFindings(codeReview.findingSeverities), policy);
4117
+ securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy);
4103
4118
  } catch (err) {
4104
4119
  return {
4105
4120
  verdict: "fail",
@@ -5180,11 +5195,27 @@ var ObservedSchema = z.object({
5180
5195
  var TaskStatusInputSchema = z.object({
5181
5196
  task: TaskToolRefSchema.optional()
5182
5197
  }).merge(PageRequestSchema).strict();
5198
+ var TaskConfidenceSchema = z.object({
5199
+ round: z.number().int().positive(),
5200
+ percent: z.number().int().min(0).max(100).nullable(),
5201
+ source: z.enum(["stated", "published-summary"])
5202
+ }).strict();
5203
+ var TaskPhaseHistorySchema = z.object({
5204
+ typicalPhaseMinutes: z.number().nonnegative(),
5205
+ typicalPhaseSamples: z.number().int().positive()
5206
+ }).strict();
5183
5207
  var TaskStatusItemSchema = z.object({
5184
5208
  task: TaskToolRefSchema,
5185
5209
  issue: z.number().int().positive(),
5186
5210
  pr: z.number().int().positive().nullable(),
5187
- state: z.string()
5211
+ state: z.string(),
5212
+ round: z.number().int().positive().nullable().optional(),
5213
+ phase: z.string().min(1).nullable().optional(),
5214
+ minutesInPhase: z.number().nonnegative().nullable().optional(),
5215
+ phaseIsCurrent: z.boolean().nullable().optional(),
5216
+ lastConfidence: TaskConfidenceSchema.nullable().optional(),
5217
+ lastConfidenceUnread: z.boolean().optional(),
5218
+ phaseHistory: TaskPhaseHistorySchema.nullable().optional()
5188
5219
  }).merge(ObservedSchema);
5189
5220
  var TaskStatusResultSchema = z.object({
5190
5221
  items: z.array(TaskStatusItemSchema),
@@ -5196,7 +5227,7 @@ var EscalationInputsSchema = z.object({
5196
5227
  round: z.number().int().nonnegative(),
5197
5228
  head: z.string(),
5198
5229
  branch: z.string(),
5199
- prNumber: z.number().int().positive()
5230
+ prNumber: z.number().int().positive().nullable()
5200
5231
  });
5201
5232
  var EscalationEvidenceSchema = z.object({
5202
5233
  round: z.number().int().nonnegative(),
@@ -5232,13 +5263,45 @@ var TaskEscalationReadResultSchema = z.object({
5232
5263
  items: z.array(TaskEscalationPacketSchema),
5233
5264
  nextCursor: z.string().nullable()
5234
5265
  }).merge(ObservedSchema);
5235
- var TaskStartInputSchema = z.object({
5236
- tranche: z.string().min(1),
5237
- id: z.string().min(1)
5266
+ var TaskPrCheckSchema = z.object({
5267
+ name: z.string(),
5268
+ required: z.boolean(),
5269
+ status: z.string(),
5270
+ conclusion: z.string().nullable(),
5271
+ detailsUrl: z.string().nullable(),
5272
+ failureSummary: z.string().nullable()
5273
+ });
5274
+ var TaskPrVerdictSchema = z.object({
5275
+ role: z.enum(["code-review", "security"]),
5276
+ value: z.string(),
5277
+ judgedHead: z.string().nullable(),
5278
+ objectivesVersion: z.string().nullable()
5279
+ });
5280
+ var TaskPrPauseSchema = z.object({
5281
+ reason: z.string(),
5282
+ body: z.string()
5283
+ });
5284
+ var TaskPrReviewRecordSchema = z.object({
5285
+ verdicts: z.array(TaskPrVerdictSchema),
5286
+ roundMarkers: z.array(z.number().int().nonnegative()),
5287
+ summaryTable: z.string().nullable(),
5288
+ pause: TaskPrPauseSchema.nullable()
5289
+ });
5290
+ var TaskPrReadInputSchema = z.object({
5291
+ task: TaskToolRefSchema,
5292
+ pr: z.number().int().positive().optional()
5238
5293
  }).strict();
5294
+ var TaskPrReadResultSchema = z.object({
5295
+ task: TaskToolRefSchema,
5296
+ issue: z.number().int().positive(),
5297
+ pr: z.number().int().positive(),
5298
+ head: z.string().nullable(),
5299
+ checks: z.array(TaskPrCheckSchema),
5300
+ review: TaskPrReviewRecordSchema
5301
+ }).merge(ObservedSchema);
5239
5302
  var TaskStartResultSchema = z.object({
5240
5303
  requestId: z.string().min(1),
5241
- run: z.object({ tranche: z.string().min(1), id: z.string().min(1) }),
5304
+ run: TaskToolRefSchema,
5242
5305
  started: z.boolean(),
5243
5306
  startedAt: z.string(),
5244
5307
  mode: z.literal("attended")
@@ -5252,7 +5315,7 @@ var TaskCancelInputSchema = z.object({
5252
5315
  }).strict();
5253
5316
  var TaskResumeResultSchema = z.object({
5254
5317
  task: z.number().int().positive(),
5255
- pr: z.number().int().positive(),
5318
+ pr: z.number().int().positive().nullable(),
5256
5319
  escalationId: z.string().min(1),
5257
5320
  outcome: z.enum(["started", "already_resumed"]),
5258
5321
  authenticatedBy: z.string().min(1),
@@ -5261,7 +5324,7 @@ var TaskResumeResultSchema = z.object({
5261
5324
  var TaskCancelOutcomeSchema = z.enum(["confirmed", "pending", "uncertain"]);
5262
5325
  var TaskCancelResultSchema = z.object({
5263
5326
  task: z.number().int().positive(),
5264
- pr: z.number().int().positive(),
5327
+ pr: z.number().int().positive().nullable(),
5265
5328
  escalationId: z.string().min(1),
5266
5329
  outcome: TaskCancelOutcomeSchema,
5267
5330
  authenticatedBy: z.string().min(1),
@@ -5272,6 +5335,7 @@ var TASK_TOOL_NAMES = [
5272
5335
  "task_start",
5273
5336
  "task_status",
5274
5337
  "task_escalation_read",
5338
+ "task_pr_read",
5275
5339
  "task_resume",
5276
5340
  "task_cancel"
5277
5341
  ];
@@ -6255,6 +6319,9 @@ function emitCheckError(error) {
6255
6319
  `);
6256
6320
  }
6257
6321
 
6322
+ // src/lib/review-gate-input.ts
6323
+ import { execFileSync as execFileSync4 } from "node:child_process";
6324
+
6258
6325
  // src/lib/config.ts
6259
6326
  import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
6260
6327
  import { promisify as promisify4 } from "node:util";
@@ -6640,7 +6707,28 @@ function trustAnchorRepoFromRemoteUrl(url) {
6640
6707
  return m?.[1] && m[2] ? wellFormedRepoSlug(`${m[1]}/${m[2]}`) : null;
6641
6708
  }
6642
6709
  var execFileAsync4 = promisify4(execFile4);
6710
+ function resolveCiTrustAnchorProbeRef(env = process.env) {
6711
+ const ref = env.VINAYA_CI_CONFIG_PROBE_REF?.trim();
6712
+ if (!ref)
6713
+ return null;
6714
+ if (env.GITHUB_ACTIONS !== "true")
6715
+ return null;
6716
+ if ((env.GH_TOKEN ?? "").length > 0 || (env.GITHUB_TOKEN ?? "").length > 0)
6717
+ return null;
6718
+ return ref;
6719
+ }
6720
+ function readTrustAnchorConfigAtRef(ref) {
6721
+ const raw = execFileSync2("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
6722
+ encoding: "utf-8",
6723
+ stdio: ["ignore", "pipe", "pipe"],
6724
+ timeout: 1e4
6725
+ });
6726
+ return Buffer.from(raw, "utf-8").toString("base64");
6727
+ }
6643
6728
  function ghFetchTrustAnchorConfig() {
6729
+ const probeRef = resolveCiTrustAnchorProbeRef();
6730
+ if (probeRef)
6731
+ return readTrustAnchorConfigAtRef(probeRef);
6644
6732
  const repo = trustAnchorRepo();
6645
6733
  if (!repo)
6646
6734
  throw new Error("could not resolve repo identity for the trust-anchor read");
@@ -6650,6 +6738,14 @@ function ghFetchTrustAnchorConfig() {
6650
6738
  });
6651
6739
  }
6652
6740
  async function ghFetchTrustAnchorConfigAsync() {
6741
+ const probeRef = resolveCiTrustAnchorProbeRef();
6742
+ if (probeRef) {
6743
+ const { stdout } = await execFileAsync4("git", ["show", `${probeRef}:${LOCAL_CONFIG_FILENAME}`], {
6744
+ encoding: "utf-8",
6745
+ timeout: 1e4
6746
+ });
6747
+ return Buffer.from(stdout, "utf-8").toString("base64");
6748
+ }
6653
6749
  const repo = await trustAnchorRepoAsync();
6654
6750
  if (!repo)
6655
6751
  throw new Error("could not resolve repo identity for the trust-anchor read");
@@ -6752,8 +6848,10 @@ function patchIdAt(base, sha) {
6752
6848
  }
6753
6849
  }
6754
6850
 
6755
- // src/checks/bin/check-review-gate.ts
6756
- var CHECK_NAME = "review-gate";
6851
+ // src/lib/review-gate-input.ts
6852
+ function failure(message, agentRecoveryPrompt) {
6853
+ return { ok: false, failure: { message, agentRecoveryPrompt } };
6854
+ }
6757
6855
  function fetchPr(prNumber) {
6758
6856
  try {
6759
6857
  const out = execFileSync4("gh", ["pr", "view", String(prNumber), "--json", "number,comments,labels,headRefName,headRefOid,baseRefName,body"], {
@@ -6782,87 +6880,45 @@ function fetchIssueCommentsForBrief(issueNumber) {
6782
6880
  function resolveBriefHash(pr, principalAllowlist) {
6783
6881
  const { issue } = extractIssue(pr.body);
6784
6882
  if (issue === null)
6785
- return null;
6883
+ return { ok: true, value: null };
6786
6884
  let comments;
6787
6885
  try {
6788
6886
  comments = fetchIssueCommentsForBrief(issue);
6789
6887
  } catch (err) {
6790
6888
  if (isIssueNotFoundError(err)) {
6791
- emitCheckError({
6792
- schema: CHECK_SCHEMA_VERSION,
6793
- check: CHECK_NAME,
6794
- severity: "error",
6795
- message: `review-gate severity:infra — Issue #${issue} does not resolve via \`gh issue view\` — cannot verify the brief-hash binding for a PR whose linked Issue no longer exists.`,
6796
- agent_recovery_prompt: `Restore Issue #${issue}, fix \`Closes #N\` to name a real Issue, or have a principal apply the \`vinaya/waiver:review\` label, then re-run \`vinaya check review-gate\`.`
6797
- });
6798
- process.exit(1);
6889
+ return failure(`review-gate severity:infra — Issue #${issue} does not resolve via \`gh issue view\` — cannot verify the brief-hash binding for a PR whose linked Issue no longer exists.`, `Restore Issue #${issue}, fix \`Closes #N\` to name a real Issue, or have a principal apply the \`vinaya/waiver:review\` label, then re-run \`vinaya check review-gate\`.`);
6799
6890
  }
6800
- emitCheckError({
6801
- schema: CHECK_SCHEMA_VERSION,
6802
- check: CHECK_NAME,
6803
- severity: "error",
6804
- message: `review-gate severity:infra — could not fetch Issue #${issue}'s comments via \`gh issue view\` to resolve its frozen-brief hash: ${err.message}`,
6805
- agent_recovery_prompt: "Confirm `gh auth status` passes and the Issue number is correct, then re-run `vinaya check review-gate`."
6806
- });
6807
- process.exit(1);
6891
+ return failure(`review-gate severity:infra — could not fetch Issue #${issue}'s comments via \`gh issue view\` to resolve its frozen-brief hash: ${err.message}`, "Confirm `gh auth status` passes and the Issue number is correct, then re-run `vinaya check review-gate`.");
6808
6892
  }
6809
6893
  const frozen = resolveNewestFrozenBrief(comments, principalAllowlist);
6810
- return frozen ? briefHash(frozen.content) : null;
6894
+ return { ok: true, value: frozen ? briefHash(frozen.content) : null };
6811
6895
  }
6812
6896
  function resolveObjectivesVersion(pr) {
6813
6897
  const { issue } = extractIssue(pr.body);
6814
6898
  const source = resolveObjectivesSource(pr.body, issue, OBJECTIVES_SINCE_ISSUE);
6815
6899
  if (source.kind === "none")
6816
- return null;
6900
+ return { ok: true, value: null };
6817
6901
  if (source.kind === "issue") {
6818
6902
  let issueBody;
6819
6903
  try {
6820
6904
  issueBody = fetchIssueBodyForObjectives(source.issue);
6821
6905
  } catch (err) {
6822
6906
  if (isIssueNotFoundError(err)) {
6823
- emitCheckError({
6824
- schema: CHECK_SCHEMA_VERSION,
6825
- check: CHECK_NAME,
6826
- severity: "error",
6827
- message: `review-gate severity:infra — Issue #${source.issue} does not resolve via \`gh issue view\` — cannot verify the objectives-version binding for a PR whose linked Issue is at/above the objectives cutover.`,
6828
- agent_recovery_prompt: `Restore Issue #${source.issue}, fix \`Closes #N\` to name a real Issue, or have a principal apply the \`vinaya/waiver:review\` label, then re-run \`vinaya check review-gate\`.`
6829
- });
6830
- process.exit(1);
6907
+ return failure(`review-gate severity:infra — Issue #${source.issue} does not resolve via \`gh issue view\` — cannot verify the objectives-version binding for a PR whose linked Issue is at/above the objectives cutover.`, `Restore Issue #${source.issue}, fix \`Closes #N\` to name a real Issue, or have a principal apply the \`vinaya/waiver:review\` label, then re-run \`vinaya check review-gate\`.`);
6831
6908
  }
6832
- emitCheckError({
6833
- schema: CHECK_SCHEMA_VERSION,
6834
- check: CHECK_NAME,
6835
- severity: "error",
6836
- message: `review-gate severity:infra — could not fetch Issue #${source.issue}'s body via \`gh issue view\` to resolve its objectives version: ${err.message}`,
6837
- agent_recovery_prompt: "Confirm `gh auth status` passes and the Issue number is correct, then re-run `vinaya check review-gate`."
6838
- });
6839
- process.exit(1);
6909
+ return failure(`review-gate severity:infra — could not fetch Issue #${source.issue}'s body via \`gh issue view\` to resolve its objectives version: ${err.message}`, "Confirm `gh auth status` passes and the Issue number is correct, then re-run `vinaya check review-gate`.");
6840
6910
  }
6841
6911
  const parsed = objectivesOf(issueBody);
6842
6912
  if (!parsed.ok) {
6843
- emitCheckError({
6844
- schema: CHECK_SCHEMA_VERSION,
6845
- check: CHECK_NAME,
6846
- severity: "error",
6847
- message: `review-gate severity:infra — Issue #${source.issue}'s \`## Objectives\` section does not parse (${parsed.errors.join("; ")}) — cannot verify the objectives-version binding.`,
6848
- agent_recovery_prompt: `Fix Issue #${source.issue}'s \`## Objectives\` section, or have a principal apply the \`vinaya/waiver:review\` label, then re-run \`vinaya check review-gate\`.`
6849
- });
6850
- process.exit(1);
6913
+ return failure(`review-gate severity:infra — Issue #${source.issue}'s \`## Objectives\` section does not parse (${parsed.errors.join("; ")}) — cannot verify the objectives-version binding.`, `Fix Issue #${source.issue}'s \`## Objectives\` section, or have a principal apply the \`vinaya/waiver:review\` label, then re-run \`vinaya check review-gate\`.`);
6851
6914
  }
6852
- return objectivesVersion(parsed.objectives);
6915
+ return { ok: true, value: objectivesVersion(parsed.objectives) };
6853
6916
  }
6854
6917
  const own = objectivesOf(pr.body);
6855
6918
  if (!own.ok) {
6856
- emitCheckError({
6857
- schema: CHECK_SCHEMA_VERSION,
6858
- check: CHECK_NAME,
6859
- severity: "error",
6860
- message: `review-gate severity:infra — this PR body's own \`## Objectives\` section does not parse (${own.errors.join("; ")}) — cannot verify the objectives-version binding.`,
6861
- agent_recovery_prompt: "Fix the PR body's `## Objectives` section, or have a principal apply the `vinaya/waiver:review` label, then re-run `vinaya check review-gate`."
6862
- });
6863
- process.exit(1);
6919
+ return failure(`review-gate severity:infra — this PR body's own \`## Objectives\` section does not parse (${own.errors.join("; ")}) — cannot verify the objectives-version binding.`, "Fix the PR body's `## Objectives` section, or have a principal apply the `vinaya/waiver:review` label, then re-run `vinaya check review-gate`.");
6864
6920
  }
6865
- return objectivesVersion(own.objectives);
6921
+ return { ok: true, value: objectivesVersion(own.objectives) };
6866
6922
  }
6867
6923
  function shaFromLsRemote(branch) {
6868
6924
  try {
@@ -6912,46 +6968,20 @@ function fetchWaiverLabelActor(prNumber, label) {
6912
6968
  return null;
6913
6969
  }
6914
6970
  }
6915
- function main() {
6916
- const prNumberStr = process.env.PR_NUMBER;
6917
- if (!prNumberStr) {
6918
- process.exit(0);
6919
- }
6920
- const prNumber = Number(prNumberStr);
6971
+ function assembleReviewGateInput(prNumber) {
6921
6972
  const pr = fetchPr(prNumber);
6922
6973
  if (!pr) {
6923
- emitCheckError({
6924
- schema: CHECK_SCHEMA_VERSION,
6925
- check: CHECK_NAME,
6926
- severity: "error",
6927
- message: `review-gate severity:infra — could not fetch PR #${prNumber} via \`gh\`.`,
6928
- agent_recovery_prompt: "Confirm `gh auth status` passes and PR_NUMBER is correct, then re-run `vinaya check review-gate`."
6929
- });
6930
- process.exit(1);
6974
+ return failure(`review-gate severity:infra — could not fetch PR #${prNumber} via \`gh\`.`, "Confirm `gh auth status` passes and PR_NUMBER is correct, then re-run `vinaya check review-gate`.");
6931
6975
  }
6932
6976
  const labels = pr.labels.map((l) => l.name);
6933
6977
  const waiverLabelActor = labels.includes(WAIVER_LABEL_REVIEW) ? fetchWaiverLabelActor(prNumber, WAIVER_LABEL_REVIEW) : null;
6934
6978
  const headSha = resolveTrueHeadSha(pr);
6935
6979
  if (!headSha) {
6936
- emitCheckError({
6937
- schema: CHECK_SCHEMA_VERSION,
6938
- check: CHECK_NAME,
6939
- severity: "error",
6940
- message: `review-gate severity:infra — could not resolve PR #${prNumber}'s true head via \`git ls-remote\` or the forge's \`git/ref/heads\` API.`,
6941
- agent_recovery_prompt: "Confirm the branch still exists on origin and `gh auth status` passes, then re-run `vinaya check review-gate`."
6942
- });
6943
- process.exit(1);
6980
+ return failure(`review-gate severity:infra — could not resolve PR #${prNumber}'s true head via \`git ls-remote\` or the forge's \`git/ref/heads\` API.`, "Confirm the branch still exists on origin and `gh auth status` passes, then re-run `vinaya check review-gate`.");
6944
6981
  }
6945
6982
  const baseSha = resolveBaseSha(pr);
6946
6983
  if (!baseSha) {
6947
- emitCheckError({
6948
- schema: CHECK_SCHEMA_VERSION,
6949
- check: CHECK_NAME,
6950
- severity: "error",
6951
- message: `review-gate severity:infra — could not resolve PR #${prNumber}'s base branch \`${pr.baseRefName}\`'s tip via \`git ls-remote\` or the forge's \`git/ref/heads\` API.`,
6952
- agent_recovery_prompt: "Confirm the base branch still exists on origin and `gh auth status` passes, then re-run `vinaya check review-gate`."
6953
- });
6954
- process.exit(1);
6984
+ return failure(`review-gate severity:infra — could not resolve PR #${prNumber}'s base branch \`${pr.baseRefName}\`'s tip via \`git ls-remote\` or the forge's \`git/ref/heads\` API.`, "Confirm the base branch still exists on origin and `gh auth status` passes, then re-run `vinaya check review-gate`.");
6955
6985
  }
6956
6986
  const trustAnchorConfig = loadTrustAnchorConfig();
6957
6987
  const principalAllowlist = resolvePrincipalAllowlist(trustAnchorConfig);
@@ -6959,14 +6989,7 @@ function main() {
6959
6989
  try {
6960
6990
  reviewPolicy = resolveReviewPolicy(trustAnchorConfig);
6961
6991
  } catch (err) {
6962
- emitCheckError({
6963
- schema: CHECK_SCHEMA_VERSION,
6964
- check: CHECK_NAME,
6965
- severity: "error",
6966
- message: `review-gate severity:infra — ${err instanceof Error ? err.message : String(err)}`,
6967
- agent_recovery_prompt: "Fix `reviewPolicy` in the default branch's `vinaya.config.json` to a known severity on each role's own scale, then re-run `vinaya check review-gate`."
6968
- });
6969
- process.exit(1);
6992
+ return failure(`review-gate severity:infra — ${err instanceof Error ? err.message : String(err)}`, "Fix `reviewPolicy` in the default branch's `vinaya.config.json` to a known severity on each role's own scale, then re-run `vinaya check review-gate`.");
6970
6993
  }
6971
6994
  const waived = isWaiverLabelActorVerified({
6972
6995
  label: WAIVER_LABEL_REVIEW,
@@ -6974,19 +6997,51 @@ function main() {
6974
6997
  labelActor: waiverLabelActor,
6975
6998
  principalAllowlist
6976
6999
  });
6977
- const result = checkReviewGate({
6978
- comments: pr.comments.map((c) => ({ body: c.body, author: c.author?.login ?? null })),
6979
- labels,
6980
- waiverLabelActor,
6981
- principalAllowlist,
6982
- headSha,
6983
- patchIdOf: (sha) => patchIdAt(pr.baseRefName, sha),
6984
- baseSha,
6985
- objectivesVersion: waived ? null : resolveObjectivesVersion(pr),
6986
- rulingOrdinal: newestPrincipalRulingOrdinal(pr.comments.map((c) => ({ body: c.body, author: c.author?.login ?? null })), principalAllowlist),
6987
- policy: reviewPolicy,
6988
- briefHash: waived ? null : resolveBriefHash(pr, principalAllowlist)
6989
- });
7000
+ const comments = pr.comments.map((c) => ({ body: c.body, author: c.author?.login ?? null }));
7001
+ const resolvedObjectivesVersion = waived ? { ok: true, value: null } : resolveObjectivesVersion(pr);
7002
+ if (!resolvedObjectivesVersion.ok)
7003
+ return resolvedObjectivesVersion;
7004
+ const resolvedBriefHash = waived ? { ok: true, value: null } : resolveBriefHash(pr, principalAllowlist);
7005
+ if (!resolvedBriefHash.ok)
7006
+ return resolvedBriefHash;
7007
+ return {
7008
+ ok: true,
7009
+ input: {
7010
+ comments,
7011
+ labels,
7012
+ waiverLabelActor,
7013
+ principalAllowlist,
7014
+ headSha,
7015
+ patchIdOf: (sha) => patchIdAt(pr.baseRefName, sha),
7016
+ baseSha,
7017
+ objectivesVersion: resolvedObjectivesVersion.value,
7018
+ rulingOrdinal: newestPrincipalRulingOrdinal(comments, principalAllowlist),
7019
+ policy: reviewPolicy,
7020
+ briefHash: resolvedBriefHash.value
7021
+ }
7022
+ };
7023
+ }
7024
+
7025
+ // src/checks/bin/check-review-gate.ts
7026
+ var CHECK_NAME = "review-gate";
7027
+ function main() {
7028
+ const prNumberStr = process.env.PR_NUMBER;
7029
+ if (!prNumberStr) {
7030
+ process.exit(0);
7031
+ }
7032
+ const prNumber = Number(prNumberStr);
7033
+ const assembly = assembleReviewGateInput(prNumber);
7034
+ if (!assembly.ok) {
7035
+ emitCheckError({
7036
+ schema: CHECK_SCHEMA_VERSION,
7037
+ check: CHECK_NAME,
7038
+ severity: "error",
7039
+ message: assembly.failure.message,
7040
+ agent_recovery_prompt: assembly.failure.agentRecoveryPrompt
7041
+ });
7042
+ process.exit(1);
7043
+ }
7044
+ const result = checkReviewGate(assembly.input);
6990
7045
  if (result.verdict === "fail") {
6991
7046
  emitCheckError({
6992
7047
  schema: CHECK_SCHEMA_VERSION,
@@ -2045,12 +2045,24 @@ function extractBaseSha(comment) {
2045
2045
  const m = firstThirteenLines(comment).match(BASE_SHA_PATTERN);
2046
2046
  return m ? m[1].toLowerCase() : null;
2047
2047
  }
2048
- var FINDING_SEVERITY_LINE = /^\d+\.\s+\[([A-Z][A-Z]*)\]\s+(.+?)\s+—/gm;
2048
+ var FINDING_DESCRIPTION_STATE = /^F(\d+)(?:\s+\S+)?(?:\s+(open|fix-claimed|reproduced|resolved))?:/;
2049
+ function parseFindingState(description) {
2050
+ const m = FINDING_DESCRIPTION_STATE.exec(description.trim());
2051
+ if (!m)
2052
+ return { id: null, state: null };
2053
+ return { id: `F${m[1]}`, state: m[2] ?? null };
2054
+ }
2055
+ var FINDING_SEVERITY_LINE = /^\d+\.\s+\[([A-Z][A-Z]*)\]\s+(.+?)\s+—(?:\s+(.*))?$/gm;
2049
2056
  function extractFindingSeverities(comment) {
2050
- return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) => ({
2051
- severity: m[1],
2052
- location: m[2]
2053
- }));
2057
+ return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) => {
2058
+ const { id, state } = parseFindingState(m[3] ?? "");
2059
+ return {
2060
+ severity: m[1],
2061
+ location: m[2],
2062
+ id,
2063
+ state
2064
+ };
2065
+ });
2054
2066
  }
2055
2067
  function extractVerdict(comments, valuePattern, missingLabel) {
2056
2068
  const candidates = comments.filter((c) => valuePattern.test(c));
@@ -2464,6 +2476,12 @@ function evaluateReviewFindings(findings, scale, threshold) {
2464
2476
  });
2465
2477
  return { outcome: blockingFindings.length > 0 ? "blocked" : "clean", blockingFindings };
2466
2478
  }
2479
+ function isConsequentialFinding(finding) {
2480
+ return finding.state !== "resolved";
2481
+ }
2482
+ function consequentialFindings(findings) {
2483
+ return findings.filter((f) => isConsequentialFinding(f));
2484
+ }
2467
2485
  function evaluateCodeReview(findings, policy) {
2468
2486
  return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold);
2469
2487
  }
@@ -4096,8 +4114,8 @@ function checkReviewGate(input) {
4096
4114
  let codeReviewPolicyEvaluation;
4097
4115
  let securityPolicyEvaluation;
4098
4116
  try {
4099
- codeReviewPolicyEvaluation = evaluateCodeReview(codeReview.findingSeverities, policy);
4100
- securityPolicyEvaluation = evaluateSecurityReview(security.findingSeverities, policy);
4117
+ codeReviewPolicyEvaluation = evaluateCodeReview(consequentialFindings(codeReview.findingSeverities), policy);
4118
+ securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy);
4101
4119
  } catch (err) {
4102
4120
  return {
4103
4121
  verdict: "fail",
@@ -5178,11 +5196,27 @@ var ObservedSchema = z.object({
5178
5196
  var TaskStatusInputSchema = z.object({
5179
5197
  task: TaskToolRefSchema.optional()
5180
5198
  }).merge(PageRequestSchema).strict();
5199
+ var TaskConfidenceSchema = z.object({
5200
+ round: z.number().int().positive(),
5201
+ percent: z.number().int().min(0).max(100).nullable(),
5202
+ source: z.enum(["stated", "published-summary"])
5203
+ }).strict();
5204
+ var TaskPhaseHistorySchema = z.object({
5205
+ typicalPhaseMinutes: z.number().nonnegative(),
5206
+ typicalPhaseSamples: z.number().int().positive()
5207
+ }).strict();
5181
5208
  var TaskStatusItemSchema = z.object({
5182
5209
  task: TaskToolRefSchema,
5183
5210
  issue: z.number().int().positive(),
5184
5211
  pr: z.number().int().positive().nullable(),
5185
- state: z.string()
5212
+ state: z.string(),
5213
+ round: z.number().int().positive().nullable().optional(),
5214
+ phase: z.string().min(1).nullable().optional(),
5215
+ minutesInPhase: z.number().nonnegative().nullable().optional(),
5216
+ phaseIsCurrent: z.boolean().nullable().optional(),
5217
+ lastConfidence: TaskConfidenceSchema.nullable().optional(),
5218
+ lastConfidenceUnread: z.boolean().optional(),
5219
+ phaseHistory: TaskPhaseHistorySchema.nullable().optional()
5186
5220
  }).merge(ObservedSchema);
5187
5221
  var TaskStatusResultSchema = z.object({
5188
5222
  items: z.array(TaskStatusItemSchema),
@@ -5194,7 +5228,7 @@ var EscalationInputsSchema = z.object({
5194
5228
  round: z.number().int().nonnegative(),
5195
5229
  head: z.string(),
5196
5230
  branch: z.string(),
5197
- prNumber: z.number().int().positive()
5231
+ prNumber: z.number().int().positive().nullable()
5198
5232
  });
5199
5233
  var EscalationEvidenceSchema = z.object({
5200
5234
  round: z.number().int().nonnegative(),
@@ -5230,13 +5264,45 @@ var TaskEscalationReadResultSchema = z.object({
5230
5264
  items: z.array(TaskEscalationPacketSchema),
5231
5265
  nextCursor: z.string().nullable()
5232
5266
  }).merge(ObservedSchema);
5233
- var TaskStartInputSchema = z.object({
5234
- tranche: z.string().min(1),
5235
- id: z.string().min(1)
5267
+ var TaskPrCheckSchema = z.object({
5268
+ name: z.string(),
5269
+ required: z.boolean(),
5270
+ status: z.string(),
5271
+ conclusion: z.string().nullable(),
5272
+ detailsUrl: z.string().nullable(),
5273
+ failureSummary: z.string().nullable()
5274
+ });
5275
+ var TaskPrVerdictSchema = z.object({
5276
+ role: z.enum(["code-review", "security"]),
5277
+ value: z.string(),
5278
+ judgedHead: z.string().nullable(),
5279
+ objectivesVersion: z.string().nullable()
5280
+ });
5281
+ var TaskPrPauseSchema = z.object({
5282
+ reason: z.string(),
5283
+ body: z.string()
5284
+ });
5285
+ var TaskPrReviewRecordSchema = z.object({
5286
+ verdicts: z.array(TaskPrVerdictSchema),
5287
+ roundMarkers: z.array(z.number().int().nonnegative()),
5288
+ summaryTable: z.string().nullable(),
5289
+ pause: TaskPrPauseSchema.nullable()
5290
+ });
5291
+ var TaskPrReadInputSchema = z.object({
5292
+ task: TaskToolRefSchema,
5293
+ pr: z.number().int().positive().optional()
5236
5294
  }).strict();
5295
+ var TaskPrReadResultSchema = z.object({
5296
+ task: TaskToolRefSchema,
5297
+ issue: z.number().int().positive(),
5298
+ pr: z.number().int().positive(),
5299
+ head: z.string().nullable(),
5300
+ checks: z.array(TaskPrCheckSchema),
5301
+ review: TaskPrReviewRecordSchema
5302
+ }).merge(ObservedSchema);
5237
5303
  var TaskStartResultSchema = z.object({
5238
5304
  requestId: z.string().min(1),
5239
- run: z.object({ tranche: z.string().min(1), id: z.string().min(1) }),
5305
+ run: TaskToolRefSchema,
5240
5306
  started: z.boolean(),
5241
5307
  startedAt: z.string(),
5242
5308
  mode: z.literal("attended")
@@ -5250,7 +5316,7 @@ var TaskCancelInputSchema = z.object({
5250
5316
  }).strict();
5251
5317
  var TaskResumeResultSchema = z.object({
5252
5318
  task: z.number().int().positive(),
5253
- pr: z.number().int().positive(),
5319
+ pr: z.number().int().positive().nullable(),
5254
5320
  escalationId: z.string().min(1),
5255
5321
  outcome: z.enum(["started", "already_resumed"]),
5256
5322
  authenticatedBy: z.string().min(1),
@@ -5259,7 +5325,7 @@ var TaskResumeResultSchema = z.object({
5259
5325
  var TaskCancelOutcomeSchema = z.enum(["confirmed", "pending", "uncertain"]);
5260
5326
  var TaskCancelResultSchema = z.object({
5261
5327
  task: z.number().int().positive(),
5262
- pr: z.number().int().positive(),
5328
+ pr: z.number().int().positive().nullable(),
5263
5329
  escalationId: z.string().min(1),
5264
5330
  outcome: TaskCancelOutcomeSchema,
5265
5331
  authenticatedBy: z.string().min(1),
@@ -5270,6 +5336,7 @@ var TASK_TOOL_NAMES = [
5270
5336
  "task_start",
5271
5337
  "task_status",
5272
5338
  "task_escalation_read",
5339
+ "task_pr_read",
5273
5340
  "task_resume",
5274
5341
  "task_cancel"
5275
5342
  ];