@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
@@ -528,11 +528,27 @@ var ObservedSchema = z.object({
528
528
  var TaskStatusInputSchema = z.object({
529
529
  task: TaskToolRefSchema.optional()
530
530
  }).merge(PageRequestSchema).strict();
531
+ var TaskConfidenceSchema = z.object({
532
+ round: z.number().int().positive(),
533
+ percent: z.number().int().min(0).max(100).nullable(),
534
+ source: z.enum(["stated", "published-summary"])
535
+ }).strict();
536
+ var TaskPhaseHistorySchema = z.object({
537
+ typicalPhaseMinutes: z.number().nonnegative(),
538
+ typicalPhaseSamples: z.number().int().positive()
539
+ }).strict();
531
540
  var TaskStatusItemSchema = z.object({
532
541
  task: TaskToolRefSchema,
533
542
  issue: z.number().int().positive(),
534
543
  pr: z.number().int().positive().nullable(),
535
- state: z.string()
544
+ state: z.string(),
545
+ round: z.number().int().positive().nullable().optional(),
546
+ phase: z.string().min(1).nullable().optional(),
547
+ minutesInPhase: z.number().nonnegative().nullable().optional(),
548
+ phaseIsCurrent: z.boolean().nullable().optional(),
549
+ lastConfidence: TaskConfidenceSchema.nullable().optional(),
550
+ lastConfidenceUnread: z.boolean().optional(),
551
+ phaseHistory: TaskPhaseHistorySchema.nullable().optional()
536
552
  }).merge(ObservedSchema);
537
553
  var TaskStatusResultSchema = z.object({
538
554
  items: z.array(TaskStatusItemSchema),
@@ -544,7 +560,7 @@ var EscalationInputsSchema = z.object({
544
560
  round: z.number().int().nonnegative(),
545
561
  head: z.string(),
546
562
  branch: z.string(),
547
- prNumber: z.number().int().positive()
563
+ prNumber: z.number().int().positive().nullable()
548
564
  });
549
565
  var EscalationEvidenceSchema = z.object({
550
566
  round: z.number().int().nonnegative(),
@@ -580,13 +596,45 @@ var TaskEscalationReadResultSchema = z.object({
580
596
  items: z.array(TaskEscalationPacketSchema),
581
597
  nextCursor: z.string().nullable()
582
598
  }).merge(ObservedSchema);
583
- var TaskStartInputSchema = z.object({
584
- tranche: z.string().min(1),
585
- id: z.string().min(1)
599
+ var TaskPrCheckSchema = z.object({
600
+ name: z.string(),
601
+ required: z.boolean(),
602
+ status: z.string(),
603
+ conclusion: z.string().nullable(),
604
+ detailsUrl: z.string().nullable(),
605
+ failureSummary: z.string().nullable()
606
+ });
607
+ var TaskPrVerdictSchema = z.object({
608
+ role: z.enum(["code-review", "security"]),
609
+ value: z.string(),
610
+ judgedHead: z.string().nullable(),
611
+ objectivesVersion: z.string().nullable()
612
+ });
613
+ var TaskPrPauseSchema = z.object({
614
+ reason: z.string(),
615
+ body: z.string()
616
+ });
617
+ var TaskPrReviewRecordSchema = z.object({
618
+ verdicts: z.array(TaskPrVerdictSchema),
619
+ roundMarkers: z.array(z.number().int().nonnegative()),
620
+ summaryTable: z.string().nullable(),
621
+ pause: TaskPrPauseSchema.nullable()
622
+ });
623
+ var TaskPrReadInputSchema = z.object({
624
+ task: TaskToolRefSchema,
625
+ pr: z.number().int().positive().optional()
586
626
  }).strict();
627
+ var TaskPrReadResultSchema = z.object({
628
+ task: TaskToolRefSchema,
629
+ issue: z.number().int().positive(),
630
+ pr: z.number().int().positive(),
631
+ head: z.string().nullable(),
632
+ checks: z.array(TaskPrCheckSchema),
633
+ review: TaskPrReviewRecordSchema
634
+ }).merge(ObservedSchema);
587
635
  var TaskStartResultSchema = z.object({
588
636
  requestId: z.string().min(1),
589
- run: z.object({ tranche: z.string().min(1), id: z.string().min(1) }),
637
+ run: TaskToolRefSchema,
590
638
  started: z.boolean(),
591
639
  startedAt: z.string(),
592
640
  mode: z.literal("attended")
@@ -600,7 +648,7 @@ var TaskCancelInputSchema = z.object({
600
648
  }).strict();
601
649
  var TaskResumeResultSchema = z.object({
602
650
  task: z.number().int().positive(),
603
- pr: z.number().int().positive(),
651
+ pr: z.number().int().positive().nullable(),
604
652
  escalationId: z.string().min(1),
605
653
  outcome: z.enum(["started", "already_resumed"]),
606
654
  authenticatedBy: z.string().min(1),
@@ -609,7 +657,7 @@ var TaskResumeResultSchema = z.object({
609
657
  var TaskCancelOutcomeSchema = z.enum(["confirmed", "pending", "uncertain"]);
610
658
  var TaskCancelResultSchema = z.object({
611
659
  task: z.number().int().positive(),
612
- pr: z.number().int().positive(),
660
+ pr: z.number().int().positive().nullable(),
613
661
  escalationId: z.string().min(1),
614
662
  outcome: TaskCancelOutcomeSchema,
615
663
  authenticatedBy: z.string().min(1),
@@ -620,6 +668,7 @@ var TASK_TOOL_NAMES = [
620
668
  "task_start",
621
669
  "task_status",
622
670
  "task_escalation_read",
671
+ "task_pr_read",
623
672
  "task_resume",
624
673
  "task_cancel"
625
674
  ];
@@ -2410,7 +2459,28 @@ function trustAnchorRepoFromRemoteUrl(url) {
2410
2459
  return m?.[1] && m[2] ? wellFormedRepoSlug(`${m[1]}/${m[2]}`) : null;
2411
2460
  }
2412
2461
  var execFileAsync4 = promisify4(execFile4);
2462
+ function resolveCiTrustAnchorProbeRef(env = process.env) {
2463
+ const ref = env.VINAYA_CI_CONFIG_PROBE_REF?.trim();
2464
+ if (!ref)
2465
+ return null;
2466
+ if (env.GITHUB_ACTIONS !== "true")
2467
+ return null;
2468
+ if ((env.GH_TOKEN ?? "").length > 0 || (env.GITHUB_TOKEN ?? "").length > 0)
2469
+ return null;
2470
+ return ref;
2471
+ }
2472
+ function readTrustAnchorConfigAtRef(ref) {
2473
+ const raw = execFileSync2("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
2474
+ encoding: "utf-8",
2475
+ stdio: ["ignore", "pipe", "pipe"],
2476
+ timeout: 1e4
2477
+ });
2478
+ return Buffer.from(raw, "utf-8").toString("base64");
2479
+ }
2413
2480
  function ghFetchTrustAnchorConfig() {
2481
+ const probeRef = resolveCiTrustAnchorProbeRef();
2482
+ if (probeRef)
2483
+ return readTrustAnchorConfigAtRef(probeRef);
2414
2484
  const repo = trustAnchorRepo();
2415
2485
  if (!repo)
2416
2486
  throw new Error("could not resolve repo identity for the trust-anchor read");
@@ -2420,6 +2490,14 @@ function ghFetchTrustAnchorConfig() {
2420
2490
  });
2421
2491
  }
2422
2492
  async function ghFetchTrustAnchorConfigAsync() {
2493
+ const probeRef = resolveCiTrustAnchorProbeRef();
2494
+ if (probeRef) {
2495
+ const { stdout } = await execFileAsync4("git", ["show", `${probeRef}:${LOCAL_CONFIG_FILENAME}`], {
2496
+ encoding: "utf-8",
2497
+ timeout: 1e4
2498
+ });
2499
+ return Buffer.from(stdout, "utf-8").toString("base64");
2500
+ }
2423
2501
  const repo = await trustAnchorRepoAsync();
2424
2502
  if (!repo)
2425
2503
  throw new Error("could not resolve repo identity for the trust-anchor read");
@@ -2684,6 +2762,7 @@ import {
2684
2762
  renameSync as renameSync2,
2685
2763
  statSync as statSync2,
2686
2764
  unlinkSync as unlinkSync2,
2765
+ utimesSync,
2687
2766
  writeFileSync as writeFileSync2,
2688
2767
  writeSync as writeSync2
2689
2768
  } from "node:fs";
@@ -2767,6 +2846,27 @@ function acquireDrainLock(lockPath) {
2767
2846
  unlinkSync2(claimed);
2768
2847
  return tryCreateLock(lockPath, token) ? token : null;
2769
2848
  }
2849
+ function renewDrainLock(lockPath, token) {
2850
+ let holder;
2851
+ try {
2852
+ holder = readFileSync4(lockPath, "utf8").trim();
2853
+ } catch (err) {
2854
+ if (!isEnoent(err))
2855
+ throw err;
2856
+ return false;
2857
+ }
2858
+ if (holder !== token)
2859
+ return false;
2860
+ const now = new Date;
2861
+ try {
2862
+ utimesSync(lockPath, now, now);
2863
+ } catch (err) {
2864
+ if (!isEnoent(err))
2865
+ throw err;
2866
+ return false;
2867
+ }
2868
+ return true;
2869
+ }
2770
2870
  function releaseDrainLock(lockPath, token) {
2771
2871
  try {
2772
2872
  const holder = readFileSync4(lockPath, "utf8").trim();
@@ -2786,6 +2886,172 @@ class WebhookDrainError extends Error {
2786
2886
  this.code = code;
2787
2887
  }
2788
2888
  }
2889
+ function backupPathFor(queuePath) {
2890
+ return queuePath.replace(/\.ndjson$/, ".1.ndjson");
2891
+ }
2892
+ function drainingPathFor(queuePath) {
2893
+ return queuePath.replace(/\.ndjson$/, ".draining.ndjson");
2894
+ }
2895
+ function rejectedPathFor(queuePath) {
2896
+ return queuePath.replace(/\.ndjson$/, ".rejected.ndjson");
2897
+ }
2898
+ var rejectionWarnedThisProcess = false;
2899
+ function warnRejectionOnce(message) {
2900
+ if (rejectionWarnedThisProcess)
2901
+ return;
2902
+ rejectionWarnedThisProcess = true;
2903
+ try {
2904
+ process.stderr.write(message);
2905
+ } catch {}
2906
+ }
2907
+ function queueLines(buf) {
2908
+ const lines = [];
2909
+ let start = 0;
2910
+ for (let i = 0;i < buf.byteLength; i++) {
2911
+ if (buf[i] !== 10)
2912
+ continue;
2913
+ if (i > start)
2914
+ lines.push({ raw: buf.toString("utf8", start, i), end: i + 1 });
2915
+ start = i + 1;
2916
+ }
2917
+ if (start < buf.byteLength)
2918
+ lines.push({ raw: buf.toString("utf8", start), end: buf.byteLength });
2919
+ return lines;
2920
+ }
2921
+ function removeQueueHead(path, cut) {
2922
+ const remaining = readFileSync4(path);
2923
+ writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
2924
+ }
2925
+ function queueBucketSize(path) {
2926
+ let lstat;
2927
+ try {
2928
+ lstat = lstatSync2(path);
2929
+ } catch (err) {
2930
+ if (!isEnoent(err))
2931
+ throw err;
2932
+ }
2933
+ if (lstat === undefined)
2934
+ return null;
2935
+ if (!lstat.isFile()) {
2936
+ throw new WebhookDrainError("log-webhook-drain-symlink", `log webhook drain: outbox target is not a regular file (symlink, FIFO, or similar) — refusing to read: ${path}`);
2937
+ }
2938
+ return Number(lstat.size);
2939
+ }
2940
+ function readQueueFile(path) {
2941
+ if (queueBucketSize(path) === null)
2942
+ return null;
2943
+ return readFileSync4(path);
2944
+ }
2945
+ function rejectLine(rejectedPath, reason, status, identity, raw) {
2946
+ const record = JSON.stringify({
2947
+ rejected_at: new Date().toISOString(),
2948
+ status,
2949
+ reason,
2950
+ identity,
2951
+ bytes: Buffer.byteLength(raw, "utf8"),
2952
+ raw
2953
+ });
2954
+ const failure = appendHardenedLine(rejectedPath, `${record}
2955
+ `);
2956
+ if (failure !== null) {
2957
+ throw new WebhookDrainError("log-webhook-drain-rejected-write", `log webhook drain: a queued line failed re-validation (${reason}) and could not be set aside in ${rejectedPath} — ${failure}; the line stays queued`);
2958
+ }
2959
+ warnRejectionOnce(`vinaya: log delivery set a queued line aside in ${rejectedPath} — ${reason}; later lines keep delivering
2960
+ `);
2961
+ }
2962
+ async function postChunk(webhookUrl, headers, body, fetchTimeoutMs, chunksAlreadyDelivered) {
2963
+ const delivered = chunksAlreadyDelivered > 0 ? ` after delivering ${chunksAlreadyDelivered} chunk(s)` : "";
2964
+ let response;
2965
+ try {
2966
+ response = await fetch(webhookUrl, {
2967
+ method: "POST",
2968
+ headers: { "content-type": "application/x-ndjson", ...headers },
2969
+ body,
2970
+ signal: AbortSignal.timeout(fetchTimeoutMs)
2971
+ });
2972
+ } catch (err) {
2973
+ const reason = err instanceof Error && err.name === "TimeoutError" ? `timed out after ${fetchTimeoutMs}ms` : err instanceof Error ? err.message : String(err);
2974
+ throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} failed${delivered}: ${reason}`);
2975
+ }
2976
+ if (!response.ok) {
2977
+ throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} returned ${response.status} ${response.statusText}${delivered}`);
2978
+ }
2979
+ }
2980
+ async function drainQueueFile(args) {
2981
+ const { path, rejectedPath, webhookUrl, headers, fetchTimeoutMs, totals } = args;
2982
+ const buf = readQueueFile(path);
2983
+ if (buf === null || buf.byteLength === 0)
2984
+ return;
2985
+ const lines = queueLines(buf);
2986
+ if (lines.length === 0) {
2987
+ removeQueueHead(path, buf.byteLength);
2988
+ return;
2989
+ }
2990
+ let removed = 0;
2991
+ let pendingEnd = 0;
2992
+ let chunk = [];
2993
+ let chunkBytes = 0;
2994
+ const deliverChunk = async () => {
2995
+ const body = `${chunk.join(`
2996
+ `)}
2997
+ `;
2998
+ args.keepLock();
2999
+ await postChunk(webhookUrl, headers, body, fetchTimeoutMs, totals.chunks);
3000
+ totals.chunks += 1;
3001
+ totals.lineCount += chunk.length;
3002
+ totals.bytes += Buffer.byteLength(body, "utf8");
3003
+ removeQueueHead(path, pendingEnd - removed);
3004
+ removed = pendingEnd;
3005
+ chunk = [];
3006
+ chunkBytes = 0;
3007
+ };
3008
+ const setAside = async (reason, status, identity, line) => {
3009
+ if (chunk.length > 0)
3010
+ await deliverChunk();
3011
+ rejectLine(rejectedPath, reason, status, identity, line.raw);
3012
+ totals.rejected += 1;
3013
+ pendingEnd = line.end;
3014
+ removeQueueHead(path, pendingEnd - removed);
3015
+ removed = pendingEnd;
3016
+ };
3017
+ for (const line of lines) {
3018
+ const record = classifyStoredLine(line.raw, homedir2());
3019
+ if (record.status !== "ok") {
3020
+ await setAside(record.reason, record.status, record.identity, line);
3021
+ continue;
3022
+ }
3023
+ const lineBytes = Buffer.byteLength(record.postLine, "utf8") + 1;
3024
+ if (lineBytes > MAX_WEBHOOK_BODY_BYTES) {
3025
+ await setAside(`one line is ${lineBytes} byte(s), over the ${MAX_WEBHOOK_BODY_BYTES}-byte per-POST cap — no chunking can carry it`, "too_large", record.identity, line);
3026
+ continue;
3027
+ }
3028
+ if (chunk.length > 0 && chunkBytes + lineBytes > MAX_WEBHOOK_BODY_BYTES)
3029
+ await deliverChunk();
3030
+ chunk.push(record.postLine);
3031
+ chunkBytes += lineBytes;
3032
+ pendingEnd = line.end;
3033
+ }
3034
+ pendingEnd = buf.byteLength;
3035
+ if (chunk.length > 0) {
3036
+ await deliverChunk();
3037
+ return;
3038
+ }
3039
+ if (pendingEnd > removed)
3040
+ removeQueueHead(path, pendingEnd - removed);
3041
+ }
3042
+ async function drainRenamedAside(args, livePath, source) {
3043
+ args.keepLock();
3044
+ const draining = drainingPathFor(livePath);
3045
+ try {
3046
+ renameSync2(source, draining);
3047
+ } catch (err) {
3048
+ if (isEnoent(err))
3049
+ return;
3050
+ throw err;
3051
+ }
3052
+ await drainQueueFile({ ...args, path: draining });
3053
+ unlinkSync2(draining);
3054
+ }
2789
3055
  async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeoutMs = WEBHOOK_FETCH_TIMEOUT_MS) {
2790
3056
  const resolved = await resolveRepo();
2791
3057
  const repo = resolved && isSafeRepoSegment2(resolved.owner) && isSafeRepoSegment2(resolved.repo) ? resolved : null;
@@ -2793,61 +3059,32 @@ async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeou
2793
3059
  const path = outboxPathFor({ outboxRoot }, repo, outboxTask);
2794
3060
  const lockPath = `${path}.flush-lock`;
2795
3061
  const lockToken = acquireDrainLock(lockPath);
3062
+ const totals = { lineCount: 0, bytes: 0, chunks: 0, rejected: 0 };
2796
3063
  if (lockToken === null)
2797
- return { flushed: false };
3064
+ return { flushed: false, ...totals };
2798
3065
  try {
2799
- let lstat;
2800
- try {
2801
- lstat = lstatSync2(path);
2802
- } catch (err) {
2803
- if (!isEnoent(err))
2804
- throw err;
2805
- }
2806
- if (lstat === undefined)
2807
- return { flushed: false };
2808
- if (!lstat.isFile()) {
2809
- throw new WebhookDrainError("log-webhook-drain-symlink", `log webhook drain: outbox target is not a regular file (symlink, FIFO, or similar) — refusing to read: ${path}`);
2810
- }
2811
- const buf = readFileSync4(path);
2812
- const startOffset = buf.byteLength;
2813
- const rawLines = buf.toString("utf8").split(`
2814
- `).filter((l) => l.length > 0);
2815
- if (rawLines.length === 0)
2816
- return { flushed: false };
2817
- const postLines = [];
2818
- for (let i = 0;i < rawLines.length; i++) {
2819
- const record = classifyStoredLine(rawLines[i], homedir2());
2820
- if (record.status !== "ok") {
2821
- throw new WebhookDrainError("log-webhook-drain-corrupt-line", `log webhook drain: outbox line ${i} failed schema re-validation — ${record.reason}`);
2822
- }
2823
- postLines.push(record.postLine);
2824
- }
2825
- const body = `${postLines.join(`
2826
- `)}
2827
- `;
2828
- const bytes = Buffer.byteLength(body, "utf8");
2829
- if (bytes > MAX_WEBHOOK_BODY_BYTES) {
2830
- throw new WebhookDrainError("log-webhook-drain-too-large", `log webhook drain: outbox body is ${bytes} byte(s), over the ${MAX_WEBHOOK_BODY_BYTES}-byte per-call cap — flush more often to drain it.`);
2831
- }
2832
- let response;
2833
- try {
2834
- response = await fetch(webhookUrl, {
2835
- method: "POST",
2836
- headers: { "content-type": "application/x-ndjson", ...headers },
2837
- body,
2838
- signal: AbortSignal.timeout(fetchTimeoutMs)
2839
- });
2840
- } catch (err) {
2841
- const reason = err instanceof Error && err.name === "TimeoutError" ? `timed out after ${fetchTimeoutMs}ms` : err instanceof Error ? err.message : String(err);
2842
- throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} failed: ${reason}`);
2843
- }
2844
- if (!response.ok) {
2845
- throw new WebhookDrainError("log-webhook-drain-failed", `log webhook drain: POST to ${webhookUrl} returned ${response.status} ${response.statusText}`);
3066
+ const keepLock = () => {
3067
+ if (renewDrainLock(lockPath, lockToken))
3068
+ return;
3069
+ throw new WebhookDrainError("log-webhook-drain-lock-lost", `log webhook drain: this drain's lock on ${lockPath} was taken over by another process — stopping here; that process delivers the rest`);
3070
+ };
3071
+ const shared = {
3072
+ rejectedPath: rejectedPathFor(path),
3073
+ webhookUrl,
3074
+ headers,
3075
+ fetchTimeoutMs,
3076
+ totals,
3077
+ keepLock
3078
+ };
3079
+ const draining = drainingPathFor(path);
3080
+ if (queueBucketSize(draining) !== null) {
3081
+ keepLock();
3082
+ await drainQueueFile({ ...shared, path: draining });
3083
+ unlinkSync2(draining);
2846
3084
  }
2847
- const liveNow = readFileSync4(path);
2848
- const tail = liveNow.subarray(Math.min(startOffset, liveNow.byteLength));
2849
- writeFileSync2(path, tail);
2850
- return { flushed: true, lineCount: postLines.length, bytes };
3085
+ await drainRenamedAside(shared, path, backupPathFor(path));
3086
+ await drainRenamedAside(shared, path, path);
3087
+ return { flushed: totals.chunks > 0 || totals.rejected > 0, ...totals };
2851
3088
  } finally {
2852
3089
  releaseDrainLock(lockPath, lockToken);
2853
3090
  }
@@ -3012,6 +3249,24 @@ function guardedAppendOpen(path) {
3012
3249
  return;
3013
3250
  }
3014
3251
  }
3252
+ function appendHardenedLine(path, line) {
3253
+ try {
3254
+ mkdirSync4(dirname6(path), { recursive: true, mode: 448 });
3255
+ const fd = guardedAppendOpen(path);
3256
+ if (fd === undefined)
3257
+ return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
3258
+ try {
3259
+ if (!fstatSync2(fd).isFile())
3260
+ return `target is not a regular file: ${path}`;
3261
+ writeSync3(fd, line);
3262
+ } finally {
3263
+ closeSync4(fd);
3264
+ }
3265
+ return null;
3266
+ } catch (err) {
3267
+ return err instanceof Error ? err.message : String(err);
3268
+ }
3269
+ }
3015
3270
  function reportRotationOverflow(backupPath, warn) {
3016
3271
  let raw;
3017
3272
  try {
@@ -3414,7 +3669,7 @@ var COMMANDS = [
3414
3669
  details: [
3415
3670
  "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.",
3416
3671
  "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.",
3417
- "`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."
3672
+ "`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."
3418
3673
  ],
3419
3674
  status: "shipped"
3420
3675
  },
@@ -3936,6 +4191,7 @@ var INFORMATIONAL_DISPATCH_BLOCKER_CLASSES = new Set([
3936
4191
  // src/lib/dispatch.ts
3937
4192
  var MAX_TEE_BYTES = 8 * 1024 * 1024;
3938
4193
  var CLAUDE_MODEL_ALIASES = new Set(["fable", "opus", "sonnet", "haiku"]);
4194
+ var NO_SUBSCRIPTION_LOGIN_REASON = "this agent has no subscription login in Vinaya yet, and no agent authenticates with an API key — " + "dispatch a vendor whose subscription login Vinaya can stage (claude, codex)";
3939
4195
 
3940
4196
  // src/commands/tokens.ts
3941
4197
  var USAGE = [
@@ -632,11 +632,27 @@ var ObservedSchema = z.object({
632
632
  var TaskStatusInputSchema = z.object({
633
633
  task: TaskToolRefSchema.optional()
634
634
  }).merge(PageRequestSchema).strict();
635
+ var TaskConfidenceSchema = z.object({
636
+ round: z.number().int().positive(),
637
+ percent: z.number().int().min(0).max(100).nullable(),
638
+ source: z.enum(["stated", "published-summary"])
639
+ }).strict();
640
+ var TaskPhaseHistorySchema = z.object({
641
+ typicalPhaseMinutes: z.number().nonnegative(),
642
+ typicalPhaseSamples: z.number().int().positive()
643
+ }).strict();
635
644
  var TaskStatusItemSchema = z.object({
636
645
  task: TaskToolRefSchema,
637
646
  issue: z.number().int().positive(),
638
647
  pr: z.number().int().positive().nullable(),
639
- state: z.string()
648
+ state: z.string(),
649
+ round: z.number().int().positive().nullable().optional(),
650
+ phase: z.string().min(1).nullable().optional(),
651
+ minutesInPhase: z.number().nonnegative().nullable().optional(),
652
+ phaseIsCurrent: z.boolean().nullable().optional(),
653
+ lastConfidence: TaskConfidenceSchema.nullable().optional(),
654
+ lastConfidenceUnread: z.boolean().optional(),
655
+ phaseHistory: TaskPhaseHistorySchema.nullable().optional()
640
656
  }).merge(ObservedSchema);
641
657
  var TaskStatusResultSchema = z.object({
642
658
  items: z.array(TaskStatusItemSchema),
@@ -648,7 +664,7 @@ var EscalationInputsSchema = z.object({
648
664
  round: z.number().int().nonnegative(),
649
665
  head: z.string(),
650
666
  branch: z.string(),
651
- prNumber: z.number().int().positive()
667
+ prNumber: z.number().int().positive().nullable()
652
668
  });
653
669
  var EscalationEvidenceSchema = z.object({
654
670
  round: z.number().int().nonnegative(),
@@ -684,13 +700,45 @@ var TaskEscalationReadResultSchema = z.object({
684
700
  items: z.array(TaskEscalationPacketSchema),
685
701
  nextCursor: z.string().nullable()
686
702
  }).merge(ObservedSchema);
687
- var TaskStartInputSchema = z.object({
688
- tranche: z.string().min(1),
689
- id: z.string().min(1)
703
+ var TaskPrCheckSchema = z.object({
704
+ name: z.string(),
705
+ required: z.boolean(),
706
+ status: z.string(),
707
+ conclusion: z.string().nullable(),
708
+ detailsUrl: z.string().nullable(),
709
+ failureSummary: z.string().nullable()
710
+ });
711
+ var TaskPrVerdictSchema = z.object({
712
+ role: z.enum(["code-review", "security"]),
713
+ value: z.string(),
714
+ judgedHead: z.string().nullable(),
715
+ objectivesVersion: z.string().nullable()
716
+ });
717
+ var TaskPrPauseSchema = z.object({
718
+ reason: z.string(),
719
+ body: z.string()
720
+ });
721
+ var TaskPrReviewRecordSchema = z.object({
722
+ verdicts: z.array(TaskPrVerdictSchema),
723
+ roundMarkers: z.array(z.number().int().nonnegative()),
724
+ summaryTable: z.string().nullable(),
725
+ pause: TaskPrPauseSchema.nullable()
726
+ });
727
+ var TaskPrReadInputSchema = z.object({
728
+ task: TaskToolRefSchema,
729
+ pr: z.number().int().positive().optional()
690
730
  }).strict();
731
+ var TaskPrReadResultSchema = z.object({
732
+ task: TaskToolRefSchema,
733
+ issue: z.number().int().positive(),
734
+ pr: z.number().int().positive(),
735
+ head: z.string().nullable(),
736
+ checks: z.array(TaskPrCheckSchema),
737
+ review: TaskPrReviewRecordSchema
738
+ }).merge(ObservedSchema);
691
739
  var TaskStartResultSchema = z.object({
692
740
  requestId: z.string().min(1),
693
- run: z.object({ tranche: z.string().min(1), id: z.string().min(1) }),
741
+ run: TaskToolRefSchema,
694
742
  started: z.boolean(),
695
743
  startedAt: z.string(),
696
744
  mode: z.literal("attended")
@@ -704,7 +752,7 @@ var TaskCancelInputSchema = z.object({
704
752
  }).strict();
705
753
  var TaskResumeResultSchema = z.object({
706
754
  task: z.number().int().positive(),
707
- pr: z.number().int().positive(),
755
+ pr: z.number().int().positive().nullable(),
708
756
  escalationId: z.string().min(1),
709
757
  outcome: z.enum(["started", "already_resumed"]),
710
758
  authenticatedBy: z.string().min(1),
@@ -713,7 +761,7 @@ var TaskResumeResultSchema = z.object({
713
761
  var TaskCancelOutcomeSchema = z.enum(["confirmed", "pending", "uncertain"]);
714
762
  var TaskCancelResultSchema = z.object({
715
763
  task: z.number().int().positive(),
716
- pr: z.number().int().positive(),
764
+ pr: z.number().int().positive().nullable(),
717
765
  escalationId: z.string().min(1),
718
766
  outcome: TaskCancelOutcomeSchema,
719
767
  authenticatedBy: z.string().min(1),
@@ -724,6 +772,7 @@ var TASK_TOOL_NAMES = [
724
772
  "task_start",
725
773
  "task_status",
726
774
  "task_escalation_read",
775
+ "task_pr_read",
727
776
  "task_resume",
728
777
  "task_cancel"
729
778
  ];
@@ -1903,7 +1952,28 @@ function trustAnchorRepoFromRemoteUrl(url) {
1903
1952
  return m?.[1] && m[2] ? wellFormedRepoSlug(`${m[1]}/${m[2]}`) : null;
1904
1953
  }
1905
1954
  var execFileAsync4 = promisify4(execFile4);
1955
+ function resolveCiTrustAnchorProbeRef(env = process.env) {
1956
+ const ref = env.VINAYA_CI_CONFIG_PROBE_REF?.trim();
1957
+ if (!ref)
1958
+ return null;
1959
+ if (env.GITHUB_ACTIONS !== "true")
1960
+ return null;
1961
+ if ((env.GH_TOKEN ?? "").length > 0 || (env.GITHUB_TOKEN ?? "").length > 0)
1962
+ return null;
1963
+ return ref;
1964
+ }
1965
+ function readTrustAnchorConfigAtRef(ref) {
1966
+ const raw = execFileSync2("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
1967
+ encoding: "utf-8",
1968
+ stdio: ["ignore", "pipe", "pipe"],
1969
+ timeout: 1e4
1970
+ });
1971
+ return Buffer.from(raw, "utf-8").toString("base64");
1972
+ }
1906
1973
  function ghFetchTrustAnchorConfig() {
1974
+ const probeRef = resolveCiTrustAnchorProbeRef();
1975
+ if (probeRef)
1976
+ return readTrustAnchorConfigAtRef(probeRef);
1907
1977
  const repo = trustAnchorRepo();
1908
1978
  if (!repo)
1909
1979
  throw new Error("could not resolve repo identity for the trust-anchor read");
@@ -1913,6 +1983,14 @@ function ghFetchTrustAnchorConfig() {
1913
1983
  });
1914
1984
  }
1915
1985
  async function ghFetchTrustAnchorConfigAsync() {
1986
+ const probeRef = resolveCiTrustAnchorProbeRef();
1987
+ if (probeRef) {
1988
+ const { stdout } = await execFileAsync4("git", ["show", `${probeRef}:${LOCAL_CONFIG_FILENAME}`], {
1989
+ encoding: "utf-8",
1990
+ timeout: 1e4
1991
+ });
1992
+ return Buffer.from(stdout, "utf-8").toString("base64");
1993
+ }
1916
1994
  const repo = await trustAnchorRepoAsync();
1917
1995
  if (!repo)
1918
1996
  throw new Error("could not resolve repo identity for the trust-anchor read");
@@ -2994,6 +3072,7 @@ function resolveThroughTable(ctx, file, name, table, stack) {
2994
3072
  };
2995
3073
  }
2996
3074
  var DEFAULT_CLI_ENTRYPOINT = "apps/cli/src/index.ts";
3075
+ var ROOT_CONFIG_FILENAME = "vinaya.config.json";
2997
3076
  function selectAffectedTestFiles(repoRoot, changedFiles, options = {}) {
2998
3077
  const packages = discoverWorkspacePackages(repoRoot);
2999
3078
  const absChanged = new Set(changedFiles.map((f) => isAbsolute4(f) ? f : join7(repoRoot, f)));
@@ -3164,6 +3243,9 @@ function selectAffectedTestFiles(repoRoot, changedFiles, options = {}) {
3164
3243
  const depthOneDefault = options.depth === "one" ? "ignore" : "select";
3165
3244
  const repoTreeScanners = options.repoTreeScanners ?? depthOneDefault;
3166
3245
  const cliSpawnDetection = options.cliSpawnDetection ?? depthOneDefault;
3246
+ const cliEntrypoint = join7(repoRoot, options.cliEntrypoint ?? DEFAULT_CLI_ENTRYPOINT);
3247
+ const rootConfigChanged = absChanged.has(join7(repoRoot, ROOT_CONFIG_FILENAME));
3248
+ const cliPackage = packages.find((pkg) => cliEntrypoint.startsWith(`${pkg.dir}/`)) ?? null;
3167
3249
  if (typescript && repoTreeScanners !== "ignore") {
3168
3250
  for (const file of allSourceFiles) {
3169
3251
  if (!isTestFile(file))
@@ -3176,7 +3258,6 @@ function selectAffectedTestFiles(repoRoot, changedFiles, options = {}) {
3176
3258
  }
3177
3259
  }
3178
3260
  if (typescript && cliSpawnDetection !== "ignore") {
3179
- const cliEntrypoint = join7(repoRoot, options.cliEntrypoint ?? DEFAULT_CLI_ENTRYPOINT);
3180
3261
  const cliEntrypointSourceRoot = dirname6(cliEntrypoint);
3181
3262
  for (const file of allSourceFiles) {
3182
3263
  if (!isTestFile(file))
@@ -3199,7 +3280,7 @@ function selectAffectedTestFiles(repoRoot, changedFiles, options = {}) {
3199
3280
  continue;
3200
3281
  const maxDepth = options.depth === "one" ? 1 : Number.POSITIVE_INFINITY;
3201
3282
  for (const test of testFiles) {
3202
- const forced = alwaysRunRegexes.some((re) => re.test(test.slice(repoRoot.length + 1))) || addedOrRenamed.has(test);
3283
+ const forced = alwaysRunRegexes.some((re) => re.test(test.slice(repoRoot.length + 1))) || addedOrRenamed.has(test) || rootConfigChanged && pkg === cliPackage;
3203
3284
  if (forced || anythingChanged && reaches(`${ALL_PREFIX}${test}`, edges, changeFacts, maxDepth)) {
3204
3285
  selected.push(test);
3205
3286
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@attalabs/vinaya",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
4
4
  "description": "Vinaya — Agentic Engineering Harness. Deterministic checks every AI coding agent must satisfy before merge.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",