@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
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/lib/pre-push-cache-test-run.ts
|
|
4
|
-
import { readFileSync as
|
|
4
|
+
import { readFileSync as readFileSync9 } from "node:fs";
|
|
5
5
|
|
|
6
6
|
// src/lib/pr-report-engine.ts
|
|
7
7
|
import { execFile as execFile6 } from "node:child_process";
|
|
8
8
|
import { createHash as createHash2, randomUUID as randomUUID3 } from "node:crypto";
|
|
9
9
|
import {
|
|
10
|
-
closeSync as
|
|
11
|
-
constants as
|
|
10
|
+
closeSync as closeSync6,
|
|
11
|
+
constants as fsConstants6,
|
|
12
12
|
existsSync as existsSync8,
|
|
13
13
|
fsyncSync as fsyncSync2,
|
|
14
|
-
lstatSync as
|
|
14
|
+
lstatSync as lstatSync4,
|
|
15
15
|
mkdtempSync,
|
|
16
|
-
openSync as
|
|
17
|
-
readFileSync as
|
|
16
|
+
openSync as openSync6,
|
|
17
|
+
readFileSync as readFileSync8,
|
|
18
18
|
renameSync as renameSync4,
|
|
19
19
|
rmSync,
|
|
20
|
-
writeFileSync as
|
|
21
|
-
writeSync as
|
|
20
|
+
writeFileSync as writeFileSync4,
|
|
21
|
+
writeSync as writeSync5
|
|
22
22
|
} from "node:fs";
|
|
23
23
|
import { hostname, tmpdir } from "node:os";
|
|
24
|
-
import { dirname as
|
|
24
|
+
import { dirname as dirname8, join as join9, resolve as resolvePath2 } from "node:path";
|
|
25
25
|
import { promisify as promisify6 } from "node:util";
|
|
26
26
|
// ../../packages/aeg-forge-state/src/gh.ts
|
|
27
27
|
import { execFile, execFileSync } from "node:child_process";
|
|
@@ -677,7 +677,6 @@ var TaskPrPauseSchema = z.object({
|
|
|
677
677
|
var TaskPrReviewRecordSchema = z.object({
|
|
678
678
|
verdicts: z.array(TaskPrVerdictSchema),
|
|
679
679
|
roundMarkers: z.array(z.number().int().nonnegative()),
|
|
680
|
-
summaryTable: z.string().nullable(),
|
|
681
680
|
pause: TaskPrPauseSchema.nullable()
|
|
682
681
|
});
|
|
683
682
|
var TaskPrReadInputSchema = z.object({
|
|
@@ -724,25 +723,69 @@ var TaskCancelResultSchema = z.object({
|
|
|
724
723
|
authenticatedFrom: z.string().min(1),
|
|
725
724
|
fencedEffectKeys: z.array(z.string())
|
|
726
725
|
});
|
|
727
|
-
var TASK_TOOL_NAMES = [
|
|
728
|
-
"task_start",
|
|
729
|
-
"task_status",
|
|
730
|
-
"task_escalation_read",
|
|
731
|
-
"task_pr_read",
|
|
732
|
-
"task_resume",
|
|
733
|
-
"task_cancel"
|
|
734
|
-
];
|
|
735
|
-
var OPERATOR_STATUS_FOLLOW = "task_status_follow";
|
|
736
|
-
var OPERATOR_TOOL_GRANT = [...TASK_TOOL_NAMES, OPERATOR_STATUS_FOLLOW];
|
|
737
|
-
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
738
|
-
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
739
|
-
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
740
|
-
var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
|
|
741
|
-
// ../../packages/aeg-core/src/log/envelope.ts
|
|
742
|
-
import { createHash } from "node:crypto";
|
|
743
|
-
|
|
744
726
|
// ../../packages/aeg-core/src/log/schema.ts
|
|
727
|
+
import { z as z3 } from "zod";
|
|
728
|
+
|
|
729
|
+
// ../../packages/aeg-core/src/log/custom.ts
|
|
745
730
|
import { z as z2 } from "zod";
|
|
731
|
+
var CUSTOM_EVENT_NAME_PATTERN = /^[a-z][a-z0-9_]*\.[a-z][a-z0-9_.]*$/;
|
|
732
|
+
var CUSTOM_EVENT_NAME_MAX_LENGTH = 64;
|
|
733
|
+
var CUSTOM_EVENT_RESERVED_NAMESPACE = "vinaya";
|
|
734
|
+
var CUSTOM_EVENT_MAX_FIELDS = 20;
|
|
735
|
+
var CUSTOM_FIELD_NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
736
|
+
var CUSTOM_FIELD_NAME_MAX_LENGTH = 64;
|
|
737
|
+
var CUSTOM_TEXT_MAX_LENGTH = 500;
|
|
738
|
+
var CUSTOM_WORD_PATTERN = /^[a-z0-9][a-z0-9_-]*$/;
|
|
739
|
+
var CUSTOM_WORD_MAX_LENGTH = 64;
|
|
740
|
+
var CUSTOM_FIELD_MAX_WORDS = 50;
|
|
741
|
+
var CustomFieldTypeSchema = z2.union([z2.enum(["text", "number", "boolean"]), z2.array(z2.string())]);
|
|
742
|
+
var CustomEventDeclarationsSchema = z2.record(z2.string(), z2.object({
|
|
743
|
+
fields: z2.record(z2.string(), CustomFieldTypeSchema)
|
|
744
|
+
}).strict()).superRefine((events, ctx) => {
|
|
745
|
+
for (const [name, declaration] of Object.entries(events)) {
|
|
746
|
+
const refuse = (message, path = []) => {
|
|
747
|
+
ctx.addIssue({
|
|
748
|
+
code: z2.ZodIssueCode.custom,
|
|
749
|
+
path: [name, ...path],
|
|
750
|
+
message: `logs.events "${name}": ${message}`
|
|
751
|
+
});
|
|
752
|
+
};
|
|
753
|
+
if (name.length > CUSTOM_EVENT_NAME_MAX_LENGTH) {
|
|
754
|
+
refuse(`the name must be at most ${CUSTOM_EVENT_NAME_MAX_LENGTH} characters`);
|
|
755
|
+
}
|
|
756
|
+
if (!CUSTOM_EVENT_NAME_PATTERN.test(name)) {
|
|
757
|
+
refuse("the name must be `<namespace>.<event>` — lowercase letters, digits and `_`, a dot between them");
|
|
758
|
+
} else if (name.split(".")[0] === CUSTOM_EVENT_RESERVED_NAMESPACE) {
|
|
759
|
+
refuse(`the \`${CUSTOM_EVENT_RESERVED_NAMESPACE}.\` namespace is reserved for Vinaya's own events`);
|
|
760
|
+
}
|
|
761
|
+
const fieldEntries = Object.entries(declaration.fields);
|
|
762
|
+
if (fieldEntries.length > CUSTOM_EVENT_MAX_FIELDS) {
|
|
763
|
+
refuse(`at most ${CUSTOM_EVENT_MAX_FIELDS} fields may be declared (found ${fieldEntries.length})`, ["fields"]);
|
|
764
|
+
}
|
|
765
|
+
for (const [field, type] of fieldEntries) {
|
|
766
|
+
if (field.length > CUSTOM_FIELD_NAME_MAX_LENGTH || !CUSTOM_FIELD_NAME_PATTERN.test(field)) {
|
|
767
|
+
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]);
|
|
768
|
+
}
|
|
769
|
+
if (typeof type === "string")
|
|
770
|
+
continue;
|
|
771
|
+
if (type.length === 0) {
|
|
772
|
+
refuse(`field "${field}": a list of words must name at least one word`, ["fields", field]);
|
|
773
|
+
}
|
|
774
|
+
if (type.length > CUSTOM_FIELD_MAX_WORDS) {
|
|
775
|
+
refuse(`field "${field}": a list of words may name at most ${CUSTOM_FIELD_MAX_WORDS}`, ["fields", field]);
|
|
776
|
+
}
|
|
777
|
+
const bad = type.filter((w) => w.length > CUSTOM_WORD_MAX_LENGTH || !CUSTOM_WORD_PATTERN.test(w));
|
|
778
|
+
if (bad.length > 0) {
|
|
779
|
+
refuse(`field "${field}": a listed word is lowercase letters, digits, \`_\` and \`-\`, at most ${CUSTOM_WORD_MAX_LENGTH} characters`, ["fields", field]);
|
|
780
|
+
}
|
|
781
|
+
if (new Set(type).size !== type.length) {
|
|
782
|
+
refuse(`field "${field}": a list of words names a word twice`, ["fields", field]);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
});
|
|
787
|
+
|
|
788
|
+
// ../../packages/aeg-core/src/log/schema.ts
|
|
746
789
|
var CONFIDENCE_REASON_MAX_LENGTH = 280;
|
|
747
790
|
var ROLE_VALUES = [
|
|
748
791
|
"planner",
|
|
@@ -753,178 +796,210 @@ var ROLE_VALUES = [
|
|
|
753
796
|
"archivist",
|
|
754
797
|
"architect"
|
|
755
798
|
];
|
|
756
|
-
var RoleSchema =
|
|
799
|
+
var RoleSchema = z3.enum(ROLE_VALUES);
|
|
757
800
|
var HOST_VALUES = ["hook", "ci", "cli", "loop"];
|
|
758
|
-
var HostSchema =
|
|
801
|
+
var HostSchema = z3.enum(HOST_VALUES);
|
|
759
802
|
var RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
|
|
760
803
|
var headerMetaCore = {
|
|
761
|
-
ts:
|
|
762
|
-
run_id:
|
|
763
|
-
seq:
|
|
764
|
-
repo:
|
|
765
|
-
vinaya:
|
|
766
|
-
doctrine:
|
|
804
|
+
ts: z3.string(),
|
|
805
|
+
run_id: z3.string().regex(RUN_ID_PATTERN),
|
|
806
|
+
seq: z3.number().int().nonnegative(),
|
|
807
|
+
repo: z3.string().nullable(),
|
|
808
|
+
vinaya: z3.string(),
|
|
809
|
+
doctrine: z3.string(),
|
|
767
810
|
host: HostSchema,
|
|
768
|
-
machine:
|
|
811
|
+
machine: z3.string()
|
|
769
812
|
};
|
|
770
|
-
var HeaderMetaV1Schema =
|
|
771
|
-
schema:
|
|
813
|
+
var HeaderMetaV1Schema = z3.object({
|
|
814
|
+
schema: z3.literal(1),
|
|
772
815
|
...headerMetaCore
|
|
773
816
|
}).strict();
|
|
774
|
-
var LineageSchema =
|
|
775
|
-
run:
|
|
776
|
-
attempt:
|
|
777
|
-
parent:
|
|
817
|
+
var LineageSchema = z3.object({
|
|
818
|
+
run: z3.string().nullable(),
|
|
819
|
+
attempt: z3.number().int().nullable(),
|
|
820
|
+
parent: z3.string().nullable()
|
|
778
821
|
}).strict();
|
|
779
|
-
var InputVersionsSchema =
|
|
780
|
-
objectives_version:
|
|
781
|
-
brief_hash:
|
|
782
|
-
ruling_ordinal:
|
|
783
|
-
policy_digest:
|
|
822
|
+
var InputVersionsSchema = z3.object({
|
|
823
|
+
objectives_version: z3.string().nullable(),
|
|
824
|
+
brief_hash: z3.string().nullable(),
|
|
825
|
+
ruling_ordinal: z3.number().int().nullable(),
|
|
826
|
+
policy_digest: z3.string().nullable()
|
|
784
827
|
}).strict();
|
|
785
|
-
var ProvenanceSchema =
|
|
786
|
-
var HeaderMetaV2Schema =
|
|
787
|
-
schema:
|
|
828
|
+
var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
|
|
829
|
+
var HeaderMetaV2Schema = z3.object({
|
|
830
|
+
schema: z3.literal(2),
|
|
788
831
|
...headerMetaCore,
|
|
789
|
-
event_id:
|
|
790
|
-
process_id:
|
|
791
|
-
actor_id:
|
|
832
|
+
event_id: z3.string().min(1),
|
|
833
|
+
process_id: z3.string().min(1),
|
|
834
|
+
actor_id: z3.string().nullable(),
|
|
792
835
|
lineage: LineageSchema,
|
|
793
836
|
input_versions: InputVersionsSchema,
|
|
794
837
|
provenance: ProvenanceSchema
|
|
795
838
|
}).strict();
|
|
796
|
-
var
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
839
|
+
var WorkSchema = z3.object({
|
|
840
|
+
ref: z3.string().nullable(),
|
|
841
|
+
repo: z3.string().nullable(),
|
|
842
|
+
change: z3.string().nullable(),
|
|
843
|
+
revision: z3.string().nullable()
|
|
844
|
+
}).strict();
|
|
845
|
+
var FlowSchema = z3.object({
|
|
846
|
+
id: z3.string().nullable(),
|
|
847
|
+
version: z3.string().nullable()
|
|
848
|
+
}).strict();
|
|
849
|
+
var HeaderMetaV3Schema = z3.object({
|
|
850
|
+
schema: z3.literal(3),
|
|
851
|
+
...headerMetaCore,
|
|
852
|
+
event_id: z3.string().min(1),
|
|
853
|
+
process_id: z3.string().min(1),
|
|
854
|
+
actor_id: z3.string().nullable(),
|
|
855
|
+
lineage: LineageSchema,
|
|
856
|
+
input_versions: InputVersionsSchema,
|
|
857
|
+
provenance: ProvenanceSchema,
|
|
858
|
+
work: WorkSchema,
|
|
859
|
+
flow: FlowSchema,
|
|
860
|
+
runtime: z3.string().nullable(),
|
|
861
|
+
source: z3.string().nullable()
|
|
862
|
+
}).strict();
|
|
863
|
+
var HeaderMetaSchema = z3.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema, HeaderMetaV3Schema]);
|
|
864
|
+
var SubjectSchema = z3.object({
|
|
865
|
+
issue: z3.number().int().nullable(),
|
|
866
|
+
pr: z3.number().int().optional(),
|
|
867
|
+
sha: z3.string().optional(),
|
|
868
|
+
role: z3.union([RoleSchema, z3.literal("unattributed")]),
|
|
869
|
+
round: z3.number().int().optional(),
|
|
870
|
+
objectives_version: z3.string().optional()
|
|
804
871
|
}).strict();
|
|
805
|
-
var HeaderSchema =
|
|
872
|
+
var HeaderSchema = z3.object({
|
|
806
873
|
meta: HeaderMetaSchema,
|
|
807
874
|
subject: SubjectSchema
|
|
808
875
|
}).strict();
|
|
809
876
|
var envelopeTail = {
|
|
810
|
-
duration_ms:
|
|
811
|
-
payload:
|
|
877
|
+
duration_ms: z3.number().nonnegative().optional(),
|
|
878
|
+
payload: z3.object({}).strict()
|
|
812
879
|
};
|
|
813
|
-
var ReviewFindingSchema =
|
|
814
|
-
id:
|
|
815
|
-
severity:
|
|
816
|
-
state:
|
|
817
|
-
severity_scale:
|
|
818
|
-
policy_treatment:
|
|
819
|
-
confidence:
|
|
820
|
-
confidence_scale:
|
|
821
|
-
confidence_source:
|
|
880
|
+
var ReviewFindingSchema = z3.object({
|
|
881
|
+
id: z3.string(),
|
|
882
|
+
severity: z3.string(),
|
|
883
|
+
state: z3.string().optional(),
|
|
884
|
+
severity_scale: z3.string().optional(),
|
|
885
|
+
policy_treatment: z3.enum(["blocking", "non_blocking", "unavailable"]).optional(),
|
|
886
|
+
confidence: z3.number().min(0).max(1).optional(),
|
|
887
|
+
confidence_scale: z3.string().optional(),
|
|
888
|
+
confidence_source: z3.string().optional()
|
|
822
889
|
}).strict();
|
|
823
|
-
var DispatchOutcomeSchema =
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
type:
|
|
827
|
-
pr:
|
|
828
|
-
head:
|
|
829
|
-
comment_id:
|
|
890
|
+
var DispatchOutcomeSchema = z3.discriminatedUnion("type", [
|
|
891
|
+
z3.object({ type: z3.literal("pr_opened"), pr: z3.number().int(), head: z3.string() }).strict(),
|
|
892
|
+
z3.object({
|
|
893
|
+
type: z3.literal("round_pushed"),
|
|
894
|
+
pr: z3.number().int(),
|
|
895
|
+
head: z3.string(),
|
|
896
|
+
comment_id: z3.number().int()
|
|
830
897
|
}).strict(),
|
|
831
|
-
|
|
832
|
-
type:
|
|
833
|
-
verdict:
|
|
834
|
-
head:
|
|
835
|
-
comment_id:
|
|
836
|
-
objectives:
|
|
837
|
-
findings:
|
|
898
|
+
z3.object({
|
|
899
|
+
type: z3.literal("verdict"),
|
|
900
|
+
verdict: z3.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
|
|
901
|
+
head: z3.string(),
|
|
902
|
+
comment_id: z3.number().int(),
|
|
903
|
+
objectives: z3.array(z3.object({ id: z3.string(), met: z3.boolean() }).strict()),
|
|
904
|
+
findings: z3.array(ReviewFindingSchema)
|
|
838
905
|
}).strict(),
|
|
839
|
-
|
|
840
|
-
type:
|
|
841
|
-
class:
|
|
842
|
-
comment_id:
|
|
906
|
+
z3.object({
|
|
907
|
+
type: z3.literal("escalation"),
|
|
908
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
909
|
+
comment_id: z3.number().int()
|
|
843
910
|
}).strict(),
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
911
|
+
z3.object({ type: z3.literal("brief"), comment_id: z3.number().int(), hash: z3.string() }).strict(),
|
|
912
|
+
z3.object({ type: z3.literal("plan"), issues: z3.array(z3.number().int()) }).strict(),
|
|
913
|
+
z3.object({ type: z3.literal("archive"), provenance_comment_id: z3.number().int() }).strict(),
|
|
914
|
+
z3.object({ type: z3.literal("completed") }).strict()
|
|
848
915
|
]);
|
|
849
916
|
var dispatchShared = {
|
|
850
917
|
meta: HeaderMetaSchema,
|
|
851
918
|
subject: SubjectSchema,
|
|
852
|
-
kind:
|
|
919
|
+
kind: z3.literal("dispatch"),
|
|
853
920
|
...envelopeTail,
|
|
854
921
|
target_role: RoleSchema,
|
|
855
|
-
model:
|
|
856
|
-
round:
|
|
857
|
-
effect_id:
|
|
922
|
+
model: z3.string(),
|
|
923
|
+
round: z3.number().int().optional(),
|
|
924
|
+
effect_id: z3.string()
|
|
858
925
|
};
|
|
859
|
-
var dispatchUsageField =
|
|
860
|
-
var DispatchEventSchema =
|
|
861
|
-
|
|
862
|
-
|
|
926
|
+
var dispatchUsageField = z3.object({ input: z3.number().nonnegative(), output: z3.number().nonnegative() }).strict().nullable();
|
|
927
|
+
var DispatchEventSchema = z3.discriminatedUnion("event", [
|
|
928
|
+
z3.object({ ...dispatchShared, event: z3.literal("dispatched"), prompt_hash: z3.string() }).strict(),
|
|
929
|
+
z3.object({
|
|
863
930
|
...dispatchShared,
|
|
864
|
-
event:
|
|
931
|
+
event: z3.literal("outcome_received"),
|
|
865
932
|
outcome: DispatchOutcomeSchema,
|
|
866
933
|
usage: dispatchUsageField
|
|
867
934
|
}).strict(),
|
|
868
|
-
|
|
935
|
+
z3.object({
|
|
869
936
|
...dispatchShared,
|
|
870
|
-
event:
|
|
871
|
-
reason:
|
|
937
|
+
event: z3.literal("dispatch_failed"),
|
|
938
|
+
reason: z3.enum(["timeout", "crash", "refused", "unattributed_write"]),
|
|
872
939
|
usage: dispatchUsageField
|
|
873
940
|
}).strict()
|
|
874
941
|
]);
|
|
942
|
+
var CODE_TOKEN_PATTERN = /^[A-Za-z0-9._-]{1,64}$/;
|
|
943
|
+
var CodeTokenSchema = z3.string().regex(CODE_TOKEN_PATTERN);
|
|
944
|
+
var ReviewerVerdictSchema = z3.object({
|
|
945
|
+
role: RoleSchema,
|
|
946
|
+
outcome: z3.enum(["approve", "changes_requested", "not_reviewed"]),
|
|
947
|
+
blockers: z3.number().int().nonnegative()
|
|
948
|
+
}).strict();
|
|
875
949
|
var loopShared = {
|
|
876
950
|
meta: HeaderMetaSchema,
|
|
877
951
|
subject: SubjectSchema,
|
|
878
|
-
kind:
|
|
952
|
+
kind: z3.literal("dev_review_loop"),
|
|
879
953
|
...envelopeTail,
|
|
880
|
-
loop_id:
|
|
954
|
+
loop_id: z3.string()
|
|
881
955
|
};
|
|
882
|
-
var DevReviewLoopEventSchema =
|
|
883
|
-
|
|
956
|
+
var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
|
|
957
|
+
z3.object({
|
|
884
958
|
...loopShared,
|
|
885
|
-
event:
|
|
886
|
-
task:
|
|
887
|
-
policy:
|
|
888
|
-
max_rounds:
|
|
889
|
-
reviewers:
|
|
890
|
-
models:
|
|
959
|
+
event: z3.literal("loop_started"),
|
|
960
|
+
task: z3.number().int(),
|
|
961
|
+
policy: z3.object({
|
|
962
|
+
max_rounds: z3.number().int().nonnegative(),
|
|
963
|
+
reviewers: z3.array(RoleSchema),
|
|
964
|
+
models: z3.record(RoleSchema, z3.string())
|
|
891
965
|
}).strict()
|
|
892
966
|
}).strict(),
|
|
893
|
-
|
|
894
|
-
|
|
967
|
+
z3.object({ ...loopShared, event: z3.literal("round_started"), round: z3.number().int(), base_head: z3.string() }).strict(),
|
|
968
|
+
z3.object({
|
|
895
969
|
...loopShared,
|
|
896
|
-
event:
|
|
897
|
-
round:
|
|
898
|
-
head:
|
|
899
|
-
green:
|
|
900
|
-
confidence_value:
|
|
901
|
-
confidence_reason:
|
|
902
|
-
confidence_unavailable:
|
|
903
|
-
extra_turn_spent:
|
|
970
|
+
event: z3.literal("gate_result_read"),
|
|
971
|
+
round: z3.number().int(),
|
|
972
|
+
head: z3.string(),
|
|
973
|
+
green: z3.boolean(),
|
|
974
|
+
confidence_value: z3.number().int().min(0).max(100).optional(),
|
|
975
|
+
confidence_reason: z3.string().max(CONFIDENCE_REASON_MAX_LENGTH).optional(),
|
|
976
|
+
confidence_unavailable: z3.boolean().optional(),
|
|
977
|
+
extra_turn_spent: z3.boolean().optional()
|
|
904
978
|
}).strict(),
|
|
905
|
-
|
|
979
|
+
z3.object({
|
|
906
980
|
...loopShared,
|
|
907
|
-
event:
|
|
908
|
-
round:
|
|
909
|
-
head:
|
|
910
|
-
all_approve:
|
|
911
|
-
blockers:
|
|
912
|
-
findings:
|
|
981
|
+
event: z3.literal("verdicts_read"),
|
|
982
|
+
round: z3.number().int(),
|
|
983
|
+
head: z3.string(),
|
|
984
|
+
all_approve: z3.boolean(),
|
|
985
|
+
blockers: z3.number().int().nonnegative(),
|
|
986
|
+
findings: z3.array(ReviewFindingSchema).optional(),
|
|
987
|
+
reviewers: z3.array(ReviewerVerdictSchema).optional()
|
|
913
988
|
}).strict(),
|
|
914
|
-
|
|
989
|
+
z3.object({
|
|
915
990
|
...loopShared,
|
|
916
|
-
event:
|
|
917
|
-
round:
|
|
918
|
-
open:
|
|
919
|
-
resolved:
|
|
920
|
-
new:
|
|
921
|
-
recurring:
|
|
991
|
+
event: z3.literal("findings_compared"),
|
|
992
|
+
round: z3.number().int(),
|
|
993
|
+
open: z3.array(z3.string()),
|
|
994
|
+
resolved: z3.array(z3.string()),
|
|
995
|
+
new: z3.array(z3.string()),
|
|
996
|
+
recurring: z3.array(z3.string())
|
|
922
997
|
}).strict(),
|
|
923
|
-
|
|
998
|
+
z3.object({
|
|
924
999
|
...loopShared,
|
|
925
|
-
event:
|
|
926
|
-
round:
|
|
927
|
-
condition:
|
|
1000
|
+
event: z3.literal("stop_condition_met"),
|
|
1001
|
+
round: z3.number().int(),
|
|
1002
|
+
condition: z3.enum([
|
|
928
1003
|
"green",
|
|
929
1004
|
"max_rounds",
|
|
930
1005
|
"no_progress",
|
|
@@ -933,66 +1008,85 @@ var DevReviewLoopEventSchema = z2.discriminatedUnion("event", [
|
|
|
933
1008
|
"confidence",
|
|
934
1009
|
"reappearance",
|
|
935
1010
|
"repeat_finding",
|
|
936
|
-
"repeat_failure"
|
|
1011
|
+
"repeat_failure",
|
|
1012
|
+
"time_budget"
|
|
937
1013
|
])
|
|
938
1014
|
}).strict(),
|
|
939
|
-
|
|
1015
|
+
z3.object({
|
|
1016
|
+
...loopShared,
|
|
1017
|
+
event: z3.literal("paused"),
|
|
1018
|
+
round: z3.number().int(),
|
|
1019
|
+
reason: z3.enum(["escalation", "principal_item", "refreeze_needed"]),
|
|
1020
|
+
reason_code: CodeTokenSchema.optional()
|
|
1021
|
+
}).strict(),
|
|
1022
|
+
z3.object({
|
|
1023
|
+
...loopShared,
|
|
1024
|
+
event: z3.literal("resumed"),
|
|
1025
|
+
round: z3.number().int(),
|
|
1026
|
+
by: z3.enum(["principal", "driver"])
|
|
1027
|
+
}).strict(),
|
|
1028
|
+
z3.object({
|
|
940
1029
|
...loopShared,
|
|
941
|
-
event:
|
|
942
|
-
round:
|
|
943
|
-
|
|
1030
|
+
event: z3.literal("cancelled"),
|
|
1031
|
+
round: z3.number().int(),
|
|
1032
|
+
by: z3.literal("principal")
|
|
944
1033
|
}).strict(),
|
|
945
|
-
|
|
1034
|
+
z3.object({
|
|
946
1035
|
...loopShared,
|
|
947
|
-
event:
|
|
948
|
-
round:
|
|
949
|
-
|
|
1036
|
+
event: z3.literal("unpushed_work_resume"),
|
|
1037
|
+
round: z3.number().int(),
|
|
1038
|
+
branch: z3.string(),
|
|
1039
|
+
detail: z3.string()
|
|
950
1040
|
}).strict(),
|
|
951
|
-
|
|
1041
|
+
z3.object({
|
|
952
1042
|
...loopShared,
|
|
953
|
-
event:
|
|
954
|
-
round:
|
|
955
|
-
|
|
1043
|
+
event: z3.literal("round_ended"),
|
|
1044
|
+
round: z3.number().int(),
|
|
1045
|
+
base_head: z3.string(),
|
|
1046
|
+
head: z3.string(),
|
|
1047
|
+
files_changed: z3.number().int().nonnegative(),
|
|
1048
|
+
insertions: z3.number().int().nonnegative(),
|
|
1049
|
+
deletions: z3.number().int().nonnegative(),
|
|
1050
|
+
wall_ms: z3.number().nonnegative(),
|
|
1051
|
+
outcome: z3.enum(["green", "changes_requested", "escalated"])
|
|
956
1052
|
}).strict(),
|
|
957
|
-
|
|
1053
|
+
z3.object({
|
|
958
1054
|
...loopShared,
|
|
959
|
-
event:
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
1055
|
+
event: z3.literal("journal_finalized"),
|
|
1056
|
+
rounds: z3.number().int().nonnegative(),
|
|
1057
|
+
total_wall_ms: z3.number().nonnegative(),
|
|
1058
|
+
time_to_green_ms: z3.number().nonnegative().nullable(),
|
|
1059
|
+
files_changed_total: z3.number().int().nonnegative(),
|
|
1060
|
+
final_head: z3.string(),
|
|
1061
|
+
result: z3.enum(["merged_ready", "stopped"])
|
|
963
1062
|
}).strict(),
|
|
964
|
-
|
|
1063
|
+
z3.object({
|
|
965
1064
|
...loopShared,
|
|
966
|
-
event:
|
|
967
|
-
round:
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
insertions: z2.number().int().nonnegative(),
|
|
972
|
-
deletions: z2.number().int().nonnegative(),
|
|
973
|
-
wall_ms: z2.number().nonnegative(),
|
|
974
|
-
outcome: z2.enum(["green", "changes_requested", "escalated"])
|
|
1065
|
+
event: z3.literal("infrastructure_retry"),
|
|
1066
|
+
round: z3.number().int(),
|
|
1067
|
+
failure_kind: z3.enum(["pause_comment_post", "developer_connection"]),
|
|
1068
|
+
attempts: z3.number().int().positive(),
|
|
1069
|
+
outcome: z3.enum(["recovered", "exhausted"])
|
|
975
1070
|
}).strict(),
|
|
976
|
-
|
|
1071
|
+
z3.object({
|
|
977
1072
|
...loopShared,
|
|
978
|
-
event:
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
final_head: z2.string(),
|
|
984
|
-
result: z2.enum(["merged_ready", "stopped"])
|
|
1073
|
+
event: z3.literal("driver_heartbeat"),
|
|
1074
|
+
task: z3.number().int(),
|
|
1075
|
+
pr: z3.number().int().positive().optional(),
|
|
1076
|
+
round: z3.number().int(),
|
|
1077
|
+
phase: z3.string()
|
|
985
1078
|
}).strict(),
|
|
986
|
-
|
|
1079
|
+
z3.object({
|
|
987
1080
|
...loopShared,
|
|
988
|
-
event:
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
1081
|
+
event: z3.literal("driver_exited"),
|
|
1082
|
+
task: z3.number().int(),
|
|
1083
|
+
reason: z3.enum(["finished", "paused", "reexec", "error", "signal"]),
|
|
1084
|
+
last_decision: z3.string(),
|
|
1085
|
+
exit_code: z3.number().int().optional(),
|
|
1086
|
+
error_class: CodeTokenSchema.optional()
|
|
993
1087
|
}).strict()
|
|
994
1088
|
]);
|
|
995
|
-
var ForgeOpSchema =
|
|
1089
|
+
var ForgeOpSchema = z3.enum([
|
|
996
1090
|
"pr.create",
|
|
997
1091
|
"pr.comment",
|
|
998
1092
|
"pr.body.replace",
|
|
@@ -1006,24 +1100,24 @@ var ForgeOpSchema = z2.enum([
|
|
|
1006
1100
|
"label.add",
|
|
1007
1101
|
"label.remove"
|
|
1008
1102
|
]);
|
|
1009
|
-
var ForgeWriteTargetSchema =
|
|
1010
|
-
issue:
|
|
1011
|
-
pr:
|
|
1103
|
+
var ForgeWriteTargetSchema = z3.object({
|
|
1104
|
+
issue: z3.number().int().optional(),
|
|
1105
|
+
pr: z3.number().int().optional()
|
|
1012
1106
|
}).strict();
|
|
1013
1107
|
var forgeWriteShared = {
|
|
1014
1108
|
meta: HeaderMetaSchema,
|
|
1015
1109
|
subject: SubjectSchema,
|
|
1016
|
-
kind:
|
|
1110
|
+
kind: z3.literal("forge_write"),
|
|
1017
1111
|
...envelopeTail,
|
|
1018
1112
|
op: ForgeOpSchema,
|
|
1019
1113
|
target: ForgeWriteTargetSchema
|
|
1020
1114
|
};
|
|
1021
|
-
var ForgeWriteEventSchema =
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1115
|
+
var ForgeWriteEventSchema = z3.discriminatedUnion("event", [
|
|
1116
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("validated") }).strict(),
|
|
1117
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("refused"), reason: z3.string() }).strict(),
|
|
1118
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("written"), comment_ids: z3.array(z3.string()) }).strict()
|
|
1025
1119
|
]);
|
|
1026
|
-
var GateOutcomeSchema =
|
|
1120
|
+
var GateOutcomeSchema = z3.enum([
|
|
1027
1121
|
"pass",
|
|
1028
1122
|
"fail",
|
|
1029
1123
|
"wait",
|
|
@@ -1036,61 +1130,74 @@ var GateOutcomeSchema = z2.enum([
|
|
|
1036
1130
|
var gateShared = {
|
|
1037
1131
|
meta: HeaderMetaSchema,
|
|
1038
1132
|
subject: SubjectSchema,
|
|
1039
|
-
kind:
|
|
1133
|
+
kind: z3.literal("gate"),
|
|
1040
1134
|
...envelopeTail,
|
|
1041
|
-
check:
|
|
1042
|
-
check_version:
|
|
1043
|
-
policy_version:
|
|
1044
|
-
input_fingerprint:
|
|
1135
|
+
check: z3.string(),
|
|
1136
|
+
check_version: z3.string().nullable(),
|
|
1137
|
+
policy_version: z3.string().nullable(),
|
|
1138
|
+
input_fingerprint: z3.string().nullable()
|
|
1045
1139
|
};
|
|
1046
|
-
var GateEventSchema =
|
|
1047
|
-
|
|
1140
|
+
var GateEventSchema = z3.discriminatedUnion("event", [
|
|
1141
|
+
z3.object({
|
|
1048
1142
|
...gateShared,
|
|
1049
|
-
event:
|
|
1143
|
+
event: z3.literal("checked"),
|
|
1050
1144
|
outcome: GateOutcomeSchema,
|
|
1051
|
-
reason:
|
|
1145
|
+
reason: z3.string().optional()
|
|
1146
|
+
}).strict(),
|
|
1147
|
+
z3.object({
|
|
1148
|
+
meta: HeaderMetaSchema,
|
|
1149
|
+
subject: SubjectSchema,
|
|
1150
|
+
kind: z3.literal("gate"),
|
|
1151
|
+
...envelopeTail,
|
|
1152
|
+
event: z3.literal("summary"),
|
|
1153
|
+
ran: z3.number().int().nonnegative(),
|
|
1154
|
+
passed: z3.number().int().nonnegative(),
|
|
1155
|
+
failed: z3.number().int().nonnegative(),
|
|
1156
|
+
skipped: z3.number().int().nonnegative(),
|
|
1157
|
+
failed_checks: z3.array(z3.string())
|
|
1052
1158
|
}).strict()
|
|
1053
1159
|
]);
|
|
1054
|
-
var OperationResultSchema =
|
|
1160
|
+
var OperationResultSchema = z3.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
|
|
1055
1161
|
var operationShared = {
|
|
1056
1162
|
meta: HeaderMetaSchema,
|
|
1057
1163
|
subject: SubjectSchema,
|
|
1058
|
-
kind:
|
|
1164
|
+
kind: z3.literal("operation"),
|
|
1059
1165
|
...envelopeTail,
|
|
1060
|
-
operation:
|
|
1061
|
-
target:
|
|
1166
|
+
operation: z3.string(),
|
|
1167
|
+
target: z3.string().nullable()
|
|
1062
1168
|
};
|
|
1063
|
-
var OperationEventSchema =
|
|
1064
|
-
|
|
1169
|
+
var OperationEventSchema = z3.discriminatedUnion("event", [
|
|
1170
|
+
z3.object({
|
|
1065
1171
|
...operationShared,
|
|
1066
|
-
event:
|
|
1172
|
+
event: z3.literal("completed"),
|
|
1067
1173
|
result: OperationResultSchema,
|
|
1068
|
-
error_class:
|
|
1174
|
+
error_class: z3.string().nullable(),
|
|
1175
|
+
field_names: z3.array(z3.string().max(CUSTOM_FIELD_NAME_MAX_LENGTH)).max(CUSTOM_EVENT_MAX_FIELDS).optional()
|
|
1069
1176
|
}).strict()
|
|
1070
1177
|
]);
|
|
1071
|
-
var UsageUnitsSchema =
|
|
1072
|
-
input:
|
|
1073
|
-
output:
|
|
1074
|
-
cache:
|
|
1178
|
+
var UsageUnitsSchema = z3.object({
|
|
1179
|
+
input: z3.number().nonnegative().nullable(),
|
|
1180
|
+
output: z3.number().nonnegative().nullable(),
|
|
1181
|
+
cache: z3.number().nonnegative().nullable()
|
|
1075
1182
|
}).strict();
|
|
1076
1183
|
var usageShared = {
|
|
1077
1184
|
meta: HeaderMetaSchema,
|
|
1078
1185
|
subject: SubjectSchema,
|
|
1079
|
-
kind:
|
|
1186
|
+
kind: z3.literal("usage"),
|
|
1080
1187
|
...envelopeTail,
|
|
1081
|
-
model:
|
|
1082
|
-
source:
|
|
1083
|
-
semantics:
|
|
1188
|
+
model: z3.string().nullable(),
|
|
1189
|
+
source: z3.string(),
|
|
1190
|
+
semantics: z3.enum(["cumulative", "delta"])
|
|
1084
1191
|
};
|
|
1085
|
-
var UsageEventSchema =
|
|
1086
|
-
|
|
1192
|
+
var UsageEventSchema = z3.discriminatedUnion("event", [
|
|
1193
|
+
z3.object({
|
|
1087
1194
|
...usageShared,
|
|
1088
|
-
event:
|
|
1195
|
+
event: z3.literal("observed"),
|
|
1089
1196
|
units: UsageUnitsSchema,
|
|
1090
|
-
unknown_reason:
|
|
1197
|
+
unknown_reason: z3.string().nullable()
|
|
1091
1198
|
}).strict()
|
|
1092
1199
|
]);
|
|
1093
|
-
var RoleAttemptOutcomeSchema =
|
|
1200
|
+
var RoleAttemptOutcomeSchema = z3.enum([
|
|
1094
1201
|
"completed",
|
|
1095
1202
|
"incomplete",
|
|
1096
1203
|
"infrastructure_failed",
|
|
@@ -1101,17 +1208,17 @@ var RoleAttemptOutcomeSchema = z2.enum([
|
|
|
1101
1208
|
var roleAttemptShared = {
|
|
1102
1209
|
meta: HeaderMetaSchema,
|
|
1103
1210
|
subject: SubjectSchema,
|
|
1104
|
-
kind:
|
|
1211
|
+
kind: z3.literal("role_attempt"),
|
|
1105
1212
|
...envelopeTail,
|
|
1106
|
-
actor:
|
|
1107
|
-
attempt:
|
|
1108
|
-
effect_id:
|
|
1109
|
-
model:
|
|
1213
|
+
actor: z3.string().nullable(),
|
|
1214
|
+
attempt: z3.number().int().nullable(),
|
|
1215
|
+
effect_id: z3.string(),
|
|
1216
|
+
model: z3.string().nullable()
|
|
1110
1217
|
};
|
|
1111
|
-
var RoleAttemptEventSchema =
|
|
1112
|
-
|
|
1218
|
+
var RoleAttemptEventSchema = z3.discriminatedUnion("event", [
|
|
1219
|
+
z3.object({
|
|
1113
1220
|
...roleAttemptShared,
|
|
1114
|
-
event:
|
|
1221
|
+
event: z3.literal("attempted"),
|
|
1115
1222
|
outcome: RoleAttemptOutcomeSchema,
|
|
1116
1223
|
usage: dispatchUsageField
|
|
1117
1224
|
}).strict()
|
|
@@ -1119,42 +1226,59 @@ var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
|
|
|
1119
1226
|
var handoffShared = {
|
|
1120
1227
|
meta: HeaderMetaSchema,
|
|
1121
1228
|
subject: SubjectSchema,
|
|
1122
|
-
kind:
|
|
1229
|
+
kind: z3.literal("handoff"),
|
|
1123
1230
|
...envelopeTail,
|
|
1124
|
-
class:
|
|
1125
|
-
reason:
|
|
1231
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
1232
|
+
reason: z3.string()
|
|
1126
1233
|
};
|
|
1127
|
-
var HandoffEventSchema =
|
|
1128
|
-
|
|
1234
|
+
var HandoffEventSchema = z3.discriminatedUnion("event", [
|
|
1235
|
+
z3.object({
|
|
1129
1236
|
...handoffShared,
|
|
1130
|
-
event:
|
|
1131
|
-
requested_decision:
|
|
1237
|
+
event: z3.literal("raised"),
|
|
1238
|
+
requested_decision: z3.string().nullable()
|
|
1132
1239
|
}).strict(),
|
|
1133
|
-
|
|
1240
|
+
z3.object({
|
|
1134
1241
|
...handoffShared,
|
|
1135
|
-
event:
|
|
1136
|
-
resolution:
|
|
1137
|
-
resolved_by:
|
|
1242
|
+
event: z3.literal("resolved"),
|
|
1243
|
+
resolution: z3.string().nullable(),
|
|
1244
|
+
resolved_by: z3.string().nullable()
|
|
1138
1245
|
}).strict()
|
|
1139
1246
|
]);
|
|
1140
|
-
var EffectTargetSchema =
|
|
1141
|
-
kind:
|
|
1142
|
-
ref:
|
|
1247
|
+
var EffectTargetSchema = z3.object({
|
|
1248
|
+
kind: z3.string(),
|
|
1249
|
+
ref: z3.string()
|
|
1143
1250
|
}).strict();
|
|
1144
1251
|
var effectShared = {
|
|
1145
1252
|
meta: HeaderMetaSchema,
|
|
1146
1253
|
subject: SubjectSchema,
|
|
1147
|
-
kind:
|
|
1254
|
+
kind: z3.literal("effect"),
|
|
1148
1255
|
...envelopeTail,
|
|
1149
|
-
effect_id:
|
|
1256
|
+
effect_id: z3.string(),
|
|
1150
1257
|
target: EffectTargetSchema
|
|
1151
1258
|
};
|
|
1152
|
-
var EffectEventSchema =
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1259
|
+
var EffectEventSchema = z3.discriminatedUnion("event", [
|
|
1260
|
+
z3.object({ ...effectShared, event: z3.literal("attempted") }).strict(),
|
|
1261
|
+
z3.object({ ...effectShared, event: z3.literal("observed"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict(),
|
|
1262
|
+
z3.object({ ...effectShared, event: z3.literal("verified"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict()
|
|
1263
|
+
]);
|
|
1264
|
+
var CustomFieldValueSchema = z3.union([z3.string().max(CUSTOM_TEXT_MAX_LENGTH), z3.number().finite(), z3.boolean()]);
|
|
1265
|
+
var customShared = {
|
|
1266
|
+
meta: HeaderMetaV3Schema,
|
|
1267
|
+
subject: SubjectSchema,
|
|
1268
|
+
kind: z3.literal("custom"),
|
|
1269
|
+
...envelopeTail
|
|
1270
|
+
};
|
|
1271
|
+
var CustomEventSchema = z3.discriminatedUnion("event", [
|
|
1272
|
+
z3.object({
|
|
1273
|
+
...customShared,
|
|
1274
|
+
event: z3.literal("recorded"),
|
|
1275
|
+
name: z3.string().max(CUSTOM_EVENT_NAME_MAX_LENGTH).regex(CUSTOM_EVENT_NAME_PATTERN),
|
|
1276
|
+
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, {
|
|
1277
|
+
message: `custom: at most ${CUSTOM_EVENT_MAX_FIELDS} fields`
|
|
1278
|
+
})
|
|
1279
|
+
}).strict()
|
|
1156
1280
|
]);
|
|
1157
|
-
var LogEventSchema =
|
|
1281
|
+
var LogEventSchema = z3.union([
|
|
1158
1282
|
DispatchEventSchema,
|
|
1159
1283
|
DevReviewLoopEventSchema,
|
|
1160
1284
|
ForgeWriteEventSchema,
|
|
@@ -1163,10 +1287,11 @@ var LogEventSchema = z2.union([
|
|
|
1163
1287
|
UsageEventSchema,
|
|
1164
1288
|
RoleAttemptEventSchema,
|
|
1165
1289
|
HandoffEventSchema,
|
|
1166
|
-
EffectEventSchema
|
|
1290
|
+
EffectEventSchema,
|
|
1291
|
+
CustomEventSchema
|
|
1167
1292
|
]);
|
|
1168
|
-
|
|
1169
1293
|
// ../../packages/aeg-core/src/log/envelope.ts
|
|
1294
|
+
import { createHash } from "node:crypto";
|
|
1170
1295
|
function isRole(value) {
|
|
1171
1296
|
return value !== undefined && ROLE_VALUES.includes(value);
|
|
1172
1297
|
}
|
|
@@ -1203,18 +1328,27 @@ function roundFromEnv(round) {
|
|
|
1203
1328
|
const n = Number(round);
|
|
1204
1329
|
return Number.isInteger(n) ? n : undefined;
|
|
1205
1330
|
}
|
|
1331
|
+
function prFromEnv(pr) {
|
|
1332
|
+
if (pr === undefined || pr === "")
|
|
1333
|
+
return;
|
|
1334
|
+
const n = Number(pr);
|
|
1335
|
+
return Number.isInteger(n) && n > 0 ? n : undefined;
|
|
1336
|
+
}
|
|
1206
1337
|
function buildHeader(input) {
|
|
1207
1338
|
const role = isRole(input.env.role) ? input.env.role : "unattributed";
|
|
1208
1339
|
const round = roundFromEnv(input.env.round);
|
|
1340
|
+
const pr = prFromEnv(input.env.pr);
|
|
1209
1341
|
const subject = {
|
|
1210
1342
|
issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
|
|
1211
1343
|
role,
|
|
1212
1344
|
...round !== undefined ? { round } : {},
|
|
1345
|
+
...pr !== undefined ? { pr } : {},
|
|
1213
1346
|
...input.subject ?? {}
|
|
1214
1347
|
};
|
|
1348
|
+
const issue = subject.issue;
|
|
1215
1349
|
return {
|
|
1216
1350
|
meta: {
|
|
1217
|
-
schema:
|
|
1351
|
+
schema: 3,
|
|
1218
1352
|
ts: input.now.toISOString(),
|
|
1219
1353
|
run_id: input.runId,
|
|
1220
1354
|
seq: input.seq,
|
|
@@ -1237,7 +1371,19 @@ function buildHeader(input) {
|
|
|
1237
1371
|
ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
|
|
1238
1372
|
policy_digest: input.inputVersions?.policyDigest ?? null
|
|
1239
1373
|
},
|
|
1240
|
-
provenance: provenanceFor(input)
|
|
1374
|
+
provenance: provenanceFor(input),
|
|
1375
|
+
work: {
|
|
1376
|
+
ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
|
|
1377
|
+
repo: input.repo,
|
|
1378
|
+
change: null,
|
|
1379
|
+
revision: null
|
|
1380
|
+
},
|
|
1381
|
+
flow: {
|
|
1382
|
+
id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
|
|
1383
|
+
version: lineageFieldFromEnv(input.env.flowVersion)
|
|
1384
|
+
},
|
|
1385
|
+
runtime: lineageFieldFromEnv(input.env.runtime),
|
|
1386
|
+
source: lineageFieldFromEnv(input.env.source)
|
|
1241
1387
|
},
|
|
1242
1388
|
subject
|
|
1243
1389
|
};
|
|
@@ -1280,7 +1426,7 @@ function redact(value, home) {
|
|
|
1280
1426
|
return value;
|
|
1281
1427
|
}
|
|
1282
1428
|
// ../../packages/aeg-core/src/log/store.ts
|
|
1283
|
-
var KNOWN_SCHEMA_VERSIONS = [1, 2];
|
|
1429
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
|
|
1284
1430
|
function metaOf(obj) {
|
|
1285
1431
|
if (obj === null || typeof obj !== "object")
|
|
1286
1432
|
return null;
|
|
@@ -1346,7 +1492,7 @@ function classifyStoredLine(raw, home) {
|
|
|
1346
1492
|
return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
|
|
1347
1493
|
}
|
|
1348
1494
|
const redacted = redact(event, home);
|
|
1349
|
-
const provenance = version
|
|
1495
|
+
const provenance = version >= 2 ? event.meta.provenance ?? null : null;
|
|
1350
1496
|
return {
|
|
1351
1497
|
status: "ok",
|
|
1352
1498
|
identity,
|
|
@@ -1359,136 +1505,139 @@ function classifyStoredLine(raw, home) {
|
|
|
1359
1505
|
};
|
|
1360
1506
|
}
|
|
1361
1507
|
// ../../packages/aeg-core/src/control-store/records.ts
|
|
1362
|
-
import { z as
|
|
1363
|
-
var isoTimestamp =
|
|
1364
|
-
var taskId =
|
|
1365
|
-
var epochNumber =
|
|
1366
|
-
var RunRecordSchema =
|
|
1367
|
-
version:
|
|
1368
|
-
kind:
|
|
1508
|
+
import { z as z4 } from "zod";
|
|
1509
|
+
var isoTimestamp = z4.string().min(1);
|
|
1510
|
+
var taskId = z4.number().int().positive();
|
|
1511
|
+
var epochNumber = z4.number().int().nonnegative();
|
|
1512
|
+
var RunRecordSchema = z4.object({
|
|
1513
|
+
version: z4.literal(1),
|
|
1514
|
+
kind: z4.literal("run"),
|
|
1369
1515
|
task: taskId,
|
|
1370
|
-
runId:
|
|
1371
|
-
pid:
|
|
1372
|
-
host:
|
|
1516
|
+
runId: z4.string().min(1),
|
|
1517
|
+
pid: z4.number().int().positive(),
|
|
1518
|
+
host: z4.string().min(1),
|
|
1373
1519
|
startedAt: isoTimestamp,
|
|
1374
|
-
childStartedAt:
|
|
1375
|
-
childCommand:
|
|
1520
|
+
childStartedAt: z4.string().min(1).nullable().optional(),
|
|
1521
|
+
childCommand: z4.string().min(1).nullable().optional()
|
|
1376
1522
|
}).strict();
|
|
1377
|
-
var InputRecordSchema =
|
|
1378
|
-
version:
|
|
1379
|
-
kind:
|
|
1523
|
+
var InputRecordSchema = z4.object({
|
|
1524
|
+
version: z4.literal(1),
|
|
1525
|
+
kind: z4.literal("input"),
|
|
1380
1526
|
task: taskId,
|
|
1381
|
-
runId:
|
|
1382
|
-
source:
|
|
1383
|
-
pr:
|
|
1384
|
-
round:
|
|
1527
|
+
runId: z4.string().min(1),
|
|
1528
|
+
source: z4.union([z4.literal("fresh"), z4.literal("resume")]),
|
|
1529
|
+
pr: z4.number().int().positive().nullable(),
|
|
1530
|
+
round: z4.number().int().nonnegative(),
|
|
1385
1531
|
recordedAt: isoTimestamp
|
|
1386
1532
|
}).strict();
|
|
1387
|
-
var OwnershipRecordSchema =
|
|
1388
|
-
version:
|
|
1389
|
-
kind:
|
|
1533
|
+
var OwnershipRecordSchema = z4.object({
|
|
1534
|
+
version: z4.literal(1),
|
|
1535
|
+
kind: z4.literal("ownership"),
|
|
1390
1536
|
task: taskId,
|
|
1391
1537
|
epoch: epochNumber,
|
|
1392
|
-
ownerId:
|
|
1393
|
-
pid:
|
|
1394
|
-
host:
|
|
1538
|
+
ownerId: z4.string().min(1),
|
|
1539
|
+
pid: z4.number().int().positive(),
|
|
1540
|
+
host: z4.string().min(1),
|
|
1395
1541
|
acquiredAt: isoTimestamp
|
|
1396
1542
|
}).strict();
|
|
1397
|
-
var TransitionRecordSchema =
|
|
1398
|
-
version:
|
|
1399
|
-
kind:
|
|
1543
|
+
var TransitionRecordSchema = z4.object({
|
|
1544
|
+
version: z4.literal(1),
|
|
1545
|
+
kind: z4.literal("transition"),
|
|
1400
1546
|
task: taskId,
|
|
1401
1547
|
epoch: epochNumber,
|
|
1402
|
-
seq:
|
|
1403
|
-
from:
|
|
1404
|
-
to:
|
|
1405
|
-
detail:
|
|
1548
|
+
seq: z4.number().int().nonnegative(),
|
|
1549
|
+
from: z4.string().min(1),
|
|
1550
|
+
to: z4.string().min(1),
|
|
1551
|
+
detail: z4.string().optional(),
|
|
1406
1552
|
at: isoTimestamp
|
|
1407
1553
|
}).strict();
|
|
1408
|
-
var ManifestRecordSchema =
|
|
1409
|
-
version:
|
|
1410
|
-
kind:
|
|
1554
|
+
var ManifestRecordSchema = z4.object({
|
|
1555
|
+
version: z4.literal(1),
|
|
1556
|
+
kind: z4.literal("manifest"),
|
|
1411
1557
|
task: taskId,
|
|
1412
1558
|
round: epochNumber,
|
|
1413
|
-
repository:
|
|
1414
|
-
pr:
|
|
1415
|
-
branch:
|
|
1416
|
-
baseSha:
|
|
1417
|
-
headSha:
|
|
1418
|
-
briefHash:
|
|
1419
|
-
objectivesVersion:
|
|
1559
|
+
repository: z4.string().min(1),
|
|
1560
|
+
pr: z4.number().int().positive(),
|
|
1561
|
+
branch: z4.string().min(1),
|
|
1562
|
+
baseSha: z4.string().min(1).nullable(),
|
|
1563
|
+
headSha: z4.string().min(1),
|
|
1564
|
+
briefHash: z4.string().min(1).nullable(),
|
|
1565
|
+
objectivesVersion: z4.string().min(1).nullable(),
|
|
1420
1566
|
rulingOrdinal: epochNumber,
|
|
1421
|
-
policyDigest:
|
|
1567
|
+
policyDigest: z4.string().min(1),
|
|
1422
1568
|
recordedAt: isoTimestamp
|
|
1423
1569
|
}).strict();
|
|
1424
|
-
var roundHeadIdentity =
|
|
1425
|
-
var LoopBudgetsSchema =
|
|
1426
|
-
mechanicalRetries:
|
|
1427
|
-
reviewRounds:
|
|
1428
|
-
infrastructureRetries:
|
|
1570
|
+
var roundHeadIdentity = z4.object({ round: z4.number().int().positive(), head: z4.string().min(1) }).strict();
|
|
1571
|
+
var LoopBudgetsSchema = z4.object({
|
|
1572
|
+
mechanicalRetries: z4.number().int().nonnegative(),
|
|
1573
|
+
reviewRounds: z4.number().int().nonnegative(),
|
|
1574
|
+
infrastructureRetries: z4.number().int().nonnegative()
|
|
1429
1575
|
}).strict();
|
|
1430
|
-
var LoopStateRecordSchema =
|
|
1431
|
-
version:
|
|
1432
|
-
kind:
|
|
1576
|
+
var LoopStateRecordSchema = z4.object({
|
|
1577
|
+
version: z4.literal(1),
|
|
1578
|
+
kind: z4.literal("loop_state"),
|
|
1433
1579
|
task: taskId,
|
|
1434
|
-
round:
|
|
1435
|
-
phase:
|
|
1436
|
-
pauseReason:
|
|
1580
|
+
round: z4.number().int().positive(),
|
|
1581
|
+
phase: z4.string().min(1),
|
|
1582
|
+
pauseReason: z4.string().min(1).nullable(),
|
|
1437
1583
|
budgets: LoopBudgetsSchema,
|
|
1438
1584
|
heldResult: roundHeadIdentity.nullable(),
|
|
1439
1585
|
deliveredFindings: roundHeadIdentity.nullable(),
|
|
1440
|
-
repeatMemory:
|
|
1441
|
-
blockingFindings:
|
|
1442
|
-
lastFailure:
|
|
1586
|
+
repeatMemory: z4.object({
|
|
1587
|
+
blockingFindings: z4.array(z4.string()),
|
|
1588
|
+
lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
|
|
1443
1589
|
}).strict().optional(),
|
|
1590
|
+
publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
|
|
1591
|
+
taskStartedAt: isoTimestamp.optional(),
|
|
1592
|
+
phaseMs: z4.record(z4.string(), z4.number().nonnegative()).optional(),
|
|
1444
1593
|
recordedAt: isoTimestamp
|
|
1445
1594
|
}).strict();
|
|
1446
|
-
var EffectRecordSchema =
|
|
1447
|
-
version:
|
|
1448
|
-
kind:
|
|
1595
|
+
var EffectRecordSchema = z4.object({
|
|
1596
|
+
version: z4.literal(1),
|
|
1597
|
+
kind: z4.literal("effect"),
|
|
1449
1598
|
task: taskId,
|
|
1450
|
-
key:
|
|
1451
|
-
operation:
|
|
1452
|
-
target:
|
|
1453
|
-
inputVersion:
|
|
1454
|
-
payloadDigest:
|
|
1455
|
-
status:
|
|
1456
|
-
url:
|
|
1599
|
+
key: z4.string().min(1),
|
|
1600
|
+
operation: z4.string().min(1),
|
|
1601
|
+
target: z4.string().min(1),
|
|
1602
|
+
inputVersion: z4.number().int().nonnegative(),
|
|
1603
|
+
payloadDigest: z4.string().min(1),
|
|
1604
|
+
status: z4.union([z4.literal("started"), z4.literal("verified"), z4.literal("uncertain")]),
|
|
1605
|
+
url: z4.string().optional(),
|
|
1457
1606
|
recordedAt: isoTimestamp
|
|
1458
1607
|
}).strict();
|
|
1459
|
-
var EscalationRecordSchema =
|
|
1460
|
-
version:
|
|
1461
|
-
kind:
|
|
1608
|
+
var EscalationRecordSchema = z4.object({
|
|
1609
|
+
version: z4.literal(1),
|
|
1610
|
+
kind: z4.literal("escalation"),
|
|
1462
1611
|
task: taskId,
|
|
1463
|
-
escalationId:
|
|
1612
|
+
escalationId: z4.string().min(1),
|
|
1464
1613
|
round: epochNumber,
|
|
1465
|
-
head:
|
|
1466
|
-
branch:
|
|
1467
|
-
pr:
|
|
1468
|
-
runId:
|
|
1469
|
-
pid:
|
|
1470
|
-
host:
|
|
1471
|
-
agent:
|
|
1472
|
-
reason:
|
|
1473
|
-
detail:
|
|
1474
|
-
evidence:
|
|
1475
|
-
attemptedRecovery:
|
|
1476
|
-
requestedDecision:
|
|
1477
|
-
recipient:
|
|
1478
|
-
briefHash:
|
|
1479
|
-
objectivesVersion:
|
|
1614
|
+
head: z4.string().min(1),
|
|
1615
|
+
branch: z4.string().min(1),
|
|
1616
|
+
pr: z4.number().int().positive().nullable(),
|
|
1617
|
+
runId: z4.string().min(1),
|
|
1618
|
+
pid: z4.number().int().positive(),
|
|
1619
|
+
host: z4.string().min(1),
|
|
1620
|
+
agent: z4.string().min(1).optional(),
|
|
1621
|
+
reason: z4.string().min(1),
|
|
1622
|
+
detail: z4.string().optional(),
|
|
1623
|
+
evidence: z4.string().optional(),
|
|
1624
|
+
attemptedRecovery: z4.string().min(1),
|
|
1625
|
+
requestedDecision: z4.string().min(1),
|
|
1626
|
+
recipient: z4.string().min(1),
|
|
1627
|
+
briefHash: z4.string().min(1).nullable(),
|
|
1628
|
+
objectivesVersion: z4.string().min(1).nullable(),
|
|
1480
1629
|
rulingOrdinal: epochNumber,
|
|
1481
|
-
policyDigest:
|
|
1630
|
+
policyDigest: z4.string().min(1),
|
|
1482
1631
|
recordedAt: isoTimestamp
|
|
1483
1632
|
}).strict();
|
|
1484
|
-
var ResolutionRecordSchema =
|
|
1485
|
-
version:
|
|
1486
|
-
kind:
|
|
1633
|
+
var ResolutionRecordSchema = z4.object({
|
|
1634
|
+
version: z4.literal(1),
|
|
1635
|
+
kind: z4.literal("resolution"),
|
|
1487
1636
|
task: taskId,
|
|
1488
|
-
escalationId:
|
|
1489
|
-
decision:
|
|
1490
|
-
authenticatedBy:
|
|
1491
|
-
authenticatedFrom:
|
|
1637
|
+
escalationId: z4.string().min(1),
|
|
1638
|
+
decision: z4.union([z4.literal("resume"), z4.literal("cancel")]),
|
|
1639
|
+
authenticatedBy: z4.string().min(1),
|
|
1640
|
+
authenticatedFrom: z4.string().min(1),
|
|
1492
1641
|
consumedAt: isoTimestamp
|
|
1493
1642
|
}).strict();
|
|
1494
1643
|
// ../../packages/aeg-core/src/control-store/local.ts
|
|
@@ -1568,8 +1717,8 @@ function mkdirNoSymlinks(dir, mode, trustedRoot) {
|
|
|
1568
1717
|
}
|
|
1569
1718
|
var CONTROL_AREA_DIRNAME = "control";
|
|
1570
1719
|
// src/checks/registry.ts
|
|
1571
|
-
import {
|
|
1572
|
-
import {
|
|
1720
|
+
import { join as join3, relative, sep as sep2 } from "node:path";
|
|
1721
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
1573
1722
|
|
|
1574
1723
|
// src/lib/package-root.ts
|
|
1575
1724
|
import { existsSync as existsSync2 } from "node:fs";
|
|
@@ -1589,10 +1738,14 @@ function packageRoot(moduleUrl) {
|
|
|
1589
1738
|
}
|
|
1590
1739
|
|
|
1591
1740
|
// src/checks/registry.ts
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1741
|
+
function resolveCheckBin(packageDir, moduleUrl) {
|
|
1742
|
+
const fromPackage = relative(packageDir, fileURLToPath2(moduleUrl));
|
|
1743
|
+
const bundled = fromPackage === "dist" || fromPackage.startsWith(`dist${sep2}`);
|
|
1744
|
+
return bundled ? { dir: join3(packageDir, "dist", "checks", "bin"), ext: ".js" } : { dir: join3(packageDir, "src", "checks", "bin"), ext: ".ts" };
|
|
1745
|
+
}
|
|
1746
|
+
var CHECK_BIN = resolveCheckBin(packageRoot(import.meta.url), import.meta.url);
|
|
1747
|
+
var BIN_DIR = CHECK_BIN.dir;
|
|
1748
|
+
var BIN_EXT = CHECK_BIN.ext;
|
|
1596
1749
|
function bin(name) {
|
|
1597
1750
|
return join3(BIN_DIR, `${name}${BIN_EXT}`);
|
|
1598
1751
|
}
|
|
@@ -1790,23 +1943,6 @@ var REGISTRY = [
|
|
|
1790
1943
|
},
|
|
1791
1944
|
1
|
|
1792
1945
|
],
|
|
1793
|
-
[
|
|
1794
|
-
{
|
|
1795
|
-
name: "token-report",
|
|
1796
|
-
validates: "body",
|
|
1797
|
-
run: bin("check-token-report"),
|
|
1798
|
-
scope: "diff",
|
|
1799
|
-
timeoutMs: 15000,
|
|
1800
|
-
requiresOpenPr: true,
|
|
1801
|
-
env: {
|
|
1802
|
-
PR_BODY: { optional: true },
|
|
1803
|
-
BRANCH: { optional: true },
|
|
1804
|
-
CLAUDE_PROJECT_DIR: { optional: true },
|
|
1805
|
-
CLAUDE_CODE_SESSION_ID: { optional: true }
|
|
1806
|
-
}
|
|
1807
|
-
},
|
|
1808
|
-
1
|
|
1809
|
-
],
|
|
1810
1946
|
[
|
|
1811
1947
|
{
|
|
1812
1948
|
name: "no-disk-state",
|
|
@@ -2156,71 +2292,52 @@ var CORE_CHECK_RING = Object.fromEntries(REGISTRY.map(([spec, ring]) => [spec.na
|
|
|
2156
2292
|
import { execFile as execFile5 } from "node:child_process";
|
|
2157
2293
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
2158
2294
|
import {
|
|
2159
|
-
|
|
2160
|
-
|
|
2295
|
+
appendFileSync,
|
|
2296
|
+
closeSync as closeSync5,
|
|
2297
|
+
constants as fsConstants5,
|
|
2161
2298
|
existsSync as existsSync6,
|
|
2162
|
-
fstatSync as
|
|
2163
|
-
mkdirSync as
|
|
2164
|
-
|
|
2165
|
-
|
|
2299
|
+
fstatSync as fstatSync3,
|
|
2300
|
+
mkdirSync as mkdirSync5,
|
|
2301
|
+
lstatSync as lstatSync3,
|
|
2302
|
+
openSync as openSync5,
|
|
2303
|
+
readFileSync as readFileSync6,
|
|
2166
2304
|
renameSync as renameSync3,
|
|
2167
|
-
|
|
2305
|
+
writeFileSync as writeFileSync3,
|
|
2306
|
+
writeSync as writeSync4
|
|
2168
2307
|
} from "node:fs";
|
|
2169
2308
|
import { hostname as osHostname, homedir as homedir3 } from "node:os";
|
|
2170
|
-
import { dirname as
|
|
2309
|
+
import { dirname as dirname7, join as join7 } from "node:path";
|
|
2171
2310
|
import { promisify as promisify5 } from "node:util";
|
|
2172
2311
|
|
|
2173
2312
|
// src/lib/config.ts
|
|
2174
|
-
import { execFile as execFile4, execFileSync as
|
|
2313
|
+
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
2175
2314
|
import { promisify as promisify4 } from "node:util";
|
|
2176
|
-
import { existsSync as
|
|
2315
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, realpathSync, writeFileSync } from "node:fs";
|
|
2177
2316
|
import { homedir } from "node:os";
|
|
2178
2317
|
import { dirname as dirname3, isAbsolute, join as join4, resolve as resolve2 } from "node:path";
|
|
2179
|
-
import { z as
|
|
2318
|
+
import { z as z5 } from "zod";
|
|
2180
2319
|
|
|
2181
2320
|
// src/lib/agent-vendors.ts
|
|
2182
2321
|
var AGENT_VENDORS = ["skills", "claude", "gemini"];
|
|
2183
2322
|
|
|
2184
|
-
// src/lib/worker-boundary.ts
|
|
2185
|
-
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
2186
|
-
var LOG_HEADER_KEYCHAIN_SERVICE = "Vinaya Log";
|
|
2187
|
-
var logHeaderKeychainCache = new Map;
|
|
2188
|
-
function readRealLogHeaderKeychainCredential(variable) {
|
|
2189
|
-
if (process.platform !== "darwin")
|
|
2190
|
-
return null;
|
|
2191
|
-
try {
|
|
2192
|
-
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$/, "");
|
|
2193
|
-
} catch {
|
|
2194
|
-
return null;
|
|
2195
|
-
}
|
|
2196
|
-
}
|
|
2197
|
-
function readLogHeaderKeychainCredential(variable) {
|
|
2198
|
-
const cached = logHeaderKeychainCache.get(variable);
|
|
2199
|
-
if (cached !== undefined)
|
|
2200
|
-
return cached;
|
|
2201
|
-
const value = readRealLogHeaderKeychainCredential(variable);
|
|
2202
|
-
logHeaderKeychainCache.set(variable, value);
|
|
2203
|
-
return value;
|
|
2204
|
-
}
|
|
2205
|
-
|
|
2206
2323
|
// src/lib/config.ts
|
|
2207
|
-
var EnvEntrySchema =
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2324
|
+
var EnvEntrySchema = z5.union([
|
|
2325
|
+
z5.literal(true),
|
|
2326
|
+
z5.object({ optional: z5.literal(true) }),
|
|
2327
|
+
z5.object({ anyOf: z5.array(z5.string()).min(2) }),
|
|
2328
|
+
z5.string()
|
|
2212
2329
|
]);
|
|
2213
|
-
var CheckEntrySchema =
|
|
2214
|
-
run:
|
|
2215
|
-
scope:
|
|
2216
|
-
include:
|
|
2217
|
-
args:
|
|
2218
|
-
timeoutMs:
|
|
2219
|
-
env:
|
|
2220
|
-
requiresOpenPr:
|
|
2221
|
-
ownWorkflow:
|
|
2222
|
-
principalOwed:
|
|
2223
|
-
validates:
|
|
2330
|
+
var CheckEntrySchema = z5.object({
|
|
2331
|
+
run: z5.string(),
|
|
2332
|
+
scope: z5.enum(["diff", "full"]),
|
|
2333
|
+
include: z5.array(z5.string()).optional(),
|
|
2334
|
+
args: z5.array(z5.string()).optional(),
|
|
2335
|
+
timeoutMs: z5.number().optional(),
|
|
2336
|
+
env: z5.record(z5.string(), EnvEntrySchema).optional(),
|
|
2337
|
+
requiresOpenPr: z5.boolean().optional(),
|
|
2338
|
+
ownWorkflow: z5.boolean().optional(),
|
|
2339
|
+
principalOwed: z5.literal(true).optional(),
|
|
2340
|
+
validates: z5.enum(["body", "issue"]).optional()
|
|
2224
2341
|
}).superRefine((entry, ctx) => {
|
|
2225
2342
|
if (!entry.env)
|
|
2226
2343
|
return;
|
|
@@ -2230,22 +2347,22 @@ var CheckEntrySchema = z4.object({
|
|
|
2230
2347
|
const members = value.anyOf;
|
|
2231
2348
|
if (new Set(members).size !== members.length) {
|
|
2232
2349
|
ctx.addIssue({
|
|
2233
|
-
code:
|
|
2350
|
+
code: z5.ZodIssueCode.custom,
|
|
2234
2351
|
message: `env.${key}.anyOf has duplicate members`,
|
|
2235
2352
|
path: ["env", key, "anyOf"]
|
|
2236
2353
|
});
|
|
2237
2354
|
}
|
|
2238
2355
|
if (!members.includes(key)) {
|
|
2239
2356
|
ctx.addIssue({
|
|
2240
|
-
code:
|
|
2357
|
+
code: z5.ZodIssueCode.custom,
|
|
2241
2358
|
message: `env.${key}.anyOf must include "${key}" itself as a member`,
|
|
2242
2359
|
path: ["env", key, "anyOf"]
|
|
2243
2360
|
});
|
|
2244
2361
|
}
|
|
2245
2362
|
}
|
|
2246
2363
|
});
|
|
2247
|
-
var RoleEntrySchema =
|
|
2248
|
-
contract:
|
|
2364
|
+
var RoleEntrySchema = z5.object({
|
|
2365
|
+
contract: z5.string().refine((p) => p.includes("/"), {
|
|
2249
2366
|
message: 'must be a path (contain at least one "/"), not a bare filename'
|
|
2250
2367
|
})
|
|
2251
2368
|
});
|
|
@@ -2269,17 +2386,17 @@ var BRIEF_BUILTINS = [
|
|
|
2269
2386
|
"briefSections",
|
|
2270
2387
|
"milestoneShape"
|
|
2271
2388
|
];
|
|
2272
|
-
var BriefSectionSchema =
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2389
|
+
var BriefSectionSchema = z5.union([
|
|
2390
|
+
z5.object({ builtin: z5.enum(BRIEF_BUILTINS) }),
|
|
2391
|
+
z5.object({ heading: z5.string().min(1), name: z5.string().optional() }),
|
|
2392
|
+
z5.object({ field: z5.string().min(1), name: z5.string().optional() }),
|
|
2393
|
+
z5.object({ phrase: z5.string().min(1), name: z5.string().optional() })
|
|
2277
2394
|
]);
|
|
2278
|
-
var BriefSchemaSchema =
|
|
2279
|
-
pr:
|
|
2280
|
-
issue:
|
|
2281
|
-
milestone:
|
|
2282
|
-
ack:
|
|
2395
|
+
var BriefSchemaSchema = z5.object({
|
|
2396
|
+
pr: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
2397
|
+
issue: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
2398
|
+
milestone: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
2399
|
+
ack: z5.array(z5.enum(BRIEF_BUILTINS)).optional()
|
|
2283
2400
|
});
|
|
2284
2401
|
function isSafeRepoRelPath(p) {
|
|
2285
2402
|
if (p.length === 0)
|
|
@@ -2288,7 +2405,7 @@ function isSafeRepoRelPath(p) {
|
|
|
2288
2405
|
return false;
|
|
2289
2406
|
return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
|
|
2290
2407
|
}
|
|
2291
|
-
var SafeRepoRelPath =
|
|
2408
|
+
var SafeRepoRelPath = z5.string().refine(isSafeRepoRelPath, {
|
|
2292
2409
|
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
2293
2410
|
});
|
|
2294
2411
|
var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
@@ -2298,22 +2415,22 @@ function isCanonicalHookBlockPath(p) {
|
|
|
2298
2415
|
var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
|
|
2299
2416
|
message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
|
|
2300
2417
|
});
|
|
2301
|
-
var ManagedBlockRecordSchema =
|
|
2418
|
+
var ManagedBlockRecordSchema = z5.object({
|
|
2302
2419
|
path: ManagedHookBlockPath,
|
|
2303
|
-
marker:
|
|
2304
|
-
comment:
|
|
2420
|
+
marker: z5.string(),
|
|
2421
|
+
comment: z5.enum(["hash", "html"])
|
|
2305
2422
|
});
|
|
2306
|
-
var ManagedManifestSchema =
|
|
2307
|
-
version:
|
|
2308
|
-
files:
|
|
2309
|
-
blocks:
|
|
2310
|
-
labels:
|
|
2311
|
-
agents:
|
|
2423
|
+
var ManagedManifestSchema = z5.object({
|
|
2424
|
+
version: z5.number().int().positive(),
|
|
2425
|
+
files: z5.array(SafeRepoRelPath),
|
|
2426
|
+
blocks: z5.array(ManagedBlockRecordSchema),
|
|
2427
|
+
labels: z5.array(z5.string()),
|
|
2428
|
+
agents: z5.array(z5.enum(AGENT_VENDORS)).optional()
|
|
2312
2429
|
});
|
|
2313
|
-
var ProjectEntrySchema =
|
|
2314
|
-
name:
|
|
2315
|
-
description:
|
|
2316
|
-
path:
|
|
2430
|
+
var ProjectEntrySchema = z5.object({
|
|
2431
|
+
name: z5.string().min(1),
|
|
2432
|
+
description: z5.string().min(1).optional(),
|
|
2433
|
+
path: z5.string().min(1).optional()
|
|
2317
2434
|
});
|
|
2318
2435
|
function parseTokensCollectDeclaration(value) {
|
|
2319
2436
|
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
@@ -2324,90 +2441,97 @@ function parseTokensCollectDeclaration(value) {
|
|
|
2324
2441
|
return null;
|
|
2325
2442
|
return { interpreter, script };
|
|
2326
2443
|
}
|
|
2327
|
-
var VinayaConfigSchema =
|
|
2328
|
-
rings:
|
|
2329
|
-
ring1_forgeWriteInterception:
|
|
2330
|
-
ring2_asyncAudits:
|
|
2444
|
+
var VinayaConfigSchema = z5.object({
|
|
2445
|
+
rings: z5.object({
|
|
2446
|
+
ring1_forgeWriteInterception: z5.boolean(),
|
|
2447
|
+
ring2_asyncAudits: z5.boolean()
|
|
2331
2448
|
}).optional(),
|
|
2332
|
-
checks:
|
|
2333
|
-
roles:
|
|
2449
|
+
checks: z5.record(z5.string(), CheckEntrySchema).optional(),
|
|
2450
|
+
roles: z5.record(z5.string(), RoleEntrySchema).optional(),
|
|
2334
2451
|
briefSchema: BriefSchemaSchema.optional(),
|
|
2335
2452
|
managed: ManagedManifestSchema.optional(),
|
|
2336
|
-
principals:
|
|
2337
|
-
releaseActor:
|
|
2338
|
-
ci:
|
|
2339
|
-
tokens:
|
|
2340
|
-
collect:
|
|
2453
|
+
principals: z5.array(z5.string()).min(1).optional(),
|
|
2454
|
+
releaseActor: z5.string().min(1).optional(),
|
|
2455
|
+
ci: z5.object({ setup: z5.string().min(1) }).optional(),
|
|
2456
|
+
tokens: z5.object({
|
|
2457
|
+
collect: z5.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
2341
2458
|
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
2342
2459
|
})
|
|
2343
2460
|
}).optional(),
|
|
2344
|
-
blastRadius:
|
|
2345
|
-
proseGates:
|
|
2346
|
-
doctrineRoot:
|
|
2347
|
-
readerFacingPrefix:
|
|
2348
|
-
readerFacingSuffix:
|
|
2349
|
-
legacySlugDir:
|
|
2350
|
-
sourceComments:
|
|
2351
|
-
globs:
|
|
2352
|
-
allowlist:
|
|
2353
|
-
severity:
|
|
2461
|
+
blastRadius: z5.object({ extraDomains: z5.array(z5.string()).optional() }).optional(),
|
|
2462
|
+
proseGates: z5.object({
|
|
2463
|
+
doctrineRoot: z5.string().min(1).optional(),
|
|
2464
|
+
readerFacingPrefix: z5.string().min(1).optional(),
|
|
2465
|
+
readerFacingSuffix: z5.string().min(1).optional(),
|
|
2466
|
+
legacySlugDir: z5.string().min(1).optional(),
|
|
2467
|
+
sourceComments: z5.object({
|
|
2468
|
+
globs: z5.array(z5.string().min(1)).optional(),
|
|
2469
|
+
allowlist: z5.array(z5.string().min(1)).optional(),
|
|
2470
|
+
severity: z5.enum(["warning", "error"]).optional()
|
|
2354
2471
|
}).optional(),
|
|
2355
|
-
specGrandfather:
|
|
2356
|
-
specPaths:
|
|
2472
|
+
specGrandfather: z5.union([z5.array(z5.string().min(1)), z5.record(z5.string().min(1), z5.number().int().min(0))]).optional(),
|
|
2473
|
+
specPaths: z5.array(z5.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
|
|
2357
2474
|
message: "must be a repository-relative path, not an absolute one"
|
|
2358
2475
|
}).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
|
|
2359
2476
|
message: "must stay inside the repository — no `..` segment"
|
|
2360
2477
|
})).optional()
|
|
2361
2478
|
}).optional(),
|
|
2362
|
-
projects:
|
|
2363
|
-
dispatch:
|
|
2364
|
-
timeoutMs:
|
|
2365
|
-
killGraceMs:
|
|
2366
|
-
agent:
|
|
2367
|
-
|
|
2479
|
+
projects: z5.array(ProjectEntrySchema).optional(),
|
|
2480
|
+
dispatch: z5.object({
|
|
2481
|
+
timeoutMs: z5.number().int().positive().optional(),
|
|
2482
|
+
killGraceMs: z5.number().int().positive().optional(),
|
|
2483
|
+
agent: z5.enum(["claude", "codex", "gemini"]).optional()
|
|
2484
|
+
}).optional(),
|
|
2485
|
+
reviewPolicy: z5.object({
|
|
2486
|
+
codeReviewThreshold: z5.string().min(1).optional(),
|
|
2487
|
+
securityThreshold: z5.string().min(1).optional(),
|
|
2488
|
+
maxRounds: z5.number().optional(),
|
|
2489
|
+
maxTaskMinutes: z5.number().optional()
|
|
2368
2490
|
}).optional(),
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
securityThreshold: z4.string().min(1).optional(),
|
|
2372
|
-
maxRounds: z4.number().optional()
|
|
2491
|
+
securityScan: z5.object({
|
|
2492
|
+
command: z5.array(z5.string().min(1)).min(1)
|
|
2373
2493
|
}).optional(),
|
|
2374
|
-
gateCutovers:
|
|
2375
|
-
objectivesSinceIssue:
|
|
2376
|
-
briefSectionsSinceIssue:
|
|
2377
|
-
documentationSinceIssue:
|
|
2378
|
-
briefRulesSincePr:
|
|
2379
|
-
agentBoxesRefusedSincePr:
|
|
2494
|
+
gateCutovers: z5.object({
|
|
2495
|
+
objectivesSinceIssue: z5.number().int().nonnegative().optional(),
|
|
2496
|
+
briefSectionsSinceIssue: z5.number().int().nonnegative().optional(),
|
|
2497
|
+
documentationSinceIssue: z5.number().int().nonnegative().optional(),
|
|
2498
|
+
briefRulesSincePr: z5.number().int().nonnegative().optional(),
|
|
2499
|
+
agentBoxesRefusedSincePr: z5.number().int().nonnegative().optional()
|
|
2380
2500
|
}).optional(),
|
|
2381
|
-
planning:
|
|
2382
|
-
collisionThreshold:
|
|
2501
|
+
planning: z5.object({
|
|
2502
|
+
collisionThreshold: z5.number().int().nonnegative().optional()
|
|
2383
2503
|
}).optional(),
|
|
2384
|
-
prePush:
|
|
2385
|
-
alwaysRun:
|
|
2504
|
+
prePush: z5.object({
|
|
2505
|
+
alwaysRun: z5.array(z5.string()).optional()
|
|
2386
2506
|
}).optional(),
|
|
2387
|
-
report:
|
|
2388
|
-
commandTimeoutMs:
|
|
2507
|
+
report: z5.object({
|
|
2508
|
+
commandTimeoutMs: z5.number().int().positive().optional()
|
|
2389
2509
|
}).superRefine((report, ctx) => {
|
|
2390
2510
|
const commandTimeoutMs = report.commandTimeoutMs;
|
|
2391
2511
|
if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
|
|
2392
2512
|
ctx.addIssue({
|
|
2393
|
-
code:
|
|
2513
|
+
code: z5.ZodIssueCode.custom,
|
|
2394
2514
|
path: ["commandTimeoutMs"],
|
|
2395
2515
|
message: "must be at most 3600000 (1 hour)"
|
|
2396
2516
|
});
|
|
2397
2517
|
}
|
|
2398
2518
|
}).optional(),
|
|
2399
|
-
logPublish:
|
|
2519
|
+
logPublish: z5.unknown().refine((v) => v === undefined, {
|
|
2400
2520
|
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
2401
2521
|
}),
|
|
2402
|
-
runtimeDir:
|
|
2403
|
-
logs:
|
|
2404
|
-
folder:
|
|
2405
|
-
url:
|
|
2406
|
-
headers:
|
|
2522
|
+
runtimeDir: z5.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
2523
|
+
logs: z5.object({
|
|
2524
|
+
folder: z5.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
2525
|
+
url: z5.string().url().optional(),
|
|
2526
|
+
headers: z5.record(z5.string()).optional(),
|
|
2527
|
+
readHeaders: z5.record(z5.string()).optional(),
|
|
2528
|
+
events: CustomEventDeclarationsSchema.optional()
|
|
2407
2529
|
}).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
|
|
2408
2530
|
message: "logs: set at most one of folder/url"
|
|
2409
2531
|
}).refine((v) => v.headers === undefined || v.url !== undefined, {
|
|
2410
2532
|
message: "logs: headers requires url"
|
|
2533
|
+
}).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
|
|
2534
|
+
message: "logs: readHeaders requires url"
|
|
2411
2535
|
}).optional()
|
|
2412
2536
|
});
|
|
2413
2537
|
var GLOBAL_VINAYA_HOME = join4(homedir(), ".vinaya");
|
|
@@ -2417,9 +2541,9 @@ function findLocalConfig() {
|
|
|
2417
2541
|
let dir = process.cwd();
|
|
2418
2542
|
while (true) {
|
|
2419
2543
|
const candidate = join4(dir, LOCAL_CONFIG_FILENAME);
|
|
2420
|
-
if (
|
|
2544
|
+
if (existsSync3(candidate))
|
|
2421
2545
|
return candidate;
|
|
2422
|
-
if (
|
|
2546
|
+
if (existsSync3(join4(dir, ".git")))
|
|
2423
2547
|
return null;
|
|
2424
2548
|
const parent = dirname3(dir);
|
|
2425
2549
|
if (parent === dir)
|
|
@@ -2431,7 +2555,7 @@ function configPath() {
|
|
|
2431
2555
|
const local = findLocalConfig();
|
|
2432
2556
|
if (local)
|
|
2433
2557
|
return local;
|
|
2434
|
-
if (
|
|
2558
|
+
if (existsSync3(GLOBAL_CONFIG_PATH))
|
|
2435
2559
|
return GLOBAL_CONFIG_PATH;
|
|
2436
2560
|
return null;
|
|
2437
2561
|
}
|
|
@@ -2515,17 +2639,12 @@ function resolveTrustAnchorLogsDestination(local, trustAnchorConfig) {
|
|
|
2515
2639
|
return "url" in anchored && anchored.url === local.url ? anchored : null;
|
|
2516
2640
|
return "folder" in anchored && anchored.folder === local.folder ? anchored : null;
|
|
2517
2641
|
}
|
|
2518
|
-
function resolveLogsHeaderValues(headers, env
|
|
2642
|
+
function resolveLogsHeaderValues(headers, env) {
|
|
2519
2643
|
if (!headers)
|
|
2520
2644
|
return;
|
|
2521
2645
|
const resolved = {};
|
|
2522
2646
|
for (const [key, value] of Object.entries(headers)) {
|
|
2523
|
-
resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) =>
|
|
2524
|
-
const fromEnv = env[name];
|
|
2525
|
-
if (fromEnv !== undefined)
|
|
2526
|
-
return fromEnv;
|
|
2527
|
-
return readKeychain(name) ?? "";
|
|
2528
|
-
});
|
|
2647
|
+
resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => env[name] ?? "");
|
|
2529
2648
|
}
|
|
2530
2649
|
return resolved;
|
|
2531
2650
|
}
|
|
@@ -2534,7 +2653,7 @@ function trustAnchorRepo() {
|
|
|
2534
2653
|
if (fromRunner)
|
|
2535
2654
|
return fromRunner;
|
|
2536
2655
|
try {
|
|
2537
|
-
const url =
|
|
2656
|
+
const url = execFileSync2("git", ["remote", "get-url", "origin"], {
|
|
2538
2657
|
encoding: "utf-8",
|
|
2539
2658
|
stdio: ["ignore", "pipe", "pipe"]
|
|
2540
2659
|
});
|
|
@@ -2581,7 +2700,7 @@ function resolveCiTrustAnchorProbeRef(env = process.env) {
|
|
|
2581
2700
|
return ref;
|
|
2582
2701
|
}
|
|
2583
2702
|
function readTrustAnchorConfigAtRef(ref) {
|
|
2584
|
-
const raw =
|
|
2703
|
+
const raw = execFileSync2("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
|
|
2585
2704
|
encoding: "utf-8",
|
|
2586
2705
|
stdio: ["ignore", "pipe", "pipe"],
|
|
2587
2706
|
timeout: 1e4
|
|
@@ -2595,7 +2714,7 @@ function ghFetchTrustAnchorConfig() {
|
|
|
2595
2714
|
const repo = trustAnchorRepo();
|
|
2596
2715
|
if (!repo)
|
|
2597
2716
|
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
2598
|
-
return
|
|
2717
|
+
return execFileSync2("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], {
|
|
2599
2718
|
encoding: "utf-8",
|
|
2600
2719
|
stdio: ["ignore", "pipe", "pipe"]
|
|
2601
2720
|
});
|
|
@@ -2686,8 +2805,8 @@ function loadConfig() {
|
|
|
2686
2805
|
var TOKENS_COLLECT_TRUST_PATH = join4(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
2687
2806
|
|
|
2688
2807
|
// src/lib/run-paths.ts
|
|
2689
|
-
import { execFileSync as
|
|
2690
|
-
import { chmodSync, existsSync as
|
|
2808
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
2809
|
+
import { chmodSync, existsSync as existsSync4, realpathSync as realpathSync2 } from "node:fs";
|
|
2691
2810
|
import { dirname as dirname4, join as join5, resolve as resolvePath } from "node:path";
|
|
2692
2811
|
var TASKS_EXECUTION_DIRNAME = "tasks-execution";
|
|
2693
2812
|
var RUN_AREA_DIRNAMES = {
|
|
@@ -2817,7 +2936,7 @@ function repoRootSync(start = process.cwd()) {
|
|
|
2817
2936
|
return null;
|
|
2818
2937
|
}
|
|
2819
2938
|
for (;; ) {
|
|
2820
|
-
if (
|
|
2939
|
+
if (existsSync4(join5(dir, ".git")))
|
|
2821
2940
|
return dir;
|
|
2822
2941
|
const parent = dirname4(dir);
|
|
2823
2942
|
if (parent === dir)
|
|
@@ -2834,7 +2953,7 @@ function resolveRepoSync() {
|
|
|
2834
2953
|
}
|
|
2835
2954
|
let url;
|
|
2836
2955
|
try {
|
|
2837
|
-
url =
|
|
2956
|
+
url = execFileSync3("git", ["remote", "get-url", "origin"], {
|
|
2838
2957
|
encoding: "utf-8",
|
|
2839
2958
|
stdio: ["ignore", "pipe", "pipe"]
|
|
2840
2959
|
}).trim();
|
|
@@ -2861,25 +2980,62 @@ function ensureRunDir(dir, runtimeDir) {
|
|
|
2861
2980
|
chmodSync(dir, 448);
|
|
2862
2981
|
}
|
|
2863
2982
|
|
|
2864
|
-
// src/lib/log
|
|
2983
|
+
// src/lib/loop-log.ts
|
|
2865
2984
|
import {
|
|
2866
2985
|
closeSync as closeSync3,
|
|
2867
2986
|
constants as fsConstants3,
|
|
2868
|
-
|
|
2987
|
+
existsSync as existsSync5,
|
|
2988
|
+
fstatSync as fstatSync2,
|
|
2869
2989
|
mkdirSync as mkdirSync3,
|
|
2870
2990
|
openSync as openSync3,
|
|
2871
|
-
linkSync as linkSync2,
|
|
2872
2991
|
readFileSync as readFileSync4,
|
|
2873
|
-
|
|
2992
|
+
readSync,
|
|
2874
2993
|
statSync as statSync2,
|
|
2994
|
+
writeSync as writeSync2
|
|
2995
|
+
} from "node:fs";
|
|
2996
|
+
import { dirname as dirname5 } from "node:path";
|
|
2997
|
+
function loopsRoot() {
|
|
2998
|
+
return runtimeDirForThisRepo();
|
|
2999
|
+
}
|
|
3000
|
+
function loopLogPathFor(_repo, issue, root = loopsRoot()) {
|
|
3001
|
+
return runPath(root, issue, { area: "output", file: "driver.log" });
|
|
3002
|
+
}
|
|
3003
|
+
var LOOP_LOG_MAX_BYTES = 8 * 1024 * 1024;
|
|
3004
|
+
function appendLoopLogLine(path, line) {
|
|
3005
|
+
try {
|
|
3006
|
+
mkdirSync3(dirname5(path), { recursive: true, mode: 448 });
|
|
3007
|
+
const fd = openSync3(path, fsConstants3.O_WRONLY | fsConstants3.O_APPEND | fsConstants3.O_CREAT | fsConstants3.O_NOFOLLOW, 384);
|
|
3008
|
+
try {
|
|
3009
|
+
const stat = fstatSync2(fd);
|
|
3010
|
+
if (stat.isFile() && stat.size < LOOP_LOG_MAX_BYTES) {
|
|
3011
|
+
writeSync2(fd, `${line}
|
|
3012
|
+
`);
|
|
3013
|
+
}
|
|
3014
|
+
} finally {
|
|
3015
|
+
closeSync3(fd);
|
|
3016
|
+
}
|
|
3017
|
+
} catch {}
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
// src/lib/log-webhook-drain.ts
|
|
3021
|
+
import {
|
|
3022
|
+
closeSync as closeSync4,
|
|
3023
|
+
constants as fsConstants4,
|
|
3024
|
+
lstatSync as lstatSync2,
|
|
3025
|
+
mkdirSync as mkdirSync4,
|
|
3026
|
+
openSync as openSync4,
|
|
3027
|
+
linkSync as linkSync2,
|
|
3028
|
+
readFileSync as readFileSync5,
|
|
3029
|
+
renameSync as renameSync2,
|
|
3030
|
+
statSync as statSync3,
|
|
2875
3031
|
unlinkSync as unlinkSync2,
|
|
2876
3032
|
utimesSync,
|
|
2877
3033
|
writeFileSync as writeFileSync2,
|
|
2878
|
-
writeSync as
|
|
3034
|
+
writeSync as writeSync3
|
|
2879
3035
|
} from "node:fs";
|
|
2880
3036
|
import { randomUUID } from "node:crypto";
|
|
2881
3037
|
import { homedir as homedir2 } from "node:os";
|
|
2882
|
-
import { dirname as
|
|
3038
|
+
import { dirname as dirname6, join as join6 } from "node:path";
|
|
2883
3039
|
var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
|
|
2884
3040
|
var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
|
|
2885
3041
|
var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
@@ -2895,13 +3051,13 @@ function isEnoent(err) {
|
|
|
2895
3051
|
var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
|
|
2896
3052
|
function tryCreateLock(lockPath, token) {
|
|
2897
3053
|
try {
|
|
2898
|
-
|
|
2899
|
-
const fd =
|
|
3054
|
+
mkdirSync4(dirname6(lockPath), { recursive: true, mode: 448 });
|
|
3055
|
+
const fd = openSync4(lockPath, fsConstants4.O_WRONLY | fsConstants4.O_CREAT | fsConstants4.O_EXCL, 384);
|
|
2900
3056
|
try {
|
|
2901
|
-
|
|
3057
|
+
writeSync3(fd, `${token}
|
|
2902
3058
|
`);
|
|
2903
3059
|
} finally {
|
|
2904
|
-
|
|
3060
|
+
closeSync4(fd);
|
|
2905
3061
|
}
|
|
2906
3062
|
return true;
|
|
2907
3063
|
} catch (err) {
|
|
@@ -2916,7 +3072,7 @@ function acquireDrainLock(lockPath) {
|
|
|
2916
3072
|
return token;
|
|
2917
3073
|
let observedMtimeMs;
|
|
2918
3074
|
try {
|
|
2919
|
-
observedMtimeMs =
|
|
3075
|
+
observedMtimeMs = statSync3(lockPath).mtimeMs;
|
|
2920
3076
|
} catch (err) {
|
|
2921
3077
|
if (!isEnoent(err))
|
|
2922
3078
|
throw err;
|
|
@@ -2934,7 +3090,7 @@ function acquireDrainLock(lockPath) {
|
|
|
2934
3090
|
}
|
|
2935
3091
|
let claimedMtimeMs = null;
|
|
2936
3092
|
try {
|
|
2937
|
-
claimedMtimeMs =
|
|
3093
|
+
claimedMtimeMs = statSync3(claimed).mtimeMs;
|
|
2938
3094
|
} catch (err) {
|
|
2939
3095
|
if (!isEnoent(err))
|
|
2940
3096
|
throw err;
|
|
@@ -2960,7 +3116,7 @@ function acquireDrainLock(lockPath) {
|
|
|
2960
3116
|
function renewDrainLock(lockPath, token) {
|
|
2961
3117
|
let holder;
|
|
2962
3118
|
try {
|
|
2963
|
-
holder =
|
|
3119
|
+
holder = readFileSync5(lockPath, "utf8").trim();
|
|
2964
3120
|
} catch (err) {
|
|
2965
3121
|
if (!isEnoent(err))
|
|
2966
3122
|
throw err;
|
|
@@ -2980,7 +3136,7 @@ function renewDrainLock(lockPath, token) {
|
|
|
2980
3136
|
}
|
|
2981
3137
|
function releaseDrainLock(lockPath, token) {
|
|
2982
3138
|
try {
|
|
2983
|
-
const holder =
|
|
3139
|
+
const holder = readFileSync5(lockPath, "utf8").trim();
|
|
2984
3140
|
if (holder !== token)
|
|
2985
3141
|
return;
|
|
2986
3142
|
unlinkSync2(lockPath);
|
|
@@ -3030,7 +3186,7 @@ function queueLines(buf) {
|
|
|
3030
3186
|
return lines;
|
|
3031
3187
|
}
|
|
3032
3188
|
function removeQueueHead(path, cut) {
|
|
3033
|
-
const remaining =
|
|
3189
|
+
const remaining = readFileSync5(path);
|
|
3034
3190
|
writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
|
|
3035
3191
|
}
|
|
3036
3192
|
function queueBucketSize(path) {
|
|
@@ -3051,7 +3207,7 @@ function queueBucketSize(path) {
|
|
|
3051
3207
|
function readQueueFile(path) {
|
|
3052
3208
|
if (queueBucketSize(path) === null)
|
|
3053
3209
|
return null;
|
|
3054
|
-
return
|
|
3210
|
+
return readFileSync5(path);
|
|
3055
3211
|
}
|
|
3056
3212
|
function rejectLine(rejectedPath, reason, status, identity, raw) {
|
|
3057
3213
|
const record = JSON.stringify({
|
|
@@ -3233,13 +3389,19 @@ function logsCredentialMissing(headers, env) {
|
|
|
3233
3389
|
const varPattern = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
|
|
3234
3390
|
for (const value of Object.values(headers)) {
|
|
3235
3391
|
for (const match of value.matchAll(varPattern)) {
|
|
3236
|
-
|
|
3237
|
-
|
|
3392
|
+
const name = match[1];
|
|
3393
|
+
if (env[name])
|
|
3394
|
+
continue;
|
|
3395
|
+
return true;
|
|
3238
3396
|
}
|
|
3239
3397
|
}
|
|
3240
3398
|
return false;
|
|
3241
3399
|
}
|
|
3242
3400
|
function resolveLogDestinationFrom(input) {
|
|
3401
|
+
const spoolDir = input.env.VINAYA_LOG_SPOOL_DIR;
|
|
3402
|
+
if (spoolDir !== undefined && spoolDir.trim() !== "") {
|
|
3403
|
+
return { kind: "folder", folder: spoolDir };
|
|
3404
|
+
}
|
|
3243
3405
|
const local = resolveLogsSetting(input.localConfig);
|
|
3244
3406
|
let effective = null;
|
|
3245
3407
|
let fallbackReason;
|
|
@@ -3279,24 +3441,73 @@ function resolveLogDestinationFrom(input) {
|
|
|
3279
3441
|
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
3280
3442
|
return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
|
|
3281
3443
|
}
|
|
3282
|
-
var
|
|
3283
|
-
function processTrustAnchor() {
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3444
|
+
var processTrustAnchorByRepo = new Map;
|
|
3445
|
+
function processTrustAnchor(repoRoot) {
|
|
3446
|
+
const cached = processTrustAnchorByRepo.get(repoRoot);
|
|
3447
|
+
if (cached !== undefined)
|
|
3448
|
+
return cached;
|
|
3449
|
+
const reading = safeLoadTrustAnchorConfig();
|
|
3450
|
+
processTrustAnchorByRepo.set(repoRoot, reading);
|
|
3451
|
+
return reading;
|
|
3287
3452
|
}
|
|
3288
3453
|
async function defaultResolveLogDestination(repo, env) {
|
|
3289
3454
|
const localConfig = loadConfig();
|
|
3290
3455
|
const unattended = isUnattendedProcess(process.env);
|
|
3456
|
+
const repoRoot = repoRootSync();
|
|
3291
3457
|
return resolveLogDestinationFrom({
|
|
3292
3458
|
localConfig,
|
|
3293
|
-
trustAnchorConfig: unattended ? await processTrustAnchor() : null,
|
|
3459
|
+
trustAnchorConfig: unattended ? await processTrustAnchor(repoRoot) : null,
|
|
3294
3460
|
unattended,
|
|
3295
3461
|
env,
|
|
3296
3462
|
defaultFolder: join7(await runtimeDirForRepoAsync(repo), "logs"),
|
|
3297
|
-
repoRoot
|
|
3463
|
+
repoRoot
|
|
3298
3464
|
});
|
|
3299
3465
|
}
|
|
3466
|
+
function unresolvedLogDestination(env) {
|
|
3467
|
+
if (hostFromEnv(env) === "ci") {
|
|
3468
|
+
return {
|
|
3469
|
+
kind: "none",
|
|
3470
|
+
reason: "the process ended before its log destination was resolved, and a CI job never records to a folder"
|
|
3471
|
+
};
|
|
3472
|
+
}
|
|
3473
|
+
const loaded = loadConfig();
|
|
3474
|
+
const localConfig = loaded?.logs?.url !== undefined ? { ...loaded, logs: undefined } : loaded;
|
|
3475
|
+
const unattended = isUnattendedProcess(process.env);
|
|
3476
|
+
const repoRoot = repoRootSync();
|
|
3477
|
+
const runtimeDir = process.env[RUNTIME_DIR_ENV_KEY] || resolveRuntimeDir({ repo: null, localConfig, trustAnchorConfig: null, unattended, repoRoot });
|
|
3478
|
+
const defaultFolder = join7(runtimeDir, "logs");
|
|
3479
|
+
const resolved = resolveLogDestinationFrom({
|
|
3480
|
+
localConfig,
|
|
3481
|
+
trustAnchorConfig: null,
|
|
3482
|
+
unattended,
|
|
3483
|
+
env,
|
|
3484
|
+
defaultFolder,
|
|
3485
|
+
repoRoot
|
|
3486
|
+
});
|
|
3487
|
+
return resolved.kind === "folder" ? resolved : { kind: "folder", folder: defaultFolder };
|
|
3488
|
+
}
|
|
3489
|
+
function folderFallbackStatePath(repo, stateRoot = GLOBAL_VINAYA_HOME) {
|
|
3490
|
+
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
3491
|
+
return join7(stateRoot, "fallback", `${dirName}.json`);
|
|
3492
|
+
}
|
|
3493
|
+
function recordFolderFallback(repo, issue, reason, now, runtimeDir, stateRoot = GLOBAL_VINAYA_HOME) {
|
|
3494
|
+
const message = describeFolderFallback(reason);
|
|
3495
|
+
if (issue !== null) {
|
|
3496
|
+
appendLoopLogLine(loopLogPathFor(repo, issue, runtimeDir), `[log] ${message}`);
|
|
3497
|
+
}
|
|
3498
|
+
try {
|
|
3499
|
+
const record = {
|
|
3500
|
+
at: now.toISOString(),
|
|
3501
|
+
reason: message,
|
|
3502
|
+
intendedUrl: reason.intendedUrl,
|
|
3503
|
+
kind: reason.kind
|
|
3504
|
+
};
|
|
3505
|
+
const path = folderFallbackStatePath(repo, stateRoot);
|
|
3506
|
+
mkdirSync5(dirname7(path), { recursive: true, mode: 448 });
|
|
3507
|
+
writeFileSync3(path, `${JSON.stringify(record)}
|
|
3508
|
+
`, { mode: 384 });
|
|
3509
|
+
} catch {}
|
|
3510
|
+
}
|
|
3300
3511
|
function isEnoent2(err) {
|
|
3301
3512
|
return typeof err === "object" && err !== null && err.code === "ENOENT";
|
|
3302
3513
|
}
|
|
@@ -3409,7 +3620,7 @@ async function resolveBranchIssue(cwd, env = process.env, repo = null) {
|
|
|
3409
3620
|
}
|
|
3410
3621
|
function readVinayaVersion() {
|
|
3411
3622
|
try {
|
|
3412
|
-
const pkg = JSON.parse(
|
|
3623
|
+
const pkg = JSON.parse(readFileSync6(join7(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
3413
3624
|
return pkg.version ?? "unknown";
|
|
3414
3625
|
} catch {
|
|
3415
3626
|
return "unknown";
|
|
@@ -3447,6 +3658,7 @@ function defaultStderr(message) {
|
|
|
3447
3658
|
}
|
|
3448
3659
|
var branchIssueFallbackEnabled = true;
|
|
3449
3660
|
var branchIssueByCwd = new Map;
|
|
3661
|
+
var branchIssueSettledByCwd = new Map;
|
|
3450
3662
|
function branchIssueRead(key, read, shared) {
|
|
3451
3663
|
if (!shared)
|
|
3452
3664
|
return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
@@ -3455,8 +3667,30 @@ function branchIssueRead(key, read, shared) {
|
|
|
3455
3667
|
return cached;
|
|
3456
3668
|
const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
3457
3669
|
branchIssueByCwd.set(key, reading);
|
|
3670
|
+
reading.then((value) => branchIssueSettledByCwd.set(key, value));
|
|
3671
|
+
return reading;
|
|
3672
|
+
}
|
|
3673
|
+
var headShaByCwd = new Map;
|
|
3674
|
+
var headShaSettledByCwd = new Map;
|
|
3675
|
+
function headShaRead(key, read, shared) {
|
|
3676
|
+
if (!shared)
|
|
3677
|
+
return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
3678
|
+
const cached = headShaByCwd.get(key);
|
|
3679
|
+
if (cached !== undefined)
|
|
3680
|
+
return cached;
|
|
3681
|
+
const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
3682
|
+
headShaByCwd.set(key, reading);
|
|
3683
|
+
reading.then((value) => headShaSettledByCwd.set(key, value));
|
|
3458
3684
|
return reading;
|
|
3459
3685
|
}
|
|
3686
|
+
async function resolveHeadSha(cwd) {
|
|
3687
|
+
try {
|
|
3688
|
+
const out = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "HEAD"], { encoding: "utf8" })).stdout.trim();
|
|
3689
|
+
return /^[0-9a-f]{40}$/.test(out) ? out : null;
|
|
3690
|
+
} catch {
|
|
3691
|
+
return null;
|
|
3692
|
+
}
|
|
3693
|
+
}
|
|
3460
3694
|
function defaultDeps() {
|
|
3461
3695
|
return {
|
|
3462
3696
|
outboxRoot: () => join7(GLOBAL_VINAYA_HOME, "outbox"),
|
|
@@ -3471,29 +3705,30 @@ function defaultDeps() {
|
|
|
3471
3705
|
inputVersions: () => {
|
|
3472
3706
|
return;
|
|
3473
3707
|
},
|
|
3474
|
-
resolveLogDestination: defaultResolveLogDestination
|
|
3708
|
+
resolveLogDestination: defaultResolveLogDestination,
|
|
3709
|
+
unresolvedLogDestination
|
|
3475
3710
|
};
|
|
3476
3711
|
}
|
|
3477
|
-
var APPEND_OPEN_FLAGS =
|
|
3712
|
+
var APPEND_OPEN_FLAGS = fsConstants5.O_WRONLY | fsConstants5.O_APPEND | fsConstants5.O_CREAT | fsConstants5.O_NOFOLLOW | fsConstants5.O_NONBLOCK;
|
|
3478
3713
|
function guardedAppendOpen(path) {
|
|
3479
3714
|
try {
|
|
3480
|
-
return
|
|
3715
|
+
return openSync5(path, APPEND_OPEN_FLAGS, 384);
|
|
3481
3716
|
} catch {
|
|
3482
3717
|
return;
|
|
3483
3718
|
}
|
|
3484
3719
|
}
|
|
3485
3720
|
function appendHardenedLine(path, line) {
|
|
3486
3721
|
try {
|
|
3487
|
-
|
|
3722
|
+
mkdirSync5(dirname7(path), { recursive: true, mode: 448 });
|
|
3488
3723
|
const fd = guardedAppendOpen(path);
|
|
3489
3724
|
if (fd === undefined)
|
|
3490
3725
|
return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
|
|
3491
3726
|
try {
|
|
3492
|
-
if (!
|
|
3727
|
+
if (!fstatSync3(fd).isFile())
|
|
3493
3728
|
return `target is not a regular file: ${path}`;
|
|
3494
|
-
|
|
3729
|
+
writeSync4(fd, line);
|
|
3495
3730
|
} finally {
|
|
3496
|
-
|
|
3731
|
+
closeSync5(fd);
|
|
3497
3732
|
}
|
|
3498
3733
|
return null;
|
|
3499
3734
|
} catch (err) {
|
|
@@ -3503,7 +3738,7 @@ function appendHardenedLine(path, line) {
|
|
|
3503
3738
|
function reportRotationOverflow(backupPath, warn) {
|
|
3504
3739
|
let raw;
|
|
3505
3740
|
try {
|
|
3506
|
-
raw =
|
|
3741
|
+
raw = readFileSync6(backupPath, "utf8");
|
|
3507
3742
|
} catch {
|
|
3508
3743
|
return;
|
|
3509
3744
|
}
|
|
@@ -3526,7 +3761,7 @@ function reportRotationOverflow(backupPath, warn) {
|
|
|
3526
3761
|
}
|
|
3527
3762
|
function appendLine(path, line, warn) {
|
|
3528
3763
|
try {
|
|
3529
|
-
|
|
3764
|
+
mkdirSync5(dirname7(path), { recursive: true, mode: 448 });
|
|
3530
3765
|
let fd = guardedAppendOpen(path);
|
|
3531
3766
|
if (fd === undefined) {
|
|
3532
3767
|
warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
|
|
@@ -3535,14 +3770,14 @@ function appendLine(path, line, warn) {
|
|
|
3535
3770
|
}
|
|
3536
3771
|
let closed = false;
|
|
3537
3772
|
try {
|
|
3538
|
-
const stat =
|
|
3773
|
+
const stat = fstatSync3(fd);
|
|
3539
3774
|
if (!stat.isFile()) {
|
|
3540
3775
|
warn(`vinaya: log outbox target is not a regular file — refusing to write: ${path}
|
|
3541
3776
|
`);
|
|
3542
3777
|
return;
|
|
3543
3778
|
}
|
|
3544
3779
|
if (stat.size > OUTBOX_MAX_BYTES) {
|
|
3545
|
-
|
|
3780
|
+
closeSync5(fd);
|
|
3546
3781
|
closed = true;
|
|
3547
3782
|
const backupPath = path.replace(/\.ndjson$/, ".1.ndjson");
|
|
3548
3783
|
reportRotationOverflow(backupPath, warn);
|
|
@@ -3556,10 +3791,10 @@ function appendLine(path, line, warn) {
|
|
|
3556
3791
|
fd = rotated;
|
|
3557
3792
|
closed = false;
|
|
3558
3793
|
}
|
|
3559
|
-
|
|
3794
|
+
writeSync4(fd, line);
|
|
3560
3795
|
} finally {
|
|
3561
3796
|
if (!closed)
|
|
3562
|
-
|
|
3797
|
+
closeSync5(fd);
|
|
3563
3798
|
}
|
|
3564
3799
|
} catch (err) {
|
|
3565
3800
|
warn(`vinaya: log outbox write failed — ${err instanceof Error ? err.message : String(err)}
|
|
@@ -3570,12 +3805,14 @@ function createLogSink(overrides = {}) {
|
|
|
3570
3805
|
const deps = {
|
|
3571
3806
|
...defaultDeps(),
|
|
3572
3807
|
resolveBranchIssue: (repo) => resolveBranchIssue(deps.cwd(), deps.env(), repo),
|
|
3808
|
+
resolveHeadSha: () => resolveHeadSha(deps.cwd()),
|
|
3573
3809
|
...overrides
|
|
3574
3810
|
};
|
|
3575
3811
|
const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
|
|
3576
3812
|
const processId = randomUUID2();
|
|
3577
3813
|
let seq = 0;
|
|
3578
3814
|
let warned = false;
|
|
3815
|
+
let folderFallbackRecorded = false;
|
|
3579
3816
|
const warnOnce = (message) => {
|
|
3580
3817
|
if (warned)
|
|
3581
3818
|
return;
|
|
@@ -3593,6 +3830,7 @@ function createLogSink(overrides = {}) {
|
|
|
3593
3830
|
};
|
|
3594
3831
|
const readerIsReal = overrides.resolveBranchIssue === undefined;
|
|
3595
3832
|
let ownBranchIssue;
|
|
3833
|
+
let ownBranchIssueSettled = null;
|
|
3596
3834
|
const branchIssueOnce = (repo) => {
|
|
3597
3835
|
if (!branchIssueFallbackEnabled)
|
|
3598
3836
|
return Promise.resolve(null);
|
|
@@ -3600,10 +3838,36 @@ function createLogSink(overrides = {}) {
|
|
|
3600
3838
|
const read = () => deps.resolveBranchIssue(slug);
|
|
3601
3839
|
if (readerIsReal)
|
|
3602
3840
|
return branchIssueRead(`${deps.cwd()}\x00${slug ?? ""}`, read, true);
|
|
3603
|
-
if (ownBranchIssue === undefined)
|
|
3841
|
+
if (ownBranchIssue === undefined) {
|
|
3604
3842
|
ownBranchIssue = branchIssueRead(deps.cwd(), read, false);
|
|
3843
|
+
ownBranchIssue.then((value) => {
|
|
3844
|
+
ownBranchIssueSettled = value;
|
|
3845
|
+
});
|
|
3846
|
+
}
|
|
3605
3847
|
return ownBranchIssue;
|
|
3606
3848
|
};
|
|
3849
|
+
const branchIssueIfSettled = (repo) => {
|
|
3850
|
+
if (!branchIssueFallbackEnabled)
|
|
3851
|
+
return null;
|
|
3852
|
+
if (!readerIsReal)
|
|
3853
|
+
return ownBranchIssueSettled;
|
|
3854
|
+
return branchIssueSettledByCwd.get(`${deps.cwd()}\x00${safeRepoSlug(repo) ?? ""}`) ?? null;
|
|
3855
|
+
};
|
|
3856
|
+
const headShaReaderIsReal = overrides.resolveHeadSha === undefined;
|
|
3857
|
+
let ownHeadSha;
|
|
3858
|
+
let ownHeadShaSettled = null;
|
|
3859
|
+
const headShaOnce = () => {
|
|
3860
|
+
if (headShaReaderIsReal)
|
|
3861
|
+
return headShaRead(deps.cwd(), deps.resolveHeadSha, true);
|
|
3862
|
+
if (ownHeadSha === undefined) {
|
|
3863
|
+
ownHeadSha = headShaRead(deps.cwd(), deps.resolveHeadSha, false);
|
|
3864
|
+
ownHeadSha.then((value) => {
|
|
3865
|
+
ownHeadShaSettled = value;
|
|
3866
|
+
});
|
|
3867
|
+
}
|
|
3868
|
+
return ownHeadSha;
|
|
3869
|
+
};
|
|
3870
|
+
const headShaIfSettled = () => headShaReaderIsReal ? headShaSettledByCwd.get(deps.cwd()) ?? null : ownHeadShaSettled;
|
|
3607
3871
|
let resolveRepoCache;
|
|
3608
3872
|
const resolveRepoOnce = () => {
|
|
3609
3873
|
if (resolveRepoCache === undefined)
|
|
@@ -3611,6 +3875,7 @@ function createLogSink(overrides = {}) {
|
|
|
3611
3875
|
return resolveRepoCache;
|
|
3612
3876
|
};
|
|
3613
3877
|
let contextCache;
|
|
3878
|
+
let settledContext;
|
|
3614
3879
|
const context = () => {
|
|
3615
3880
|
if (contextCache === undefined) {
|
|
3616
3881
|
const env = deps.env();
|
|
@@ -3619,11 +3884,16 @@ function createLogSink(overrides = {}) {
|
|
|
3619
3884
|
doctrine()
|
|
3620
3885
|
]).then(async ([resolved, doctrineValue]) => {
|
|
3621
3886
|
const repo = resolved && isSafeRepoSegment3(resolved.owner) && isSafeRepoSegment3(resolved.repo) ? resolved : null;
|
|
3622
|
-
|
|
3887
|
+
settledContext = { repo, doctrine: doctrineValue, destination: await deps.resolveLogDestination(repo, env) };
|
|
3888
|
+
return settledContext;
|
|
3623
3889
|
});
|
|
3624
3890
|
}
|
|
3625
3891
|
return contextCache;
|
|
3626
3892
|
};
|
|
3893
|
+
const resetContext = () => {
|
|
3894
|
+
contextCache = undefined;
|
|
3895
|
+
settledContext = undefined;
|
|
3896
|
+
};
|
|
3627
3897
|
let drainChain = Promise.resolve();
|
|
3628
3898
|
const pendingWrites = new Set;
|
|
3629
3899
|
let writeChain = Promise.resolve();
|
|
@@ -3635,63 +3905,88 @@ function createLogSink(overrides = {}) {
|
|
|
3635
3905
|
`);
|
|
3636
3906
|
});
|
|
3637
3907
|
};
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3908
|
+
const snapshot = () => {
|
|
3909
|
+
const env = deps.env();
|
|
3910
|
+
return {
|
|
3911
|
+
host: hostFromEnv(env),
|
|
3912
|
+
now: deps.now(),
|
|
3913
|
+
seq: seq++,
|
|
3914
|
+
envFields: {
|
|
3645
3915
|
role: env.VINAYA_ROLE,
|
|
3646
3916
|
task: env.VINAYA_TASK,
|
|
3647
3917
|
round: env.VINAYA_ROUND,
|
|
3918
|
+
pr: env.VINAYA_PR,
|
|
3648
3919
|
run: env.VINAYA_RUN || runId,
|
|
3649
3920
|
attempt: env.VINAYA_ATTEMPT,
|
|
3650
|
-
parent: env.VINAYA_PARENT_EVENT
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3921
|
+
parent: env.VINAYA_PARENT_EVENT,
|
|
3922
|
+
workRef: env.VINAYA_WORK_REF,
|
|
3923
|
+
flow: env.VINAYA_FLOW,
|
|
3924
|
+
flowVersion: env.VINAYA_FLOW_VERSION,
|
|
3925
|
+
runtime: env.VINAYA_RUNTIME,
|
|
3926
|
+
source: env.VINAYA_SOURCE
|
|
3927
|
+
}
|
|
3928
|
+
};
|
|
3929
|
+
};
|
|
3930
|
+
const writeEvent = (e, call, ctx, branchIssue, headSha, deliver) => {
|
|
3931
|
+
const { repo, doctrine: doctrineValue, destination } = ctx;
|
|
3932
|
+
if (destination.kind === "none") {
|
|
3933
|
+
warnOnce(`vinaya: not recording — ${destination.reason}
|
|
3656
3934
|
`);
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3935
|
+
return;
|
|
3936
|
+
}
|
|
3937
|
+
if (destination.kind === "folder" && destination.fallbackReason) {
|
|
3938
|
+
warnOnce(`vinaya: ${describeFolderFallback(destination.fallbackReason)}
|
|
3661
3939
|
`);
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3940
|
+
}
|
|
3941
|
+
const built = buildHeader({
|
|
3942
|
+
now: call.now,
|
|
3943
|
+
runId,
|
|
3944
|
+
seq: call.seq,
|
|
3945
|
+
repo: repo ? `${repo.owner}/${repo.repo}` : null,
|
|
3946
|
+
vinaya: deps.vinayaVersion(),
|
|
3947
|
+
doctrine: doctrineValue,
|
|
3948
|
+
host: call.host,
|
|
3949
|
+
hostname: deps.hostname(),
|
|
3950
|
+
env: call.envFields,
|
|
3951
|
+
branchIssue,
|
|
3952
|
+
eventId: randomUUID2(),
|
|
3953
|
+
processId,
|
|
3954
|
+
inputVersions: deps.inputVersions()
|
|
3955
|
+
});
|
|
3956
|
+
const header = headSha === null ? built : { ...built, subject: { ...built.subject, sha: headSha } };
|
|
3957
|
+
if (destination.kind === "folder" && destination.fallbackReason && !folderFallbackRecorded) {
|
|
3958
|
+
folderFallbackRecorded = true;
|
|
3959
|
+
recordFolderFallback(repo, header.subject.issue, destination.fallbackReason, call.now, dirname7(destination.folder), join7(deps.home(), ".vinaya"));
|
|
3960
|
+
}
|
|
3961
|
+
const full = { ...e, ...header };
|
|
3962
|
+
const parsed = LogEventSchema.safeParse(full);
|
|
3963
|
+
if (!parsed.success) {
|
|
3964
|
+
warnOnce(`vinaya: log() refused an invalid payload — ${parsed.error.issues[0]?.message ?? "schema violation"}
|
|
3683
3965
|
`);
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3966
|
+
return;
|
|
3967
|
+
}
|
|
3968
|
+
const line = `${JSON.stringify(redact(parsed.data, deps.home()))}
|
|
3687
3969
|
`;
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3970
|
+
if (destination.kind === "server") {
|
|
3971
|
+
appendLine(outboxPathFor(deps, repo, header.subject.issue), line, warnOnce);
|
|
3972
|
+
if (deliver)
|
|
3973
|
+
scheduleWebhookDrain(header.subject.issue, destination.url, destination.headers);
|
|
3974
|
+
} else {
|
|
3975
|
+
appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
|
|
3976
|
+
}
|
|
3977
|
+
};
|
|
3978
|
+
function log(e) {
|
|
3979
|
+
try {
|
|
3980
|
+
const call = snapshot();
|
|
3981
|
+
const write = async () => {
|
|
3982
|
+
const ctx = await context();
|
|
3983
|
+
if (ctx.destination.kind === "none") {
|
|
3984
|
+
writeEvent(e, call, ctx, null, null, true);
|
|
3985
|
+
return;
|
|
3694
3986
|
}
|
|
3987
|
+
const branchIssue = call.envFields.task ? null : await branchIssueOnce(ctx.repo);
|
|
3988
|
+
const headSha = e.kind === "gate" ? await headShaOnce() : null;
|
|
3989
|
+
writeEvent(e, call, ctx, branchIssue, headSha, true);
|
|
3695
3990
|
};
|
|
3696
3991
|
const written = writeChain.then(write).catch((err) => {
|
|
3697
3992
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
@@ -3702,6 +3997,26 @@ function createLogSink(overrides = {}) {
|
|
|
3702
3997
|
written.finally(() => pendingWrites.delete(written));
|
|
3703
3998
|
} catch (err) {
|
|
3704
3999
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
4000
|
+
`);
|
|
4001
|
+
}
|
|
4002
|
+
}
|
|
4003
|
+
function logSync(e, opts = {}) {
|
|
4004
|
+
try {
|
|
4005
|
+
const call = snapshot();
|
|
4006
|
+
let ctx = settledContext;
|
|
4007
|
+
if (ctx === undefined) {
|
|
4008
|
+
const destination = deps.unresolvedLogDestination(deps.env());
|
|
4009
|
+
if (destination.kind === "folder" && !opts.quiet) {
|
|
4010
|
+
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
|
|
4011
|
+
`);
|
|
4012
|
+
}
|
|
4013
|
+
ctx = { repo: null, doctrine: "unknown", destination };
|
|
4014
|
+
}
|
|
4015
|
+
const branchIssue = ctx.destination.kind === "none" || call.envFields.task ? null : branchIssueIfSettled(ctx.repo);
|
|
4016
|
+
const headSha = e.kind === "gate" && ctx.destination.kind !== "none" ? headShaIfSettled() : null;
|
|
4017
|
+
writeEvent(e, call, ctx, branchIssue, headSha, false);
|
|
4018
|
+
} catch (err) {
|
|
4019
|
+
warnOnce(`vinaya: logSync() failed — ${err instanceof Error ? err.message : String(err)}
|
|
3705
4020
|
`);
|
|
3706
4021
|
}
|
|
3707
4022
|
}
|
|
@@ -3722,18 +4037,15 @@ function createLogSink(overrides = {}) {
|
|
|
3722
4037
|
return;
|
|
3723
4038
|
});
|
|
3724
4039
|
};
|
|
3725
|
-
return { log, runId, warmup, drain };
|
|
4040
|
+
return { log, logSync, runId, warmup, drain, resetContext };
|
|
3726
4041
|
}
|
|
3727
4042
|
var defaultSink = createLogSink();
|
|
3728
4043
|
|
|
3729
4044
|
// src/checks/runner.ts
|
|
3730
4045
|
var activeChecks = new Map;
|
|
3731
4046
|
|
|
3732
|
-
// src/lib/loop-log.ts
|
|
3733
|
-
var LOOP_LOG_MAX_BYTES = 8 * 1024 * 1024;
|
|
3734
|
-
|
|
3735
4047
|
// src/lib/brief-assembly.ts
|
|
3736
|
-
import { existsSync as existsSync7, readFileSync as
|
|
4048
|
+
import { existsSync as existsSync7, readFileSync as readFileSync7, readdirSync as readdirSync2 } from "node:fs";
|
|
3737
4049
|
import { join as join8 } from "node:path";
|
|
3738
4050
|
|
|
3739
4051
|
// ../../packages/sources/src/commands.ts
|
|
@@ -3890,7 +4202,7 @@ var COMMANDS = [
|
|
|
3890
4202
|
"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.",
|
|
3891
4203
|
"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.",
|
|
3892
4204
|
"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.",
|
|
3893
|
-
"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
|
|
4205
|
+
"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`)."
|
|
3894
4206
|
],
|
|
3895
4207
|
status: "shipped"
|
|
3896
4208
|
},
|
|
@@ -3975,13 +4287,14 @@ var COMMANDS = [
|
|
|
3975
4287
|
},
|
|
3976
4288
|
{
|
|
3977
4289
|
flag: "--push",
|
|
3978
|
-
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
|
|
4290
|
+
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."
|
|
3979
4291
|
}
|
|
3980
4292
|
],
|
|
3981
4293
|
details: [
|
|
3982
4294
|
"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.",
|
|
3983
4295
|
"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.",
|
|
3984
|
-
"`--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.
|
|
4296
|
+
"`--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.",
|
|
4297
|
+
"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."
|
|
3985
4298
|
],
|
|
3986
4299
|
status: "shipped"
|
|
3987
4300
|
},
|
|
@@ -4006,7 +4319,7 @@ var COMMANDS = [
|
|
|
4006
4319
|
"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.",
|
|
4007
4320
|
"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.",
|
|
4008
4321
|
"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.",
|
|
4009
|
-
"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
|
|
4322
|
+
"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."
|
|
4010
4323
|
],
|
|
4011
4324
|
status: "shipped"
|
|
4012
4325
|
},
|
|
@@ -4177,7 +4490,7 @@ var COMMANDS = [
|
|
|
4177
4490
|
{ flag: "--secrets", description: "security only: the SECRETS line" },
|
|
4178
4491
|
{
|
|
4179
4492
|
flag: "--secrets-evidence-file",
|
|
4180
|
-
description: 'security only: required whenever `--secrets` claims "none found" — the
|
|
4493
|
+
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'
|
|
4181
4494
|
},
|
|
4182
4495
|
{ flag: "--task-id", description: "the closing `Tokens:` line's task id" },
|
|
4183
4496
|
{ flag: "--model", description: "the closing `Tokens:` line's model name" },
|
|
@@ -4285,7 +4598,20 @@ var COMMANDS = [
|
|
|
4285
4598
|
flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
|
|
4286
4599
|
details: [
|
|
4287
4600
|
"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.",
|
|
4288
|
-
"Once every task Issue is closed, prompts for confirmation (unless `--yes`) and closes
|
|
4601
|
+
"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.",
|
|
4602
|
+
"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.",
|
|
4603
|
+
"Idempotent: on a tranche whose Milestone is already closed and carries its retrospective, changes nothing and says it is already archived.",
|
|
4604
|
+
"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."
|
|
4605
|
+
],
|
|
4606
|
+
status: "shipped"
|
|
4607
|
+
},
|
|
4608
|
+
{
|
|
4609
|
+
name: "archive tranches",
|
|
4610
|
+
description: "Archive every finished tranche that has no closed Milestone carrying its retrospective",
|
|
4611
|
+
flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
|
|
4612
|
+
details: [
|
|
4613
|
+
"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.",
|
|
4614
|
+
"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."
|
|
4289
4615
|
],
|
|
4290
4616
|
status: "shipped"
|
|
4291
4617
|
},
|
|
@@ -4429,6 +4755,29 @@ var COMMANDS = [
|
|
|
4429
4755
|
],
|
|
4430
4756
|
status: "shipped"
|
|
4431
4757
|
},
|
|
4758
|
+
{
|
|
4759
|
+
name: "log selftest",
|
|
4760
|
+
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)",
|
|
4761
|
+
details: [
|
|
4762
|
+
"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.",
|
|
4763
|
+
"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.",
|
|
4764
|
+
"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."
|
|
4765
|
+
],
|
|
4766
|
+
status: "shipped"
|
|
4767
|
+
},
|
|
4768
|
+
{
|
|
4769
|
+
name: "log emit",
|
|
4770
|
+
description: "Record a consumer-declared event (`logs.events` in vinaya.config.json) from a script or agent outside Vinaya",
|
|
4771
|
+
flags: [
|
|
4772
|
+
{ flag: "--json '<json>'", description: "The field values as one JSON object (else read from standard input)" }
|
|
4773
|
+
],
|
|
4774
|
+
details: [
|
|
4775
|
+
"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.",
|
|
4776
|
+
"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.",
|
|
4777
|
+
"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)."
|
|
4778
|
+
],
|
|
4779
|
+
status: "shipped"
|
|
4780
|
+
},
|
|
4432
4781
|
{
|
|
4433
4782
|
name: "log send",
|
|
4434
4783
|
description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
|
|
@@ -4441,28 +4790,42 @@ var COMMANDS = [
|
|
|
4441
4790
|
status: "shipped"
|
|
4442
4791
|
},
|
|
4443
4792
|
{
|
|
4444
|
-
name: "
|
|
4445
|
-
description: "
|
|
4793
|
+
name: "sync",
|
|
4794
|
+
description: "Fill, resume and rebuild the local log cache from this repository's configured destination (read-only)",
|
|
4795
|
+
flags: [
|
|
4796
|
+
{
|
|
4797
|
+
flag: "--rebuild",
|
|
4798
|
+
description: "Delete the cache file and sync from the beginning of what the destination still retains"
|
|
4799
|
+
},
|
|
4800
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
4801
|
+
],
|
|
4446
4802
|
details: [
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
"
|
|
4803
|
+
"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.",
|
|
4804
|
+
"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.",
|
|
4805
|
+
"`--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."
|
|
4450
4806
|
],
|
|
4451
4807
|
status: "shipped"
|
|
4452
4808
|
}
|
|
4453
4809
|
];
|
|
4454
4810
|
// ../../packages/sources/src/select-source.ts
|
|
4455
|
-
import { z as
|
|
4456
|
-
var StateSourceConfigSchema =
|
|
4457
|
-
|
|
4458
|
-
|
|
4811
|
+
import { z as z6 } from "zod";
|
|
4812
|
+
var StateSourceConfigSchema = z6.discriminatedUnion("kind", [
|
|
4813
|
+
z6.object({ kind: z6.literal("forge"), owner: z6.string(), repo: z6.string() }),
|
|
4814
|
+
z6.object({ kind: z6.literal("file"), root: z6.string().optional() })
|
|
4459
4815
|
]);
|
|
4460
4816
|
// src/checks/edge-resolve.ts
|
|
4461
4817
|
var issueCache = new Map;
|
|
4462
4818
|
var siblingTrancheCache = new Map;
|
|
4463
4819
|
|
|
4464
4820
|
// src/commands/doctrine.ts
|
|
4821
|
+
import matter4 from "gray-matter";
|
|
4822
|
+
|
|
4823
|
+
// ../../packages/aeg-core/src/docs/parse-doc.ts
|
|
4465
4824
|
import matter2 from "gray-matter";
|
|
4825
|
+
// ../../packages/aeg-core/src/docs/surfaced-manifest.ts
|
|
4826
|
+
var NO_MODEL_BACKED_PATHS = new Set;
|
|
4827
|
+
// src/roles/contract.ts
|
|
4828
|
+
import matter3 from "gray-matter";
|
|
4466
4829
|
|
|
4467
4830
|
// src/lib/brief-assembly.ts
|
|
4468
4831
|
var PACKAGE_ROOT = packageRoot(import.meta.url);
|
|
@@ -4478,31 +4841,6 @@ var INFORMATIONAL_DISPATCH_BLOCKER_CLASSES = new Set([
|
|
|
4478
4841
|
"conflicts-with"
|
|
4479
4842
|
]);
|
|
4480
4843
|
|
|
4481
|
-
// src/lib/dispatch.ts
|
|
4482
|
-
var MAX_TEE_BYTES = 8 * 1024 * 1024;
|
|
4483
|
-
var CLAUDE_MODEL_ALIASES = new Set(["fable", "opus", "sonnet", "haiku"]);
|
|
4484
|
-
var NO_SUBSCRIPTION_LOGIN_REASON = "this agent has no subscription login in Vinaya yet, and no agent authenticates with an API key — " + "dispatch a vendor whose subscription login Vinaya can stage (claude, codex)";
|
|
4485
|
-
|
|
4486
|
-
// src/commands/tokens.ts
|
|
4487
|
-
var USAGE = [
|
|
4488
|
-
'Usage: vinaya tokens --phase "<task-id>: develop" --role Developer',
|
|
4489
|
-
" [--model <id>] [--transcript <path>] [--in <tokens-in> --out <tokens-out>]",
|
|
4490
|
-
"",
|
|
4491
|
-
" --transcript Read this transcript directly. Supported primary route — use it whenever you know",
|
|
4492
|
-
" which transcript is yours, and always in a repo with no track-transcript.sh hook.",
|
|
4493
|
-
" (omitted) Resolve via the Stop-hook pointer file, if this repo installs that hook.",
|
|
4494
|
-
" --in/--out Manual entry: the exact token figures, for a host whose usage arrives by some other",
|
|
4495
|
-
" means than a Claude Code transcript. Both required together; skips transcript",
|
|
4496
|
-
" resolution entirely.",
|
|
4497
|
-
"",
|
|
4498
|
-
"Usage: vinaya tokens --trust-collect",
|
|
4499
|
-
" Approves this repo's declared tokens.collect command, pinned to the script's exact current",
|
|
4500
|
-
" content, on this machine. Run this once before tokens.collect will ever execute — a changed",
|
|
4501
|
-
" interpreter, script path, or script CONTENT needs its own fresh approval. Does not take",
|
|
4502
|
-
" --phase/--role and never emits a Tokens: line."
|
|
4503
|
-
].join(`
|
|
4504
|
-
`);
|
|
4505
|
-
|
|
4506
4844
|
// src/lib/pr-report-engine.ts
|
|
4507
4845
|
var execFileAsync6 = promisify6(execFile6);
|
|
4508
4846
|
var BODY_READING_CHECK_NAMES = new Set(coreCheckRegistry().filter((spec) => {
|
|
@@ -4512,21 +4850,21 @@ var BODY_READING_CHECK_NAMES = new Set(coreCheckRegistry().filter((spec) => {
|
|
|
4512
4850
|
var FAILING_STATUSES = new Set(["fail", "error", "timeout"]);
|
|
4513
4851
|
function readTestRunCacheFile(path) {
|
|
4514
4852
|
try {
|
|
4515
|
-
if (!
|
|
4853
|
+
if (!lstatSync4(path).isFile())
|
|
4516
4854
|
return {};
|
|
4517
|
-
return JSON.parse(
|
|
4855
|
+
return JSON.parse(readFileSync8(path, "utf8"));
|
|
4518
4856
|
} catch {
|
|
4519
4857
|
return {};
|
|
4520
4858
|
}
|
|
4521
4859
|
}
|
|
4522
4860
|
function writeTestRunCacheFile(path, all) {
|
|
4523
4861
|
const tmp = `${path}.tmp-${process.pid}-${randomUUID3()}`;
|
|
4524
|
-
const fd =
|
|
4862
|
+
const fd = openSync6(tmp, fsConstants6.O_WRONLY | fsConstants6.O_CREAT | fsConstants6.O_EXCL, 384);
|
|
4525
4863
|
try {
|
|
4526
|
-
|
|
4864
|
+
writeSync5(fd, JSON.stringify(all, null, 2), null, "utf8");
|
|
4527
4865
|
fsyncSync2(fd);
|
|
4528
4866
|
} finally {
|
|
4529
|
-
|
|
4867
|
+
closeSync6(fd);
|
|
4530
4868
|
}
|
|
4531
4869
|
renameSync4(tmp, path);
|
|
4532
4870
|
}
|
|
@@ -4536,7 +4874,7 @@ function fileBackedTestRunCache(path, runtimeDir) {
|
|
|
4536
4874
|
set: (key, record) => {
|
|
4537
4875
|
const all = readTestRunCacheFile(path);
|
|
4538
4876
|
all[key] = record;
|
|
4539
|
-
ensureRunDir(
|
|
4877
|
+
ensureRunDir(dirname8(path), runtimeDir);
|
|
4540
4878
|
writeTestRunCacheFile(path, all);
|
|
4541
4879
|
}
|
|
4542
4880
|
};
|
|
@@ -4578,7 +4916,7 @@ async function collectStateFields(cwd) {
|
|
|
4578
4916
|
for (const f of uncommitted) {
|
|
4579
4917
|
fields.push(f);
|
|
4580
4918
|
try {
|
|
4581
|
-
fields.push(
|
|
4919
|
+
fields.push(readFileSync8(join9(base, f)));
|
|
4582
4920
|
} catch {
|
|
4583
4921
|
fields.push("MISSING");
|
|
4584
4922
|
}
|
|
@@ -4676,21 +5014,6 @@ async function recordGreenTestRun(command, output, cwd, source, cache = defaultT
|
|
|
4676
5014
|
}
|
|
4677
5015
|
return true;
|
|
4678
5016
|
}
|
|
4679
|
-
var TOKEN_ROW_REMEDY = [
|
|
4680
|
-
"Nothing here established that this host cannot meter — only that this session resolved no",
|
|
4681
|
-
"transcript of its own. Report real figures by naming your own transcript:",
|
|
4682
|
-
"",
|
|
4683
|
-
" vinaya pr report --write <body-file> --transcript <path>",
|
|
4684
|
-
"",
|
|
4685
|
-
"or, on a host whose usage arrives by some other means, format figures you already hold with:",
|
|
4686
|
-
"",
|
|
4687
|
-
' vinaya tokens --phase "<task-id>: develop" --role Developer --in <tokens-in> --out <tokens-out>',
|
|
4688
|
-
"",
|
|
4689
|
-
"and transcribe them into the `## Token report` table. That command prints a `Tokens:` line, not",
|
|
4690
|
-
"a table row — the table takes | Phase | Role | Agent/Model | Tokens in | Tokens out | Cost | Date |,",
|
|
4691
|
-
"and a line inside the block that does not start with `|` truncates the table for every row after it."
|
|
4692
|
-
].join(`
|
|
4693
|
-
`);
|
|
4694
5017
|
|
|
4695
5018
|
// src/lib/pre-push-cache-test-run.ts
|
|
4696
5019
|
async function main() {
|
|
@@ -4703,7 +5026,7 @@ async function main() {
|
|
|
4703
5026
|
}
|
|
4704
5027
|
let output;
|
|
4705
5028
|
try {
|
|
4706
|
-
output =
|
|
5029
|
+
output = readFileSync9(logPath, "utf8");
|
|
4707
5030
|
} catch (err) {
|
|
4708
5031
|
process.stderr.write(`vinaya pre-push: could not read ${logPath} to cache this run — nothing recorded (${err instanceof Error ? err.message : String(err)}).
|
|
4709
5032
|
`);
|