@attalabs/vinaya 0.35.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 +23 -8
- package/aeg-root/roles/planner.md +2 -0
- package/aeg-root/roles/principal.md +6 -1
- package/aeg-root/roles/reviewer.md +11 -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 +10 -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 +2081 -1883
- package/dist/checks/bin/check-branch-topology.js +1376 -1139
- package/dist/checks/bin/check-brief-shape.js +2081 -1883
- package/dist/checks/bin/check-changeset-coverage.js +2564 -2025
- package/dist/checks/bin/check-closes-n.js +1376 -1139
- package/dist/checks/bin/check-coherence.js +1480 -1228
- package/dist/checks/bin/check-dead-branch-push.js +1339 -1156
- package/dist/checks/bin/check-dispatch-readiness.js +1480 -1228
- package/dist/checks/bin/check-doc-coverage-push.js +2563 -2024
- package/dist/checks/bin/check-doc-coverage.js +2565 -2026
- package/dist/checks/bin/check-doctrine-no-procedures.js +2081 -1883
- package/dist/checks/bin/check-doctrine-portability.js +2563 -2024
- package/dist/checks/bin/check-evidence-fresh.js +1906 -1536
- package/dist/checks/bin/check-exec-bits.js +2136 -1597
- package/dist/checks/bin/check-first-push-dispatch.js +1480 -1228
- package/dist/checks/bin/check-issue-assignment.js +1376 -1139
- package/dist/checks/bin/check-issue-milestone-attach.js +1339 -1156
- package/dist/checks/bin/check-issue-objectives-numbering.js +2081 -1883
- package/dist/checks/bin/check-issue-parts-coverage.js +1339 -1156
- package/dist/checks/bin/check-issue-surface-globs.js +1488 -1227
- package/dist/checks/bin/check-issue-title-grammar.js +1339 -1156
- package/dist/checks/bin/check-issue-tranche-label.js +1339 -1156
- package/dist/checks/bin/check-main-branch-refusal.js +1342 -1159
- package/dist/checks/bin/check-no-disk-state.js +1342 -1159
- package/dist/checks/bin/check-pr-premise-reassert.js +2081 -1883
- package/dist/checks/bin/check-pr-report-density.js +1342 -1159
- package/dist/checks/bin/check-principal-test-plan-wait.js +1342 -1159
- package/dist/checks/bin/check-quoted-command.js +4063 -3526
- package/dist/checks/bin/check-reader-resolvable-prose.js +4082 -3533
- package/dist/checks/bin/check-registry-gates.js +1363 -1167
- package/dist/checks/bin/check-retired-vocabulary.js +4057 -3520
- package/dist/checks/bin/check-review-gate.js +2081 -1883
- package/dist/checks/bin/check-single-plan-pr.js +1339 -1156
- package/dist/checks/bin/check-surface-scope.js +1376 -1139
- package/dist/checks/bin/check-test-plan.js +1339 -1156
- package/dist/checks/bin/check-token-collection-wired.js +1342 -1159
- package/dist/checks/bin/check-token-report.js +1409 -1342
- package/dist/checks/bin/check-workspace-escape.js +2562 -2023
- package/dist/index.js +14171 -6490
- package/dist/lib/pre-push-cache-test-run.js +1044 -641
- package/dist/lib/pre-push-select-tests.js +641 -444
- 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 +257 -10
- 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 +2 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +69 -11
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +139 -2
- 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 +27 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +757 -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]__0zc_0gx._.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/0vtfb0g813gki.js +1 -0
- 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/{3ip5z3cf43bgo.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/{3goaig_rysc6p.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/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/3u9emqjwpd0t9.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/{ca66rAHI_w9D7S7ceXDvR → yR5RsCxb1OGnYggiaO09S}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{ca66rAHI_w9D7S7ceXDvR → yR5RsCxb1OGnYggiaO09S}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{ca66rAHI_w9D7S7ceXDvR → 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";
|
|
@@ -427,6 +427,16 @@ function globToRegex(pat) {
|
|
|
427
427
|
return new RegExp(re);
|
|
428
428
|
}
|
|
429
429
|
var SEPARATOR = /(?:[ \t]*[—–][ \t]*|[ \t]+-[ \t]+)/.source;
|
|
430
|
+
// ../../packages/aeg-core/src/review-policy.ts
|
|
431
|
+
var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
|
|
432
|
+
function blockingSeverities(scale, threshold) {
|
|
433
|
+
const idx = scale.indexOf(threshold);
|
|
434
|
+
if (idx === -1) {
|
|
435
|
+
throw new Error(`blockingSeverities: threshold "${threshold}" is not one of ${scale.join(" > ")}`);
|
|
436
|
+
}
|
|
437
|
+
return scale.slice(0, idx + 1);
|
|
438
|
+
}
|
|
439
|
+
var SECURITY_HIGH_AND_ABOVE = blockingSeverities(SECURITY_SEVERITY_ORDER, "HIGH");
|
|
430
440
|
// ../../packages/aeg-core/src/pr-tier.ts
|
|
431
441
|
var OVERRIDE_BODY_TOKEN = `[${label("override-docs")}]`;
|
|
432
442
|
// ../../packages/aeg-core/src/premise-check.ts
|
|
@@ -457,20 +467,42 @@ var NON_PATH_TOP_SEGMENTS = new Set(["origin", "refs", "HEAD", "vinaya", "fix"])
|
|
|
457
467
|
|
|
458
468
|
// ../../packages/aeg-core/src/doctrine-no-procedures.ts
|
|
459
469
|
var SHELL_LANGS = new Set(["", "sh", "bash", "shell", "console"]);
|
|
470
|
+
// ../../packages/aeg-core/src/reader-resolvable-prose.ts
|
|
471
|
+
var SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
472
|
+
|
|
473
|
+
// ../../packages/aeg-core/src/quoted-command.ts
|
|
474
|
+
var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
475
|
+
|
|
460
476
|
// ../../packages/aeg-core/src/issue-validation.ts
|
|
461
477
|
var TYPE_LABEL_IDS = LABELS.filter((l) => l.category === "type").map((l) => l.id);
|
|
462
478
|
var DOC_PATH_RE = /(?:(?:aeg-root|apps|packages|specs|docs|tools|\.claude|\.github)\/[\w./@-]*\.(?:md|mdx)|\.claude\/(?:skills|rules)\/[\w./-]+|\b(?:docs-index|decisions|projects|state-machine|enforcement|process|README|CLAUDE)\.md\b|\b[\w-]+-(?:spec|decisions|backlog)\.md\b)/i;
|
|
463
479
|
var DOC_PATH_RE_GLOBAL = new RegExp(DOC_PATH_RE.source, "gi");
|
|
480
|
+
var FILE_EXTENSIONS = new Set([
|
|
481
|
+
"ts",
|
|
482
|
+
"tsx",
|
|
483
|
+
"js",
|
|
484
|
+
"jsx",
|
|
485
|
+
"mjs",
|
|
486
|
+
"cjs",
|
|
487
|
+
"json",
|
|
488
|
+
"jsonc",
|
|
489
|
+
"md",
|
|
490
|
+
"mdx",
|
|
491
|
+
"yml",
|
|
492
|
+
"yaml",
|
|
493
|
+
"txt",
|
|
494
|
+
"sh",
|
|
495
|
+
"lock",
|
|
496
|
+
"toml",
|
|
497
|
+
"ndjson",
|
|
498
|
+
"html",
|
|
499
|
+
"css"
|
|
500
|
+
]);
|
|
464
501
|
|
|
465
502
|
// ../../packages/aeg-core/src/coherence-checks.ts
|
|
466
503
|
var R1_GRANDFATHERED_ISSUES = new Set([279, 280, 281, 282]);
|
|
467
504
|
// ../../packages/aeg-core/src/diagram-model.ts
|
|
468
505
|
import matter from "gray-matter";
|
|
469
|
-
// ../../packages/aeg-core/src/reader-resolvable-prose.ts
|
|
470
|
-
var SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
471
|
-
|
|
472
|
-
// ../../packages/aeg-core/src/quoted-command.ts
|
|
473
|
-
var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
474
506
|
// ../../packages/aeg-core/src/retired-vocabulary.ts
|
|
475
507
|
var RETIRED_PATTERNS = [
|
|
476
508
|
String.raw`\bD-[0-9]{3}\b`,
|
|
@@ -645,7 +677,6 @@ var TaskPrPauseSchema = z.object({
|
|
|
645
677
|
var TaskPrReviewRecordSchema = z.object({
|
|
646
678
|
verdicts: z.array(TaskPrVerdictSchema),
|
|
647
679
|
roundMarkers: z.array(z.number().int().nonnegative()),
|
|
648
|
-
summaryTable: z.string().nullable(),
|
|
649
680
|
pause: TaskPrPauseSchema.nullable()
|
|
650
681
|
});
|
|
651
682
|
var TaskPrReadInputSchema = z.object({
|
|
@@ -692,25 +723,69 @@ var TaskCancelResultSchema = z.object({
|
|
|
692
723
|
authenticatedFrom: z.string().min(1),
|
|
693
724
|
fencedEffectKeys: z.array(z.string())
|
|
694
725
|
});
|
|
695
|
-
var TASK_TOOL_NAMES = [
|
|
696
|
-
"task_start",
|
|
697
|
-
"task_status",
|
|
698
|
-
"task_escalation_read",
|
|
699
|
-
"task_pr_read",
|
|
700
|
-
"task_resume",
|
|
701
|
-
"task_cancel"
|
|
702
|
-
];
|
|
703
|
-
var OPERATOR_STATUS_FOLLOW = "task_status_follow";
|
|
704
|
-
var OPERATOR_TOOL_GRANT = [...TASK_TOOL_NAMES, OPERATOR_STATUS_FOLLOW];
|
|
705
|
-
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
706
|
-
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
707
|
-
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
708
|
-
var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
|
|
709
|
-
// ../../packages/aeg-core/src/log/envelope.ts
|
|
710
|
-
import { createHash } from "node:crypto";
|
|
711
|
-
|
|
712
726
|
// ../../packages/aeg-core/src/log/schema.ts
|
|
727
|
+
import { z as z3 } from "zod";
|
|
728
|
+
|
|
729
|
+
// ../../packages/aeg-core/src/log/custom.ts
|
|
713
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
|
|
714
789
|
var CONFIDENCE_REASON_MAX_LENGTH = 280;
|
|
715
790
|
var ROLE_VALUES = [
|
|
716
791
|
"planner",
|
|
@@ -721,244 +796,297 @@ var ROLE_VALUES = [
|
|
|
721
796
|
"archivist",
|
|
722
797
|
"architect"
|
|
723
798
|
];
|
|
724
|
-
var RoleSchema =
|
|
799
|
+
var RoleSchema = z3.enum(ROLE_VALUES);
|
|
725
800
|
var HOST_VALUES = ["hook", "ci", "cli", "loop"];
|
|
726
|
-
var HostSchema =
|
|
801
|
+
var HostSchema = z3.enum(HOST_VALUES);
|
|
727
802
|
var RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
|
|
728
803
|
var headerMetaCore = {
|
|
729
|
-
ts:
|
|
730
|
-
run_id:
|
|
731
|
-
seq:
|
|
732
|
-
repo:
|
|
733
|
-
vinaya:
|
|
734
|
-
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(),
|
|
735
810
|
host: HostSchema,
|
|
736
|
-
machine:
|
|
811
|
+
machine: z3.string()
|
|
737
812
|
};
|
|
738
|
-
var HeaderMetaV1Schema =
|
|
739
|
-
schema:
|
|
813
|
+
var HeaderMetaV1Schema = z3.object({
|
|
814
|
+
schema: z3.literal(1),
|
|
740
815
|
...headerMetaCore
|
|
741
816
|
}).strict();
|
|
742
|
-
var LineageSchema =
|
|
743
|
-
run:
|
|
744
|
-
attempt:
|
|
745
|
-
parent:
|
|
817
|
+
var LineageSchema = z3.object({
|
|
818
|
+
run: z3.string().nullable(),
|
|
819
|
+
attempt: z3.number().int().nullable(),
|
|
820
|
+
parent: z3.string().nullable()
|
|
746
821
|
}).strict();
|
|
747
|
-
var InputVersionsSchema =
|
|
748
|
-
objectives_version:
|
|
749
|
-
brief_hash:
|
|
750
|
-
ruling_ordinal:
|
|
751
|
-
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()
|
|
752
827
|
}).strict();
|
|
753
|
-
var ProvenanceSchema =
|
|
754
|
-
var HeaderMetaV2Schema =
|
|
755
|
-
schema:
|
|
828
|
+
var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
|
|
829
|
+
var HeaderMetaV2Schema = z3.object({
|
|
830
|
+
schema: z3.literal(2),
|
|
756
831
|
...headerMetaCore,
|
|
757
|
-
event_id:
|
|
758
|
-
process_id:
|
|
759
|
-
actor_id:
|
|
832
|
+
event_id: z3.string().min(1),
|
|
833
|
+
process_id: z3.string().min(1),
|
|
834
|
+
actor_id: z3.string().nullable(),
|
|
760
835
|
lineage: LineageSchema,
|
|
761
836
|
input_versions: InputVersionsSchema,
|
|
762
837
|
provenance: ProvenanceSchema
|
|
763
838
|
}).strict();
|
|
764
|
-
var
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
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()
|
|
772
871
|
}).strict();
|
|
773
|
-
var HeaderSchema =
|
|
872
|
+
var HeaderSchema = z3.object({
|
|
774
873
|
meta: HeaderMetaSchema,
|
|
775
874
|
subject: SubjectSchema
|
|
776
875
|
}).strict();
|
|
777
876
|
var envelopeTail = {
|
|
778
|
-
duration_ms:
|
|
779
|
-
payload:
|
|
877
|
+
duration_ms: z3.number().nonnegative().optional(),
|
|
878
|
+
payload: z3.object({}).strict()
|
|
780
879
|
};
|
|
781
|
-
var ReviewFindingSchema =
|
|
782
|
-
id:
|
|
783
|
-
severity:
|
|
784
|
-
state:
|
|
785
|
-
severity_scale:
|
|
786
|
-
policy_treatment:
|
|
787
|
-
confidence:
|
|
788
|
-
confidence_scale:
|
|
789
|
-
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()
|
|
790
889
|
}).strict();
|
|
791
|
-
var DispatchOutcomeSchema =
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
type:
|
|
795
|
-
pr:
|
|
796
|
-
head:
|
|
797
|
-
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()
|
|
798
897
|
}).strict(),
|
|
799
|
-
|
|
800
|
-
type:
|
|
801
|
-
verdict:
|
|
802
|
-
head:
|
|
803
|
-
comment_id:
|
|
804
|
-
objectives:
|
|
805
|
-
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)
|
|
806
905
|
}).strict(),
|
|
807
|
-
|
|
808
|
-
type:
|
|
809
|
-
class:
|
|
810
|
-
comment_id:
|
|
906
|
+
z3.object({
|
|
907
|
+
type: z3.literal("escalation"),
|
|
908
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
909
|
+
comment_id: z3.number().int()
|
|
811
910
|
}).strict(),
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
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()
|
|
816
915
|
]);
|
|
817
916
|
var dispatchShared = {
|
|
818
917
|
meta: HeaderMetaSchema,
|
|
819
918
|
subject: SubjectSchema,
|
|
820
|
-
kind:
|
|
919
|
+
kind: z3.literal("dispatch"),
|
|
821
920
|
...envelopeTail,
|
|
822
921
|
target_role: RoleSchema,
|
|
823
|
-
model:
|
|
824
|
-
round:
|
|
825
|
-
effect_id:
|
|
922
|
+
model: z3.string(),
|
|
923
|
+
round: z3.number().int().optional(),
|
|
924
|
+
effect_id: z3.string()
|
|
826
925
|
};
|
|
827
|
-
var dispatchUsageField =
|
|
828
|
-
var DispatchEventSchema =
|
|
829
|
-
|
|
830
|
-
|
|
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({
|
|
831
930
|
...dispatchShared,
|
|
832
|
-
event:
|
|
931
|
+
event: z3.literal("outcome_received"),
|
|
833
932
|
outcome: DispatchOutcomeSchema,
|
|
834
933
|
usage: dispatchUsageField
|
|
835
934
|
}).strict(),
|
|
836
|
-
|
|
935
|
+
z3.object({
|
|
837
936
|
...dispatchShared,
|
|
838
|
-
event:
|
|
839
|
-
reason:
|
|
937
|
+
event: z3.literal("dispatch_failed"),
|
|
938
|
+
reason: z3.enum(["timeout", "crash", "refused", "unattributed_write"]),
|
|
840
939
|
usage: dispatchUsageField
|
|
841
940
|
}).strict()
|
|
842
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();
|
|
843
949
|
var loopShared = {
|
|
844
950
|
meta: HeaderMetaSchema,
|
|
845
951
|
subject: SubjectSchema,
|
|
846
|
-
kind:
|
|
952
|
+
kind: z3.literal("dev_review_loop"),
|
|
847
953
|
...envelopeTail,
|
|
848
|
-
loop_id:
|
|
954
|
+
loop_id: z3.string()
|
|
849
955
|
};
|
|
850
|
-
var DevReviewLoopEventSchema =
|
|
851
|
-
|
|
956
|
+
var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
|
|
957
|
+
z3.object({
|
|
852
958
|
...loopShared,
|
|
853
|
-
event:
|
|
854
|
-
task:
|
|
855
|
-
policy:
|
|
856
|
-
max_rounds:
|
|
857
|
-
reviewers:
|
|
858
|
-
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())
|
|
859
965
|
}).strict()
|
|
860
966
|
}).strict(),
|
|
861
|
-
|
|
862
|
-
|
|
967
|
+
z3.object({ ...loopShared, event: z3.literal("round_started"), round: z3.number().int(), base_head: z3.string() }).strict(),
|
|
968
|
+
z3.object({
|
|
863
969
|
...loopShared,
|
|
864
|
-
event:
|
|
865
|
-
round:
|
|
866
|
-
head:
|
|
867
|
-
green:
|
|
868
|
-
confidence_value:
|
|
869
|
-
confidence_reason:
|
|
870
|
-
confidence_unavailable:
|
|
871
|
-
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()
|
|
872
978
|
}).strict(),
|
|
873
|
-
|
|
979
|
+
z3.object({
|
|
874
980
|
...loopShared,
|
|
875
|
-
event:
|
|
876
|
-
round:
|
|
877
|
-
head:
|
|
878
|
-
all_approve:
|
|
879
|
-
blockers:
|
|
880
|
-
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()
|
|
881
988
|
}).strict(),
|
|
882
|
-
|
|
989
|
+
z3.object({
|
|
883
990
|
...loopShared,
|
|
884
|
-
event:
|
|
885
|
-
round:
|
|
886
|
-
open:
|
|
887
|
-
resolved:
|
|
888
|
-
new:
|
|
889
|
-
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())
|
|
890
997
|
}).strict(),
|
|
891
|
-
|
|
998
|
+
z3.object({
|
|
892
999
|
...loopShared,
|
|
893
|
-
event:
|
|
894
|
-
round:
|
|
895
|
-
condition:
|
|
1000
|
+
event: z3.literal("stop_condition_met"),
|
|
1001
|
+
round: z3.number().int(),
|
|
1002
|
+
condition: z3.enum([
|
|
896
1003
|
"green",
|
|
897
1004
|
"max_rounds",
|
|
898
1005
|
"no_progress",
|
|
899
1006
|
"escalated",
|
|
900
1007
|
"principal_stop",
|
|
901
1008
|
"confidence",
|
|
902
|
-
"reappearance"
|
|
1009
|
+
"reappearance",
|
|
1010
|
+
"repeat_finding",
|
|
1011
|
+
"repeat_failure",
|
|
1012
|
+
"time_budget"
|
|
903
1013
|
])
|
|
904
1014
|
}).strict(),
|
|
905
|
-
|
|
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({
|
|
906
1023
|
...loopShared,
|
|
907
|
-
event:
|
|
908
|
-
round:
|
|
909
|
-
|
|
1024
|
+
event: z3.literal("resumed"),
|
|
1025
|
+
round: z3.number().int(),
|
|
1026
|
+
by: z3.enum(["principal", "driver"])
|
|
910
1027
|
}).strict(),
|
|
911
|
-
|
|
1028
|
+
z3.object({
|
|
912
1029
|
...loopShared,
|
|
913
|
-
event:
|
|
914
|
-
round:
|
|
915
|
-
by:
|
|
1030
|
+
event: z3.literal("cancelled"),
|
|
1031
|
+
round: z3.number().int(),
|
|
1032
|
+
by: z3.literal("principal")
|
|
916
1033
|
}).strict(),
|
|
917
|
-
|
|
1034
|
+
z3.object({
|
|
918
1035
|
...loopShared,
|
|
919
|
-
event:
|
|
920
|
-
round:
|
|
921
|
-
|
|
1036
|
+
event: z3.literal("unpushed_work_resume"),
|
|
1037
|
+
round: z3.number().int(),
|
|
1038
|
+
branch: z3.string(),
|
|
1039
|
+
detail: z3.string()
|
|
922
1040
|
}).strict(),
|
|
923
|
-
|
|
1041
|
+
z3.object({
|
|
924
1042
|
...loopShared,
|
|
925
|
-
event:
|
|
926
|
-
round:
|
|
927
|
-
|
|
928
|
-
|
|
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"])
|
|
929
1052
|
}).strict(),
|
|
930
|
-
|
|
1053
|
+
z3.object({
|
|
931
1054
|
...loopShared,
|
|
932
|
-
event:
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
wall_ms: z2.number().nonnegative(),
|
|
940
|
-
outcome: z2.enum(["green", "changes_requested", "escalated"])
|
|
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"])
|
|
941
1062
|
}).strict(),
|
|
942
|
-
|
|
1063
|
+
z3.object({
|
|
943
1064
|
...loopShared,
|
|
944
|
-
event:
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
final_head: z2.string(),
|
|
950
|
-
result: z2.enum(["merged_ready", "stopped"])
|
|
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"])
|
|
951
1070
|
}).strict(),
|
|
952
|
-
|
|
1071
|
+
z3.object({
|
|
953
1072
|
...loopShared,
|
|
954
|
-
event:
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
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()
|
|
1078
|
+
}).strict(),
|
|
1079
|
+
z3.object({
|
|
1080
|
+
...loopShared,
|
|
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()
|
|
959
1087
|
}).strict()
|
|
960
1088
|
]);
|
|
961
|
-
var ForgeOpSchema =
|
|
1089
|
+
var ForgeOpSchema = z3.enum([
|
|
962
1090
|
"pr.create",
|
|
963
1091
|
"pr.comment",
|
|
964
1092
|
"pr.body.replace",
|
|
@@ -972,24 +1100,24 @@ var ForgeOpSchema = z2.enum([
|
|
|
972
1100
|
"label.add",
|
|
973
1101
|
"label.remove"
|
|
974
1102
|
]);
|
|
975
|
-
var ForgeWriteTargetSchema =
|
|
976
|
-
issue:
|
|
977
|
-
pr:
|
|
1103
|
+
var ForgeWriteTargetSchema = z3.object({
|
|
1104
|
+
issue: z3.number().int().optional(),
|
|
1105
|
+
pr: z3.number().int().optional()
|
|
978
1106
|
}).strict();
|
|
979
1107
|
var forgeWriteShared = {
|
|
980
1108
|
meta: HeaderMetaSchema,
|
|
981
1109
|
subject: SubjectSchema,
|
|
982
|
-
kind:
|
|
1110
|
+
kind: z3.literal("forge_write"),
|
|
983
1111
|
...envelopeTail,
|
|
984
1112
|
op: ForgeOpSchema,
|
|
985
1113
|
target: ForgeWriteTargetSchema
|
|
986
1114
|
};
|
|
987
|
-
var ForgeWriteEventSchema =
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
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()
|
|
991
1119
|
]);
|
|
992
|
-
var GateOutcomeSchema =
|
|
1120
|
+
var GateOutcomeSchema = z3.enum([
|
|
993
1121
|
"pass",
|
|
994
1122
|
"fail",
|
|
995
1123
|
"wait",
|
|
@@ -1002,61 +1130,74 @@ var GateOutcomeSchema = z2.enum([
|
|
|
1002
1130
|
var gateShared = {
|
|
1003
1131
|
meta: HeaderMetaSchema,
|
|
1004
1132
|
subject: SubjectSchema,
|
|
1005
|
-
kind:
|
|
1133
|
+
kind: z3.literal("gate"),
|
|
1006
1134
|
...envelopeTail,
|
|
1007
|
-
check:
|
|
1008
|
-
check_version:
|
|
1009
|
-
policy_version:
|
|
1010
|
-
input_fingerprint:
|
|
1135
|
+
check: z3.string(),
|
|
1136
|
+
check_version: z3.string().nullable(),
|
|
1137
|
+
policy_version: z3.string().nullable(),
|
|
1138
|
+
input_fingerprint: z3.string().nullable()
|
|
1011
1139
|
};
|
|
1012
|
-
var GateEventSchema =
|
|
1013
|
-
|
|
1140
|
+
var GateEventSchema = z3.discriminatedUnion("event", [
|
|
1141
|
+
z3.object({
|
|
1014
1142
|
...gateShared,
|
|
1015
|
-
event:
|
|
1143
|
+
event: z3.literal("checked"),
|
|
1016
1144
|
outcome: GateOutcomeSchema,
|
|
1017
|
-
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())
|
|
1018
1158
|
}).strict()
|
|
1019
1159
|
]);
|
|
1020
|
-
var OperationResultSchema =
|
|
1160
|
+
var OperationResultSchema = z3.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
|
|
1021
1161
|
var operationShared = {
|
|
1022
1162
|
meta: HeaderMetaSchema,
|
|
1023
1163
|
subject: SubjectSchema,
|
|
1024
|
-
kind:
|
|
1164
|
+
kind: z3.literal("operation"),
|
|
1025
1165
|
...envelopeTail,
|
|
1026
|
-
operation:
|
|
1027
|
-
target:
|
|
1166
|
+
operation: z3.string(),
|
|
1167
|
+
target: z3.string().nullable()
|
|
1028
1168
|
};
|
|
1029
|
-
var OperationEventSchema =
|
|
1030
|
-
|
|
1169
|
+
var OperationEventSchema = z3.discriminatedUnion("event", [
|
|
1170
|
+
z3.object({
|
|
1031
1171
|
...operationShared,
|
|
1032
|
-
event:
|
|
1172
|
+
event: z3.literal("completed"),
|
|
1033
1173
|
result: OperationResultSchema,
|
|
1034
|
-
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()
|
|
1035
1176
|
}).strict()
|
|
1036
1177
|
]);
|
|
1037
|
-
var UsageUnitsSchema =
|
|
1038
|
-
input:
|
|
1039
|
-
output:
|
|
1040
|
-
cache:
|
|
1178
|
+
var UsageUnitsSchema = z3.object({
|
|
1179
|
+
input: z3.number().nonnegative().nullable(),
|
|
1180
|
+
output: z3.number().nonnegative().nullable(),
|
|
1181
|
+
cache: z3.number().nonnegative().nullable()
|
|
1041
1182
|
}).strict();
|
|
1042
1183
|
var usageShared = {
|
|
1043
1184
|
meta: HeaderMetaSchema,
|
|
1044
1185
|
subject: SubjectSchema,
|
|
1045
|
-
kind:
|
|
1186
|
+
kind: z3.literal("usage"),
|
|
1046
1187
|
...envelopeTail,
|
|
1047
|
-
model:
|
|
1048
|
-
source:
|
|
1049
|
-
semantics:
|
|
1188
|
+
model: z3.string().nullable(),
|
|
1189
|
+
source: z3.string(),
|
|
1190
|
+
semantics: z3.enum(["cumulative", "delta"])
|
|
1050
1191
|
};
|
|
1051
|
-
var UsageEventSchema =
|
|
1052
|
-
|
|
1192
|
+
var UsageEventSchema = z3.discriminatedUnion("event", [
|
|
1193
|
+
z3.object({
|
|
1053
1194
|
...usageShared,
|
|
1054
|
-
event:
|
|
1195
|
+
event: z3.literal("observed"),
|
|
1055
1196
|
units: UsageUnitsSchema,
|
|
1056
|
-
unknown_reason:
|
|
1197
|
+
unknown_reason: z3.string().nullable()
|
|
1057
1198
|
}).strict()
|
|
1058
1199
|
]);
|
|
1059
|
-
var RoleAttemptOutcomeSchema =
|
|
1200
|
+
var RoleAttemptOutcomeSchema = z3.enum([
|
|
1060
1201
|
"completed",
|
|
1061
1202
|
"incomplete",
|
|
1062
1203
|
"infrastructure_failed",
|
|
@@ -1067,17 +1208,17 @@ var RoleAttemptOutcomeSchema = z2.enum([
|
|
|
1067
1208
|
var roleAttemptShared = {
|
|
1068
1209
|
meta: HeaderMetaSchema,
|
|
1069
1210
|
subject: SubjectSchema,
|
|
1070
|
-
kind:
|
|
1211
|
+
kind: z3.literal("role_attempt"),
|
|
1071
1212
|
...envelopeTail,
|
|
1072
|
-
actor:
|
|
1073
|
-
attempt:
|
|
1074
|
-
effect_id:
|
|
1075
|
-
model:
|
|
1213
|
+
actor: z3.string().nullable(),
|
|
1214
|
+
attempt: z3.number().int().nullable(),
|
|
1215
|
+
effect_id: z3.string(),
|
|
1216
|
+
model: z3.string().nullable()
|
|
1076
1217
|
};
|
|
1077
|
-
var RoleAttemptEventSchema =
|
|
1078
|
-
|
|
1218
|
+
var RoleAttemptEventSchema = z3.discriminatedUnion("event", [
|
|
1219
|
+
z3.object({
|
|
1079
1220
|
...roleAttemptShared,
|
|
1080
|
-
event:
|
|
1221
|
+
event: z3.literal("attempted"),
|
|
1081
1222
|
outcome: RoleAttemptOutcomeSchema,
|
|
1082
1223
|
usage: dispatchUsageField
|
|
1083
1224
|
}).strict()
|
|
@@ -1085,42 +1226,59 @@ var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
|
|
|
1085
1226
|
var handoffShared = {
|
|
1086
1227
|
meta: HeaderMetaSchema,
|
|
1087
1228
|
subject: SubjectSchema,
|
|
1088
|
-
kind:
|
|
1229
|
+
kind: z3.literal("handoff"),
|
|
1089
1230
|
...envelopeTail,
|
|
1090
|
-
class:
|
|
1091
|
-
reason:
|
|
1231
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
1232
|
+
reason: z3.string()
|
|
1092
1233
|
};
|
|
1093
|
-
var HandoffEventSchema =
|
|
1094
|
-
|
|
1234
|
+
var HandoffEventSchema = z3.discriminatedUnion("event", [
|
|
1235
|
+
z3.object({
|
|
1095
1236
|
...handoffShared,
|
|
1096
|
-
event:
|
|
1097
|
-
requested_decision:
|
|
1237
|
+
event: z3.literal("raised"),
|
|
1238
|
+
requested_decision: z3.string().nullable()
|
|
1098
1239
|
}).strict(),
|
|
1099
|
-
|
|
1240
|
+
z3.object({
|
|
1100
1241
|
...handoffShared,
|
|
1101
|
-
event:
|
|
1102
|
-
resolution:
|
|
1103
|
-
resolved_by:
|
|
1242
|
+
event: z3.literal("resolved"),
|
|
1243
|
+
resolution: z3.string().nullable(),
|
|
1244
|
+
resolved_by: z3.string().nullable()
|
|
1104
1245
|
}).strict()
|
|
1105
1246
|
]);
|
|
1106
|
-
var EffectTargetSchema =
|
|
1107
|
-
kind:
|
|
1108
|
-
ref:
|
|
1247
|
+
var EffectTargetSchema = z3.object({
|
|
1248
|
+
kind: z3.string(),
|
|
1249
|
+
ref: z3.string()
|
|
1109
1250
|
}).strict();
|
|
1110
1251
|
var effectShared = {
|
|
1111
1252
|
meta: HeaderMetaSchema,
|
|
1112
1253
|
subject: SubjectSchema,
|
|
1113
|
-
kind:
|
|
1254
|
+
kind: z3.literal("effect"),
|
|
1114
1255
|
...envelopeTail,
|
|
1115
|
-
effect_id:
|
|
1256
|
+
effect_id: z3.string(),
|
|
1116
1257
|
target: EffectTargetSchema
|
|
1117
1258
|
};
|
|
1118
|
-
var EffectEventSchema =
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
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()
|
|
1122
1263
|
]);
|
|
1123
|
-
var
|
|
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()
|
|
1280
|
+
]);
|
|
1281
|
+
var LogEventSchema = z3.union([
|
|
1124
1282
|
DispatchEventSchema,
|
|
1125
1283
|
DevReviewLoopEventSchema,
|
|
1126
1284
|
ForgeWriteEventSchema,
|
|
@@ -1129,10 +1287,11 @@ var LogEventSchema = z2.union([
|
|
|
1129
1287
|
UsageEventSchema,
|
|
1130
1288
|
RoleAttemptEventSchema,
|
|
1131
1289
|
HandoffEventSchema,
|
|
1132
|
-
EffectEventSchema
|
|
1290
|
+
EffectEventSchema,
|
|
1291
|
+
CustomEventSchema
|
|
1133
1292
|
]);
|
|
1134
|
-
|
|
1135
1293
|
// ../../packages/aeg-core/src/log/envelope.ts
|
|
1294
|
+
import { createHash } from "node:crypto";
|
|
1136
1295
|
function isRole(value) {
|
|
1137
1296
|
return value !== undefined && ROLE_VALUES.includes(value);
|
|
1138
1297
|
}
|
|
@@ -1169,18 +1328,27 @@ function roundFromEnv(round) {
|
|
|
1169
1328
|
const n = Number(round);
|
|
1170
1329
|
return Number.isInteger(n) ? n : undefined;
|
|
1171
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
|
+
}
|
|
1172
1337
|
function buildHeader(input) {
|
|
1173
1338
|
const role = isRole(input.env.role) ? input.env.role : "unattributed";
|
|
1174
1339
|
const round = roundFromEnv(input.env.round);
|
|
1340
|
+
const pr = prFromEnv(input.env.pr);
|
|
1175
1341
|
const subject = {
|
|
1176
1342
|
issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
|
|
1177
1343
|
role,
|
|
1178
1344
|
...round !== undefined ? { round } : {},
|
|
1345
|
+
...pr !== undefined ? { pr } : {},
|
|
1179
1346
|
...input.subject ?? {}
|
|
1180
1347
|
};
|
|
1348
|
+
const issue = subject.issue;
|
|
1181
1349
|
return {
|
|
1182
1350
|
meta: {
|
|
1183
|
-
schema:
|
|
1351
|
+
schema: 3,
|
|
1184
1352
|
ts: input.now.toISOString(),
|
|
1185
1353
|
run_id: input.runId,
|
|
1186
1354
|
seq: input.seq,
|
|
@@ -1203,7 +1371,19 @@ function buildHeader(input) {
|
|
|
1203
1371
|
ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
|
|
1204
1372
|
policy_digest: input.inputVersions?.policyDigest ?? null
|
|
1205
1373
|
},
|
|
1206
|
-
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)
|
|
1207
1387
|
},
|
|
1208
1388
|
subject
|
|
1209
1389
|
};
|
|
@@ -1246,7 +1426,7 @@ function redact(value, home) {
|
|
|
1246
1426
|
return value;
|
|
1247
1427
|
}
|
|
1248
1428
|
// ../../packages/aeg-core/src/log/store.ts
|
|
1249
|
-
var KNOWN_SCHEMA_VERSIONS = [1, 2];
|
|
1429
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
|
|
1250
1430
|
function metaOf(obj) {
|
|
1251
1431
|
if (obj === null || typeof obj !== "object")
|
|
1252
1432
|
return null;
|
|
@@ -1312,7 +1492,7 @@ function classifyStoredLine(raw, home) {
|
|
|
1312
1492
|
return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
|
|
1313
1493
|
}
|
|
1314
1494
|
const redacted = redact(event, home);
|
|
1315
|
-
const provenance = version
|
|
1495
|
+
const provenance = version >= 2 ? event.meta.provenance ?? null : null;
|
|
1316
1496
|
return {
|
|
1317
1497
|
status: "ok",
|
|
1318
1498
|
identity,
|
|
@@ -1325,132 +1505,139 @@ function classifyStoredLine(raw, home) {
|
|
|
1325
1505
|
};
|
|
1326
1506
|
}
|
|
1327
1507
|
// ../../packages/aeg-core/src/control-store/records.ts
|
|
1328
|
-
import { z as
|
|
1329
|
-
var isoTimestamp =
|
|
1330
|
-
var taskId =
|
|
1331
|
-
var epochNumber =
|
|
1332
|
-
var RunRecordSchema =
|
|
1333
|
-
version:
|
|
1334
|
-
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"),
|
|
1335
1515
|
task: taskId,
|
|
1336
|
-
runId:
|
|
1337
|
-
pid:
|
|
1338
|
-
host:
|
|
1516
|
+
runId: z4.string().min(1),
|
|
1517
|
+
pid: z4.number().int().positive(),
|
|
1518
|
+
host: z4.string().min(1),
|
|
1339
1519
|
startedAt: isoTimestamp,
|
|
1340
|
-
childStartedAt:
|
|
1341
|
-
childCommand:
|
|
1520
|
+
childStartedAt: z4.string().min(1).nullable().optional(),
|
|
1521
|
+
childCommand: z4.string().min(1).nullable().optional()
|
|
1342
1522
|
}).strict();
|
|
1343
|
-
var InputRecordSchema =
|
|
1344
|
-
version:
|
|
1345
|
-
kind:
|
|
1523
|
+
var InputRecordSchema = z4.object({
|
|
1524
|
+
version: z4.literal(1),
|
|
1525
|
+
kind: z4.literal("input"),
|
|
1346
1526
|
task: taskId,
|
|
1347
|
-
runId:
|
|
1348
|
-
source:
|
|
1349
|
-
pr:
|
|
1350
|
-
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(),
|
|
1351
1531
|
recordedAt: isoTimestamp
|
|
1352
1532
|
}).strict();
|
|
1353
|
-
var OwnershipRecordSchema =
|
|
1354
|
-
version:
|
|
1355
|
-
kind:
|
|
1533
|
+
var OwnershipRecordSchema = z4.object({
|
|
1534
|
+
version: z4.literal(1),
|
|
1535
|
+
kind: z4.literal("ownership"),
|
|
1356
1536
|
task: taskId,
|
|
1357
1537
|
epoch: epochNumber,
|
|
1358
|
-
ownerId:
|
|
1359
|
-
pid:
|
|
1360
|
-
host:
|
|
1538
|
+
ownerId: z4.string().min(1),
|
|
1539
|
+
pid: z4.number().int().positive(),
|
|
1540
|
+
host: z4.string().min(1),
|
|
1361
1541
|
acquiredAt: isoTimestamp
|
|
1362
1542
|
}).strict();
|
|
1363
|
-
var TransitionRecordSchema =
|
|
1364
|
-
version:
|
|
1365
|
-
kind:
|
|
1543
|
+
var TransitionRecordSchema = z4.object({
|
|
1544
|
+
version: z4.literal(1),
|
|
1545
|
+
kind: z4.literal("transition"),
|
|
1366
1546
|
task: taskId,
|
|
1367
1547
|
epoch: epochNumber,
|
|
1368
|
-
seq:
|
|
1369
|
-
from:
|
|
1370
|
-
to:
|
|
1371
|
-
detail:
|
|
1548
|
+
seq: z4.number().int().nonnegative(),
|
|
1549
|
+
from: z4.string().min(1),
|
|
1550
|
+
to: z4.string().min(1),
|
|
1551
|
+
detail: z4.string().optional(),
|
|
1372
1552
|
at: isoTimestamp
|
|
1373
1553
|
}).strict();
|
|
1374
|
-
var ManifestRecordSchema =
|
|
1375
|
-
version:
|
|
1376
|
-
kind:
|
|
1554
|
+
var ManifestRecordSchema = z4.object({
|
|
1555
|
+
version: z4.literal(1),
|
|
1556
|
+
kind: z4.literal("manifest"),
|
|
1377
1557
|
task: taskId,
|
|
1378
1558
|
round: epochNumber,
|
|
1379
|
-
repository:
|
|
1380
|
-
pr:
|
|
1381
|
-
branch:
|
|
1382
|
-
baseSha:
|
|
1383
|
-
headSha:
|
|
1384
|
-
briefHash:
|
|
1385
|
-
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(),
|
|
1386
1566
|
rulingOrdinal: epochNumber,
|
|
1387
|
-
policyDigest:
|
|
1567
|
+
policyDigest: z4.string().min(1),
|
|
1388
1568
|
recordedAt: isoTimestamp
|
|
1389
1569
|
}).strict();
|
|
1390
|
-
var roundHeadIdentity =
|
|
1391
|
-
var LoopBudgetsSchema =
|
|
1392
|
-
mechanicalRetries:
|
|
1393
|
-
reviewRounds:
|
|
1394
|
-
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()
|
|
1395
1575
|
}).strict();
|
|
1396
|
-
var LoopStateRecordSchema =
|
|
1397
|
-
version:
|
|
1398
|
-
kind:
|
|
1576
|
+
var LoopStateRecordSchema = z4.object({
|
|
1577
|
+
version: z4.literal(1),
|
|
1578
|
+
kind: z4.literal("loop_state"),
|
|
1399
1579
|
task: taskId,
|
|
1400
|
-
round:
|
|
1401
|
-
phase:
|
|
1402
|
-
pauseReason:
|
|
1580
|
+
round: z4.number().int().positive(),
|
|
1581
|
+
phase: z4.string().min(1),
|
|
1582
|
+
pauseReason: z4.string().min(1).nullable(),
|
|
1403
1583
|
budgets: LoopBudgetsSchema,
|
|
1404
1584
|
heldResult: roundHeadIdentity.nullable(),
|
|
1405
1585
|
deliveredFindings: roundHeadIdentity.nullable(),
|
|
1586
|
+
repeatMemory: z4.object({
|
|
1587
|
+
blockingFindings: z4.array(z4.string()),
|
|
1588
|
+
lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
|
|
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(),
|
|
1406
1593
|
recordedAt: isoTimestamp
|
|
1407
1594
|
}).strict();
|
|
1408
|
-
var EffectRecordSchema =
|
|
1409
|
-
version:
|
|
1410
|
-
kind:
|
|
1595
|
+
var EffectRecordSchema = z4.object({
|
|
1596
|
+
version: z4.literal(1),
|
|
1597
|
+
kind: z4.literal("effect"),
|
|
1411
1598
|
task: taskId,
|
|
1412
|
-
key:
|
|
1413
|
-
operation:
|
|
1414
|
-
target:
|
|
1415
|
-
inputVersion:
|
|
1416
|
-
payloadDigest:
|
|
1417
|
-
status:
|
|
1418
|
-
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(),
|
|
1419
1606
|
recordedAt: isoTimestamp
|
|
1420
1607
|
}).strict();
|
|
1421
|
-
var EscalationRecordSchema =
|
|
1422
|
-
version:
|
|
1423
|
-
kind:
|
|
1608
|
+
var EscalationRecordSchema = z4.object({
|
|
1609
|
+
version: z4.literal(1),
|
|
1610
|
+
kind: z4.literal("escalation"),
|
|
1424
1611
|
task: taskId,
|
|
1425
|
-
escalationId:
|
|
1612
|
+
escalationId: z4.string().min(1),
|
|
1426
1613
|
round: epochNumber,
|
|
1427
|
-
head:
|
|
1428
|
-
branch:
|
|
1429
|
-
pr:
|
|
1430
|
-
runId:
|
|
1431
|
-
pid:
|
|
1432
|
-
host:
|
|
1433
|
-
agent:
|
|
1434
|
-
reason:
|
|
1435
|
-
detail:
|
|
1436
|
-
evidence:
|
|
1437
|
-
attemptedRecovery:
|
|
1438
|
-
requestedDecision:
|
|
1439
|
-
recipient:
|
|
1440
|
-
briefHash:
|
|
1441
|
-
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(),
|
|
1442
1629
|
rulingOrdinal: epochNumber,
|
|
1443
|
-
policyDigest:
|
|
1630
|
+
policyDigest: z4.string().min(1),
|
|
1444
1631
|
recordedAt: isoTimestamp
|
|
1445
1632
|
}).strict();
|
|
1446
|
-
var ResolutionRecordSchema =
|
|
1447
|
-
version:
|
|
1448
|
-
kind:
|
|
1633
|
+
var ResolutionRecordSchema = z4.object({
|
|
1634
|
+
version: z4.literal(1),
|
|
1635
|
+
kind: z4.literal("resolution"),
|
|
1449
1636
|
task: taskId,
|
|
1450
|
-
escalationId:
|
|
1451
|
-
decision:
|
|
1452
|
-
authenticatedBy:
|
|
1453
|
-
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),
|
|
1454
1641
|
consumedAt: isoTimestamp
|
|
1455
1642
|
}).strict();
|
|
1456
1643
|
// ../../packages/aeg-core/src/control-store/local.ts
|
|
@@ -1530,8 +1717,8 @@ function mkdirNoSymlinks(dir, mode, trustedRoot) {
|
|
|
1530
1717
|
}
|
|
1531
1718
|
var CONTROL_AREA_DIRNAME = "control";
|
|
1532
1719
|
// src/checks/registry.ts
|
|
1533
|
-
import {
|
|
1534
|
-
import {
|
|
1720
|
+
import { join as join3, relative, sep as sep2 } from "node:path";
|
|
1721
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
1535
1722
|
|
|
1536
1723
|
// src/lib/package-root.ts
|
|
1537
1724
|
import { existsSync as existsSync2 } from "node:fs";
|
|
@@ -1551,10 +1738,14 @@ function packageRoot(moduleUrl) {
|
|
|
1551
1738
|
}
|
|
1552
1739
|
|
|
1553
1740
|
// src/checks/registry.ts
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
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;
|
|
1558
1749
|
function bin(name) {
|
|
1559
1750
|
return join3(BIN_DIR, `${name}${BIN_EXT}`);
|
|
1560
1751
|
}
|
|
@@ -1752,23 +1943,6 @@ var REGISTRY = [
|
|
|
1752
1943
|
},
|
|
1753
1944
|
1
|
|
1754
1945
|
],
|
|
1755
|
-
[
|
|
1756
|
-
{
|
|
1757
|
-
name: "token-report",
|
|
1758
|
-
validates: "body",
|
|
1759
|
-
run: bin("check-token-report"),
|
|
1760
|
-
scope: "diff",
|
|
1761
|
-
timeoutMs: 15000,
|
|
1762
|
-
requiresOpenPr: true,
|
|
1763
|
-
env: {
|
|
1764
|
-
PR_BODY: { optional: true },
|
|
1765
|
-
BRANCH: { optional: true },
|
|
1766
|
-
CLAUDE_PROJECT_DIR: { optional: true },
|
|
1767
|
-
CLAUDE_CODE_SESSION_ID: { optional: true }
|
|
1768
|
-
}
|
|
1769
|
-
},
|
|
1770
|
-
1
|
|
1771
|
-
],
|
|
1772
1946
|
[
|
|
1773
1947
|
{
|
|
1774
1948
|
name: "no-disk-state",
|
|
@@ -2118,49 +2292,52 @@ var CORE_CHECK_RING = Object.fromEntries(REGISTRY.map(([spec, ring]) => [spec.na
|
|
|
2118
2292
|
import { execFile as execFile5 } from "node:child_process";
|
|
2119
2293
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
2120
2294
|
import {
|
|
2121
|
-
|
|
2122
|
-
|
|
2295
|
+
appendFileSync,
|
|
2296
|
+
closeSync as closeSync5,
|
|
2297
|
+
constants as fsConstants5,
|
|
2123
2298
|
existsSync as existsSync6,
|
|
2124
|
-
fstatSync as
|
|
2125
|
-
mkdirSync as
|
|
2126
|
-
|
|
2127
|
-
|
|
2299
|
+
fstatSync as fstatSync3,
|
|
2300
|
+
mkdirSync as mkdirSync5,
|
|
2301
|
+
lstatSync as lstatSync3,
|
|
2302
|
+
openSync as openSync5,
|
|
2303
|
+
readFileSync as readFileSync6,
|
|
2128
2304
|
renameSync as renameSync3,
|
|
2129
|
-
|
|
2305
|
+
writeFileSync as writeFileSync3,
|
|
2306
|
+
writeSync as writeSync4
|
|
2130
2307
|
} from "node:fs";
|
|
2131
2308
|
import { hostname as osHostname, homedir as homedir3 } from "node:os";
|
|
2132
|
-
import { dirname as
|
|
2309
|
+
import { dirname as dirname7, join as join7 } from "node:path";
|
|
2133
2310
|
import { promisify as promisify5 } from "node:util";
|
|
2134
2311
|
|
|
2135
2312
|
// src/lib/config.ts
|
|
2136
2313
|
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
2137
2314
|
import { promisify as promisify4 } from "node:util";
|
|
2138
|
-
import { existsSync as
|
|
2315
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, realpathSync, writeFileSync } from "node:fs";
|
|
2139
2316
|
import { homedir } from "node:os";
|
|
2140
2317
|
import { dirname as dirname3, isAbsolute, join as join4, resolve as resolve2 } from "node:path";
|
|
2141
|
-
import { z as
|
|
2318
|
+
import { z as z5 } from "zod";
|
|
2142
2319
|
|
|
2143
2320
|
// src/lib/agent-vendors.ts
|
|
2144
2321
|
var AGENT_VENDORS = ["skills", "claude", "gemini"];
|
|
2145
2322
|
|
|
2146
2323
|
// src/lib/config.ts
|
|
2147
|
-
var EnvEntrySchema =
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
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()
|
|
2152
2329
|
]);
|
|
2153
|
-
var CheckEntrySchema =
|
|
2154
|
-
run:
|
|
2155
|
-
scope:
|
|
2156
|
-
include:
|
|
2157
|
-
args:
|
|
2158
|
-
timeoutMs:
|
|
2159
|
-
env:
|
|
2160
|
-
requiresOpenPr:
|
|
2161
|
-
ownWorkflow:
|
|
2162
|
-
principalOwed:
|
|
2163
|
-
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()
|
|
2164
2341
|
}).superRefine((entry, ctx) => {
|
|
2165
2342
|
if (!entry.env)
|
|
2166
2343
|
return;
|
|
@@ -2170,22 +2347,22 @@ var CheckEntrySchema = z4.object({
|
|
|
2170
2347
|
const members = value.anyOf;
|
|
2171
2348
|
if (new Set(members).size !== members.length) {
|
|
2172
2349
|
ctx.addIssue({
|
|
2173
|
-
code:
|
|
2350
|
+
code: z5.ZodIssueCode.custom,
|
|
2174
2351
|
message: `env.${key}.anyOf has duplicate members`,
|
|
2175
2352
|
path: ["env", key, "anyOf"]
|
|
2176
2353
|
});
|
|
2177
2354
|
}
|
|
2178
2355
|
if (!members.includes(key)) {
|
|
2179
2356
|
ctx.addIssue({
|
|
2180
|
-
code:
|
|
2357
|
+
code: z5.ZodIssueCode.custom,
|
|
2181
2358
|
message: `env.${key}.anyOf must include "${key}" itself as a member`,
|
|
2182
2359
|
path: ["env", key, "anyOf"]
|
|
2183
2360
|
});
|
|
2184
2361
|
}
|
|
2185
2362
|
}
|
|
2186
2363
|
});
|
|
2187
|
-
var RoleEntrySchema =
|
|
2188
|
-
contract:
|
|
2364
|
+
var RoleEntrySchema = z5.object({
|
|
2365
|
+
contract: z5.string().refine((p) => p.includes("/"), {
|
|
2189
2366
|
message: 'must be a path (contain at least one "/"), not a bare filename'
|
|
2190
2367
|
})
|
|
2191
2368
|
});
|
|
@@ -2209,17 +2386,17 @@ var BRIEF_BUILTINS = [
|
|
|
2209
2386
|
"briefSections",
|
|
2210
2387
|
"milestoneShape"
|
|
2211
2388
|
];
|
|
2212
|
-
var BriefSectionSchema =
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
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() })
|
|
2217
2394
|
]);
|
|
2218
|
-
var BriefSchemaSchema =
|
|
2219
|
-
pr:
|
|
2220
|
-
issue:
|
|
2221
|
-
milestone:
|
|
2222
|
-
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()
|
|
2223
2400
|
});
|
|
2224
2401
|
function isSafeRepoRelPath(p) {
|
|
2225
2402
|
if (p.length === 0)
|
|
@@ -2228,7 +2405,7 @@ function isSafeRepoRelPath(p) {
|
|
|
2228
2405
|
return false;
|
|
2229
2406
|
return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
|
|
2230
2407
|
}
|
|
2231
|
-
var SafeRepoRelPath =
|
|
2408
|
+
var SafeRepoRelPath = z5.string().refine(isSafeRepoRelPath, {
|
|
2232
2409
|
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
2233
2410
|
});
|
|
2234
2411
|
var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
@@ -2238,22 +2415,22 @@ function isCanonicalHookBlockPath(p) {
|
|
|
2238
2415
|
var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
|
|
2239
2416
|
message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
|
|
2240
2417
|
});
|
|
2241
|
-
var ManagedBlockRecordSchema =
|
|
2418
|
+
var ManagedBlockRecordSchema = z5.object({
|
|
2242
2419
|
path: ManagedHookBlockPath,
|
|
2243
|
-
marker:
|
|
2244
|
-
comment:
|
|
2420
|
+
marker: z5.string(),
|
|
2421
|
+
comment: z5.enum(["hash", "html"])
|
|
2245
2422
|
});
|
|
2246
|
-
var ManagedManifestSchema =
|
|
2247
|
-
version:
|
|
2248
|
-
files:
|
|
2249
|
-
blocks:
|
|
2250
|
-
labels:
|
|
2251
|
-
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()
|
|
2252
2429
|
});
|
|
2253
|
-
var ProjectEntrySchema =
|
|
2254
|
-
name:
|
|
2255
|
-
description:
|
|
2256
|
-
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()
|
|
2257
2434
|
});
|
|
2258
2435
|
function parseTokensCollectDeclaration(value) {
|
|
2259
2436
|
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
@@ -2264,87 +2441,97 @@ function parseTokensCollectDeclaration(value) {
|
|
|
2264
2441
|
return null;
|
|
2265
2442
|
return { interpreter, script };
|
|
2266
2443
|
}
|
|
2267
|
-
var VinayaConfigSchema =
|
|
2268
|
-
rings:
|
|
2269
|
-
ring1_forgeWriteInterception:
|
|
2270
|
-
ring2_asyncAudits:
|
|
2444
|
+
var VinayaConfigSchema = z5.object({
|
|
2445
|
+
rings: z5.object({
|
|
2446
|
+
ring1_forgeWriteInterception: z5.boolean(),
|
|
2447
|
+
ring2_asyncAudits: z5.boolean()
|
|
2271
2448
|
}).optional(),
|
|
2272
|
-
checks:
|
|
2273
|
-
roles:
|
|
2449
|
+
checks: z5.record(z5.string(), CheckEntrySchema).optional(),
|
|
2450
|
+
roles: z5.record(z5.string(), RoleEntrySchema).optional(),
|
|
2274
2451
|
briefSchema: BriefSchemaSchema.optional(),
|
|
2275
2452
|
managed: ManagedManifestSchema.optional(),
|
|
2276
|
-
principals:
|
|
2277
|
-
releaseActor:
|
|
2278
|
-
ci:
|
|
2279
|
-
tokens:
|
|
2280
|
-
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, {
|
|
2281
2458
|
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
2282
2459
|
})
|
|
2283
2460
|
}).optional(),
|
|
2284
|
-
blastRadius:
|
|
2285
|
-
proseGates:
|
|
2286
|
-
doctrineRoot:
|
|
2287
|
-
readerFacingPrefix:
|
|
2288
|
-
readerFacingSuffix:
|
|
2289
|
-
legacySlugDir:
|
|
2290
|
-
sourceComments:
|
|
2291
|
-
globs:
|
|
2292
|
-
allowlist:
|
|
2293
|
-
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()
|
|
2294
2471
|
}).optional(),
|
|
2295
|
-
specGrandfather:
|
|
2296
|
-
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), {
|
|
2297
2474
|
message: "must be a repository-relative path, not an absolute one"
|
|
2298
2475
|
}).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
|
|
2299
2476
|
message: "must stay inside the repository — no `..` segment"
|
|
2300
2477
|
})).optional()
|
|
2301
2478
|
}).optional(),
|
|
2302
|
-
projects:
|
|
2303
|
-
dispatch:
|
|
2304
|
-
timeoutMs:
|
|
2305
|
-
killGraceMs:
|
|
2306
|
-
agent:
|
|
2307
|
-
|
|
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()
|
|
2308
2490
|
}).optional(),
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
securityThreshold: z4.string().min(1).optional(),
|
|
2312
|
-
maxRounds: z4.number().optional()
|
|
2491
|
+
securityScan: z5.object({
|
|
2492
|
+
command: z5.array(z5.string().min(1)).min(1)
|
|
2313
2493
|
}).optional(),
|
|
2314
|
-
gateCutovers:
|
|
2315
|
-
objectivesSinceIssue:
|
|
2316
|
-
briefSectionsSinceIssue:
|
|
2317
|
-
documentationSinceIssue:
|
|
2318
|
-
briefRulesSincePr:
|
|
2319
|
-
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()
|
|
2320
2500
|
}).optional(),
|
|
2321
|
-
|
|
2322
|
-
|
|
2501
|
+
planning: z5.object({
|
|
2502
|
+
collisionThreshold: z5.number().int().nonnegative().optional()
|
|
2323
2503
|
}).optional(),
|
|
2324
|
-
|
|
2325
|
-
|
|
2504
|
+
prePush: z5.object({
|
|
2505
|
+
alwaysRun: z5.array(z5.string()).optional()
|
|
2506
|
+
}).optional(),
|
|
2507
|
+
report: z5.object({
|
|
2508
|
+
commandTimeoutMs: z5.number().int().positive().optional()
|
|
2326
2509
|
}).superRefine((report, ctx) => {
|
|
2327
2510
|
const commandTimeoutMs = report.commandTimeoutMs;
|
|
2328
2511
|
if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
|
|
2329
2512
|
ctx.addIssue({
|
|
2330
|
-
code:
|
|
2513
|
+
code: z5.ZodIssueCode.custom,
|
|
2331
2514
|
path: ["commandTimeoutMs"],
|
|
2332
2515
|
message: "must be at most 3600000 (1 hour)"
|
|
2333
2516
|
});
|
|
2334
2517
|
}
|
|
2335
2518
|
}).optional(),
|
|
2336
|
-
logPublish:
|
|
2519
|
+
logPublish: z5.unknown().refine((v) => v === undefined, {
|
|
2337
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)"
|
|
2338
2521
|
}),
|
|
2339
|
-
runtimeDir:
|
|
2340
|
-
logs:
|
|
2341
|
-
folder:
|
|
2342
|
-
url:
|
|
2343
|
-
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()
|
|
2344
2529
|
}).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
|
|
2345
2530
|
message: "logs: set at most one of folder/url"
|
|
2346
2531
|
}).refine((v) => v.headers === undefined || v.url !== undefined, {
|
|
2347
2532
|
message: "logs: headers requires url"
|
|
2533
|
+
}).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
|
|
2534
|
+
message: "logs: readHeaders requires url"
|
|
2348
2535
|
}).optional()
|
|
2349
2536
|
});
|
|
2350
2537
|
var GLOBAL_VINAYA_HOME = join4(homedir(), ".vinaya");
|
|
@@ -2354,9 +2541,9 @@ function findLocalConfig() {
|
|
|
2354
2541
|
let dir = process.cwd();
|
|
2355
2542
|
while (true) {
|
|
2356
2543
|
const candidate = join4(dir, LOCAL_CONFIG_FILENAME);
|
|
2357
|
-
if (
|
|
2544
|
+
if (existsSync3(candidate))
|
|
2358
2545
|
return candidate;
|
|
2359
|
-
if (
|
|
2546
|
+
if (existsSync3(join4(dir, ".git")))
|
|
2360
2547
|
return null;
|
|
2361
2548
|
const parent = dirname3(dir);
|
|
2362
2549
|
if (parent === dir)
|
|
@@ -2368,7 +2555,7 @@ function configPath() {
|
|
|
2368
2555
|
const local = findLocalConfig();
|
|
2369
2556
|
if (local)
|
|
2370
2557
|
return local;
|
|
2371
|
-
if (
|
|
2558
|
+
if (existsSync3(GLOBAL_CONFIG_PATH))
|
|
2372
2559
|
return GLOBAL_CONFIG_PATH;
|
|
2373
2560
|
return null;
|
|
2374
2561
|
}
|
|
@@ -2619,7 +2806,7 @@ var TOKENS_COLLECT_TRUST_PATH = join4(GLOBAL_VINAYA_HOME, "tokens-collect-trust.
|
|
|
2619
2806
|
|
|
2620
2807
|
// src/lib/run-paths.ts
|
|
2621
2808
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
2622
|
-
import { chmodSync, existsSync as
|
|
2809
|
+
import { chmodSync, existsSync as existsSync4, realpathSync as realpathSync2 } from "node:fs";
|
|
2623
2810
|
import { dirname as dirname4, join as join5, resolve as resolvePath } from "node:path";
|
|
2624
2811
|
var TASKS_EXECUTION_DIRNAME = "tasks-execution";
|
|
2625
2812
|
var RUN_AREA_DIRNAMES = {
|
|
@@ -2749,7 +2936,7 @@ function repoRootSync(start = process.cwd()) {
|
|
|
2749
2936
|
return null;
|
|
2750
2937
|
}
|
|
2751
2938
|
for (;; ) {
|
|
2752
|
-
if (
|
|
2939
|
+
if (existsSync4(join5(dir, ".git")))
|
|
2753
2940
|
return dir;
|
|
2754
2941
|
const parent = dirname4(dir);
|
|
2755
2942
|
if (parent === dir)
|
|
@@ -2793,25 +2980,62 @@ function ensureRunDir(dir, runtimeDir) {
|
|
|
2793
2980
|
chmodSync(dir, 448);
|
|
2794
2981
|
}
|
|
2795
2982
|
|
|
2796
|
-
// src/lib/log
|
|
2983
|
+
// src/lib/loop-log.ts
|
|
2797
2984
|
import {
|
|
2798
2985
|
closeSync as closeSync3,
|
|
2799
2986
|
constants as fsConstants3,
|
|
2800
|
-
|
|
2987
|
+
existsSync as existsSync5,
|
|
2988
|
+
fstatSync as fstatSync2,
|
|
2801
2989
|
mkdirSync as mkdirSync3,
|
|
2802
2990
|
openSync as openSync3,
|
|
2803
|
-
linkSync as linkSync2,
|
|
2804
2991
|
readFileSync as readFileSync4,
|
|
2805
|
-
|
|
2992
|
+
readSync,
|
|
2806
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,
|
|
2807
3031
|
unlinkSync as unlinkSync2,
|
|
2808
3032
|
utimesSync,
|
|
2809
3033
|
writeFileSync as writeFileSync2,
|
|
2810
|
-
writeSync as
|
|
3034
|
+
writeSync as writeSync3
|
|
2811
3035
|
} from "node:fs";
|
|
2812
3036
|
import { randomUUID } from "node:crypto";
|
|
2813
3037
|
import { homedir as homedir2 } from "node:os";
|
|
2814
|
-
import { dirname as
|
|
3038
|
+
import { dirname as dirname6, join as join6 } from "node:path";
|
|
2815
3039
|
var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
|
|
2816
3040
|
var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
|
|
2817
3041
|
var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
@@ -2827,13 +3051,13 @@ function isEnoent(err) {
|
|
|
2827
3051
|
var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
|
|
2828
3052
|
function tryCreateLock(lockPath, token) {
|
|
2829
3053
|
try {
|
|
2830
|
-
|
|
2831
|
-
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);
|
|
2832
3056
|
try {
|
|
2833
|
-
|
|
3057
|
+
writeSync3(fd, `${token}
|
|
2834
3058
|
`);
|
|
2835
3059
|
} finally {
|
|
2836
|
-
|
|
3060
|
+
closeSync4(fd);
|
|
2837
3061
|
}
|
|
2838
3062
|
return true;
|
|
2839
3063
|
} catch (err) {
|
|
@@ -2848,7 +3072,7 @@ function acquireDrainLock(lockPath) {
|
|
|
2848
3072
|
return token;
|
|
2849
3073
|
let observedMtimeMs;
|
|
2850
3074
|
try {
|
|
2851
|
-
observedMtimeMs =
|
|
3075
|
+
observedMtimeMs = statSync3(lockPath).mtimeMs;
|
|
2852
3076
|
} catch (err) {
|
|
2853
3077
|
if (!isEnoent(err))
|
|
2854
3078
|
throw err;
|
|
@@ -2866,7 +3090,7 @@ function acquireDrainLock(lockPath) {
|
|
|
2866
3090
|
}
|
|
2867
3091
|
let claimedMtimeMs = null;
|
|
2868
3092
|
try {
|
|
2869
|
-
claimedMtimeMs =
|
|
3093
|
+
claimedMtimeMs = statSync3(claimed).mtimeMs;
|
|
2870
3094
|
} catch (err) {
|
|
2871
3095
|
if (!isEnoent(err))
|
|
2872
3096
|
throw err;
|
|
@@ -2892,7 +3116,7 @@ function acquireDrainLock(lockPath) {
|
|
|
2892
3116
|
function renewDrainLock(lockPath, token) {
|
|
2893
3117
|
let holder;
|
|
2894
3118
|
try {
|
|
2895
|
-
holder =
|
|
3119
|
+
holder = readFileSync5(lockPath, "utf8").trim();
|
|
2896
3120
|
} catch (err) {
|
|
2897
3121
|
if (!isEnoent(err))
|
|
2898
3122
|
throw err;
|
|
@@ -2912,7 +3136,7 @@ function renewDrainLock(lockPath, token) {
|
|
|
2912
3136
|
}
|
|
2913
3137
|
function releaseDrainLock(lockPath, token) {
|
|
2914
3138
|
try {
|
|
2915
|
-
const holder =
|
|
3139
|
+
const holder = readFileSync5(lockPath, "utf8").trim();
|
|
2916
3140
|
if (holder !== token)
|
|
2917
3141
|
return;
|
|
2918
3142
|
unlinkSync2(lockPath);
|
|
@@ -2962,7 +3186,7 @@ function queueLines(buf) {
|
|
|
2962
3186
|
return lines;
|
|
2963
3187
|
}
|
|
2964
3188
|
function removeQueueHead(path, cut) {
|
|
2965
|
-
const remaining =
|
|
3189
|
+
const remaining = readFileSync5(path);
|
|
2966
3190
|
writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
|
|
2967
3191
|
}
|
|
2968
3192
|
function queueBucketSize(path) {
|
|
@@ -2983,7 +3207,7 @@ function queueBucketSize(path) {
|
|
|
2983
3207
|
function readQueueFile(path) {
|
|
2984
3208
|
if (queueBucketSize(path) === null)
|
|
2985
3209
|
return null;
|
|
2986
|
-
return
|
|
3210
|
+
return readFileSync5(path);
|
|
2987
3211
|
}
|
|
2988
3212
|
function rejectLine(rejectedPath, reason, status, identity, raw) {
|
|
2989
3213
|
const record = JSON.stringify({
|
|
@@ -3165,13 +3389,19 @@ function logsCredentialMissing(headers, env) {
|
|
|
3165
3389
|
const varPattern = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
|
|
3166
3390
|
for (const value of Object.values(headers)) {
|
|
3167
3391
|
for (const match of value.matchAll(varPattern)) {
|
|
3168
|
-
|
|
3169
|
-
|
|
3392
|
+
const name = match[1];
|
|
3393
|
+
if (env[name])
|
|
3394
|
+
continue;
|
|
3395
|
+
return true;
|
|
3170
3396
|
}
|
|
3171
3397
|
}
|
|
3172
3398
|
return false;
|
|
3173
3399
|
}
|
|
3174
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
|
+
}
|
|
3175
3405
|
const local = resolveLogsSetting(input.localConfig);
|
|
3176
3406
|
let effective = null;
|
|
3177
3407
|
let fallbackReason;
|
|
@@ -3211,23 +3441,72 @@ function resolveLogDestinationFrom(input) {
|
|
|
3211
3441
|
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
3212
3442
|
return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
|
|
3213
3443
|
}
|
|
3214
|
-
var
|
|
3215
|
-
function processTrustAnchor() {
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
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;
|
|
3219
3452
|
}
|
|
3220
3453
|
async function defaultResolveLogDestination(repo, env) {
|
|
3221
3454
|
const localConfig = loadConfig();
|
|
3222
3455
|
const unattended = isUnattendedProcess(process.env);
|
|
3456
|
+
const repoRoot = repoRootSync();
|
|
3223
3457
|
return resolveLogDestinationFrom({
|
|
3224
3458
|
localConfig,
|
|
3225
|
-
trustAnchorConfig: unattended ? await processTrustAnchor() : null,
|
|
3459
|
+
trustAnchorConfig: unattended ? await processTrustAnchor(repoRoot) : null,
|
|
3226
3460
|
unattended,
|
|
3227
3461
|
env,
|
|
3228
3462
|
defaultFolder: join7(await runtimeDirForRepoAsync(repo), "logs"),
|
|
3229
|
-
repoRoot
|
|
3463
|
+
repoRoot
|
|
3464
|
+
});
|
|
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
|
|
3230
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 {}
|
|
3231
3510
|
}
|
|
3232
3511
|
function isEnoent2(err) {
|
|
3233
3512
|
return typeof err === "object" && err !== null && err.code === "ENOENT";
|
|
@@ -3341,7 +3620,7 @@ async function resolveBranchIssue(cwd, env = process.env, repo = null) {
|
|
|
3341
3620
|
}
|
|
3342
3621
|
function readVinayaVersion() {
|
|
3343
3622
|
try {
|
|
3344
|
-
const pkg = JSON.parse(
|
|
3623
|
+
const pkg = JSON.parse(readFileSync6(join7(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
3345
3624
|
return pkg.version ?? "unknown";
|
|
3346
3625
|
} catch {
|
|
3347
3626
|
return "unknown";
|
|
@@ -3379,6 +3658,7 @@ function defaultStderr(message) {
|
|
|
3379
3658
|
}
|
|
3380
3659
|
var branchIssueFallbackEnabled = true;
|
|
3381
3660
|
var branchIssueByCwd = new Map;
|
|
3661
|
+
var branchIssueSettledByCwd = new Map;
|
|
3382
3662
|
function branchIssueRead(key, read, shared) {
|
|
3383
3663
|
if (!shared)
|
|
3384
3664
|
return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
@@ -3387,8 +3667,30 @@ function branchIssueRead(key, read, shared) {
|
|
|
3387
3667
|
return cached;
|
|
3388
3668
|
const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
3389
3669
|
branchIssueByCwd.set(key, reading);
|
|
3670
|
+
reading.then((value) => branchIssueSettledByCwd.set(key, value));
|
|
3390
3671
|
return reading;
|
|
3391
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));
|
|
3684
|
+
return reading;
|
|
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
|
+
}
|
|
3392
3694
|
function defaultDeps() {
|
|
3393
3695
|
return {
|
|
3394
3696
|
outboxRoot: () => join7(GLOBAL_VINAYA_HOME, "outbox"),
|
|
@@ -3403,29 +3705,30 @@ function defaultDeps() {
|
|
|
3403
3705
|
inputVersions: () => {
|
|
3404
3706
|
return;
|
|
3405
3707
|
},
|
|
3406
|
-
resolveLogDestination: defaultResolveLogDestination
|
|
3708
|
+
resolveLogDestination: defaultResolveLogDestination,
|
|
3709
|
+
unresolvedLogDestination
|
|
3407
3710
|
};
|
|
3408
3711
|
}
|
|
3409
|
-
var APPEND_OPEN_FLAGS =
|
|
3712
|
+
var APPEND_OPEN_FLAGS = fsConstants5.O_WRONLY | fsConstants5.O_APPEND | fsConstants5.O_CREAT | fsConstants5.O_NOFOLLOW | fsConstants5.O_NONBLOCK;
|
|
3410
3713
|
function guardedAppendOpen(path) {
|
|
3411
3714
|
try {
|
|
3412
|
-
return
|
|
3715
|
+
return openSync5(path, APPEND_OPEN_FLAGS, 384);
|
|
3413
3716
|
} catch {
|
|
3414
3717
|
return;
|
|
3415
3718
|
}
|
|
3416
3719
|
}
|
|
3417
3720
|
function appendHardenedLine(path, line) {
|
|
3418
3721
|
try {
|
|
3419
|
-
|
|
3722
|
+
mkdirSync5(dirname7(path), { recursive: true, mode: 448 });
|
|
3420
3723
|
const fd = guardedAppendOpen(path);
|
|
3421
3724
|
if (fd === undefined)
|
|
3422
3725
|
return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
|
|
3423
3726
|
try {
|
|
3424
|
-
if (!
|
|
3727
|
+
if (!fstatSync3(fd).isFile())
|
|
3425
3728
|
return `target is not a regular file: ${path}`;
|
|
3426
|
-
|
|
3729
|
+
writeSync4(fd, line);
|
|
3427
3730
|
} finally {
|
|
3428
|
-
|
|
3731
|
+
closeSync5(fd);
|
|
3429
3732
|
}
|
|
3430
3733
|
return null;
|
|
3431
3734
|
} catch (err) {
|
|
@@ -3435,7 +3738,7 @@ function appendHardenedLine(path, line) {
|
|
|
3435
3738
|
function reportRotationOverflow(backupPath, warn) {
|
|
3436
3739
|
let raw;
|
|
3437
3740
|
try {
|
|
3438
|
-
raw =
|
|
3741
|
+
raw = readFileSync6(backupPath, "utf8");
|
|
3439
3742
|
} catch {
|
|
3440
3743
|
return;
|
|
3441
3744
|
}
|
|
@@ -3458,7 +3761,7 @@ function reportRotationOverflow(backupPath, warn) {
|
|
|
3458
3761
|
}
|
|
3459
3762
|
function appendLine(path, line, warn) {
|
|
3460
3763
|
try {
|
|
3461
|
-
|
|
3764
|
+
mkdirSync5(dirname7(path), { recursive: true, mode: 448 });
|
|
3462
3765
|
let fd = guardedAppendOpen(path);
|
|
3463
3766
|
if (fd === undefined) {
|
|
3464
3767
|
warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
|
|
@@ -3467,14 +3770,14 @@ function appendLine(path, line, warn) {
|
|
|
3467
3770
|
}
|
|
3468
3771
|
let closed = false;
|
|
3469
3772
|
try {
|
|
3470
|
-
const stat =
|
|
3773
|
+
const stat = fstatSync3(fd);
|
|
3471
3774
|
if (!stat.isFile()) {
|
|
3472
3775
|
warn(`vinaya: log outbox target is not a regular file — refusing to write: ${path}
|
|
3473
3776
|
`);
|
|
3474
3777
|
return;
|
|
3475
3778
|
}
|
|
3476
3779
|
if (stat.size > OUTBOX_MAX_BYTES) {
|
|
3477
|
-
|
|
3780
|
+
closeSync5(fd);
|
|
3478
3781
|
closed = true;
|
|
3479
3782
|
const backupPath = path.replace(/\.ndjson$/, ".1.ndjson");
|
|
3480
3783
|
reportRotationOverflow(backupPath, warn);
|
|
@@ -3488,10 +3791,10 @@ function appendLine(path, line, warn) {
|
|
|
3488
3791
|
fd = rotated;
|
|
3489
3792
|
closed = false;
|
|
3490
3793
|
}
|
|
3491
|
-
|
|
3794
|
+
writeSync4(fd, line);
|
|
3492
3795
|
} finally {
|
|
3493
3796
|
if (!closed)
|
|
3494
|
-
|
|
3797
|
+
closeSync5(fd);
|
|
3495
3798
|
}
|
|
3496
3799
|
} catch (err) {
|
|
3497
3800
|
warn(`vinaya: log outbox write failed — ${err instanceof Error ? err.message : String(err)}
|
|
@@ -3502,12 +3805,14 @@ function createLogSink(overrides = {}) {
|
|
|
3502
3805
|
const deps = {
|
|
3503
3806
|
...defaultDeps(),
|
|
3504
3807
|
resolveBranchIssue: (repo) => resolveBranchIssue(deps.cwd(), deps.env(), repo),
|
|
3808
|
+
resolveHeadSha: () => resolveHeadSha(deps.cwd()),
|
|
3505
3809
|
...overrides
|
|
3506
3810
|
};
|
|
3507
3811
|
const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
|
|
3508
3812
|
const processId = randomUUID2();
|
|
3509
3813
|
let seq = 0;
|
|
3510
3814
|
let warned = false;
|
|
3815
|
+
let folderFallbackRecorded = false;
|
|
3511
3816
|
const warnOnce = (message) => {
|
|
3512
3817
|
if (warned)
|
|
3513
3818
|
return;
|
|
@@ -3525,6 +3830,7 @@ function createLogSink(overrides = {}) {
|
|
|
3525
3830
|
};
|
|
3526
3831
|
const readerIsReal = overrides.resolveBranchIssue === undefined;
|
|
3527
3832
|
let ownBranchIssue;
|
|
3833
|
+
let ownBranchIssueSettled = null;
|
|
3528
3834
|
const branchIssueOnce = (repo) => {
|
|
3529
3835
|
if (!branchIssueFallbackEnabled)
|
|
3530
3836
|
return Promise.resolve(null);
|
|
@@ -3532,10 +3838,36 @@ function createLogSink(overrides = {}) {
|
|
|
3532
3838
|
const read = () => deps.resolveBranchIssue(slug);
|
|
3533
3839
|
if (readerIsReal)
|
|
3534
3840
|
return branchIssueRead(`${deps.cwd()}\x00${slug ?? ""}`, read, true);
|
|
3535
|
-
if (ownBranchIssue === undefined)
|
|
3841
|
+
if (ownBranchIssue === undefined) {
|
|
3536
3842
|
ownBranchIssue = branchIssueRead(deps.cwd(), read, false);
|
|
3843
|
+
ownBranchIssue.then((value) => {
|
|
3844
|
+
ownBranchIssueSettled = value;
|
|
3845
|
+
});
|
|
3846
|
+
}
|
|
3537
3847
|
return ownBranchIssue;
|
|
3538
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;
|
|
3539
3871
|
let resolveRepoCache;
|
|
3540
3872
|
const resolveRepoOnce = () => {
|
|
3541
3873
|
if (resolveRepoCache === undefined)
|
|
@@ -3543,6 +3875,7 @@ function createLogSink(overrides = {}) {
|
|
|
3543
3875
|
return resolveRepoCache;
|
|
3544
3876
|
};
|
|
3545
3877
|
let contextCache;
|
|
3878
|
+
let settledContext;
|
|
3546
3879
|
const context = () => {
|
|
3547
3880
|
if (contextCache === undefined) {
|
|
3548
3881
|
const env = deps.env();
|
|
@@ -3551,11 +3884,16 @@ function createLogSink(overrides = {}) {
|
|
|
3551
3884
|
doctrine()
|
|
3552
3885
|
]).then(async ([resolved, doctrineValue]) => {
|
|
3553
3886
|
const repo = resolved && isSafeRepoSegment3(resolved.owner) && isSafeRepoSegment3(resolved.repo) ? resolved : null;
|
|
3554
|
-
|
|
3887
|
+
settledContext = { repo, doctrine: doctrineValue, destination: await deps.resolveLogDestination(repo, env) };
|
|
3888
|
+
return settledContext;
|
|
3555
3889
|
});
|
|
3556
3890
|
}
|
|
3557
3891
|
return contextCache;
|
|
3558
3892
|
};
|
|
3893
|
+
const resetContext = () => {
|
|
3894
|
+
contextCache = undefined;
|
|
3895
|
+
settledContext = undefined;
|
|
3896
|
+
};
|
|
3559
3897
|
let drainChain = Promise.resolve();
|
|
3560
3898
|
const pendingWrites = new Set;
|
|
3561
3899
|
let writeChain = Promise.resolve();
|
|
@@ -3567,63 +3905,88 @@ function createLogSink(overrides = {}) {
|
|
|
3567
3905
|
`);
|
|
3568
3906
|
});
|
|
3569
3907
|
};
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3908
|
+
const snapshot = () => {
|
|
3909
|
+
const env = deps.env();
|
|
3910
|
+
return {
|
|
3911
|
+
host: hostFromEnv(env),
|
|
3912
|
+
now: deps.now(),
|
|
3913
|
+
seq: seq++,
|
|
3914
|
+
envFields: {
|
|
3577
3915
|
role: env.VINAYA_ROLE,
|
|
3578
3916
|
task: env.VINAYA_TASK,
|
|
3579
3917
|
round: env.VINAYA_ROUND,
|
|
3918
|
+
pr: env.VINAYA_PR,
|
|
3580
3919
|
run: env.VINAYA_RUN || runId,
|
|
3581
3920
|
attempt: env.VINAYA_ATTEMPT,
|
|
3582
|
-
parent: env.VINAYA_PARENT_EVENT
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
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}
|
|
3588
3934
|
`);
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3935
|
+
return;
|
|
3936
|
+
}
|
|
3937
|
+
if (destination.kind === "folder" && destination.fallbackReason) {
|
|
3938
|
+
warnOnce(`vinaya: ${describeFolderFallback(destination.fallbackReason)}
|
|
3593
3939
|
`);
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
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"}
|
|
3615
3965
|
`);
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3966
|
+
return;
|
|
3967
|
+
}
|
|
3968
|
+
const line = `${JSON.stringify(redact(parsed.data, deps.home()))}
|
|
3619
3969
|
`;
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
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;
|
|
3626
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);
|
|
3627
3990
|
};
|
|
3628
3991
|
const written = writeChain.then(write).catch((err) => {
|
|
3629
3992
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
@@ -3634,6 +3997,26 @@ function createLogSink(overrides = {}) {
|
|
|
3634
3997
|
written.finally(() => pendingWrites.delete(written));
|
|
3635
3998
|
} catch (err) {
|
|
3636
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)}
|
|
3637
4020
|
`);
|
|
3638
4021
|
}
|
|
3639
4022
|
}
|
|
@@ -3654,18 +4037,15 @@ function createLogSink(overrides = {}) {
|
|
|
3654
4037
|
return;
|
|
3655
4038
|
});
|
|
3656
4039
|
};
|
|
3657
|
-
return { log, runId, warmup, drain };
|
|
4040
|
+
return { log, logSync, runId, warmup, drain, resetContext };
|
|
3658
4041
|
}
|
|
3659
4042
|
var defaultSink = createLogSink();
|
|
3660
4043
|
|
|
3661
4044
|
// src/checks/runner.ts
|
|
3662
4045
|
var activeChecks = new Map;
|
|
3663
4046
|
|
|
3664
|
-
// src/lib/loop-log.ts
|
|
3665
|
-
var LOOP_LOG_MAX_BYTES = 8 * 1024 * 1024;
|
|
3666
|
-
|
|
3667
4047
|
// src/lib/brief-assembly.ts
|
|
3668
|
-
import { existsSync as existsSync7, readFileSync as
|
|
4048
|
+
import { existsSync as existsSync7, readFileSync as readFileSync7, readdirSync as readdirSync2 } from "node:fs";
|
|
3669
4049
|
import { join as join8 } from "node:path";
|
|
3670
4050
|
|
|
3671
4051
|
// ../../packages/sources/src/commands.ts
|
|
@@ -3822,7 +4202,7 @@ var COMMANDS = [
|
|
|
3822
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.",
|
|
3823
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.",
|
|
3824
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.",
|
|
3825
|
-
"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`)."
|
|
3826
4206
|
],
|
|
3827
4207
|
status: "shipped"
|
|
3828
4208
|
},
|
|
@@ -3907,13 +4287,14 @@ var COMMANDS = [
|
|
|
3907
4287
|
},
|
|
3908
4288
|
{
|
|
3909
4289
|
flag: "--push",
|
|
3910
|
-
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."
|
|
3911
4291
|
}
|
|
3912
4292
|
],
|
|
3913
4293
|
details: [
|
|
3914
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.",
|
|
3915
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.",
|
|
3916
|
-
"`--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."
|
|
3917
4298
|
],
|
|
3918
4299
|
status: "shipped"
|
|
3919
4300
|
},
|
|
@@ -3938,7 +4319,7 @@ var COMMANDS = [
|
|
|
3938
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.",
|
|
3939
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.",
|
|
3940
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.",
|
|
3941
|
-
"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."
|
|
3942
4323
|
],
|
|
3943
4324
|
status: "shipped"
|
|
3944
4325
|
},
|
|
@@ -4109,7 +4490,7 @@ var COMMANDS = [
|
|
|
4109
4490
|
{ flag: "--secrets", description: "security only: the SECRETS line" },
|
|
4110
4491
|
{
|
|
4111
4492
|
flag: "--secrets-evidence-file",
|
|
4112
|
-
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'
|
|
4113
4494
|
},
|
|
4114
4495
|
{ flag: "--task-id", description: "the closing `Tokens:` line's task id" },
|
|
4115
4496
|
{ flag: "--model", description: "the closing `Tokens:` line's model name" },
|
|
@@ -4217,7 +4598,20 @@ var COMMANDS = [
|
|
|
4217
4598
|
flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
|
|
4218
4599
|
details: [
|
|
4219
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.",
|
|
4220
|
-
"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."
|
|
4221
4615
|
],
|
|
4222
4616
|
status: "shipped"
|
|
4223
4617
|
},
|
|
@@ -4361,6 +4755,29 @@ var COMMANDS = [
|
|
|
4361
4755
|
],
|
|
4362
4756
|
status: "shipped"
|
|
4363
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
|
+
},
|
|
4364
4781
|
{
|
|
4365
4782
|
name: "log send",
|
|
4366
4783
|
description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
|
|
@@ -4371,20 +4788,44 @@ var COMMANDS = [
|
|
|
4371
4788
|
"Safe to run more than once: the server stores events by `event_id` and ignores one it already holds, so a re-sent chunk creates no duplicate, and a second run finds the folder emptied and the queue drained."
|
|
4372
4789
|
],
|
|
4373
4790
|
status: "shipped"
|
|
4791
|
+
},
|
|
4792
|
+
{
|
|
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
|
+
],
|
|
4802
|
+
details: [
|
|
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."
|
|
4806
|
+
],
|
|
4807
|
+
status: "shipped"
|
|
4374
4808
|
}
|
|
4375
4809
|
];
|
|
4376
4810
|
// ../../packages/sources/src/select-source.ts
|
|
4377
|
-
import { z as
|
|
4378
|
-
var StateSourceConfigSchema =
|
|
4379
|
-
|
|
4380
|
-
|
|
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() })
|
|
4381
4815
|
]);
|
|
4382
4816
|
// src/checks/edge-resolve.ts
|
|
4383
4817
|
var issueCache = new Map;
|
|
4384
4818
|
var siblingTrancheCache = new Map;
|
|
4385
4819
|
|
|
4386
4820
|
// src/commands/doctrine.ts
|
|
4821
|
+
import matter4 from "gray-matter";
|
|
4822
|
+
|
|
4823
|
+
// ../../packages/aeg-core/src/docs/parse-doc.ts
|
|
4387
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";
|
|
4388
4829
|
|
|
4389
4830
|
// src/lib/brief-assembly.ts
|
|
4390
4831
|
var PACKAGE_ROOT = packageRoot(import.meta.url);
|
|
@@ -4393,36 +4834,13 @@ var TEMPLATE_PATH = existsSync7(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH
|
|
|
4393
4834
|
var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
4394
4835
|
|
|
4395
4836
|
// src/lib/forge-write.ts
|
|
4837
|
+
var IMPORTABLE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
|
|
4838
|
+
var IMPORT_SEARCH_PATHSPEC = IMPORTABLE_EXTENSIONS.map((e) => `*${e}`);
|
|
4396
4839
|
var INFORMATIONAL_DISPATCH_BLOCKER_CLASSES = new Set([
|
|
4397
4840
|
"depends-on-not-merged",
|
|
4398
4841
|
"conflicts-with"
|
|
4399
4842
|
]);
|
|
4400
4843
|
|
|
4401
|
-
// src/lib/dispatch.ts
|
|
4402
|
-
var MAX_TEE_BYTES = 8 * 1024 * 1024;
|
|
4403
|
-
var CLAUDE_MODEL_ALIASES = new Set(["fable", "opus", "sonnet", "haiku"]);
|
|
4404
|
-
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)";
|
|
4405
|
-
|
|
4406
|
-
// src/commands/tokens.ts
|
|
4407
|
-
var USAGE = [
|
|
4408
|
-
'Usage: vinaya tokens --phase "<task-id>: develop" --role Developer',
|
|
4409
|
-
" [--model <id>] [--transcript <path>] [--in <tokens-in> --out <tokens-out>]",
|
|
4410
|
-
"",
|
|
4411
|
-
" --transcript Read this transcript directly. Supported primary route — use it whenever you know",
|
|
4412
|
-
" which transcript is yours, and always in a repo with no track-transcript.sh hook.",
|
|
4413
|
-
" (omitted) Resolve via the Stop-hook pointer file, if this repo installs that hook.",
|
|
4414
|
-
" --in/--out Manual entry: the exact token figures, for a host whose usage arrives by some other",
|
|
4415
|
-
" means than a Claude Code transcript. Both required together; skips transcript",
|
|
4416
|
-
" resolution entirely.",
|
|
4417
|
-
"",
|
|
4418
|
-
"Usage: vinaya tokens --trust-collect",
|
|
4419
|
-
" Approves this repo's declared tokens.collect command, pinned to the script's exact current",
|
|
4420
|
-
" content, on this machine. Run this once before tokens.collect will ever execute — a changed",
|
|
4421
|
-
" interpreter, script path, or script CONTENT needs its own fresh approval. Does not take",
|
|
4422
|
-
" --phase/--role and never emits a Tokens: line."
|
|
4423
|
-
].join(`
|
|
4424
|
-
`);
|
|
4425
|
-
|
|
4426
4844
|
// src/lib/pr-report-engine.ts
|
|
4427
4845
|
var execFileAsync6 = promisify6(execFile6);
|
|
4428
4846
|
var BODY_READING_CHECK_NAMES = new Set(coreCheckRegistry().filter((spec) => {
|
|
@@ -4432,21 +4850,21 @@ var BODY_READING_CHECK_NAMES = new Set(coreCheckRegistry().filter((spec) => {
|
|
|
4432
4850
|
var FAILING_STATUSES = new Set(["fail", "error", "timeout"]);
|
|
4433
4851
|
function readTestRunCacheFile(path) {
|
|
4434
4852
|
try {
|
|
4435
|
-
if (!
|
|
4853
|
+
if (!lstatSync4(path).isFile())
|
|
4436
4854
|
return {};
|
|
4437
|
-
return JSON.parse(
|
|
4855
|
+
return JSON.parse(readFileSync8(path, "utf8"));
|
|
4438
4856
|
} catch {
|
|
4439
4857
|
return {};
|
|
4440
4858
|
}
|
|
4441
4859
|
}
|
|
4442
4860
|
function writeTestRunCacheFile(path, all) {
|
|
4443
4861
|
const tmp = `${path}.tmp-${process.pid}-${randomUUID3()}`;
|
|
4444
|
-
const fd =
|
|
4862
|
+
const fd = openSync6(tmp, fsConstants6.O_WRONLY | fsConstants6.O_CREAT | fsConstants6.O_EXCL, 384);
|
|
4445
4863
|
try {
|
|
4446
|
-
|
|
4864
|
+
writeSync5(fd, JSON.stringify(all, null, 2), null, "utf8");
|
|
4447
4865
|
fsyncSync2(fd);
|
|
4448
4866
|
} finally {
|
|
4449
|
-
|
|
4867
|
+
closeSync6(fd);
|
|
4450
4868
|
}
|
|
4451
4869
|
renameSync4(tmp, path);
|
|
4452
4870
|
}
|
|
@@ -4456,7 +4874,7 @@ function fileBackedTestRunCache(path, runtimeDir) {
|
|
|
4456
4874
|
set: (key, record) => {
|
|
4457
4875
|
const all = readTestRunCacheFile(path);
|
|
4458
4876
|
all[key] = record;
|
|
4459
|
-
ensureRunDir(
|
|
4877
|
+
ensureRunDir(dirname8(path), runtimeDir);
|
|
4460
4878
|
writeTestRunCacheFile(path, all);
|
|
4461
4879
|
}
|
|
4462
4880
|
};
|
|
@@ -4498,7 +4916,7 @@ async function collectStateFields(cwd) {
|
|
|
4498
4916
|
for (const f of uncommitted) {
|
|
4499
4917
|
fields.push(f);
|
|
4500
4918
|
try {
|
|
4501
|
-
fields.push(
|
|
4919
|
+
fields.push(readFileSync8(join9(base, f)));
|
|
4502
4920
|
} catch {
|
|
4503
4921
|
fields.push("MISSING");
|
|
4504
4922
|
}
|
|
@@ -4596,21 +5014,6 @@ async function recordGreenTestRun(command, output, cwd, source, cache = defaultT
|
|
|
4596
5014
|
}
|
|
4597
5015
|
return true;
|
|
4598
5016
|
}
|
|
4599
|
-
var TOKEN_ROW_REMEDY = [
|
|
4600
|
-
"Nothing here established that this host cannot meter — only that this session resolved no",
|
|
4601
|
-
"transcript of its own. Report real figures by naming your own transcript:",
|
|
4602
|
-
"",
|
|
4603
|
-
" vinaya pr report --write <body-file> --transcript <path>",
|
|
4604
|
-
"",
|
|
4605
|
-
"or, on a host whose usage arrives by some other means, format figures you already hold with:",
|
|
4606
|
-
"",
|
|
4607
|
-
' vinaya tokens --phase "<task-id>: develop" --role Developer --in <tokens-in> --out <tokens-out>',
|
|
4608
|
-
"",
|
|
4609
|
-
"and transcribe them into the `## Token report` table. That command prints a `Tokens:` line, not",
|
|
4610
|
-
"a table row — the table takes | Phase | Role | Agent/Model | Tokens in | Tokens out | Cost | Date |,",
|
|
4611
|
-
"and a line inside the block that does not start with `|` truncates the table for every row after it."
|
|
4612
|
-
].join(`
|
|
4613
|
-
`);
|
|
4614
5017
|
|
|
4615
5018
|
// src/lib/pre-push-cache-test-run.ts
|
|
4616
5019
|
async function main() {
|
|
@@ -4623,7 +5026,7 @@ async function main() {
|
|
|
4623
5026
|
}
|
|
4624
5027
|
let output;
|
|
4625
5028
|
try {
|
|
4626
|
-
output =
|
|
5029
|
+
output = readFileSync9(logPath, "utf8");
|
|
4627
5030
|
} catch (err) {
|
|
4628
5031
|
process.stderr.write(`vinaya pre-push: could not read ${logPath} to cache this run — nothing recorded (${err instanceof Error ? err.message : String(err)}).
|
|
4629
5032
|
`);
|