@attalabs/vinaya 0.36.0 → 0.37.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.
- package/README.md +6 -6
- package/aeg-root/contracts/developer-reviewer.md +1 -1
- package/aeg-root/contracts/planner-operator.md +1 -1
- package/aeg-root/contracts/principal-operator.md +6 -6
- package/aeg-root/contracts/security-archivist.md +1 -1
- package/aeg-root/enforcement.md +9 -10
- package/aeg-root/process.md +3 -1
- package/aeg-root/roles/archivist.md +2 -2
- package/aeg-root/roles/developer/reference.md +13 -16
- package/aeg-root/roles/developer.md +7 -3
- package/aeg-root/roles/operator.md +18 -18
- package/aeg-root/roles/planner/reference.md +4 -4
- package/aeg-root/roles/principal.md +6 -1
- package/aeg-root/roles/reviewer.md +9 -3
- package/aeg-root/roles/security.md +19 -9
- package/aeg-root/roles/tranche-archivist.md +14 -2
- package/aeg-root/state-machine.md +11 -10
- package/aeg-root/templates/brief-template.md +6 -4
- package/aeg-root/templates/pr-report-template.md +1 -9
- package/aeg-root/tranche-model.md +4 -4
- package/dist/checks/bin/check-body-bare-digits.js +685 -584
- package/dist/checks/bin/check-branch-topology.js +626 -466
- package/dist/checks/bin/check-brief-shape.js +686 -585
- package/dist/checks/bin/check-changeset-coverage.js +1161 -731
- package/dist/checks/bin/check-closes-n.js +626 -466
- package/dist/checks/bin/check-coherence.js +744 -599
- package/dist/checks/bin/check-dead-branch-push.js +567 -451
- package/dist/checks/bin/check-dispatch-readiness.js +747 -602
- package/dist/checks/bin/check-doc-coverage-push.js +1160 -730
- package/dist/checks/bin/check-doc-coverage.js +1160 -730
- package/dist/checks/bin/check-doctrine-no-procedures.js +683 -582
- package/dist/checks/bin/check-doctrine-portability.js +1160 -730
- package/dist/checks/bin/check-evidence-fresh.js +1167 -906
- package/dist/checks/bin/check-exec-bits.js +1159 -729
- package/dist/checks/bin/check-first-push-dispatch.js +747 -602
- package/dist/checks/bin/check-issue-assignment.js +626 -466
- package/dist/checks/bin/check-issue-milestone-attach.js +567 -451
- package/dist/checks/bin/check-issue-objectives-numbering.js +683 -582
- package/dist/checks/bin/check-issue-parts-coverage.js +567 -451
- package/dist/checks/bin/check-issue-surface-globs.js +755 -601
- package/dist/checks/bin/check-issue-title-grammar.js +567 -451
- package/dist/checks/bin/check-issue-tranche-label.js +567 -451
- package/dist/checks/bin/check-main-branch-refusal.js +567 -451
- package/dist/checks/bin/check-no-disk-state.js +567 -451
- package/dist/checks/bin/check-pr-premise-reassert.js +683 -582
- package/dist/checks/bin/check-pr-report-density.js +567 -451
- package/dist/checks/bin/check-principal-test-plan-wait.js +567 -451
- package/dist/checks/bin/check-quoted-command.js +1644 -1216
- package/dist/checks/bin/check-reader-resolvable-prose.js +1663 -1223
- package/dist/checks/bin/check-registry-gates.js +610 -481
- package/dist/checks/bin/check-retired-vocabulary.js +1638 -1210
- package/dist/checks/bin/check-review-gate.js +694 -593
- package/dist/checks/bin/check-single-plan-pr.js +567 -451
- package/dist/checks/bin/check-surface-scope.js +626 -466
- package/dist/checks/bin/check-test-plan.js +567 -451
- package/dist/checks/bin/check-token-collection-wired.js +567 -451
- package/dist/checks/bin/check-workspace-escape.js +1160 -730
- package/dist/index.js +13507 -7975
- package/dist/lib/pre-push-cache-test-run.js +1004 -681
- package/dist/lib/pre-push-select-tests.js +609 -480
- package/package.json +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +38 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +19 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +233 -8
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +7 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +1 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +38 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +113 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +32 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +26 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +747 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +8 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +52 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +163 -21
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/app-path-routes-manifest.json +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/required-server-files.json +0 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/routes-manifest.json +0 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +5 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app-paths-manifest.json +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/044u_vinaya-studio_web_src_app_studio_backlog__components_BacklogTable_tsx_0oha0bt._.js +3 -0
- 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
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1bh2awk._.js → [root-of-the-server]__038scsm._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1widio3._.js → [root-of-the-server]__03__s45._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_15gdg48._.js → [root-of-the-server]__04adkz-._.js} +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__05zwn98._.js +14 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__10riywf._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13znegp._.js → [root-of-the-server]__134x-65._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1wy7w66._.js → [root-of-the-server]__14ui9sz._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13eeix2._.js → [root-of-the-server]__1_l_l1u._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1f4bb3_._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1dky4g0._.js → [root-of-the-server]__1my83lt._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1ng2x88._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__040smoa._.js → [root-of-the-server]__1qpc6at._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +56 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_06h3wbl._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0gs4gvl._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_121lrn5._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1o4v6lb._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1q7h5mz._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1ztd4i3._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_209-ugd._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_214d71c._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_17dho0f._.js +3 -0
- 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
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_next_dist_1lzmr5o._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_animate_components_index_ts_186fje1._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_index_ts_0xk1vda._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/09fcolor69bun.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0lcwmwzxacdie.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ojry7lrbzkfd.css +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{00z3-ljjd1gj9.js → 0vtfb0g813gki.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1giu47hrbhroj.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1shz6lwruld25.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1ytvuy1mmnc6j.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3oxhhhm_psozq.js → 21a6_5cr956wj.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2g8mwnydod96u.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3li0ueedy-ozv.js → 2nrnuawd5fwpv.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2nw47832_uvfe.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qdxnj8wk2h0s.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3b9q75p-z5ma5.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3cv-oe7153242.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3lqjwjrcvq481.js → 3l56x8wjdzvaw.js} +5 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3m310lbjj4p5u.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2o9l0b7eqbr57.js → 3qtt1v3ya-ofe.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/server.js +1 -1
- 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/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/bin/verify-coherence.ts +0 -1089
- package/studio-standalone/_node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +0 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/app-paths-manifest.json +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/build-manifest.json +0 -9
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/server-reference-manifest.json +0 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +0 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.map +0 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route_client-reference-manifest.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/044u_vinaya-studio_web__next-internal_server_app_api_coherence_route_actions_1rnzea1.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[externals]__0cki-x_._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +0 -15
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[turbopack]_runtime.js +0 -903
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ln09ua._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0oegopp._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__13yxbjd._.js +0 -51
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1duqmtm._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1z7dml9._.js +0 -9
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0bfs_u4._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0g8_eot._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0hrh_v-._.js +0 -181
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0i4-dea._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0o54suy._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0rxd7s0._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_151m4rz._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1a9dieq._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sxsf5q._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sy_yfr._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_219v2an._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_05ufo8i._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_form_input_tsx_0es8d8b._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_brutal_components_index_ts_0n_lcc4._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_0wvpm_z._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0c8uwz_-m8s99.js +0 -165
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ct0c-xj0baf6.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0t5n_r4xm__t-.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vc2u252q5q6o.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/16r_o07lw0vm0.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1cah7_e5a1zvu.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1gjo9-6dz7nup.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/24tz8aro1uto4.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ef2g5fozszw7.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ka8dg687auhj.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2pf3f50gbrkyv.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qq49pct3q51-.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3et66z7glk65w.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3y6u3prmrkea-.js +0 -1
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yR5RsCxb1OGnYggiaO09S}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yR5RsCxb1OGnYggiaO09S}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yR5RsCxb1OGnYggiaO09S}/_ssgManifest.js +0 -0
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
// src/checks/bin/check-changeset-coverage.ts
|
|
4
4
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
5
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
6
|
-
import { join as join10, relative as
|
|
5
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync8 } from "node:fs";
|
|
6
|
+
import { join as join10, relative as relative3 } from "node:path";
|
|
7
7
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
8
8
|
var GATE_AUDIENCE = {
|
|
9
9
|
"check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
|
|
@@ -1887,45 +1887,6 @@ var DERIVED_STATUSES = [
|
|
|
1887
1887
|
"incoherent"
|
|
1888
1888
|
];
|
|
1889
1889
|
var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
|
|
1890
|
-
// ../../packages/aeg-core/src/parse-ledger.ts
|
|
1891
|
-
function rowFromCells(cells) {
|
|
1892
|
-
if (cells.length < 7)
|
|
1893
|
-
return null;
|
|
1894
|
-
const phase = (cells[0] ?? "").trim();
|
|
1895
|
-
if (!phase)
|
|
1896
|
-
return null;
|
|
1897
|
-
return {
|
|
1898
|
-
phase,
|
|
1899
|
-
role: (cells[1] ?? "").trim(),
|
|
1900
|
-
agentModel: (cells[2] ?? "").trim(),
|
|
1901
|
-
tokensIn: parseIntCell(cells[3] ?? ""),
|
|
1902
|
-
tokensOut: parseIntCell(cells[4] ?? ""),
|
|
1903
|
-
cost: parseCostCell(cells[5] ?? ""),
|
|
1904
|
-
date: (cells[6] ?? "").trim()
|
|
1905
|
-
};
|
|
1906
|
-
}
|
|
1907
|
-
function parseIntCell(cell) {
|
|
1908
|
-
const trimmed = cell.replace(/`/g, "").trim();
|
|
1909
|
-
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1910
|
-
return null;
|
|
1911
|
-
const normalized = trimmed.replace(/[,_\s]/g, "");
|
|
1912
|
-
if (!/^-?\d+$/.test(normalized))
|
|
1913
|
-
return null;
|
|
1914
|
-
return Number(normalized);
|
|
1915
|
-
}
|
|
1916
|
-
function parseCostCell(cell) {
|
|
1917
|
-
const trimmed = cell.replace(/`/g, "").trim();
|
|
1918
|
-
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1919
|
-
return null;
|
|
1920
|
-
const normalized = trimmed.replace(/^\$/, "").replace(/[,_\s]/g, "");
|
|
1921
|
-
if (!/^-?\d+(\.\d+)?$/.test(normalized))
|
|
1922
|
-
return null;
|
|
1923
|
-
return Number(normalized);
|
|
1924
|
-
}
|
|
1925
|
-
function isEmDashOrDash(s) {
|
|
1926
|
-
const t = s.trim();
|
|
1927
|
-
return t === "—" || t === "-" || t === "–";
|
|
1928
|
-
}
|
|
1929
1890
|
// ../../packages/aeg-core/src/waiver-label.ts
|
|
1930
1891
|
var WAIVER_LABEL = label("waiver-docs");
|
|
1931
1892
|
var WAIVER_LABEL_REVIEW = label("waiver-review");
|
|
@@ -1941,61 +1902,6 @@ function isWaiverLabelActorVerified(opts) {
|
|
|
1941
1902
|
return false;
|
|
1942
1903
|
return isPrincipal(opts.labelActor, opts.principalAllowlist);
|
|
1943
1904
|
}
|
|
1944
|
-
|
|
1945
|
-
// ../../packages/aeg-core/src/parse-token-report.ts
|
|
1946
|
-
var TOKEN_REPORT_HEADING = /^\s*(?:#{1,6}\s*Token report\s*|\*\*Token report\*\*)\s*$/i;
|
|
1947
|
-
var INLINE_FIELD_LIST = /Phase:\s*([^|]+?)\s*\|\s*Role:\s*([^|]+?)\s*\|\s*Agent\/Model:\s*([^|]+?)\s*\|\s*Tokens in:\s*([^|]+?)\s*\|\s*Tokens out:\s*([^|]+?)\s*\|\s*Cost:\s*([^|]+?)\s*\|\s*Date:\s*(.+?)\s*$/im;
|
|
1948
|
-
function parseTokenReportEntries(body) {
|
|
1949
|
-
const lines = body.split(/\r?\n/);
|
|
1950
|
-
const headingIdxs = [];
|
|
1951
|
-
lines.forEach((line, i) => {
|
|
1952
|
-
if (TOKEN_REPORT_HEADING.test(line))
|
|
1953
|
-
headingIdxs.push(i);
|
|
1954
|
-
});
|
|
1955
|
-
const out = [];
|
|
1956
|
-
for (let h = 0;h < headingIdxs.length; h++) {
|
|
1957
|
-
const start = headingIdxs[h] + 1;
|
|
1958
|
-
const end = h + 1 < headingIdxs.length ? headingIdxs[h + 1] : lines.length;
|
|
1959
|
-
const section = lines.slice(start, end).join(`
|
|
1960
|
-
`);
|
|
1961
|
-
const tableRows = parseTableSection(section);
|
|
1962
|
-
if (tableRows.length > 0) {
|
|
1963
|
-
out.push(...tableRows);
|
|
1964
|
-
continue;
|
|
1965
|
-
}
|
|
1966
|
-
const inlineRow = parseInlineFieldList(section);
|
|
1967
|
-
if (inlineRow)
|
|
1968
|
-
out.push(inlineRow);
|
|
1969
|
-
}
|
|
1970
|
-
return out;
|
|
1971
|
-
}
|
|
1972
|
-
function parseTableSection(section) {
|
|
1973
|
-
const lines = section.split(/\r?\n/);
|
|
1974
|
-
let i = 0;
|
|
1975
|
-
for (;i < lines.length; i++) {
|
|
1976
|
-
if ((lines[i] ?? "").trim().startsWith("|"))
|
|
1977
|
-
break;
|
|
1978
|
-
}
|
|
1979
|
-
if (i + 1 >= lines.length)
|
|
1980
|
-
return [];
|
|
1981
|
-
i += 2;
|
|
1982
|
-
const out = [];
|
|
1983
|
-
for (;i < lines.length; i++) {
|
|
1984
|
-
const trimmed = (lines[i] ?? "").trim();
|
|
1985
|
-
if (!trimmed.startsWith("|"))
|
|
1986
|
-
break;
|
|
1987
|
-
const row = rowFromCells(splitTableRow(trimmed));
|
|
1988
|
-
if (row)
|
|
1989
|
-
out.push(row);
|
|
1990
|
-
}
|
|
1991
|
-
return out;
|
|
1992
|
-
}
|
|
1993
|
-
function parseInlineFieldList(section) {
|
|
1994
|
-
const m = section.match(INLINE_FIELD_LIST);
|
|
1995
|
-
if (!m)
|
|
1996
|
-
return null;
|
|
1997
|
-
return rowFromCells([m[1], m[2], m[3], m[4], m[5], m[6], m[7]]);
|
|
1998
|
-
}
|
|
1999
1905
|
// ../../packages/aeg-core/src/verdict-extraction.ts
|
|
2000
1906
|
var HEAD_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged head:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
2001
1907
|
var OBJECTIVES_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Objectives version:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
@@ -2444,10 +2350,12 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive,
|
|
|
2444
2350
|
var CODE_REVIEW_SEVERITY_ORDER = ["BLOCKER", "MAJOR", "MINOR"];
|
|
2445
2351
|
var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
|
|
2446
2352
|
var DEFAULT_MAX_ROUNDS = 3;
|
|
2353
|
+
var DEFAULT_MAX_TASK_MINUTES = 180;
|
|
2447
2354
|
var DEFAULT_REVIEW_POLICY = {
|
|
2448
2355
|
codeReviewThreshold: "BLOCKER",
|
|
2449
2356
|
securityThreshold: "HIGH",
|
|
2450
|
-
maxRounds: DEFAULT_MAX_ROUNDS
|
|
2357
|
+
maxRounds: DEFAULT_MAX_ROUNDS,
|
|
2358
|
+
maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES
|
|
2451
2359
|
};
|
|
2452
2360
|
var FILE_SHAPED_LOCATION = /\.[a-zA-Z0-9]{1,10}(:\d+)?\s*$/;
|
|
2453
2361
|
var PROSE_LOCATION_PATTERNS = [/\bpr\s*body\b/i, /\bcomment\b/i];
|
|
@@ -2848,11 +2756,13 @@ function checkDocUpdateList(prBody) {
|
|
|
2848
2756
|
return headingCheck(prBody, "(?:documentation|doc)[- ]update(?:\\s+list)?", "Documentation-update list");
|
|
2849
2757
|
}
|
|
2850
2758
|
function checkWorktreeStep0(prBody) {
|
|
2851
|
-
if (/git worktree add/.test(prBody))
|
|
2759
|
+
if (/git worktree add/.test(prBody) || /cd \.worktrees\//.test(prBody) || /bun install --frozen-lockfile/.test(prBody))
|
|
2852
2760
|
return { status: "pass", errors: [] };
|
|
2853
2761
|
return {
|
|
2854
2762
|
status: "fail",
|
|
2855
|
-
errors: [
|
|
2763
|
+
errors: [
|
|
2764
|
+
"brief-validation worktree Step 0: no `git worktree add`, `cd .worktrees/`, or `bun install --frozen-lockfile` command found in the PR body."
|
|
2765
|
+
]
|
|
2856
2766
|
};
|
|
2857
2767
|
}
|
|
2858
2768
|
function checkStopConditions(prBody) {
|
|
@@ -3042,7 +2952,8 @@ function isCommandBlock(content) {
|
|
|
3042
2952
|
return COMMAND_WORDS.includes(commandWordOf(firstNonBlankLine(content)));
|
|
3043
2953
|
}
|
|
3044
2954
|
function isStep0Block(content) {
|
|
3045
|
-
|
|
2955
|
+
const first = firstNonBlankLine(content);
|
|
2956
|
+
return first.startsWith("git worktree add") || first.startsWith("cd .worktrees/") || first.startsWith("bun install --frozen-lockfile");
|
|
3046
2957
|
}
|
|
3047
2958
|
function checkCommandsCarryOutput(prBody) {
|
|
3048
2959
|
const errors = [];
|
|
@@ -3511,10 +3422,14 @@ function legacySlugPattern(legacySlugs) {
|
|
|
3511
3422
|
const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
3512
3423
|
return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
|
|
3513
3424
|
}
|
|
3425
|
+
function specGrandfatherPaths(specGrandfather) {
|
|
3426
|
+
return Array.isArray(specGrandfather) ? [...specGrandfather] : Object.keys(specGrandfather);
|
|
3427
|
+
}
|
|
3514
3428
|
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
3515
3429
|
const findings = [];
|
|
3516
3430
|
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
3517
|
-
const
|
|
3431
|
+
const grandfatheredWhole = new Set(Array.isArray(specGrandfather) ? specGrandfather : []);
|
|
3432
|
+
const limits = new Map(Array.isArray(specGrandfather) ? [] : Object.entries(specGrandfather));
|
|
3518
3433
|
const patterns = [
|
|
3519
3434
|
{ pattern: FORGE_NUMBER_PATTERN, what: "a forge number" },
|
|
3520
3435
|
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
|
|
@@ -3533,18 +3448,19 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
3533
3448
|
continue;
|
|
3534
3449
|
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
3535
3450
|
continue;
|
|
3536
|
-
if (cls === "spec" &&
|
|
3451
|
+
if (cls === "spec" && grandfatheredWhole.has(file.path))
|
|
3537
3452
|
continue;
|
|
3538
3453
|
const blocking = cls === "product" || cls === "spec";
|
|
3539
3454
|
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
3540
3455
|
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
3456
|
+
const fileFindings = [];
|
|
3541
3457
|
for (const { pattern, what, group } of patternsToRun) {
|
|
3542
3458
|
pattern.lastIndex = 0;
|
|
3543
3459
|
let match = pattern.exec(scrubbed);
|
|
3544
3460
|
while (match !== null) {
|
|
3545
3461
|
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
3546
3462
|
const citedIndex = match.index + match[0].indexOf(cited);
|
|
3547
|
-
|
|
3463
|
+
fileFindings.push({
|
|
3548
3464
|
file: file.path,
|
|
3549
3465
|
line: lineAt(scrubbed, citedIndex),
|
|
3550
3466
|
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
@@ -3553,6 +3469,15 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
3553
3469
|
match = pattern.exec(scrubbed);
|
|
3554
3470
|
}
|
|
3555
3471
|
}
|
|
3472
|
+
const limit = cls === "spec" ? limits.get(file.path) : undefined;
|
|
3473
|
+
if (limit !== undefined) {
|
|
3474
|
+
if (fileFindings.length <= limit)
|
|
3475
|
+
continue;
|
|
3476
|
+
for (const f of fileFindings) {
|
|
3477
|
+
f.message += `; ${file.path} carries ${fileFindings.length} such findings, over its proseGates.specGrandfather limit of ${limit}`;
|
|
3478
|
+
}
|
|
3479
|
+
}
|
|
3480
|
+
findings.push(...fileFindings);
|
|
3556
3481
|
}
|
|
3557
3482
|
return findings;
|
|
3558
3483
|
}
|
|
@@ -4512,8 +4437,7 @@ function briefHash(brief) {
|
|
|
4512
4437
|
function policyDigest(policy) {
|
|
4513
4438
|
return createHash4("sha256").update(JSON.stringify({
|
|
4514
4439
|
codeReviewThreshold: policy.codeReviewThreshold,
|
|
4515
|
-
securityThreshold: policy.securityThreshold
|
|
4516
|
-
maxRounds: policy.maxRounds
|
|
4440
|
+
securityThreshold: policy.securityThreshold
|
|
4517
4441
|
})).digest("hex");
|
|
4518
4442
|
}
|
|
4519
4443
|
function isBoundToHead(echoed, headSha) {
|
|
@@ -4826,7 +4750,46 @@ function parseEnforcementRegistry(content) {
|
|
|
4826
4750
|
return result;
|
|
4827
4751
|
}
|
|
4828
4752
|
// ../../packages/aeg-core/src/registry-checks.ts
|
|
4829
|
-
|
|
4753
|
+
var HOOK_DIR_PREFIXES = [".claude/hooks/", ".vinaya/hooks/", ".husky/", ".git/hooks/"];
|
|
4754
|
+
var BARE_HOOK_NAME = /^check-[A-Za-z0-9_.-]*\.sh$/;
|
|
4755
|
+
function basename(path) {
|
|
4756
|
+
return path.slice(path.lastIndexOf("/") + 1);
|
|
4757
|
+
}
|
|
4758
|
+
function lineOf(content, index) {
|
|
4759
|
+
let line = 1;
|
|
4760
|
+
for (let i = 0;i < index; i++)
|
|
4761
|
+
if (content.charCodeAt(i) === 10)
|
|
4762
|
+
line++;
|
|
4763
|
+
return line;
|
|
4764
|
+
}
|
|
4765
|
+
function findUnshippedHookRefs(docs, shipped) {
|
|
4766
|
+
const shippedNames = new Set([...shipped].map(basename));
|
|
4767
|
+
const findings = [];
|
|
4768
|
+
const flag = (doc, token, index) => {
|
|
4769
|
+
findings.push({
|
|
4770
|
+
path: doc.path,
|
|
4771
|
+
reason: `${doc.path}:${lineOf(doc.content, index)} names hook "${token}", which is neither tracked in git nor emitted by \`vinaya init\``
|
|
4772
|
+
});
|
|
4773
|
+
};
|
|
4774
|
+
for (const doc of docs) {
|
|
4775
|
+
for (const { cited, index } of extractCitedPaths(doc.content)) {
|
|
4776
|
+
if (cited.endsWith("/") || !HOOK_DIR_PREFIXES.some((p) => cited.startsWith(p)))
|
|
4777
|
+
continue;
|
|
4778
|
+
if (!shipped.has(cited))
|
|
4779
|
+
flag(doc, cited, index);
|
|
4780
|
+
}
|
|
4781
|
+
const spanPattern = /`([^`\n]+)`/g;
|
|
4782
|
+
let match = spanPattern.exec(doc.content);
|
|
4783
|
+
while (match !== null) {
|
|
4784
|
+
const token = match[1] ?? "";
|
|
4785
|
+
if (BARE_HOOK_NAME.test(token) && !shippedNames.has(token))
|
|
4786
|
+
flag(doc, token, match.index);
|
|
4787
|
+
match = spanPattern.exec(doc.content);
|
|
4788
|
+
}
|
|
4789
|
+
}
|
|
4790
|
+
return findings;
|
|
4791
|
+
}
|
|
4792
|
+
function checkG1(rows, existsFn, hookRefs) {
|
|
4830
4793
|
const findings = [];
|
|
4831
4794
|
for (const row of rows) {
|
|
4832
4795
|
if (row.implementation === "")
|
|
@@ -4839,6 +4802,8 @@ function checkG1(rows, existsFn) {
|
|
|
4839
4802
|
});
|
|
4840
4803
|
}
|
|
4841
4804
|
}
|
|
4805
|
+
if (hookRefs)
|
|
4806
|
+
findings.push(...findUnshippedHookRefs(hookRefs.docs, hookRefs.shipped));
|
|
4842
4807
|
return { check: "G1", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4843
4808
|
}
|
|
4844
4809
|
var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
|
|
@@ -5392,7 +5357,6 @@ var TaskPrPauseSchema = z.object({
|
|
|
5392
5357
|
var TaskPrReviewRecordSchema = z.object({
|
|
5393
5358
|
verdicts: z.array(TaskPrVerdictSchema),
|
|
5394
5359
|
roundMarkers: z.array(z.number().int().nonnegative()),
|
|
5395
|
-
summaryTable: z.string().nullable(),
|
|
5396
5360
|
pause: TaskPrPauseSchema.nullable()
|
|
5397
5361
|
});
|
|
5398
5362
|
var TaskPrReadInputSchema = z.object({
|
|
@@ -5439,16 +5403,6 @@ var TaskCancelResultSchema = z.object({
|
|
|
5439
5403
|
authenticatedFrom: z.string().min(1),
|
|
5440
5404
|
fencedEffectKeys: z.array(z.string())
|
|
5441
5405
|
});
|
|
5442
|
-
var TASK_TOOL_NAMES = [
|
|
5443
|
-
"task_start",
|
|
5444
|
-
"task_status",
|
|
5445
|
-
"task_escalation_read",
|
|
5446
|
-
"task_pr_read",
|
|
5447
|
-
"task_resume",
|
|
5448
|
-
"task_cancel"
|
|
5449
|
-
];
|
|
5450
|
-
var OPERATOR_STATUS_FOLLOW = "task_status_follow";
|
|
5451
|
-
var OPERATOR_TOOL_GRANT = [...TASK_TOOL_NAMES, OPERATOR_STATUS_FOLLOW];
|
|
5452
5406
|
// ../../packages/aeg-core/src/first-push-dispatch-gate.ts
|
|
5453
5407
|
function parseTaskBranch(branch) {
|
|
5454
5408
|
const m = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
|
|
@@ -5679,15 +5633,69 @@ var NO_GATE_CUTOVERS = {
|
|
|
5679
5633
|
briefRulesSincePr: null,
|
|
5680
5634
|
agentBoxesRefusedSincePr: null
|
|
5681
5635
|
};
|
|
5682
|
-
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
5683
|
-
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
5684
|
-
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
5685
|
-
var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
|
|
5686
|
-
// ../../packages/aeg-core/src/log/envelope.ts
|
|
5687
|
-
import { createHash as createHash5 } from "node:crypto";
|
|
5688
|
-
|
|
5689
5636
|
// ../../packages/aeg-core/src/log/schema.ts
|
|
5637
|
+
import { z as z3 } from "zod";
|
|
5638
|
+
|
|
5639
|
+
// ../../packages/aeg-core/src/log/custom.ts
|
|
5690
5640
|
import { z as z2 } from "zod";
|
|
5641
|
+
var CUSTOM_EVENT_NAME_PATTERN = /^[a-z][a-z0-9_]*\.[a-z][a-z0-9_.]*$/;
|
|
5642
|
+
var CUSTOM_EVENT_NAME_MAX_LENGTH = 64;
|
|
5643
|
+
var CUSTOM_EVENT_RESERVED_NAMESPACE = "vinaya";
|
|
5644
|
+
var CUSTOM_EVENT_MAX_FIELDS = 20;
|
|
5645
|
+
var CUSTOM_FIELD_NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
5646
|
+
var CUSTOM_FIELD_NAME_MAX_LENGTH = 64;
|
|
5647
|
+
var CUSTOM_TEXT_MAX_LENGTH = 500;
|
|
5648
|
+
var CUSTOM_WORD_PATTERN = /^[a-z0-9][a-z0-9_-]*$/;
|
|
5649
|
+
var CUSTOM_WORD_MAX_LENGTH = 64;
|
|
5650
|
+
var CUSTOM_FIELD_MAX_WORDS = 50;
|
|
5651
|
+
var CustomFieldTypeSchema = z2.union([z2.enum(["text", "number", "boolean"]), z2.array(z2.string())]);
|
|
5652
|
+
var CustomEventDeclarationsSchema = z2.record(z2.string(), z2.object({
|
|
5653
|
+
fields: z2.record(z2.string(), CustomFieldTypeSchema)
|
|
5654
|
+
}).strict()).superRefine((events, ctx) => {
|
|
5655
|
+
for (const [name, declaration] of Object.entries(events)) {
|
|
5656
|
+
const refuse = (message, path = []) => {
|
|
5657
|
+
ctx.addIssue({
|
|
5658
|
+
code: z2.ZodIssueCode.custom,
|
|
5659
|
+
path: [name, ...path],
|
|
5660
|
+
message: `logs.events "${name}": ${message}`
|
|
5661
|
+
});
|
|
5662
|
+
};
|
|
5663
|
+
if (name.length > CUSTOM_EVENT_NAME_MAX_LENGTH) {
|
|
5664
|
+
refuse(`the name must be at most ${CUSTOM_EVENT_NAME_MAX_LENGTH} characters`);
|
|
5665
|
+
}
|
|
5666
|
+
if (!CUSTOM_EVENT_NAME_PATTERN.test(name)) {
|
|
5667
|
+
refuse("the name must be `<namespace>.<event>` — lowercase letters, digits and `_`, a dot between them");
|
|
5668
|
+
} else if (name.split(".")[0] === CUSTOM_EVENT_RESERVED_NAMESPACE) {
|
|
5669
|
+
refuse(`the \`${CUSTOM_EVENT_RESERVED_NAMESPACE}.\` namespace is reserved for Vinaya's own events`);
|
|
5670
|
+
}
|
|
5671
|
+
const fieldEntries = Object.entries(declaration.fields);
|
|
5672
|
+
if (fieldEntries.length > CUSTOM_EVENT_MAX_FIELDS) {
|
|
5673
|
+
refuse(`at most ${CUSTOM_EVENT_MAX_FIELDS} fields may be declared (found ${fieldEntries.length})`, ["fields"]);
|
|
5674
|
+
}
|
|
5675
|
+
for (const [field, type] of fieldEntries) {
|
|
5676
|
+
if (field.length > CUSTOM_FIELD_NAME_MAX_LENGTH || !CUSTOM_FIELD_NAME_PATTERN.test(field)) {
|
|
5677
|
+
refuse(`field "${field}": a field name is lowercase letters, digits and \`_\`, starting with a letter, at most ${CUSTOM_FIELD_NAME_MAX_LENGTH} characters`, ["fields", field]);
|
|
5678
|
+
}
|
|
5679
|
+
if (typeof type === "string")
|
|
5680
|
+
continue;
|
|
5681
|
+
if (type.length === 0) {
|
|
5682
|
+
refuse(`field "${field}": a list of words must name at least one word`, ["fields", field]);
|
|
5683
|
+
}
|
|
5684
|
+
if (type.length > CUSTOM_FIELD_MAX_WORDS) {
|
|
5685
|
+
refuse(`field "${field}": a list of words may name at most ${CUSTOM_FIELD_MAX_WORDS}`, ["fields", field]);
|
|
5686
|
+
}
|
|
5687
|
+
const bad = type.filter((w) => w.length > CUSTOM_WORD_MAX_LENGTH || !CUSTOM_WORD_PATTERN.test(w));
|
|
5688
|
+
if (bad.length > 0) {
|
|
5689
|
+
refuse(`field "${field}": a listed word is lowercase letters, digits, \`_\` and \`-\`, at most ${CUSTOM_WORD_MAX_LENGTH} characters`, ["fields", field]);
|
|
5690
|
+
}
|
|
5691
|
+
if (new Set(type).size !== type.length) {
|
|
5692
|
+
refuse(`field "${field}": a list of words names a word twice`, ["fields", field]);
|
|
5693
|
+
}
|
|
5694
|
+
}
|
|
5695
|
+
}
|
|
5696
|
+
});
|
|
5697
|
+
|
|
5698
|
+
// ../../packages/aeg-core/src/log/schema.ts
|
|
5691
5699
|
var CONFIDENCE_REASON_MAX_LENGTH = 280;
|
|
5692
5700
|
var ROLE_VALUES = [
|
|
5693
5701
|
"planner",
|
|
@@ -5698,178 +5706,210 @@ var ROLE_VALUES = [
|
|
|
5698
5706
|
"archivist",
|
|
5699
5707
|
"architect"
|
|
5700
5708
|
];
|
|
5701
|
-
var RoleSchema =
|
|
5709
|
+
var RoleSchema = z3.enum(ROLE_VALUES);
|
|
5702
5710
|
var HOST_VALUES = ["hook", "ci", "cli", "loop"];
|
|
5703
|
-
var HostSchema =
|
|
5711
|
+
var HostSchema = z3.enum(HOST_VALUES);
|
|
5704
5712
|
var RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
|
|
5705
5713
|
var headerMetaCore = {
|
|
5706
|
-
ts:
|
|
5707
|
-
run_id:
|
|
5708
|
-
seq:
|
|
5709
|
-
repo:
|
|
5710
|
-
vinaya:
|
|
5711
|
-
doctrine:
|
|
5714
|
+
ts: z3.string(),
|
|
5715
|
+
run_id: z3.string().regex(RUN_ID_PATTERN),
|
|
5716
|
+
seq: z3.number().int().nonnegative(),
|
|
5717
|
+
repo: z3.string().nullable(),
|
|
5718
|
+
vinaya: z3.string(),
|
|
5719
|
+
doctrine: z3.string(),
|
|
5712
5720
|
host: HostSchema,
|
|
5713
|
-
machine:
|
|
5721
|
+
machine: z3.string()
|
|
5714
5722
|
};
|
|
5715
|
-
var HeaderMetaV1Schema =
|
|
5716
|
-
schema:
|
|
5723
|
+
var HeaderMetaV1Schema = z3.object({
|
|
5724
|
+
schema: z3.literal(1),
|
|
5717
5725
|
...headerMetaCore
|
|
5718
5726
|
}).strict();
|
|
5719
|
-
var LineageSchema =
|
|
5720
|
-
run:
|
|
5721
|
-
attempt:
|
|
5722
|
-
parent:
|
|
5727
|
+
var LineageSchema = z3.object({
|
|
5728
|
+
run: z3.string().nullable(),
|
|
5729
|
+
attempt: z3.number().int().nullable(),
|
|
5730
|
+
parent: z3.string().nullable()
|
|
5723
5731
|
}).strict();
|
|
5724
|
-
var InputVersionsSchema =
|
|
5725
|
-
objectives_version:
|
|
5726
|
-
brief_hash:
|
|
5727
|
-
ruling_ordinal:
|
|
5728
|
-
policy_digest:
|
|
5732
|
+
var InputVersionsSchema = z3.object({
|
|
5733
|
+
objectives_version: z3.string().nullable(),
|
|
5734
|
+
brief_hash: z3.string().nullable(),
|
|
5735
|
+
ruling_ordinal: z3.number().int().nullable(),
|
|
5736
|
+
policy_digest: z3.string().nullable()
|
|
5729
5737
|
}).strict();
|
|
5730
|
-
var ProvenanceSchema =
|
|
5731
|
-
var HeaderMetaV2Schema =
|
|
5732
|
-
schema:
|
|
5738
|
+
var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
|
|
5739
|
+
var HeaderMetaV2Schema = z3.object({
|
|
5740
|
+
schema: z3.literal(2),
|
|
5733
5741
|
...headerMetaCore,
|
|
5734
|
-
event_id:
|
|
5735
|
-
process_id:
|
|
5736
|
-
actor_id:
|
|
5742
|
+
event_id: z3.string().min(1),
|
|
5743
|
+
process_id: z3.string().min(1),
|
|
5744
|
+
actor_id: z3.string().nullable(),
|
|
5737
5745
|
lineage: LineageSchema,
|
|
5738
5746
|
input_versions: InputVersionsSchema,
|
|
5739
5747
|
provenance: ProvenanceSchema
|
|
5740
5748
|
}).strict();
|
|
5741
|
-
var
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
+
var WorkSchema = z3.object({
|
|
5750
|
+
ref: z3.string().nullable(),
|
|
5751
|
+
repo: z3.string().nullable(),
|
|
5752
|
+
change: z3.string().nullable(),
|
|
5753
|
+
revision: z3.string().nullable()
|
|
5754
|
+
}).strict();
|
|
5755
|
+
var FlowSchema = z3.object({
|
|
5756
|
+
id: z3.string().nullable(),
|
|
5757
|
+
version: z3.string().nullable()
|
|
5749
5758
|
}).strict();
|
|
5750
|
-
var
|
|
5759
|
+
var HeaderMetaV3Schema = z3.object({
|
|
5760
|
+
schema: z3.literal(3),
|
|
5761
|
+
...headerMetaCore,
|
|
5762
|
+
event_id: z3.string().min(1),
|
|
5763
|
+
process_id: z3.string().min(1),
|
|
5764
|
+
actor_id: z3.string().nullable(),
|
|
5765
|
+
lineage: LineageSchema,
|
|
5766
|
+
input_versions: InputVersionsSchema,
|
|
5767
|
+
provenance: ProvenanceSchema,
|
|
5768
|
+
work: WorkSchema,
|
|
5769
|
+
flow: FlowSchema,
|
|
5770
|
+
runtime: z3.string().nullable(),
|
|
5771
|
+
source: z3.string().nullable()
|
|
5772
|
+
}).strict();
|
|
5773
|
+
var HeaderMetaSchema = z3.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema, HeaderMetaV3Schema]);
|
|
5774
|
+
var SubjectSchema = z3.object({
|
|
5775
|
+
issue: z3.number().int().nullable(),
|
|
5776
|
+
pr: z3.number().int().optional(),
|
|
5777
|
+
sha: z3.string().optional(),
|
|
5778
|
+
role: z3.union([RoleSchema, z3.literal("unattributed")]),
|
|
5779
|
+
round: z3.number().int().optional(),
|
|
5780
|
+
objectives_version: z3.string().optional()
|
|
5781
|
+
}).strict();
|
|
5782
|
+
var HeaderSchema = z3.object({
|
|
5751
5783
|
meta: HeaderMetaSchema,
|
|
5752
5784
|
subject: SubjectSchema
|
|
5753
5785
|
}).strict();
|
|
5754
5786
|
var envelopeTail = {
|
|
5755
|
-
duration_ms:
|
|
5756
|
-
payload:
|
|
5787
|
+
duration_ms: z3.number().nonnegative().optional(),
|
|
5788
|
+
payload: z3.object({}).strict()
|
|
5757
5789
|
};
|
|
5758
|
-
var ReviewFindingSchema =
|
|
5759
|
-
id:
|
|
5760
|
-
severity:
|
|
5761
|
-
state:
|
|
5762
|
-
severity_scale:
|
|
5763
|
-
policy_treatment:
|
|
5764
|
-
confidence:
|
|
5765
|
-
confidence_scale:
|
|
5766
|
-
confidence_source:
|
|
5790
|
+
var ReviewFindingSchema = z3.object({
|
|
5791
|
+
id: z3.string(),
|
|
5792
|
+
severity: z3.string(),
|
|
5793
|
+
state: z3.string().optional(),
|
|
5794
|
+
severity_scale: z3.string().optional(),
|
|
5795
|
+
policy_treatment: z3.enum(["blocking", "non_blocking", "unavailable"]).optional(),
|
|
5796
|
+
confidence: z3.number().min(0).max(1).optional(),
|
|
5797
|
+
confidence_scale: z3.string().optional(),
|
|
5798
|
+
confidence_source: z3.string().optional()
|
|
5767
5799
|
}).strict();
|
|
5768
|
-
var DispatchOutcomeSchema =
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
type:
|
|
5772
|
-
pr:
|
|
5773
|
-
head:
|
|
5774
|
-
comment_id:
|
|
5800
|
+
var DispatchOutcomeSchema = z3.discriminatedUnion("type", [
|
|
5801
|
+
z3.object({ type: z3.literal("pr_opened"), pr: z3.number().int(), head: z3.string() }).strict(),
|
|
5802
|
+
z3.object({
|
|
5803
|
+
type: z3.literal("round_pushed"),
|
|
5804
|
+
pr: z3.number().int(),
|
|
5805
|
+
head: z3.string(),
|
|
5806
|
+
comment_id: z3.number().int()
|
|
5775
5807
|
}).strict(),
|
|
5776
|
-
|
|
5777
|
-
type:
|
|
5778
|
-
verdict:
|
|
5779
|
-
head:
|
|
5780
|
-
comment_id:
|
|
5781
|
-
objectives:
|
|
5782
|
-
findings:
|
|
5808
|
+
z3.object({
|
|
5809
|
+
type: z3.literal("verdict"),
|
|
5810
|
+
verdict: z3.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
|
|
5811
|
+
head: z3.string(),
|
|
5812
|
+
comment_id: z3.number().int(),
|
|
5813
|
+
objectives: z3.array(z3.object({ id: z3.string(), met: z3.boolean() }).strict()),
|
|
5814
|
+
findings: z3.array(ReviewFindingSchema)
|
|
5783
5815
|
}).strict(),
|
|
5784
|
-
|
|
5785
|
-
type:
|
|
5786
|
-
class:
|
|
5787
|
-
comment_id:
|
|
5816
|
+
z3.object({
|
|
5817
|
+
type: z3.literal("escalation"),
|
|
5818
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
5819
|
+
comment_id: z3.number().int()
|
|
5788
5820
|
}).strict(),
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5821
|
+
z3.object({ type: z3.literal("brief"), comment_id: z3.number().int(), hash: z3.string() }).strict(),
|
|
5822
|
+
z3.object({ type: z3.literal("plan"), issues: z3.array(z3.number().int()) }).strict(),
|
|
5823
|
+
z3.object({ type: z3.literal("archive"), provenance_comment_id: z3.number().int() }).strict(),
|
|
5824
|
+
z3.object({ type: z3.literal("completed") }).strict()
|
|
5793
5825
|
]);
|
|
5794
5826
|
var dispatchShared = {
|
|
5795
5827
|
meta: HeaderMetaSchema,
|
|
5796
5828
|
subject: SubjectSchema,
|
|
5797
|
-
kind:
|
|
5829
|
+
kind: z3.literal("dispatch"),
|
|
5798
5830
|
...envelopeTail,
|
|
5799
5831
|
target_role: RoleSchema,
|
|
5800
|
-
model:
|
|
5801
|
-
round:
|
|
5802
|
-
effect_id:
|
|
5832
|
+
model: z3.string(),
|
|
5833
|
+
round: z3.number().int().optional(),
|
|
5834
|
+
effect_id: z3.string()
|
|
5803
5835
|
};
|
|
5804
|
-
var dispatchUsageField =
|
|
5805
|
-
var DispatchEventSchema =
|
|
5806
|
-
|
|
5807
|
-
|
|
5836
|
+
var dispatchUsageField = z3.object({ input: z3.number().nonnegative(), output: z3.number().nonnegative() }).strict().nullable();
|
|
5837
|
+
var DispatchEventSchema = z3.discriminatedUnion("event", [
|
|
5838
|
+
z3.object({ ...dispatchShared, event: z3.literal("dispatched"), prompt_hash: z3.string() }).strict(),
|
|
5839
|
+
z3.object({
|
|
5808
5840
|
...dispatchShared,
|
|
5809
|
-
event:
|
|
5841
|
+
event: z3.literal("outcome_received"),
|
|
5810
5842
|
outcome: DispatchOutcomeSchema,
|
|
5811
5843
|
usage: dispatchUsageField
|
|
5812
5844
|
}).strict(),
|
|
5813
|
-
|
|
5845
|
+
z3.object({
|
|
5814
5846
|
...dispatchShared,
|
|
5815
|
-
event:
|
|
5816
|
-
reason:
|
|
5847
|
+
event: z3.literal("dispatch_failed"),
|
|
5848
|
+
reason: z3.enum(["timeout", "crash", "refused", "unattributed_write"]),
|
|
5817
5849
|
usage: dispatchUsageField
|
|
5818
5850
|
}).strict()
|
|
5819
5851
|
]);
|
|
5852
|
+
var CODE_TOKEN_PATTERN = /^[A-Za-z0-9._-]{1,64}$/;
|
|
5853
|
+
var CodeTokenSchema = z3.string().regex(CODE_TOKEN_PATTERN);
|
|
5854
|
+
var ReviewerVerdictSchema = z3.object({
|
|
5855
|
+
role: RoleSchema,
|
|
5856
|
+
outcome: z3.enum(["approve", "changes_requested", "not_reviewed"]),
|
|
5857
|
+
blockers: z3.number().int().nonnegative()
|
|
5858
|
+
}).strict();
|
|
5820
5859
|
var loopShared = {
|
|
5821
5860
|
meta: HeaderMetaSchema,
|
|
5822
5861
|
subject: SubjectSchema,
|
|
5823
|
-
kind:
|
|
5862
|
+
kind: z3.literal("dev_review_loop"),
|
|
5824
5863
|
...envelopeTail,
|
|
5825
|
-
loop_id:
|
|
5864
|
+
loop_id: z3.string()
|
|
5826
5865
|
};
|
|
5827
|
-
var DevReviewLoopEventSchema =
|
|
5828
|
-
|
|
5866
|
+
var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
|
|
5867
|
+
z3.object({
|
|
5829
5868
|
...loopShared,
|
|
5830
|
-
event:
|
|
5831
|
-
task:
|
|
5832
|
-
policy:
|
|
5833
|
-
max_rounds:
|
|
5834
|
-
reviewers:
|
|
5835
|
-
models:
|
|
5869
|
+
event: z3.literal("loop_started"),
|
|
5870
|
+
task: z3.number().int(),
|
|
5871
|
+
policy: z3.object({
|
|
5872
|
+
max_rounds: z3.number().int().nonnegative(),
|
|
5873
|
+
reviewers: z3.array(RoleSchema),
|
|
5874
|
+
models: z3.record(RoleSchema, z3.string())
|
|
5836
5875
|
}).strict()
|
|
5837
5876
|
}).strict(),
|
|
5838
|
-
|
|
5839
|
-
|
|
5877
|
+
z3.object({ ...loopShared, event: z3.literal("round_started"), round: z3.number().int(), base_head: z3.string() }).strict(),
|
|
5878
|
+
z3.object({
|
|
5840
5879
|
...loopShared,
|
|
5841
|
-
event:
|
|
5842
|
-
round:
|
|
5843
|
-
head:
|
|
5844
|
-
green:
|
|
5845
|
-
confidence_value:
|
|
5846
|
-
confidence_reason:
|
|
5847
|
-
confidence_unavailable:
|
|
5848
|
-
extra_turn_spent:
|
|
5880
|
+
event: z3.literal("gate_result_read"),
|
|
5881
|
+
round: z3.number().int(),
|
|
5882
|
+
head: z3.string(),
|
|
5883
|
+
green: z3.boolean(),
|
|
5884
|
+
confidence_value: z3.number().int().min(0).max(100).optional(),
|
|
5885
|
+
confidence_reason: z3.string().max(CONFIDENCE_REASON_MAX_LENGTH).optional(),
|
|
5886
|
+
confidence_unavailable: z3.boolean().optional(),
|
|
5887
|
+
extra_turn_spent: z3.boolean().optional()
|
|
5849
5888
|
}).strict(),
|
|
5850
|
-
|
|
5889
|
+
z3.object({
|
|
5851
5890
|
...loopShared,
|
|
5852
|
-
event:
|
|
5853
|
-
round:
|
|
5854
|
-
head:
|
|
5855
|
-
all_approve:
|
|
5856
|
-
blockers:
|
|
5857
|
-
findings:
|
|
5891
|
+
event: z3.literal("verdicts_read"),
|
|
5892
|
+
round: z3.number().int(),
|
|
5893
|
+
head: z3.string(),
|
|
5894
|
+
all_approve: z3.boolean(),
|
|
5895
|
+
blockers: z3.number().int().nonnegative(),
|
|
5896
|
+
findings: z3.array(ReviewFindingSchema).optional(),
|
|
5897
|
+
reviewers: z3.array(ReviewerVerdictSchema).optional()
|
|
5858
5898
|
}).strict(),
|
|
5859
|
-
|
|
5899
|
+
z3.object({
|
|
5860
5900
|
...loopShared,
|
|
5861
|
-
event:
|
|
5862
|
-
round:
|
|
5863
|
-
open:
|
|
5864
|
-
resolved:
|
|
5865
|
-
new:
|
|
5866
|
-
recurring:
|
|
5901
|
+
event: z3.literal("findings_compared"),
|
|
5902
|
+
round: z3.number().int(),
|
|
5903
|
+
open: z3.array(z3.string()),
|
|
5904
|
+
resolved: z3.array(z3.string()),
|
|
5905
|
+
new: z3.array(z3.string()),
|
|
5906
|
+
recurring: z3.array(z3.string())
|
|
5867
5907
|
}).strict(),
|
|
5868
|
-
|
|
5908
|
+
z3.object({
|
|
5869
5909
|
...loopShared,
|
|
5870
|
-
event:
|
|
5871
|
-
round:
|
|
5872
|
-
condition:
|
|
5910
|
+
event: z3.literal("stop_condition_met"),
|
|
5911
|
+
round: z3.number().int(),
|
|
5912
|
+
condition: z3.enum([
|
|
5873
5913
|
"green",
|
|
5874
5914
|
"max_rounds",
|
|
5875
5915
|
"no_progress",
|
|
@@ -5878,66 +5918,85 @@ var DevReviewLoopEventSchema = z2.discriminatedUnion("event", [
|
|
|
5878
5918
|
"confidence",
|
|
5879
5919
|
"reappearance",
|
|
5880
5920
|
"repeat_finding",
|
|
5881
|
-
"repeat_failure"
|
|
5921
|
+
"repeat_failure",
|
|
5922
|
+
"time_budget"
|
|
5882
5923
|
])
|
|
5883
5924
|
}).strict(),
|
|
5884
|
-
|
|
5925
|
+
z3.object({
|
|
5926
|
+
...loopShared,
|
|
5927
|
+
event: z3.literal("paused"),
|
|
5928
|
+
round: z3.number().int(),
|
|
5929
|
+
reason: z3.enum(["escalation", "principal_item", "refreeze_needed"]),
|
|
5930
|
+
reason_code: CodeTokenSchema.optional()
|
|
5931
|
+
}).strict(),
|
|
5932
|
+
z3.object({
|
|
5885
5933
|
...loopShared,
|
|
5886
|
-
event:
|
|
5887
|
-
round:
|
|
5888
|
-
|
|
5934
|
+
event: z3.literal("resumed"),
|
|
5935
|
+
round: z3.number().int(),
|
|
5936
|
+
by: z3.enum(["principal", "driver"])
|
|
5889
5937
|
}).strict(),
|
|
5890
|
-
|
|
5938
|
+
z3.object({
|
|
5891
5939
|
...loopShared,
|
|
5892
|
-
event:
|
|
5893
|
-
round:
|
|
5894
|
-
by:
|
|
5940
|
+
event: z3.literal("cancelled"),
|
|
5941
|
+
round: z3.number().int(),
|
|
5942
|
+
by: z3.literal("principal")
|
|
5895
5943
|
}).strict(),
|
|
5896
|
-
|
|
5944
|
+
z3.object({
|
|
5897
5945
|
...loopShared,
|
|
5898
|
-
event:
|
|
5899
|
-
round:
|
|
5900
|
-
|
|
5946
|
+
event: z3.literal("unpushed_work_resume"),
|
|
5947
|
+
round: z3.number().int(),
|
|
5948
|
+
branch: z3.string(),
|
|
5949
|
+
detail: z3.string()
|
|
5901
5950
|
}).strict(),
|
|
5902
|
-
|
|
5951
|
+
z3.object({
|
|
5903
5952
|
...loopShared,
|
|
5904
|
-
event:
|
|
5905
|
-
round:
|
|
5906
|
-
|
|
5907
|
-
|
|
5953
|
+
event: z3.literal("round_ended"),
|
|
5954
|
+
round: z3.number().int(),
|
|
5955
|
+
base_head: z3.string(),
|
|
5956
|
+
head: z3.string(),
|
|
5957
|
+
files_changed: z3.number().int().nonnegative(),
|
|
5958
|
+
insertions: z3.number().int().nonnegative(),
|
|
5959
|
+
deletions: z3.number().int().nonnegative(),
|
|
5960
|
+
wall_ms: z3.number().nonnegative(),
|
|
5961
|
+
outcome: z3.enum(["green", "changes_requested", "escalated"])
|
|
5908
5962
|
}).strict(),
|
|
5909
|
-
|
|
5963
|
+
z3.object({
|
|
5910
5964
|
...loopShared,
|
|
5911
|
-
event:
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
wall_ms: z2.number().nonnegative(),
|
|
5919
|
-
outcome: z2.enum(["green", "changes_requested", "escalated"])
|
|
5965
|
+
event: z3.literal("journal_finalized"),
|
|
5966
|
+
rounds: z3.number().int().nonnegative(),
|
|
5967
|
+
total_wall_ms: z3.number().nonnegative(),
|
|
5968
|
+
time_to_green_ms: z3.number().nonnegative().nullable(),
|
|
5969
|
+
files_changed_total: z3.number().int().nonnegative(),
|
|
5970
|
+
final_head: z3.string(),
|
|
5971
|
+
result: z3.enum(["merged_ready", "stopped"])
|
|
5920
5972
|
}).strict(),
|
|
5921
|
-
|
|
5973
|
+
z3.object({
|
|
5922
5974
|
...loopShared,
|
|
5923
|
-
event:
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
final_head: z2.string(),
|
|
5929
|
-
result: z2.enum(["merged_ready", "stopped"])
|
|
5975
|
+
event: z3.literal("infrastructure_retry"),
|
|
5976
|
+
round: z3.number().int(),
|
|
5977
|
+
failure_kind: z3.enum(["pause_comment_post", "developer_connection"]),
|
|
5978
|
+
attempts: z3.number().int().positive(),
|
|
5979
|
+
outcome: z3.enum(["recovered", "exhausted"])
|
|
5930
5980
|
}).strict(),
|
|
5931
|
-
|
|
5981
|
+
z3.object({
|
|
5932
5982
|
...loopShared,
|
|
5933
|
-
event:
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5983
|
+
event: z3.literal("driver_heartbeat"),
|
|
5984
|
+
task: z3.number().int(),
|
|
5985
|
+
pr: z3.number().int().positive().optional(),
|
|
5986
|
+
round: z3.number().int(),
|
|
5987
|
+
phase: z3.string()
|
|
5988
|
+
}).strict(),
|
|
5989
|
+
z3.object({
|
|
5990
|
+
...loopShared,
|
|
5991
|
+
event: z3.literal("driver_exited"),
|
|
5992
|
+
task: z3.number().int(),
|
|
5993
|
+
reason: z3.enum(["finished", "paused", "reexec", "error", "signal"]),
|
|
5994
|
+
last_decision: z3.string(),
|
|
5995
|
+
exit_code: z3.number().int().optional(),
|
|
5996
|
+
error_class: CodeTokenSchema.optional()
|
|
5938
5997
|
}).strict()
|
|
5939
5998
|
]);
|
|
5940
|
-
var ForgeOpSchema =
|
|
5999
|
+
var ForgeOpSchema = z3.enum([
|
|
5941
6000
|
"pr.create",
|
|
5942
6001
|
"pr.comment",
|
|
5943
6002
|
"pr.body.replace",
|
|
@@ -5951,24 +6010,24 @@ var ForgeOpSchema = z2.enum([
|
|
|
5951
6010
|
"label.add",
|
|
5952
6011
|
"label.remove"
|
|
5953
6012
|
]);
|
|
5954
|
-
var ForgeWriteTargetSchema =
|
|
5955
|
-
issue:
|
|
5956
|
-
pr:
|
|
6013
|
+
var ForgeWriteTargetSchema = z3.object({
|
|
6014
|
+
issue: z3.number().int().optional(),
|
|
6015
|
+
pr: z3.number().int().optional()
|
|
5957
6016
|
}).strict();
|
|
5958
6017
|
var forgeWriteShared = {
|
|
5959
6018
|
meta: HeaderMetaSchema,
|
|
5960
6019
|
subject: SubjectSchema,
|
|
5961
|
-
kind:
|
|
6020
|
+
kind: z3.literal("forge_write"),
|
|
5962
6021
|
...envelopeTail,
|
|
5963
6022
|
op: ForgeOpSchema,
|
|
5964
6023
|
target: ForgeWriteTargetSchema
|
|
5965
6024
|
};
|
|
5966
|
-
var ForgeWriteEventSchema =
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
6025
|
+
var ForgeWriteEventSchema = z3.discriminatedUnion("event", [
|
|
6026
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("validated") }).strict(),
|
|
6027
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("refused"), reason: z3.string() }).strict(),
|
|
6028
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("written"), comment_ids: z3.array(z3.string()) }).strict()
|
|
5970
6029
|
]);
|
|
5971
|
-
var GateOutcomeSchema =
|
|
6030
|
+
var GateOutcomeSchema = z3.enum([
|
|
5972
6031
|
"pass",
|
|
5973
6032
|
"fail",
|
|
5974
6033
|
"wait",
|
|
@@ -5981,61 +6040,74 @@ var GateOutcomeSchema = z2.enum([
|
|
|
5981
6040
|
var gateShared = {
|
|
5982
6041
|
meta: HeaderMetaSchema,
|
|
5983
6042
|
subject: SubjectSchema,
|
|
5984
|
-
kind:
|
|
6043
|
+
kind: z3.literal("gate"),
|
|
5985
6044
|
...envelopeTail,
|
|
5986
|
-
check:
|
|
5987
|
-
check_version:
|
|
5988
|
-
policy_version:
|
|
5989
|
-
input_fingerprint:
|
|
6045
|
+
check: z3.string(),
|
|
6046
|
+
check_version: z3.string().nullable(),
|
|
6047
|
+
policy_version: z3.string().nullable(),
|
|
6048
|
+
input_fingerprint: z3.string().nullable()
|
|
5990
6049
|
};
|
|
5991
|
-
var GateEventSchema =
|
|
5992
|
-
|
|
6050
|
+
var GateEventSchema = z3.discriminatedUnion("event", [
|
|
6051
|
+
z3.object({
|
|
5993
6052
|
...gateShared,
|
|
5994
|
-
event:
|
|
6053
|
+
event: z3.literal("checked"),
|
|
5995
6054
|
outcome: GateOutcomeSchema,
|
|
5996
|
-
reason:
|
|
6055
|
+
reason: z3.string().optional()
|
|
6056
|
+
}).strict(),
|
|
6057
|
+
z3.object({
|
|
6058
|
+
meta: HeaderMetaSchema,
|
|
6059
|
+
subject: SubjectSchema,
|
|
6060
|
+
kind: z3.literal("gate"),
|
|
6061
|
+
...envelopeTail,
|
|
6062
|
+
event: z3.literal("summary"),
|
|
6063
|
+
ran: z3.number().int().nonnegative(),
|
|
6064
|
+
passed: z3.number().int().nonnegative(),
|
|
6065
|
+
failed: z3.number().int().nonnegative(),
|
|
6066
|
+
skipped: z3.number().int().nonnegative(),
|
|
6067
|
+
failed_checks: z3.array(z3.string())
|
|
5997
6068
|
}).strict()
|
|
5998
6069
|
]);
|
|
5999
|
-
var OperationResultSchema =
|
|
6070
|
+
var OperationResultSchema = z3.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
|
|
6000
6071
|
var operationShared = {
|
|
6001
6072
|
meta: HeaderMetaSchema,
|
|
6002
6073
|
subject: SubjectSchema,
|
|
6003
|
-
kind:
|
|
6074
|
+
kind: z3.literal("operation"),
|
|
6004
6075
|
...envelopeTail,
|
|
6005
|
-
operation:
|
|
6006
|
-
target:
|
|
6076
|
+
operation: z3.string(),
|
|
6077
|
+
target: z3.string().nullable()
|
|
6007
6078
|
};
|
|
6008
|
-
var OperationEventSchema =
|
|
6009
|
-
|
|
6079
|
+
var OperationEventSchema = z3.discriminatedUnion("event", [
|
|
6080
|
+
z3.object({
|
|
6010
6081
|
...operationShared,
|
|
6011
|
-
event:
|
|
6082
|
+
event: z3.literal("completed"),
|
|
6012
6083
|
result: OperationResultSchema,
|
|
6013
|
-
error_class:
|
|
6084
|
+
error_class: z3.string().nullable(),
|
|
6085
|
+
field_names: z3.array(z3.string().max(CUSTOM_FIELD_NAME_MAX_LENGTH)).max(CUSTOM_EVENT_MAX_FIELDS).optional()
|
|
6014
6086
|
}).strict()
|
|
6015
6087
|
]);
|
|
6016
|
-
var UsageUnitsSchema =
|
|
6017
|
-
input:
|
|
6018
|
-
output:
|
|
6019
|
-
cache:
|
|
6088
|
+
var UsageUnitsSchema = z3.object({
|
|
6089
|
+
input: z3.number().nonnegative().nullable(),
|
|
6090
|
+
output: z3.number().nonnegative().nullable(),
|
|
6091
|
+
cache: z3.number().nonnegative().nullable()
|
|
6020
6092
|
}).strict();
|
|
6021
6093
|
var usageShared = {
|
|
6022
6094
|
meta: HeaderMetaSchema,
|
|
6023
6095
|
subject: SubjectSchema,
|
|
6024
|
-
kind:
|
|
6096
|
+
kind: z3.literal("usage"),
|
|
6025
6097
|
...envelopeTail,
|
|
6026
|
-
model:
|
|
6027
|
-
source:
|
|
6028
|
-
semantics:
|
|
6098
|
+
model: z3.string().nullable(),
|
|
6099
|
+
source: z3.string(),
|
|
6100
|
+
semantics: z3.enum(["cumulative", "delta"])
|
|
6029
6101
|
};
|
|
6030
|
-
var UsageEventSchema =
|
|
6031
|
-
|
|
6102
|
+
var UsageEventSchema = z3.discriminatedUnion("event", [
|
|
6103
|
+
z3.object({
|
|
6032
6104
|
...usageShared,
|
|
6033
|
-
event:
|
|
6105
|
+
event: z3.literal("observed"),
|
|
6034
6106
|
units: UsageUnitsSchema,
|
|
6035
|
-
unknown_reason:
|
|
6107
|
+
unknown_reason: z3.string().nullable()
|
|
6036
6108
|
}).strict()
|
|
6037
6109
|
]);
|
|
6038
|
-
var RoleAttemptOutcomeSchema =
|
|
6110
|
+
var RoleAttemptOutcomeSchema = z3.enum([
|
|
6039
6111
|
"completed",
|
|
6040
6112
|
"incomplete",
|
|
6041
6113
|
"infrastructure_failed",
|
|
@@ -6046,17 +6118,17 @@ var RoleAttemptOutcomeSchema = z2.enum([
|
|
|
6046
6118
|
var roleAttemptShared = {
|
|
6047
6119
|
meta: HeaderMetaSchema,
|
|
6048
6120
|
subject: SubjectSchema,
|
|
6049
|
-
kind:
|
|
6121
|
+
kind: z3.literal("role_attempt"),
|
|
6050
6122
|
...envelopeTail,
|
|
6051
|
-
actor:
|
|
6052
|
-
attempt:
|
|
6053
|
-
effect_id:
|
|
6054
|
-
model:
|
|
6123
|
+
actor: z3.string().nullable(),
|
|
6124
|
+
attempt: z3.number().int().nullable(),
|
|
6125
|
+
effect_id: z3.string(),
|
|
6126
|
+
model: z3.string().nullable()
|
|
6055
6127
|
};
|
|
6056
|
-
var RoleAttemptEventSchema =
|
|
6057
|
-
|
|
6128
|
+
var RoleAttemptEventSchema = z3.discriminatedUnion("event", [
|
|
6129
|
+
z3.object({
|
|
6058
6130
|
...roleAttemptShared,
|
|
6059
|
-
event:
|
|
6131
|
+
event: z3.literal("attempted"),
|
|
6060
6132
|
outcome: RoleAttemptOutcomeSchema,
|
|
6061
6133
|
usage: dispatchUsageField
|
|
6062
6134
|
}).strict()
|
|
@@ -6064,42 +6136,59 @@ var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
|
|
|
6064
6136
|
var handoffShared = {
|
|
6065
6137
|
meta: HeaderMetaSchema,
|
|
6066
6138
|
subject: SubjectSchema,
|
|
6067
|
-
kind:
|
|
6139
|
+
kind: z3.literal("handoff"),
|
|
6068
6140
|
...envelopeTail,
|
|
6069
|
-
class:
|
|
6070
|
-
reason:
|
|
6141
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
6142
|
+
reason: z3.string()
|
|
6071
6143
|
};
|
|
6072
|
-
var HandoffEventSchema =
|
|
6073
|
-
|
|
6144
|
+
var HandoffEventSchema = z3.discriminatedUnion("event", [
|
|
6145
|
+
z3.object({
|
|
6074
6146
|
...handoffShared,
|
|
6075
|
-
event:
|
|
6076
|
-
requested_decision:
|
|
6147
|
+
event: z3.literal("raised"),
|
|
6148
|
+
requested_decision: z3.string().nullable()
|
|
6077
6149
|
}).strict(),
|
|
6078
|
-
|
|
6150
|
+
z3.object({
|
|
6079
6151
|
...handoffShared,
|
|
6080
|
-
event:
|
|
6081
|
-
resolution:
|
|
6082
|
-
resolved_by:
|
|
6152
|
+
event: z3.literal("resolved"),
|
|
6153
|
+
resolution: z3.string().nullable(),
|
|
6154
|
+
resolved_by: z3.string().nullable()
|
|
6083
6155
|
}).strict()
|
|
6084
6156
|
]);
|
|
6085
|
-
var EffectTargetSchema =
|
|
6086
|
-
kind:
|
|
6087
|
-
ref:
|
|
6157
|
+
var EffectTargetSchema = z3.object({
|
|
6158
|
+
kind: z3.string(),
|
|
6159
|
+
ref: z3.string()
|
|
6088
6160
|
}).strict();
|
|
6089
6161
|
var effectShared = {
|
|
6090
6162
|
meta: HeaderMetaSchema,
|
|
6091
6163
|
subject: SubjectSchema,
|
|
6092
|
-
kind:
|
|
6164
|
+
kind: z3.literal("effect"),
|
|
6093
6165
|
...envelopeTail,
|
|
6094
|
-
effect_id:
|
|
6166
|
+
effect_id: z3.string(),
|
|
6095
6167
|
target: EffectTargetSchema
|
|
6096
6168
|
};
|
|
6097
|
-
var EffectEventSchema =
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6169
|
+
var EffectEventSchema = z3.discriminatedUnion("event", [
|
|
6170
|
+
z3.object({ ...effectShared, event: z3.literal("attempted") }).strict(),
|
|
6171
|
+
z3.object({ ...effectShared, event: z3.literal("observed"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict(),
|
|
6172
|
+
z3.object({ ...effectShared, event: z3.literal("verified"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict()
|
|
6101
6173
|
]);
|
|
6102
|
-
var
|
|
6174
|
+
var CustomFieldValueSchema = z3.union([z3.string().max(CUSTOM_TEXT_MAX_LENGTH), z3.number().finite(), z3.boolean()]);
|
|
6175
|
+
var customShared = {
|
|
6176
|
+
meta: HeaderMetaV3Schema,
|
|
6177
|
+
subject: SubjectSchema,
|
|
6178
|
+
kind: z3.literal("custom"),
|
|
6179
|
+
...envelopeTail
|
|
6180
|
+
};
|
|
6181
|
+
var CustomEventSchema = z3.discriminatedUnion("event", [
|
|
6182
|
+
z3.object({
|
|
6183
|
+
...customShared,
|
|
6184
|
+
event: z3.literal("recorded"),
|
|
6185
|
+
name: z3.string().max(CUSTOM_EVENT_NAME_MAX_LENGTH).regex(CUSTOM_EVENT_NAME_PATTERN),
|
|
6186
|
+
fields: z3.record(z3.string().max(CUSTOM_FIELD_NAME_MAX_LENGTH).regex(CUSTOM_FIELD_NAME_PATTERN), CustomFieldValueSchema).refine((f) => Object.keys(f).length <= CUSTOM_EVENT_MAX_FIELDS, {
|
|
6187
|
+
message: `custom: at most ${CUSTOM_EVENT_MAX_FIELDS} fields`
|
|
6188
|
+
})
|
|
6189
|
+
}).strict()
|
|
6190
|
+
]);
|
|
6191
|
+
var LogEventSchema = z3.union([
|
|
6103
6192
|
DispatchEventSchema,
|
|
6104
6193
|
DevReviewLoopEventSchema,
|
|
6105
6194
|
ForgeWriteEventSchema,
|
|
@@ -6108,10 +6197,11 @@ var LogEventSchema = z2.union([
|
|
|
6108
6197
|
UsageEventSchema,
|
|
6109
6198
|
RoleAttemptEventSchema,
|
|
6110
6199
|
HandoffEventSchema,
|
|
6111
|
-
EffectEventSchema
|
|
6200
|
+
EffectEventSchema,
|
|
6201
|
+
CustomEventSchema
|
|
6112
6202
|
]);
|
|
6113
|
-
|
|
6114
6203
|
// ../../packages/aeg-core/src/log/envelope.ts
|
|
6204
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
6115
6205
|
function isRole(value) {
|
|
6116
6206
|
return value !== undefined && ROLE_VALUES.includes(value);
|
|
6117
6207
|
}
|
|
@@ -6148,18 +6238,27 @@ function roundFromEnv(round) {
|
|
|
6148
6238
|
const n = Number(round);
|
|
6149
6239
|
return Number.isInteger(n) ? n : undefined;
|
|
6150
6240
|
}
|
|
6241
|
+
function prFromEnv(pr) {
|
|
6242
|
+
if (pr === undefined || pr === "")
|
|
6243
|
+
return;
|
|
6244
|
+
const n = Number(pr);
|
|
6245
|
+
return Number.isInteger(n) && n > 0 ? n : undefined;
|
|
6246
|
+
}
|
|
6151
6247
|
function buildHeader(input) {
|
|
6152
6248
|
const role = isRole(input.env.role) ? input.env.role : "unattributed";
|
|
6153
6249
|
const round = roundFromEnv(input.env.round);
|
|
6250
|
+
const pr = prFromEnv(input.env.pr);
|
|
6154
6251
|
const subject = {
|
|
6155
6252
|
issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
|
|
6156
6253
|
role,
|
|
6157
6254
|
...round !== undefined ? { round } : {},
|
|
6255
|
+
...pr !== undefined ? { pr } : {},
|
|
6158
6256
|
...input.subject ?? {}
|
|
6159
6257
|
};
|
|
6258
|
+
const issue = subject.issue;
|
|
6160
6259
|
return {
|
|
6161
6260
|
meta: {
|
|
6162
|
-
schema:
|
|
6261
|
+
schema: 3,
|
|
6163
6262
|
ts: input.now.toISOString(),
|
|
6164
6263
|
run_id: input.runId,
|
|
6165
6264
|
seq: input.seq,
|
|
@@ -6182,7 +6281,19 @@ function buildHeader(input) {
|
|
|
6182
6281
|
ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
|
|
6183
6282
|
policy_digest: input.inputVersions?.policyDigest ?? null
|
|
6184
6283
|
},
|
|
6185
|
-
provenance: provenanceFor(input)
|
|
6284
|
+
provenance: provenanceFor(input),
|
|
6285
|
+
work: {
|
|
6286
|
+
ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
|
|
6287
|
+
repo: input.repo,
|
|
6288
|
+
change: null,
|
|
6289
|
+
revision: null
|
|
6290
|
+
},
|
|
6291
|
+
flow: {
|
|
6292
|
+
id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
|
|
6293
|
+
version: lineageFieldFromEnv(input.env.flowVersion)
|
|
6294
|
+
},
|
|
6295
|
+
runtime: lineageFieldFromEnv(input.env.runtime),
|
|
6296
|
+
source: lineageFieldFromEnv(input.env.source)
|
|
6186
6297
|
},
|
|
6187
6298
|
subject
|
|
6188
6299
|
};
|
|
@@ -6225,7 +6336,7 @@ function redact(value, home) {
|
|
|
6225
6336
|
return value;
|
|
6226
6337
|
}
|
|
6227
6338
|
// ../../packages/aeg-core/src/log/store.ts
|
|
6228
|
-
var KNOWN_SCHEMA_VERSIONS = [1, 2];
|
|
6339
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
|
|
6229
6340
|
function metaOf(obj) {
|
|
6230
6341
|
if (obj === null || typeof obj !== "object")
|
|
6231
6342
|
return null;
|
|
@@ -6291,7 +6402,7 @@ function classifyStoredLine(raw, home) {
|
|
|
6291
6402
|
return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
|
|
6292
6403
|
}
|
|
6293
6404
|
const redacted = redact(event, home);
|
|
6294
|
-
const provenance = version
|
|
6405
|
+
const provenance = version >= 2 ? event.meta.provenance ?? null : null;
|
|
6295
6406
|
return {
|
|
6296
6407
|
status: "ok",
|
|
6297
6408
|
identity,
|
|
@@ -6304,193 +6415,176 @@ function classifyStoredLine(raw, home) {
|
|
|
6304
6415
|
};
|
|
6305
6416
|
}
|
|
6306
6417
|
// ../../packages/aeg-core/src/control-store/records.ts
|
|
6307
|
-
import { z as
|
|
6308
|
-
var isoTimestamp =
|
|
6309
|
-
var taskId =
|
|
6310
|
-
var epochNumber =
|
|
6311
|
-
var RunRecordSchema =
|
|
6312
|
-
version:
|
|
6313
|
-
kind:
|
|
6418
|
+
import { z as z4 } from "zod";
|
|
6419
|
+
var isoTimestamp = z4.string().min(1);
|
|
6420
|
+
var taskId = z4.number().int().positive();
|
|
6421
|
+
var epochNumber = z4.number().int().nonnegative();
|
|
6422
|
+
var RunRecordSchema = z4.object({
|
|
6423
|
+
version: z4.literal(1),
|
|
6424
|
+
kind: z4.literal("run"),
|
|
6314
6425
|
task: taskId,
|
|
6315
|
-
runId:
|
|
6316
|
-
pid:
|
|
6317
|
-
host:
|
|
6426
|
+
runId: z4.string().min(1),
|
|
6427
|
+
pid: z4.number().int().positive(),
|
|
6428
|
+
host: z4.string().min(1),
|
|
6318
6429
|
startedAt: isoTimestamp,
|
|
6319
|
-
childStartedAt:
|
|
6320
|
-
childCommand:
|
|
6430
|
+
childStartedAt: z4.string().min(1).nullable().optional(),
|
|
6431
|
+
childCommand: z4.string().min(1).nullable().optional()
|
|
6321
6432
|
}).strict();
|
|
6322
|
-
var InputRecordSchema =
|
|
6323
|
-
version:
|
|
6324
|
-
kind:
|
|
6433
|
+
var InputRecordSchema = z4.object({
|
|
6434
|
+
version: z4.literal(1),
|
|
6435
|
+
kind: z4.literal("input"),
|
|
6325
6436
|
task: taskId,
|
|
6326
|
-
runId:
|
|
6327
|
-
source:
|
|
6328
|
-
pr:
|
|
6329
|
-
round:
|
|
6437
|
+
runId: z4.string().min(1),
|
|
6438
|
+
source: z4.union([z4.literal("fresh"), z4.literal("resume")]),
|
|
6439
|
+
pr: z4.number().int().positive().nullable(),
|
|
6440
|
+
round: z4.number().int().nonnegative(),
|
|
6330
6441
|
recordedAt: isoTimestamp
|
|
6331
6442
|
}).strict();
|
|
6332
|
-
var OwnershipRecordSchema =
|
|
6333
|
-
version:
|
|
6334
|
-
kind:
|
|
6443
|
+
var OwnershipRecordSchema = z4.object({
|
|
6444
|
+
version: z4.literal(1),
|
|
6445
|
+
kind: z4.literal("ownership"),
|
|
6335
6446
|
task: taskId,
|
|
6336
6447
|
epoch: epochNumber,
|
|
6337
|
-
ownerId:
|
|
6338
|
-
pid:
|
|
6339
|
-
host:
|
|
6448
|
+
ownerId: z4.string().min(1),
|
|
6449
|
+
pid: z4.number().int().positive(),
|
|
6450
|
+
host: z4.string().min(1),
|
|
6340
6451
|
acquiredAt: isoTimestamp
|
|
6341
6452
|
}).strict();
|
|
6342
|
-
var TransitionRecordSchema =
|
|
6343
|
-
version:
|
|
6344
|
-
kind:
|
|
6453
|
+
var TransitionRecordSchema = z4.object({
|
|
6454
|
+
version: z4.literal(1),
|
|
6455
|
+
kind: z4.literal("transition"),
|
|
6345
6456
|
task: taskId,
|
|
6346
6457
|
epoch: epochNumber,
|
|
6347
|
-
seq:
|
|
6348
|
-
from:
|
|
6349
|
-
to:
|
|
6350
|
-
detail:
|
|
6458
|
+
seq: z4.number().int().nonnegative(),
|
|
6459
|
+
from: z4.string().min(1),
|
|
6460
|
+
to: z4.string().min(1),
|
|
6461
|
+
detail: z4.string().optional(),
|
|
6351
6462
|
at: isoTimestamp
|
|
6352
6463
|
}).strict();
|
|
6353
|
-
var ManifestRecordSchema =
|
|
6354
|
-
version:
|
|
6355
|
-
kind:
|
|
6464
|
+
var ManifestRecordSchema = z4.object({
|
|
6465
|
+
version: z4.literal(1),
|
|
6466
|
+
kind: z4.literal("manifest"),
|
|
6356
6467
|
task: taskId,
|
|
6357
6468
|
round: epochNumber,
|
|
6358
|
-
repository:
|
|
6359
|
-
pr:
|
|
6360
|
-
branch:
|
|
6361
|
-
baseSha:
|
|
6362
|
-
headSha:
|
|
6363
|
-
briefHash:
|
|
6364
|
-
objectivesVersion:
|
|
6469
|
+
repository: z4.string().min(1),
|
|
6470
|
+
pr: z4.number().int().positive(),
|
|
6471
|
+
branch: z4.string().min(1),
|
|
6472
|
+
baseSha: z4.string().min(1).nullable(),
|
|
6473
|
+
headSha: z4.string().min(1),
|
|
6474
|
+
briefHash: z4.string().min(1).nullable(),
|
|
6475
|
+
objectivesVersion: z4.string().min(1).nullable(),
|
|
6365
6476
|
rulingOrdinal: epochNumber,
|
|
6366
|
-
policyDigest:
|
|
6477
|
+
policyDigest: z4.string().min(1),
|
|
6367
6478
|
recordedAt: isoTimestamp
|
|
6368
6479
|
}).strict();
|
|
6369
|
-
var roundHeadIdentity =
|
|
6370
|
-
var LoopBudgetsSchema =
|
|
6371
|
-
mechanicalRetries:
|
|
6372
|
-
reviewRounds:
|
|
6373
|
-
infrastructureRetries:
|
|
6480
|
+
var roundHeadIdentity = z4.object({ round: z4.number().int().positive(), head: z4.string().min(1) }).strict();
|
|
6481
|
+
var LoopBudgetsSchema = z4.object({
|
|
6482
|
+
mechanicalRetries: z4.number().int().nonnegative(),
|
|
6483
|
+
reviewRounds: z4.number().int().nonnegative(),
|
|
6484
|
+
infrastructureRetries: z4.number().int().nonnegative()
|
|
6374
6485
|
}).strict();
|
|
6375
|
-
var LoopStateRecordSchema =
|
|
6376
|
-
version:
|
|
6377
|
-
kind:
|
|
6486
|
+
var LoopStateRecordSchema = z4.object({
|
|
6487
|
+
version: z4.literal(1),
|
|
6488
|
+
kind: z4.literal("loop_state"),
|
|
6378
6489
|
task: taskId,
|
|
6379
|
-
round:
|
|
6380
|
-
phase:
|
|
6381
|
-
pauseReason:
|
|
6490
|
+
round: z4.number().int().positive(),
|
|
6491
|
+
phase: z4.string().min(1),
|
|
6492
|
+
pauseReason: z4.string().min(1).nullable(),
|
|
6382
6493
|
budgets: LoopBudgetsSchema,
|
|
6383
6494
|
heldResult: roundHeadIdentity.nullable(),
|
|
6384
6495
|
deliveredFindings: roundHeadIdentity.nullable(),
|
|
6385
|
-
repeatMemory:
|
|
6386
|
-
blockingFindings:
|
|
6387
|
-
lastFailure:
|
|
6496
|
+
repeatMemory: z4.object({
|
|
6497
|
+
blockingFindings: z4.array(z4.string()),
|
|
6498
|
+
lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
|
|
6388
6499
|
}).strict().optional(),
|
|
6500
|
+
publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
|
|
6501
|
+
taskStartedAt: isoTimestamp.optional(),
|
|
6502
|
+
phaseMs: z4.record(z4.string(), z4.number().nonnegative()).optional(),
|
|
6389
6503
|
recordedAt: isoTimestamp
|
|
6390
6504
|
}).strict();
|
|
6391
|
-
var EffectRecordSchema =
|
|
6392
|
-
version:
|
|
6393
|
-
kind:
|
|
6505
|
+
var EffectRecordSchema = z4.object({
|
|
6506
|
+
version: z4.literal(1),
|
|
6507
|
+
kind: z4.literal("effect"),
|
|
6394
6508
|
task: taskId,
|
|
6395
|
-
key:
|
|
6396
|
-
operation:
|
|
6397
|
-
target:
|
|
6398
|
-
inputVersion:
|
|
6399
|
-
payloadDigest:
|
|
6400
|
-
status:
|
|
6401
|
-
url:
|
|
6509
|
+
key: z4.string().min(1),
|
|
6510
|
+
operation: z4.string().min(1),
|
|
6511
|
+
target: z4.string().min(1),
|
|
6512
|
+
inputVersion: z4.number().int().nonnegative(),
|
|
6513
|
+
payloadDigest: z4.string().min(1),
|
|
6514
|
+
status: z4.union([z4.literal("started"), z4.literal("verified"), z4.literal("uncertain")]),
|
|
6515
|
+
url: z4.string().optional(),
|
|
6402
6516
|
recordedAt: isoTimestamp
|
|
6403
6517
|
}).strict();
|
|
6404
|
-
var EscalationRecordSchema =
|
|
6405
|
-
version:
|
|
6406
|
-
kind:
|
|
6518
|
+
var EscalationRecordSchema = z4.object({
|
|
6519
|
+
version: z4.literal(1),
|
|
6520
|
+
kind: z4.literal("escalation"),
|
|
6407
6521
|
task: taskId,
|
|
6408
|
-
escalationId:
|
|
6522
|
+
escalationId: z4.string().min(1),
|
|
6409
6523
|
round: epochNumber,
|
|
6410
|
-
head:
|
|
6411
|
-
branch:
|
|
6412
|
-
pr:
|
|
6413
|
-
runId:
|
|
6414
|
-
pid:
|
|
6415
|
-
host:
|
|
6416
|
-
agent:
|
|
6417
|
-
reason:
|
|
6418
|
-
detail:
|
|
6419
|
-
evidence:
|
|
6420
|
-
attemptedRecovery:
|
|
6421
|
-
requestedDecision:
|
|
6422
|
-
recipient:
|
|
6423
|
-
briefHash:
|
|
6424
|
-
objectivesVersion:
|
|
6524
|
+
head: z4.string().min(1),
|
|
6525
|
+
branch: z4.string().min(1),
|
|
6526
|
+
pr: z4.number().int().positive().nullable(),
|
|
6527
|
+
runId: z4.string().min(1),
|
|
6528
|
+
pid: z4.number().int().positive(),
|
|
6529
|
+
host: z4.string().min(1),
|
|
6530
|
+
agent: z4.string().min(1).optional(),
|
|
6531
|
+
reason: z4.string().min(1),
|
|
6532
|
+
detail: z4.string().optional(),
|
|
6533
|
+
evidence: z4.string().optional(),
|
|
6534
|
+
attemptedRecovery: z4.string().min(1),
|
|
6535
|
+
requestedDecision: z4.string().min(1),
|
|
6536
|
+
recipient: z4.string().min(1),
|
|
6537
|
+
briefHash: z4.string().min(1).nullable(),
|
|
6538
|
+
objectivesVersion: z4.string().min(1).nullable(),
|
|
6425
6539
|
rulingOrdinal: epochNumber,
|
|
6426
|
-
policyDigest:
|
|
6540
|
+
policyDigest: z4.string().min(1),
|
|
6427
6541
|
recordedAt: isoTimestamp
|
|
6428
6542
|
}).strict();
|
|
6429
|
-
var ResolutionRecordSchema =
|
|
6430
|
-
version:
|
|
6431
|
-
kind:
|
|
6543
|
+
var ResolutionRecordSchema = z4.object({
|
|
6544
|
+
version: z4.literal(1),
|
|
6545
|
+
kind: z4.literal("resolution"),
|
|
6432
6546
|
task: taskId,
|
|
6433
|
-
escalationId:
|
|
6434
|
-
decision:
|
|
6435
|
-
authenticatedBy:
|
|
6436
|
-
authenticatedFrom:
|
|
6547
|
+
escalationId: z4.string().min(1),
|
|
6548
|
+
decision: z4.union([z4.literal("resume"), z4.literal("cancel")]),
|
|
6549
|
+
authenticatedBy: z4.string().min(1),
|
|
6550
|
+
authenticatedFrom: z4.string().min(1),
|
|
6437
6551
|
consumedAt: isoTimestamp
|
|
6438
6552
|
}).strict();
|
|
6553
|
+
// ../../packages/aeg-core/src/control-store/local.ts
|
|
6554
|
+
var CONTROL_AREA_DIRNAME = "control";
|
|
6439
6555
|
// src/lib/diff-evidence.ts
|
|
6440
6556
|
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
6441
|
-
import { join as join9, relative, resolve as resolve2 } from "node:path";
|
|
6557
|
+
import { join as join9, relative as relative2, resolve as resolve2 } from "node:path";
|
|
6442
6558
|
|
|
6443
6559
|
// src/lib/config.ts
|
|
6444
|
-
import { execFile as execFile4, execFileSync as
|
|
6560
|
+
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
6445
6561
|
import { promisify as promisify4 } from "node:util";
|
|
6446
6562
|
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
|
|
6447
6563
|
import { homedir } from "node:os";
|
|
6448
6564
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
6449
|
-
import { z as
|
|
6565
|
+
import { z as z5 } from "zod";
|
|
6450
6566
|
|
|
6451
6567
|
// src/lib/agent-vendors.ts
|
|
6452
6568
|
var AGENT_VENDORS = ["skills", "claude", "gemini"];
|
|
6453
6569
|
|
|
6454
|
-
// src/lib/worker-boundary.ts
|
|
6455
|
-
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
6456
|
-
var LOG_HEADER_KEYCHAIN_SERVICE = "Vinaya Log";
|
|
6457
|
-
var logHeaderKeychainCache = new Map;
|
|
6458
|
-
function readRealLogHeaderKeychainCredential(variable) {
|
|
6459
|
-
if (process.platform !== "darwin")
|
|
6460
|
-
return null;
|
|
6461
|
-
try {
|
|
6462
|
-
return execFileSync2("/usr/bin/security", ["find-generic-password", "-s", LOG_HEADER_KEYCHAIN_SERVICE, "-a", variable, "-w"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 5000, maxBuffer: 1024 * 1024 }).replace(/\n$/, "");
|
|
6463
|
-
} catch {
|
|
6464
|
-
return null;
|
|
6465
|
-
}
|
|
6466
|
-
}
|
|
6467
|
-
function readLogHeaderKeychainCredential(variable) {
|
|
6468
|
-
const cached = logHeaderKeychainCache.get(variable);
|
|
6469
|
-
if (cached !== undefined)
|
|
6470
|
-
return cached;
|
|
6471
|
-
const value = readRealLogHeaderKeychainCredential(variable);
|
|
6472
|
-
logHeaderKeychainCache.set(variable, value);
|
|
6473
|
-
return value;
|
|
6474
|
-
}
|
|
6475
|
-
|
|
6476
6570
|
// src/lib/config.ts
|
|
6477
|
-
var EnvEntrySchema =
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6571
|
+
var EnvEntrySchema = z5.union([
|
|
6572
|
+
z5.literal(true),
|
|
6573
|
+
z5.object({ optional: z5.literal(true) }),
|
|
6574
|
+
z5.object({ anyOf: z5.array(z5.string()).min(2) }),
|
|
6575
|
+
z5.string()
|
|
6482
6576
|
]);
|
|
6483
|
-
var CheckEntrySchema =
|
|
6484
|
-
run:
|
|
6485
|
-
scope:
|
|
6486
|
-
include:
|
|
6487
|
-
args:
|
|
6488
|
-
timeoutMs:
|
|
6489
|
-
env:
|
|
6490
|
-
requiresOpenPr:
|
|
6491
|
-
ownWorkflow:
|
|
6492
|
-
principalOwed:
|
|
6493
|
-
validates:
|
|
6577
|
+
var CheckEntrySchema = z5.object({
|
|
6578
|
+
run: z5.string(),
|
|
6579
|
+
scope: z5.enum(["diff", "full"]),
|
|
6580
|
+
include: z5.array(z5.string()).optional(),
|
|
6581
|
+
args: z5.array(z5.string()).optional(),
|
|
6582
|
+
timeoutMs: z5.number().optional(),
|
|
6583
|
+
env: z5.record(z5.string(), EnvEntrySchema).optional(),
|
|
6584
|
+
requiresOpenPr: z5.boolean().optional(),
|
|
6585
|
+
ownWorkflow: z5.boolean().optional(),
|
|
6586
|
+
principalOwed: z5.literal(true).optional(),
|
|
6587
|
+
validates: z5.enum(["body", "issue"]).optional()
|
|
6494
6588
|
}).superRefine((entry, ctx) => {
|
|
6495
6589
|
if (!entry.env)
|
|
6496
6590
|
return;
|
|
@@ -6500,22 +6594,22 @@ var CheckEntrySchema = z4.object({
|
|
|
6500
6594
|
const members = value.anyOf;
|
|
6501
6595
|
if (new Set(members).size !== members.length) {
|
|
6502
6596
|
ctx.addIssue({
|
|
6503
|
-
code:
|
|
6597
|
+
code: z5.ZodIssueCode.custom,
|
|
6504
6598
|
message: `env.${key}.anyOf has duplicate members`,
|
|
6505
6599
|
path: ["env", key, "anyOf"]
|
|
6506
6600
|
});
|
|
6507
6601
|
}
|
|
6508
6602
|
if (!members.includes(key)) {
|
|
6509
6603
|
ctx.addIssue({
|
|
6510
|
-
code:
|
|
6604
|
+
code: z5.ZodIssueCode.custom,
|
|
6511
6605
|
message: `env.${key}.anyOf must include "${key}" itself as a member`,
|
|
6512
6606
|
path: ["env", key, "anyOf"]
|
|
6513
6607
|
});
|
|
6514
6608
|
}
|
|
6515
6609
|
}
|
|
6516
6610
|
});
|
|
6517
|
-
var RoleEntrySchema =
|
|
6518
|
-
contract:
|
|
6611
|
+
var RoleEntrySchema = z5.object({
|
|
6612
|
+
contract: z5.string().refine((p) => p.includes("/"), {
|
|
6519
6613
|
message: 'must be a path (contain at least one "/"), not a bare filename'
|
|
6520
6614
|
})
|
|
6521
6615
|
});
|
|
@@ -6539,17 +6633,17 @@ var BRIEF_BUILTINS = [
|
|
|
6539
6633
|
"briefSections",
|
|
6540
6634
|
"milestoneShape"
|
|
6541
6635
|
];
|
|
6542
|
-
var BriefSectionSchema =
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6636
|
+
var BriefSectionSchema = z5.union([
|
|
6637
|
+
z5.object({ builtin: z5.enum(BRIEF_BUILTINS) }),
|
|
6638
|
+
z5.object({ heading: z5.string().min(1), name: z5.string().optional() }),
|
|
6639
|
+
z5.object({ field: z5.string().min(1), name: z5.string().optional() }),
|
|
6640
|
+
z5.object({ phrase: z5.string().min(1), name: z5.string().optional() })
|
|
6547
6641
|
]);
|
|
6548
|
-
var BriefSchemaSchema =
|
|
6549
|
-
pr:
|
|
6550
|
-
issue:
|
|
6551
|
-
milestone:
|
|
6552
|
-
ack:
|
|
6642
|
+
var BriefSchemaSchema = z5.object({
|
|
6643
|
+
pr: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
6644
|
+
issue: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
6645
|
+
milestone: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
6646
|
+
ack: z5.array(z5.enum(BRIEF_BUILTINS)).optional()
|
|
6553
6647
|
});
|
|
6554
6648
|
function isSafeRepoRelPath(p) {
|
|
6555
6649
|
if (p.length === 0)
|
|
@@ -6558,7 +6652,7 @@ function isSafeRepoRelPath(p) {
|
|
|
6558
6652
|
return false;
|
|
6559
6653
|
return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
|
|
6560
6654
|
}
|
|
6561
|
-
var SafeRepoRelPath =
|
|
6655
|
+
var SafeRepoRelPath = z5.string().refine(isSafeRepoRelPath, {
|
|
6562
6656
|
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
6563
6657
|
});
|
|
6564
6658
|
var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
@@ -6568,22 +6662,22 @@ function isCanonicalHookBlockPath(p) {
|
|
|
6568
6662
|
var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
|
|
6569
6663
|
message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
|
|
6570
6664
|
});
|
|
6571
|
-
var ManagedBlockRecordSchema =
|
|
6665
|
+
var ManagedBlockRecordSchema = z5.object({
|
|
6572
6666
|
path: ManagedHookBlockPath,
|
|
6573
|
-
marker:
|
|
6574
|
-
comment:
|
|
6667
|
+
marker: z5.string(),
|
|
6668
|
+
comment: z5.enum(["hash", "html"])
|
|
6575
6669
|
});
|
|
6576
|
-
var ManagedManifestSchema =
|
|
6577
|
-
version:
|
|
6578
|
-
files:
|
|
6579
|
-
blocks:
|
|
6580
|
-
labels:
|
|
6581
|
-
agents:
|
|
6670
|
+
var ManagedManifestSchema = z5.object({
|
|
6671
|
+
version: z5.number().int().positive(),
|
|
6672
|
+
files: z5.array(SafeRepoRelPath),
|
|
6673
|
+
blocks: z5.array(ManagedBlockRecordSchema),
|
|
6674
|
+
labels: z5.array(z5.string()),
|
|
6675
|
+
agents: z5.array(z5.enum(AGENT_VENDORS)).optional()
|
|
6582
6676
|
});
|
|
6583
|
-
var ProjectEntrySchema =
|
|
6584
|
-
name:
|
|
6585
|
-
description:
|
|
6586
|
-
path:
|
|
6677
|
+
var ProjectEntrySchema = z5.object({
|
|
6678
|
+
name: z5.string().min(1),
|
|
6679
|
+
description: z5.string().min(1).optional(),
|
|
6680
|
+
path: z5.string().min(1).optional()
|
|
6587
6681
|
});
|
|
6588
6682
|
function parseTokensCollectDeclaration(value) {
|
|
6589
6683
|
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
@@ -6594,90 +6688,97 @@ function parseTokensCollectDeclaration(value) {
|
|
|
6594
6688
|
return null;
|
|
6595
6689
|
return { interpreter, script };
|
|
6596
6690
|
}
|
|
6597
|
-
var VinayaConfigSchema =
|
|
6598
|
-
rings:
|
|
6599
|
-
ring1_forgeWriteInterception:
|
|
6600
|
-
ring2_asyncAudits:
|
|
6691
|
+
var VinayaConfigSchema = z5.object({
|
|
6692
|
+
rings: z5.object({
|
|
6693
|
+
ring1_forgeWriteInterception: z5.boolean(),
|
|
6694
|
+
ring2_asyncAudits: z5.boolean()
|
|
6601
6695
|
}).optional(),
|
|
6602
|
-
checks:
|
|
6603
|
-
roles:
|
|
6696
|
+
checks: z5.record(z5.string(), CheckEntrySchema).optional(),
|
|
6697
|
+
roles: z5.record(z5.string(), RoleEntrySchema).optional(),
|
|
6604
6698
|
briefSchema: BriefSchemaSchema.optional(),
|
|
6605
6699
|
managed: ManagedManifestSchema.optional(),
|
|
6606
|
-
principals:
|
|
6607
|
-
releaseActor:
|
|
6608
|
-
ci:
|
|
6609
|
-
tokens:
|
|
6610
|
-
collect:
|
|
6700
|
+
principals: z5.array(z5.string()).min(1).optional(),
|
|
6701
|
+
releaseActor: z5.string().min(1).optional(),
|
|
6702
|
+
ci: z5.object({ setup: z5.string().min(1) }).optional(),
|
|
6703
|
+
tokens: z5.object({
|
|
6704
|
+
collect: z5.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
6611
6705
|
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
6612
6706
|
})
|
|
6613
6707
|
}).optional(),
|
|
6614
|
-
blastRadius:
|
|
6615
|
-
proseGates:
|
|
6616
|
-
doctrineRoot:
|
|
6617
|
-
readerFacingPrefix:
|
|
6618
|
-
readerFacingSuffix:
|
|
6619
|
-
legacySlugDir:
|
|
6620
|
-
sourceComments:
|
|
6621
|
-
globs:
|
|
6622
|
-
allowlist:
|
|
6623
|
-
severity:
|
|
6708
|
+
blastRadius: z5.object({ extraDomains: z5.array(z5.string()).optional() }).optional(),
|
|
6709
|
+
proseGates: z5.object({
|
|
6710
|
+
doctrineRoot: z5.string().min(1).optional(),
|
|
6711
|
+
readerFacingPrefix: z5.string().min(1).optional(),
|
|
6712
|
+
readerFacingSuffix: z5.string().min(1).optional(),
|
|
6713
|
+
legacySlugDir: z5.string().min(1).optional(),
|
|
6714
|
+
sourceComments: z5.object({
|
|
6715
|
+
globs: z5.array(z5.string().min(1)).optional(),
|
|
6716
|
+
allowlist: z5.array(z5.string().min(1)).optional(),
|
|
6717
|
+
severity: z5.enum(["warning", "error"]).optional()
|
|
6624
6718
|
}).optional(),
|
|
6625
|
-
specGrandfather:
|
|
6626
|
-
specPaths:
|
|
6719
|
+
specGrandfather: z5.union([z5.array(z5.string().min(1)), z5.record(z5.string().min(1), z5.number().int().min(0))]).optional(),
|
|
6720
|
+
specPaths: z5.array(z5.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
|
|
6627
6721
|
message: "must be a repository-relative path, not an absolute one"
|
|
6628
6722
|
}).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
|
|
6629
6723
|
message: "must stay inside the repository — no `..` segment"
|
|
6630
6724
|
})).optional()
|
|
6631
6725
|
}).optional(),
|
|
6632
|
-
projects:
|
|
6633
|
-
dispatch:
|
|
6634
|
-
timeoutMs:
|
|
6635
|
-
killGraceMs:
|
|
6636
|
-
agent:
|
|
6637
|
-
requireWorkerIsolation: z4.boolean().optional()
|
|
6726
|
+
projects: z5.array(ProjectEntrySchema).optional(),
|
|
6727
|
+
dispatch: z5.object({
|
|
6728
|
+
timeoutMs: z5.number().int().positive().optional(),
|
|
6729
|
+
killGraceMs: z5.number().int().positive().optional(),
|
|
6730
|
+
agent: z5.enum(["claude", "codex", "gemini"]).optional()
|
|
6638
6731
|
}).optional(),
|
|
6639
|
-
reviewPolicy:
|
|
6640
|
-
codeReviewThreshold:
|
|
6641
|
-
securityThreshold:
|
|
6642
|
-
maxRounds:
|
|
6732
|
+
reviewPolicy: z5.object({
|
|
6733
|
+
codeReviewThreshold: z5.string().min(1).optional(),
|
|
6734
|
+
securityThreshold: z5.string().min(1).optional(),
|
|
6735
|
+
maxRounds: z5.number().optional(),
|
|
6736
|
+
maxTaskMinutes: z5.number().optional()
|
|
6643
6737
|
}).optional(),
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
briefSectionsSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6647
|
-
documentationSinceIssue: z4.number().int().nonnegative().optional(),
|
|
6648
|
-
briefRulesSincePr: z4.number().int().nonnegative().optional(),
|
|
6649
|
-
agentBoxesRefusedSincePr: z4.number().int().nonnegative().optional()
|
|
6738
|
+
securityScan: z5.object({
|
|
6739
|
+
command: z5.array(z5.string().min(1)).min(1)
|
|
6650
6740
|
}).optional(),
|
|
6651
|
-
|
|
6652
|
-
|
|
6741
|
+
gateCutovers: z5.object({
|
|
6742
|
+
objectivesSinceIssue: z5.number().int().nonnegative().optional(),
|
|
6743
|
+
briefSectionsSinceIssue: z5.number().int().nonnegative().optional(),
|
|
6744
|
+
documentationSinceIssue: z5.number().int().nonnegative().optional(),
|
|
6745
|
+
briefRulesSincePr: z5.number().int().nonnegative().optional(),
|
|
6746
|
+
agentBoxesRefusedSincePr: z5.number().int().nonnegative().optional()
|
|
6653
6747
|
}).optional(),
|
|
6654
|
-
|
|
6655
|
-
|
|
6748
|
+
planning: z5.object({
|
|
6749
|
+
collisionThreshold: z5.number().int().nonnegative().optional()
|
|
6656
6750
|
}).optional(),
|
|
6657
|
-
|
|
6658
|
-
|
|
6751
|
+
prePush: z5.object({
|
|
6752
|
+
alwaysRun: z5.array(z5.string()).optional()
|
|
6753
|
+
}).optional(),
|
|
6754
|
+
report: z5.object({
|
|
6755
|
+
commandTimeoutMs: z5.number().int().positive().optional()
|
|
6659
6756
|
}).superRefine((report, ctx) => {
|
|
6660
6757
|
const commandTimeoutMs = report.commandTimeoutMs;
|
|
6661
6758
|
if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
|
|
6662
6759
|
ctx.addIssue({
|
|
6663
|
-
code:
|
|
6760
|
+
code: z5.ZodIssueCode.custom,
|
|
6664
6761
|
path: ["commandTimeoutMs"],
|
|
6665
6762
|
message: "must be at most 3600000 (1 hour)"
|
|
6666
6763
|
});
|
|
6667
6764
|
}
|
|
6668
6765
|
}).optional(),
|
|
6669
|
-
logPublish:
|
|
6766
|
+
logPublish: z5.unknown().refine((v) => v === undefined, {
|
|
6670
6767
|
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
6671
6768
|
}),
|
|
6672
|
-
runtimeDir:
|
|
6673
|
-
logs:
|
|
6674
|
-
folder:
|
|
6675
|
-
url:
|
|
6676
|
-
headers:
|
|
6769
|
+
runtimeDir: z5.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
6770
|
+
logs: z5.object({
|
|
6771
|
+
folder: z5.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
6772
|
+
url: z5.string().url().optional(),
|
|
6773
|
+
headers: z5.record(z5.string()).optional(),
|
|
6774
|
+
readHeaders: z5.record(z5.string()).optional(),
|
|
6775
|
+
events: CustomEventDeclarationsSchema.optional()
|
|
6677
6776
|
}).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
|
|
6678
6777
|
message: "logs: set at most one of folder/url"
|
|
6679
6778
|
}).refine((v) => v.headers === undefined || v.url !== undefined, {
|
|
6680
6779
|
message: "logs: headers requires url"
|
|
6780
|
+
}).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
|
|
6781
|
+
message: "logs: readHeaders requires url"
|
|
6681
6782
|
}).optional()
|
|
6682
6783
|
});
|
|
6683
6784
|
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
@@ -6782,10 +6883,15 @@ function resolveReviewPolicy(config) {
|
|
|
6782
6883
|
if (!Number.isInteger(maxRounds) || maxRounds < 1) {
|
|
6783
6884
|
throw new Error(`vinaya.config.json: reviewPolicy.maxRounds "${maxRounds}" is not a positive integer — fix the config, this never falls back to a default.`);
|
|
6784
6885
|
}
|
|
6886
|
+
const maxTaskMinutes = raw.maxTaskMinutes ?? DEFAULT_REVIEW_POLICY.maxTaskMinutes;
|
|
6887
|
+
if (!Number.isInteger(maxTaskMinutes) || maxTaskMinutes < 0) {
|
|
6888
|
+
throw new Error(`vinaya.config.json: reviewPolicy.maxTaskMinutes "${maxTaskMinutes}" is not a non-negative integer (0 turns the budget off) — fix the config, this never falls back to a default.`);
|
|
6889
|
+
}
|
|
6785
6890
|
return {
|
|
6786
6891
|
codeReviewThreshold,
|
|
6787
6892
|
securityThreshold,
|
|
6788
|
-
maxRounds
|
|
6893
|
+
maxRounds,
|
|
6894
|
+
maxTaskMinutes
|
|
6789
6895
|
};
|
|
6790
6896
|
}
|
|
6791
6897
|
function resolveGateCutovers(config) {
|
|
@@ -6825,17 +6931,12 @@ function resolveTrustAnchorLogsDestination(local, trustAnchorConfig) {
|
|
|
6825
6931
|
return "url" in anchored && anchored.url === local.url ? anchored : null;
|
|
6826
6932
|
return "folder" in anchored && anchored.folder === local.folder ? anchored : null;
|
|
6827
6933
|
}
|
|
6828
|
-
function resolveLogsHeaderValues(headers, env
|
|
6934
|
+
function resolveLogsHeaderValues(headers, env) {
|
|
6829
6935
|
if (!headers)
|
|
6830
6936
|
return;
|
|
6831
6937
|
const resolved = {};
|
|
6832
6938
|
for (const [key, value] of Object.entries(headers)) {
|
|
6833
|
-
resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) =>
|
|
6834
|
-
const fromEnv = env[name];
|
|
6835
|
-
if (fromEnv !== undefined)
|
|
6836
|
-
return fromEnv;
|
|
6837
|
-
return readKeychain(name) ?? "";
|
|
6838
|
-
});
|
|
6939
|
+
resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => env[name] ?? "");
|
|
6839
6940
|
}
|
|
6840
6941
|
return resolved;
|
|
6841
6942
|
}
|
|
@@ -6844,7 +6945,7 @@ function trustAnchorRepo() {
|
|
|
6844
6945
|
if (fromRunner)
|
|
6845
6946
|
return fromRunner;
|
|
6846
6947
|
try {
|
|
6847
|
-
const url =
|
|
6948
|
+
const url = execFileSync2("git", ["remote", "get-url", "origin"], {
|
|
6848
6949
|
encoding: "utf-8",
|
|
6849
6950
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6850
6951
|
});
|
|
@@ -6891,7 +6992,7 @@ function resolveCiTrustAnchorProbeRef(env = process.env) {
|
|
|
6891
6992
|
return ref;
|
|
6892
6993
|
}
|
|
6893
6994
|
function readTrustAnchorConfigAtRef(ref) {
|
|
6894
|
-
const raw =
|
|
6995
|
+
const raw = execFileSync2("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
|
|
6895
6996
|
encoding: "utf-8",
|
|
6896
6997
|
stdio: ["ignore", "pipe", "pipe"],
|
|
6897
6998
|
timeout: 1e4
|
|
@@ -6905,7 +7006,7 @@ function ghFetchTrustAnchorConfig() {
|
|
|
6905
7006
|
const repo = trustAnchorRepo();
|
|
6906
7007
|
if (!repo)
|
|
6907
7008
|
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
6908
|
-
return
|
|
7009
|
+
return execFileSync2("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], {
|
|
6909
7010
|
encoding: "utf-8",
|
|
6910
7011
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6911
7012
|
});
|
|
@@ -6996,7 +7097,7 @@ function loadConfig() {
|
|
|
6996
7097
|
var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
6997
7098
|
|
|
6998
7099
|
// src/lib/brief-assembly.ts
|
|
6999
|
-
import { execFileSync as
|
|
7100
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
7000
7101
|
import { existsSync as existsSync4, readFileSync as readFileSync4, readdirSync as readdirSync2 } from "node:fs";
|
|
7001
7102
|
import { join as join4 } from "node:path";
|
|
7002
7103
|
|
|
@@ -7154,7 +7255,7 @@ var COMMANDS = [
|
|
|
7154
7255
|
"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.",
|
|
7155
7256
|
"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.",
|
|
7156
7257
|
"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.",
|
|
7157
|
-
"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
|
|
7258
|
+
"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 working `vinaya task run` command for this task's own branch to continue by hand — `<tranche> <n>` for a tranche task, `--issue <n>` for a backlog one — never a `dev-review-loop --resume` line naming a pull-request number this pause does not have), a usage/argv error (exit `2`), and any other failure (exit `3`)."
|
|
7158
7259
|
],
|
|
7159
7260
|
status: "shipped"
|
|
7160
7261
|
},
|
|
@@ -7239,13 +7340,14 @@ var COMMANDS = [
|
|
|
7239
7340
|
},
|
|
7240
7341
|
{
|
|
7241
7342
|
flag: "--push",
|
|
7242
|
-
description: "PR number; splices the same content into that PR's LIVE body (fetched from the forge) and pushes it via `gh pr edit`, self-verifying nothing outside the AEG:EVIDENCE
|
|
7343
|
+
description: "PR number; splices the same content into that PR's LIVE body (fetched from the forge) and pushes it via `gh pr edit`, self-verifying nothing outside the AEG:EVIDENCE region changed. Mutually exclusive with --write."
|
|
7243
7344
|
}
|
|
7244
7345
|
],
|
|
7245
7346
|
details: [
|
|
7246
7347
|
"Two groups: Group A (recomputable) is the head sha and a width-invariant `git diff --numstat` against the merge-base with `BASE_SHA` (else `origin/main`, then `main`) — `check-evidence-fresh` recomputes and byte-compares this exactly. Group B (attested) is the result of `vinaya check --all --diff-only`, this CLI's own portable gate suite — `check-evidence-fresh` can only check it for staleness (the block's recorded head still matches the PR's real head), never re-run it.",
|
|
7247
7348
|
"With no `--write`/`--push`, prints the block to stdout instead of writing a file. Exits non-zero whenever the gate run failed, whether or not `--write`/`--push` was given — the block records a failing result rather than hiding one, and a non-zero exit stops a scripted `--write && open-pr` (or `--push`) from carrying a failing suite onto the forge.",
|
|
7248
|
-
"`--push` refuses before writing anything when the live body carries no real `AEG:EVIDENCE` pair (it never appends one, unlike `--write`), when the anchor resolves differently before and after normalisation, or when `<pr>` isn't a bare number.
|
|
7349
|
+
"`--push` refuses before writing anything when the live body carries no real `AEG:EVIDENCE` pair (it never appends one, unlike `--write`), when the anchor resolves differently before and after normalisation, or when `<pr>` isn't a bare number. After pushing, it re-reads the live body and restores the pre-edit body — exiting non-zero — if anything outside that one anchored region changed.",
|
|
7350
|
+
"A pull-request body carries no token table, and this command writes none: a dispatched turn's token use is recorded as the Vinaya log's own `usage` event instead. A body that still carries an older run's table keeps it byte for byte — it is prose this command does not own, and a change inside it reads as real drift."
|
|
7249
7351
|
],
|
|
7250
7352
|
status: "shipped"
|
|
7251
7353
|
},
|
|
@@ -7270,7 +7372,7 @@ var COMMANDS = [
|
|
|
7270
7372
|
"Deliberately a command, not a check: `evidence-fresh` runs inside `vinaya check --all`, and `pr report` runs `vinaya check --all --diff-only`, so a check that regenerated the block would run the suite containing itself. That recursion is why `evidence-fresh` verifies Group A only and leaves Group B attested.",
|
|
7271
7373
|
"Must be run from the repository ROOT of a CLEAN checkout at the pull request's head, and refuses otherwise. The regeneration inherits the working directory and several gates resolve their scan root from it, so a subdirectory silently narrows what the fresh run inspects. On cleanliness: Group B is regenerated by diff-scoped checks, so uncommitted or untracked files change which files are scanned and can produce a MATCH a clean checkout would not. Ignored paths are deliberately NOT inspected — `git diff` never reports one, so they cannot change the scope, and including them would refuse in every real checkout since `node_modules` is ignored and always present. The head is read from the forge and both a mismatch AND an unreadable head refuse — the verdict is bound to a commit, never merely attested. `BASE_SHA` is refused as well, since it steers the regeneration's merge-base.",
|
|
7272
7374
|
"Exits 0 on MATCH; 1 on DIFFERS, HIDDEN, or no block; 2 on a refusal (dirty worktree, wrong head, usage error). HIDDEN means the anchor pair sits inside a collapsed `<details>` block, where `body-bare-digits` blanks every digit and nothing can verify what it claims.",
|
|
7273
|
-
"Comparison is a multiset of repo-relative, control-stripped lines: absolute paths (local AND foreign, so a block generated in CI compares against one generated on a laptop) and line order are ignored — a reorder is not a fabrication. Only the AEG:EVIDENCE region is read
|
|
7375
|
+
"Comparison is a multiset of repo-relative, control-stripped lines: absolute paths (local AND foreign, so a block generated in CI compares against one generated on a laptop) and line order are ignored — a reorder is not a fabrication. Only the AEG:EVIDENCE region is read: every other section of the body is prose no regeneration reproduces. A moved merge-base is reported ALONGSIDE the differing lines, never instead of them."
|
|
7274
7376
|
],
|
|
7275
7377
|
status: "shipped"
|
|
7276
7378
|
},
|
|
@@ -7441,7 +7543,7 @@ var COMMANDS = [
|
|
|
7441
7543
|
{ flag: "--secrets", description: "security only: the SECRETS line" },
|
|
7442
7544
|
{
|
|
7443
7545
|
flag: "--secrets-evidence-file",
|
|
7444
|
-
description: 'security only: required whenever `--secrets` claims "none found" — the
|
|
7546
|
+
description: 'security only: required whenever `--secrets` claims "none found" — the passing `atta-labs/secret-scan` check result on the judged head that backs it; never run or paste the scanner'
|
|
7445
7547
|
},
|
|
7446
7548
|
{ flag: "--task-id", description: "the closing `Tokens:` line's task id" },
|
|
7447
7549
|
{ flag: "--model", description: "the closing `Tokens:` line's model name" },
|
|
@@ -7549,7 +7651,20 @@ var COMMANDS = [
|
|
|
7549
7651
|
flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
|
|
7550
7652
|
details: [
|
|
7551
7653
|
"Refuses if any task Issue attached to the named tranche is still open, naming each one — closing a tranche with unresolved work is never silently allowed.",
|
|
7552
|
-
"Once every task Issue is closed, prompts for confirmation (unless `--yes`) and closes
|
|
7654
|
+
"Once every task Issue is closed, prompts for confirmation (unless `--yes`), records the tranche's retrospective in the Milestone its task Issues are attached to, and closes that Milestone once nothing else in it is still open.",
|
|
7655
|
+
"A tranche none of whose task Issues carry a Milestone gets one: a Milestone titled with the tranche's slug is created, the tranche's closed task Issues are attached to it, the retrospective is recorded, and it is closed — so the tranche reads as archived. An Issue already on a Milestone is never moved.",
|
|
7656
|
+
"Idempotent: on a tranche whose Milestone is already closed and carries its retrospective, changes nothing and says it is already archived.",
|
|
7657
|
+
"The generated `vinaya-archivist.yml` workflow runs it after a task pull request merges, and again when an Issue labeled with the tranche closes without a merge (dropped, replaced or closed by hand) — the tranche's slug read from that Issue's own label."
|
|
7658
|
+
],
|
|
7659
|
+
status: "shipped"
|
|
7660
|
+
},
|
|
7661
|
+
{
|
|
7662
|
+
name: "archive tranches",
|
|
7663
|
+
description: "Archive every finished tranche that has no closed Milestone carrying its retrospective",
|
|
7664
|
+
flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
|
|
7665
|
+
details: [
|
|
7666
|
+
"Walks every `vinaya/tranche:<slug>` label, skips each tranche that still has an open task Issue, and runs `archive tranche` for each finished one whose Milestone is not already closed with its retrospective. One tranche failing does not stop the others; the exit code reports it.",
|
|
7667
|
+
"The generated `vinaya-archivist.yml` workflow calls it on its daily scheduled run, so a tranche that finished before the workflow could see it is archived within a day. Running it again when every finished tranche is archived changes nothing and says so."
|
|
7553
7668
|
],
|
|
7554
7669
|
status: "shipped"
|
|
7555
7670
|
},
|
|
@@ -7693,6 +7808,29 @@ var COMMANDS = [
|
|
|
7693
7808
|
],
|
|
7694
7809
|
status: "shipped"
|
|
7695
7810
|
},
|
|
7811
|
+
{
|
|
7812
|
+
name: "log selftest",
|
|
7813
|
+
description: "Prove log delivery works end to end: send one marked test event and read it back — PASS (exit 0) or FAIL with the one reason (exit 1)",
|
|
7814
|
+
details: [
|
|
7815
|
+
"Resolves the destination exactly as an UNATTENDED review-loop run does in this repository — the same trust-anchor read and credential lookup, forced unattended so running it by hand proves the launch path's own resolution, not a human's. It sends one test event to the configured `logs.url` server, then reads it back from the server by the event's own id through the server's cursor read.",
|
|
7816
|
+
"PASS (exit 0) only when the event round-trips. Otherwise FAIL (exit 1) with the ONE reason that stopped it: no server is configured, the default branch's config could not be read to confirm the url (and why), this host holds no ingest or read credential, the server refused with its status, or the event could not be read back. It never prints a credential value.",
|
|
7817
|
+
"The read-back needs a READ credential distinct from the write-only ingest one the server refuses on a read route: set `logs.readHeaders` in vinaya.config.json to the server's read token (referenced by variable name, resolved from the environment exactly as `logs.headers` is). The test event is marked `operation: 'log.selftest'` so a reader can exclude it from real telemetry."
|
|
7818
|
+
],
|
|
7819
|
+
status: "shipped"
|
|
7820
|
+
},
|
|
7821
|
+
{
|
|
7822
|
+
name: "log emit",
|
|
7823
|
+
description: "Record a consumer-declared event (`logs.events` in vinaya.config.json) from a script or agent outside Vinaya",
|
|
7824
|
+
flags: [
|
|
7825
|
+
{ flag: "--json '<json>'", description: "The field values as one JSON object (else read from standard input)" }
|
|
7826
|
+
],
|
|
7827
|
+
details: [
|
|
7828
|
+
"Reads the field values as ONE JSON object — `--json '<json>'` or piped on standard input, never positional arguments — and records them through `emitCustomEvent`, the same chokepoint every custom event goes through, so the refusal event and the redaction stay in one place.",
|
|
7829
|
+
"A declared event with every field present and of its declared type exits 0 and prints the event name and the kind of destination it was recorded toward (`folder`, `server`, or `none`) — never a field value. A refused event (an undeclared name, or a missing, extra, wrong-typed or too-long field) exits 1 and prints the reason class and the field names — never a value, since a rejected value may be the secret. A missing event name, unreadable JSON, or JSON that is not a flat object is a usage error: exit 2, before anything is recorded.",
|
|
7830
|
+
"A process with only `VINAYA_WORK_REF` and `VINAYA_FLOW` set, and no Vinaya role or task, still gets a header carrying that work reference and way-of-working id — the same environment read every event already honours (`apps/cli/specs/log.md` § Attribution)."
|
|
7831
|
+
],
|
|
7832
|
+
status: "shipped"
|
|
7833
|
+
},
|
|
7696
7834
|
{
|
|
7697
7835
|
name: "log send",
|
|
7698
7836
|
description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
|
|
@@ -7705,12 +7843,19 @@ var COMMANDS = [
|
|
|
7705
7843
|
status: "shipped"
|
|
7706
7844
|
},
|
|
7707
7845
|
{
|
|
7708
|
-
name: "
|
|
7709
|
-
description: "
|
|
7846
|
+
name: "sync",
|
|
7847
|
+
description: "Fill, resume and rebuild the local log cache from this repository's configured destination (read-only)",
|
|
7848
|
+
flags: [
|
|
7849
|
+
{
|
|
7850
|
+
flag: "--rebuild",
|
|
7851
|
+
description: "Delete the cache file and sync from the beginning of what the destination still retains"
|
|
7852
|
+
},
|
|
7853
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7854
|
+
],
|
|
7710
7855
|
details: [
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
"
|
|
7856
|
+
"Resolves the destination exactly the way a normal event does — the sink's own decision over `vinaya.config.json`'s `logs` setting, trust-anchor-gated for an unattended caller — then reads a folder destination through the folder source or a server destination through the server source (with the configured `logs.readHeaders`, substituted from the environment), and runs the bounded sync engine against the durable cache this repository holds under its runtime directory. Prints pages read, rows stored, duplicates, edits, deletions, gaps, quarantined lines and, for a server destination, its lost-event diagnostic. Reads the destination and writes only its own cache directory — never the folder, the server, or the forge.",
|
|
7857
|
+
"Exits 0 when the run completed or stopped cleanly on its page bound (and says more is available), 1 when it failed part way (the progress made is kept — a second run resumes from the stored cursor), and 2 for a usage or configuration problem: no destination is configured, or a server destination is configured with no usable read credential. A missing credential names the environment variable to set and never prints its value.",
|
|
7858
|
+
"`--rebuild` deletes the cache file ALONE — never anything else under the cache directory — and syncs again from the beginning of what the destination still retains; an event already rotated out of a folder's single backup slot, or no longer retained by the destination, cannot be recovered and shows up as a gap, never silently."
|
|
7714
7859
|
],
|
|
7715
7860
|
status: "shipped"
|
|
7716
7861
|
}
|
|
@@ -7724,13 +7869,13 @@ function createForgeSource(config) {
|
|
|
7724
7869
|
};
|
|
7725
7870
|
}
|
|
7726
7871
|
// ../../packages/sources/src/select-source.ts
|
|
7727
|
-
import { z as
|
|
7728
|
-
var StateSourceConfigSchema =
|
|
7729
|
-
|
|
7730
|
-
|
|
7872
|
+
import { z as z6 } from "zod";
|
|
7873
|
+
var StateSourceConfigSchema = z6.discriminatedUnion("kind", [
|
|
7874
|
+
z6.object({ kind: z6.literal("forge"), owner: z6.string(), repo: z6.string() }),
|
|
7875
|
+
z6.object({ kind: z6.literal("file"), root: z6.string().optional() })
|
|
7731
7876
|
]);
|
|
7732
7877
|
// src/checks/edge-resolve.ts
|
|
7733
|
-
import { execFileSync as
|
|
7878
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
7734
7879
|
var DIRECT_ISSUE_REF = /#(\d+)/;
|
|
7735
7880
|
var issueCache = new Map;
|
|
7736
7881
|
function fetchIssueState(num, repo) {
|
|
@@ -7739,7 +7884,7 @@ function fetchIssueState(num, repo) {
|
|
|
7739
7884
|
return issueCache.get(key) ?? null;
|
|
7740
7885
|
let out = null;
|
|
7741
7886
|
try {
|
|
7742
|
-
const raw =
|
|
7887
|
+
const raw = execFileSync3("gh", [
|
|
7743
7888
|
"issue",
|
|
7744
7889
|
"view",
|
|
7745
7890
|
String(num),
|
|
@@ -7865,17 +8010,26 @@ function packageRoot(moduleUrl) {
|
|
|
7865
8010
|
}
|
|
7866
8011
|
|
|
7867
8012
|
// src/commands/doctrine.ts
|
|
7868
|
-
import { execFileSync as
|
|
8013
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
7869
8014
|
import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync3 } from "node:fs";
|
|
7870
8015
|
import { dirname as dirname3, join as join3, sep } from "node:path";
|
|
8016
|
+
import matter4 from "gray-matter";
|
|
8017
|
+
|
|
8018
|
+
// ../../packages/aeg-core/src/docs/parse-doc.ts
|
|
7871
8019
|
import matter2 from "gray-matter";
|
|
8020
|
+
// ../../packages/aeg-core/src/docs/surfaced-manifest.ts
|
|
8021
|
+
var NO_MODEL_BACKED_PATHS = new Set;
|
|
8022
|
+
// src/roles/contract.ts
|
|
8023
|
+
import matter3 from "gray-matter";
|
|
8024
|
+
|
|
8025
|
+
// src/commands/doctrine.ts
|
|
7872
8026
|
var ENTRY_SEGMENTS = ["skills", "aeg", "SKILL.md"];
|
|
7873
8027
|
function resolveDoctrineRoot(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
|
|
7874
8028
|
return resolveDoctrineRootInfo(pkg, cwd)?.root ?? null;
|
|
7875
8029
|
}
|
|
7876
8030
|
function gitToplevel(cwd) {
|
|
7877
8031
|
try {
|
|
7878
|
-
return
|
|
8032
|
+
return execFileSync4("git", ["-C", cwd, "rev-parse", "--show-toplevel"], {
|
|
7879
8033
|
encoding: "utf8",
|
|
7880
8034
|
stdio: ["ignore", "pipe", "pipe"]
|
|
7881
8035
|
}).trim();
|
|
@@ -7904,7 +8058,7 @@ var PACKAGED_TEMPLATE_PATH = join4(PACKAGE_ROOT, "aeg-root", "templates", "brief
|
|
|
7904
8058
|
var TEMPLATE_PATH = existsSync4(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join4(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
|
|
7905
8059
|
function git(args) {
|
|
7906
8060
|
try {
|
|
7907
|
-
return
|
|
8061
|
+
return execFileSync5("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
7908
8062
|
} catch {
|
|
7909
8063
|
return "";
|
|
7910
8064
|
}
|
|
@@ -7917,12 +8071,16 @@ function expandGlob(glob) {
|
|
|
7917
8071
|
var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
7918
8072
|
|
|
7919
8073
|
// src/checks/registry.ts
|
|
7920
|
-
import {
|
|
7921
|
-
import {
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
8074
|
+
import { join as join5, relative, sep as sep2 } from "node:path";
|
|
8075
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8076
|
+
function resolveCheckBin(packageDir, moduleUrl) {
|
|
8077
|
+
const fromPackage = relative(packageDir, fileURLToPath2(moduleUrl));
|
|
8078
|
+
const bundled = fromPackage === "dist" || fromPackage.startsWith(`dist${sep2}`);
|
|
8079
|
+
return bundled ? { dir: join5(packageDir, "dist", "checks", "bin"), ext: ".js" } : { dir: join5(packageDir, "src", "checks", "bin"), ext: ".ts" };
|
|
8080
|
+
}
|
|
8081
|
+
var CHECK_BIN = resolveCheckBin(packageRoot(import.meta.url), import.meta.url);
|
|
8082
|
+
var BIN_DIR = CHECK_BIN.dir;
|
|
8083
|
+
var BIN_EXT = CHECK_BIN.ext;
|
|
7926
8084
|
function bin(name) {
|
|
7927
8085
|
return join5(BIN_DIR, `${name}${BIN_EXT}`);
|
|
7928
8086
|
}
|
|
@@ -8120,23 +8278,6 @@ var REGISTRY = [
|
|
|
8120
8278
|
},
|
|
8121
8279
|
1
|
|
8122
8280
|
],
|
|
8123
|
-
[
|
|
8124
|
-
{
|
|
8125
|
-
name: "token-report",
|
|
8126
|
-
validates: "body",
|
|
8127
|
-
run: bin("check-token-report"),
|
|
8128
|
-
scope: "diff",
|
|
8129
|
-
timeoutMs: 15000,
|
|
8130
|
-
requiresOpenPr: true,
|
|
8131
|
-
env: {
|
|
8132
|
-
PR_BODY: { optional: true },
|
|
8133
|
-
BRANCH: { optional: true },
|
|
8134
|
-
CLAUDE_PROJECT_DIR: { optional: true },
|
|
8135
|
-
CLAUDE_CODE_SESSION_ID: { optional: true }
|
|
8136
|
-
}
|
|
8137
|
-
},
|
|
8138
|
-
1
|
|
8139
|
-
],
|
|
8140
8281
|
[
|
|
8141
8282
|
{
|
|
8142
8283
|
name: "no-disk-state",
|
|
@@ -8486,23 +8627,35 @@ var CORE_CHECK_RING = Object.fromEntries(REGISTRY.map(([spec, ring]) => [spec.na
|
|
|
8486
8627
|
import { execFile as execFile5 } from "node:child_process";
|
|
8487
8628
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
8488
8629
|
import {
|
|
8489
|
-
|
|
8490
|
-
|
|
8630
|
+
appendFileSync,
|
|
8631
|
+
closeSync as closeSync4,
|
|
8632
|
+
constants as fsConstants4,
|
|
8491
8633
|
existsSync as existsSync7,
|
|
8492
|
-
fstatSync as
|
|
8493
|
-
mkdirSync as
|
|
8494
|
-
|
|
8495
|
-
|
|
8634
|
+
fstatSync as fstatSync3,
|
|
8635
|
+
mkdirSync as mkdirSync4,
|
|
8636
|
+
lstatSync as lstatSync2,
|
|
8637
|
+
openSync as openSync4,
|
|
8638
|
+
readFileSync as readFileSync7,
|
|
8496
8639
|
renameSync as renameSync2,
|
|
8497
|
-
|
|
8640
|
+
writeFileSync as writeFileSync3,
|
|
8641
|
+
writeSync as writeSync3
|
|
8498
8642
|
} from "node:fs";
|
|
8499
8643
|
import { hostname as osHostname, homedir as homedir3 } from "node:os";
|
|
8500
|
-
import { dirname as
|
|
8644
|
+
import { dirname as dirname7, join as join8 } from "node:path";
|
|
8501
8645
|
import { promisify as promisify5 } from "node:util";
|
|
8502
8646
|
|
|
8503
8647
|
// src/lib/run-paths.ts
|
|
8504
|
-
import {
|
|
8648
|
+
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
8649
|
+
import { chmodSync, existsSync as existsSync5, realpathSync as realpathSync2 } from "node:fs";
|
|
8505
8650
|
import { dirname as dirname4, join as join6, resolve as resolvePath } from "node:path";
|
|
8651
|
+
var TASKS_EXECUTION_DIRNAME = "tasks-execution";
|
|
8652
|
+
var RUN_AREA_DIRNAMES = {
|
|
8653
|
+
control: CONTROL_AREA_DIRNAME,
|
|
8654
|
+
sessions: "sessions",
|
|
8655
|
+
hooks: "hooks",
|
|
8656
|
+
output: "output",
|
|
8657
|
+
rounds: "rounds"
|
|
8658
|
+
};
|
|
8506
8659
|
var SAFE_PATH_SEGMENT = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
8507
8660
|
function isSafeRepoSegment(segment) {
|
|
8508
8661
|
return SAFE_PATH_SEGMENT.test(segment) && !segment.includes("..");
|
|
@@ -8533,12 +8686,52 @@ function isInsideRepo(candidate, repoRoot) {
|
|
|
8533
8686
|
const target = resolvePath(candidate);
|
|
8534
8687
|
return target === root || target.startsWith(`${root}/`);
|
|
8535
8688
|
}
|
|
8689
|
+
function runPath(runtimeDir, scope, location) {
|
|
8690
|
+
const dir = join6(runtimeDir, TASKS_EXECUTION_DIRNAME, scopeSegment(scope));
|
|
8691
|
+
switch (location.area) {
|
|
8692
|
+
case "task":
|
|
8693
|
+
return location.file ? join6(dir, location.file) : dir;
|
|
8694
|
+
case "control": {
|
|
8695
|
+
const controlDir = join6(dir, RUN_AREA_DIRNAMES.control);
|
|
8696
|
+
return location.file ? join6(controlDir, location.file) : controlDir;
|
|
8697
|
+
}
|
|
8698
|
+
case "rounds":
|
|
8699
|
+
return join6(dir, RUN_AREA_DIRNAMES.rounds);
|
|
8700
|
+
case "round": {
|
|
8701
|
+
const roundDir = join6(dir, RUN_AREA_DIRNAMES.rounds, String(location.round));
|
|
8702
|
+
return location.file ? join6(roundDir, location.file) : roundDir;
|
|
8703
|
+
}
|
|
8704
|
+
case "developer": {
|
|
8705
|
+
const developerDir = join6(dir, RUN_AREA_DIRNAMES.rounds, String(location.round), "developer");
|
|
8706
|
+
return location.file ? join6(developerDir, location.file) : developerDir;
|
|
8707
|
+
}
|
|
8708
|
+
default: {
|
|
8709
|
+
const areaDir = join6(dir, RUN_AREA_DIRNAMES[location.area]);
|
|
8710
|
+
return location.file ? join6(areaDir, location.file) : areaDir;
|
|
8711
|
+
}
|
|
8712
|
+
}
|
|
8713
|
+
}
|
|
8714
|
+
function scopeSegment(scope) {
|
|
8715
|
+
if (scope === "unscoped")
|
|
8716
|
+
return "unscoped";
|
|
8717
|
+
if (typeof scope === "number")
|
|
8718
|
+
return String(scope);
|
|
8719
|
+
return `pr-${scope.pr}`;
|
|
8720
|
+
}
|
|
8536
8721
|
var UNATTENDED_ENV_KEY = "VINAYA_UNATTENDED";
|
|
8537
8722
|
var RUNTIME_DIR_ENV_KEY = "VINAYA_RUNTIME_DIR";
|
|
8538
8723
|
function isUnattendedProcess(env = process.env) {
|
|
8539
8724
|
return env[UNATTENDED_ENV_KEY] === "1" || (env.VINAYA_ROLE ?? "") !== "";
|
|
8540
8725
|
}
|
|
8541
8726
|
var memoized = null;
|
|
8727
|
+
function runtimeDirForRepo(repo) {
|
|
8728
|
+
const key = repoSegment(repo);
|
|
8729
|
+
if (memoized?.key === key)
|
|
8730
|
+
return memoized.value;
|
|
8731
|
+
const value = resolveRuntimeDirUncached(repo);
|
|
8732
|
+
memoized = { key, value };
|
|
8733
|
+
return value;
|
|
8734
|
+
}
|
|
8542
8735
|
async function runtimeDirForRepoAsync(repo) {
|
|
8543
8736
|
const key = repoSegment(repo);
|
|
8544
8737
|
if (memoized?.key === key)
|
|
@@ -8554,6 +8747,16 @@ async function runtimeDirForRepoAsync(repo) {
|
|
|
8554
8747
|
memoized = { key, value };
|
|
8555
8748
|
return value;
|
|
8556
8749
|
}
|
|
8750
|
+
function resolveRuntimeDirUncached(repo) {
|
|
8751
|
+
const inputs = runtimeDirInputs();
|
|
8752
|
+
if (typeof inputs === "string")
|
|
8753
|
+
return inputs;
|
|
8754
|
+
return resolveRuntimeDir({
|
|
8755
|
+
repo,
|
|
8756
|
+
...inputs.base,
|
|
8757
|
+
trustAnchorConfig: inputs.needsAnchor ? loadTrustAnchorConfig() : null
|
|
8758
|
+
});
|
|
8759
|
+
}
|
|
8557
8760
|
function runtimeDirInputs() {
|
|
8558
8761
|
const handedDown = process.env[RUNTIME_DIR_ENV_KEY];
|
|
8559
8762
|
if (handedDown)
|
|
@@ -8573,7 +8776,7 @@ function repoRootSync(start = process.cwd()) {
|
|
|
8573
8776
|
return null;
|
|
8574
8777
|
}
|
|
8575
8778
|
for (;; ) {
|
|
8576
|
-
if (
|
|
8779
|
+
if (existsSync5(join6(dir, ".git")))
|
|
8577
8780
|
return dir;
|
|
8578
8781
|
const parent = dirname4(dir);
|
|
8579
8782
|
if (parent === dir)
|
|
@@ -8581,26 +8784,94 @@ function repoRootSync(start = process.cwd()) {
|
|
|
8581
8784
|
dir = parent;
|
|
8582
8785
|
}
|
|
8583
8786
|
}
|
|
8787
|
+
function resolveRepoSync() {
|
|
8788
|
+
const fromEnv = process.env.AEG_REPO;
|
|
8789
|
+
if (fromEnv) {
|
|
8790
|
+
const m = /^([^/]+)\/(.+)$/.exec(fromEnv);
|
|
8791
|
+
if (m?.[1] && m[2])
|
|
8792
|
+
return { owner: m[1], repo: m[2] };
|
|
8793
|
+
}
|
|
8794
|
+
let url;
|
|
8795
|
+
try {
|
|
8796
|
+
url = execFileSync6("git", ["remote", "get-url", "origin"], {
|
|
8797
|
+
encoding: "utf-8",
|
|
8798
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
8799
|
+
}).trim();
|
|
8800
|
+
} catch {
|
|
8801
|
+
return null;
|
|
8802
|
+
}
|
|
8803
|
+
const ssh = /^git@github\.com:([^/]+)\/(.+?)(?:\.git)?$/.exec(url);
|
|
8804
|
+
if (ssh?.[1] && ssh[2])
|
|
8805
|
+
return { owner: ssh[1], repo: ssh[2] };
|
|
8806
|
+
const https = /^https?:\/\/(?:[^@]+@)?github\.com\/([^/]+)\/(.+?)(?:\.git)?\/?$/.exec(url);
|
|
8807
|
+
if (https?.[1] && https[2])
|
|
8808
|
+
return { owner: https[1], repo: https[2] };
|
|
8809
|
+
return null;
|
|
8810
|
+
}
|
|
8811
|
+
var memoizedThisRepo = null;
|
|
8812
|
+
function runtimeDirForThisRepo() {
|
|
8813
|
+
if (memoizedThisRepo !== null)
|
|
8814
|
+
return memoizedThisRepo;
|
|
8815
|
+
memoizedThisRepo = runtimeDirForRepo(resolveRepoSync());
|
|
8816
|
+
return memoizedThisRepo;
|
|
8817
|
+
}
|
|
8584
8818
|
|
|
8585
|
-
// src/lib/log
|
|
8819
|
+
// src/lib/loop-log.ts
|
|
8586
8820
|
import {
|
|
8587
8821
|
closeSync as closeSync2,
|
|
8588
8822
|
constants as fsConstants2,
|
|
8589
|
-
|
|
8823
|
+
existsSync as existsSync6,
|
|
8824
|
+
fstatSync as fstatSync2,
|
|
8590
8825
|
mkdirSync as mkdirSync2,
|
|
8591
8826
|
openSync as openSync2,
|
|
8592
|
-
linkSync,
|
|
8593
8827
|
readFileSync as readFileSync5,
|
|
8594
|
-
|
|
8828
|
+
readSync,
|
|
8595
8829
|
statSync,
|
|
8830
|
+
writeSync
|
|
8831
|
+
} from "node:fs";
|
|
8832
|
+
import { dirname as dirname5 } from "node:path";
|
|
8833
|
+
function loopsRoot() {
|
|
8834
|
+
return runtimeDirForThisRepo();
|
|
8835
|
+
}
|
|
8836
|
+
function loopLogPathFor(_repo, issue, root = loopsRoot()) {
|
|
8837
|
+
return runPath(root, issue, { area: "output", file: "driver.log" });
|
|
8838
|
+
}
|
|
8839
|
+
var LOOP_LOG_MAX_BYTES = 8 * 1024 * 1024;
|
|
8840
|
+
function appendLoopLogLine(path, line) {
|
|
8841
|
+
try {
|
|
8842
|
+
mkdirSync2(dirname5(path), { recursive: true, mode: 448 });
|
|
8843
|
+
const fd = openSync2(path, fsConstants2.O_WRONLY | fsConstants2.O_APPEND | fsConstants2.O_CREAT | fsConstants2.O_NOFOLLOW, 384);
|
|
8844
|
+
try {
|
|
8845
|
+
const stat = fstatSync2(fd);
|
|
8846
|
+
if (stat.isFile() && stat.size < LOOP_LOG_MAX_BYTES) {
|
|
8847
|
+
writeSync(fd, `${line}
|
|
8848
|
+
`);
|
|
8849
|
+
}
|
|
8850
|
+
} finally {
|
|
8851
|
+
closeSync2(fd);
|
|
8852
|
+
}
|
|
8853
|
+
} catch {}
|
|
8854
|
+
}
|
|
8855
|
+
|
|
8856
|
+
// src/lib/log-webhook-drain.ts
|
|
8857
|
+
import {
|
|
8858
|
+
closeSync as closeSync3,
|
|
8859
|
+
constants as fsConstants3,
|
|
8860
|
+
lstatSync,
|
|
8861
|
+
mkdirSync as mkdirSync3,
|
|
8862
|
+
openSync as openSync3,
|
|
8863
|
+
linkSync,
|
|
8864
|
+
readFileSync as readFileSync6,
|
|
8865
|
+
renameSync,
|
|
8866
|
+
statSync as statSync2,
|
|
8596
8867
|
unlinkSync,
|
|
8597
8868
|
utimesSync,
|
|
8598
8869
|
writeFileSync as writeFileSync2,
|
|
8599
|
-
writeSync
|
|
8870
|
+
writeSync as writeSync2
|
|
8600
8871
|
} from "node:fs";
|
|
8601
8872
|
import { randomUUID } from "node:crypto";
|
|
8602
8873
|
import { homedir as homedir2 } from "node:os";
|
|
8603
|
-
import { dirname as
|
|
8874
|
+
import { dirname as dirname6, join as join7 } from "node:path";
|
|
8604
8875
|
var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
|
|
8605
8876
|
var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
|
|
8606
8877
|
var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
@@ -8616,13 +8887,13 @@ function isEnoent(err) {
|
|
|
8616
8887
|
var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
|
|
8617
8888
|
function tryCreateLock(lockPath, token) {
|
|
8618
8889
|
try {
|
|
8619
|
-
|
|
8620
|
-
const fd =
|
|
8890
|
+
mkdirSync3(dirname6(lockPath), { recursive: true, mode: 448 });
|
|
8891
|
+
const fd = openSync3(lockPath, fsConstants3.O_WRONLY | fsConstants3.O_CREAT | fsConstants3.O_EXCL, 384);
|
|
8621
8892
|
try {
|
|
8622
|
-
|
|
8893
|
+
writeSync2(fd, `${token}
|
|
8623
8894
|
`);
|
|
8624
8895
|
} finally {
|
|
8625
|
-
|
|
8896
|
+
closeSync3(fd);
|
|
8626
8897
|
}
|
|
8627
8898
|
return true;
|
|
8628
8899
|
} catch (err) {
|
|
@@ -8637,7 +8908,7 @@ function acquireDrainLock(lockPath) {
|
|
|
8637
8908
|
return token;
|
|
8638
8909
|
let observedMtimeMs;
|
|
8639
8910
|
try {
|
|
8640
|
-
observedMtimeMs =
|
|
8911
|
+
observedMtimeMs = statSync2(lockPath).mtimeMs;
|
|
8641
8912
|
} catch (err) {
|
|
8642
8913
|
if (!isEnoent(err))
|
|
8643
8914
|
throw err;
|
|
@@ -8655,7 +8926,7 @@ function acquireDrainLock(lockPath) {
|
|
|
8655
8926
|
}
|
|
8656
8927
|
let claimedMtimeMs = null;
|
|
8657
8928
|
try {
|
|
8658
|
-
claimedMtimeMs =
|
|
8929
|
+
claimedMtimeMs = statSync2(claimed).mtimeMs;
|
|
8659
8930
|
} catch (err) {
|
|
8660
8931
|
if (!isEnoent(err))
|
|
8661
8932
|
throw err;
|
|
@@ -8681,7 +8952,7 @@ function acquireDrainLock(lockPath) {
|
|
|
8681
8952
|
function renewDrainLock(lockPath, token) {
|
|
8682
8953
|
let holder;
|
|
8683
8954
|
try {
|
|
8684
|
-
holder =
|
|
8955
|
+
holder = readFileSync6(lockPath, "utf8").trim();
|
|
8685
8956
|
} catch (err) {
|
|
8686
8957
|
if (!isEnoent(err))
|
|
8687
8958
|
throw err;
|
|
@@ -8701,7 +8972,7 @@ function renewDrainLock(lockPath, token) {
|
|
|
8701
8972
|
}
|
|
8702
8973
|
function releaseDrainLock(lockPath, token) {
|
|
8703
8974
|
try {
|
|
8704
|
-
const holder =
|
|
8975
|
+
const holder = readFileSync6(lockPath, "utf8").trim();
|
|
8705
8976
|
if (holder !== token)
|
|
8706
8977
|
return;
|
|
8707
8978
|
unlinkSync(lockPath);
|
|
@@ -8751,7 +9022,7 @@ function queueLines(buf) {
|
|
|
8751
9022
|
return lines;
|
|
8752
9023
|
}
|
|
8753
9024
|
function removeQueueHead(path, cut) {
|
|
8754
|
-
const remaining =
|
|
9025
|
+
const remaining = readFileSync6(path);
|
|
8755
9026
|
writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
|
|
8756
9027
|
}
|
|
8757
9028
|
function queueBucketSize(path) {
|
|
@@ -8772,7 +9043,7 @@ function queueBucketSize(path) {
|
|
|
8772
9043
|
function readQueueFile(path) {
|
|
8773
9044
|
if (queueBucketSize(path) === null)
|
|
8774
9045
|
return null;
|
|
8775
|
-
return
|
|
9046
|
+
return readFileSync6(path);
|
|
8776
9047
|
}
|
|
8777
9048
|
function rejectLine(rejectedPath, reason, status, identity, raw) {
|
|
8778
9049
|
const record = JSON.stringify({
|
|
@@ -8954,13 +9225,19 @@ function logsCredentialMissing(headers, env) {
|
|
|
8954
9225
|
const varPattern = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
|
|
8955
9226
|
for (const value of Object.values(headers)) {
|
|
8956
9227
|
for (const match of value.matchAll(varPattern)) {
|
|
8957
|
-
|
|
8958
|
-
|
|
9228
|
+
const name = match[1];
|
|
9229
|
+
if (env[name])
|
|
9230
|
+
continue;
|
|
9231
|
+
return true;
|
|
8959
9232
|
}
|
|
8960
9233
|
}
|
|
8961
9234
|
return false;
|
|
8962
9235
|
}
|
|
8963
9236
|
function resolveLogDestinationFrom(input) {
|
|
9237
|
+
const spoolDir = input.env.VINAYA_LOG_SPOOL_DIR;
|
|
9238
|
+
if (spoolDir !== undefined && spoolDir.trim() !== "") {
|
|
9239
|
+
return { kind: "folder", folder: spoolDir };
|
|
9240
|
+
}
|
|
8964
9241
|
const local = resolveLogsSetting(input.localConfig);
|
|
8965
9242
|
let effective = null;
|
|
8966
9243
|
let fallbackReason;
|
|
@@ -9000,23 +9277,72 @@ function resolveLogDestinationFrom(input) {
|
|
|
9000
9277
|
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
9001
9278
|
return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
|
|
9002
9279
|
}
|
|
9003
|
-
var
|
|
9004
|
-
function processTrustAnchor() {
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9280
|
+
var processTrustAnchorByRepo = new Map;
|
|
9281
|
+
function processTrustAnchor(repoRoot) {
|
|
9282
|
+
const cached = processTrustAnchorByRepo.get(repoRoot);
|
|
9283
|
+
if (cached !== undefined)
|
|
9284
|
+
return cached;
|
|
9285
|
+
const reading = safeLoadTrustAnchorConfig();
|
|
9286
|
+
processTrustAnchorByRepo.set(repoRoot, reading);
|
|
9287
|
+
return reading;
|
|
9008
9288
|
}
|
|
9009
9289
|
async function defaultResolveLogDestination(repo, env) {
|
|
9010
9290
|
const localConfig = loadConfig();
|
|
9011
9291
|
const unattended = isUnattendedProcess(process.env);
|
|
9292
|
+
const repoRoot = repoRootSync();
|
|
9012
9293
|
return resolveLogDestinationFrom({
|
|
9013
9294
|
localConfig,
|
|
9014
|
-
trustAnchorConfig: unattended ? await processTrustAnchor() : null,
|
|
9295
|
+
trustAnchorConfig: unattended ? await processTrustAnchor(repoRoot) : null,
|
|
9015
9296
|
unattended,
|
|
9016
9297
|
env,
|
|
9017
9298
|
defaultFolder: join8(await runtimeDirForRepoAsync(repo), "logs"),
|
|
9018
|
-
repoRoot
|
|
9299
|
+
repoRoot
|
|
9300
|
+
});
|
|
9301
|
+
}
|
|
9302
|
+
function unresolvedLogDestination(env) {
|
|
9303
|
+
if (hostFromEnv(env) === "ci") {
|
|
9304
|
+
return {
|
|
9305
|
+
kind: "none",
|
|
9306
|
+
reason: "the process ended before its log destination was resolved, and a CI job never records to a folder"
|
|
9307
|
+
};
|
|
9308
|
+
}
|
|
9309
|
+
const loaded = loadConfig();
|
|
9310
|
+
const localConfig = loaded?.logs?.url !== undefined ? { ...loaded, logs: undefined } : loaded;
|
|
9311
|
+
const unattended = isUnattendedProcess(process.env);
|
|
9312
|
+
const repoRoot = repoRootSync();
|
|
9313
|
+
const runtimeDir = process.env[RUNTIME_DIR_ENV_KEY] || resolveRuntimeDir({ repo: null, localConfig, trustAnchorConfig: null, unattended, repoRoot });
|
|
9314
|
+
const defaultFolder = join8(runtimeDir, "logs");
|
|
9315
|
+
const resolved = resolveLogDestinationFrom({
|
|
9316
|
+
localConfig,
|
|
9317
|
+
trustAnchorConfig: null,
|
|
9318
|
+
unattended,
|
|
9319
|
+
env,
|
|
9320
|
+
defaultFolder,
|
|
9321
|
+
repoRoot
|
|
9019
9322
|
});
|
|
9323
|
+
return resolved.kind === "folder" ? resolved : { kind: "folder", folder: defaultFolder };
|
|
9324
|
+
}
|
|
9325
|
+
function folderFallbackStatePath(repo, stateRoot = GLOBAL_VINAYA_HOME) {
|
|
9326
|
+
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
9327
|
+
return join8(stateRoot, "fallback", `${dirName}.json`);
|
|
9328
|
+
}
|
|
9329
|
+
function recordFolderFallback(repo, issue, reason, now, runtimeDir, stateRoot = GLOBAL_VINAYA_HOME) {
|
|
9330
|
+
const message = describeFolderFallback(reason);
|
|
9331
|
+
if (issue !== null) {
|
|
9332
|
+
appendLoopLogLine(loopLogPathFor(repo, issue, runtimeDir), `[log] ${message}`);
|
|
9333
|
+
}
|
|
9334
|
+
try {
|
|
9335
|
+
const record = {
|
|
9336
|
+
at: now.toISOString(),
|
|
9337
|
+
reason: message,
|
|
9338
|
+
intendedUrl: reason.intendedUrl,
|
|
9339
|
+
kind: reason.kind
|
|
9340
|
+
};
|
|
9341
|
+
const path = folderFallbackStatePath(repo, stateRoot);
|
|
9342
|
+
mkdirSync4(dirname7(path), { recursive: true, mode: 448 });
|
|
9343
|
+
writeFileSync3(path, `${JSON.stringify(record)}
|
|
9344
|
+
`, { mode: 384 });
|
|
9345
|
+
} catch {}
|
|
9020
9346
|
}
|
|
9021
9347
|
function isEnoent2(err) {
|
|
9022
9348
|
return typeof err === "object" && err !== null && err.code === "ENOENT";
|
|
@@ -9130,7 +9456,7 @@ async function resolveBranchIssue(cwd, env = process.env, repo = null) {
|
|
|
9130
9456
|
}
|
|
9131
9457
|
function readVinayaVersion() {
|
|
9132
9458
|
try {
|
|
9133
|
-
const pkg = JSON.parse(
|
|
9459
|
+
const pkg = JSON.parse(readFileSync7(join8(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
9134
9460
|
return pkg.version ?? "unknown";
|
|
9135
9461
|
} catch {
|
|
9136
9462
|
return "unknown";
|
|
@@ -9168,6 +9494,7 @@ function defaultStderr(message) {
|
|
|
9168
9494
|
}
|
|
9169
9495
|
var branchIssueFallbackEnabled = true;
|
|
9170
9496
|
var branchIssueByCwd = new Map;
|
|
9497
|
+
var branchIssueSettledByCwd = new Map;
|
|
9171
9498
|
function branchIssueRead(key, read, shared) {
|
|
9172
9499
|
if (!shared)
|
|
9173
9500
|
return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
@@ -9176,8 +9503,30 @@ function branchIssueRead(key, read, shared) {
|
|
|
9176
9503
|
return cached;
|
|
9177
9504
|
const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9178
9505
|
branchIssueByCwd.set(key, reading);
|
|
9506
|
+
reading.then((value) => branchIssueSettledByCwd.set(key, value));
|
|
9179
9507
|
return reading;
|
|
9180
9508
|
}
|
|
9509
|
+
var headShaByCwd = new Map;
|
|
9510
|
+
var headShaSettledByCwd = new Map;
|
|
9511
|
+
function headShaRead(key, read, shared) {
|
|
9512
|
+
if (!shared)
|
|
9513
|
+
return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9514
|
+
const cached = headShaByCwd.get(key);
|
|
9515
|
+
if (cached !== undefined)
|
|
9516
|
+
return cached;
|
|
9517
|
+
const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9518
|
+
headShaByCwd.set(key, reading);
|
|
9519
|
+
reading.then((value) => headShaSettledByCwd.set(key, value));
|
|
9520
|
+
return reading;
|
|
9521
|
+
}
|
|
9522
|
+
async function resolveHeadSha(cwd) {
|
|
9523
|
+
try {
|
|
9524
|
+
const out = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "HEAD"], { encoding: "utf8" })).stdout.trim();
|
|
9525
|
+
return /^[0-9a-f]{40}$/.test(out) ? out : null;
|
|
9526
|
+
} catch {
|
|
9527
|
+
return null;
|
|
9528
|
+
}
|
|
9529
|
+
}
|
|
9181
9530
|
function defaultDeps() {
|
|
9182
9531
|
return {
|
|
9183
9532
|
outboxRoot: () => join8(GLOBAL_VINAYA_HOME, "outbox"),
|
|
@@ -9192,29 +9541,30 @@ function defaultDeps() {
|
|
|
9192
9541
|
inputVersions: () => {
|
|
9193
9542
|
return;
|
|
9194
9543
|
},
|
|
9195
|
-
resolveLogDestination: defaultResolveLogDestination
|
|
9544
|
+
resolveLogDestination: defaultResolveLogDestination,
|
|
9545
|
+
unresolvedLogDestination
|
|
9196
9546
|
};
|
|
9197
9547
|
}
|
|
9198
|
-
var APPEND_OPEN_FLAGS =
|
|
9548
|
+
var APPEND_OPEN_FLAGS = fsConstants4.O_WRONLY | fsConstants4.O_APPEND | fsConstants4.O_CREAT | fsConstants4.O_NOFOLLOW | fsConstants4.O_NONBLOCK;
|
|
9199
9549
|
function guardedAppendOpen(path) {
|
|
9200
9550
|
try {
|
|
9201
|
-
return
|
|
9551
|
+
return openSync4(path, APPEND_OPEN_FLAGS, 384);
|
|
9202
9552
|
} catch {
|
|
9203
9553
|
return;
|
|
9204
9554
|
}
|
|
9205
9555
|
}
|
|
9206
9556
|
function appendHardenedLine(path, line) {
|
|
9207
9557
|
try {
|
|
9208
|
-
|
|
9558
|
+
mkdirSync4(dirname7(path), { recursive: true, mode: 448 });
|
|
9209
9559
|
const fd = guardedAppendOpen(path);
|
|
9210
9560
|
if (fd === undefined)
|
|
9211
9561
|
return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
|
|
9212
9562
|
try {
|
|
9213
|
-
if (!
|
|
9563
|
+
if (!fstatSync3(fd).isFile())
|
|
9214
9564
|
return `target is not a regular file: ${path}`;
|
|
9215
|
-
|
|
9565
|
+
writeSync3(fd, line);
|
|
9216
9566
|
} finally {
|
|
9217
|
-
|
|
9567
|
+
closeSync4(fd);
|
|
9218
9568
|
}
|
|
9219
9569
|
return null;
|
|
9220
9570
|
} catch (err) {
|
|
@@ -9224,7 +9574,7 @@ function appendHardenedLine(path, line) {
|
|
|
9224
9574
|
function reportRotationOverflow(backupPath, warn) {
|
|
9225
9575
|
let raw;
|
|
9226
9576
|
try {
|
|
9227
|
-
raw =
|
|
9577
|
+
raw = readFileSync7(backupPath, "utf8");
|
|
9228
9578
|
} catch {
|
|
9229
9579
|
return;
|
|
9230
9580
|
}
|
|
@@ -9247,7 +9597,7 @@ function reportRotationOverflow(backupPath, warn) {
|
|
|
9247
9597
|
}
|
|
9248
9598
|
function appendLine(path, line, warn) {
|
|
9249
9599
|
try {
|
|
9250
|
-
|
|
9600
|
+
mkdirSync4(dirname7(path), { recursive: true, mode: 448 });
|
|
9251
9601
|
let fd = guardedAppendOpen(path);
|
|
9252
9602
|
if (fd === undefined) {
|
|
9253
9603
|
warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
|
|
@@ -9256,14 +9606,14 @@ function appendLine(path, line, warn) {
|
|
|
9256
9606
|
}
|
|
9257
9607
|
let closed = false;
|
|
9258
9608
|
try {
|
|
9259
|
-
const stat =
|
|
9609
|
+
const stat = fstatSync3(fd);
|
|
9260
9610
|
if (!stat.isFile()) {
|
|
9261
9611
|
warn(`vinaya: log outbox target is not a regular file — refusing to write: ${path}
|
|
9262
9612
|
`);
|
|
9263
9613
|
return;
|
|
9264
9614
|
}
|
|
9265
9615
|
if (stat.size > OUTBOX_MAX_BYTES) {
|
|
9266
|
-
|
|
9616
|
+
closeSync4(fd);
|
|
9267
9617
|
closed = true;
|
|
9268
9618
|
const backupPath = path.replace(/\.ndjson$/, ".1.ndjson");
|
|
9269
9619
|
reportRotationOverflow(backupPath, warn);
|
|
@@ -9277,10 +9627,10 @@ function appendLine(path, line, warn) {
|
|
|
9277
9627
|
fd = rotated;
|
|
9278
9628
|
closed = false;
|
|
9279
9629
|
}
|
|
9280
|
-
|
|
9630
|
+
writeSync3(fd, line);
|
|
9281
9631
|
} finally {
|
|
9282
9632
|
if (!closed)
|
|
9283
|
-
|
|
9633
|
+
closeSync4(fd);
|
|
9284
9634
|
}
|
|
9285
9635
|
} catch (err) {
|
|
9286
9636
|
warn(`vinaya: log outbox write failed — ${err instanceof Error ? err.message : String(err)}
|
|
@@ -9291,12 +9641,14 @@ function createLogSink(overrides = {}) {
|
|
|
9291
9641
|
const deps = {
|
|
9292
9642
|
...defaultDeps(),
|
|
9293
9643
|
resolveBranchIssue: (repo) => resolveBranchIssue(deps.cwd(), deps.env(), repo),
|
|
9644
|
+
resolveHeadSha: () => resolveHeadSha(deps.cwd()),
|
|
9294
9645
|
...overrides
|
|
9295
9646
|
};
|
|
9296
9647
|
const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
|
|
9297
9648
|
const processId = randomUUID2();
|
|
9298
9649
|
let seq = 0;
|
|
9299
9650
|
let warned = false;
|
|
9651
|
+
let folderFallbackRecorded = false;
|
|
9300
9652
|
const warnOnce = (message) => {
|
|
9301
9653
|
if (warned)
|
|
9302
9654
|
return;
|
|
@@ -9314,6 +9666,7 @@ function createLogSink(overrides = {}) {
|
|
|
9314
9666
|
};
|
|
9315
9667
|
const readerIsReal = overrides.resolveBranchIssue === undefined;
|
|
9316
9668
|
let ownBranchIssue;
|
|
9669
|
+
let ownBranchIssueSettled = null;
|
|
9317
9670
|
const branchIssueOnce = (repo) => {
|
|
9318
9671
|
if (!branchIssueFallbackEnabled)
|
|
9319
9672
|
return Promise.resolve(null);
|
|
@@ -9321,10 +9674,36 @@ function createLogSink(overrides = {}) {
|
|
|
9321
9674
|
const read = () => deps.resolveBranchIssue(slug);
|
|
9322
9675
|
if (readerIsReal)
|
|
9323
9676
|
return branchIssueRead(`${deps.cwd()}\x00${slug ?? ""}`, read, true);
|
|
9324
|
-
if (ownBranchIssue === undefined)
|
|
9677
|
+
if (ownBranchIssue === undefined) {
|
|
9325
9678
|
ownBranchIssue = branchIssueRead(deps.cwd(), read, false);
|
|
9679
|
+
ownBranchIssue.then((value) => {
|
|
9680
|
+
ownBranchIssueSettled = value;
|
|
9681
|
+
});
|
|
9682
|
+
}
|
|
9326
9683
|
return ownBranchIssue;
|
|
9327
9684
|
};
|
|
9685
|
+
const branchIssueIfSettled = (repo) => {
|
|
9686
|
+
if (!branchIssueFallbackEnabled)
|
|
9687
|
+
return null;
|
|
9688
|
+
if (!readerIsReal)
|
|
9689
|
+
return ownBranchIssueSettled;
|
|
9690
|
+
return branchIssueSettledByCwd.get(`${deps.cwd()}\x00${safeRepoSlug(repo) ?? ""}`) ?? null;
|
|
9691
|
+
};
|
|
9692
|
+
const headShaReaderIsReal = overrides.resolveHeadSha === undefined;
|
|
9693
|
+
let ownHeadSha;
|
|
9694
|
+
let ownHeadShaSettled = null;
|
|
9695
|
+
const headShaOnce = () => {
|
|
9696
|
+
if (headShaReaderIsReal)
|
|
9697
|
+
return headShaRead(deps.cwd(), deps.resolveHeadSha, true);
|
|
9698
|
+
if (ownHeadSha === undefined) {
|
|
9699
|
+
ownHeadSha = headShaRead(deps.cwd(), deps.resolveHeadSha, false);
|
|
9700
|
+
ownHeadSha.then((value) => {
|
|
9701
|
+
ownHeadShaSettled = value;
|
|
9702
|
+
});
|
|
9703
|
+
}
|
|
9704
|
+
return ownHeadSha;
|
|
9705
|
+
};
|
|
9706
|
+
const headShaIfSettled = () => headShaReaderIsReal ? headShaSettledByCwd.get(deps.cwd()) ?? null : ownHeadShaSettled;
|
|
9328
9707
|
let resolveRepoCache;
|
|
9329
9708
|
const resolveRepoOnce = () => {
|
|
9330
9709
|
if (resolveRepoCache === undefined)
|
|
@@ -9332,6 +9711,7 @@ function createLogSink(overrides = {}) {
|
|
|
9332
9711
|
return resolveRepoCache;
|
|
9333
9712
|
};
|
|
9334
9713
|
let contextCache;
|
|
9714
|
+
let settledContext;
|
|
9335
9715
|
const context = () => {
|
|
9336
9716
|
if (contextCache === undefined) {
|
|
9337
9717
|
const env = deps.env();
|
|
@@ -9340,11 +9720,16 @@ function createLogSink(overrides = {}) {
|
|
|
9340
9720
|
doctrine()
|
|
9341
9721
|
]).then(async ([resolved, doctrineValue]) => {
|
|
9342
9722
|
const repo = resolved && isSafeRepoSegment3(resolved.owner) && isSafeRepoSegment3(resolved.repo) ? resolved : null;
|
|
9343
|
-
|
|
9723
|
+
settledContext = { repo, doctrine: doctrineValue, destination: await deps.resolveLogDestination(repo, env) };
|
|
9724
|
+
return settledContext;
|
|
9344
9725
|
});
|
|
9345
9726
|
}
|
|
9346
9727
|
return contextCache;
|
|
9347
9728
|
};
|
|
9729
|
+
const resetContext = () => {
|
|
9730
|
+
contextCache = undefined;
|
|
9731
|
+
settledContext = undefined;
|
|
9732
|
+
};
|
|
9348
9733
|
let drainChain = Promise.resolve();
|
|
9349
9734
|
const pendingWrites = new Set;
|
|
9350
9735
|
let writeChain = Promise.resolve();
|
|
@@ -9356,63 +9741,88 @@ function createLogSink(overrides = {}) {
|
|
|
9356
9741
|
`);
|
|
9357
9742
|
});
|
|
9358
9743
|
};
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9744
|
+
const snapshot = () => {
|
|
9745
|
+
const env = deps.env();
|
|
9746
|
+
return {
|
|
9747
|
+
host: hostFromEnv(env),
|
|
9748
|
+
now: deps.now(),
|
|
9749
|
+
seq: seq++,
|
|
9750
|
+
envFields: {
|
|
9366
9751
|
role: env.VINAYA_ROLE,
|
|
9367
9752
|
task: env.VINAYA_TASK,
|
|
9368
9753
|
round: env.VINAYA_ROUND,
|
|
9754
|
+
pr: env.VINAYA_PR,
|
|
9369
9755
|
run: env.VINAYA_RUN || runId,
|
|
9370
9756
|
attempt: env.VINAYA_ATTEMPT,
|
|
9371
|
-
parent: env.VINAYA_PARENT_EVENT
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9757
|
+
parent: env.VINAYA_PARENT_EVENT,
|
|
9758
|
+
workRef: env.VINAYA_WORK_REF,
|
|
9759
|
+
flow: env.VINAYA_FLOW,
|
|
9760
|
+
flowVersion: env.VINAYA_FLOW_VERSION,
|
|
9761
|
+
runtime: env.VINAYA_RUNTIME,
|
|
9762
|
+
source: env.VINAYA_SOURCE
|
|
9763
|
+
}
|
|
9764
|
+
};
|
|
9765
|
+
};
|
|
9766
|
+
const writeEvent = (e, call, ctx, branchIssue, headSha, deliver) => {
|
|
9767
|
+
const { repo, doctrine: doctrineValue, destination } = ctx;
|
|
9768
|
+
if (destination.kind === "none") {
|
|
9769
|
+
warnOnce(`vinaya: not recording — ${destination.reason}
|
|
9377
9770
|
`);
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9771
|
+
return;
|
|
9772
|
+
}
|
|
9773
|
+
if (destination.kind === "folder" && destination.fallbackReason) {
|
|
9774
|
+
warnOnce(`vinaya: ${describeFolderFallback(destination.fallbackReason)}
|
|
9382
9775
|
`);
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
|
|
9776
|
+
}
|
|
9777
|
+
const built = buildHeader({
|
|
9778
|
+
now: call.now,
|
|
9779
|
+
runId,
|
|
9780
|
+
seq: call.seq,
|
|
9781
|
+
repo: repo ? `${repo.owner}/${repo.repo}` : null,
|
|
9782
|
+
vinaya: deps.vinayaVersion(),
|
|
9783
|
+
doctrine: doctrineValue,
|
|
9784
|
+
host: call.host,
|
|
9785
|
+
hostname: deps.hostname(),
|
|
9786
|
+
env: call.envFields,
|
|
9787
|
+
branchIssue,
|
|
9788
|
+
eventId: randomUUID2(),
|
|
9789
|
+
processId,
|
|
9790
|
+
inputVersions: deps.inputVersions()
|
|
9791
|
+
});
|
|
9792
|
+
const header = headSha === null ? built : { ...built, subject: { ...built.subject, sha: headSha } };
|
|
9793
|
+
if (destination.kind === "folder" && destination.fallbackReason && !folderFallbackRecorded) {
|
|
9794
|
+
folderFallbackRecorded = true;
|
|
9795
|
+
recordFolderFallback(repo, header.subject.issue, destination.fallbackReason, call.now, dirname7(destination.folder), join8(deps.home(), ".vinaya"));
|
|
9796
|
+
}
|
|
9797
|
+
const full = { ...e, ...header };
|
|
9798
|
+
const parsed = LogEventSchema.safeParse(full);
|
|
9799
|
+
if (!parsed.success) {
|
|
9800
|
+
warnOnce(`vinaya: log() refused an invalid payload — ${parsed.error.issues[0]?.message ?? "schema violation"}
|
|
9404
9801
|
`);
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
|
|
9802
|
+
return;
|
|
9803
|
+
}
|
|
9804
|
+
const line = `${JSON.stringify(redact(parsed.data, deps.home()))}
|
|
9408
9805
|
`;
|
|
9409
|
-
|
|
9410
|
-
|
|
9411
|
-
|
|
9412
|
-
|
|
9413
|
-
|
|
9414
|
-
|
|
9806
|
+
if (destination.kind === "server") {
|
|
9807
|
+
appendLine(outboxPathFor(deps, repo, header.subject.issue), line, warnOnce);
|
|
9808
|
+
if (deliver)
|
|
9809
|
+
scheduleWebhookDrain(header.subject.issue, destination.url, destination.headers);
|
|
9810
|
+
} else {
|
|
9811
|
+
appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
|
|
9812
|
+
}
|
|
9813
|
+
};
|
|
9814
|
+
function log(e) {
|
|
9815
|
+
try {
|
|
9816
|
+
const call = snapshot();
|
|
9817
|
+
const write = async () => {
|
|
9818
|
+
const ctx = await context();
|
|
9819
|
+
if (ctx.destination.kind === "none") {
|
|
9820
|
+
writeEvent(e, call, ctx, null, null, true);
|
|
9821
|
+
return;
|
|
9415
9822
|
}
|
|
9823
|
+
const branchIssue = call.envFields.task ? null : await branchIssueOnce(ctx.repo);
|
|
9824
|
+
const headSha = e.kind === "gate" ? await headShaOnce() : null;
|
|
9825
|
+
writeEvent(e, call, ctx, branchIssue, headSha, true);
|
|
9416
9826
|
};
|
|
9417
9827
|
const written = writeChain.then(write).catch((err) => {
|
|
9418
9828
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
@@ -9423,6 +9833,26 @@ function createLogSink(overrides = {}) {
|
|
|
9423
9833
|
written.finally(() => pendingWrites.delete(written));
|
|
9424
9834
|
} catch (err) {
|
|
9425
9835
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
9836
|
+
`);
|
|
9837
|
+
}
|
|
9838
|
+
}
|
|
9839
|
+
function logSync(e, opts = {}) {
|
|
9840
|
+
try {
|
|
9841
|
+
const call = snapshot();
|
|
9842
|
+
let ctx = settledContext;
|
|
9843
|
+
if (ctx === undefined) {
|
|
9844
|
+
const destination = deps.unresolvedLogDestination(deps.env());
|
|
9845
|
+
if (destination.kind === "folder" && !opts.quiet) {
|
|
9846
|
+
warnOnce(`vinaya: the process ended before its log destination was resolved — the event is written to ${destination.folder}; \`vinaya log send\` delivers it to a configured server later
|
|
9847
|
+
`);
|
|
9848
|
+
}
|
|
9849
|
+
ctx = { repo: null, doctrine: "unknown", destination };
|
|
9850
|
+
}
|
|
9851
|
+
const branchIssue = ctx.destination.kind === "none" || call.envFields.task ? null : branchIssueIfSettled(ctx.repo);
|
|
9852
|
+
const headSha = e.kind === "gate" && ctx.destination.kind !== "none" ? headShaIfSettled() : null;
|
|
9853
|
+
writeEvent(e, call, ctx, branchIssue, headSha, false);
|
|
9854
|
+
} catch (err) {
|
|
9855
|
+
warnOnce(`vinaya: logSync() failed — ${err instanceof Error ? err.message : String(err)}
|
|
9426
9856
|
`);
|
|
9427
9857
|
}
|
|
9428
9858
|
}
|
|
@@ -9443,7 +9873,7 @@ function createLogSink(overrides = {}) {
|
|
|
9443
9873
|
return;
|
|
9444
9874
|
});
|
|
9445
9875
|
};
|
|
9446
|
-
return { log, runId, warmup, drain };
|
|
9876
|
+
return { log, logSync, runId, warmup, drain, resetContext };
|
|
9447
9877
|
}
|
|
9448
9878
|
var defaultSink = createLogSink();
|
|
9449
9879
|
|
|
@@ -9576,7 +10006,7 @@ function findingsInThisDiff(findings) {
|
|
|
9576
10006
|
const abs = resolve2(diff.root, f.file);
|
|
9577
10007
|
if (!changed.has(abs))
|
|
9578
10008
|
return false;
|
|
9579
|
-
const relPath =
|
|
10009
|
+
const relPath = relative2(diff.root, abs);
|
|
9580
10010
|
if (!ranges.has(relPath))
|
|
9581
10011
|
ranges.set(relPath, changedLineRanges(diff.base, relPath));
|
|
9582
10012
|
const fileRanges = ranges.get(relPath) ?? null;
|
|
@@ -9671,7 +10101,7 @@ function toPosix(p) {
|
|
|
9671
10101
|
}
|
|
9672
10102
|
function readPackageJson(path) {
|
|
9673
10103
|
try {
|
|
9674
|
-
const parsed = JSON.parse(
|
|
10104
|
+
const parsed = JSON.parse(readFileSync8(path, "utf8"));
|
|
9675
10105
|
return parsed && typeof parsed === "object" ? parsed : null;
|
|
9676
10106
|
} catch {
|
|
9677
10107
|
return null;
|
|
@@ -9741,7 +10171,7 @@ function main() {
|
|
|
9741
10171
|
if (changedAbs.length === 0) {
|
|
9742
10172
|
process.exit(0);
|
|
9743
10173
|
}
|
|
9744
|
-
const changedFiles = changedAbs.map((p) => toPosix(
|
|
10174
|
+
const changedFiles = changedAbs.map((p) => toPosix(relative3(root, p)));
|
|
9745
10175
|
const branch = git2(["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
9746
10176
|
const isReleaseBranch = branch === CHANGESET_RELEASE_BRANCH;
|
|
9747
10177
|
const workspaceMembers = resolveWorkspaceMembers(root);
|