@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
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/checks/bin/check-ci-shard-coverage.ts
4
+ import { execFileSync } from "node:child_process";
5
+
6
+ // src/checks/contract.ts
7
+ var CHECK_SCHEMA_VERSION = 1;
8
+ function emitCheckError(error) {
9
+ process.stderr.write(`${JSON.stringify(error)}
10
+ `);
11
+ }
12
+
13
+ // src/lib/ci-shard-membership.ts
14
+ var CI_SHARD_COUNT = 3;
15
+ var CI_SHARD_DIR_REL = "tests/ci-shards";
16
+ function shardFileRelPath(n) {
17
+ return `${CI_SHARD_DIR_REL}/shard-${n}.txt`;
18
+ }
19
+ function isCliTestFile(relPath) {
20
+ if (!relPath.endsWith(".test.ts"))
21
+ return false;
22
+ const segments = relPath.split("/");
23
+ return !segments.includes("node_modules") && !segments.includes("dist");
24
+ }
25
+
26
+ // src/checks/bin/check-ci-shard-coverage.ts
27
+ var CHECK_NAME = "ci-shard-coverage";
28
+ var CLI_PREFIX = "apps/cli/";
29
+ function git(args) {
30
+ try {
31
+ return execFileSync("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
32
+ } catch {
33
+ return null;
34
+ }
35
+ }
36
+ function stagedAddedFiles() {
37
+ const out = git(["diff", "--cached", "--name-only", "--diff-filter=A"]);
38
+ if (out === null || out === "")
39
+ return [];
40
+ return out.split(`
41
+ `).map((s) => s.trim()).filter(Boolean);
42
+ }
43
+ function stagedCliFileContent(relPath) {
44
+ return git(["show", `:${CLI_PREFIX}${relPath}`]);
45
+ }
46
+ function main() {
47
+ const addedTestFiles = stagedAddedFiles().filter((p) => p.startsWith(CLI_PREFIX)).map((p) => p.slice(CLI_PREFIX.length)).filter(isCliTestFile);
48
+ if (addedTestFiles.length === 0) {
49
+ process.stdout.write(`${CHECK_NAME}: no new CLI test file staged in this commit
50
+ `);
51
+ process.exit(0);
52
+ }
53
+ const shardRelPaths = Array.from({ length: CI_SHARD_COUNT }, (_, i) => shardFileRelPath(i + 1));
54
+ const shardMembers = new Set;
55
+ for (const rel of shardRelPaths) {
56
+ const content = stagedCliFileContent(rel);
57
+ if (content === null)
58
+ continue;
59
+ for (const line of content.split(`
60
+ `)) {
61
+ const trimmed = line.trim();
62
+ if (trimmed)
63
+ shardMembers.add(trimmed);
64
+ }
65
+ }
66
+ const missing = addedTestFiles.filter((f) => !shardMembers.has(f));
67
+ process.stdout.write(`${CHECK_NAME}: ${addedTestFiles.length} new CLI test file(s) staged; ${missing.length} missing from a shard
68
+ `);
69
+ const shardPaths = shardRelPaths.map((rel) => `${CLI_PREFIX}${rel}`);
70
+ for (const file of missing) {
71
+ emitCheckError({
72
+ schema: CHECK_SCHEMA_VERSION,
73
+ check: CHECK_NAME,
74
+ severity: "error",
75
+ message: `${CLI_PREFIX}${file} is a new CLI test file not listed in any CI shard (${shardPaths.join(", ")}).`,
76
+ file: `${CLI_PREFIX}${file}`,
77
+ agent_recovery_prompt: `Add "${file}" as its own line to one of ${shardPaths.join(", ")}, stage that shard file, and commit again.`
78
+ });
79
+ }
80
+ process.exit(missing.length > 0 ? 1 : 0);
81
+ }
82
+ main();
@@ -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
 
5
3
  // src/checks/bin/check-closes-n.ts
6
4
  import { execFileSync as execFileSync2 } from "node:child_process";
@@ -1037,7 +1035,7 @@ function withDefaults(oldDefaults, newDefaults) {
1037
1035
  var endpoint = withDefaults(null, DEFAULTS);
1038
1036
 
1039
1037
  // ../../node_modules/fast-content-type-parse/index.js
1040
- var NullObject = function NullObject2() {};
1038
+ var NullObject = function NullObject() {};
1041
1039
  NullObject.prototype = Object.create(null);
1042
1040
  var paramRE = /; *([!#$%&'*+.^\w`|~-]+)=("(?:[\v\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\v\u0020-\u00ff])*"|[!#$%&'*+.^\w`|~-]+) */gu;
1043
1041
  var quotedPairRE = /\\([\v\u0020-\u00ff])/gu;
@@ -1781,27 +1779,27 @@ function splitTableRow(row) {
1781
1779
  return parts.map((p) => p.split(PLACEHOLDER).join("|"));
1782
1780
  }
1783
1781
  // ../../packages/aeg-core/src/blast-radius-domains.ts
1784
- function resolveWorkspaceEntry(entry2, listDirs) {
1785
- if (entry2.endsWith("/*")) {
1786
- const baseDir = entry2.slice(0, -2);
1782
+ function resolveWorkspaceEntry(entry, listDirs) {
1783
+ if (entry.endsWith("/*")) {
1784
+ const baseDir = entry.slice(0, -2);
1787
1785
  return listDirs(baseDir).map((name) => `${baseDir}/${name}`);
1788
1786
  }
1789
- if (entry2.includes("*"))
1787
+ if (entry.includes("*"))
1790
1788
  return [];
1791
- return [entry2];
1789
+ return [entry];
1792
1790
  }
1793
1791
  // ../../packages/aeg-core/src/consumer-enumeration.ts
1794
1792
  function deriveWorkspaceMemberDirs(workspaces, listDirs) {
1795
- const positive = workspaces.filter((entry2) => !entry2.startsWith("!"));
1796
- const negative = workspaces.filter((entry2) => entry2.startsWith("!")).map((entry2) => entry2.slice(1));
1793
+ const positive = workspaces.filter((entry) => !entry.startsWith("!"));
1794
+ const negative = workspaces.filter((entry) => entry.startsWith("!")).map((entry) => entry.slice(1));
1797
1795
  const excluded = new Set;
1798
- for (const entry2 of negative) {
1799
- for (const member of resolveWorkspaceEntry(entry2, listDirs))
1796
+ for (const entry of negative) {
1797
+ for (const member of resolveWorkspaceEntry(entry, listDirs))
1800
1798
  excluded.add(member);
1801
1799
  }
1802
1800
  const members = new Set;
1803
- for (const entry2 of positive) {
1804
- for (const member of resolveWorkspaceEntry(entry2, listDirs)) {
1801
+ for (const entry of positive) {
1802
+ for (const member of resolveWorkspaceEntry(entry, listDirs)) {
1805
1803
  if (!excluded.has(member))
1806
1804
  members.add(member);
1807
1805
  }
@@ -2047,12 +2045,24 @@ function extractBaseSha(comment) {
2047
2045
  const m = firstThirteenLines(comment).match(BASE_SHA_PATTERN);
2048
2046
  return m ? m[1].toLowerCase() : null;
2049
2047
  }
2050
- 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;
2051
2056
  function extractFindingSeverities(comment) {
2052
- return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) => ({
2053
- severity: m[1],
2054
- location: m[2]
2055
- }));
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
+ });
2056
2066
  }
2057
2067
  function extractVerdict(comments, valuePattern, missingLabel) {
2058
2068
  const candidates = comments.filter((c) => valuePattern.test(c));
@@ -2125,15 +2135,15 @@ function summarizeTranscript(jsonl) {
2125
2135
  const line = rawLine.trim();
2126
2136
  if (!line)
2127
2137
  continue;
2128
- let entry2;
2138
+ let entry;
2129
2139
  try {
2130
- entry2 = JSON.parse(line);
2140
+ entry = JSON.parse(line);
2131
2141
  } catch {
2132
2142
  continue;
2133
2143
  }
2134
- if (!entry2 || typeof entry2 !== "object")
2144
+ if (!entry || typeof entry !== "object")
2135
2145
  continue;
2136
- const obj = entry2;
2146
+ const obj = entry;
2137
2147
  if (obj.type !== "assistant")
2138
2148
  continue;
2139
2149
  const message = obj.message;
@@ -2466,6 +2476,12 @@ function evaluateReviewFindings(findings, scale, threshold) {
2466
2476
  });
2467
2477
  return { outcome: blockingFindings.length > 0 ? "blocked" : "clean", blockingFindings };
2468
2478
  }
2479
+ function isConsequentialFinding(finding) {
2480
+ return finding.state !== "resolved";
2481
+ }
2482
+ function consequentialFindings(findings) {
2483
+ return findings.filter((f) => isConsequentialFinding(f));
2484
+ }
2469
2485
  function evaluateCodeReview(findings, policy) {
2470
2486
  return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold);
2471
2487
  }
@@ -2981,7 +2997,7 @@ function isStep0Block(content) {
2981
2997
  }
2982
2998
  function checkCommandsCarryOutput(prBody) {
2983
2999
  const errors = [];
2984
- for (const [label2, num] of [
3000
+ for (const [label, num] of [
2985
3001
  ["5", 5],
2986
3002
  ["6", 6]
2987
3003
  ]) {
@@ -2995,7 +3011,7 @@ function checkCommandsCarryOutput(prBody) {
2995
3011
  continue;
2996
3012
  const next = blocks[i + 1];
2997
3013
  if (!next || isCommandBlock(next.content)) {
2998
- 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.`);
3014
+ 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.`);
2999
3015
  }
3000
3016
  }
3001
3017
  }
@@ -3432,8 +3448,8 @@ function stripPartBackticks(text) {
3432
3448
  function partWordCount(text) {
3433
3449
  return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
3434
3450
  }
3435
- function looksLikeFilePath(entry2) {
3436
- const stripped = entry2.replace(/\/\*\*?$/, "");
3451
+ function looksLikeFilePath(entry) {
3452
+ const stripped = entry.replace(/\/\*\*?$/, "");
3437
3453
  const lastSegment = stripped.split("/").pop() ?? stripped;
3438
3454
  const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
3439
3455
  return extMatch !== null && extMatch.index > 0;
@@ -3919,14 +3935,14 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
3919
3935
  const referenced = extractClosesReferences(prBody);
3920
3936
  if (taskIssueRefs) {
3921
3937
  for (const n of referenced) {
3922
- const ref2 = taskIssueRefs.get(n);
3923
- if (!ref2)
3938
+ const ref = taskIssueRefs.get(n);
3939
+ if (!ref)
3924
3940
  continue;
3925
- const expectedBranch = `task/${ref2.trancheSlug}/${ref2.taskId}`;
3941
+ const expectedBranch = `task/${ref.trancheSlug}/${ref.taskId}`;
3926
3942
  if (branch !== expectedBranch) {
3927
3943
  return {
3928
3944
  ok: false,
3929
- 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.`
3945
+ 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.`
3930
3946
  };
3931
3947
  }
3932
3948
  }
@@ -3935,15 +3951,15 @@ function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
3935
3951
  if (!ref)
3936
3952
  return { ok: true };
3937
3953
  if (ref.kind === "issue") {
3938
- const expectedIssue2 = ref.issueNumber;
3939
- if (!referenced.has(expectedIssue2)) {
3954
+ const expectedIssue = ref.issueNumber;
3955
+ if (!referenced.has(expectedIssue)) {
3940
3956
  return {
3941
3957
  ok: false,
3942
- expectedIssue: expectedIssue2,
3943
- message: `closes-n: PR body does not contain \`Closes #${expectedIssue2}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
3958
+ expectedIssue,
3959
+ message: `closes-n: PR body does not contain \`Closes #${expectedIssue}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
3944
3960
  };
3945
3961
  }
3946
- return { ok: true, expectedIssue: expectedIssue2 };
3962
+ return { ok: true, expectedIssue };
3947
3963
  }
3948
3964
  const trancheSlug = ref.tranche;
3949
3965
  const taskId = ref.taskId;
@@ -3989,8 +4005,8 @@ function extractIssue(body) {
3989
4005
  const anchorNums = closesRefs(anchored);
3990
4006
  if (anchorNums.length === 0)
3991
4007
  return { issue: null, extraIssues: bodyNums, outsideHeader: false };
3992
- const issue2 = anchorNums[0];
3993
- return { issue: issue2, extraIssues: bodyNums.filter((n) => n !== issue2), outsideHeader: false };
4008
+ const issue = anchorNums[0];
4009
+ return { issue, extraIssues: bodyNums.filter((n) => n !== issue), outsideHeader: false };
3994
4010
  }
3995
4011
  const headerNums = closesRefs(headerRegion(stripped));
3996
4012
  if (bodyNums.length === 0)
@@ -4059,15 +4075,15 @@ function compareManifest(echoed, current, patchIdOf) {
4059
4075
  const bothFullShas = echoedShaLen >= 40 && currentShaLen >= 40;
4060
4076
  const base = patchHead || exactHead && bothFullShas ? true : isBoundToBase(echoed, current.baseSha);
4061
4077
  const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
4062
- const objectivesVersion2 = isBoundToObjectives(echoed, current.objectivesVersion);
4078
+ const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
4063
4079
  const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
4064
4080
  const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
4065
4081
  return {
4066
- bound: head && base && briefHashBound && objectivesVersion2 && rulingOrdinal && policyDigestBound,
4082
+ bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
4067
4083
  head,
4068
4084
  base,
4069
4085
  briefHash: briefHashBound,
4070
- objectivesVersion: objectivesVersion2,
4086
+ objectivesVersion,
4071
4087
  rulingOrdinal,
4072
4088
  policyDigest: policyDigestBound
4073
4089
  };
@@ -4098,8 +4114,8 @@ function checkReviewGate(input) {
4098
4114
  let codeReviewPolicyEvaluation;
4099
4115
  let securityPolicyEvaluation;
4100
4116
  try {
4101
- codeReviewPolicyEvaluation = evaluateCodeReview(codeReview.findingSeverities, policy);
4102
- securityPolicyEvaluation = evaluateSecurityReview(security.findingSeverities, policy);
4117
+ codeReviewPolicyEvaluation = evaluateCodeReview(consequentialFindings(codeReview.findingSeverities), policy);
4118
+ securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy);
4103
4119
  } catch (err) {
4104
4120
  return {
4105
4121
  verdict: "fail",
@@ -5180,11 +5196,27 @@ var ObservedSchema = z.object({
5180
5196
  var TaskStatusInputSchema = z.object({
5181
5197
  task: TaskToolRefSchema.optional()
5182
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();
5183
5208
  var TaskStatusItemSchema = z.object({
5184
5209
  task: TaskToolRefSchema,
5185
5210
  issue: z.number().int().positive(),
5186
5211
  pr: z.number().int().positive().nullable(),
5187
- 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()
5188
5220
  }).merge(ObservedSchema);
5189
5221
  var TaskStatusResultSchema = z.object({
5190
5222
  items: z.array(TaskStatusItemSchema),
@@ -5196,7 +5228,7 @@ var EscalationInputsSchema = z.object({
5196
5228
  round: z.number().int().nonnegative(),
5197
5229
  head: z.string(),
5198
5230
  branch: z.string(),
5199
- prNumber: z.number().int().positive()
5231
+ prNumber: z.number().int().positive().nullable()
5200
5232
  });
5201
5233
  var EscalationEvidenceSchema = z.object({
5202
5234
  round: z.number().int().nonnegative(),
@@ -5232,13 +5264,45 @@ var TaskEscalationReadResultSchema = z.object({
5232
5264
  items: z.array(TaskEscalationPacketSchema),
5233
5265
  nextCursor: z.string().nullable()
5234
5266
  }).merge(ObservedSchema);
5235
- var TaskStartInputSchema = z.object({
5236
- tranche: z.string().min(1),
5237
- 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()
5238
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);
5239
5303
  var TaskStartResultSchema = z.object({
5240
5304
  requestId: z.string().min(1),
5241
- run: z.object({ tranche: z.string().min(1), id: z.string().min(1) }),
5305
+ run: TaskToolRefSchema,
5242
5306
  started: z.boolean(),
5243
5307
  startedAt: z.string(),
5244
5308
  mode: z.literal("attended")
@@ -5252,7 +5316,7 @@ var TaskCancelInputSchema = z.object({
5252
5316
  }).strict();
5253
5317
  var TaskResumeResultSchema = z.object({
5254
5318
  task: z.number().int().positive(),
5255
- pr: z.number().int().positive(),
5319
+ pr: z.number().int().positive().nullable(),
5256
5320
  escalationId: z.string().min(1),
5257
5321
  outcome: z.enum(["started", "already_resumed"]),
5258
5322
  authenticatedBy: z.string().min(1),
@@ -5261,7 +5325,7 @@ var TaskResumeResultSchema = z.object({
5261
5325
  var TaskCancelOutcomeSchema = z.enum(["confirmed", "pending", "uncertain"]);
5262
5326
  var TaskCancelResultSchema = z.object({
5263
5327
  task: z.number().int().positive(),
5264
- pr: z.number().int().positive(),
5328
+ pr: z.number().int().positive().nullable(),
5265
5329
  escalationId: z.string().min(1),
5266
5330
  outcome: TaskCancelOutcomeSchema,
5267
5331
  authenticatedBy: z.string().min(1),
@@ -5272,6 +5336,7 @@ var TASK_TOOL_NAMES = [
5272
5336
  "task_start",
5273
5337
  "task_status",
5274
5338
  "task_escalation_read",
5339
+ "task_pr_read",
5275
5340
  "task_resume",
5276
5341
  "task_cancel"
5277
5342
  ];
@@ -5499,6 +5564,10 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
5499
5564
  }
5500
5565
  return findings;
5501
5566
  }
5567
+ // ../../packages/aeg-core/src/dev-review-loop/types.ts
5568
+ var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
5569
+ // ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
5570
+ var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
5502
5571
  // ../../packages/aeg-core/src/log/envelope.ts
5503
5572
  import { createHash as createHash5 } from "node:crypto";
5504
5573
 
@@ -6037,6 +6106,7 @@ function redact(value, home) {
6037
6106
  return value;
6038
6107
  }
6039
6108
  // ../../packages/aeg-core/src/log/store.ts
6109
+ var KNOWN_SCHEMA_VERSIONS = [1, 2];
6040
6110
  function metaOf(obj) {
6041
6111
  if (obj === null || typeof obj !== "object")
6042
6112
  return null;
@@ -6059,11 +6129,61 @@ function recordIdentity(obj) {
6059
6129
  }
6060
6130
  return null;
6061
6131
  }
6062
-
6063
- // ../../packages/aeg-core/src/log/artifact.ts
6064
- var TASK_LOG_ARTIFACT_MAX_BYTES = 8 * 1024 * 1024;
6065
- // ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
6066
- var STOPPED_CONDITIONS = new Set(["confidence", "reappearance", "no_progress", "max_rounds"]);
6132
+ function schemaVersionOf(obj) {
6133
+ const meta = metaOf(obj);
6134
+ const schema = meta?.schema;
6135
+ return typeof schema === "number" ? schema : null;
6136
+ }
6137
+ function isKnownSchema(version) {
6138
+ return version !== null && KNOWN_SCHEMA_VERSIONS.includes(version);
6139
+ }
6140
+ function classifyStoredLine(raw, home) {
6141
+ let obj;
6142
+ try {
6143
+ obj = JSON.parse(raw);
6144
+ } catch {
6145
+ return { status: "invalid", identity: null, raw, reason: "not valid JSON" };
6146
+ }
6147
+ const version = schemaVersionOf(obj);
6148
+ if (version === null) {
6149
+ return { status: "invalid", identity: recordIdentity(obj), raw, reason: "no readable meta.schema" };
6150
+ }
6151
+ if (!isKnownSchema(version)) {
6152
+ return {
6153
+ status: "unknown_version",
6154
+ identity: recordIdentity(obj),
6155
+ schema: version,
6156
+ raw,
6157
+ reason: `schema version ${version} is not one this build validates (${KNOWN_SCHEMA_VERSIONS.join(", ")}) — kept for diagnosis`
6158
+ };
6159
+ }
6160
+ const result = LogEventSchema.safeParse(obj);
6161
+ if (!result.success) {
6162
+ return {
6163
+ status: "invalid",
6164
+ identity: recordIdentity(obj),
6165
+ raw,
6166
+ reason: result.error.issues[0]?.message ?? "schema violation"
6167
+ };
6168
+ }
6169
+ const event = result.data;
6170
+ const identity = recordIdentity(event);
6171
+ if (identity === null) {
6172
+ return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
6173
+ }
6174
+ const redacted = redact(event, home);
6175
+ const provenance = version === 2 ? event.meta.provenance ?? null : null;
6176
+ return {
6177
+ status: "ok",
6178
+ identity,
6179
+ runId: event.meta.run_id,
6180
+ seq: event.meta.seq,
6181
+ schema: version,
6182
+ provenance,
6183
+ event,
6184
+ postLine: JSON.stringify(redacted)
6185
+ };
6186
+ }
6067
6187
  // ../../packages/aeg-core/src/control-store/records.ts
6068
6188
  import { z as z3 } from "zod";
6069
6189
  var isoTimestamp = z3.string().min(1);
@@ -6344,10 +6464,10 @@ var COMMANDS = [
6344
6464
  }
6345
6465
  ],
6346
6466
  details: [
6347
- "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.",
6467
+ "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.",
6348
6468
  "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.",
6349
- "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.",
6350
- "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."
6469
+ "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.",
6470
+ "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`)."
6351
6471
  ],
6352
6472
  status: "shipped"
6353
6473
  },
@@ -6386,7 +6506,7 @@ var COMMANDS = [
6386
6506
  details: [
6387
6507
  "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.",
6388
6508
  "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.",
6389
- "`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."
6509
+ "`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."
6390
6510
  ],
6391
6511
  status: "shipped"
6392
6512
  },
@@ -6516,48 +6636,6 @@ var COMMANDS = [
6516
6636
  ],
6517
6637
  status: "shipped"
6518
6638
  },
6519
- {
6520
- name: "log flush",
6521
- description: "Post a target Issue or PR's outbox as one or more marked comments, then truncate what the forge confirmed",
6522
- flags: [
6523
- { flag: "--issue", description: "Flush this Issue's outbox (`~/.vinaya/outbox/<owner>-<repo>/<n>.ndjson`)" },
6524
- {
6525
- flag: "--pr",
6526
- description: "Flush the Issue named by this PR's `Closes #N` line, posting the comments on the PR"
6527
- },
6528
- { flag: "--json", description: "Enveloped JSON output (schema: 1)" }
6529
- ],
6530
- details: [
6531
- "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.",
6532
- "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.",
6533
- "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."
6534
- ],
6535
- status: "shipped"
6536
- },
6537
- {
6538
- name: "log export-artifact",
6539
- description: "Copy this run's own local outbox into a file, for the generated task-path workflow's own upload step",
6540
- flags: [],
6541
- details: [
6542
- "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.",
6543
- "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."
6544
- ],
6545
- status: "shipped"
6546
- },
6547
- {
6548
- name: "log collect-artifact",
6549
- description: "Validate a downloaded task-log artifact and publish the valid records through the existing flush path",
6550
- flags: [
6551
- { flag: "--pr", description: "The pull request this artifact belongs to" },
6552
- { flag: "--repo", description: "Expected `owner/repo` — a provenance cross-check against each record" }
6553
- ],
6554
- details: [
6555
- "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.",
6556
- "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.",
6557
- "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."
6558
- ],
6559
- status: "shipped"
6560
- },
6561
6639
  {
6562
6640
  name: "milestone create",
6563
6641
  description: "Create a GitHub Milestone from a validated body",
@@ -6887,7 +6965,7 @@ var COMMANDS = [
6887
6965
  { flag: "--task", description: "This dispatch's task Issue number — mutually exclusive with `--pr`" },
6888
6966
  {
6889
6967
  flag: "--pr",
6890
- description: "Flush the outbox to this PR's Issue after the dispatch — mutually exclusive with `--task`"
6968
+ description: "This dispatch's pull request number, for attribution — mutually exclusive with `--task`"
6891
6969
  },
6892
6970
  { flag: "--round", description: "Round number, for a dispatch inside a review loop" },
6893
6971
  {
@@ -6899,7 +6977,7 @@ var COMMANDS = [
6899
6977
  details: [
6900
6978
  "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.",
6901
6979
  "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`.",
6902
- "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.",
6980
+ "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.",
6903
6981
  "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."
6904
6982
  ],
6905
6983
  status: "shipped"
@@ -6919,7 +6997,8 @@ var COMMANDS = [
6919
6997
  "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> -->`.",
6920
6998
  "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.",
6921
6999
  "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.",
6922
- "Every dispatch and round transition is a log line through the Vinaya Log, flushed to the forge at each round boundary."
7000
+ "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.",
7001
+ "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)."
6923
7002
  ],
6924
7003
  status: "shipped"
6925
7004
  }