@attalabs/vinaya 0.36.0 → 0.38.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 +14 -14
- package/aeg-root/process.md +3 -1
- package/aeg-root/roles/archivist.md +2 -2
- package/aeg-root/roles/developer/reference.md +36 -37
- package/aeg-root/roles/developer.md +9 -5
- package/aeg-root/roles/operator.md +18 -18
- package/aeg-root/roles/planner/reference.md +15 -4
- package/aeg-root/roles/principal.md +6 -1
- package/aeg-root/roles/reviewer.md +14 -6
- package/aeg-root/roles/security.md +22 -11
- package/aeg-root/roles/tranche-archivist.md +14 -2
- package/aeg-root/state-machine.md +12 -11
- package/aeg-root/templates/brief-template.md +8 -6
- package/aeg-root/templates/pr-report-template.md +1 -9
- package/aeg-root/tranche-model.md +10 -4
- package/dist/checks/bin/check-body-bare-digits.js +823 -595
- package/dist/checks/bin/check-branch-topology.js +796 -478
- package/dist/checks/bin/check-brief-shape.js +824 -596
- package/dist/checks/bin/check-changeset-coverage.js +1337 -747
- package/dist/checks/bin/check-closes-n.js +796 -478
- package/dist/checks/bin/check-coherence.js +914 -611
- package/dist/checks/bin/check-dead-branch-push.js +705 -462
- package/dist/checks/bin/check-dispatch-readiness.js +941 -624
- package/dist/checks/bin/check-doc-coverage-push.js +1332 -742
- package/dist/checks/bin/check-doc-coverage.js +1339 -742
- package/dist/checks/bin/check-doctrine-no-procedures.js +821 -593
- package/dist/checks/bin/check-doctrine-portability.js +1332 -742
- package/dist/checks/bin/check-evidence-fresh.js +1339 -918
- package/dist/checks/bin/check-exec-bits.js +1331 -741
- package/dist/checks/bin/check-first-push-dispatch.js +917 -614
- package/dist/checks/bin/check-issue-assignment.js +796 -478
- package/dist/checks/bin/check-issue-milestone-attach.js +705 -462
- package/dist/checks/bin/check-issue-objectives-numbering.js +821 -593
- package/dist/checks/bin/check-issue-parts-coverage.js +705 -462
- package/dist/checks/bin/check-issue-surface-globs.js +925 -613
- package/dist/checks/bin/check-issue-title-grammar.js +705 -462
- package/dist/checks/bin/check-issue-tranche-label.js +705 -462
- package/dist/checks/bin/check-main-branch-refusal.js +705 -462
- package/dist/checks/bin/check-no-disk-state.js +705 -462
- package/dist/checks/bin/check-pr-premise-reassert.js +821 -593
- package/dist/checks/bin/check-pr-report-density.js +705 -462
- package/dist/checks/bin/check-principal-test-plan-wait.js +705 -462
- package/dist/checks/bin/check-quoted-command.js +1816 -1228
- package/dist/checks/bin/check-reader-resolvable-prose.js +1835 -1235
- package/dist/checks/bin/check-registry-gates.js +993 -526
- package/dist/checks/bin/check-retired-vocabulary.js +1810 -1222
- package/dist/checks/bin/check-review-gate.js +832 -604
- package/dist/checks/bin/check-single-plan-pr.js +705 -462
- package/dist/checks/bin/check-surface-scope.js +796 -478
- package/dist/checks/bin/check-test-plan.js +705 -462
- package/dist/checks/bin/check-token-collection-wired.js +705 -462
- package/dist/checks/bin/check-workspace-escape.js +1332 -742
- package/dist/checks/bin/verify-dispatch.js +3849 -0
- package/dist/index.js +20876 -10091
- package/dist/lib/pre-push-cache-test-run.js +1045 -682
- package/dist/lib/pre-push-changed-files.js +16 -11
- package/dist/lib/pre-push-select-tests.js +785 -500
- package/package.json +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +7 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +71 -15
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +51 -12
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +1 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +31 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +50 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +443 -28
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +18 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +6 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +13 -13
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +46 -110
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +169 -11
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +32 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/index.ts +3 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/published-prose.ts +30 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +6 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +0 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +82 -8
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +754 -7
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +24 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/custom.ts +157 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +44 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/executions.ts +493 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/fact-sheets.ts +111 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/generator.ts +155 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/index.ts +12 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +128 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/catches.ts +63 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/checks.ts +146 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/common.ts +137 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/completion.ts +137 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/convergence.ts +420 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/determinism.ts +65 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/index.ts +69 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/judgment.ts +132 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/labels.ts +21 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/time.ts +167 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/usage.ts +139 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +226 -15
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +7 -7
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/cache-contract.ts +207 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/contracts.ts +105 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/engine.ts +308 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/index.ts +34 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/measured.ts +20 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/memory-cache.ts +78 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/normalize.ts +156 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/row.ts +103 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +34 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +70 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +52 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +19 -14
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +201 -24
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +5 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-phase-history.ts +46 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +15 -28
- 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/page_client-reference-manifest.js +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]__0h9yhwx._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1wy7w66._.js → [root-of-the-server]__0jdjsxe._.js} +2 -2
- 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]__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/1-acpmtfmrc35.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/{2o9l0b7eqbr57.js → 2f2y8xxok8zph.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/{3lqjwjrcvq481.js → 2xevgia1h8g0y.js} +2 -2
- 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/3m310lbjj4p5u.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/server.js +1 -1
- package/dist/checks/bin/check-token-report.js +0 -6526
- package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core/bin/verify-coherence.ts +0 -1089
- package/studio-standalone/_node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +0 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/app-paths-manifest.json +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/build-manifest.json +0 -9
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/server-reference-manifest.json +0 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +0 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.map +0 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route_client-reference-manifest.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/044u_vinaya-studio_web__next-internal_server_app_api_coherence_route_actions_1rnzea1.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[externals]__0cki-x_._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +0 -15
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[turbopack]_runtime.js +0 -903
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ln09ua._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0oegopp._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__13yxbjd._.js +0 -51
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1duqmtm._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1z7dml9._.js +0 -9
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0bfs_u4._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0g8_eot._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0hrh_v-._.js +0 -181
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0i4-dea._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0o54suy._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0rxd7s0._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_151m4rz._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1a9dieq._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sxsf5q._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sy_yfr._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_219v2an._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_05ufo8i._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_form_input_tsx_0es8d8b._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_brutal_components_index_ts_0n_lcc4._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_0wvpm_z._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/00z3-ljjd1gj9.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0c8uwz_-m8s99.js +0 -165
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ct0c-xj0baf6.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0t5n_r4xm__t-.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vc2u252q5q6o.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/16r_o07lw0vm0.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1cah7_e5a1zvu.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1gjo9-6dz7nup.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/24tz8aro1uto4.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ef2g5fozszw7.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ka8dg687auhj.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2pf3f50gbrkyv.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qq49pct3q51-.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3et66z7glk65w.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3y6u3prmrkea-.js +0 -1
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_ssgManifest.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/checks/bin/check-evidence-fresh.ts
|
|
4
|
-
import { execFileSync as
|
|
4
|
+
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
5
5
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
6
6
|
var GATE_AUDIENCE = {
|
|
7
7
|
"check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
|
|
@@ -627,6 +627,33 @@ function tasksFromIssues(issues) {
|
|
|
627
627
|
}
|
|
628
628
|
return tasks.sort((a, b) => compareTaskIds(a.id, b.id));
|
|
629
629
|
}
|
|
630
|
+
function resolveDuplicateTasks(tasks, isOpen) {
|
|
631
|
+
const byId = new Map;
|
|
632
|
+
for (const t of tasks)
|
|
633
|
+
byId.set(t.id, [...byId.get(t.id) ?? [], t]);
|
|
634
|
+
const resolved = [];
|
|
635
|
+
const conflicts = [];
|
|
636
|
+
for (const [id, group] of byId) {
|
|
637
|
+
const first = group[0];
|
|
638
|
+
if (!first)
|
|
639
|
+
continue;
|
|
640
|
+
if (group.length === 1) {
|
|
641
|
+
resolved.push(first);
|
|
642
|
+
continue;
|
|
643
|
+
}
|
|
644
|
+
const number = (t) => t.issue ?? 0;
|
|
645
|
+
const open = group.filter((t) => t.issue !== null && isOpen(t.issue)).sort((a, b) => number(a) - number(b));
|
|
646
|
+
if (open.length > 1) {
|
|
647
|
+
conflicts.push({ id, issues: open.map(number) });
|
|
648
|
+
resolved.push(open[0]);
|
|
649
|
+
} else if (open.length === 1) {
|
|
650
|
+
resolved.push(open[0]);
|
|
651
|
+
} else {
|
|
652
|
+
resolved.push([...group].sort((a, b) => number(b) - number(a))[0]);
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
return { tasks: resolved.sort((a, b) => compareTaskIds(a.id, b.id)), conflicts };
|
|
656
|
+
}
|
|
630
657
|
async function fetchTrancheIssuesAsync(owner, repo, slug) {
|
|
631
658
|
return ghIssueListByAnyLabelAsync(owner, repo, [trancheLabel(slug)]);
|
|
632
659
|
}
|
|
@@ -1434,7 +1461,7 @@ function mapReviewDecision(decision) {
|
|
|
1434
1461
|
function buildBranchName(tranche, taskId) {
|
|
1435
1462
|
return `task/${tranche}/${taskId}`;
|
|
1436
1463
|
}
|
|
1437
|
-
async function
|
|
1464
|
+
async function fetchForgeFactsByIssue(input) {
|
|
1438
1465
|
const token = await resolveGithubToken(input.token);
|
|
1439
1466
|
if (!token) {
|
|
1440
1467
|
return {
|
|
@@ -1444,7 +1471,13 @@ async function fetchForgeFacts(input) {
|
|
|
1444
1471
|
reason: "No GitHub token available (set GITHUB_TOKEN/GH_TOKEN or `gh auth login`)."
|
|
1445
1472
|
};
|
|
1446
1473
|
}
|
|
1447
|
-
const
|
|
1474
|
+
const seen = new Set;
|
|
1475
|
+
const queriedTasks = input.tasks.filter((t) => {
|
|
1476
|
+
if (t.issue === null || seen.has(t.issue))
|
|
1477
|
+
return false;
|
|
1478
|
+
seen.add(t.issue);
|
|
1479
|
+
return true;
|
|
1480
|
+
});
|
|
1448
1481
|
if (queriedTasks.length === 0) {
|
|
1449
1482
|
return { facts: new Map, prRefs: new Map, unavailable: false };
|
|
1450
1483
|
}
|
|
@@ -1472,21 +1505,52 @@ async function fetchForgeFacts(input) {
|
|
|
1472
1505
|
};
|
|
1473
1506
|
}
|
|
1474
1507
|
for (const task of queriedTasks) {
|
|
1475
|
-
const
|
|
1476
|
-
const raw = extractRawFromResponse(response.repository, alias);
|
|
1508
|
+
const raw = extractRawFromResponse(response.repository, aliasFor(task.issue));
|
|
1477
1509
|
const mapped = mapForgeFacts(raw);
|
|
1478
1510
|
if (mapped)
|
|
1479
|
-
facts.set(task.
|
|
1511
|
+
facts.set(task.issue, mapped);
|
|
1480
1512
|
const pr = raw.pullRequest;
|
|
1481
1513
|
if (pr && typeof pr.number === "number" && typeof pr.url === "string") {
|
|
1482
|
-
prRefs.set(task.
|
|
1514
|
+
prRefs.set(task.issue, { number: pr.number, url: pr.url, state: pr.state });
|
|
1483
1515
|
}
|
|
1484
1516
|
}
|
|
1485
1517
|
return { facts, prRefs, unavailable: false };
|
|
1486
1518
|
}
|
|
1519
|
+
async function fetchForgeFacts(input) {
|
|
1520
|
+
const byIssue = await fetchForgeFactsByIssue(input);
|
|
1521
|
+
if (byIssue.unavailable) {
|
|
1522
|
+
return { facts: new Map, prRefs: new Map, unavailable: true, reason: byIssue.reason };
|
|
1523
|
+
}
|
|
1524
|
+
const facts = new Map;
|
|
1525
|
+
const prRefs = new Map;
|
|
1526
|
+
const winner = new Map;
|
|
1527
|
+
for (const task of input.tasks) {
|
|
1528
|
+
if (task.issue === null)
|
|
1529
|
+
continue;
|
|
1530
|
+
const current = winner.get(task.id);
|
|
1531
|
+
if (current === undefined || outranks(byIssue.facts, task.issue, current))
|
|
1532
|
+
winner.set(task.id, task.issue);
|
|
1533
|
+
}
|
|
1534
|
+
for (const [taskId, issue] of winner) {
|
|
1535
|
+
const f = byIssue.facts.get(issue);
|
|
1536
|
+
if (f)
|
|
1537
|
+
facts.set(taskId, f);
|
|
1538
|
+
const pr = byIssue.prRefs.get(issue);
|
|
1539
|
+
if (pr)
|
|
1540
|
+
prRefs.set(taskId, pr);
|
|
1541
|
+
}
|
|
1542
|
+
return { facts, prRefs, unavailable: false };
|
|
1543
|
+
}
|
|
1544
|
+
function outranks(facts, candidate, current) {
|
|
1545
|
+
const candidateOpen = facts.get(candidate)?.issueState === "open";
|
|
1546
|
+
const currentOpen = facts.get(current)?.issueState === "open";
|
|
1547
|
+
if (candidateOpen !== currentOpen)
|
|
1548
|
+
return candidateOpen;
|
|
1549
|
+
return candidate > current;
|
|
1550
|
+
}
|
|
1487
1551
|
function buildBatchQuery(tranche, tasks) {
|
|
1488
1552
|
const perTask = tasks.map((task) => {
|
|
1489
|
-
const a = aliasFor(task.
|
|
1553
|
+
const a = aliasFor(task.issue);
|
|
1490
1554
|
const branch = buildBranchName(tranche, task.id);
|
|
1491
1555
|
return `
|
|
1492
1556
|
${a}_issue: issue(number: ${task.issue}) {
|
|
@@ -1528,9 +1592,8 @@ function buildBatchQuery(tranche, tasks) {
|
|
|
1528
1592
|
}
|
|
1529
1593
|
}`;
|
|
1530
1594
|
}
|
|
1531
|
-
function aliasFor(
|
|
1532
|
-
|
|
1533
|
-
return `t_${sanitized}`;
|
|
1595
|
+
function aliasFor(issue) {
|
|
1596
|
+
return `i_${issue}`;
|
|
1534
1597
|
}
|
|
1535
1598
|
function extractRawFromResponse(repository, alias) {
|
|
1536
1599
|
const issue = repository[`${alias}_issue`];
|
|
@@ -1885,45 +1948,6 @@ var DERIVED_STATUSES = [
|
|
|
1885
1948
|
"incoherent"
|
|
1886
1949
|
];
|
|
1887
1950
|
var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
|
|
1888
|
-
// ../../packages/aeg-core/src/parse-ledger.ts
|
|
1889
|
-
function rowFromCells(cells) {
|
|
1890
|
-
if (cells.length < 7)
|
|
1891
|
-
return null;
|
|
1892
|
-
const phase = (cells[0] ?? "").trim();
|
|
1893
|
-
if (!phase)
|
|
1894
|
-
return null;
|
|
1895
|
-
return {
|
|
1896
|
-
phase,
|
|
1897
|
-
role: (cells[1] ?? "").trim(),
|
|
1898
|
-
agentModel: (cells[2] ?? "").trim(),
|
|
1899
|
-
tokensIn: parseIntCell(cells[3] ?? ""),
|
|
1900
|
-
tokensOut: parseIntCell(cells[4] ?? ""),
|
|
1901
|
-
cost: parseCostCell(cells[5] ?? ""),
|
|
1902
|
-
date: (cells[6] ?? "").trim()
|
|
1903
|
-
};
|
|
1904
|
-
}
|
|
1905
|
-
function parseIntCell(cell) {
|
|
1906
|
-
const trimmed = cell.replace(/`/g, "").trim();
|
|
1907
|
-
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1908
|
-
return null;
|
|
1909
|
-
const normalized = trimmed.replace(/[,_\s]/g, "");
|
|
1910
|
-
if (!/^-?\d+$/.test(normalized))
|
|
1911
|
-
return null;
|
|
1912
|
-
return Number(normalized);
|
|
1913
|
-
}
|
|
1914
|
-
function parseCostCell(cell) {
|
|
1915
|
-
const trimmed = cell.replace(/`/g, "").trim();
|
|
1916
|
-
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1917
|
-
return null;
|
|
1918
|
-
const normalized = trimmed.replace(/^\$/, "").replace(/[,_\s]/g, "");
|
|
1919
|
-
if (!/^-?\d+(\.\d+)?$/.test(normalized))
|
|
1920
|
-
return null;
|
|
1921
|
-
return Number(normalized);
|
|
1922
|
-
}
|
|
1923
|
-
function isEmDashOrDash(s) {
|
|
1924
|
-
const t = s.trim();
|
|
1925
|
-
return t === "—" || t === "-" || t === "–";
|
|
1926
|
-
}
|
|
1927
1951
|
// ../../packages/aeg-core/src/waiver-label.ts
|
|
1928
1952
|
var WAIVER_LABEL = label("waiver-docs");
|
|
1929
1953
|
var WAIVER_LABEL_REVIEW = label("waiver-review");
|
|
@@ -1939,61 +1963,6 @@ function isWaiverLabelActorVerified(opts) {
|
|
|
1939
1963
|
return false;
|
|
1940
1964
|
return isPrincipal(opts.labelActor, opts.principalAllowlist);
|
|
1941
1965
|
}
|
|
1942
|
-
|
|
1943
|
-
// ../../packages/aeg-core/src/parse-token-report.ts
|
|
1944
|
-
var TOKEN_REPORT_HEADING = /^\s*(?:#{1,6}\s*Token report\s*|\*\*Token report\*\*)\s*$/i;
|
|
1945
|
-
var INLINE_FIELD_LIST = /Phase:\s*([^|]+?)\s*\|\s*Role:\s*([^|]+?)\s*\|\s*Agent\/Model:\s*([^|]+?)\s*\|\s*Tokens in:\s*([^|]+?)\s*\|\s*Tokens out:\s*([^|]+?)\s*\|\s*Cost:\s*([^|]+?)\s*\|\s*Date:\s*(.+?)\s*$/im;
|
|
1946
|
-
function parseTokenReportEntries(body) {
|
|
1947
|
-
const lines = body.split(/\r?\n/);
|
|
1948
|
-
const headingIdxs = [];
|
|
1949
|
-
lines.forEach((line, i) => {
|
|
1950
|
-
if (TOKEN_REPORT_HEADING.test(line))
|
|
1951
|
-
headingIdxs.push(i);
|
|
1952
|
-
});
|
|
1953
|
-
const out = [];
|
|
1954
|
-
for (let h = 0;h < headingIdxs.length; h++) {
|
|
1955
|
-
const start = headingIdxs[h] + 1;
|
|
1956
|
-
const end = h + 1 < headingIdxs.length ? headingIdxs[h + 1] : lines.length;
|
|
1957
|
-
const section = lines.slice(start, end).join(`
|
|
1958
|
-
`);
|
|
1959
|
-
const tableRows = parseTableSection(section);
|
|
1960
|
-
if (tableRows.length > 0) {
|
|
1961
|
-
out.push(...tableRows);
|
|
1962
|
-
continue;
|
|
1963
|
-
}
|
|
1964
|
-
const inlineRow = parseInlineFieldList(section);
|
|
1965
|
-
if (inlineRow)
|
|
1966
|
-
out.push(inlineRow);
|
|
1967
|
-
}
|
|
1968
|
-
return out;
|
|
1969
|
-
}
|
|
1970
|
-
function parseTableSection(section) {
|
|
1971
|
-
const lines = section.split(/\r?\n/);
|
|
1972
|
-
let i = 0;
|
|
1973
|
-
for (;i < lines.length; i++) {
|
|
1974
|
-
if ((lines[i] ?? "").trim().startsWith("|"))
|
|
1975
|
-
break;
|
|
1976
|
-
}
|
|
1977
|
-
if (i + 1 >= lines.length)
|
|
1978
|
-
return [];
|
|
1979
|
-
i += 2;
|
|
1980
|
-
const out = [];
|
|
1981
|
-
for (;i < lines.length; i++) {
|
|
1982
|
-
const trimmed = (lines[i] ?? "").trim();
|
|
1983
|
-
if (!trimmed.startsWith("|"))
|
|
1984
|
-
break;
|
|
1985
|
-
const row = rowFromCells(splitTableRow(trimmed));
|
|
1986
|
-
if (row)
|
|
1987
|
-
out.push(row);
|
|
1988
|
-
}
|
|
1989
|
-
return out;
|
|
1990
|
-
}
|
|
1991
|
-
function parseInlineFieldList(section) {
|
|
1992
|
-
const m = section.match(INLINE_FIELD_LIST);
|
|
1993
|
-
if (!m)
|
|
1994
|
-
return null;
|
|
1995
|
-
return rowFromCells([m[1], m[2], m[3], m[4], m[5], m[6], m[7]]);
|
|
1996
|
-
}
|
|
1997
1966
|
// ../../packages/aeg-core/src/verdict-extraction.ts
|
|
1998
1967
|
var HEAD_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged head:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
1999
1968
|
var OBJECTIVES_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Objectives version:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
@@ -2442,10 +2411,12 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive,
|
|
|
2442
2411
|
var CODE_REVIEW_SEVERITY_ORDER = ["BLOCKER", "MAJOR", "MINOR"];
|
|
2443
2412
|
var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
|
|
2444
2413
|
var DEFAULT_MAX_ROUNDS = 3;
|
|
2414
|
+
var DEFAULT_MAX_TASK_MINUTES = 180;
|
|
2445
2415
|
var DEFAULT_REVIEW_POLICY = {
|
|
2446
2416
|
codeReviewThreshold: "BLOCKER",
|
|
2447
2417
|
securityThreshold: "HIGH",
|
|
2448
|
-
maxRounds: DEFAULT_MAX_ROUNDS
|
|
2418
|
+
maxRounds: DEFAULT_MAX_ROUNDS,
|
|
2419
|
+
maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES
|
|
2449
2420
|
};
|
|
2450
2421
|
var FILE_SHAPED_LOCATION = /\.[a-zA-Z0-9]{1,10}(:\d+)?\s*$/;
|
|
2451
2422
|
var PROSE_LOCATION_PATTERNS = [/\bpr\s*body\b/i, /\bcomment\b/i];
|
|
@@ -2453,6 +2424,9 @@ var ROLE_FILE_LOCATION = /(^|\/)aeg-root\/roles\//i;
|
|
|
2453
2424
|
function isProseLocation(location) {
|
|
2454
2425
|
if (ROLE_FILE_LOCATION.test(location))
|
|
2455
2426
|
return true;
|
|
2427
|
+
return isBodyOrCommentLocation(location);
|
|
2428
|
+
}
|
|
2429
|
+
function isBodyOrCommentLocation(location) {
|
|
2456
2430
|
if (FILE_SHAPED_LOCATION.test(location))
|
|
2457
2431
|
return false;
|
|
2458
2432
|
return PROSE_LOCATION_PATTERNS.some((pattern) => pattern.test(location));
|
|
@@ -2479,7 +2453,7 @@ function classifyFinding(finding, scale, threshold, context = {}) {
|
|
|
2479
2453
|
const wouldBlock = blockingSeverities(scale, threshold).includes(effectiveSeverity);
|
|
2480
2454
|
if (!wouldBlock)
|
|
2481
2455
|
return { outcome: "non_blocking", deferralReason: null };
|
|
2482
|
-
const hasLocation = location !== undefined && location.length > 0;
|
|
2456
|
+
const hasLocation = location !== undefined && location.length > 0 && !isBodyOrCommentLocation(location);
|
|
2483
2457
|
if (hasLocation && context.inSurface && !context.inSurface(location)) {
|
|
2484
2458
|
return { outcome: "deferred", deferralReason: "outside-surface" };
|
|
2485
2459
|
}
|
|
@@ -2846,11 +2820,13 @@ function checkDocUpdateList(prBody) {
|
|
|
2846
2820
|
return headingCheck(prBody, "(?:documentation|doc)[- ]update(?:\\s+list)?", "Documentation-update list");
|
|
2847
2821
|
}
|
|
2848
2822
|
function checkWorktreeStep0(prBody) {
|
|
2849
|
-
if (/git worktree add/.test(prBody))
|
|
2823
|
+
if (/git worktree add/.test(prBody) || /cd \.worktrees\//.test(prBody) || /bun install --frozen-lockfile/.test(prBody))
|
|
2850
2824
|
return { status: "pass", errors: [] };
|
|
2851
2825
|
return {
|
|
2852
2826
|
status: "fail",
|
|
2853
|
-
errors: [
|
|
2827
|
+
errors: [
|
|
2828
|
+
"brief-validation worktree Step 0: no `git worktree add`, `cd .worktrees/`, or `bun install --frozen-lockfile` command found in the PR body."
|
|
2829
|
+
]
|
|
2854
2830
|
};
|
|
2855
2831
|
}
|
|
2856
2832
|
function checkStopConditions(prBody) {
|
|
@@ -3040,7 +3016,8 @@ function isCommandBlock(content) {
|
|
|
3040
3016
|
return COMMAND_WORDS.includes(commandWordOf(firstNonBlankLine(content)));
|
|
3041
3017
|
}
|
|
3042
3018
|
function isStep0Block(content) {
|
|
3043
|
-
|
|
3019
|
+
const first = firstNonBlankLine(content);
|
|
3020
|
+
return first.startsWith("git worktree add") || first.startsWith("cd .worktrees/") || first.startsWith("bun install --frozen-lockfile");
|
|
3044
3021
|
}
|
|
3045
3022
|
function checkCommandsCarryOutput(prBody) {
|
|
3046
3023
|
const errors = [];
|
|
@@ -3509,10 +3486,14 @@ function legacySlugPattern(legacySlugs) {
|
|
|
3509
3486
|
const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
3510
3487
|
return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
|
|
3511
3488
|
}
|
|
3489
|
+
function specGrandfatherPaths(specGrandfather) {
|
|
3490
|
+
return Array.isArray(specGrandfather) ? [...specGrandfather] : Object.keys(specGrandfather);
|
|
3491
|
+
}
|
|
3512
3492
|
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
3513
3493
|
const findings = [];
|
|
3514
3494
|
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
3515
|
-
const
|
|
3495
|
+
const grandfatheredWhole = new Set(Array.isArray(specGrandfather) ? specGrandfather : []);
|
|
3496
|
+
const limits = new Map(Array.isArray(specGrandfather) ? [] : Object.entries(specGrandfather));
|
|
3516
3497
|
const patterns = [
|
|
3517
3498
|
{ pattern: FORGE_NUMBER_PATTERN, what: "a forge number" },
|
|
3518
3499
|
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
|
|
@@ -3531,18 +3512,19 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
3531
3512
|
continue;
|
|
3532
3513
|
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
3533
3514
|
continue;
|
|
3534
|
-
if (cls === "spec" &&
|
|
3515
|
+
if (cls === "spec" && grandfatheredWhole.has(file.path))
|
|
3535
3516
|
continue;
|
|
3536
3517
|
const blocking = cls === "product" || cls === "spec";
|
|
3537
3518
|
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
3538
3519
|
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
3520
|
+
const fileFindings = [];
|
|
3539
3521
|
for (const { pattern, what, group } of patternsToRun) {
|
|
3540
3522
|
pattern.lastIndex = 0;
|
|
3541
3523
|
let match = pattern.exec(scrubbed);
|
|
3542
3524
|
while (match !== null) {
|
|
3543
3525
|
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
3544
3526
|
const citedIndex = match.index + match[0].indexOf(cited);
|
|
3545
|
-
|
|
3527
|
+
fileFindings.push({
|
|
3546
3528
|
file: file.path,
|
|
3547
3529
|
line: lineAt(scrubbed, citedIndex),
|
|
3548
3530
|
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
@@ -3551,6 +3533,15 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
3551
3533
|
match = pattern.exec(scrubbed);
|
|
3552
3534
|
}
|
|
3553
3535
|
}
|
|
3536
|
+
const limit = cls === "spec" ? limits.get(file.path) : undefined;
|
|
3537
|
+
if (limit !== undefined) {
|
|
3538
|
+
if (fileFindings.length <= limit)
|
|
3539
|
+
continue;
|
|
3540
|
+
for (const f of fileFindings) {
|
|
3541
|
+
f.message += `; ${file.path} carries ${fileFindings.length} such findings, over its proseGates.specGrandfather limit of ${limit}`;
|
|
3542
|
+
}
|
|
3543
|
+
}
|
|
3544
|
+
findings.push(...fileFindings);
|
|
3554
3545
|
}
|
|
3555
3546
|
return findings;
|
|
3556
3547
|
}
|
|
@@ -4132,6 +4123,8 @@ var FILE_EXTENSIONS = new Set([
|
|
|
4132
4123
|
"html",
|
|
4133
4124
|
"css"
|
|
4134
4125
|
]);
|
|
4126
|
+
var CI_SHARD_DIR = "apps/cli/tests/ci-shards";
|
|
4127
|
+
var CI_SHARD_PROBE = `${CI_SHARD_DIR}/shard-1.txt`;
|
|
4135
4128
|
|
|
4136
4129
|
// ../../packages/aeg-core/src/task-branch-identity.ts
|
|
4137
4130
|
var ISSUE_BRANCH_PATTERN = /^task\/issue-(\d+)$/;
|
|
@@ -4510,8 +4503,7 @@ function briefHash(brief) {
|
|
|
4510
4503
|
function policyDigest(policy) {
|
|
4511
4504
|
return createHash4("sha256").update(JSON.stringify({
|
|
4512
4505
|
codeReviewThreshold: policy.codeReviewThreshold,
|
|
4513
|
-
securityThreshold: policy.securityThreshold
|
|
4514
|
-
maxRounds: policy.maxRounds
|
|
4506
|
+
securityThreshold: policy.securityThreshold
|
|
4515
4507
|
})).digest("hex");
|
|
4516
4508
|
}
|
|
4517
4509
|
function isBoundToHead(echoed, headSha) {
|
|
@@ -4824,7 +4816,46 @@ function parseEnforcementRegistry(content) {
|
|
|
4824
4816
|
return result;
|
|
4825
4817
|
}
|
|
4826
4818
|
// ../../packages/aeg-core/src/registry-checks.ts
|
|
4827
|
-
|
|
4819
|
+
var HOOK_DIR_PREFIXES = [".claude/hooks/", ".vinaya/hooks/", ".husky/", ".git/hooks/"];
|
|
4820
|
+
var BARE_HOOK_NAME = /^check-[A-Za-z0-9_.-]*\.sh$/;
|
|
4821
|
+
function basename(path) {
|
|
4822
|
+
return path.slice(path.lastIndexOf("/") + 1);
|
|
4823
|
+
}
|
|
4824
|
+
function lineOf(content, index) {
|
|
4825
|
+
let line = 1;
|
|
4826
|
+
for (let i = 0;i < index; i++)
|
|
4827
|
+
if (content.charCodeAt(i) === 10)
|
|
4828
|
+
line++;
|
|
4829
|
+
return line;
|
|
4830
|
+
}
|
|
4831
|
+
function findUnshippedHookRefs(docs, shipped) {
|
|
4832
|
+
const shippedNames = new Set([...shipped].map(basename));
|
|
4833
|
+
const findings = [];
|
|
4834
|
+
const flag = (doc, token, index) => {
|
|
4835
|
+
findings.push({
|
|
4836
|
+
path: doc.path,
|
|
4837
|
+
reason: `${doc.path}:${lineOf(doc.content, index)} names hook "${token}", which is neither tracked in git nor emitted by \`vinaya init\``
|
|
4838
|
+
});
|
|
4839
|
+
};
|
|
4840
|
+
for (const doc of docs) {
|
|
4841
|
+
for (const { cited, index } of extractCitedPaths(doc.content)) {
|
|
4842
|
+
if (cited.endsWith("/") || !HOOK_DIR_PREFIXES.some((p) => cited.startsWith(p)))
|
|
4843
|
+
continue;
|
|
4844
|
+
if (!shipped.has(cited))
|
|
4845
|
+
flag(doc, cited, index);
|
|
4846
|
+
}
|
|
4847
|
+
const spanPattern = /`([^`\n]+)`/g;
|
|
4848
|
+
let match = spanPattern.exec(doc.content);
|
|
4849
|
+
while (match !== null) {
|
|
4850
|
+
const token = match[1] ?? "";
|
|
4851
|
+
if (BARE_HOOK_NAME.test(token) && !shippedNames.has(token))
|
|
4852
|
+
flag(doc, token, match.index);
|
|
4853
|
+
match = spanPattern.exec(doc.content);
|
|
4854
|
+
}
|
|
4855
|
+
}
|
|
4856
|
+
return findings;
|
|
4857
|
+
}
|
|
4858
|
+
function checkG1(rows, existsFn, hookRefs) {
|
|
4828
4859
|
const findings = [];
|
|
4829
4860
|
for (const row of rows) {
|
|
4830
4861
|
if (row.implementation === "")
|
|
@@ -4837,6 +4868,8 @@ function checkG1(rows, existsFn) {
|
|
|
4837
4868
|
});
|
|
4838
4869
|
}
|
|
4839
4870
|
}
|
|
4871
|
+
if (hookRefs)
|
|
4872
|
+
findings.push(...findUnshippedHookRefs(hookRefs.docs, hookRefs.shipped));
|
|
4840
4873
|
return { check: "G1", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4841
4874
|
}
|
|
4842
4875
|
var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
|
|
@@ -4969,6 +5002,55 @@ function checkG6(rows, registeredCheckNames) {
|
|
|
4969
5002
|
}
|
|
4970
5003
|
return { check: "G6", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4971
5004
|
}
|
|
5005
|
+
function reachesProducer(file, producers, imports) {
|
|
5006
|
+
const seen = new Set([file]);
|
|
5007
|
+
const queue = [file];
|
|
5008
|
+
for (let next = queue.pop();next !== undefined; next = queue.pop()) {
|
|
5009
|
+
if (producers.has(next))
|
|
5010
|
+
return true;
|
|
5011
|
+
for (const dep of imports.get(next) ?? []) {
|
|
5012
|
+
if (!seen.has(dep)) {
|
|
5013
|
+
seen.add(dep);
|
|
5014
|
+
queue.push(dep);
|
|
5015
|
+
}
|
|
5016
|
+
}
|
|
5017
|
+
}
|
|
5018
|
+
return false;
|
|
5019
|
+
}
|
|
5020
|
+
function checkG7(input) {
|
|
5021
|
+
if (!input.enforcementMapPresent)
|
|
5022
|
+
return { check: "G7", status: "info", findings: [] };
|
|
5023
|
+
const subjects = new Set([...input.crossingFiles, ...input.blockingFiles]);
|
|
5024
|
+
const findings = [];
|
|
5025
|
+
for (const path of subjects) {
|
|
5026
|
+
if (path in input.exemptions)
|
|
5027
|
+
continue;
|
|
5028
|
+
if (!reachesProducer(path, input.producers, input.imports)) {
|
|
5029
|
+
findings.push({
|
|
5030
|
+
path,
|
|
5031
|
+
reason: `"${path}" ${input.crossingFiles.includes(path) ? "makes a GitHub-writing call" : "implements a blocking gate"} but neither is a log producer nor imports one, and it is not exempted with a reason`
|
|
5032
|
+
});
|
|
5033
|
+
}
|
|
5034
|
+
}
|
|
5035
|
+
for (const [path, reason] of Object.entries(input.exemptions)) {
|
|
5036
|
+
if (reason.trim() === "") {
|
|
5037
|
+
findings.push({ path, reason: `exemption for "${path}" states no reason` });
|
|
5038
|
+
} else if (!input.existsFn(path)) {
|
|
5039
|
+
findings.push({ path, reason: `exemption names "${path}", which no longer exists` });
|
|
5040
|
+
} else if (!subjects.has(path)) {
|
|
5041
|
+
findings.push({
|
|
5042
|
+
path,
|
|
5043
|
+
reason: `exemption names "${path}", which is neither a GitHub-writing file nor a blocking gate's implementation`
|
|
5044
|
+
});
|
|
5045
|
+
} else if (reachesProducer(path, input.producers, input.imports)) {
|
|
5046
|
+
findings.push({
|
|
5047
|
+
path,
|
|
5048
|
+
reason: `exemption names "${path}", which does reach a log producer — remove the exemption`
|
|
5049
|
+
});
|
|
5050
|
+
}
|
|
5051
|
+
}
|
|
5052
|
+
return { check: "G7", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
5053
|
+
}
|
|
4972
5054
|
// ../../packages/aeg-core/src/dead-branch-push-guard.ts
|
|
4973
5055
|
function checkDeadBranchPush(input) {
|
|
4974
5056
|
const { branch, prState, prNumber } = input;
|
|
@@ -5148,6 +5230,11 @@ function checkDispatchReadiness(input) {
|
|
|
5148
5230
|
push("depends-on-unresolvable", `dispatch-gate depends-on: ${taskLabel} depends on "${dep.id}", which is UNRESOLVABLE — the resolver could not find a matching tranche/task/Issue for this edge (not a claim about merge status). Not dispatchable until the edge is corrected.`);
|
|
5149
5231
|
continue;
|
|
5150
5232
|
}
|
|
5233
|
+
if (dep.readFailed === true) {
|
|
5234
|
+
const issueStr = dep.issue !== null ? ` (#${dep.issue})` : "";
|
|
5235
|
+
push("depends-on-read-failed", `dispatch-gate depends-on: ${taskLabel} depends on ${dep.id}${issueStr}, but the forge could not be read for that dependency — not a claim about its merge status. Retry the check.`);
|
|
5236
|
+
continue;
|
|
5237
|
+
}
|
|
5151
5238
|
if (!dep.merged && !isHandClosedByRecognizedPrincipal(dep, principalAllowlist)) {
|
|
5152
5239
|
const issueStr = dep.issue !== null ? ` (#${dep.issue})` : "";
|
|
5153
5240
|
push("depends-on-not-merged", `dispatch-gate depends-on: ${taskLabel} depends on ${dep.id}${issueStr}, whose PR is not merged yet — not dispatchable, it serializes behind it.`);
|
|
@@ -5390,7 +5477,6 @@ var TaskPrPauseSchema = z.object({
|
|
|
5390
5477
|
var TaskPrReviewRecordSchema = z.object({
|
|
5391
5478
|
verdicts: z.array(TaskPrVerdictSchema),
|
|
5392
5479
|
roundMarkers: z.array(z.number().int().nonnegative()),
|
|
5393
|
-
summaryTable: z.string().nullable(),
|
|
5394
5480
|
pause: TaskPrPauseSchema.nullable()
|
|
5395
5481
|
});
|
|
5396
5482
|
var TaskPrReadInputSchema = z.object({
|
|
@@ -5437,16 +5523,6 @@ var TaskCancelResultSchema = z.object({
|
|
|
5437
5523
|
authenticatedFrom: z.string().min(1),
|
|
5438
5524
|
fencedEffectKeys: z.array(z.string())
|
|
5439
5525
|
});
|
|
5440
|
-
var TASK_TOOL_NAMES = [
|
|
5441
|
-
"task_start",
|
|
5442
|
-
"task_status",
|
|
5443
|
-
"task_escalation_read",
|
|
5444
|
-
"task_pr_read",
|
|
5445
|
-
"task_resume",
|
|
5446
|
-
"task_cancel"
|
|
5447
|
-
];
|
|
5448
|
-
var OPERATOR_STATUS_FOLLOW = "task_status_follow";
|
|
5449
|
-
var OPERATOR_TOOL_GRANT = [...TASK_TOOL_NAMES, OPERATOR_STATUS_FOLLOW];
|
|
5450
5526
|
// ../../packages/aeg-core/src/first-push-dispatch-gate.ts
|
|
5451
5527
|
function parseTaskBranch(branch) {
|
|
5452
5528
|
const m = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
|
|
@@ -5677,16 +5753,71 @@ var NO_GATE_CUTOVERS = {
|
|
|
5677
5753
|
briefRulesSincePr: null,
|
|
5678
5754
|
agentBoxesRefusedSincePr: null
|
|
5679
5755
|
};
|
|
5680
|
-
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
5681
|
-
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
5682
|
-
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
5683
|
-
var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
|
|
5684
|
-
// ../../packages/aeg-core/src/log/envelope.ts
|
|
5685
|
-
import { createHash as createHash5 } from "node:crypto";
|
|
5686
|
-
|
|
5687
5756
|
// ../../packages/aeg-core/src/log/schema.ts
|
|
5757
|
+
import { z as z3 } from "zod";
|
|
5758
|
+
|
|
5759
|
+
// ../../packages/aeg-core/src/log/custom.ts
|
|
5688
5760
|
import { z as z2 } from "zod";
|
|
5761
|
+
var CUSTOM_EVENT_NAME_PATTERN = /^[a-z][a-z0-9_]*\.[a-z][a-z0-9_.]*$/;
|
|
5762
|
+
var CUSTOM_EVENT_NAME_MAX_LENGTH = 64;
|
|
5763
|
+
var CUSTOM_EVENT_RESERVED_NAMESPACE = "vinaya";
|
|
5764
|
+
var CUSTOM_EVENT_MAX_FIELDS = 20;
|
|
5765
|
+
var CUSTOM_FIELD_NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
5766
|
+
var CUSTOM_FIELD_NAME_MAX_LENGTH = 64;
|
|
5767
|
+
var CUSTOM_TEXT_MAX_LENGTH = 500;
|
|
5768
|
+
var CUSTOM_WORD_PATTERN = /^[a-z0-9][a-z0-9_-]*$/;
|
|
5769
|
+
var CUSTOM_WORD_MAX_LENGTH = 64;
|
|
5770
|
+
var CUSTOM_FIELD_MAX_WORDS = 50;
|
|
5771
|
+
var CustomFieldTypeSchema = z2.union([z2.enum(["text", "number", "boolean"]), z2.array(z2.string())]);
|
|
5772
|
+
var CustomEventDeclarationsSchema = z2.record(z2.string(), z2.object({
|
|
5773
|
+
fields: z2.record(z2.string(), CustomFieldTypeSchema)
|
|
5774
|
+
}).strict()).superRefine((events, ctx) => {
|
|
5775
|
+
for (const [name, declaration] of Object.entries(events)) {
|
|
5776
|
+
const refuse = (message, path = []) => {
|
|
5777
|
+
ctx.addIssue({
|
|
5778
|
+
code: z2.ZodIssueCode.custom,
|
|
5779
|
+
path: [name, ...path],
|
|
5780
|
+
message: `logs.events "${name}": ${message}`
|
|
5781
|
+
});
|
|
5782
|
+
};
|
|
5783
|
+
if (name.length > CUSTOM_EVENT_NAME_MAX_LENGTH) {
|
|
5784
|
+
refuse(`the name must be at most ${CUSTOM_EVENT_NAME_MAX_LENGTH} characters`);
|
|
5785
|
+
}
|
|
5786
|
+
if (!CUSTOM_EVENT_NAME_PATTERN.test(name)) {
|
|
5787
|
+
refuse("the name must be `<namespace>.<event>` — lowercase letters, digits and `_`, a dot between them");
|
|
5788
|
+
} else if (name.split(".")[0] === CUSTOM_EVENT_RESERVED_NAMESPACE) {
|
|
5789
|
+
refuse(`the \`${CUSTOM_EVENT_RESERVED_NAMESPACE}.\` namespace is reserved for Vinaya's own events`);
|
|
5790
|
+
}
|
|
5791
|
+
const fieldEntries = Object.entries(declaration.fields);
|
|
5792
|
+
if (fieldEntries.length > CUSTOM_EVENT_MAX_FIELDS) {
|
|
5793
|
+
refuse(`at most ${CUSTOM_EVENT_MAX_FIELDS} fields may be declared (found ${fieldEntries.length})`, ["fields"]);
|
|
5794
|
+
}
|
|
5795
|
+
for (const [field, type] of fieldEntries) {
|
|
5796
|
+
if (field.length > CUSTOM_FIELD_NAME_MAX_LENGTH || !CUSTOM_FIELD_NAME_PATTERN.test(field)) {
|
|
5797
|
+
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]);
|
|
5798
|
+
}
|
|
5799
|
+
if (typeof type === "string")
|
|
5800
|
+
continue;
|
|
5801
|
+
if (type.length === 0) {
|
|
5802
|
+
refuse(`field "${field}": a list of words must name at least one word`, ["fields", field]);
|
|
5803
|
+
}
|
|
5804
|
+
if (type.length > CUSTOM_FIELD_MAX_WORDS) {
|
|
5805
|
+
refuse(`field "${field}": a list of words may name at most ${CUSTOM_FIELD_MAX_WORDS}`, ["fields", field]);
|
|
5806
|
+
}
|
|
5807
|
+
const bad = type.filter((w) => w.length > CUSTOM_WORD_MAX_LENGTH || !CUSTOM_WORD_PATTERN.test(w));
|
|
5808
|
+
if (bad.length > 0) {
|
|
5809
|
+
refuse(`field "${field}": a listed word is lowercase letters, digits, \`_\` and \`-\`, at most ${CUSTOM_WORD_MAX_LENGTH} characters`, ["fields", field]);
|
|
5810
|
+
}
|
|
5811
|
+
if (new Set(type).size !== type.length) {
|
|
5812
|
+
refuse(`field "${field}": a list of words names a word twice`, ["fields", field]);
|
|
5813
|
+
}
|
|
5814
|
+
}
|
|
5815
|
+
}
|
|
5816
|
+
});
|
|
5817
|
+
|
|
5818
|
+
// ../../packages/aeg-core/src/log/schema.ts
|
|
5689
5819
|
var CONFIDENCE_REASON_MAX_LENGTH = 280;
|
|
5820
|
+
var REVIEW_FINDING_DESCRIPTION_MAX_LENGTH = 1000;
|
|
5690
5821
|
var ROLE_VALUES = [
|
|
5691
5822
|
"planner",
|
|
5692
5823
|
"developer",
|
|
@@ -5696,178 +5827,214 @@ var ROLE_VALUES = [
|
|
|
5696
5827
|
"archivist",
|
|
5697
5828
|
"architect"
|
|
5698
5829
|
];
|
|
5699
|
-
var RoleSchema =
|
|
5830
|
+
var RoleSchema = z3.enum(ROLE_VALUES);
|
|
5700
5831
|
var HOST_VALUES = ["hook", "ci", "cli", "loop"];
|
|
5701
|
-
var HostSchema =
|
|
5832
|
+
var HostSchema = z3.enum(HOST_VALUES);
|
|
5702
5833
|
var RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
|
|
5703
5834
|
var headerMetaCore = {
|
|
5704
|
-
ts:
|
|
5705
|
-
run_id:
|
|
5706
|
-
seq:
|
|
5707
|
-
repo:
|
|
5708
|
-
vinaya:
|
|
5709
|
-
doctrine:
|
|
5835
|
+
ts: z3.string(),
|
|
5836
|
+
run_id: z3.string().regex(RUN_ID_PATTERN),
|
|
5837
|
+
seq: z3.number().int().nonnegative(),
|
|
5838
|
+
repo: z3.string().nullable(),
|
|
5839
|
+
vinaya: z3.string(),
|
|
5840
|
+
doctrine: z3.string(),
|
|
5710
5841
|
host: HostSchema,
|
|
5711
|
-
machine:
|
|
5842
|
+
machine: z3.string()
|
|
5712
5843
|
};
|
|
5713
|
-
var HeaderMetaV1Schema =
|
|
5714
|
-
schema:
|
|
5844
|
+
var HeaderMetaV1Schema = z3.object({
|
|
5845
|
+
schema: z3.literal(1),
|
|
5715
5846
|
...headerMetaCore
|
|
5716
5847
|
}).strict();
|
|
5717
|
-
var LineageSchema =
|
|
5718
|
-
run:
|
|
5719
|
-
attempt:
|
|
5720
|
-
parent:
|
|
5848
|
+
var LineageSchema = z3.object({
|
|
5849
|
+
run: z3.string().nullable(),
|
|
5850
|
+
attempt: z3.number().int().nullable(),
|
|
5851
|
+
parent: z3.string().nullable()
|
|
5721
5852
|
}).strict();
|
|
5722
|
-
var InputVersionsSchema =
|
|
5723
|
-
objectives_version:
|
|
5724
|
-
brief_hash:
|
|
5725
|
-
ruling_ordinal:
|
|
5726
|
-
policy_digest:
|
|
5853
|
+
var InputVersionsSchema = z3.object({
|
|
5854
|
+
objectives_version: z3.string().nullable(),
|
|
5855
|
+
brief_hash: z3.string().nullable(),
|
|
5856
|
+
ruling_ordinal: z3.number().int().nullable(),
|
|
5857
|
+
policy_digest: z3.string().nullable()
|
|
5727
5858
|
}).strict();
|
|
5728
|
-
var ProvenanceSchema =
|
|
5729
|
-
var HeaderMetaV2Schema =
|
|
5730
|
-
schema:
|
|
5859
|
+
var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
|
|
5860
|
+
var HeaderMetaV2Schema = z3.object({
|
|
5861
|
+
schema: z3.literal(2),
|
|
5731
5862
|
...headerMetaCore,
|
|
5732
|
-
event_id:
|
|
5733
|
-
process_id:
|
|
5734
|
-
actor_id:
|
|
5863
|
+
event_id: z3.string().min(1),
|
|
5864
|
+
process_id: z3.string().min(1),
|
|
5865
|
+
actor_id: z3.string().nullable(),
|
|
5735
5866
|
lineage: LineageSchema,
|
|
5736
5867
|
input_versions: InputVersionsSchema,
|
|
5737
5868
|
provenance: ProvenanceSchema
|
|
5738
5869
|
}).strict();
|
|
5739
|
-
var
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
role: z2.union([RoleSchema, z2.literal("unattributed")]),
|
|
5745
|
-
round: z2.number().int().optional(),
|
|
5746
|
-
objectives_version: z2.string().optional()
|
|
5870
|
+
var WorkSchema = z3.object({
|
|
5871
|
+
ref: z3.string().nullable(),
|
|
5872
|
+
repo: z3.string().nullable(),
|
|
5873
|
+
change: z3.string().nullable(),
|
|
5874
|
+
revision: z3.string().nullable()
|
|
5747
5875
|
}).strict();
|
|
5748
|
-
var
|
|
5876
|
+
var FlowSchema = z3.object({
|
|
5877
|
+
id: z3.string().nullable(),
|
|
5878
|
+
version: z3.string().nullable()
|
|
5879
|
+
}).strict();
|
|
5880
|
+
var HeaderMetaV3Schema = z3.object({
|
|
5881
|
+
schema: z3.literal(3),
|
|
5882
|
+
...headerMetaCore,
|
|
5883
|
+
event_id: z3.string().min(1),
|
|
5884
|
+
process_id: z3.string().min(1),
|
|
5885
|
+
actor_id: z3.string().nullable(),
|
|
5886
|
+
lineage: LineageSchema,
|
|
5887
|
+
input_versions: InputVersionsSchema,
|
|
5888
|
+
provenance: ProvenanceSchema,
|
|
5889
|
+
work: WorkSchema,
|
|
5890
|
+
flow: FlowSchema,
|
|
5891
|
+
runtime: z3.string().nullable(),
|
|
5892
|
+
source: z3.string().nullable()
|
|
5893
|
+
}).strict();
|
|
5894
|
+
var HeaderMetaSchema = z3.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema, HeaderMetaV3Schema]);
|
|
5895
|
+
var SubjectSchema = z3.object({
|
|
5896
|
+
issue: z3.number().int().nullable(),
|
|
5897
|
+
pr: z3.number().int().optional(),
|
|
5898
|
+
sha: z3.string().optional(),
|
|
5899
|
+
role: z3.union([RoleSchema, z3.literal("unattributed")]),
|
|
5900
|
+
round: z3.number().int().optional(),
|
|
5901
|
+
objectives_version: z3.string().optional()
|
|
5902
|
+
}).strict();
|
|
5903
|
+
var HeaderSchema = z3.object({
|
|
5749
5904
|
meta: HeaderMetaSchema,
|
|
5750
5905
|
subject: SubjectSchema
|
|
5751
5906
|
}).strict();
|
|
5752
5907
|
var envelopeTail = {
|
|
5753
|
-
duration_ms:
|
|
5754
|
-
payload:
|
|
5908
|
+
duration_ms: z3.number().nonnegative().optional(),
|
|
5909
|
+
payload: z3.object({}).strict()
|
|
5755
5910
|
};
|
|
5756
|
-
var ReviewFindingSchema =
|
|
5757
|
-
id:
|
|
5758
|
-
severity:
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5911
|
+
var ReviewFindingSchema = z3.object({
|
|
5912
|
+
id: z3.string(),
|
|
5913
|
+
severity: z3.string(),
|
|
5914
|
+
location: z3.string().optional(),
|
|
5915
|
+
deferral_reason: z3.enum(["outside-surface", "unchanged-line"]).optional(),
|
|
5916
|
+
description: z3.string().max(REVIEW_FINDING_DESCRIPTION_MAX_LENGTH).optional(),
|
|
5917
|
+
state: z3.string().optional(),
|
|
5918
|
+
severity_scale: z3.string().optional(),
|
|
5919
|
+
policy_treatment: z3.enum(["blocking", "non_blocking", "unavailable"]).optional(),
|
|
5920
|
+
confidence: z3.number().min(0).max(1).optional(),
|
|
5921
|
+
confidence_scale: z3.string().optional(),
|
|
5922
|
+
confidence_source: z3.string().optional()
|
|
5765
5923
|
}).strict();
|
|
5766
|
-
var DispatchOutcomeSchema =
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
type:
|
|
5770
|
-
pr:
|
|
5771
|
-
head:
|
|
5772
|
-
comment_id:
|
|
5924
|
+
var DispatchOutcomeSchema = z3.discriminatedUnion("type", [
|
|
5925
|
+
z3.object({ type: z3.literal("pr_opened"), pr: z3.number().int(), head: z3.string() }).strict(),
|
|
5926
|
+
z3.object({
|
|
5927
|
+
type: z3.literal("round_pushed"),
|
|
5928
|
+
pr: z3.number().int(),
|
|
5929
|
+
head: z3.string(),
|
|
5930
|
+
comment_id: z3.number().int()
|
|
5773
5931
|
}).strict(),
|
|
5774
|
-
|
|
5775
|
-
type:
|
|
5776
|
-
verdict:
|
|
5777
|
-
head:
|
|
5778
|
-
comment_id:
|
|
5779
|
-
objectives:
|
|
5780
|
-
findings:
|
|
5932
|
+
z3.object({
|
|
5933
|
+
type: z3.literal("verdict"),
|
|
5934
|
+
verdict: z3.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
|
|
5935
|
+
head: z3.string(),
|
|
5936
|
+
comment_id: z3.number().int(),
|
|
5937
|
+
objectives: z3.array(z3.object({ id: z3.string(), met: z3.boolean() }).strict()),
|
|
5938
|
+
findings: z3.array(ReviewFindingSchema)
|
|
5781
5939
|
}).strict(),
|
|
5782
|
-
|
|
5783
|
-
type:
|
|
5784
|
-
class:
|
|
5785
|
-
comment_id:
|
|
5940
|
+
z3.object({
|
|
5941
|
+
type: z3.literal("escalation"),
|
|
5942
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
5943
|
+
comment_id: z3.number().int()
|
|
5786
5944
|
}).strict(),
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5945
|
+
z3.object({ type: z3.literal("brief"), comment_id: z3.number().int(), hash: z3.string() }).strict(),
|
|
5946
|
+
z3.object({ type: z3.literal("plan"), issues: z3.array(z3.number().int()) }).strict(),
|
|
5947
|
+
z3.object({ type: z3.literal("archive"), provenance_comment_id: z3.number().int() }).strict(),
|
|
5948
|
+
z3.object({ type: z3.literal("completed") }).strict()
|
|
5791
5949
|
]);
|
|
5792
5950
|
var dispatchShared = {
|
|
5793
5951
|
meta: HeaderMetaSchema,
|
|
5794
5952
|
subject: SubjectSchema,
|
|
5795
|
-
kind:
|
|
5953
|
+
kind: z3.literal("dispatch"),
|
|
5796
5954
|
...envelopeTail,
|
|
5797
5955
|
target_role: RoleSchema,
|
|
5798
|
-
model:
|
|
5799
|
-
round:
|
|
5800
|
-
effect_id:
|
|
5956
|
+
model: z3.string(),
|
|
5957
|
+
round: z3.number().int().optional(),
|
|
5958
|
+
effect_id: z3.string()
|
|
5801
5959
|
};
|
|
5802
|
-
var dispatchUsageField =
|
|
5803
|
-
var DispatchEventSchema =
|
|
5804
|
-
|
|
5805
|
-
|
|
5960
|
+
var dispatchUsageField = z3.object({ input: z3.number().nonnegative(), output: z3.number().nonnegative() }).strict().nullable();
|
|
5961
|
+
var DispatchEventSchema = z3.discriminatedUnion("event", [
|
|
5962
|
+
z3.object({ ...dispatchShared, event: z3.literal("dispatched"), prompt_hash: z3.string() }).strict(),
|
|
5963
|
+
z3.object({
|
|
5806
5964
|
...dispatchShared,
|
|
5807
|
-
event:
|
|
5965
|
+
event: z3.literal("outcome_received"),
|
|
5808
5966
|
outcome: DispatchOutcomeSchema,
|
|
5809
5967
|
usage: dispatchUsageField
|
|
5810
5968
|
}).strict(),
|
|
5811
|
-
|
|
5969
|
+
z3.object({
|
|
5812
5970
|
...dispatchShared,
|
|
5813
|
-
event:
|
|
5814
|
-
reason:
|
|
5971
|
+
event: z3.literal("dispatch_failed"),
|
|
5972
|
+
reason: z3.enum(["timeout", "crash", "refused", "unattributed_write", "usage_limit"]),
|
|
5973
|
+
usage_limit: z3.object({ agent: z3.string().min(1), reset_at: z3.string().nullable() }).strict().optional(),
|
|
5815
5974
|
usage: dispatchUsageField
|
|
5816
5975
|
}).strict()
|
|
5817
5976
|
]);
|
|
5977
|
+
var CODE_TOKEN_PATTERN = /^[A-Za-z0-9._-]{1,64}$/;
|
|
5978
|
+
var CodeTokenSchema = z3.string().regex(CODE_TOKEN_PATTERN);
|
|
5979
|
+
var ReviewerVerdictSchema = z3.object({
|
|
5980
|
+
role: RoleSchema,
|
|
5981
|
+
outcome: z3.enum(["approve", "changes_requested", "not_reviewed"]),
|
|
5982
|
+
blockers: z3.number().int().nonnegative()
|
|
5983
|
+
}).strict();
|
|
5818
5984
|
var loopShared = {
|
|
5819
5985
|
meta: HeaderMetaSchema,
|
|
5820
5986
|
subject: SubjectSchema,
|
|
5821
|
-
kind:
|
|
5987
|
+
kind: z3.literal("dev_review_loop"),
|
|
5822
5988
|
...envelopeTail,
|
|
5823
|
-
loop_id:
|
|
5989
|
+
loop_id: z3.string()
|
|
5824
5990
|
};
|
|
5825
|
-
var DevReviewLoopEventSchema =
|
|
5826
|
-
|
|
5991
|
+
var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
|
|
5992
|
+
z3.object({
|
|
5827
5993
|
...loopShared,
|
|
5828
|
-
event:
|
|
5829
|
-
task:
|
|
5830
|
-
policy:
|
|
5831
|
-
max_rounds:
|
|
5832
|
-
reviewers:
|
|
5833
|
-
models:
|
|
5994
|
+
event: z3.literal("loop_started"),
|
|
5995
|
+
task: z3.number().int(),
|
|
5996
|
+
policy: z3.object({
|
|
5997
|
+
max_rounds: z3.number().int().nonnegative(),
|
|
5998
|
+
reviewers: z3.array(RoleSchema),
|
|
5999
|
+
models: z3.record(RoleSchema, z3.string())
|
|
5834
6000
|
}).strict()
|
|
5835
6001
|
}).strict(),
|
|
5836
|
-
|
|
5837
|
-
|
|
6002
|
+
z3.object({ ...loopShared, event: z3.literal("round_started"), round: z3.number().int(), base_head: z3.string() }).strict(),
|
|
6003
|
+
z3.object({
|
|
5838
6004
|
...loopShared,
|
|
5839
|
-
event:
|
|
5840
|
-
round:
|
|
5841
|
-
head:
|
|
5842
|
-
green:
|
|
5843
|
-
confidence_value:
|
|
5844
|
-
confidence_reason:
|
|
5845
|
-
confidence_unavailable:
|
|
5846
|
-
extra_turn_spent:
|
|
6005
|
+
event: z3.literal("gate_result_read"),
|
|
6006
|
+
round: z3.number().int(),
|
|
6007
|
+
head: z3.string(),
|
|
6008
|
+
green: z3.boolean(),
|
|
6009
|
+
confidence_value: z3.number().int().min(0).max(100).optional(),
|
|
6010
|
+
confidence_reason: z3.string().max(CONFIDENCE_REASON_MAX_LENGTH).optional(),
|
|
6011
|
+
confidence_unavailable: z3.boolean().optional(),
|
|
6012
|
+
extra_turn_spent: z3.boolean().optional()
|
|
5847
6013
|
}).strict(),
|
|
5848
|
-
|
|
6014
|
+
z3.object({
|
|
5849
6015
|
...loopShared,
|
|
5850
|
-
event:
|
|
5851
|
-
round:
|
|
5852
|
-
head:
|
|
5853
|
-
all_approve:
|
|
5854
|
-
blockers:
|
|
5855
|
-
findings:
|
|
6016
|
+
event: z3.literal("verdicts_read"),
|
|
6017
|
+
round: z3.number().int(),
|
|
6018
|
+
head: z3.string(),
|
|
6019
|
+
all_approve: z3.boolean(),
|
|
6020
|
+
blockers: z3.number().int().nonnegative(),
|
|
6021
|
+
findings: z3.array(ReviewFindingSchema).optional(),
|
|
6022
|
+
reviewers: z3.array(ReviewerVerdictSchema).optional()
|
|
5856
6023
|
}).strict(),
|
|
5857
|
-
|
|
6024
|
+
z3.object({
|
|
5858
6025
|
...loopShared,
|
|
5859
|
-
event:
|
|
5860
|
-
round:
|
|
5861
|
-
open:
|
|
5862
|
-
resolved:
|
|
5863
|
-
new:
|
|
5864
|
-
recurring:
|
|
6026
|
+
event: z3.literal("findings_compared"),
|
|
6027
|
+
round: z3.number().int(),
|
|
6028
|
+
open: z3.array(z3.string()),
|
|
6029
|
+
resolved: z3.array(z3.string()),
|
|
6030
|
+
new: z3.array(z3.string()),
|
|
6031
|
+
recurring: z3.array(z3.string())
|
|
5865
6032
|
}).strict(),
|
|
5866
|
-
|
|
6033
|
+
z3.object({
|
|
5867
6034
|
...loopShared,
|
|
5868
|
-
event:
|
|
5869
|
-
round:
|
|
5870
|
-
condition:
|
|
6035
|
+
event: z3.literal("stop_condition_met"),
|
|
6036
|
+
round: z3.number().int(),
|
|
6037
|
+
condition: z3.enum([
|
|
5871
6038
|
"green",
|
|
5872
6039
|
"max_rounds",
|
|
5873
6040
|
"no_progress",
|
|
@@ -5876,66 +6043,85 @@ var DevReviewLoopEventSchema = z2.discriminatedUnion("event", [
|
|
|
5876
6043
|
"confidence",
|
|
5877
6044
|
"reappearance",
|
|
5878
6045
|
"repeat_finding",
|
|
5879
|
-
"repeat_failure"
|
|
6046
|
+
"repeat_failure",
|
|
6047
|
+
"time_budget"
|
|
5880
6048
|
])
|
|
5881
6049
|
}).strict(),
|
|
5882
|
-
|
|
6050
|
+
z3.object({
|
|
6051
|
+
...loopShared,
|
|
6052
|
+
event: z3.literal("paused"),
|
|
6053
|
+
round: z3.number().int(),
|
|
6054
|
+
reason: z3.enum(["escalation", "principal_item", "refreeze_needed"]),
|
|
6055
|
+
reason_code: CodeTokenSchema.optional()
|
|
6056
|
+
}).strict(),
|
|
6057
|
+
z3.object({
|
|
6058
|
+
...loopShared,
|
|
6059
|
+
event: z3.literal("resumed"),
|
|
6060
|
+
round: z3.number().int(),
|
|
6061
|
+
by: z3.enum(["principal", "driver"])
|
|
6062
|
+
}).strict(),
|
|
6063
|
+
z3.object({
|
|
5883
6064
|
...loopShared,
|
|
5884
|
-
event:
|
|
5885
|
-
round:
|
|
5886
|
-
|
|
6065
|
+
event: z3.literal("cancelled"),
|
|
6066
|
+
round: z3.number().int(),
|
|
6067
|
+
by: z3.literal("principal")
|
|
5887
6068
|
}).strict(),
|
|
5888
|
-
|
|
6069
|
+
z3.object({
|
|
5889
6070
|
...loopShared,
|
|
5890
|
-
event:
|
|
5891
|
-
round:
|
|
5892
|
-
|
|
6071
|
+
event: z3.literal("unpushed_work_resume"),
|
|
6072
|
+
round: z3.number().int(),
|
|
6073
|
+
branch: z3.string(),
|
|
6074
|
+
detail: z3.string()
|
|
5893
6075
|
}).strict(),
|
|
5894
|
-
|
|
6076
|
+
z3.object({
|
|
5895
6077
|
...loopShared,
|
|
5896
|
-
event:
|
|
5897
|
-
round:
|
|
5898
|
-
|
|
6078
|
+
event: z3.literal("round_ended"),
|
|
6079
|
+
round: z3.number().int(),
|
|
6080
|
+
base_head: z3.string(),
|
|
6081
|
+
head: z3.string(),
|
|
6082
|
+
files_changed: z3.number().int().nonnegative(),
|
|
6083
|
+
insertions: z3.number().int().nonnegative(),
|
|
6084
|
+
deletions: z3.number().int().nonnegative(),
|
|
6085
|
+
wall_ms: z3.number().nonnegative(),
|
|
6086
|
+
outcome: z3.enum(["green", "changes_requested", "escalated"])
|
|
5899
6087
|
}).strict(),
|
|
5900
|
-
|
|
6088
|
+
z3.object({
|
|
5901
6089
|
...loopShared,
|
|
5902
|
-
event:
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
6090
|
+
event: z3.literal("journal_finalized"),
|
|
6091
|
+
rounds: z3.number().int().nonnegative(),
|
|
6092
|
+
total_wall_ms: z3.number().nonnegative(),
|
|
6093
|
+
time_to_green_ms: z3.number().nonnegative().nullable(),
|
|
6094
|
+
files_changed_total: z3.number().int().nonnegative(),
|
|
6095
|
+
final_head: z3.string(),
|
|
6096
|
+
result: z3.enum(["merged_ready", "stopped"])
|
|
5906
6097
|
}).strict(),
|
|
5907
|
-
|
|
6098
|
+
z3.object({
|
|
5908
6099
|
...loopShared,
|
|
5909
|
-
event:
|
|
5910
|
-
round:
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
insertions: z2.number().int().nonnegative(),
|
|
5915
|
-
deletions: z2.number().int().nonnegative(),
|
|
5916
|
-
wall_ms: z2.number().nonnegative(),
|
|
5917
|
-
outcome: z2.enum(["green", "changes_requested", "escalated"])
|
|
6100
|
+
event: z3.literal("infrastructure_retry"),
|
|
6101
|
+
round: z3.number().int(),
|
|
6102
|
+
failure_kind: z3.enum(["pause_comment_post", "developer_connection"]),
|
|
6103
|
+
attempts: z3.number().int().positive(),
|
|
6104
|
+
outcome: z3.enum(["recovered", "exhausted"])
|
|
5918
6105
|
}).strict(),
|
|
5919
|
-
|
|
6106
|
+
z3.object({
|
|
5920
6107
|
...loopShared,
|
|
5921
|
-
event:
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
final_head: z2.string(),
|
|
5927
|
-
result: z2.enum(["merged_ready", "stopped"])
|
|
6108
|
+
event: z3.literal("driver_heartbeat"),
|
|
6109
|
+
task: z3.number().int(),
|
|
6110
|
+
pr: z3.number().int().positive().optional(),
|
|
6111
|
+
round: z3.number().int(),
|
|
6112
|
+
phase: z3.string()
|
|
5928
6113
|
}).strict(),
|
|
5929
|
-
|
|
6114
|
+
z3.object({
|
|
5930
6115
|
...loopShared,
|
|
5931
|
-
event:
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
6116
|
+
event: z3.literal("driver_exited"),
|
|
6117
|
+
task: z3.number().int(),
|
|
6118
|
+
reason: z3.enum(["finished", "paused", "reexec", "error", "signal"]),
|
|
6119
|
+
last_decision: z3.string(),
|
|
6120
|
+
exit_code: z3.number().int().optional(),
|
|
6121
|
+
error_class: CodeTokenSchema.optional()
|
|
5936
6122
|
}).strict()
|
|
5937
6123
|
]);
|
|
5938
|
-
var ForgeOpSchema =
|
|
6124
|
+
var ForgeOpSchema = z3.enum([
|
|
5939
6125
|
"pr.create",
|
|
5940
6126
|
"pr.comment",
|
|
5941
6127
|
"pr.body.replace",
|
|
@@ -5949,24 +6135,24 @@ var ForgeOpSchema = z2.enum([
|
|
|
5949
6135
|
"label.add",
|
|
5950
6136
|
"label.remove"
|
|
5951
6137
|
]);
|
|
5952
|
-
var ForgeWriteTargetSchema =
|
|
5953
|
-
issue:
|
|
5954
|
-
pr:
|
|
6138
|
+
var ForgeWriteTargetSchema = z3.object({
|
|
6139
|
+
issue: z3.number().int().optional(),
|
|
6140
|
+
pr: z3.number().int().optional()
|
|
5955
6141
|
}).strict();
|
|
5956
6142
|
var forgeWriteShared = {
|
|
5957
6143
|
meta: HeaderMetaSchema,
|
|
5958
6144
|
subject: SubjectSchema,
|
|
5959
|
-
kind:
|
|
6145
|
+
kind: z3.literal("forge_write"),
|
|
5960
6146
|
...envelopeTail,
|
|
5961
6147
|
op: ForgeOpSchema,
|
|
5962
6148
|
target: ForgeWriteTargetSchema
|
|
5963
6149
|
};
|
|
5964
|
-
var ForgeWriteEventSchema =
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
6150
|
+
var ForgeWriteEventSchema = z3.discriminatedUnion("event", [
|
|
6151
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("validated") }).strict(),
|
|
6152
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("refused"), reason: z3.string() }).strict(),
|
|
6153
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("written"), comment_ids: z3.array(z3.string()) }).strict()
|
|
5968
6154
|
]);
|
|
5969
|
-
var GateOutcomeSchema =
|
|
6155
|
+
var GateOutcomeSchema = z3.enum([
|
|
5970
6156
|
"pass",
|
|
5971
6157
|
"fail",
|
|
5972
6158
|
"wait",
|
|
@@ -5979,61 +6165,74 @@ var GateOutcomeSchema = z2.enum([
|
|
|
5979
6165
|
var gateShared = {
|
|
5980
6166
|
meta: HeaderMetaSchema,
|
|
5981
6167
|
subject: SubjectSchema,
|
|
5982
|
-
kind:
|
|
6168
|
+
kind: z3.literal("gate"),
|
|
5983
6169
|
...envelopeTail,
|
|
5984
|
-
check:
|
|
5985
|
-
check_version:
|
|
5986
|
-
policy_version:
|
|
5987
|
-
input_fingerprint:
|
|
6170
|
+
check: z3.string(),
|
|
6171
|
+
check_version: z3.string().nullable(),
|
|
6172
|
+
policy_version: z3.string().nullable(),
|
|
6173
|
+
input_fingerprint: z3.string().nullable()
|
|
5988
6174
|
};
|
|
5989
|
-
var GateEventSchema =
|
|
5990
|
-
|
|
6175
|
+
var GateEventSchema = z3.discriminatedUnion("event", [
|
|
6176
|
+
z3.object({
|
|
5991
6177
|
...gateShared,
|
|
5992
|
-
event:
|
|
6178
|
+
event: z3.literal("checked"),
|
|
5993
6179
|
outcome: GateOutcomeSchema,
|
|
5994
|
-
reason:
|
|
6180
|
+
reason: z3.string().optional()
|
|
6181
|
+
}).strict(),
|
|
6182
|
+
z3.object({
|
|
6183
|
+
meta: HeaderMetaSchema,
|
|
6184
|
+
subject: SubjectSchema,
|
|
6185
|
+
kind: z3.literal("gate"),
|
|
6186
|
+
...envelopeTail,
|
|
6187
|
+
event: z3.literal("summary"),
|
|
6188
|
+
ran: z3.number().int().nonnegative(),
|
|
6189
|
+
passed: z3.number().int().nonnegative(),
|
|
6190
|
+
failed: z3.number().int().nonnegative(),
|
|
6191
|
+
skipped: z3.number().int().nonnegative(),
|
|
6192
|
+
failed_checks: z3.array(z3.string())
|
|
5995
6193
|
}).strict()
|
|
5996
6194
|
]);
|
|
5997
|
-
var OperationResultSchema =
|
|
6195
|
+
var OperationResultSchema = z3.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
|
|
5998
6196
|
var operationShared = {
|
|
5999
6197
|
meta: HeaderMetaSchema,
|
|
6000
6198
|
subject: SubjectSchema,
|
|
6001
|
-
kind:
|
|
6199
|
+
kind: z3.literal("operation"),
|
|
6002
6200
|
...envelopeTail,
|
|
6003
|
-
operation:
|
|
6004
|
-
target:
|
|
6201
|
+
operation: z3.string(),
|
|
6202
|
+
target: z3.string().nullable()
|
|
6005
6203
|
};
|
|
6006
|
-
var OperationEventSchema =
|
|
6007
|
-
|
|
6204
|
+
var OperationEventSchema = z3.discriminatedUnion("event", [
|
|
6205
|
+
z3.object({
|
|
6008
6206
|
...operationShared,
|
|
6009
|
-
event:
|
|
6207
|
+
event: z3.literal("completed"),
|
|
6010
6208
|
result: OperationResultSchema,
|
|
6011
|
-
error_class:
|
|
6209
|
+
error_class: z3.string().nullable(),
|
|
6210
|
+
field_names: z3.array(z3.string().max(CUSTOM_FIELD_NAME_MAX_LENGTH)).max(CUSTOM_EVENT_MAX_FIELDS).optional()
|
|
6012
6211
|
}).strict()
|
|
6013
6212
|
]);
|
|
6014
|
-
var UsageUnitsSchema =
|
|
6015
|
-
input:
|
|
6016
|
-
output:
|
|
6017
|
-
cache:
|
|
6213
|
+
var UsageUnitsSchema = z3.object({
|
|
6214
|
+
input: z3.number().nonnegative().nullable(),
|
|
6215
|
+
output: z3.number().nonnegative().nullable(),
|
|
6216
|
+
cache: z3.number().nonnegative().nullable()
|
|
6018
6217
|
}).strict();
|
|
6019
6218
|
var usageShared = {
|
|
6020
6219
|
meta: HeaderMetaSchema,
|
|
6021
6220
|
subject: SubjectSchema,
|
|
6022
|
-
kind:
|
|
6221
|
+
kind: z3.literal("usage"),
|
|
6023
6222
|
...envelopeTail,
|
|
6024
|
-
model:
|
|
6025
|
-
source:
|
|
6026
|
-
semantics:
|
|
6223
|
+
model: z3.string().nullable(),
|
|
6224
|
+
source: z3.string(),
|
|
6225
|
+
semantics: z3.enum(["cumulative", "delta"])
|
|
6027
6226
|
};
|
|
6028
|
-
var UsageEventSchema =
|
|
6029
|
-
|
|
6227
|
+
var UsageEventSchema = z3.discriminatedUnion("event", [
|
|
6228
|
+
z3.object({
|
|
6030
6229
|
...usageShared,
|
|
6031
|
-
event:
|
|
6230
|
+
event: z3.literal("observed"),
|
|
6032
6231
|
units: UsageUnitsSchema,
|
|
6033
|
-
unknown_reason:
|
|
6232
|
+
unknown_reason: z3.string().nullable()
|
|
6034
6233
|
}).strict()
|
|
6035
6234
|
]);
|
|
6036
|
-
var RoleAttemptOutcomeSchema =
|
|
6235
|
+
var RoleAttemptOutcomeSchema = z3.enum([
|
|
6037
6236
|
"completed",
|
|
6038
6237
|
"incomplete",
|
|
6039
6238
|
"infrastructure_failed",
|
|
@@ -6044,17 +6243,17 @@ var RoleAttemptOutcomeSchema = z2.enum([
|
|
|
6044
6243
|
var roleAttemptShared = {
|
|
6045
6244
|
meta: HeaderMetaSchema,
|
|
6046
6245
|
subject: SubjectSchema,
|
|
6047
|
-
kind:
|
|
6246
|
+
kind: z3.literal("role_attempt"),
|
|
6048
6247
|
...envelopeTail,
|
|
6049
|
-
actor:
|
|
6050
|
-
attempt:
|
|
6051
|
-
effect_id:
|
|
6052
|
-
model:
|
|
6248
|
+
actor: z3.string().nullable(),
|
|
6249
|
+
attempt: z3.number().int().nullable(),
|
|
6250
|
+
effect_id: z3.string(),
|
|
6251
|
+
model: z3.string().nullable()
|
|
6053
6252
|
};
|
|
6054
|
-
var RoleAttemptEventSchema =
|
|
6055
|
-
|
|
6253
|
+
var RoleAttemptEventSchema = z3.discriminatedUnion("event", [
|
|
6254
|
+
z3.object({
|
|
6056
6255
|
...roleAttemptShared,
|
|
6057
|
-
event:
|
|
6256
|
+
event: z3.literal("attempted"),
|
|
6058
6257
|
outcome: RoleAttemptOutcomeSchema,
|
|
6059
6258
|
usage: dispatchUsageField
|
|
6060
6259
|
}).strict()
|
|
@@ -6062,42 +6261,59 @@ var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
|
|
|
6062
6261
|
var handoffShared = {
|
|
6063
6262
|
meta: HeaderMetaSchema,
|
|
6064
6263
|
subject: SubjectSchema,
|
|
6065
|
-
kind:
|
|
6264
|
+
kind: z3.literal("handoff"),
|
|
6066
6265
|
...envelopeTail,
|
|
6067
|
-
class:
|
|
6068
|
-
reason:
|
|
6266
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
6267
|
+
reason: z3.string()
|
|
6069
6268
|
};
|
|
6070
|
-
var HandoffEventSchema =
|
|
6071
|
-
|
|
6269
|
+
var HandoffEventSchema = z3.discriminatedUnion("event", [
|
|
6270
|
+
z3.object({
|
|
6072
6271
|
...handoffShared,
|
|
6073
|
-
event:
|
|
6074
|
-
requested_decision:
|
|
6272
|
+
event: z3.literal("raised"),
|
|
6273
|
+
requested_decision: z3.string().nullable()
|
|
6075
6274
|
}).strict(),
|
|
6076
|
-
|
|
6275
|
+
z3.object({
|
|
6077
6276
|
...handoffShared,
|
|
6078
|
-
event:
|
|
6079
|
-
resolution:
|
|
6080
|
-
resolved_by:
|
|
6277
|
+
event: z3.literal("resolved"),
|
|
6278
|
+
resolution: z3.string().nullable(),
|
|
6279
|
+
resolved_by: z3.string().nullable()
|
|
6081
6280
|
}).strict()
|
|
6082
6281
|
]);
|
|
6083
|
-
var EffectTargetSchema =
|
|
6084
|
-
kind:
|
|
6085
|
-
ref:
|
|
6282
|
+
var EffectTargetSchema = z3.object({
|
|
6283
|
+
kind: z3.string(),
|
|
6284
|
+
ref: z3.string()
|
|
6086
6285
|
}).strict();
|
|
6087
6286
|
var effectShared = {
|
|
6088
6287
|
meta: HeaderMetaSchema,
|
|
6089
6288
|
subject: SubjectSchema,
|
|
6090
|
-
kind:
|
|
6289
|
+
kind: z3.literal("effect"),
|
|
6091
6290
|
...envelopeTail,
|
|
6092
|
-
effect_id:
|
|
6291
|
+
effect_id: z3.string(),
|
|
6093
6292
|
target: EffectTargetSchema
|
|
6094
6293
|
};
|
|
6095
|
-
var EffectEventSchema =
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6294
|
+
var EffectEventSchema = z3.discriminatedUnion("event", [
|
|
6295
|
+
z3.object({ ...effectShared, event: z3.literal("attempted") }).strict(),
|
|
6296
|
+
z3.object({ ...effectShared, event: z3.literal("observed"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict(),
|
|
6297
|
+
z3.object({ ...effectShared, event: z3.literal("verified"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict()
|
|
6298
|
+
]);
|
|
6299
|
+
var CustomFieldValueSchema = z3.union([z3.string().max(CUSTOM_TEXT_MAX_LENGTH), z3.number().finite(), z3.boolean()]);
|
|
6300
|
+
var customShared = {
|
|
6301
|
+
meta: HeaderMetaV3Schema,
|
|
6302
|
+
subject: SubjectSchema,
|
|
6303
|
+
kind: z3.literal("custom"),
|
|
6304
|
+
...envelopeTail
|
|
6305
|
+
};
|
|
6306
|
+
var CustomEventSchema = z3.discriminatedUnion("event", [
|
|
6307
|
+
z3.object({
|
|
6308
|
+
...customShared,
|
|
6309
|
+
event: z3.literal("recorded"),
|
|
6310
|
+
name: z3.string().max(CUSTOM_EVENT_NAME_MAX_LENGTH).regex(CUSTOM_EVENT_NAME_PATTERN),
|
|
6311
|
+
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, {
|
|
6312
|
+
message: `custom: at most ${CUSTOM_EVENT_MAX_FIELDS} fields`
|
|
6313
|
+
})
|
|
6314
|
+
}).strict()
|
|
6099
6315
|
]);
|
|
6100
|
-
var LogEventSchema =
|
|
6316
|
+
var LogEventSchema = z3.union([
|
|
6101
6317
|
DispatchEventSchema,
|
|
6102
6318
|
DevReviewLoopEventSchema,
|
|
6103
6319
|
ForgeWriteEventSchema,
|
|
@@ -6106,10 +6322,11 @@ var LogEventSchema = z2.union([
|
|
|
6106
6322
|
UsageEventSchema,
|
|
6107
6323
|
RoleAttemptEventSchema,
|
|
6108
6324
|
HandoffEventSchema,
|
|
6109
|
-
EffectEventSchema
|
|
6325
|
+
EffectEventSchema,
|
|
6326
|
+
CustomEventSchema
|
|
6110
6327
|
]);
|
|
6111
|
-
|
|
6112
6328
|
// ../../packages/aeg-core/src/log/envelope.ts
|
|
6329
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
6113
6330
|
function isRole(value) {
|
|
6114
6331
|
return value !== undefined && ROLE_VALUES.includes(value);
|
|
6115
6332
|
}
|
|
@@ -6146,18 +6363,27 @@ function roundFromEnv(round) {
|
|
|
6146
6363
|
const n = Number(round);
|
|
6147
6364
|
return Number.isInteger(n) ? n : undefined;
|
|
6148
6365
|
}
|
|
6366
|
+
function prFromEnv(pr) {
|
|
6367
|
+
if (pr === undefined || pr === "")
|
|
6368
|
+
return;
|
|
6369
|
+
const n = Number(pr);
|
|
6370
|
+
return Number.isInteger(n) && n > 0 ? n : undefined;
|
|
6371
|
+
}
|
|
6149
6372
|
function buildHeader(input) {
|
|
6150
6373
|
const role = isRole(input.env.role) ? input.env.role : "unattributed";
|
|
6151
6374
|
const round = roundFromEnv(input.env.round);
|
|
6375
|
+
const pr = prFromEnv(input.env.pr);
|
|
6152
6376
|
const subject = {
|
|
6153
6377
|
issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
|
|
6154
6378
|
role,
|
|
6155
6379
|
...round !== undefined ? { round } : {},
|
|
6380
|
+
...pr !== undefined ? { pr } : {},
|
|
6156
6381
|
...input.subject ?? {}
|
|
6157
6382
|
};
|
|
6383
|
+
const issue = subject.issue;
|
|
6158
6384
|
return {
|
|
6159
6385
|
meta: {
|
|
6160
|
-
schema:
|
|
6386
|
+
schema: 3,
|
|
6161
6387
|
ts: input.now.toISOString(),
|
|
6162
6388
|
run_id: input.runId,
|
|
6163
6389
|
seq: input.seq,
|
|
@@ -6180,7 +6406,19 @@ function buildHeader(input) {
|
|
|
6180
6406
|
ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
|
|
6181
6407
|
policy_digest: input.inputVersions?.policyDigest ?? null
|
|
6182
6408
|
},
|
|
6183
|
-
provenance: provenanceFor(input)
|
|
6409
|
+
provenance: provenanceFor(input),
|
|
6410
|
+
work: {
|
|
6411
|
+
ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
|
|
6412
|
+
repo: input.repo,
|
|
6413
|
+
change: null,
|
|
6414
|
+
revision: null
|
|
6415
|
+
},
|
|
6416
|
+
flow: {
|
|
6417
|
+
id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
|
|
6418
|
+
version: lineageFieldFromEnv(input.env.flowVersion)
|
|
6419
|
+
},
|
|
6420
|
+
runtime: lineageFieldFromEnv(input.env.runtime),
|
|
6421
|
+
source: lineageFieldFromEnv(input.env.source)
|
|
6184
6422
|
},
|
|
6185
6423
|
subject
|
|
6186
6424
|
};
|
|
@@ -6223,7 +6461,7 @@ function redact(value, home) {
|
|
|
6223
6461
|
return value;
|
|
6224
6462
|
}
|
|
6225
6463
|
// ../../packages/aeg-core/src/log/store.ts
|
|
6226
|
-
var KNOWN_SCHEMA_VERSIONS = [1, 2];
|
|
6464
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
|
|
6227
6465
|
function metaOf(obj) {
|
|
6228
6466
|
if (obj === null || typeof obj !== "object")
|
|
6229
6467
|
return null;
|
|
@@ -6289,7 +6527,7 @@ function classifyStoredLine(raw, home) {
|
|
|
6289
6527
|
return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
|
|
6290
6528
|
}
|
|
6291
6529
|
const redacted = redact(event, home);
|
|
6292
|
-
const provenance = version
|
|
6530
|
+
const provenance = version >= 2 ? event.meta.provenance ?? null : null;
|
|
6293
6531
|
return {
|
|
6294
6532
|
status: "ok",
|
|
6295
6533
|
identity,
|
|
@@ -6302,145 +6540,150 @@ function classifyStoredLine(raw, home) {
|
|
|
6302
6540
|
};
|
|
6303
6541
|
}
|
|
6304
6542
|
// ../../packages/aeg-core/src/control-store/records.ts
|
|
6305
|
-
import { z as
|
|
6306
|
-
var isoTimestamp =
|
|
6307
|
-
var taskId =
|
|
6308
|
-
var epochNumber =
|
|
6309
|
-
var RunRecordSchema =
|
|
6310
|
-
version:
|
|
6311
|
-
kind:
|
|
6543
|
+
import { z as z4 } from "zod";
|
|
6544
|
+
var isoTimestamp = z4.string().min(1);
|
|
6545
|
+
var taskId = z4.number().int().positive();
|
|
6546
|
+
var epochNumber = z4.number().int().nonnegative();
|
|
6547
|
+
var RunRecordSchema = z4.object({
|
|
6548
|
+
version: z4.literal(1),
|
|
6549
|
+
kind: z4.literal("run"),
|
|
6312
6550
|
task: taskId,
|
|
6313
|
-
runId:
|
|
6314
|
-
pid:
|
|
6315
|
-
host:
|
|
6551
|
+
runId: z4.string().min(1),
|
|
6552
|
+
pid: z4.number().int().positive(),
|
|
6553
|
+
host: z4.string().min(1),
|
|
6316
6554
|
startedAt: isoTimestamp,
|
|
6317
|
-
childStartedAt:
|
|
6318
|
-
childCommand:
|
|
6555
|
+
childStartedAt: z4.string().min(1).nullable().optional(),
|
|
6556
|
+
childCommand: z4.string().min(1).nullable().optional()
|
|
6319
6557
|
}).strict();
|
|
6320
|
-
var InputRecordSchema =
|
|
6321
|
-
version:
|
|
6322
|
-
kind:
|
|
6558
|
+
var InputRecordSchema = z4.object({
|
|
6559
|
+
version: z4.literal(1),
|
|
6560
|
+
kind: z4.literal("input"),
|
|
6323
6561
|
task: taskId,
|
|
6324
|
-
runId:
|
|
6325
|
-
source:
|
|
6326
|
-
pr:
|
|
6327
|
-
round:
|
|
6562
|
+
runId: z4.string().min(1),
|
|
6563
|
+
source: z4.union([z4.literal("fresh"), z4.literal("resume")]),
|
|
6564
|
+
pr: z4.number().int().positive().nullable(),
|
|
6565
|
+
round: z4.number().int().nonnegative(),
|
|
6328
6566
|
recordedAt: isoTimestamp
|
|
6329
6567
|
}).strict();
|
|
6330
|
-
var OwnershipRecordSchema =
|
|
6331
|
-
version:
|
|
6332
|
-
kind:
|
|
6568
|
+
var OwnershipRecordSchema = z4.object({
|
|
6569
|
+
version: z4.literal(1),
|
|
6570
|
+
kind: z4.literal("ownership"),
|
|
6333
6571
|
task: taskId,
|
|
6334
6572
|
epoch: epochNumber,
|
|
6335
|
-
ownerId:
|
|
6336
|
-
pid:
|
|
6337
|
-
host:
|
|
6573
|
+
ownerId: z4.string().min(1),
|
|
6574
|
+
pid: z4.number().int().positive(),
|
|
6575
|
+
host: z4.string().min(1),
|
|
6338
6576
|
acquiredAt: isoTimestamp
|
|
6339
6577
|
}).strict();
|
|
6340
|
-
var TransitionRecordSchema =
|
|
6341
|
-
version:
|
|
6342
|
-
kind:
|
|
6578
|
+
var TransitionRecordSchema = z4.object({
|
|
6579
|
+
version: z4.literal(1),
|
|
6580
|
+
kind: z4.literal("transition"),
|
|
6343
6581
|
task: taskId,
|
|
6344
6582
|
epoch: epochNumber,
|
|
6345
|
-
seq:
|
|
6346
|
-
from:
|
|
6347
|
-
to:
|
|
6348
|
-
detail:
|
|
6583
|
+
seq: z4.number().int().nonnegative(),
|
|
6584
|
+
from: z4.string().min(1),
|
|
6585
|
+
to: z4.string().min(1),
|
|
6586
|
+
detail: z4.string().optional(),
|
|
6349
6587
|
at: isoTimestamp
|
|
6350
6588
|
}).strict();
|
|
6351
|
-
var ManifestRecordSchema =
|
|
6352
|
-
version:
|
|
6353
|
-
kind:
|
|
6589
|
+
var ManifestRecordSchema = z4.object({
|
|
6590
|
+
version: z4.literal(1),
|
|
6591
|
+
kind: z4.literal("manifest"),
|
|
6354
6592
|
task: taskId,
|
|
6355
6593
|
round: epochNumber,
|
|
6356
|
-
repository:
|
|
6357
|
-
pr:
|
|
6358
|
-
branch:
|
|
6359
|
-
baseSha:
|
|
6360
|
-
headSha:
|
|
6361
|
-
briefHash:
|
|
6362
|
-
objectivesVersion:
|
|
6594
|
+
repository: z4.string().min(1),
|
|
6595
|
+
pr: z4.number().int().positive(),
|
|
6596
|
+
branch: z4.string().min(1),
|
|
6597
|
+
baseSha: z4.string().min(1).nullable(),
|
|
6598
|
+
headSha: z4.string().min(1),
|
|
6599
|
+
briefHash: z4.string().min(1).nullable(),
|
|
6600
|
+
objectivesVersion: z4.string().min(1).nullable(),
|
|
6363
6601
|
rulingOrdinal: epochNumber,
|
|
6364
|
-
policyDigest:
|
|
6602
|
+
policyDigest: z4.string().min(1),
|
|
6365
6603
|
recordedAt: isoTimestamp
|
|
6366
6604
|
}).strict();
|
|
6367
|
-
var roundHeadIdentity =
|
|
6368
|
-
var LoopBudgetsSchema =
|
|
6369
|
-
mechanicalRetries:
|
|
6370
|
-
reviewRounds:
|
|
6371
|
-
infrastructureRetries:
|
|
6605
|
+
var roundHeadIdentity = z4.object({ round: z4.number().int().positive(), head: z4.string().min(1) }).strict();
|
|
6606
|
+
var LoopBudgetsSchema = z4.object({
|
|
6607
|
+
mechanicalRetries: z4.number().int().nonnegative(),
|
|
6608
|
+
reviewRounds: z4.number().int().nonnegative(),
|
|
6609
|
+
infrastructureRetries: z4.number().int().nonnegative()
|
|
6372
6610
|
}).strict();
|
|
6373
|
-
var LoopStateRecordSchema =
|
|
6374
|
-
version:
|
|
6375
|
-
kind:
|
|
6611
|
+
var LoopStateRecordSchema = z4.object({
|
|
6612
|
+
version: z4.literal(1),
|
|
6613
|
+
kind: z4.literal("loop_state"),
|
|
6376
6614
|
task: taskId,
|
|
6377
|
-
round:
|
|
6378
|
-
phase:
|
|
6379
|
-
pauseReason:
|
|
6615
|
+
round: z4.number().int().positive(),
|
|
6616
|
+
phase: z4.string().min(1),
|
|
6617
|
+
pauseReason: z4.string().min(1).nullable(),
|
|
6380
6618
|
budgets: LoopBudgetsSchema,
|
|
6381
6619
|
heldResult: roundHeadIdentity.nullable(),
|
|
6382
6620
|
deliveredFindings: roundHeadIdentity.nullable(),
|
|
6383
|
-
repeatMemory:
|
|
6384
|
-
blockingFindings:
|
|
6385
|
-
lastFailure:
|
|
6621
|
+
repeatMemory: z4.object({
|
|
6622
|
+
blockingFindings: z4.array(z4.string()),
|
|
6623
|
+
lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
|
|
6386
6624
|
}).strict().optional(),
|
|
6625
|
+
publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
|
|
6626
|
+
taskStartedAt: isoTimestamp.optional(),
|
|
6627
|
+
phaseMs: z4.record(z4.string(), z4.number().nonnegative()).optional(),
|
|
6387
6628
|
recordedAt: isoTimestamp
|
|
6388
6629
|
}).strict();
|
|
6389
|
-
var EffectRecordSchema =
|
|
6390
|
-
version:
|
|
6391
|
-
kind:
|
|
6630
|
+
var EffectRecordSchema = z4.object({
|
|
6631
|
+
version: z4.literal(1),
|
|
6632
|
+
kind: z4.literal("effect"),
|
|
6392
6633
|
task: taskId,
|
|
6393
|
-
key:
|
|
6394
|
-
operation:
|
|
6395
|
-
target:
|
|
6396
|
-
inputVersion:
|
|
6397
|
-
payloadDigest:
|
|
6398
|
-
status:
|
|
6399
|
-
url:
|
|
6634
|
+
key: z4.string().min(1),
|
|
6635
|
+
operation: z4.string().min(1),
|
|
6636
|
+
target: z4.string().min(1),
|
|
6637
|
+
inputVersion: z4.number().int().nonnegative(),
|
|
6638
|
+
payloadDigest: z4.string().min(1),
|
|
6639
|
+
status: z4.union([z4.literal("started"), z4.literal("verified"), z4.literal("uncertain")]),
|
|
6640
|
+
url: z4.string().optional(),
|
|
6400
6641
|
recordedAt: isoTimestamp
|
|
6401
6642
|
}).strict();
|
|
6402
|
-
var EscalationRecordSchema =
|
|
6403
|
-
version:
|
|
6404
|
-
kind:
|
|
6643
|
+
var EscalationRecordSchema = z4.object({
|
|
6644
|
+
version: z4.literal(1),
|
|
6645
|
+
kind: z4.literal("escalation"),
|
|
6405
6646
|
task: taskId,
|
|
6406
|
-
escalationId:
|
|
6647
|
+
escalationId: z4.string().min(1),
|
|
6407
6648
|
round: epochNumber,
|
|
6408
|
-
head:
|
|
6409
|
-
branch:
|
|
6410
|
-
pr:
|
|
6411
|
-
runId:
|
|
6412
|
-
pid:
|
|
6413
|
-
host:
|
|
6414
|
-
agent:
|
|
6415
|
-
reason:
|
|
6416
|
-
detail:
|
|
6417
|
-
evidence:
|
|
6418
|
-
attemptedRecovery:
|
|
6419
|
-
requestedDecision:
|
|
6420
|
-
recipient:
|
|
6421
|
-
briefHash:
|
|
6422
|
-
objectivesVersion:
|
|
6649
|
+
head: z4.string().min(1),
|
|
6650
|
+
branch: z4.string().min(1),
|
|
6651
|
+
pr: z4.number().int().positive().nullable(),
|
|
6652
|
+
runId: z4.string().min(1),
|
|
6653
|
+
pid: z4.number().int().positive(),
|
|
6654
|
+
host: z4.string().min(1),
|
|
6655
|
+
agent: z4.string().min(1).optional(),
|
|
6656
|
+
reason: z4.string().min(1),
|
|
6657
|
+
detail: z4.string().optional(),
|
|
6658
|
+
evidence: z4.string().optional(),
|
|
6659
|
+
attemptedRecovery: z4.string().min(1),
|
|
6660
|
+
requestedDecision: z4.string().min(1),
|
|
6661
|
+
recipient: z4.string().min(1),
|
|
6662
|
+
briefHash: z4.string().min(1).nullable(),
|
|
6663
|
+
objectivesVersion: z4.string().min(1).nullable(),
|
|
6423
6664
|
rulingOrdinal: epochNumber,
|
|
6424
|
-
policyDigest:
|
|
6665
|
+
policyDigest: z4.string().min(1),
|
|
6425
6666
|
recordedAt: isoTimestamp
|
|
6426
6667
|
}).strict();
|
|
6427
|
-
var ResolutionRecordSchema =
|
|
6428
|
-
version:
|
|
6429
|
-
kind:
|
|
6668
|
+
var ResolutionRecordSchema = z4.object({
|
|
6669
|
+
version: z4.literal(1),
|
|
6670
|
+
kind: z4.literal("resolution"),
|
|
6430
6671
|
task: taskId,
|
|
6431
|
-
escalationId:
|
|
6432
|
-
decision:
|
|
6433
|
-
authenticatedBy:
|
|
6434
|
-
authenticatedFrom:
|
|
6672
|
+
escalationId: z4.string().min(1),
|
|
6673
|
+
decision: z4.union([z4.literal("resume"), z4.literal("cancel")]),
|
|
6674
|
+
authenticatedBy: z4.string().min(1),
|
|
6675
|
+
authenticatedFrom: z4.string().min(1),
|
|
6435
6676
|
consumedAt: isoTimestamp
|
|
6436
6677
|
}).strict();
|
|
6678
|
+
// ../../packages/aeg-core/src/control-store/local.ts
|
|
6679
|
+
var CONTROL_AREA_DIRNAME = "control";
|
|
6437
6680
|
// src/lib/pr-report-engine.ts
|
|
6438
6681
|
import { execFile as execFile6 } from "node:child_process";
|
|
6439
6682
|
import { promisify as promisify6 } from "node:util";
|
|
6440
6683
|
|
|
6441
6684
|
// src/checks/registry.ts
|
|
6442
|
-
import {
|
|
6443
|
-
import {
|
|
6685
|
+
import { join as join2, relative, sep } from "node:path";
|
|
6686
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
6444
6687
|
|
|
6445
6688
|
// src/lib/package-root.ts
|
|
6446
6689
|
import { existsSync } from "node:fs";
|
|
@@ -6460,10 +6703,14 @@ function packageRoot(moduleUrl) {
|
|
|
6460
6703
|
}
|
|
6461
6704
|
|
|
6462
6705
|
// src/checks/registry.ts
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6706
|
+
function resolveCheckBin(packageDir, moduleUrl) {
|
|
6707
|
+
const fromPackage = relative(packageDir, fileURLToPath2(moduleUrl));
|
|
6708
|
+
const bundled = fromPackage === "dist" || fromPackage.startsWith(`dist${sep}`);
|
|
6709
|
+
return bundled ? { dir: join2(packageDir, "dist", "checks", "bin"), ext: ".js" } : { dir: join2(packageDir, "src", "checks", "bin"), ext: ".ts" };
|
|
6710
|
+
}
|
|
6711
|
+
var CHECK_BIN = resolveCheckBin(packageRoot(import.meta.url), import.meta.url);
|
|
6712
|
+
var BIN_DIR = CHECK_BIN.dir;
|
|
6713
|
+
var BIN_EXT = CHECK_BIN.ext;
|
|
6467
6714
|
function bin(name) {
|
|
6468
6715
|
return join2(BIN_DIR, `${name}${BIN_EXT}`);
|
|
6469
6716
|
}
|
|
@@ -6507,6 +6754,8 @@ var REGISTRY = [
|
|
|
6507
6754
|
timeoutMs: 15000,
|
|
6508
6755
|
env: {
|
|
6509
6756
|
BASE_SHA: { optional: true },
|
|
6757
|
+
GIT_INDEX_FILE: { optional: true },
|
|
6758
|
+
VINAYA_COMMIT_HOOK: { optional: true },
|
|
6510
6759
|
PR_BODY: { optional: true },
|
|
6511
6760
|
PR_BODY_FILE: { optional: true },
|
|
6512
6761
|
PR_NUMBER: { optional: true },
|
|
@@ -6661,23 +6910,6 @@ var REGISTRY = [
|
|
|
6661
6910
|
},
|
|
6662
6911
|
1
|
|
6663
6912
|
],
|
|
6664
|
-
[
|
|
6665
|
-
{
|
|
6666
|
-
name: "token-report",
|
|
6667
|
-
validates: "body",
|
|
6668
|
-
run: bin("check-token-report"),
|
|
6669
|
-
scope: "diff",
|
|
6670
|
-
timeoutMs: 15000,
|
|
6671
|
-
requiresOpenPr: true,
|
|
6672
|
-
env: {
|
|
6673
|
-
PR_BODY: { optional: true },
|
|
6674
|
-
BRANCH: { optional: true },
|
|
6675
|
-
CLAUDE_PROJECT_DIR: { optional: true },
|
|
6676
|
-
CLAUDE_CODE_SESSION_ID: { optional: true }
|
|
6677
|
-
}
|
|
6678
|
-
},
|
|
6679
|
-
1
|
|
6680
|
-
],
|
|
6681
6913
|
[
|
|
6682
6914
|
{
|
|
6683
6915
|
name: "no-disk-state",
|
|
@@ -7027,71 +7259,52 @@ var CORE_CHECK_RING = Object.fromEntries(REGISTRY.map(([spec, ring]) => [spec.na
|
|
|
7027
7259
|
import { execFile as execFile5 } from "node:child_process";
|
|
7028
7260
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
7029
7261
|
import {
|
|
7030
|
-
|
|
7031
|
-
|
|
7262
|
+
appendFileSync,
|
|
7263
|
+
closeSync as closeSync4,
|
|
7264
|
+
constants as fsConstants4,
|
|
7032
7265
|
existsSync as existsSync5,
|
|
7033
|
-
fstatSync as
|
|
7034
|
-
mkdirSync as
|
|
7035
|
-
|
|
7036
|
-
|
|
7266
|
+
fstatSync as fstatSync3,
|
|
7267
|
+
mkdirSync as mkdirSync4,
|
|
7268
|
+
lstatSync as lstatSync2,
|
|
7269
|
+
openSync as openSync4,
|
|
7270
|
+
readFileSync as readFileSync5,
|
|
7037
7271
|
renameSync as renameSync2,
|
|
7038
|
-
|
|
7272
|
+
writeFileSync as writeFileSync3,
|
|
7273
|
+
writeSync as writeSync3
|
|
7039
7274
|
} from "node:fs";
|
|
7040
7275
|
import { hostname as osHostname, homedir as homedir3 } from "node:os";
|
|
7041
|
-
import { dirname as
|
|
7276
|
+
import { dirname as dirname6, join as join6 } from "node:path";
|
|
7042
7277
|
import { promisify as promisify5 } from "node:util";
|
|
7043
7278
|
|
|
7044
7279
|
// src/lib/config.ts
|
|
7045
|
-
import { execFile as execFile4, execFileSync as
|
|
7280
|
+
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
7046
7281
|
import { promisify as promisify4 } from "node:util";
|
|
7047
|
-
import { existsSync as
|
|
7282
|
+
import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
|
|
7048
7283
|
import { homedir } from "node:os";
|
|
7049
7284
|
import { dirname as dirname2, isAbsolute, join as join3, resolve } from "node:path";
|
|
7050
|
-
import { z as
|
|
7285
|
+
import { z as z5 } from "zod";
|
|
7051
7286
|
|
|
7052
7287
|
// src/lib/agent-vendors.ts
|
|
7053
7288
|
var AGENT_VENDORS = ["skills", "claude", "gemini"];
|
|
7054
7289
|
|
|
7055
|
-
// src/lib/worker-boundary.ts
|
|
7056
|
-
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
7057
|
-
var LOG_HEADER_KEYCHAIN_SERVICE = "Vinaya Log";
|
|
7058
|
-
var logHeaderKeychainCache = new Map;
|
|
7059
|
-
function readRealLogHeaderKeychainCredential(variable) {
|
|
7060
|
-
if (process.platform !== "darwin")
|
|
7061
|
-
return null;
|
|
7062
|
-
try {
|
|
7063
|
-
return execFileSync2("/usr/bin/security", ["find-generic-password", "-s", LOG_HEADER_KEYCHAIN_SERVICE, "-a", variable, "-w"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 5000, maxBuffer: 1024 * 1024 }).replace(/\n$/, "");
|
|
7064
|
-
} catch {
|
|
7065
|
-
return null;
|
|
7066
|
-
}
|
|
7067
|
-
}
|
|
7068
|
-
function readLogHeaderKeychainCredential(variable) {
|
|
7069
|
-
const cached = logHeaderKeychainCache.get(variable);
|
|
7070
|
-
if (cached !== undefined)
|
|
7071
|
-
return cached;
|
|
7072
|
-
const value = readRealLogHeaderKeychainCredential(variable);
|
|
7073
|
-
logHeaderKeychainCache.set(variable, value);
|
|
7074
|
-
return value;
|
|
7075
|
-
}
|
|
7076
|
-
|
|
7077
7290
|
// src/lib/config.ts
|
|
7078
|
-
var EnvEntrySchema =
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7291
|
+
var EnvEntrySchema = z5.union([
|
|
7292
|
+
z5.literal(true),
|
|
7293
|
+
z5.object({ optional: z5.literal(true) }),
|
|
7294
|
+
z5.object({ anyOf: z5.array(z5.string()).min(2) }),
|
|
7295
|
+
z5.string()
|
|
7083
7296
|
]);
|
|
7084
|
-
var CheckEntrySchema =
|
|
7085
|
-
run:
|
|
7086
|
-
scope:
|
|
7087
|
-
include:
|
|
7088
|
-
args:
|
|
7089
|
-
timeoutMs:
|
|
7090
|
-
env:
|
|
7091
|
-
requiresOpenPr:
|
|
7092
|
-
ownWorkflow:
|
|
7093
|
-
principalOwed:
|
|
7094
|
-
validates:
|
|
7297
|
+
var CheckEntrySchema = z5.object({
|
|
7298
|
+
run: z5.string(),
|
|
7299
|
+
scope: z5.enum(["diff", "full"]),
|
|
7300
|
+
include: z5.array(z5.string()).optional(),
|
|
7301
|
+
args: z5.array(z5.string()).optional(),
|
|
7302
|
+
timeoutMs: z5.number().optional(),
|
|
7303
|
+
env: z5.record(z5.string(), EnvEntrySchema).optional(),
|
|
7304
|
+
requiresOpenPr: z5.boolean().optional(),
|
|
7305
|
+
ownWorkflow: z5.boolean().optional(),
|
|
7306
|
+
principalOwed: z5.literal(true).optional(),
|
|
7307
|
+
validates: z5.enum(["body", "issue"]).optional()
|
|
7095
7308
|
}).superRefine((entry, ctx) => {
|
|
7096
7309
|
if (!entry.env)
|
|
7097
7310
|
return;
|
|
@@ -7101,22 +7314,22 @@ var CheckEntrySchema = z4.object({
|
|
|
7101
7314
|
const members = value.anyOf;
|
|
7102
7315
|
if (new Set(members).size !== members.length) {
|
|
7103
7316
|
ctx.addIssue({
|
|
7104
|
-
code:
|
|
7317
|
+
code: z5.ZodIssueCode.custom,
|
|
7105
7318
|
message: `env.${key}.anyOf has duplicate members`,
|
|
7106
7319
|
path: ["env", key, "anyOf"]
|
|
7107
7320
|
});
|
|
7108
7321
|
}
|
|
7109
7322
|
if (!members.includes(key)) {
|
|
7110
7323
|
ctx.addIssue({
|
|
7111
|
-
code:
|
|
7324
|
+
code: z5.ZodIssueCode.custom,
|
|
7112
7325
|
message: `env.${key}.anyOf must include "${key}" itself as a member`,
|
|
7113
7326
|
path: ["env", key, "anyOf"]
|
|
7114
7327
|
});
|
|
7115
7328
|
}
|
|
7116
7329
|
}
|
|
7117
7330
|
});
|
|
7118
|
-
var RoleEntrySchema =
|
|
7119
|
-
contract:
|
|
7331
|
+
var RoleEntrySchema = z5.object({
|
|
7332
|
+
contract: z5.string().refine((p) => p.includes("/"), {
|
|
7120
7333
|
message: 'must be a path (contain at least one "/"), not a bare filename'
|
|
7121
7334
|
})
|
|
7122
7335
|
});
|
|
@@ -7140,17 +7353,17 @@ var BRIEF_BUILTINS = [
|
|
|
7140
7353
|
"briefSections",
|
|
7141
7354
|
"milestoneShape"
|
|
7142
7355
|
];
|
|
7143
|
-
var BriefSectionSchema =
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7356
|
+
var BriefSectionSchema = z5.union([
|
|
7357
|
+
z5.object({ builtin: z5.enum(BRIEF_BUILTINS) }),
|
|
7358
|
+
z5.object({ heading: z5.string().min(1), name: z5.string().optional() }),
|
|
7359
|
+
z5.object({ field: z5.string().min(1), name: z5.string().optional() }),
|
|
7360
|
+
z5.object({ phrase: z5.string().min(1), name: z5.string().optional() })
|
|
7148
7361
|
]);
|
|
7149
|
-
var BriefSchemaSchema =
|
|
7150
|
-
pr:
|
|
7151
|
-
issue:
|
|
7152
|
-
milestone:
|
|
7153
|
-
ack:
|
|
7362
|
+
var BriefSchemaSchema = z5.object({
|
|
7363
|
+
pr: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
7364
|
+
issue: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
7365
|
+
milestone: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
7366
|
+
ack: z5.array(z5.enum(BRIEF_BUILTINS)).optional()
|
|
7154
7367
|
});
|
|
7155
7368
|
function isSafeRepoRelPath(p) {
|
|
7156
7369
|
if (p.length === 0)
|
|
@@ -7159,7 +7372,7 @@ function isSafeRepoRelPath(p) {
|
|
|
7159
7372
|
return false;
|
|
7160
7373
|
return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
|
|
7161
7374
|
}
|
|
7162
|
-
var SafeRepoRelPath =
|
|
7375
|
+
var SafeRepoRelPath = z5.string().refine(isSafeRepoRelPath, {
|
|
7163
7376
|
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
7164
7377
|
});
|
|
7165
7378
|
var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
@@ -7169,22 +7382,22 @@ function isCanonicalHookBlockPath(p) {
|
|
|
7169
7382
|
var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
|
|
7170
7383
|
message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
|
|
7171
7384
|
});
|
|
7172
|
-
var ManagedBlockRecordSchema =
|
|
7385
|
+
var ManagedBlockRecordSchema = z5.object({
|
|
7173
7386
|
path: ManagedHookBlockPath,
|
|
7174
|
-
marker:
|
|
7175
|
-
comment:
|
|
7387
|
+
marker: z5.string(),
|
|
7388
|
+
comment: z5.enum(["hash", "html"])
|
|
7176
7389
|
});
|
|
7177
|
-
var ManagedManifestSchema =
|
|
7178
|
-
version:
|
|
7179
|
-
files:
|
|
7180
|
-
blocks:
|
|
7181
|
-
labels:
|
|
7182
|
-
agents:
|
|
7390
|
+
var ManagedManifestSchema = z5.object({
|
|
7391
|
+
version: z5.number().int().positive(),
|
|
7392
|
+
files: z5.array(SafeRepoRelPath),
|
|
7393
|
+
blocks: z5.array(ManagedBlockRecordSchema),
|
|
7394
|
+
labels: z5.array(z5.string()),
|
|
7395
|
+
agents: z5.array(z5.enum(AGENT_VENDORS)).optional()
|
|
7183
7396
|
});
|
|
7184
|
-
var ProjectEntrySchema =
|
|
7185
|
-
name:
|
|
7186
|
-
description:
|
|
7187
|
-
path:
|
|
7397
|
+
var ProjectEntrySchema = z5.object({
|
|
7398
|
+
name: z5.string().min(1),
|
|
7399
|
+
description: z5.string().min(1).optional(),
|
|
7400
|
+
path: z5.string().min(1).optional()
|
|
7188
7401
|
});
|
|
7189
7402
|
function parseTokensCollectDeclaration(value) {
|
|
7190
7403
|
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
@@ -7195,90 +7408,97 @@ function parseTokensCollectDeclaration(value) {
|
|
|
7195
7408
|
return null;
|
|
7196
7409
|
return { interpreter, script };
|
|
7197
7410
|
}
|
|
7198
|
-
var VinayaConfigSchema =
|
|
7199
|
-
rings:
|
|
7200
|
-
ring1_forgeWriteInterception:
|
|
7201
|
-
ring2_asyncAudits:
|
|
7411
|
+
var VinayaConfigSchema = z5.object({
|
|
7412
|
+
rings: z5.object({
|
|
7413
|
+
ring1_forgeWriteInterception: z5.boolean(),
|
|
7414
|
+
ring2_asyncAudits: z5.boolean()
|
|
7202
7415
|
}).optional(),
|
|
7203
|
-
checks:
|
|
7204
|
-
roles:
|
|
7416
|
+
checks: z5.record(z5.string(), CheckEntrySchema).optional(),
|
|
7417
|
+
roles: z5.record(z5.string(), RoleEntrySchema).optional(),
|
|
7205
7418
|
briefSchema: BriefSchemaSchema.optional(),
|
|
7206
7419
|
managed: ManagedManifestSchema.optional(),
|
|
7207
|
-
principals:
|
|
7208
|
-
releaseActor:
|
|
7209
|
-
ci:
|
|
7210
|
-
tokens:
|
|
7211
|
-
collect:
|
|
7420
|
+
principals: z5.array(z5.string()).min(1).optional(),
|
|
7421
|
+
releaseActor: z5.string().min(1).optional(),
|
|
7422
|
+
ci: z5.object({ setup: z5.string().min(1) }).optional(),
|
|
7423
|
+
tokens: z5.object({
|
|
7424
|
+
collect: z5.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
7212
7425
|
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
7213
7426
|
})
|
|
7214
7427
|
}).optional(),
|
|
7215
|
-
blastRadius:
|
|
7216
|
-
proseGates:
|
|
7217
|
-
doctrineRoot:
|
|
7218
|
-
readerFacingPrefix:
|
|
7219
|
-
readerFacingSuffix:
|
|
7220
|
-
legacySlugDir:
|
|
7221
|
-
sourceComments:
|
|
7222
|
-
globs:
|
|
7223
|
-
allowlist:
|
|
7224
|
-
severity:
|
|
7428
|
+
blastRadius: z5.object({ extraDomains: z5.array(z5.string()).optional() }).optional(),
|
|
7429
|
+
proseGates: z5.object({
|
|
7430
|
+
doctrineRoot: z5.string().min(1).optional(),
|
|
7431
|
+
readerFacingPrefix: z5.string().min(1).optional(),
|
|
7432
|
+
readerFacingSuffix: z5.string().min(1).optional(),
|
|
7433
|
+
legacySlugDir: z5.string().min(1).optional(),
|
|
7434
|
+
sourceComments: z5.object({
|
|
7435
|
+
globs: z5.array(z5.string().min(1)).optional(),
|
|
7436
|
+
allowlist: z5.array(z5.string().min(1)).optional(),
|
|
7437
|
+
severity: z5.enum(["warning", "error"]).optional()
|
|
7225
7438
|
}).optional(),
|
|
7226
|
-
specGrandfather:
|
|
7227
|
-
specPaths:
|
|
7439
|
+
specGrandfather: z5.union([z5.array(z5.string().min(1)), z5.record(z5.string().min(1), z5.number().int().min(0))]).optional(),
|
|
7440
|
+
specPaths: z5.array(z5.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
|
|
7228
7441
|
message: "must be a repository-relative path, not an absolute one"
|
|
7229
7442
|
}).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
|
|
7230
7443
|
message: "must stay inside the repository — no `..` segment"
|
|
7231
7444
|
})).optional()
|
|
7232
7445
|
}).optional(),
|
|
7233
|
-
projects:
|
|
7234
|
-
dispatch:
|
|
7235
|
-
timeoutMs:
|
|
7236
|
-
killGraceMs:
|
|
7237
|
-
agent:
|
|
7238
|
-
requireWorkerIsolation: z4.boolean().optional()
|
|
7446
|
+
projects: z5.array(ProjectEntrySchema).optional(),
|
|
7447
|
+
dispatch: z5.object({
|
|
7448
|
+
timeoutMs: z5.number().int().positive().optional(),
|
|
7449
|
+
killGraceMs: z5.number().int().positive().optional(),
|
|
7450
|
+
agent: z5.enum(["claude", "codex", "gemini"]).optional()
|
|
7239
7451
|
}).optional(),
|
|
7240
|
-
reviewPolicy:
|
|
7241
|
-
codeReviewThreshold:
|
|
7242
|
-
securityThreshold:
|
|
7243
|
-
maxRounds:
|
|
7452
|
+
reviewPolicy: z5.object({
|
|
7453
|
+
codeReviewThreshold: z5.string().min(1).optional(),
|
|
7454
|
+
securityThreshold: z5.string().min(1).optional(),
|
|
7455
|
+
maxRounds: z5.number().optional(),
|
|
7456
|
+
maxTaskMinutes: z5.number().optional()
|
|
7244
7457
|
}).optional(),
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
briefSectionsSinceIssue: z4.number().int().nonnegative().optional(),
|
|
7248
|
-
documentationSinceIssue: z4.number().int().nonnegative().optional(),
|
|
7249
|
-
briefRulesSincePr: z4.number().int().nonnegative().optional(),
|
|
7250
|
-
agentBoxesRefusedSincePr: z4.number().int().nonnegative().optional()
|
|
7458
|
+
securityScan: z5.object({
|
|
7459
|
+
command: z5.array(z5.string().min(1)).min(1)
|
|
7251
7460
|
}).optional(),
|
|
7252
|
-
|
|
7253
|
-
|
|
7461
|
+
gateCutovers: z5.object({
|
|
7462
|
+
objectivesSinceIssue: z5.number().int().nonnegative().optional(),
|
|
7463
|
+
briefSectionsSinceIssue: z5.number().int().nonnegative().optional(),
|
|
7464
|
+
documentationSinceIssue: z5.number().int().nonnegative().optional(),
|
|
7465
|
+
briefRulesSincePr: z5.number().int().nonnegative().optional(),
|
|
7466
|
+
agentBoxesRefusedSincePr: z5.number().int().nonnegative().optional()
|
|
7254
7467
|
}).optional(),
|
|
7255
|
-
|
|
7256
|
-
|
|
7468
|
+
planning: z5.object({
|
|
7469
|
+
collisionThreshold: z5.number().int().nonnegative().optional()
|
|
7257
7470
|
}).optional(),
|
|
7258
|
-
|
|
7259
|
-
|
|
7471
|
+
prePush: z5.object({
|
|
7472
|
+
alwaysRun: z5.array(z5.string()).optional()
|
|
7473
|
+
}).optional(),
|
|
7474
|
+
report: z5.object({
|
|
7475
|
+
commandTimeoutMs: z5.number().int().positive().optional()
|
|
7260
7476
|
}).superRefine((report, ctx) => {
|
|
7261
7477
|
const commandTimeoutMs = report.commandTimeoutMs;
|
|
7262
7478
|
if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
|
|
7263
7479
|
ctx.addIssue({
|
|
7264
|
-
code:
|
|
7480
|
+
code: z5.ZodIssueCode.custom,
|
|
7265
7481
|
path: ["commandTimeoutMs"],
|
|
7266
7482
|
message: "must be at most 3600000 (1 hour)"
|
|
7267
7483
|
});
|
|
7268
7484
|
}
|
|
7269
7485
|
}).optional(),
|
|
7270
|
-
logPublish:
|
|
7486
|
+
logPublish: z5.unknown().refine((v) => v === undefined, {
|
|
7271
7487
|
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
7272
7488
|
}),
|
|
7273
|
-
runtimeDir:
|
|
7274
|
-
logs:
|
|
7275
|
-
folder:
|
|
7276
|
-
url:
|
|
7277
|
-
headers:
|
|
7489
|
+
runtimeDir: z5.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
7490
|
+
logs: z5.object({
|
|
7491
|
+
folder: z5.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
7492
|
+
url: z5.string().url().optional(),
|
|
7493
|
+
headers: z5.record(z5.string()).optional(),
|
|
7494
|
+
readHeaders: z5.record(z5.string()).optional(),
|
|
7495
|
+
events: CustomEventDeclarationsSchema.optional()
|
|
7278
7496
|
}).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
|
|
7279
7497
|
message: "logs: set at most one of folder/url"
|
|
7280
7498
|
}).refine((v) => v.headers === undefined || v.url !== undefined, {
|
|
7281
7499
|
message: "logs: headers requires url"
|
|
7500
|
+
}).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
|
|
7501
|
+
message: "logs: readHeaders requires url"
|
|
7282
7502
|
}).optional()
|
|
7283
7503
|
});
|
|
7284
7504
|
var GLOBAL_VINAYA_HOME = join3(homedir(), ".vinaya");
|
|
@@ -7288,9 +7508,9 @@ function findLocalConfig() {
|
|
|
7288
7508
|
let dir = process.cwd();
|
|
7289
7509
|
while (true) {
|
|
7290
7510
|
const candidate = join3(dir, LOCAL_CONFIG_FILENAME);
|
|
7291
|
-
if (
|
|
7511
|
+
if (existsSync2(candidate))
|
|
7292
7512
|
return candidate;
|
|
7293
|
-
if (
|
|
7513
|
+
if (existsSync2(join3(dir, ".git")))
|
|
7294
7514
|
return null;
|
|
7295
7515
|
const parent = dirname2(dir);
|
|
7296
7516
|
if (parent === dir)
|
|
@@ -7302,7 +7522,7 @@ function configPath() {
|
|
|
7302
7522
|
const local = findLocalConfig();
|
|
7303
7523
|
if (local)
|
|
7304
7524
|
return local;
|
|
7305
|
-
if (
|
|
7525
|
+
if (existsSync2(GLOBAL_CONFIG_PATH))
|
|
7306
7526
|
return GLOBAL_CONFIG_PATH;
|
|
7307
7527
|
return null;
|
|
7308
7528
|
}
|
|
@@ -7383,10 +7603,15 @@ function resolveReviewPolicy(config) {
|
|
|
7383
7603
|
if (!Number.isInteger(maxRounds) || maxRounds < 1) {
|
|
7384
7604
|
throw new Error(`vinaya.config.json: reviewPolicy.maxRounds "${maxRounds}" is not a positive integer — fix the config, this never falls back to a default.`);
|
|
7385
7605
|
}
|
|
7606
|
+
const maxTaskMinutes = raw.maxTaskMinutes ?? DEFAULT_REVIEW_POLICY.maxTaskMinutes;
|
|
7607
|
+
if (!Number.isInteger(maxTaskMinutes) || maxTaskMinutes < 0) {
|
|
7608
|
+
throw new Error(`vinaya.config.json: reviewPolicy.maxTaskMinutes "${maxTaskMinutes}" is not a non-negative integer (0 turns the budget off) — fix the config, this never falls back to a default.`);
|
|
7609
|
+
}
|
|
7386
7610
|
return {
|
|
7387
7611
|
codeReviewThreshold,
|
|
7388
7612
|
securityThreshold,
|
|
7389
|
-
maxRounds
|
|
7613
|
+
maxRounds,
|
|
7614
|
+
maxTaskMinutes
|
|
7390
7615
|
};
|
|
7391
7616
|
}
|
|
7392
7617
|
function resolveGateCutovers(config) {
|
|
@@ -7426,17 +7651,12 @@ function resolveTrustAnchorLogsDestination(local, trustAnchorConfig) {
|
|
|
7426
7651
|
return "url" in anchored && anchored.url === local.url ? anchored : null;
|
|
7427
7652
|
return "folder" in anchored && anchored.folder === local.folder ? anchored : null;
|
|
7428
7653
|
}
|
|
7429
|
-
function resolveLogsHeaderValues(headers, env
|
|
7654
|
+
function resolveLogsHeaderValues(headers, env) {
|
|
7430
7655
|
if (!headers)
|
|
7431
7656
|
return;
|
|
7432
7657
|
const resolved = {};
|
|
7433
7658
|
for (const [key, value] of Object.entries(headers)) {
|
|
7434
|
-
resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) =>
|
|
7435
|
-
const fromEnv = env[name];
|
|
7436
|
-
if (fromEnv !== undefined)
|
|
7437
|
-
return fromEnv;
|
|
7438
|
-
return readKeychain(name) ?? "";
|
|
7439
|
-
});
|
|
7659
|
+
resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => env[name] ?? "");
|
|
7440
7660
|
}
|
|
7441
7661
|
return resolved;
|
|
7442
7662
|
}
|
|
@@ -7445,7 +7665,7 @@ function trustAnchorRepo() {
|
|
|
7445
7665
|
if (fromRunner)
|
|
7446
7666
|
return fromRunner;
|
|
7447
7667
|
try {
|
|
7448
|
-
const url =
|
|
7668
|
+
const url = execFileSync2("git", ["remote", "get-url", "origin"], {
|
|
7449
7669
|
encoding: "utf-8",
|
|
7450
7670
|
stdio: ["ignore", "pipe", "pipe"]
|
|
7451
7671
|
});
|
|
@@ -7492,7 +7712,7 @@ function resolveCiTrustAnchorProbeRef(env = process.env) {
|
|
|
7492
7712
|
return ref;
|
|
7493
7713
|
}
|
|
7494
7714
|
function readTrustAnchorConfigAtRef(ref) {
|
|
7495
|
-
const raw =
|
|
7715
|
+
const raw = execFileSync2("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
|
|
7496
7716
|
encoding: "utf-8",
|
|
7497
7717
|
stdio: ["ignore", "pipe", "pipe"],
|
|
7498
7718
|
timeout: 1e4
|
|
@@ -7506,7 +7726,7 @@ function ghFetchTrustAnchorConfig() {
|
|
|
7506
7726
|
const repo = trustAnchorRepo();
|
|
7507
7727
|
if (!repo)
|
|
7508
7728
|
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
7509
|
-
return
|
|
7729
|
+
return execFileSync2("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], {
|
|
7510
7730
|
encoding: "utf-8",
|
|
7511
7731
|
stdio: ["ignore", "pipe", "pipe"]
|
|
7512
7732
|
});
|
|
@@ -7597,8 +7817,17 @@ function loadConfig() {
|
|
|
7597
7817
|
var TOKENS_COLLECT_TRUST_PATH = join3(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
7598
7818
|
|
|
7599
7819
|
// src/lib/run-paths.ts
|
|
7600
|
-
import {
|
|
7820
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
7821
|
+
import { chmodSync, existsSync as existsSync3, realpathSync as realpathSync2 } from "node:fs";
|
|
7601
7822
|
import { dirname as dirname3, join as join4, resolve as resolvePath } from "node:path";
|
|
7823
|
+
var TASKS_EXECUTION_DIRNAME = "tasks-execution";
|
|
7824
|
+
var RUN_AREA_DIRNAMES = {
|
|
7825
|
+
control: CONTROL_AREA_DIRNAME,
|
|
7826
|
+
sessions: "sessions",
|
|
7827
|
+
hooks: "hooks",
|
|
7828
|
+
output: "output",
|
|
7829
|
+
rounds: "rounds"
|
|
7830
|
+
};
|
|
7602
7831
|
var SAFE_PATH_SEGMENT = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
7603
7832
|
function isSafeRepoSegment(segment) {
|
|
7604
7833
|
return SAFE_PATH_SEGMENT.test(segment) && !segment.includes("..");
|
|
@@ -7629,12 +7858,52 @@ function isInsideRepo(candidate, repoRoot) {
|
|
|
7629
7858
|
const target = resolvePath(candidate);
|
|
7630
7859
|
return target === root || target.startsWith(`${root}/`);
|
|
7631
7860
|
}
|
|
7861
|
+
function runPath(runtimeDir, scope, location) {
|
|
7862
|
+
const dir = join4(runtimeDir, TASKS_EXECUTION_DIRNAME, scopeSegment(scope));
|
|
7863
|
+
switch (location.area) {
|
|
7864
|
+
case "task":
|
|
7865
|
+
return location.file ? join4(dir, location.file) : dir;
|
|
7866
|
+
case "control": {
|
|
7867
|
+
const controlDir = join4(dir, RUN_AREA_DIRNAMES.control);
|
|
7868
|
+
return location.file ? join4(controlDir, location.file) : controlDir;
|
|
7869
|
+
}
|
|
7870
|
+
case "rounds":
|
|
7871
|
+
return join4(dir, RUN_AREA_DIRNAMES.rounds);
|
|
7872
|
+
case "round": {
|
|
7873
|
+
const roundDir = join4(dir, RUN_AREA_DIRNAMES.rounds, String(location.round));
|
|
7874
|
+
return location.file ? join4(roundDir, location.file) : roundDir;
|
|
7875
|
+
}
|
|
7876
|
+
case "developer": {
|
|
7877
|
+
const developerDir = join4(dir, RUN_AREA_DIRNAMES.rounds, String(location.round), "developer");
|
|
7878
|
+
return location.file ? join4(developerDir, location.file) : developerDir;
|
|
7879
|
+
}
|
|
7880
|
+
default: {
|
|
7881
|
+
const areaDir = join4(dir, RUN_AREA_DIRNAMES[location.area]);
|
|
7882
|
+
return location.file ? join4(areaDir, location.file) : areaDir;
|
|
7883
|
+
}
|
|
7884
|
+
}
|
|
7885
|
+
}
|
|
7886
|
+
function scopeSegment(scope) {
|
|
7887
|
+
if (scope === "unscoped")
|
|
7888
|
+
return "unscoped";
|
|
7889
|
+
if (typeof scope === "number")
|
|
7890
|
+
return String(scope);
|
|
7891
|
+
return `pr-${scope.pr}`;
|
|
7892
|
+
}
|
|
7632
7893
|
var UNATTENDED_ENV_KEY = "VINAYA_UNATTENDED";
|
|
7633
7894
|
var RUNTIME_DIR_ENV_KEY = "VINAYA_RUNTIME_DIR";
|
|
7634
7895
|
function isUnattendedProcess(env = process.env) {
|
|
7635
7896
|
return env[UNATTENDED_ENV_KEY] === "1" || (env.VINAYA_ROLE ?? "") !== "";
|
|
7636
7897
|
}
|
|
7637
7898
|
var memoized = null;
|
|
7899
|
+
function runtimeDirForRepo(repo) {
|
|
7900
|
+
const key = repoSegment(repo);
|
|
7901
|
+
if (memoized?.key === key)
|
|
7902
|
+
return memoized.value;
|
|
7903
|
+
const value = resolveRuntimeDirUncached(repo);
|
|
7904
|
+
memoized = { key, value };
|
|
7905
|
+
return value;
|
|
7906
|
+
}
|
|
7638
7907
|
async function runtimeDirForRepoAsync(repo) {
|
|
7639
7908
|
const key = repoSegment(repo);
|
|
7640
7909
|
if (memoized?.key === key)
|
|
@@ -7650,6 +7919,16 @@ async function runtimeDirForRepoAsync(repo) {
|
|
|
7650
7919
|
memoized = { key, value };
|
|
7651
7920
|
return value;
|
|
7652
7921
|
}
|
|
7922
|
+
function resolveRuntimeDirUncached(repo) {
|
|
7923
|
+
const inputs = runtimeDirInputs();
|
|
7924
|
+
if (typeof inputs === "string")
|
|
7925
|
+
return inputs;
|
|
7926
|
+
return resolveRuntimeDir({
|
|
7927
|
+
repo,
|
|
7928
|
+
...inputs.base,
|
|
7929
|
+
trustAnchorConfig: inputs.needsAnchor ? loadTrustAnchorConfig() : null
|
|
7930
|
+
});
|
|
7931
|
+
}
|
|
7653
7932
|
function runtimeDirInputs() {
|
|
7654
7933
|
const handedDown = process.env[RUNTIME_DIR_ENV_KEY];
|
|
7655
7934
|
if (handedDown)
|
|
@@ -7669,7 +7948,7 @@ function repoRootSync(start = process.cwd()) {
|
|
|
7669
7948
|
return null;
|
|
7670
7949
|
}
|
|
7671
7950
|
for (;; ) {
|
|
7672
|
-
if (
|
|
7951
|
+
if (existsSync3(join4(dir, ".git")))
|
|
7673
7952
|
return dir;
|
|
7674
7953
|
const parent = dirname3(dir);
|
|
7675
7954
|
if (parent === dir)
|
|
@@ -7677,26 +7956,94 @@ function repoRootSync(start = process.cwd()) {
|
|
|
7677
7956
|
dir = parent;
|
|
7678
7957
|
}
|
|
7679
7958
|
}
|
|
7959
|
+
function resolveRepoSync() {
|
|
7960
|
+
const fromEnv = process.env.AEG_REPO;
|
|
7961
|
+
if (fromEnv) {
|
|
7962
|
+
const m = /^([^/]+)\/(.+)$/.exec(fromEnv);
|
|
7963
|
+
if (m?.[1] && m[2])
|
|
7964
|
+
return { owner: m[1], repo: m[2] };
|
|
7965
|
+
}
|
|
7966
|
+
let url;
|
|
7967
|
+
try {
|
|
7968
|
+
url = execFileSync3("git", ["remote", "get-url", "origin"], {
|
|
7969
|
+
encoding: "utf-8",
|
|
7970
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
7971
|
+
}).trim();
|
|
7972
|
+
} catch {
|
|
7973
|
+
return null;
|
|
7974
|
+
}
|
|
7975
|
+
const ssh = /^git@github\.com:([^/]+)\/(.+?)(?:\.git)?$/.exec(url);
|
|
7976
|
+
if (ssh?.[1] && ssh[2])
|
|
7977
|
+
return { owner: ssh[1], repo: ssh[2] };
|
|
7978
|
+
const https = /^https?:\/\/(?:[^@]+@)?github\.com\/([^/]+)\/(.+?)(?:\.git)?\/?$/.exec(url);
|
|
7979
|
+
if (https?.[1] && https[2])
|
|
7980
|
+
return { owner: https[1], repo: https[2] };
|
|
7981
|
+
return null;
|
|
7982
|
+
}
|
|
7983
|
+
var memoizedThisRepo = null;
|
|
7984
|
+
function runtimeDirForThisRepo() {
|
|
7985
|
+
if (memoizedThisRepo !== null)
|
|
7986
|
+
return memoizedThisRepo;
|
|
7987
|
+
memoizedThisRepo = runtimeDirForRepo(resolveRepoSync());
|
|
7988
|
+
return memoizedThisRepo;
|
|
7989
|
+
}
|
|
7680
7990
|
|
|
7681
|
-
// src/lib/log
|
|
7991
|
+
// src/lib/loop-log.ts
|
|
7682
7992
|
import {
|
|
7683
7993
|
closeSync as closeSync2,
|
|
7684
7994
|
constants as fsConstants2,
|
|
7685
|
-
|
|
7995
|
+
existsSync as existsSync4,
|
|
7996
|
+
fstatSync as fstatSync2,
|
|
7686
7997
|
mkdirSync as mkdirSync2,
|
|
7687
7998
|
openSync as openSync2,
|
|
7688
|
-
linkSync,
|
|
7689
7999
|
readFileSync as readFileSync3,
|
|
7690
|
-
|
|
8000
|
+
readSync,
|
|
7691
8001
|
statSync,
|
|
8002
|
+
writeSync
|
|
8003
|
+
} from "node:fs";
|
|
8004
|
+
import { dirname as dirname4 } from "node:path";
|
|
8005
|
+
function loopsRoot() {
|
|
8006
|
+
return runtimeDirForThisRepo();
|
|
8007
|
+
}
|
|
8008
|
+
function loopLogPathFor(_repo, issue, root = loopsRoot()) {
|
|
8009
|
+
return runPath(root, issue, { area: "output", file: "driver.log" });
|
|
8010
|
+
}
|
|
8011
|
+
var LOOP_LOG_MAX_BYTES = 8 * 1024 * 1024;
|
|
8012
|
+
function appendLoopLogLine(path, line) {
|
|
8013
|
+
try {
|
|
8014
|
+
mkdirSync2(dirname4(path), { recursive: true, mode: 448 });
|
|
8015
|
+
const fd = openSync2(path, fsConstants2.O_WRONLY | fsConstants2.O_APPEND | fsConstants2.O_CREAT | fsConstants2.O_NOFOLLOW, 384);
|
|
8016
|
+
try {
|
|
8017
|
+
const stat = fstatSync2(fd);
|
|
8018
|
+
if (stat.isFile() && stat.size < LOOP_LOG_MAX_BYTES) {
|
|
8019
|
+
writeSync(fd, `${line}
|
|
8020
|
+
`);
|
|
8021
|
+
}
|
|
8022
|
+
} finally {
|
|
8023
|
+
closeSync2(fd);
|
|
8024
|
+
}
|
|
8025
|
+
} catch {}
|
|
8026
|
+
}
|
|
8027
|
+
|
|
8028
|
+
// src/lib/log-webhook-drain.ts
|
|
8029
|
+
import {
|
|
8030
|
+
closeSync as closeSync3,
|
|
8031
|
+
constants as fsConstants3,
|
|
8032
|
+
lstatSync,
|
|
8033
|
+
mkdirSync as mkdirSync3,
|
|
8034
|
+
openSync as openSync3,
|
|
8035
|
+
linkSync,
|
|
8036
|
+
readFileSync as readFileSync4,
|
|
8037
|
+
renameSync,
|
|
8038
|
+
statSync as statSync2,
|
|
7692
8039
|
unlinkSync,
|
|
7693
8040
|
utimesSync,
|
|
7694
8041
|
writeFileSync as writeFileSync2,
|
|
7695
|
-
writeSync
|
|
8042
|
+
writeSync as writeSync2
|
|
7696
8043
|
} from "node:fs";
|
|
7697
8044
|
import { randomUUID } from "node:crypto";
|
|
7698
8045
|
import { homedir as homedir2 } from "node:os";
|
|
7699
|
-
import { dirname as
|
|
8046
|
+
import { dirname as dirname5, join as join5 } from "node:path";
|
|
7700
8047
|
var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
|
|
7701
8048
|
var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
|
|
7702
8049
|
var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
@@ -7712,13 +8059,13 @@ function isEnoent(err) {
|
|
|
7712
8059
|
var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
|
|
7713
8060
|
function tryCreateLock(lockPath, token) {
|
|
7714
8061
|
try {
|
|
7715
|
-
|
|
7716
|
-
const fd =
|
|
8062
|
+
mkdirSync3(dirname5(lockPath), { recursive: true, mode: 448 });
|
|
8063
|
+
const fd = openSync3(lockPath, fsConstants3.O_WRONLY | fsConstants3.O_CREAT | fsConstants3.O_EXCL, 384);
|
|
7717
8064
|
try {
|
|
7718
|
-
|
|
8065
|
+
writeSync2(fd, `${token}
|
|
7719
8066
|
`);
|
|
7720
8067
|
} finally {
|
|
7721
|
-
|
|
8068
|
+
closeSync3(fd);
|
|
7722
8069
|
}
|
|
7723
8070
|
return true;
|
|
7724
8071
|
} catch (err) {
|
|
@@ -7733,7 +8080,7 @@ function acquireDrainLock(lockPath) {
|
|
|
7733
8080
|
return token;
|
|
7734
8081
|
let observedMtimeMs;
|
|
7735
8082
|
try {
|
|
7736
|
-
observedMtimeMs =
|
|
8083
|
+
observedMtimeMs = statSync2(lockPath).mtimeMs;
|
|
7737
8084
|
} catch (err) {
|
|
7738
8085
|
if (!isEnoent(err))
|
|
7739
8086
|
throw err;
|
|
@@ -7751,7 +8098,7 @@ function acquireDrainLock(lockPath) {
|
|
|
7751
8098
|
}
|
|
7752
8099
|
let claimedMtimeMs = null;
|
|
7753
8100
|
try {
|
|
7754
|
-
claimedMtimeMs =
|
|
8101
|
+
claimedMtimeMs = statSync2(claimed).mtimeMs;
|
|
7755
8102
|
} catch (err) {
|
|
7756
8103
|
if (!isEnoent(err))
|
|
7757
8104
|
throw err;
|
|
@@ -7777,7 +8124,7 @@ function acquireDrainLock(lockPath) {
|
|
|
7777
8124
|
function renewDrainLock(lockPath, token) {
|
|
7778
8125
|
let holder;
|
|
7779
8126
|
try {
|
|
7780
|
-
holder =
|
|
8127
|
+
holder = readFileSync4(lockPath, "utf8").trim();
|
|
7781
8128
|
} catch (err) {
|
|
7782
8129
|
if (!isEnoent(err))
|
|
7783
8130
|
throw err;
|
|
@@ -7797,7 +8144,7 @@ function renewDrainLock(lockPath, token) {
|
|
|
7797
8144
|
}
|
|
7798
8145
|
function releaseDrainLock(lockPath, token) {
|
|
7799
8146
|
try {
|
|
7800
|
-
const holder =
|
|
8147
|
+
const holder = readFileSync4(lockPath, "utf8").trim();
|
|
7801
8148
|
if (holder !== token)
|
|
7802
8149
|
return;
|
|
7803
8150
|
unlinkSync(lockPath);
|
|
@@ -7847,7 +8194,7 @@ function queueLines(buf) {
|
|
|
7847
8194
|
return lines;
|
|
7848
8195
|
}
|
|
7849
8196
|
function removeQueueHead(path, cut) {
|
|
7850
|
-
const remaining =
|
|
8197
|
+
const remaining = readFileSync4(path);
|
|
7851
8198
|
writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
|
|
7852
8199
|
}
|
|
7853
8200
|
function queueBucketSize(path) {
|
|
@@ -7868,7 +8215,7 @@ function queueBucketSize(path) {
|
|
|
7868
8215
|
function readQueueFile(path) {
|
|
7869
8216
|
if (queueBucketSize(path) === null)
|
|
7870
8217
|
return null;
|
|
7871
|
-
return
|
|
8218
|
+
return readFileSync4(path);
|
|
7872
8219
|
}
|
|
7873
8220
|
function rejectLine(rejectedPath, reason, status, identity, raw) {
|
|
7874
8221
|
const record = JSON.stringify({
|
|
@@ -8050,13 +8397,19 @@ function logsCredentialMissing(headers, env) {
|
|
|
8050
8397
|
const varPattern = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
|
|
8051
8398
|
for (const value of Object.values(headers)) {
|
|
8052
8399
|
for (const match of value.matchAll(varPattern)) {
|
|
8053
|
-
|
|
8054
|
-
|
|
8400
|
+
const name = match[1];
|
|
8401
|
+
if (env[name])
|
|
8402
|
+
continue;
|
|
8403
|
+
return true;
|
|
8055
8404
|
}
|
|
8056
8405
|
}
|
|
8057
8406
|
return false;
|
|
8058
8407
|
}
|
|
8059
8408
|
function resolveLogDestinationFrom(input) {
|
|
8409
|
+
const spoolDir = input.env.VINAYA_LOG_SPOOL_DIR;
|
|
8410
|
+
if (spoolDir !== undefined && spoolDir.trim() !== "") {
|
|
8411
|
+
return { kind: "folder", folder: spoolDir };
|
|
8412
|
+
}
|
|
8060
8413
|
const local = resolveLogsSetting(input.localConfig);
|
|
8061
8414
|
let effective = null;
|
|
8062
8415
|
let fallbackReason;
|
|
@@ -8096,23 +8449,72 @@ function resolveLogDestinationFrom(input) {
|
|
|
8096
8449
|
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
8097
8450
|
return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
|
|
8098
8451
|
}
|
|
8099
|
-
var
|
|
8100
|
-
function processTrustAnchor() {
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8452
|
+
var processTrustAnchorByRepo = new Map;
|
|
8453
|
+
function processTrustAnchor(repoRoot) {
|
|
8454
|
+
const cached = processTrustAnchorByRepo.get(repoRoot);
|
|
8455
|
+
if (cached !== undefined)
|
|
8456
|
+
return cached;
|
|
8457
|
+
const reading = safeLoadTrustAnchorConfig();
|
|
8458
|
+
processTrustAnchorByRepo.set(repoRoot, reading);
|
|
8459
|
+
return reading;
|
|
8104
8460
|
}
|
|
8105
8461
|
async function defaultResolveLogDestination(repo, env) {
|
|
8106
8462
|
const localConfig = loadConfig();
|
|
8107
8463
|
const unattended = isUnattendedProcess(process.env);
|
|
8464
|
+
const repoRoot = repoRootSync();
|
|
8108
8465
|
return resolveLogDestinationFrom({
|
|
8109
8466
|
localConfig,
|
|
8110
|
-
trustAnchorConfig: unattended ? await processTrustAnchor() : null,
|
|
8467
|
+
trustAnchorConfig: unattended ? await processTrustAnchor(repoRoot) : null,
|
|
8111
8468
|
unattended,
|
|
8112
8469
|
env,
|
|
8113
8470
|
defaultFolder: join6(await runtimeDirForRepoAsync(repo), "logs"),
|
|
8114
|
-
repoRoot
|
|
8471
|
+
repoRoot
|
|
8472
|
+
});
|
|
8473
|
+
}
|
|
8474
|
+
function unresolvedLogDestination(env) {
|
|
8475
|
+
if (hostFromEnv(env) === "ci") {
|
|
8476
|
+
return {
|
|
8477
|
+
kind: "none",
|
|
8478
|
+
reason: "the process ended before its log destination was resolved, and a CI job never records to a folder"
|
|
8479
|
+
};
|
|
8480
|
+
}
|
|
8481
|
+
const loaded = loadConfig();
|
|
8482
|
+
const localConfig = loaded?.logs?.url !== undefined ? { ...loaded, logs: undefined } : loaded;
|
|
8483
|
+
const unattended = isUnattendedProcess(process.env);
|
|
8484
|
+
const repoRoot = repoRootSync();
|
|
8485
|
+
const runtimeDir = process.env[RUNTIME_DIR_ENV_KEY] || resolveRuntimeDir({ repo: null, localConfig, trustAnchorConfig: null, unattended, repoRoot });
|
|
8486
|
+
const defaultFolder = join6(runtimeDir, "logs");
|
|
8487
|
+
const resolved = resolveLogDestinationFrom({
|
|
8488
|
+
localConfig,
|
|
8489
|
+
trustAnchorConfig: null,
|
|
8490
|
+
unattended,
|
|
8491
|
+
env,
|
|
8492
|
+
defaultFolder,
|
|
8493
|
+
repoRoot
|
|
8115
8494
|
});
|
|
8495
|
+
return resolved.kind === "folder" ? resolved : { kind: "folder", folder: defaultFolder };
|
|
8496
|
+
}
|
|
8497
|
+
function folderFallbackStatePath(repo, stateRoot = GLOBAL_VINAYA_HOME) {
|
|
8498
|
+
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
8499
|
+
return join6(stateRoot, "fallback", `${dirName}.json`);
|
|
8500
|
+
}
|
|
8501
|
+
function recordFolderFallback(repo, issue, reason, now, runtimeDir, stateRoot = GLOBAL_VINAYA_HOME) {
|
|
8502
|
+
const message = describeFolderFallback(reason);
|
|
8503
|
+
if (issue !== null) {
|
|
8504
|
+
appendLoopLogLine(loopLogPathFor(repo, issue, runtimeDir), `[log] ${message}`);
|
|
8505
|
+
}
|
|
8506
|
+
try {
|
|
8507
|
+
const record = {
|
|
8508
|
+
at: now.toISOString(),
|
|
8509
|
+
reason: message,
|
|
8510
|
+
intendedUrl: reason.intendedUrl,
|
|
8511
|
+
kind: reason.kind
|
|
8512
|
+
};
|
|
8513
|
+
const path = folderFallbackStatePath(repo, stateRoot);
|
|
8514
|
+
mkdirSync4(dirname6(path), { recursive: true, mode: 448 });
|
|
8515
|
+
writeFileSync3(path, `${JSON.stringify(record)}
|
|
8516
|
+
`, { mode: 384 });
|
|
8517
|
+
} catch {}
|
|
8116
8518
|
}
|
|
8117
8519
|
function isEnoent2(err) {
|
|
8118
8520
|
return typeof err === "object" && err !== null && err.code === "ENOENT";
|
|
@@ -8226,7 +8628,7 @@ async function resolveBranchIssue(cwd, env = process.env, repo = null) {
|
|
|
8226
8628
|
}
|
|
8227
8629
|
function readVinayaVersion() {
|
|
8228
8630
|
try {
|
|
8229
|
-
const pkg = JSON.parse(
|
|
8631
|
+
const pkg = JSON.parse(readFileSync5(join6(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
8230
8632
|
return pkg.version ?? "unknown";
|
|
8231
8633
|
} catch {
|
|
8232
8634
|
return "unknown";
|
|
@@ -8264,6 +8666,7 @@ function defaultStderr(message) {
|
|
|
8264
8666
|
}
|
|
8265
8667
|
var branchIssueFallbackEnabled = true;
|
|
8266
8668
|
var branchIssueByCwd = new Map;
|
|
8669
|
+
var branchIssueSettledByCwd = new Map;
|
|
8267
8670
|
function branchIssueRead(key, read, shared) {
|
|
8268
8671
|
if (!shared)
|
|
8269
8672
|
return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
@@ -8272,8 +8675,30 @@ function branchIssueRead(key, read, shared) {
|
|
|
8272
8675
|
return cached;
|
|
8273
8676
|
const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
8274
8677
|
branchIssueByCwd.set(key, reading);
|
|
8678
|
+
reading.then((value) => branchIssueSettledByCwd.set(key, value));
|
|
8275
8679
|
return reading;
|
|
8276
8680
|
}
|
|
8681
|
+
var headShaByCwd = new Map;
|
|
8682
|
+
var headShaSettledByCwd = new Map;
|
|
8683
|
+
function headShaRead(key, read, shared) {
|
|
8684
|
+
if (!shared)
|
|
8685
|
+
return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
8686
|
+
const cached = headShaByCwd.get(key);
|
|
8687
|
+
if (cached !== undefined)
|
|
8688
|
+
return cached;
|
|
8689
|
+
const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
8690
|
+
headShaByCwd.set(key, reading);
|
|
8691
|
+
reading.then((value) => headShaSettledByCwd.set(key, value));
|
|
8692
|
+
return reading;
|
|
8693
|
+
}
|
|
8694
|
+
async function resolveHeadSha(cwd) {
|
|
8695
|
+
try {
|
|
8696
|
+
const out = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "HEAD"], { encoding: "utf8" })).stdout.trim();
|
|
8697
|
+
return /^[0-9a-f]{40}$/.test(out) ? out : null;
|
|
8698
|
+
} catch {
|
|
8699
|
+
return null;
|
|
8700
|
+
}
|
|
8701
|
+
}
|
|
8277
8702
|
function defaultDeps() {
|
|
8278
8703
|
return {
|
|
8279
8704
|
outboxRoot: () => join6(GLOBAL_VINAYA_HOME, "outbox"),
|
|
@@ -8288,29 +8713,30 @@ function defaultDeps() {
|
|
|
8288
8713
|
inputVersions: () => {
|
|
8289
8714
|
return;
|
|
8290
8715
|
},
|
|
8291
|
-
resolveLogDestination: defaultResolveLogDestination
|
|
8716
|
+
resolveLogDestination: defaultResolveLogDestination,
|
|
8717
|
+
unresolvedLogDestination
|
|
8292
8718
|
};
|
|
8293
8719
|
}
|
|
8294
|
-
var APPEND_OPEN_FLAGS =
|
|
8720
|
+
var APPEND_OPEN_FLAGS = fsConstants4.O_WRONLY | fsConstants4.O_APPEND | fsConstants4.O_CREAT | fsConstants4.O_NOFOLLOW | fsConstants4.O_NONBLOCK;
|
|
8295
8721
|
function guardedAppendOpen(path) {
|
|
8296
8722
|
try {
|
|
8297
|
-
return
|
|
8723
|
+
return openSync4(path, APPEND_OPEN_FLAGS, 384);
|
|
8298
8724
|
} catch {
|
|
8299
8725
|
return;
|
|
8300
8726
|
}
|
|
8301
8727
|
}
|
|
8302
8728
|
function appendHardenedLine(path, line) {
|
|
8303
8729
|
try {
|
|
8304
|
-
|
|
8730
|
+
mkdirSync4(dirname6(path), { recursive: true, mode: 448 });
|
|
8305
8731
|
const fd = guardedAppendOpen(path);
|
|
8306
8732
|
if (fd === undefined)
|
|
8307
8733
|
return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
|
|
8308
8734
|
try {
|
|
8309
|
-
if (!
|
|
8735
|
+
if (!fstatSync3(fd).isFile())
|
|
8310
8736
|
return `target is not a regular file: ${path}`;
|
|
8311
|
-
|
|
8737
|
+
writeSync3(fd, line);
|
|
8312
8738
|
} finally {
|
|
8313
|
-
|
|
8739
|
+
closeSync4(fd);
|
|
8314
8740
|
}
|
|
8315
8741
|
return null;
|
|
8316
8742
|
} catch (err) {
|
|
@@ -8320,7 +8746,7 @@ function appendHardenedLine(path, line) {
|
|
|
8320
8746
|
function reportRotationOverflow(backupPath, warn) {
|
|
8321
8747
|
let raw;
|
|
8322
8748
|
try {
|
|
8323
|
-
raw =
|
|
8749
|
+
raw = readFileSync5(backupPath, "utf8");
|
|
8324
8750
|
} catch {
|
|
8325
8751
|
return;
|
|
8326
8752
|
}
|
|
@@ -8343,7 +8769,7 @@ function reportRotationOverflow(backupPath, warn) {
|
|
|
8343
8769
|
}
|
|
8344
8770
|
function appendLine(path, line, warn) {
|
|
8345
8771
|
try {
|
|
8346
|
-
|
|
8772
|
+
mkdirSync4(dirname6(path), { recursive: true, mode: 448 });
|
|
8347
8773
|
let fd = guardedAppendOpen(path);
|
|
8348
8774
|
if (fd === undefined) {
|
|
8349
8775
|
warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
|
|
@@ -8352,14 +8778,14 @@ function appendLine(path, line, warn) {
|
|
|
8352
8778
|
}
|
|
8353
8779
|
let closed = false;
|
|
8354
8780
|
try {
|
|
8355
|
-
const stat =
|
|
8781
|
+
const stat = fstatSync3(fd);
|
|
8356
8782
|
if (!stat.isFile()) {
|
|
8357
8783
|
warn(`vinaya: log outbox target is not a regular file — refusing to write: ${path}
|
|
8358
8784
|
`);
|
|
8359
8785
|
return;
|
|
8360
8786
|
}
|
|
8361
8787
|
if (stat.size > OUTBOX_MAX_BYTES) {
|
|
8362
|
-
|
|
8788
|
+
closeSync4(fd);
|
|
8363
8789
|
closed = true;
|
|
8364
8790
|
const backupPath = path.replace(/\.ndjson$/, ".1.ndjson");
|
|
8365
8791
|
reportRotationOverflow(backupPath, warn);
|
|
@@ -8373,10 +8799,10 @@ function appendLine(path, line, warn) {
|
|
|
8373
8799
|
fd = rotated;
|
|
8374
8800
|
closed = false;
|
|
8375
8801
|
}
|
|
8376
|
-
|
|
8802
|
+
writeSync3(fd, line);
|
|
8377
8803
|
} finally {
|
|
8378
8804
|
if (!closed)
|
|
8379
|
-
|
|
8805
|
+
closeSync4(fd);
|
|
8380
8806
|
}
|
|
8381
8807
|
} catch (err) {
|
|
8382
8808
|
warn(`vinaya: log outbox write failed — ${err instanceof Error ? err.message : String(err)}
|
|
@@ -8387,12 +8813,14 @@ function createLogSink(overrides = {}) {
|
|
|
8387
8813
|
const deps = {
|
|
8388
8814
|
...defaultDeps(),
|
|
8389
8815
|
resolveBranchIssue: (repo) => resolveBranchIssue(deps.cwd(), deps.env(), repo),
|
|
8816
|
+
resolveHeadSha: () => resolveHeadSha(deps.cwd()),
|
|
8390
8817
|
...overrides
|
|
8391
8818
|
};
|
|
8392
8819
|
const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
|
|
8393
8820
|
const processId = randomUUID2();
|
|
8394
8821
|
let seq = 0;
|
|
8395
8822
|
let warned = false;
|
|
8823
|
+
let folderFallbackRecorded = false;
|
|
8396
8824
|
const warnOnce = (message) => {
|
|
8397
8825
|
if (warned)
|
|
8398
8826
|
return;
|
|
@@ -8410,6 +8838,7 @@ function createLogSink(overrides = {}) {
|
|
|
8410
8838
|
};
|
|
8411
8839
|
const readerIsReal = overrides.resolveBranchIssue === undefined;
|
|
8412
8840
|
let ownBranchIssue;
|
|
8841
|
+
let ownBranchIssueSettled = null;
|
|
8413
8842
|
const branchIssueOnce = (repo) => {
|
|
8414
8843
|
if (!branchIssueFallbackEnabled)
|
|
8415
8844
|
return Promise.resolve(null);
|
|
@@ -8417,10 +8846,36 @@ function createLogSink(overrides = {}) {
|
|
|
8417
8846
|
const read = () => deps.resolveBranchIssue(slug);
|
|
8418
8847
|
if (readerIsReal)
|
|
8419
8848
|
return branchIssueRead(`${deps.cwd()}\x00${slug ?? ""}`, read, true);
|
|
8420
|
-
if (ownBranchIssue === undefined)
|
|
8849
|
+
if (ownBranchIssue === undefined) {
|
|
8421
8850
|
ownBranchIssue = branchIssueRead(deps.cwd(), read, false);
|
|
8851
|
+
ownBranchIssue.then((value) => {
|
|
8852
|
+
ownBranchIssueSettled = value;
|
|
8853
|
+
});
|
|
8854
|
+
}
|
|
8422
8855
|
return ownBranchIssue;
|
|
8423
8856
|
};
|
|
8857
|
+
const branchIssueIfSettled = (repo) => {
|
|
8858
|
+
if (!branchIssueFallbackEnabled)
|
|
8859
|
+
return null;
|
|
8860
|
+
if (!readerIsReal)
|
|
8861
|
+
return ownBranchIssueSettled;
|
|
8862
|
+
return branchIssueSettledByCwd.get(`${deps.cwd()}\x00${safeRepoSlug(repo) ?? ""}`) ?? null;
|
|
8863
|
+
};
|
|
8864
|
+
const headShaReaderIsReal = overrides.resolveHeadSha === undefined;
|
|
8865
|
+
let ownHeadSha;
|
|
8866
|
+
let ownHeadShaSettled = null;
|
|
8867
|
+
const headShaOnce = () => {
|
|
8868
|
+
if (headShaReaderIsReal)
|
|
8869
|
+
return headShaRead(deps.cwd(), deps.resolveHeadSha, true);
|
|
8870
|
+
if (ownHeadSha === undefined) {
|
|
8871
|
+
ownHeadSha = headShaRead(deps.cwd(), deps.resolveHeadSha, false);
|
|
8872
|
+
ownHeadSha.then((value) => {
|
|
8873
|
+
ownHeadShaSettled = value;
|
|
8874
|
+
});
|
|
8875
|
+
}
|
|
8876
|
+
return ownHeadSha;
|
|
8877
|
+
};
|
|
8878
|
+
const headShaIfSettled = () => headShaReaderIsReal ? headShaSettledByCwd.get(deps.cwd()) ?? null : ownHeadShaSettled;
|
|
8424
8879
|
let resolveRepoCache;
|
|
8425
8880
|
const resolveRepoOnce = () => {
|
|
8426
8881
|
if (resolveRepoCache === undefined)
|
|
@@ -8428,6 +8883,7 @@ function createLogSink(overrides = {}) {
|
|
|
8428
8883
|
return resolveRepoCache;
|
|
8429
8884
|
};
|
|
8430
8885
|
let contextCache;
|
|
8886
|
+
let settledContext;
|
|
8431
8887
|
const context = () => {
|
|
8432
8888
|
if (contextCache === undefined) {
|
|
8433
8889
|
const env = deps.env();
|
|
@@ -8436,11 +8892,16 @@ function createLogSink(overrides = {}) {
|
|
|
8436
8892
|
doctrine()
|
|
8437
8893
|
]).then(async ([resolved, doctrineValue]) => {
|
|
8438
8894
|
const repo = resolved && isSafeRepoSegment3(resolved.owner) && isSafeRepoSegment3(resolved.repo) ? resolved : null;
|
|
8439
|
-
|
|
8895
|
+
settledContext = { repo, doctrine: doctrineValue, destination: await deps.resolveLogDestination(repo, env) };
|
|
8896
|
+
return settledContext;
|
|
8440
8897
|
});
|
|
8441
8898
|
}
|
|
8442
8899
|
return contextCache;
|
|
8443
8900
|
};
|
|
8901
|
+
const resetContext = () => {
|
|
8902
|
+
contextCache = undefined;
|
|
8903
|
+
settledContext = undefined;
|
|
8904
|
+
};
|
|
8444
8905
|
let drainChain = Promise.resolve();
|
|
8445
8906
|
const pendingWrites = new Set;
|
|
8446
8907
|
let writeChain = Promise.resolve();
|
|
@@ -8452,63 +8913,88 @@ function createLogSink(overrides = {}) {
|
|
|
8452
8913
|
`);
|
|
8453
8914
|
});
|
|
8454
8915
|
};
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
|
|
8916
|
+
const snapshot = () => {
|
|
8917
|
+
const env = deps.env();
|
|
8918
|
+
return {
|
|
8919
|
+
host: hostFromEnv(env),
|
|
8920
|
+
now: deps.now(),
|
|
8921
|
+
seq: seq++,
|
|
8922
|
+
envFields: {
|
|
8462
8923
|
role: env.VINAYA_ROLE,
|
|
8463
8924
|
task: env.VINAYA_TASK,
|
|
8464
8925
|
round: env.VINAYA_ROUND,
|
|
8926
|
+
pr: env.VINAYA_PR,
|
|
8465
8927
|
run: env.VINAYA_RUN || runId,
|
|
8466
8928
|
attempt: env.VINAYA_ATTEMPT,
|
|
8467
|
-
parent: env.VINAYA_PARENT_EVENT
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8929
|
+
parent: env.VINAYA_PARENT_EVENT,
|
|
8930
|
+
workRef: env.VINAYA_WORK_REF,
|
|
8931
|
+
flow: env.VINAYA_FLOW,
|
|
8932
|
+
flowVersion: env.VINAYA_FLOW_VERSION,
|
|
8933
|
+
runtime: env.VINAYA_RUNTIME,
|
|
8934
|
+
source: env.VINAYA_SOURCE
|
|
8935
|
+
}
|
|
8936
|
+
};
|
|
8937
|
+
};
|
|
8938
|
+
const writeEvent = (e, call, ctx, branchIssue, headSha, deliver) => {
|
|
8939
|
+
const { repo, doctrine: doctrineValue, destination } = ctx;
|
|
8940
|
+
if (destination.kind === "none") {
|
|
8941
|
+
warnOnce(`vinaya: not recording — ${destination.reason}
|
|
8473
8942
|
`);
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8943
|
+
return;
|
|
8944
|
+
}
|
|
8945
|
+
if (destination.kind === "folder" && destination.fallbackReason) {
|
|
8946
|
+
warnOnce(`vinaya: ${describeFolderFallback(destination.fallbackReason)}
|
|
8478
8947
|
`);
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8948
|
+
}
|
|
8949
|
+
const built = buildHeader({
|
|
8950
|
+
now: call.now,
|
|
8951
|
+
runId,
|
|
8952
|
+
seq: call.seq,
|
|
8953
|
+
repo: repo ? `${repo.owner}/${repo.repo}` : null,
|
|
8954
|
+
vinaya: deps.vinayaVersion(),
|
|
8955
|
+
doctrine: doctrineValue,
|
|
8956
|
+
host: call.host,
|
|
8957
|
+
hostname: deps.hostname(),
|
|
8958
|
+
env: call.envFields,
|
|
8959
|
+
branchIssue,
|
|
8960
|
+
eventId: randomUUID2(),
|
|
8961
|
+
processId,
|
|
8962
|
+
inputVersions: deps.inputVersions()
|
|
8963
|
+
});
|
|
8964
|
+
const header = headSha === null ? built : { ...built, subject: { ...built.subject, sha: headSha } };
|
|
8965
|
+
if (destination.kind === "folder" && destination.fallbackReason && !folderFallbackRecorded) {
|
|
8966
|
+
folderFallbackRecorded = true;
|
|
8967
|
+
recordFolderFallback(repo, header.subject.issue, destination.fallbackReason, call.now, dirname6(destination.folder), join6(deps.home(), ".vinaya"));
|
|
8968
|
+
}
|
|
8969
|
+
const full = { ...e, ...header };
|
|
8970
|
+
const parsed = LogEventSchema.safeParse(full);
|
|
8971
|
+
if (!parsed.success) {
|
|
8972
|
+
warnOnce(`vinaya: log() refused an invalid payload — ${parsed.error.issues[0]?.message ?? "schema violation"}
|
|
8500
8973
|
`);
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8974
|
+
return;
|
|
8975
|
+
}
|
|
8976
|
+
const line = `${JSON.stringify(redact(parsed.data, deps.home()))}
|
|
8504
8977
|
`;
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8978
|
+
if (destination.kind === "server") {
|
|
8979
|
+
appendLine(outboxPathFor(deps, repo, header.subject.issue), line, warnOnce);
|
|
8980
|
+
if (deliver)
|
|
8981
|
+
scheduleWebhookDrain(header.subject.issue, destination.url, destination.headers);
|
|
8982
|
+
} else {
|
|
8983
|
+
appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
|
|
8984
|
+
}
|
|
8985
|
+
};
|
|
8986
|
+
function log(e) {
|
|
8987
|
+
try {
|
|
8988
|
+
const call = snapshot();
|
|
8989
|
+
const write = async () => {
|
|
8990
|
+
const ctx = await context();
|
|
8991
|
+
if (ctx.destination.kind === "none") {
|
|
8992
|
+
writeEvent(e, call, ctx, null, null, true);
|
|
8993
|
+
return;
|
|
8511
8994
|
}
|
|
8995
|
+
const branchIssue = call.envFields.task ? null : await branchIssueOnce(ctx.repo);
|
|
8996
|
+
const headSha = e.kind === "gate" ? await headShaOnce() : null;
|
|
8997
|
+
writeEvent(e, call, ctx, branchIssue, headSha, true);
|
|
8512
8998
|
};
|
|
8513
8999
|
const written = writeChain.then(write).catch((err) => {
|
|
8514
9000
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
@@ -8519,6 +9005,26 @@ function createLogSink(overrides = {}) {
|
|
|
8519
9005
|
written.finally(() => pendingWrites.delete(written));
|
|
8520
9006
|
} catch (err) {
|
|
8521
9007
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
9008
|
+
`);
|
|
9009
|
+
}
|
|
9010
|
+
}
|
|
9011
|
+
function logSync(e, opts = {}) {
|
|
9012
|
+
try {
|
|
9013
|
+
const call = snapshot();
|
|
9014
|
+
let ctx = settledContext;
|
|
9015
|
+
if (ctx === undefined) {
|
|
9016
|
+
const destination = deps.unresolvedLogDestination(deps.env());
|
|
9017
|
+
if (destination.kind === "folder" && !opts.quiet) {
|
|
9018
|
+
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
|
|
9019
|
+
`);
|
|
9020
|
+
}
|
|
9021
|
+
ctx = { repo: null, doctrine: "unknown", destination };
|
|
9022
|
+
}
|
|
9023
|
+
const branchIssue = ctx.destination.kind === "none" || call.envFields.task ? null : branchIssueIfSettled(ctx.repo);
|
|
9024
|
+
const headSha = e.kind === "gate" && ctx.destination.kind !== "none" ? headShaIfSettled() : null;
|
|
9025
|
+
writeEvent(e, call, ctx, branchIssue, headSha, false);
|
|
9026
|
+
} catch (err) {
|
|
9027
|
+
warnOnce(`vinaya: logSync() failed — ${err instanceof Error ? err.message : String(err)}
|
|
8522
9028
|
`);
|
|
8523
9029
|
}
|
|
8524
9030
|
}
|
|
@@ -8539,7 +9045,7 @@ function createLogSink(overrides = {}) {
|
|
|
8539
9045
|
return;
|
|
8540
9046
|
});
|
|
8541
9047
|
};
|
|
8542
|
-
return { log, runId, warmup, drain };
|
|
9048
|
+
return { log, logSync, runId, warmup, drain, resetContext };
|
|
8543
9049
|
}
|
|
8544
9050
|
var defaultSink = createLogSink();
|
|
8545
9051
|
|
|
@@ -8628,16 +9134,9 @@ function summaryLineIndex(maskedRegion) {
|
|
|
8628
9134
|
return index === -1 ? null : index;
|
|
8629
9135
|
}
|
|
8630
9136
|
|
|
8631
|
-
// src/lib/loop-log.ts
|
|
8632
|
-
var LOOP_LOG_MAX_BYTES = 8 * 1024 * 1024;
|
|
8633
|
-
|
|
8634
|
-
// src/lib/diff-evidence.ts
|
|
8635
|
-
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
8636
|
-
import { join as join9, relative, resolve as resolve2 } from "node:path";
|
|
8637
|
-
|
|
8638
9137
|
// src/lib/brief-assembly.ts
|
|
8639
9138
|
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
8640
|
-
import { existsSync as existsSync7, readFileSync as
|
|
9139
|
+
import { existsSync as existsSync7, readFileSync as readFileSync7, readdirSync as readdirSync2 } from "node:fs";
|
|
8641
9140
|
import { join as join8 } from "node:path";
|
|
8642
9141
|
|
|
8643
9142
|
// ../../packages/sources/src/commands.ts
|
|
@@ -8788,20 +9287,31 @@ var COMMANDS = [
|
|
|
8788
9287
|
{
|
|
8789
9288
|
flag: "--agent <claude|codex|gemini>",
|
|
8790
9289
|
description: "Vendor for the developer and both reviewers this run dispatches"
|
|
9290
|
+
},
|
|
9291
|
+
{
|
|
9292
|
+
flag: "--quiet",
|
|
9293
|
+
description: "Hide the detail lines (an agent's prose, full commands, failed-result tails) on the live terminal; the driver log file keeps them"
|
|
8791
9294
|
}
|
|
8792
9295
|
],
|
|
8793
9296
|
details: [
|
|
8794
9297
|
"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.",
|
|
8795
9298
|
"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.",
|
|
8796
9299
|
"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.",
|
|
8797
|
-
"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
|
|
9300
|
+
"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`)."
|
|
8798
9301
|
],
|
|
8799
9302
|
status: "shipped"
|
|
8800
9303
|
},
|
|
8801
9304
|
{
|
|
8802
9305
|
name: "task status",
|
|
8803
9306
|
description: "Every open task with a frozen brief, its pull request, and whether its loop is running, paused, or published",
|
|
8804
|
-
flags: [
|
|
9307
|
+
flags: [
|
|
9308
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" },
|
|
9309
|
+
{
|
|
9310
|
+
flag: "--follow",
|
|
9311
|
+
description: "Tail the task's driver log live, with its detail lines, on either the `<tranche> <n>` form or `--issue <n>`"
|
|
9312
|
+
},
|
|
9313
|
+
{ flag: "--quiet", description: "With `--follow`, hide the detail lines; the log file is unchanged" }
|
|
9314
|
+
],
|
|
8805
9315
|
details: [
|
|
8806
9316
|
"Read-only: one `gh issue list` for every open task Issue across every tranche (title/label resolved through the same `resolveTaskIssueRef` `list-tasks.ts` already uses), the open pull request per branch, and the driver pid record / pause record / publish effect markers under `<outboxRoot>/dev-review-loop/<task>/` — never a `ps` scan, never a re-parse of posted verdict comments to decide `published`.",
|
|
8807
9317
|
"`running` names the driver's pid (`review-validity-v1` task 7's pid record); `paused` names the reason from the pause record; `published` means the newest round's reviewer and security verdict effect markers both read `posted`; `no driver` is the fallback when none of the above holds.",
|
|
@@ -8837,6 +9347,26 @@ var COMMANDS = [
|
|
|
8837
9347
|
],
|
|
8838
9348
|
status: "shipped"
|
|
8839
9349
|
},
|
|
9350
|
+
{
|
|
9351
|
+
name: "task-tools result-proof",
|
|
9352
|
+
description: "Prove, live on this host, that a CLI delivers the Developer's turn result as its own structured final output",
|
|
9353
|
+
flags: [{ flag: "--agent <claude|codex>", description: "The CLI to prove" }],
|
|
9354
|
+
details: [
|
|
9355
|
+
"Runs real Developer-shaped dispatches on this host — the driver-run dev-tools registered and called, the agent's own sandbox where the host supports it, the subscription login, and the dispatch's own argv — and asks for the versioned `DeveloperTurnResult` (`completed`, `blocked` or `needs_ruling`) through the CLI's native structured output: Claude Code `--json-schema` under `--output-format stream-json`, with the dispatch's Stop hook plus one that rejects the first stop; Codex `--output-schema` under `exec --json` and `exec resume --json`.",
|
|
9356
|
+
"Cases: a first and a resumed session (the same provider session, a fresh result, exactly one accepted); a schema-valid but semantically invalid result (an unknown finding id, a ruling request naming no permissible decision), which the driver rejects; malformed output, which never reaches the driver; and a cancelled run, a provider error and context exhaustion, each ending with no accepted result. Each case prints whether a schema-valid result reached the driver, the result, and the event it was read from; exits 1 when any case fails. Never publishes, opens a pull request or writes the forge."
|
|
9357
|
+
],
|
|
9358
|
+
status: "shipped"
|
|
9359
|
+
},
|
|
9360
|
+
{
|
|
9361
|
+
name: "task-tools review-result-proof",
|
|
9362
|
+
description: "Prove, live on this host, that a CLI delivers a reviewer's result as its own structured final output, concurrent and fresh",
|
|
9363
|
+
flags: [{ flag: "--agent <claude|codex>", description: "The CLI to prove" }],
|
|
9364
|
+
details: [
|
|
9365
|
+
"Runs real reviewer-shaped dispatches on this host — fresh, non-resumed sessions, the agent's own sandbox where the host supports it, the subscription login, read-only grants, and the staged diff and review-input manifest — and asks for the versioned `ReviewResult` (`completed` or `blocked`, bound to the controller's role, head and manifest digest) through the CLI's native structured output: Claude Code `--json-schema` under `--output-format stream-json`; Codex `--output-schema` under `exec --json`. Both the code-reviewer and the security-reviewer role run, concurrently against one manifest, each accepted result attributed to its own role.",
|
|
9366
|
+
"Cases: a role mismatch, a wrong head and a wrong manifest digest; an objective id outside the brief, a severity outside the role's scale and a finding without a file (all refused) and a finding without a line (accepted); and a blocked, malformed, missing, cancelled, provider-error and context-exhausted outcome, each recorded as no review, never approval. Each case prints whether a schema-valid result reached the driver and what the controller made of it; exits 1 when any case fails. Never writes the forge and leaves the loop's reviewer dispatch and result files untouched."
|
|
9367
|
+
],
|
|
9368
|
+
status: "shipped"
|
|
9369
|
+
},
|
|
8840
9370
|
{
|
|
8841
9371
|
name: "pr create",
|
|
8842
9372
|
description: "Open a pull request after full brief-schema validation",
|
|
@@ -8879,13 +9409,14 @@ var COMMANDS = [
|
|
|
8879
9409
|
},
|
|
8880
9410
|
{
|
|
8881
9411
|
flag: "--push",
|
|
8882
|
-
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
|
|
9412
|
+
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."
|
|
8883
9413
|
}
|
|
8884
9414
|
],
|
|
8885
9415
|
details: [
|
|
8886
9416
|
"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.",
|
|
8887
9417
|
"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.",
|
|
8888
|
-
"`--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.
|
|
9418
|
+
"`--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.",
|
|
9419
|
+
"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."
|
|
8889
9420
|
],
|
|
8890
9421
|
status: "shipped"
|
|
8891
9422
|
},
|
|
@@ -8910,7 +9441,7 @@ var COMMANDS = [
|
|
|
8910
9441
|
"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.",
|
|
8911
9442
|
"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.",
|
|
8912
9443
|
"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.",
|
|
8913
|
-
"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
|
|
9444
|
+
"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."
|
|
8914
9445
|
],
|
|
8915
9446
|
status: "shipped"
|
|
8916
9447
|
},
|
|
@@ -9081,7 +9612,7 @@ var COMMANDS = [
|
|
|
9081
9612
|
{ flag: "--secrets", description: "security only: the SECRETS line" },
|
|
9082
9613
|
{
|
|
9083
9614
|
flag: "--secrets-evidence-file",
|
|
9084
|
-
description: 'security only: required whenever `--secrets` claims "none found" — the
|
|
9615
|
+
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'
|
|
9085
9616
|
},
|
|
9086
9617
|
{ flag: "--task-id", description: "the closing `Tokens:` line's task id" },
|
|
9087
9618
|
{ flag: "--model", description: "the closing `Tokens:` line's model name" },
|
|
@@ -9189,7 +9720,20 @@ var COMMANDS = [
|
|
|
9189
9720
|
flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
|
|
9190
9721
|
details: [
|
|
9191
9722
|
"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.",
|
|
9192
|
-
"Once every task Issue is closed, prompts for confirmation (unless `--yes`) and closes
|
|
9723
|
+
"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.",
|
|
9724
|
+
"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.",
|
|
9725
|
+
"Idempotent: on a tranche whose Milestone is already closed and carries its retrospective, changes nothing and says it is already archived.",
|
|
9726
|
+
"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."
|
|
9727
|
+
],
|
|
9728
|
+
status: "shipped"
|
|
9729
|
+
},
|
|
9730
|
+
{
|
|
9731
|
+
name: "archive tranches",
|
|
9732
|
+
description: "Archive every finished tranche that has no closed Milestone carrying its retrospective",
|
|
9733
|
+
flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
|
|
9734
|
+
details: [
|
|
9735
|
+
"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.",
|
|
9736
|
+
"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."
|
|
9193
9737
|
],
|
|
9194
9738
|
status: "shipped"
|
|
9195
9739
|
},
|
|
@@ -9333,6 +9877,29 @@ var COMMANDS = [
|
|
|
9333
9877
|
],
|
|
9334
9878
|
status: "shipped"
|
|
9335
9879
|
},
|
|
9880
|
+
{
|
|
9881
|
+
name: "log selftest",
|
|
9882
|
+
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)",
|
|
9883
|
+
details: [
|
|
9884
|
+
"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.",
|
|
9885
|
+
"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.",
|
|
9886
|
+
"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."
|
|
9887
|
+
],
|
|
9888
|
+
status: "shipped"
|
|
9889
|
+
},
|
|
9890
|
+
{
|
|
9891
|
+
name: "log emit",
|
|
9892
|
+
description: "Record a consumer-declared event (`logs.events` in vinaya.config.json) from a script or agent outside Vinaya",
|
|
9893
|
+
flags: [
|
|
9894
|
+
{ flag: "--json '<json>'", description: "The field values as one JSON object (else read from standard input)" }
|
|
9895
|
+
],
|
|
9896
|
+
details: [
|
|
9897
|
+
"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.",
|
|
9898
|
+
"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.",
|
|
9899
|
+
"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)."
|
|
9900
|
+
],
|
|
9901
|
+
status: "shipped"
|
|
9902
|
+
},
|
|
9336
9903
|
{
|
|
9337
9904
|
name: "log send",
|
|
9338
9905
|
description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
|
|
@@ -9345,12 +9912,19 @@ var COMMANDS = [
|
|
|
9345
9912
|
status: "shipped"
|
|
9346
9913
|
},
|
|
9347
9914
|
{
|
|
9348
|
-
name: "
|
|
9349
|
-
description: "
|
|
9915
|
+
name: "sync",
|
|
9916
|
+
description: "Fill, resume and rebuild the local log cache from this repository's configured destination (read-only)",
|
|
9917
|
+
flags: [
|
|
9918
|
+
{
|
|
9919
|
+
flag: "--rebuild",
|
|
9920
|
+
description: "Delete the cache file and sync from the beginning of what the destination still retains"
|
|
9921
|
+
},
|
|
9922
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
9923
|
+
],
|
|
9350
9924
|
details: [
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
"
|
|
9925
|
+
"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.",
|
|
9926
|
+
"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.",
|
|
9927
|
+
"`--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."
|
|
9354
9928
|
],
|
|
9355
9929
|
status: "shipped"
|
|
9356
9930
|
}
|
|
@@ -9364,10 +9938,10 @@ function createForgeSource(config) {
|
|
|
9364
9938
|
};
|
|
9365
9939
|
}
|
|
9366
9940
|
// ../../packages/sources/src/select-source.ts
|
|
9367
|
-
import { z as
|
|
9368
|
-
var StateSourceConfigSchema =
|
|
9369
|
-
|
|
9370
|
-
|
|
9941
|
+
import { z as z6 } from "zod";
|
|
9942
|
+
var StateSourceConfigSchema = z6.discriminatedUnion("kind", [
|
|
9943
|
+
z6.object({ kind: z6.literal("forge"), owner: z6.string(), repo: z6.string() }),
|
|
9944
|
+
z6.object({ kind: z6.literal("file"), root: z6.string().optional() })
|
|
9371
9945
|
]);
|
|
9372
9946
|
// src/checks/edge-resolve.ts
|
|
9373
9947
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
@@ -9489,9 +10063,18 @@ async function resolveEdge(id, taskById, factsByTaskId, repo, resolveSibling = d
|
|
|
9489
10063
|
|
|
9490
10064
|
// src/commands/doctrine.ts
|
|
9491
10065
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
9492
|
-
import { existsSync as existsSync6, readdirSync, readFileSync as
|
|
9493
|
-
import { dirname as
|
|
10066
|
+
import { existsSync as existsSync6, readdirSync, readFileSync as readFileSync6 } from "node:fs";
|
|
10067
|
+
import { dirname as dirname7, join as join7, sep as sep2 } from "node:path";
|
|
10068
|
+
import matter4 from "gray-matter";
|
|
10069
|
+
|
|
10070
|
+
// ../../packages/aeg-core/src/docs/parse-doc.ts
|
|
9494
10071
|
import matter2 from "gray-matter";
|
|
10072
|
+
// ../../packages/aeg-core/src/docs/surfaced-manifest.ts
|
|
10073
|
+
var NO_MODEL_BACKED_PATHS = new Set;
|
|
10074
|
+
// src/roles/contract.ts
|
|
10075
|
+
import matter3 from "gray-matter";
|
|
10076
|
+
|
|
10077
|
+
// src/commands/doctrine.ts
|
|
9495
10078
|
var ENTRY_SEGMENTS = ["skills", "aeg", "SKILL.md"];
|
|
9496
10079
|
function resolveDoctrineRoot(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
|
|
9497
10080
|
return resolveDoctrineRootInfo(pkg, cwd)?.root ?? null;
|
|
@@ -9513,8 +10096,8 @@ function resolveDoctrineRootInfo(pkg = packageRoot(import.meta.url), cwd = proce
|
|
|
9513
10096
|
if (existsSync6(join7(treeRoot, "roles")))
|
|
9514
10097
|
return { root: treeRoot, source: "tree" };
|
|
9515
10098
|
}
|
|
9516
|
-
const fromSource = !pkg.split(
|
|
9517
|
-
const bundleRoot = fromSource ? join7(
|
|
10099
|
+
const fromSource = !pkg.split(sep2).includes("node_modules");
|
|
10100
|
+
const bundleRoot = fromSource ? join7(dirname7(dirname7(pkg)), "aeg-root") : join7(pkg, "aeg-root");
|
|
9518
10101
|
return hasDoctrineEntry(bundleRoot) ? { root: bundleRoot, source: "bundle" } : null;
|
|
9519
10102
|
}
|
|
9520
10103
|
function hasDoctrineEntry(root) {
|
|
@@ -9547,150 +10130,6 @@ var INFORMATIONAL_DISPATCH_BLOCKER_CLASSES = new Set([
|
|
|
9547
10130
|
"conflicts-with"
|
|
9548
10131
|
]);
|
|
9549
10132
|
|
|
9550
|
-
// src/commands/review-post.ts
|
|
9551
|
-
function parseChangedLineRanges(diffOutput) {
|
|
9552
|
-
const result = {};
|
|
9553
|
-
let currentFile = null;
|
|
9554
|
-
for (const line of diffOutput.split(`
|
|
9555
|
-
`)) {
|
|
9556
|
-
if (line.startsWith("+++ ")) {
|
|
9557
|
-
const path = line.slice(4).trim();
|
|
9558
|
-
currentFile = path === "/dev/null" ? null : path.replace(/^b\//, "");
|
|
9559
|
-
continue;
|
|
9560
|
-
}
|
|
9561
|
-
if (line.startsWith("@@") && currentFile) {
|
|
9562
|
-
const m = line.match(/^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/);
|
|
9563
|
-
if (m) {
|
|
9564
|
-
const start = Number(m[1]);
|
|
9565
|
-
const count = m[2] !== undefined ? Number(m[2]) : 1;
|
|
9566
|
-
if (count > 0) {
|
|
9567
|
-
if (!result[currentFile])
|
|
9568
|
-
result[currentFile] = [];
|
|
9569
|
-
result[currentFile].push([start, start + count - 1]);
|
|
9570
|
-
}
|
|
9571
|
-
}
|
|
9572
|
-
}
|
|
9573
|
-
}
|
|
9574
|
-
return result;
|
|
9575
|
-
}
|
|
9576
|
-
|
|
9577
|
-
// src/lib/diff-evidence.ts
|
|
9578
|
-
function fileDiffAgainst(ref, path) {
|
|
9579
|
-
let out;
|
|
9580
|
-
try {
|
|
9581
|
-
out = execFileSync7("git", ["diff", `${ref}...HEAD`, "--", path], {
|
|
9582
|
-
encoding: "utf8",
|
|
9583
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
9584
|
-
}).trim();
|
|
9585
|
-
} catch {
|
|
9586
|
-
return null;
|
|
9587
|
-
}
|
|
9588
|
-
return out === "" ? null : out;
|
|
9589
|
-
}
|
|
9590
|
-
function revParse(ref) {
|
|
9591
|
-
try {
|
|
9592
|
-
return execFileSync7("git", ["rev-parse", "--verify", ref], {
|
|
9593
|
-
encoding: "utf8",
|
|
9594
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
9595
|
-
}).trim();
|
|
9596
|
-
} catch {
|
|
9597
|
-
return null;
|
|
9598
|
-
}
|
|
9599
|
-
}
|
|
9600
|
-
function repoRoot() {
|
|
9601
|
-
try {
|
|
9602
|
-
return execFileSync7("git", ["rev-parse", "--show-toplevel"], {
|
|
9603
|
-
encoding: "utf8",
|
|
9604
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
9605
|
-
}).trim();
|
|
9606
|
-
} catch {
|
|
9607
|
-
return null;
|
|
9608
|
-
}
|
|
9609
|
-
}
|
|
9610
|
-
function changedFiles(base) {
|
|
9611
|
-
let out;
|
|
9612
|
-
try {
|
|
9613
|
-
out = execFileSync7("git", ["diff", "--name-only", `${base}...HEAD`], {
|
|
9614
|
-
encoding: "utf8",
|
|
9615
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
9616
|
-
}).trim();
|
|
9617
|
-
} catch {
|
|
9618
|
-
return null;
|
|
9619
|
-
}
|
|
9620
|
-
return out === "" ? [] : out.split(`
|
|
9621
|
-
`).map((s) => s.trim()).filter(Boolean);
|
|
9622
|
-
}
|
|
9623
|
-
function resolveChangedFiles(base = process.env.BASE_SHA || "origin/main") {
|
|
9624
|
-
return resolveDiff(base)?.files ?? null;
|
|
9625
|
-
}
|
|
9626
|
-
function resolveDiff(base = process.env.BASE_SHA || "origin/main") {
|
|
9627
|
-
const root = repoRoot();
|
|
9628
|
-
if (root === null)
|
|
9629
|
-
return null;
|
|
9630
|
-
const head = revParse("HEAD");
|
|
9631
|
-
for (const ref of [base, "main"]) {
|
|
9632
|
-
const resolved = revParse(ref);
|
|
9633
|
-
if (resolved === null || resolved === head)
|
|
9634
|
-
continue;
|
|
9635
|
-
const relPaths = changedFiles(ref);
|
|
9636
|
-
if (relPaths === null)
|
|
9637
|
-
continue;
|
|
9638
|
-
return { base: ref, root, files: relPaths.map((p) => join9(root, p)) };
|
|
9639
|
-
}
|
|
9640
|
-
return null;
|
|
9641
|
-
}
|
|
9642
|
-
function changedLineRanges(ref, path) {
|
|
9643
|
-
const diff = fileDiffAgainst(ref, path);
|
|
9644
|
-
if (diff === null)
|
|
9645
|
-
return null;
|
|
9646
|
-
return parseChangedLineRanges(diff)[path] ?? null;
|
|
9647
|
-
}
|
|
9648
|
-
function lineIsInRanges(line, ranges) {
|
|
9649
|
-
return ranges.some(([start, end]) => line >= start && line <= end);
|
|
9650
|
-
}
|
|
9651
|
-
function findingsInThisDiff(findings) {
|
|
9652
|
-
const diff = resolveDiff();
|
|
9653
|
-
if (diff === null)
|
|
9654
|
-
return [...findings];
|
|
9655
|
-
const changed = new Set(diff.files);
|
|
9656
|
-
const ranges = new Map;
|
|
9657
|
-
return findings.filter((f) => {
|
|
9658
|
-
const abs = resolve2(diff.root, f.file);
|
|
9659
|
-
if (!changed.has(abs))
|
|
9660
|
-
return false;
|
|
9661
|
-
const relPath = relative(diff.root, abs);
|
|
9662
|
-
if (!ranges.has(relPath))
|
|
9663
|
-
ranges.set(relPath, changedLineRanges(diff.base, relPath));
|
|
9664
|
-
const fileRanges = ranges.get(relPath) ?? null;
|
|
9665
|
-
return fileRanges === null ? true : lineIsInRanges(f.line, fileRanges);
|
|
9666
|
-
});
|
|
9667
|
-
}
|
|
9668
|
-
|
|
9669
|
-
// src/lib/dispatch.ts
|
|
9670
|
-
var MAX_TEE_BYTES = 8 * 1024 * 1024;
|
|
9671
|
-
var CLAUDE_MODEL_ALIASES = new Set(["fable", "opus", "sonnet", "haiku"]);
|
|
9672
|
-
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)";
|
|
9673
|
-
|
|
9674
|
-
// src/commands/tokens.ts
|
|
9675
|
-
var USAGE = [
|
|
9676
|
-
'Usage: vinaya tokens --phase "<task-id>: develop" --role Developer',
|
|
9677
|
-
" [--model <id>] [--transcript <path>] [--in <tokens-in> --out <tokens-out>]",
|
|
9678
|
-
"",
|
|
9679
|
-
" --transcript Read this transcript directly. Supported primary route — use it whenever you know",
|
|
9680
|
-
" which transcript is yours, and always in a repo with no track-transcript.sh hook.",
|
|
9681
|
-
" (omitted) Resolve via the Stop-hook pointer file, if this repo installs that hook.",
|
|
9682
|
-
" --in/--out Manual entry: the exact token figures, for a host whose usage arrives by some other",
|
|
9683
|
-
" means than a Claude Code transcript. Both required together; skips transcript",
|
|
9684
|
-
" resolution entirely.",
|
|
9685
|
-
"",
|
|
9686
|
-
"Usage: vinaya tokens --trust-collect",
|
|
9687
|
-
" Approves this repo's declared tokens.collect command, pinned to the script's exact current",
|
|
9688
|
-
" content, on this machine. Run this once before tokens.collect will ever execute — a changed",
|
|
9689
|
-
" interpreter, script path, or script CONTENT needs its own fresh approval. Does not take",
|
|
9690
|
-
" --phase/--role and never emits a Tokens: line."
|
|
9691
|
-
].join(`
|
|
9692
|
-
`);
|
|
9693
|
-
|
|
9694
10133
|
// src/lib/pr-report-engine.ts
|
|
9695
10134
|
var execFileAsync6 = promisify6(execFile6);
|
|
9696
10135
|
var BODY_READING_CHECK_NAMES = new Set(coreCheckRegistry().filter((spec) => {
|
|
@@ -9717,39 +10156,21 @@ function agentCommandText(line) {
|
|
|
9717
10156
|
return (idx === -1 ? line : line.slice(0, idx)).trim();
|
|
9718
10157
|
}
|
|
9719
10158
|
var AGENT_COMMAND_MAX_BUFFER_BYTES = 32 * 1024 * 1024;
|
|
9720
|
-
var TOKEN_ROW_REMEDY = [
|
|
9721
|
-
"Nothing here established that this host cannot meter — only that this session resolved no",
|
|
9722
|
-
"transcript of its own. Report real figures by naming your own transcript:",
|
|
9723
|
-
"",
|
|
9724
|
-
" vinaya pr report --write <body-file> --transcript <path>",
|
|
9725
|
-
"",
|
|
9726
|
-
"or, on a host whose usage arrives by some other means, format figures you already hold with:",
|
|
9727
|
-
"",
|
|
9728
|
-
' vinaya tokens --phase "<task-id>: develop" --role Developer --in <tokens-in> --out <tokens-out>',
|
|
9729
|
-
"",
|
|
9730
|
-
"and transcribe them into the `## Token report` table. That command prints a `Tokens:` line, not",
|
|
9731
|
-
"a table row — the table takes | Phase | Role | Agent/Model | Tokens in | Tokens out | Cost | Date |,",
|
|
9732
|
-
"and a line inside the block that does not start with `|` truncates the table for every row after it."
|
|
9733
|
-
].join(`
|
|
9734
|
-
`);
|
|
9735
|
-
// src/commands/pr-report.ts
|
|
9736
|
-
var USAGE2 = "Usage: vinaya pr report [--write <body-file> | --push <pr> [--body-file <path>]] [--phase <phase>] " + "[--role <role>] [--model <id>] [--transcript <path>]";
|
|
9737
|
-
|
|
9738
10159
|
// src/lib/patch-id.ts
|
|
9739
|
-
import { execFileSync as
|
|
10160
|
+
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
9740
10161
|
function patchIdAt(base, sha) {
|
|
9741
10162
|
try {
|
|
9742
|
-
|
|
10163
|
+
execFileSync7("git", ["fetch", "--quiet", "origin", sha], { stdio: ["ignore", "ignore", "ignore"] });
|
|
9743
10164
|
} catch {}
|
|
9744
10165
|
try {
|
|
9745
|
-
const diff =
|
|
10166
|
+
const diff = execFileSync7("git", ["diff", `origin/${base}...${sha}`], {
|
|
9746
10167
|
encoding: "utf8",
|
|
9747
10168
|
maxBuffer: 64 * 1024 * 1024,
|
|
9748
10169
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9749
10170
|
});
|
|
9750
10171
|
if (diff === "")
|
|
9751
10172
|
return null;
|
|
9752
|
-
const out =
|
|
10173
|
+
const out = execFileSync7("git", ["patch-id", "--stable"], {
|
|
9753
10174
|
input: diff,
|
|
9754
10175
|
encoding: "utf8",
|
|
9755
10176
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -9861,7 +10282,7 @@ function compareEvidenceBlock(resolved, resolvedHead, actualNumstat, expectedGro
|
|
|
9861
10282
|
var DEVELOPER_ROUND_MARKER = /<!--\s*aeg:developer:round-\d+\s*-->/i;
|
|
9862
10283
|
function fetchHasPriorDeveloperRound(prNumber) {
|
|
9863
10284
|
try {
|
|
9864
|
-
const out =
|
|
10285
|
+
const out = execFileSync8("gh", ["pr", "view", String(prNumber), "--json", "comments"], {
|
|
9865
10286
|
encoding: "utf8",
|
|
9866
10287
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9867
10288
|
});
|
|
@@ -9875,7 +10296,7 @@ function fetchHasPriorDeveloperRound(prNumber) {
|
|
|
9875
10296
|
var CHECK_NAME = "evidence-fresh";
|
|
9876
10297
|
function git2(args) {
|
|
9877
10298
|
try {
|
|
9878
|
-
return
|
|
10299
|
+
return execFileSync8("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
9879
10300
|
} catch {
|
|
9880
10301
|
return "";
|
|
9881
10302
|
}
|
|
@@ -9894,7 +10315,7 @@ class GitCommandError2 extends Error {
|
|
|
9894
10315
|
}
|
|
9895
10316
|
function gitStrict(args) {
|
|
9896
10317
|
try {
|
|
9897
|
-
return
|
|
10318
|
+
return execFileSync8("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
9898
10319
|
} catch (err) {
|
|
9899
10320
|
const stderr = err.stderr;
|
|
9900
10321
|
throw new GitCommandError2(args, String(stderr ?? err.message).trim() || "non-zero exit");
|
|
@@ -9912,7 +10333,7 @@ function resolveMergeBase(head) {
|
|
|
9912
10333
|
}
|
|
9913
10334
|
function fetchPrRefs(prNumber) {
|
|
9914
10335
|
try {
|
|
9915
|
-
const out =
|
|
10336
|
+
const out = execFileSync8("gh", ["pr", "view", String(prNumber), "--json", "headRefOid,baseRefName"], {
|
|
9916
10337
|
encoding: "utf8",
|
|
9917
10338
|
stdio: ["ignore", "pipe", "pipe"]
|
|
9918
10339
|
});
|