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