@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
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
// src/checks/bin/check-registry-gates.ts
|
|
4
4
|
import { execSync, execFileSync as execFileSync2 } from "node:child_process";
|
|
5
|
-
import { existsSync as existsSync3, readdirSync, readFileSync as
|
|
5
|
+
import { existsSync as existsSync3, readdirSync as readdirSync3, readFileSync as readFileSync5 } from "node:fs";
|
|
6
|
+
import { join as join5 } from "node:path";
|
|
6
7
|
import matter2 from "gray-matter";
|
|
7
8
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
8
9
|
var GATE_AUDIENCE = {
|
|
@@ -629,6 +630,33 @@ function tasksFromIssues(issues) {
|
|
|
629
630
|
}
|
|
630
631
|
return tasks.sort((a, b) => compareTaskIds(a.id, b.id));
|
|
631
632
|
}
|
|
633
|
+
function resolveDuplicateTasks(tasks, isOpen) {
|
|
634
|
+
const byId = new Map;
|
|
635
|
+
for (const t of tasks)
|
|
636
|
+
byId.set(t.id, [...byId.get(t.id) ?? [], t]);
|
|
637
|
+
const resolved = [];
|
|
638
|
+
const conflicts = [];
|
|
639
|
+
for (const [id, group] of byId) {
|
|
640
|
+
const first = group[0];
|
|
641
|
+
if (!first)
|
|
642
|
+
continue;
|
|
643
|
+
if (group.length === 1) {
|
|
644
|
+
resolved.push(first);
|
|
645
|
+
continue;
|
|
646
|
+
}
|
|
647
|
+
const number = (t) => t.issue ?? 0;
|
|
648
|
+
const open = group.filter((t) => t.issue !== null && isOpen(t.issue)).sort((a, b) => number(a) - number(b));
|
|
649
|
+
if (open.length > 1) {
|
|
650
|
+
conflicts.push({ id, issues: open.map(number) });
|
|
651
|
+
resolved.push(open[0]);
|
|
652
|
+
} else if (open.length === 1) {
|
|
653
|
+
resolved.push(open[0]);
|
|
654
|
+
} else {
|
|
655
|
+
resolved.push([...group].sort((a, b) => number(b) - number(a))[0]);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
return { tasks: resolved.sort((a, b) => compareTaskIds(a.id, b.id)), conflicts };
|
|
659
|
+
}
|
|
632
660
|
async function fetchTrancheIssuesAsync(owner, repo, slug) {
|
|
633
661
|
return ghIssueListByAnyLabelAsync(owner, repo, [trancheLabel(slug)]);
|
|
634
662
|
}
|
|
@@ -1436,7 +1464,7 @@ function mapReviewDecision(decision) {
|
|
|
1436
1464
|
function buildBranchName(tranche, taskId) {
|
|
1437
1465
|
return `task/${tranche}/${taskId}`;
|
|
1438
1466
|
}
|
|
1439
|
-
async function
|
|
1467
|
+
async function fetchForgeFactsByIssue(input) {
|
|
1440
1468
|
const token = await resolveGithubToken(input.token);
|
|
1441
1469
|
if (!token) {
|
|
1442
1470
|
return {
|
|
@@ -1446,7 +1474,13 @@ async function fetchForgeFacts(input) {
|
|
|
1446
1474
|
reason: "No GitHub token available (set GITHUB_TOKEN/GH_TOKEN or `gh auth login`)."
|
|
1447
1475
|
};
|
|
1448
1476
|
}
|
|
1449
|
-
const
|
|
1477
|
+
const seen = new Set;
|
|
1478
|
+
const queriedTasks = input.tasks.filter((t) => {
|
|
1479
|
+
if (t.issue === null || seen.has(t.issue))
|
|
1480
|
+
return false;
|
|
1481
|
+
seen.add(t.issue);
|
|
1482
|
+
return true;
|
|
1483
|
+
});
|
|
1450
1484
|
if (queriedTasks.length === 0) {
|
|
1451
1485
|
return { facts: new Map, prRefs: new Map, unavailable: false };
|
|
1452
1486
|
}
|
|
@@ -1474,21 +1508,52 @@ async function fetchForgeFacts(input) {
|
|
|
1474
1508
|
};
|
|
1475
1509
|
}
|
|
1476
1510
|
for (const task of queriedTasks) {
|
|
1477
|
-
const
|
|
1478
|
-
const raw = extractRawFromResponse(response.repository, alias);
|
|
1511
|
+
const raw = extractRawFromResponse(response.repository, aliasFor(task.issue));
|
|
1479
1512
|
const mapped = mapForgeFacts(raw);
|
|
1480
1513
|
if (mapped)
|
|
1481
|
-
facts.set(task.
|
|
1514
|
+
facts.set(task.issue, mapped);
|
|
1482
1515
|
const pr = raw.pullRequest;
|
|
1483
1516
|
if (pr && typeof pr.number === "number" && typeof pr.url === "string") {
|
|
1484
|
-
prRefs.set(task.
|
|
1517
|
+
prRefs.set(task.issue, { number: pr.number, url: pr.url, state: pr.state });
|
|
1485
1518
|
}
|
|
1486
1519
|
}
|
|
1487
1520
|
return { facts, prRefs, unavailable: false };
|
|
1488
1521
|
}
|
|
1522
|
+
async function fetchForgeFacts(input) {
|
|
1523
|
+
const byIssue = await fetchForgeFactsByIssue(input);
|
|
1524
|
+
if (byIssue.unavailable) {
|
|
1525
|
+
return { facts: new Map, prRefs: new Map, unavailable: true, reason: byIssue.reason };
|
|
1526
|
+
}
|
|
1527
|
+
const facts = new Map;
|
|
1528
|
+
const prRefs = new Map;
|
|
1529
|
+
const winner = new Map;
|
|
1530
|
+
for (const task of input.tasks) {
|
|
1531
|
+
if (task.issue === null)
|
|
1532
|
+
continue;
|
|
1533
|
+
const current = winner.get(task.id);
|
|
1534
|
+
if (current === undefined || outranks(byIssue.facts, task.issue, current))
|
|
1535
|
+
winner.set(task.id, task.issue);
|
|
1536
|
+
}
|
|
1537
|
+
for (const [taskId, issue] of winner) {
|
|
1538
|
+
const f = byIssue.facts.get(issue);
|
|
1539
|
+
if (f)
|
|
1540
|
+
facts.set(taskId, f);
|
|
1541
|
+
const pr = byIssue.prRefs.get(issue);
|
|
1542
|
+
if (pr)
|
|
1543
|
+
prRefs.set(taskId, pr);
|
|
1544
|
+
}
|
|
1545
|
+
return { facts, prRefs, unavailable: false };
|
|
1546
|
+
}
|
|
1547
|
+
function outranks(facts, candidate, current) {
|
|
1548
|
+
const candidateOpen = facts.get(candidate)?.issueState === "open";
|
|
1549
|
+
const currentOpen = facts.get(current)?.issueState === "open";
|
|
1550
|
+
if (candidateOpen !== currentOpen)
|
|
1551
|
+
return candidateOpen;
|
|
1552
|
+
return candidate > current;
|
|
1553
|
+
}
|
|
1489
1554
|
function buildBatchQuery(tranche, tasks) {
|
|
1490
1555
|
const perTask = tasks.map((task) => {
|
|
1491
|
-
const a = aliasFor(task.
|
|
1556
|
+
const a = aliasFor(task.issue);
|
|
1492
1557
|
const branch = buildBranchName(tranche, task.id);
|
|
1493
1558
|
return `
|
|
1494
1559
|
${a}_issue: issue(number: ${task.issue}) {
|
|
@@ -1530,9 +1595,8 @@ function buildBatchQuery(tranche, tasks) {
|
|
|
1530
1595
|
}
|
|
1531
1596
|
}`;
|
|
1532
1597
|
}
|
|
1533
|
-
function aliasFor(
|
|
1534
|
-
|
|
1535
|
-
return `t_${sanitized}`;
|
|
1598
|
+
function aliasFor(issue) {
|
|
1599
|
+
return `i_${issue}`;
|
|
1536
1600
|
}
|
|
1537
1601
|
function extractRawFromResponse(repository, alias) {
|
|
1538
1602
|
const issue = repository[`${alias}_issue`];
|
|
@@ -1887,45 +1951,6 @@ var DERIVED_STATUSES = [
|
|
|
1887
1951
|
"incoherent"
|
|
1888
1952
|
];
|
|
1889
1953
|
var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
|
|
1890
|
-
// ../../packages/aeg-core/src/parse-ledger.ts
|
|
1891
|
-
function rowFromCells(cells) {
|
|
1892
|
-
if (cells.length < 7)
|
|
1893
|
-
return null;
|
|
1894
|
-
const phase = (cells[0] ?? "").trim();
|
|
1895
|
-
if (!phase)
|
|
1896
|
-
return null;
|
|
1897
|
-
return {
|
|
1898
|
-
phase,
|
|
1899
|
-
role: (cells[1] ?? "").trim(),
|
|
1900
|
-
agentModel: (cells[2] ?? "").trim(),
|
|
1901
|
-
tokensIn: parseIntCell(cells[3] ?? ""),
|
|
1902
|
-
tokensOut: parseIntCell(cells[4] ?? ""),
|
|
1903
|
-
cost: parseCostCell(cells[5] ?? ""),
|
|
1904
|
-
date: (cells[6] ?? "").trim()
|
|
1905
|
-
};
|
|
1906
|
-
}
|
|
1907
|
-
function parseIntCell(cell) {
|
|
1908
|
-
const trimmed = cell.replace(/`/g, "").trim();
|
|
1909
|
-
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1910
|
-
return null;
|
|
1911
|
-
const normalized = trimmed.replace(/[,_\s]/g, "");
|
|
1912
|
-
if (!/^-?\d+$/.test(normalized))
|
|
1913
|
-
return null;
|
|
1914
|
-
return Number(normalized);
|
|
1915
|
-
}
|
|
1916
|
-
function parseCostCell(cell) {
|
|
1917
|
-
const trimmed = cell.replace(/`/g, "").trim();
|
|
1918
|
-
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1919
|
-
return null;
|
|
1920
|
-
const normalized = trimmed.replace(/^\$/, "").replace(/[,_\s]/g, "");
|
|
1921
|
-
if (!/^-?\d+(\.\d+)?$/.test(normalized))
|
|
1922
|
-
return null;
|
|
1923
|
-
return Number(normalized);
|
|
1924
|
-
}
|
|
1925
|
-
function isEmDashOrDash(s) {
|
|
1926
|
-
const t = s.trim();
|
|
1927
|
-
return t === "—" || t === "-" || t === "–";
|
|
1928
|
-
}
|
|
1929
1954
|
// ../../packages/aeg-core/src/waiver-label.ts
|
|
1930
1955
|
var WAIVER_LABEL = label("waiver-docs");
|
|
1931
1956
|
var WAIVER_LABEL_REVIEW = label("waiver-review");
|
|
@@ -1941,61 +1966,6 @@ function isWaiverLabelActorVerified(opts) {
|
|
|
1941
1966
|
return false;
|
|
1942
1967
|
return isPrincipal(opts.labelActor, opts.principalAllowlist);
|
|
1943
1968
|
}
|
|
1944
|
-
|
|
1945
|
-
// ../../packages/aeg-core/src/parse-token-report.ts
|
|
1946
|
-
var TOKEN_REPORT_HEADING = /^\s*(?:#{1,6}\s*Token report\s*|\*\*Token report\*\*)\s*$/i;
|
|
1947
|
-
var INLINE_FIELD_LIST = /Phase:\s*([^|]+?)\s*\|\s*Role:\s*([^|]+?)\s*\|\s*Agent\/Model:\s*([^|]+?)\s*\|\s*Tokens in:\s*([^|]+?)\s*\|\s*Tokens out:\s*([^|]+?)\s*\|\s*Cost:\s*([^|]+?)\s*\|\s*Date:\s*(.+?)\s*$/im;
|
|
1948
|
-
function parseTokenReportEntries(body) {
|
|
1949
|
-
const lines = body.split(/\r?\n/);
|
|
1950
|
-
const headingIdxs = [];
|
|
1951
|
-
lines.forEach((line, i) => {
|
|
1952
|
-
if (TOKEN_REPORT_HEADING.test(line))
|
|
1953
|
-
headingIdxs.push(i);
|
|
1954
|
-
});
|
|
1955
|
-
const out = [];
|
|
1956
|
-
for (let h = 0;h < headingIdxs.length; h++) {
|
|
1957
|
-
const start = headingIdxs[h] + 1;
|
|
1958
|
-
const end = h + 1 < headingIdxs.length ? headingIdxs[h + 1] : lines.length;
|
|
1959
|
-
const section = lines.slice(start, end).join(`
|
|
1960
|
-
`);
|
|
1961
|
-
const tableRows = parseTableSection(section);
|
|
1962
|
-
if (tableRows.length > 0) {
|
|
1963
|
-
out.push(...tableRows);
|
|
1964
|
-
continue;
|
|
1965
|
-
}
|
|
1966
|
-
const inlineRow = parseInlineFieldList(section);
|
|
1967
|
-
if (inlineRow)
|
|
1968
|
-
out.push(inlineRow);
|
|
1969
|
-
}
|
|
1970
|
-
return out;
|
|
1971
|
-
}
|
|
1972
|
-
function parseTableSection(section) {
|
|
1973
|
-
const lines = section.split(/\r?\n/);
|
|
1974
|
-
let i = 0;
|
|
1975
|
-
for (;i < lines.length; i++) {
|
|
1976
|
-
if ((lines[i] ?? "").trim().startsWith("|"))
|
|
1977
|
-
break;
|
|
1978
|
-
}
|
|
1979
|
-
if (i + 1 >= lines.length)
|
|
1980
|
-
return [];
|
|
1981
|
-
i += 2;
|
|
1982
|
-
const out = [];
|
|
1983
|
-
for (;i < lines.length; i++) {
|
|
1984
|
-
const trimmed = (lines[i] ?? "").trim();
|
|
1985
|
-
if (!trimmed.startsWith("|"))
|
|
1986
|
-
break;
|
|
1987
|
-
const row = rowFromCells(splitTableRow(trimmed));
|
|
1988
|
-
if (row)
|
|
1989
|
-
out.push(row);
|
|
1990
|
-
}
|
|
1991
|
-
return out;
|
|
1992
|
-
}
|
|
1993
|
-
function parseInlineFieldList(section) {
|
|
1994
|
-
const m = section.match(INLINE_FIELD_LIST);
|
|
1995
|
-
if (!m)
|
|
1996
|
-
return null;
|
|
1997
|
-
return rowFromCells([m[1], m[2], m[3], m[4], m[5], m[6], m[7]]);
|
|
1998
|
-
}
|
|
1999
1969
|
// ../../packages/aeg-core/src/verdict-extraction.ts
|
|
2000
1970
|
var HEAD_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged head:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
2001
1971
|
var OBJECTIVES_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Objectives version:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
@@ -2444,10 +2414,12 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive,
|
|
|
2444
2414
|
var CODE_REVIEW_SEVERITY_ORDER = ["BLOCKER", "MAJOR", "MINOR"];
|
|
2445
2415
|
var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
|
|
2446
2416
|
var DEFAULT_MAX_ROUNDS = 3;
|
|
2417
|
+
var DEFAULT_MAX_TASK_MINUTES = 180;
|
|
2447
2418
|
var DEFAULT_REVIEW_POLICY = {
|
|
2448
2419
|
codeReviewThreshold: "BLOCKER",
|
|
2449
2420
|
securityThreshold: "HIGH",
|
|
2450
|
-
maxRounds: DEFAULT_MAX_ROUNDS
|
|
2421
|
+
maxRounds: DEFAULT_MAX_ROUNDS,
|
|
2422
|
+
maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES
|
|
2451
2423
|
};
|
|
2452
2424
|
var FILE_SHAPED_LOCATION = /\.[a-zA-Z0-9]{1,10}(:\d+)?\s*$/;
|
|
2453
2425
|
var PROSE_LOCATION_PATTERNS = [/\bpr\s*body\b/i, /\bcomment\b/i];
|
|
@@ -2455,6 +2427,9 @@ var ROLE_FILE_LOCATION = /(^|\/)aeg-root\/roles\//i;
|
|
|
2455
2427
|
function isProseLocation(location) {
|
|
2456
2428
|
if (ROLE_FILE_LOCATION.test(location))
|
|
2457
2429
|
return true;
|
|
2430
|
+
return isBodyOrCommentLocation(location);
|
|
2431
|
+
}
|
|
2432
|
+
function isBodyOrCommentLocation(location) {
|
|
2458
2433
|
if (FILE_SHAPED_LOCATION.test(location))
|
|
2459
2434
|
return false;
|
|
2460
2435
|
return PROSE_LOCATION_PATTERNS.some((pattern) => pattern.test(location));
|
|
@@ -2481,7 +2456,7 @@ function classifyFinding(finding, scale, threshold, context = {}) {
|
|
|
2481
2456
|
const wouldBlock = blockingSeverities(scale, threshold).includes(effectiveSeverity);
|
|
2482
2457
|
if (!wouldBlock)
|
|
2483
2458
|
return { outcome: "non_blocking", deferralReason: null };
|
|
2484
|
-
const hasLocation = location !== undefined && location.length > 0;
|
|
2459
|
+
const hasLocation = location !== undefined && location.length > 0 && !isBodyOrCommentLocation(location);
|
|
2485
2460
|
if (hasLocation && context.inSurface && !context.inSurface(location)) {
|
|
2486
2461
|
return { outcome: "deferred", deferralReason: "outside-surface" };
|
|
2487
2462
|
}
|
|
@@ -2848,11 +2823,13 @@ function checkDocUpdateList(prBody) {
|
|
|
2848
2823
|
return headingCheck(prBody, "(?:documentation|doc)[- ]update(?:\\s+list)?", "Documentation-update list");
|
|
2849
2824
|
}
|
|
2850
2825
|
function checkWorktreeStep0(prBody) {
|
|
2851
|
-
if (/git worktree add/.test(prBody))
|
|
2826
|
+
if (/git worktree add/.test(prBody) || /cd \.worktrees\//.test(prBody) || /bun install --frozen-lockfile/.test(prBody))
|
|
2852
2827
|
return { status: "pass", errors: [] };
|
|
2853
2828
|
return {
|
|
2854
2829
|
status: "fail",
|
|
2855
|
-
errors: [
|
|
2830
|
+
errors: [
|
|
2831
|
+
"brief-validation worktree Step 0: no `git worktree add`, `cd .worktrees/`, or `bun install --frozen-lockfile` command found in the PR body."
|
|
2832
|
+
]
|
|
2856
2833
|
};
|
|
2857
2834
|
}
|
|
2858
2835
|
function checkStopConditions(prBody) {
|
|
@@ -3042,7 +3019,8 @@ function isCommandBlock(content) {
|
|
|
3042
3019
|
return COMMAND_WORDS.includes(commandWordOf(firstNonBlankLine(content)));
|
|
3043
3020
|
}
|
|
3044
3021
|
function isStep0Block(content) {
|
|
3045
|
-
|
|
3022
|
+
const first = firstNonBlankLine(content);
|
|
3023
|
+
return first.startsWith("git worktree add") || first.startsWith("cd .worktrees/") || first.startsWith("bun install --frozen-lockfile");
|
|
3046
3024
|
}
|
|
3047
3025
|
function checkCommandsCarryOutput(prBody) {
|
|
3048
3026
|
const errors = [];
|
|
@@ -3511,10 +3489,14 @@ function legacySlugPattern(legacySlugs) {
|
|
|
3511
3489
|
const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
3512
3490
|
return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
|
|
3513
3491
|
}
|
|
3492
|
+
function specGrandfatherPaths(specGrandfather) {
|
|
3493
|
+
return Array.isArray(specGrandfather) ? [...specGrandfather] : Object.keys(specGrandfather);
|
|
3494
|
+
}
|
|
3514
3495
|
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
3515
3496
|
const findings = [];
|
|
3516
3497
|
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
3517
|
-
const
|
|
3498
|
+
const grandfatheredWhole = new Set(Array.isArray(specGrandfather) ? specGrandfather : []);
|
|
3499
|
+
const limits = new Map(Array.isArray(specGrandfather) ? [] : Object.entries(specGrandfather));
|
|
3518
3500
|
const patterns = [
|
|
3519
3501
|
{ pattern: FORGE_NUMBER_PATTERN, what: "a forge number" },
|
|
3520
3502
|
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
|
|
@@ -3533,18 +3515,19 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
3533
3515
|
continue;
|
|
3534
3516
|
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
3535
3517
|
continue;
|
|
3536
|
-
if (cls === "spec" &&
|
|
3518
|
+
if (cls === "spec" && grandfatheredWhole.has(file.path))
|
|
3537
3519
|
continue;
|
|
3538
3520
|
const blocking = cls === "product" || cls === "spec";
|
|
3539
3521
|
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
3540
3522
|
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
3523
|
+
const fileFindings = [];
|
|
3541
3524
|
for (const { pattern, what, group } of patternsToRun) {
|
|
3542
3525
|
pattern.lastIndex = 0;
|
|
3543
3526
|
let match = pattern.exec(scrubbed);
|
|
3544
3527
|
while (match !== null) {
|
|
3545
3528
|
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
3546
3529
|
const citedIndex = match.index + match[0].indexOf(cited);
|
|
3547
|
-
|
|
3530
|
+
fileFindings.push({
|
|
3548
3531
|
file: file.path,
|
|
3549
3532
|
line: lineAt(scrubbed, citedIndex),
|
|
3550
3533
|
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
@@ -3553,6 +3536,15 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
3553
3536
|
match = pattern.exec(scrubbed);
|
|
3554
3537
|
}
|
|
3555
3538
|
}
|
|
3539
|
+
const limit = cls === "spec" ? limits.get(file.path) : undefined;
|
|
3540
|
+
if (limit !== undefined) {
|
|
3541
|
+
if (fileFindings.length <= limit)
|
|
3542
|
+
continue;
|
|
3543
|
+
for (const f of fileFindings) {
|
|
3544
|
+
f.message += `; ${file.path} carries ${fileFindings.length} such findings, over its proseGates.specGrandfather limit of ${limit}`;
|
|
3545
|
+
}
|
|
3546
|
+
}
|
|
3547
|
+
findings.push(...fileFindings);
|
|
3556
3548
|
}
|
|
3557
3549
|
return findings;
|
|
3558
3550
|
}
|
|
@@ -4134,6 +4126,8 @@ var FILE_EXTENSIONS = new Set([
|
|
|
4134
4126
|
"html",
|
|
4135
4127
|
"css"
|
|
4136
4128
|
]);
|
|
4129
|
+
var CI_SHARD_DIR = "apps/cli/tests/ci-shards";
|
|
4130
|
+
var CI_SHARD_PROBE = `${CI_SHARD_DIR}/shard-1.txt`;
|
|
4137
4131
|
|
|
4138
4132
|
// ../../packages/aeg-core/src/task-branch-identity.ts
|
|
4139
4133
|
var ISSUE_BRANCH_PATTERN = /^task\/issue-(\d+)$/;
|
|
@@ -4512,8 +4506,7 @@ function briefHash(brief) {
|
|
|
4512
4506
|
function policyDigest(policy) {
|
|
4513
4507
|
return createHash4("sha256").update(JSON.stringify({
|
|
4514
4508
|
codeReviewThreshold: policy.codeReviewThreshold,
|
|
4515
|
-
securityThreshold: policy.securityThreshold
|
|
4516
|
-
maxRounds: policy.maxRounds
|
|
4509
|
+
securityThreshold: policy.securityThreshold
|
|
4517
4510
|
})).digest("hex");
|
|
4518
4511
|
}
|
|
4519
4512
|
function isBoundToHead(echoed, headSha) {
|
|
@@ -4826,7 +4819,46 @@ function parseEnforcementRegistry(content) {
|
|
|
4826
4819
|
return result;
|
|
4827
4820
|
}
|
|
4828
4821
|
// ../../packages/aeg-core/src/registry-checks.ts
|
|
4829
|
-
|
|
4822
|
+
var HOOK_DIR_PREFIXES = [".claude/hooks/", ".vinaya/hooks/", ".husky/", ".git/hooks/"];
|
|
4823
|
+
var BARE_HOOK_NAME = /^check-[A-Za-z0-9_.-]*\.sh$/;
|
|
4824
|
+
function basename(path) {
|
|
4825
|
+
return path.slice(path.lastIndexOf("/") + 1);
|
|
4826
|
+
}
|
|
4827
|
+
function lineOf(content, index) {
|
|
4828
|
+
let line = 1;
|
|
4829
|
+
for (let i = 0;i < index; i++)
|
|
4830
|
+
if (content.charCodeAt(i) === 10)
|
|
4831
|
+
line++;
|
|
4832
|
+
return line;
|
|
4833
|
+
}
|
|
4834
|
+
function findUnshippedHookRefs(docs, shipped) {
|
|
4835
|
+
const shippedNames = new Set([...shipped].map(basename));
|
|
4836
|
+
const findings = [];
|
|
4837
|
+
const flag = (doc, token, index) => {
|
|
4838
|
+
findings.push({
|
|
4839
|
+
path: doc.path,
|
|
4840
|
+
reason: `${doc.path}:${lineOf(doc.content, index)} names hook "${token}", which is neither tracked in git nor emitted by \`vinaya init\``
|
|
4841
|
+
});
|
|
4842
|
+
};
|
|
4843
|
+
for (const doc of docs) {
|
|
4844
|
+
for (const { cited, index } of extractCitedPaths(doc.content)) {
|
|
4845
|
+
if (cited.endsWith("/") || !HOOK_DIR_PREFIXES.some((p) => cited.startsWith(p)))
|
|
4846
|
+
continue;
|
|
4847
|
+
if (!shipped.has(cited))
|
|
4848
|
+
flag(doc, cited, index);
|
|
4849
|
+
}
|
|
4850
|
+
const spanPattern = /`([^`\n]+)`/g;
|
|
4851
|
+
let match = spanPattern.exec(doc.content);
|
|
4852
|
+
while (match !== null) {
|
|
4853
|
+
const token = match[1] ?? "";
|
|
4854
|
+
if (BARE_HOOK_NAME.test(token) && !shippedNames.has(token))
|
|
4855
|
+
flag(doc, token, match.index);
|
|
4856
|
+
match = spanPattern.exec(doc.content);
|
|
4857
|
+
}
|
|
4858
|
+
}
|
|
4859
|
+
return findings;
|
|
4860
|
+
}
|
|
4861
|
+
function checkG1(rows, existsFn, hookRefs) {
|
|
4830
4862
|
const findings = [];
|
|
4831
4863
|
for (const row of rows) {
|
|
4832
4864
|
if (row.implementation === "")
|
|
@@ -4839,6 +4871,8 @@ function checkG1(rows, existsFn) {
|
|
|
4839
4871
|
});
|
|
4840
4872
|
}
|
|
4841
4873
|
}
|
|
4874
|
+
if (hookRefs)
|
|
4875
|
+
findings.push(...findUnshippedHookRefs(hookRefs.docs, hookRefs.shipped));
|
|
4842
4876
|
return { check: "G1", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4843
4877
|
}
|
|
4844
4878
|
var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
|
|
@@ -4971,6 +5005,55 @@ function checkG6(rows, registeredCheckNames) {
|
|
|
4971
5005
|
}
|
|
4972
5006
|
return { check: "G6", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4973
5007
|
}
|
|
5008
|
+
function reachesProducer(file, producers, imports) {
|
|
5009
|
+
const seen = new Set([file]);
|
|
5010
|
+
const queue = [file];
|
|
5011
|
+
for (let next = queue.pop();next !== undefined; next = queue.pop()) {
|
|
5012
|
+
if (producers.has(next))
|
|
5013
|
+
return true;
|
|
5014
|
+
for (const dep of imports.get(next) ?? []) {
|
|
5015
|
+
if (!seen.has(dep)) {
|
|
5016
|
+
seen.add(dep);
|
|
5017
|
+
queue.push(dep);
|
|
5018
|
+
}
|
|
5019
|
+
}
|
|
5020
|
+
}
|
|
5021
|
+
return false;
|
|
5022
|
+
}
|
|
5023
|
+
function checkG7(input) {
|
|
5024
|
+
if (!input.enforcementMapPresent)
|
|
5025
|
+
return { check: "G7", status: "info", findings: [] };
|
|
5026
|
+
const subjects = new Set([...input.crossingFiles, ...input.blockingFiles]);
|
|
5027
|
+
const findings = [];
|
|
5028
|
+
for (const path of subjects) {
|
|
5029
|
+
if (path in input.exemptions)
|
|
5030
|
+
continue;
|
|
5031
|
+
if (!reachesProducer(path, input.producers, input.imports)) {
|
|
5032
|
+
findings.push({
|
|
5033
|
+
path,
|
|
5034
|
+
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`
|
|
5035
|
+
});
|
|
5036
|
+
}
|
|
5037
|
+
}
|
|
5038
|
+
for (const [path, reason] of Object.entries(input.exemptions)) {
|
|
5039
|
+
if (reason.trim() === "") {
|
|
5040
|
+
findings.push({ path, reason: `exemption for "${path}" states no reason` });
|
|
5041
|
+
} else if (!input.existsFn(path)) {
|
|
5042
|
+
findings.push({ path, reason: `exemption names "${path}", which no longer exists` });
|
|
5043
|
+
} else if (!subjects.has(path)) {
|
|
5044
|
+
findings.push({
|
|
5045
|
+
path,
|
|
5046
|
+
reason: `exemption names "${path}", which is neither a GitHub-writing file nor a blocking gate's implementation`
|
|
5047
|
+
});
|
|
5048
|
+
} else if (reachesProducer(path, input.producers, input.imports)) {
|
|
5049
|
+
findings.push({
|
|
5050
|
+
path,
|
|
5051
|
+
reason: `exemption names "${path}", which does reach a log producer — remove the exemption`
|
|
5052
|
+
});
|
|
5053
|
+
}
|
|
5054
|
+
}
|
|
5055
|
+
return { check: "G7", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
5056
|
+
}
|
|
4974
5057
|
// ../../packages/aeg-core/src/dead-branch-push-guard.ts
|
|
4975
5058
|
function checkDeadBranchPush(input) {
|
|
4976
5059
|
const { branch, prState, prNumber } = input;
|
|
@@ -5150,6 +5233,11 @@ function checkDispatchReadiness(input) {
|
|
|
5150
5233
|
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.`);
|
|
5151
5234
|
continue;
|
|
5152
5235
|
}
|
|
5236
|
+
if (dep.readFailed === true) {
|
|
5237
|
+
const issueStr = dep.issue !== null ? ` (#${dep.issue})` : "";
|
|
5238
|
+
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.`);
|
|
5239
|
+
continue;
|
|
5240
|
+
}
|
|
5153
5241
|
if (!dep.merged && !isHandClosedByRecognizedPrincipal(dep, principalAllowlist)) {
|
|
5154
5242
|
const issueStr = dep.issue !== null ? ` (#${dep.issue})` : "";
|
|
5155
5243
|
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.`);
|
|
@@ -5392,7 +5480,6 @@ var TaskPrPauseSchema = z.object({
|
|
|
5392
5480
|
var TaskPrReviewRecordSchema = z.object({
|
|
5393
5481
|
verdicts: z.array(TaskPrVerdictSchema),
|
|
5394
5482
|
roundMarkers: z.array(z.number().int().nonnegative()),
|
|
5395
|
-
summaryTable: z.string().nullable(),
|
|
5396
5483
|
pause: TaskPrPauseSchema.nullable()
|
|
5397
5484
|
});
|
|
5398
5485
|
var TaskPrReadInputSchema = z.object({
|
|
@@ -5439,16 +5526,6 @@ var TaskCancelResultSchema = z.object({
|
|
|
5439
5526
|
authenticatedFrom: z.string().min(1),
|
|
5440
5527
|
fencedEffectKeys: z.array(z.string())
|
|
5441
5528
|
});
|
|
5442
|
-
var TASK_TOOL_NAMES = [
|
|
5443
|
-
"task_start",
|
|
5444
|
-
"task_status",
|
|
5445
|
-
"task_escalation_read",
|
|
5446
|
-
"task_pr_read",
|
|
5447
|
-
"task_resume",
|
|
5448
|
-
"task_cancel"
|
|
5449
|
-
];
|
|
5450
|
-
var OPERATOR_STATUS_FOLLOW = "task_status_follow";
|
|
5451
|
-
var OPERATOR_TOOL_GRANT = [...TASK_TOOL_NAMES, OPERATOR_STATUS_FOLLOW];
|
|
5452
5529
|
// ../../packages/aeg-core/src/first-push-dispatch-gate.ts
|
|
5453
5530
|
function parseTaskBranch(branch) {
|
|
5454
5531
|
const m = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
|
|
@@ -5679,16 +5756,71 @@ var NO_GATE_CUTOVERS = {
|
|
|
5679
5756
|
briefRulesSincePr: null,
|
|
5680
5757
|
agentBoxesRefusedSincePr: null
|
|
5681
5758
|
};
|
|
5682
|
-
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
5683
|
-
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
5684
|
-
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
5685
|
-
var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
|
|
5686
|
-
// ../../packages/aeg-core/src/log/envelope.ts
|
|
5687
|
-
import { createHash as createHash5 } from "node:crypto";
|
|
5688
|
-
|
|
5689
5759
|
// ../../packages/aeg-core/src/log/schema.ts
|
|
5760
|
+
import { z as z3 } from "zod";
|
|
5761
|
+
|
|
5762
|
+
// ../../packages/aeg-core/src/log/custom.ts
|
|
5690
5763
|
import { z as z2 } from "zod";
|
|
5764
|
+
var CUSTOM_EVENT_NAME_PATTERN = /^[a-z][a-z0-9_]*\.[a-z][a-z0-9_.]*$/;
|
|
5765
|
+
var CUSTOM_EVENT_NAME_MAX_LENGTH = 64;
|
|
5766
|
+
var CUSTOM_EVENT_RESERVED_NAMESPACE = "vinaya";
|
|
5767
|
+
var CUSTOM_EVENT_MAX_FIELDS = 20;
|
|
5768
|
+
var CUSTOM_FIELD_NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
5769
|
+
var CUSTOM_FIELD_NAME_MAX_LENGTH = 64;
|
|
5770
|
+
var CUSTOM_TEXT_MAX_LENGTH = 500;
|
|
5771
|
+
var CUSTOM_WORD_PATTERN = /^[a-z0-9][a-z0-9_-]*$/;
|
|
5772
|
+
var CUSTOM_WORD_MAX_LENGTH = 64;
|
|
5773
|
+
var CUSTOM_FIELD_MAX_WORDS = 50;
|
|
5774
|
+
var CustomFieldTypeSchema = z2.union([z2.enum(["text", "number", "boolean"]), z2.array(z2.string())]);
|
|
5775
|
+
var CustomEventDeclarationsSchema = z2.record(z2.string(), z2.object({
|
|
5776
|
+
fields: z2.record(z2.string(), CustomFieldTypeSchema)
|
|
5777
|
+
}).strict()).superRefine((events, ctx) => {
|
|
5778
|
+
for (const [name, declaration] of Object.entries(events)) {
|
|
5779
|
+
const refuse = (message, path = []) => {
|
|
5780
|
+
ctx.addIssue({
|
|
5781
|
+
code: z2.ZodIssueCode.custom,
|
|
5782
|
+
path: [name, ...path],
|
|
5783
|
+
message: `logs.events "${name}": ${message}`
|
|
5784
|
+
});
|
|
5785
|
+
};
|
|
5786
|
+
if (name.length > CUSTOM_EVENT_NAME_MAX_LENGTH) {
|
|
5787
|
+
refuse(`the name must be at most ${CUSTOM_EVENT_NAME_MAX_LENGTH} characters`);
|
|
5788
|
+
}
|
|
5789
|
+
if (!CUSTOM_EVENT_NAME_PATTERN.test(name)) {
|
|
5790
|
+
refuse("the name must be `<namespace>.<event>` — lowercase letters, digits and `_`, a dot between them");
|
|
5791
|
+
} else if (name.split(".")[0] === CUSTOM_EVENT_RESERVED_NAMESPACE) {
|
|
5792
|
+
refuse(`the \`${CUSTOM_EVENT_RESERVED_NAMESPACE}.\` namespace is reserved for Vinaya's own events`);
|
|
5793
|
+
}
|
|
5794
|
+
const fieldEntries = Object.entries(declaration.fields);
|
|
5795
|
+
if (fieldEntries.length > CUSTOM_EVENT_MAX_FIELDS) {
|
|
5796
|
+
refuse(`at most ${CUSTOM_EVENT_MAX_FIELDS} fields may be declared (found ${fieldEntries.length})`, ["fields"]);
|
|
5797
|
+
}
|
|
5798
|
+
for (const [field, type] of fieldEntries) {
|
|
5799
|
+
if (field.length > CUSTOM_FIELD_NAME_MAX_LENGTH || !CUSTOM_FIELD_NAME_PATTERN.test(field)) {
|
|
5800
|
+
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]);
|
|
5801
|
+
}
|
|
5802
|
+
if (typeof type === "string")
|
|
5803
|
+
continue;
|
|
5804
|
+
if (type.length === 0) {
|
|
5805
|
+
refuse(`field "${field}": a list of words must name at least one word`, ["fields", field]);
|
|
5806
|
+
}
|
|
5807
|
+
if (type.length > CUSTOM_FIELD_MAX_WORDS) {
|
|
5808
|
+
refuse(`field "${field}": a list of words may name at most ${CUSTOM_FIELD_MAX_WORDS}`, ["fields", field]);
|
|
5809
|
+
}
|
|
5810
|
+
const bad = type.filter((w) => w.length > CUSTOM_WORD_MAX_LENGTH || !CUSTOM_WORD_PATTERN.test(w));
|
|
5811
|
+
if (bad.length > 0) {
|
|
5812
|
+
refuse(`field "${field}": a listed word is lowercase letters, digits, \`_\` and \`-\`, at most ${CUSTOM_WORD_MAX_LENGTH} characters`, ["fields", field]);
|
|
5813
|
+
}
|
|
5814
|
+
if (new Set(type).size !== type.length) {
|
|
5815
|
+
refuse(`field "${field}": a list of words names a word twice`, ["fields", field]);
|
|
5816
|
+
}
|
|
5817
|
+
}
|
|
5818
|
+
}
|
|
5819
|
+
});
|
|
5820
|
+
|
|
5821
|
+
// ../../packages/aeg-core/src/log/schema.ts
|
|
5691
5822
|
var CONFIDENCE_REASON_MAX_LENGTH = 280;
|
|
5823
|
+
var REVIEW_FINDING_DESCRIPTION_MAX_LENGTH = 1000;
|
|
5692
5824
|
var ROLE_VALUES = [
|
|
5693
5825
|
"planner",
|
|
5694
5826
|
"developer",
|
|
@@ -5698,178 +5830,214 @@ var ROLE_VALUES = [
|
|
|
5698
5830
|
"archivist",
|
|
5699
5831
|
"architect"
|
|
5700
5832
|
];
|
|
5701
|
-
var RoleSchema =
|
|
5833
|
+
var RoleSchema = z3.enum(ROLE_VALUES);
|
|
5702
5834
|
var HOST_VALUES = ["hook", "ci", "cli", "loop"];
|
|
5703
|
-
var HostSchema =
|
|
5835
|
+
var HostSchema = z3.enum(HOST_VALUES);
|
|
5704
5836
|
var RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
|
|
5705
5837
|
var headerMetaCore = {
|
|
5706
|
-
ts:
|
|
5707
|
-
run_id:
|
|
5708
|
-
seq:
|
|
5709
|
-
repo:
|
|
5710
|
-
vinaya:
|
|
5711
|
-
doctrine:
|
|
5838
|
+
ts: z3.string(),
|
|
5839
|
+
run_id: z3.string().regex(RUN_ID_PATTERN),
|
|
5840
|
+
seq: z3.number().int().nonnegative(),
|
|
5841
|
+
repo: z3.string().nullable(),
|
|
5842
|
+
vinaya: z3.string(),
|
|
5843
|
+
doctrine: z3.string(),
|
|
5712
5844
|
host: HostSchema,
|
|
5713
|
-
machine:
|
|
5845
|
+
machine: z3.string()
|
|
5714
5846
|
};
|
|
5715
|
-
var HeaderMetaV1Schema =
|
|
5716
|
-
schema:
|
|
5847
|
+
var HeaderMetaV1Schema = z3.object({
|
|
5848
|
+
schema: z3.literal(1),
|
|
5717
5849
|
...headerMetaCore
|
|
5718
5850
|
}).strict();
|
|
5719
|
-
var LineageSchema =
|
|
5720
|
-
run:
|
|
5721
|
-
attempt:
|
|
5722
|
-
parent:
|
|
5851
|
+
var LineageSchema = z3.object({
|
|
5852
|
+
run: z3.string().nullable(),
|
|
5853
|
+
attempt: z3.number().int().nullable(),
|
|
5854
|
+
parent: z3.string().nullable()
|
|
5723
5855
|
}).strict();
|
|
5724
|
-
var InputVersionsSchema =
|
|
5725
|
-
objectives_version:
|
|
5726
|
-
brief_hash:
|
|
5727
|
-
ruling_ordinal:
|
|
5728
|
-
policy_digest:
|
|
5856
|
+
var InputVersionsSchema = z3.object({
|
|
5857
|
+
objectives_version: z3.string().nullable(),
|
|
5858
|
+
brief_hash: z3.string().nullable(),
|
|
5859
|
+
ruling_ordinal: z3.number().int().nullable(),
|
|
5860
|
+
policy_digest: z3.string().nullable()
|
|
5729
5861
|
}).strict();
|
|
5730
|
-
var ProvenanceSchema =
|
|
5731
|
-
var HeaderMetaV2Schema =
|
|
5732
|
-
schema:
|
|
5862
|
+
var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
|
|
5863
|
+
var HeaderMetaV2Schema = z3.object({
|
|
5864
|
+
schema: z3.literal(2),
|
|
5733
5865
|
...headerMetaCore,
|
|
5734
|
-
event_id:
|
|
5735
|
-
process_id:
|
|
5736
|
-
actor_id:
|
|
5866
|
+
event_id: z3.string().min(1),
|
|
5867
|
+
process_id: z3.string().min(1),
|
|
5868
|
+
actor_id: z3.string().nullable(),
|
|
5737
5869
|
lineage: LineageSchema,
|
|
5738
5870
|
input_versions: InputVersionsSchema,
|
|
5739
5871
|
provenance: ProvenanceSchema
|
|
5740
5872
|
}).strict();
|
|
5741
|
-
var
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
role: z2.union([RoleSchema, z2.literal("unattributed")]),
|
|
5747
|
-
round: z2.number().int().optional(),
|
|
5748
|
-
objectives_version: z2.string().optional()
|
|
5873
|
+
var WorkSchema = z3.object({
|
|
5874
|
+
ref: z3.string().nullable(),
|
|
5875
|
+
repo: z3.string().nullable(),
|
|
5876
|
+
change: z3.string().nullable(),
|
|
5877
|
+
revision: z3.string().nullable()
|
|
5749
5878
|
}).strict();
|
|
5750
|
-
var
|
|
5879
|
+
var FlowSchema = z3.object({
|
|
5880
|
+
id: z3.string().nullable(),
|
|
5881
|
+
version: z3.string().nullable()
|
|
5882
|
+
}).strict();
|
|
5883
|
+
var HeaderMetaV3Schema = z3.object({
|
|
5884
|
+
schema: z3.literal(3),
|
|
5885
|
+
...headerMetaCore,
|
|
5886
|
+
event_id: z3.string().min(1),
|
|
5887
|
+
process_id: z3.string().min(1),
|
|
5888
|
+
actor_id: z3.string().nullable(),
|
|
5889
|
+
lineage: LineageSchema,
|
|
5890
|
+
input_versions: InputVersionsSchema,
|
|
5891
|
+
provenance: ProvenanceSchema,
|
|
5892
|
+
work: WorkSchema,
|
|
5893
|
+
flow: FlowSchema,
|
|
5894
|
+
runtime: z3.string().nullable(),
|
|
5895
|
+
source: z3.string().nullable()
|
|
5896
|
+
}).strict();
|
|
5897
|
+
var HeaderMetaSchema = z3.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema, HeaderMetaV3Schema]);
|
|
5898
|
+
var SubjectSchema = z3.object({
|
|
5899
|
+
issue: z3.number().int().nullable(),
|
|
5900
|
+
pr: z3.number().int().optional(),
|
|
5901
|
+
sha: z3.string().optional(),
|
|
5902
|
+
role: z3.union([RoleSchema, z3.literal("unattributed")]),
|
|
5903
|
+
round: z3.number().int().optional(),
|
|
5904
|
+
objectives_version: z3.string().optional()
|
|
5905
|
+
}).strict();
|
|
5906
|
+
var HeaderSchema = z3.object({
|
|
5751
5907
|
meta: HeaderMetaSchema,
|
|
5752
5908
|
subject: SubjectSchema
|
|
5753
5909
|
}).strict();
|
|
5754
5910
|
var envelopeTail = {
|
|
5755
|
-
duration_ms:
|
|
5756
|
-
payload:
|
|
5911
|
+
duration_ms: z3.number().nonnegative().optional(),
|
|
5912
|
+
payload: z3.object({}).strict()
|
|
5757
5913
|
};
|
|
5758
|
-
var ReviewFindingSchema =
|
|
5759
|
-
id:
|
|
5760
|
-
severity:
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5914
|
+
var ReviewFindingSchema = z3.object({
|
|
5915
|
+
id: z3.string(),
|
|
5916
|
+
severity: z3.string(),
|
|
5917
|
+
location: z3.string().optional(),
|
|
5918
|
+
deferral_reason: z3.enum(["outside-surface", "unchanged-line"]).optional(),
|
|
5919
|
+
description: z3.string().max(REVIEW_FINDING_DESCRIPTION_MAX_LENGTH).optional(),
|
|
5920
|
+
state: z3.string().optional(),
|
|
5921
|
+
severity_scale: z3.string().optional(),
|
|
5922
|
+
policy_treatment: z3.enum(["blocking", "non_blocking", "unavailable"]).optional(),
|
|
5923
|
+
confidence: z3.number().min(0).max(1).optional(),
|
|
5924
|
+
confidence_scale: z3.string().optional(),
|
|
5925
|
+
confidence_source: z3.string().optional()
|
|
5767
5926
|
}).strict();
|
|
5768
|
-
var DispatchOutcomeSchema =
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
type:
|
|
5772
|
-
pr:
|
|
5773
|
-
head:
|
|
5774
|
-
comment_id:
|
|
5927
|
+
var DispatchOutcomeSchema = z3.discriminatedUnion("type", [
|
|
5928
|
+
z3.object({ type: z3.literal("pr_opened"), pr: z3.number().int(), head: z3.string() }).strict(),
|
|
5929
|
+
z3.object({
|
|
5930
|
+
type: z3.literal("round_pushed"),
|
|
5931
|
+
pr: z3.number().int(),
|
|
5932
|
+
head: z3.string(),
|
|
5933
|
+
comment_id: z3.number().int()
|
|
5775
5934
|
}).strict(),
|
|
5776
|
-
|
|
5777
|
-
type:
|
|
5778
|
-
verdict:
|
|
5779
|
-
head:
|
|
5780
|
-
comment_id:
|
|
5781
|
-
objectives:
|
|
5782
|
-
findings:
|
|
5935
|
+
z3.object({
|
|
5936
|
+
type: z3.literal("verdict"),
|
|
5937
|
+
verdict: z3.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
|
|
5938
|
+
head: z3.string(),
|
|
5939
|
+
comment_id: z3.number().int(),
|
|
5940
|
+
objectives: z3.array(z3.object({ id: z3.string(), met: z3.boolean() }).strict()),
|
|
5941
|
+
findings: z3.array(ReviewFindingSchema)
|
|
5783
5942
|
}).strict(),
|
|
5784
|
-
|
|
5785
|
-
type:
|
|
5786
|
-
class:
|
|
5787
|
-
comment_id:
|
|
5943
|
+
z3.object({
|
|
5944
|
+
type: z3.literal("escalation"),
|
|
5945
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
5946
|
+
comment_id: z3.number().int()
|
|
5788
5947
|
}).strict(),
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5948
|
+
z3.object({ type: z3.literal("brief"), comment_id: z3.number().int(), hash: z3.string() }).strict(),
|
|
5949
|
+
z3.object({ type: z3.literal("plan"), issues: z3.array(z3.number().int()) }).strict(),
|
|
5950
|
+
z3.object({ type: z3.literal("archive"), provenance_comment_id: z3.number().int() }).strict(),
|
|
5951
|
+
z3.object({ type: z3.literal("completed") }).strict()
|
|
5793
5952
|
]);
|
|
5794
5953
|
var dispatchShared = {
|
|
5795
5954
|
meta: HeaderMetaSchema,
|
|
5796
5955
|
subject: SubjectSchema,
|
|
5797
|
-
kind:
|
|
5956
|
+
kind: z3.literal("dispatch"),
|
|
5798
5957
|
...envelopeTail,
|
|
5799
5958
|
target_role: RoleSchema,
|
|
5800
|
-
model:
|
|
5801
|
-
round:
|
|
5802
|
-
effect_id:
|
|
5959
|
+
model: z3.string(),
|
|
5960
|
+
round: z3.number().int().optional(),
|
|
5961
|
+
effect_id: z3.string()
|
|
5803
5962
|
};
|
|
5804
|
-
var dispatchUsageField =
|
|
5805
|
-
var DispatchEventSchema =
|
|
5806
|
-
|
|
5807
|
-
|
|
5963
|
+
var dispatchUsageField = z3.object({ input: z3.number().nonnegative(), output: z3.number().nonnegative() }).strict().nullable();
|
|
5964
|
+
var DispatchEventSchema = z3.discriminatedUnion("event", [
|
|
5965
|
+
z3.object({ ...dispatchShared, event: z3.literal("dispatched"), prompt_hash: z3.string() }).strict(),
|
|
5966
|
+
z3.object({
|
|
5808
5967
|
...dispatchShared,
|
|
5809
|
-
event:
|
|
5968
|
+
event: z3.literal("outcome_received"),
|
|
5810
5969
|
outcome: DispatchOutcomeSchema,
|
|
5811
5970
|
usage: dispatchUsageField
|
|
5812
5971
|
}).strict(),
|
|
5813
|
-
|
|
5972
|
+
z3.object({
|
|
5814
5973
|
...dispatchShared,
|
|
5815
|
-
event:
|
|
5816
|
-
reason:
|
|
5974
|
+
event: z3.literal("dispatch_failed"),
|
|
5975
|
+
reason: z3.enum(["timeout", "crash", "refused", "unattributed_write", "usage_limit"]),
|
|
5976
|
+
usage_limit: z3.object({ agent: z3.string().min(1), reset_at: z3.string().nullable() }).strict().optional(),
|
|
5817
5977
|
usage: dispatchUsageField
|
|
5818
5978
|
}).strict()
|
|
5819
5979
|
]);
|
|
5980
|
+
var CODE_TOKEN_PATTERN = /^[A-Za-z0-9._-]{1,64}$/;
|
|
5981
|
+
var CodeTokenSchema = z3.string().regex(CODE_TOKEN_PATTERN);
|
|
5982
|
+
var ReviewerVerdictSchema = z3.object({
|
|
5983
|
+
role: RoleSchema,
|
|
5984
|
+
outcome: z3.enum(["approve", "changes_requested", "not_reviewed"]),
|
|
5985
|
+
blockers: z3.number().int().nonnegative()
|
|
5986
|
+
}).strict();
|
|
5820
5987
|
var loopShared = {
|
|
5821
5988
|
meta: HeaderMetaSchema,
|
|
5822
5989
|
subject: SubjectSchema,
|
|
5823
|
-
kind:
|
|
5990
|
+
kind: z3.literal("dev_review_loop"),
|
|
5824
5991
|
...envelopeTail,
|
|
5825
|
-
loop_id:
|
|
5992
|
+
loop_id: z3.string()
|
|
5826
5993
|
};
|
|
5827
|
-
var DevReviewLoopEventSchema =
|
|
5828
|
-
|
|
5994
|
+
var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
|
|
5995
|
+
z3.object({
|
|
5829
5996
|
...loopShared,
|
|
5830
|
-
event:
|
|
5831
|
-
task:
|
|
5832
|
-
policy:
|
|
5833
|
-
max_rounds:
|
|
5834
|
-
reviewers:
|
|
5835
|
-
models:
|
|
5997
|
+
event: z3.literal("loop_started"),
|
|
5998
|
+
task: z3.number().int(),
|
|
5999
|
+
policy: z3.object({
|
|
6000
|
+
max_rounds: z3.number().int().nonnegative(),
|
|
6001
|
+
reviewers: z3.array(RoleSchema),
|
|
6002
|
+
models: z3.record(RoleSchema, z3.string())
|
|
5836
6003
|
}).strict()
|
|
5837
6004
|
}).strict(),
|
|
5838
|
-
|
|
5839
|
-
|
|
6005
|
+
z3.object({ ...loopShared, event: z3.literal("round_started"), round: z3.number().int(), base_head: z3.string() }).strict(),
|
|
6006
|
+
z3.object({
|
|
5840
6007
|
...loopShared,
|
|
5841
|
-
event:
|
|
5842
|
-
round:
|
|
5843
|
-
head:
|
|
5844
|
-
green:
|
|
5845
|
-
confidence_value:
|
|
5846
|
-
confidence_reason:
|
|
5847
|
-
confidence_unavailable:
|
|
5848
|
-
extra_turn_spent:
|
|
6008
|
+
event: z3.literal("gate_result_read"),
|
|
6009
|
+
round: z3.number().int(),
|
|
6010
|
+
head: z3.string(),
|
|
6011
|
+
green: z3.boolean(),
|
|
6012
|
+
confidence_value: z3.number().int().min(0).max(100).optional(),
|
|
6013
|
+
confidence_reason: z3.string().max(CONFIDENCE_REASON_MAX_LENGTH).optional(),
|
|
6014
|
+
confidence_unavailable: z3.boolean().optional(),
|
|
6015
|
+
extra_turn_spent: z3.boolean().optional()
|
|
5849
6016
|
}).strict(),
|
|
5850
|
-
|
|
6017
|
+
z3.object({
|
|
5851
6018
|
...loopShared,
|
|
5852
|
-
event:
|
|
5853
|
-
round:
|
|
5854
|
-
head:
|
|
5855
|
-
all_approve:
|
|
5856
|
-
blockers:
|
|
5857
|
-
findings:
|
|
6019
|
+
event: z3.literal("verdicts_read"),
|
|
6020
|
+
round: z3.number().int(),
|
|
6021
|
+
head: z3.string(),
|
|
6022
|
+
all_approve: z3.boolean(),
|
|
6023
|
+
blockers: z3.number().int().nonnegative(),
|
|
6024
|
+
findings: z3.array(ReviewFindingSchema).optional(),
|
|
6025
|
+
reviewers: z3.array(ReviewerVerdictSchema).optional()
|
|
5858
6026
|
}).strict(),
|
|
5859
|
-
|
|
6027
|
+
z3.object({
|
|
5860
6028
|
...loopShared,
|
|
5861
|
-
event:
|
|
5862
|
-
round:
|
|
5863
|
-
open:
|
|
5864
|
-
resolved:
|
|
5865
|
-
new:
|
|
5866
|
-
recurring:
|
|
6029
|
+
event: z3.literal("findings_compared"),
|
|
6030
|
+
round: z3.number().int(),
|
|
6031
|
+
open: z3.array(z3.string()),
|
|
6032
|
+
resolved: z3.array(z3.string()),
|
|
6033
|
+
new: z3.array(z3.string()),
|
|
6034
|
+
recurring: z3.array(z3.string())
|
|
5867
6035
|
}).strict(),
|
|
5868
|
-
|
|
6036
|
+
z3.object({
|
|
5869
6037
|
...loopShared,
|
|
5870
|
-
event:
|
|
5871
|
-
round:
|
|
5872
|
-
condition:
|
|
6038
|
+
event: z3.literal("stop_condition_met"),
|
|
6039
|
+
round: z3.number().int(),
|
|
6040
|
+
condition: z3.enum([
|
|
5873
6041
|
"green",
|
|
5874
6042
|
"max_rounds",
|
|
5875
6043
|
"no_progress",
|
|
@@ -5878,66 +6046,85 @@ var DevReviewLoopEventSchema = z2.discriminatedUnion("event", [
|
|
|
5878
6046
|
"confidence",
|
|
5879
6047
|
"reappearance",
|
|
5880
6048
|
"repeat_finding",
|
|
5881
|
-
"repeat_failure"
|
|
6049
|
+
"repeat_failure",
|
|
6050
|
+
"time_budget"
|
|
5882
6051
|
])
|
|
5883
6052
|
}).strict(),
|
|
5884
|
-
|
|
6053
|
+
z3.object({
|
|
6054
|
+
...loopShared,
|
|
6055
|
+
event: z3.literal("paused"),
|
|
6056
|
+
round: z3.number().int(),
|
|
6057
|
+
reason: z3.enum(["escalation", "principal_item", "refreeze_needed"]),
|
|
6058
|
+
reason_code: CodeTokenSchema.optional()
|
|
6059
|
+
}).strict(),
|
|
6060
|
+
z3.object({
|
|
5885
6061
|
...loopShared,
|
|
5886
|
-
event:
|
|
5887
|
-
round:
|
|
5888
|
-
|
|
6062
|
+
event: z3.literal("resumed"),
|
|
6063
|
+
round: z3.number().int(),
|
|
6064
|
+
by: z3.enum(["principal", "driver"])
|
|
5889
6065
|
}).strict(),
|
|
5890
|
-
|
|
6066
|
+
z3.object({
|
|
5891
6067
|
...loopShared,
|
|
5892
|
-
event:
|
|
5893
|
-
round:
|
|
5894
|
-
by:
|
|
6068
|
+
event: z3.literal("cancelled"),
|
|
6069
|
+
round: z3.number().int(),
|
|
6070
|
+
by: z3.literal("principal")
|
|
5895
6071
|
}).strict(),
|
|
5896
|
-
|
|
6072
|
+
z3.object({
|
|
5897
6073
|
...loopShared,
|
|
5898
|
-
event:
|
|
5899
|
-
round:
|
|
5900
|
-
|
|
6074
|
+
event: z3.literal("unpushed_work_resume"),
|
|
6075
|
+
round: z3.number().int(),
|
|
6076
|
+
branch: z3.string(),
|
|
6077
|
+
detail: z3.string()
|
|
5901
6078
|
}).strict(),
|
|
5902
|
-
|
|
6079
|
+
z3.object({
|
|
5903
6080
|
...loopShared,
|
|
5904
|
-
event:
|
|
5905
|
-
round:
|
|
5906
|
-
|
|
5907
|
-
|
|
6081
|
+
event: z3.literal("round_ended"),
|
|
6082
|
+
round: z3.number().int(),
|
|
6083
|
+
base_head: z3.string(),
|
|
6084
|
+
head: z3.string(),
|
|
6085
|
+
files_changed: z3.number().int().nonnegative(),
|
|
6086
|
+
insertions: z3.number().int().nonnegative(),
|
|
6087
|
+
deletions: z3.number().int().nonnegative(),
|
|
6088
|
+
wall_ms: z3.number().nonnegative(),
|
|
6089
|
+
outcome: z3.enum(["green", "changes_requested", "escalated"])
|
|
5908
6090
|
}).strict(),
|
|
5909
|
-
|
|
6091
|
+
z3.object({
|
|
5910
6092
|
...loopShared,
|
|
5911
|
-
event:
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
wall_ms: z2.number().nonnegative(),
|
|
5919
|
-
outcome: z2.enum(["green", "changes_requested", "escalated"])
|
|
6093
|
+
event: z3.literal("journal_finalized"),
|
|
6094
|
+
rounds: z3.number().int().nonnegative(),
|
|
6095
|
+
total_wall_ms: z3.number().nonnegative(),
|
|
6096
|
+
time_to_green_ms: z3.number().nonnegative().nullable(),
|
|
6097
|
+
files_changed_total: z3.number().int().nonnegative(),
|
|
6098
|
+
final_head: z3.string(),
|
|
6099
|
+
result: z3.enum(["merged_ready", "stopped"])
|
|
5920
6100
|
}).strict(),
|
|
5921
|
-
|
|
6101
|
+
z3.object({
|
|
5922
6102
|
...loopShared,
|
|
5923
|
-
event:
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
final_head: z2.string(),
|
|
5929
|
-
result: z2.enum(["merged_ready", "stopped"])
|
|
6103
|
+
event: z3.literal("infrastructure_retry"),
|
|
6104
|
+
round: z3.number().int(),
|
|
6105
|
+
failure_kind: z3.enum(["pause_comment_post", "developer_connection"]),
|
|
6106
|
+
attempts: z3.number().int().positive(),
|
|
6107
|
+
outcome: z3.enum(["recovered", "exhausted"])
|
|
5930
6108
|
}).strict(),
|
|
5931
|
-
|
|
6109
|
+
z3.object({
|
|
5932
6110
|
...loopShared,
|
|
5933
|
-
event:
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
6111
|
+
event: z3.literal("driver_heartbeat"),
|
|
6112
|
+
task: z3.number().int(),
|
|
6113
|
+
pr: z3.number().int().positive().optional(),
|
|
6114
|
+
round: z3.number().int(),
|
|
6115
|
+
phase: z3.string()
|
|
6116
|
+
}).strict(),
|
|
6117
|
+
z3.object({
|
|
6118
|
+
...loopShared,
|
|
6119
|
+
event: z3.literal("driver_exited"),
|
|
6120
|
+
task: z3.number().int(),
|
|
6121
|
+
reason: z3.enum(["finished", "paused", "reexec", "error", "signal"]),
|
|
6122
|
+
last_decision: z3.string(),
|
|
6123
|
+
exit_code: z3.number().int().optional(),
|
|
6124
|
+
error_class: CodeTokenSchema.optional()
|
|
5938
6125
|
}).strict()
|
|
5939
6126
|
]);
|
|
5940
|
-
var ForgeOpSchema =
|
|
6127
|
+
var ForgeOpSchema = z3.enum([
|
|
5941
6128
|
"pr.create",
|
|
5942
6129
|
"pr.comment",
|
|
5943
6130
|
"pr.body.replace",
|
|
@@ -5951,24 +6138,24 @@ var ForgeOpSchema = z2.enum([
|
|
|
5951
6138
|
"label.add",
|
|
5952
6139
|
"label.remove"
|
|
5953
6140
|
]);
|
|
5954
|
-
var ForgeWriteTargetSchema =
|
|
5955
|
-
issue:
|
|
5956
|
-
pr:
|
|
6141
|
+
var ForgeWriteTargetSchema = z3.object({
|
|
6142
|
+
issue: z3.number().int().optional(),
|
|
6143
|
+
pr: z3.number().int().optional()
|
|
5957
6144
|
}).strict();
|
|
5958
6145
|
var forgeWriteShared = {
|
|
5959
6146
|
meta: HeaderMetaSchema,
|
|
5960
6147
|
subject: SubjectSchema,
|
|
5961
|
-
kind:
|
|
6148
|
+
kind: z3.literal("forge_write"),
|
|
5962
6149
|
...envelopeTail,
|
|
5963
6150
|
op: ForgeOpSchema,
|
|
5964
6151
|
target: ForgeWriteTargetSchema
|
|
5965
6152
|
};
|
|
5966
|
-
var ForgeWriteEventSchema =
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
6153
|
+
var ForgeWriteEventSchema = z3.discriminatedUnion("event", [
|
|
6154
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("validated") }).strict(),
|
|
6155
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("refused"), reason: z3.string() }).strict(),
|
|
6156
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("written"), comment_ids: z3.array(z3.string()) }).strict()
|
|
5970
6157
|
]);
|
|
5971
|
-
var GateOutcomeSchema =
|
|
6158
|
+
var GateOutcomeSchema = z3.enum([
|
|
5972
6159
|
"pass",
|
|
5973
6160
|
"fail",
|
|
5974
6161
|
"wait",
|
|
@@ -5981,61 +6168,74 @@ var GateOutcomeSchema = z2.enum([
|
|
|
5981
6168
|
var gateShared = {
|
|
5982
6169
|
meta: HeaderMetaSchema,
|
|
5983
6170
|
subject: SubjectSchema,
|
|
5984
|
-
kind:
|
|
6171
|
+
kind: z3.literal("gate"),
|
|
5985
6172
|
...envelopeTail,
|
|
5986
|
-
check:
|
|
5987
|
-
check_version:
|
|
5988
|
-
policy_version:
|
|
5989
|
-
input_fingerprint:
|
|
6173
|
+
check: z3.string(),
|
|
6174
|
+
check_version: z3.string().nullable(),
|
|
6175
|
+
policy_version: z3.string().nullable(),
|
|
6176
|
+
input_fingerprint: z3.string().nullable()
|
|
5990
6177
|
};
|
|
5991
|
-
var GateEventSchema =
|
|
5992
|
-
|
|
6178
|
+
var GateEventSchema = z3.discriminatedUnion("event", [
|
|
6179
|
+
z3.object({
|
|
5993
6180
|
...gateShared,
|
|
5994
|
-
event:
|
|
6181
|
+
event: z3.literal("checked"),
|
|
5995
6182
|
outcome: GateOutcomeSchema,
|
|
5996
|
-
reason:
|
|
6183
|
+
reason: z3.string().optional()
|
|
6184
|
+
}).strict(),
|
|
6185
|
+
z3.object({
|
|
6186
|
+
meta: HeaderMetaSchema,
|
|
6187
|
+
subject: SubjectSchema,
|
|
6188
|
+
kind: z3.literal("gate"),
|
|
6189
|
+
...envelopeTail,
|
|
6190
|
+
event: z3.literal("summary"),
|
|
6191
|
+
ran: z3.number().int().nonnegative(),
|
|
6192
|
+
passed: z3.number().int().nonnegative(),
|
|
6193
|
+
failed: z3.number().int().nonnegative(),
|
|
6194
|
+
skipped: z3.number().int().nonnegative(),
|
|
6195
|
+
failed_checks: z3.array(z3.string())
|
|
5997
6196
|
}).strict()
|
|
5998
6197
|
]);
|
|
5999
|
-
var OperationResultSchema =
|
|
6198
|
+
var OperationResultSchema = z3.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
|
|
6000
6199
|
var operationShared = {
|
|
6001
6200
|
meta: HeaderMetaSchema,
|
|
6002
6201
|
subject: SubjectSchema,
|
|
6003
|
-
kind:
|
|
6202
|
+
kind: z3.literal("operation"),
|
|
6004
6203
|
...envelopeTail,
|
|
6005
|
-
operation:
|
|
6006
|
-
target:
|
|
6204
|
+
operation: z3.string(),
|
|
6205
|
+
target: z3.string().nullable()
|
|
6007
6206
|
};
|
|
6008
|
-
var OperationEventSchema =
|
|
6009
|
-
|
|
6207
|
+
var OperationEventSchema = z3.discriminatedUnion("event", [
|
|
6208
|
+
z3.object({
|
|
6010
6209
|
...operationShared,
|
|
6011
|
-
event:
|
|
6210
|
+
event: z3.literal("completed"),
|
|
6012
6211
|
result: OperationResultSchema,
|
|
6013
|
-
error_class:
|
|
6212
|
+
error_class: z3.string().nullable(),
|
|
6213
|
+
field_names: z3.array(z3.string().max(CUSTOM_FIELD_NAME_MAX_LENGTH)).max(CUSTOM_EVENT_MAX_FIELDS).optional()
|
|
6014
6214
|
}).strict()
|
|
6015
6215
|
]);
|
|
6016
|
-
var UsageUnitsSchema =
|
|
6017
|
-
input:
|
|
6018
|
-
output:
|
|
6019
|
-
cache:
|
|
6216
|
+
var UsageUnitsSchema = z3.object({
|
|
6217
|
+
input: z3.number().nonnegative().nullable(),
|
|
6218
|
+
output: z3.number().nonnegative().nullable(),
|
|
6219
|
+
cache: z3.number().nonnegative().nullable()
|
|
6020
6220
|
}).strict();
|
|
6021
6221
|
var usageShared = {
|
|
6022
6222
|
meta: HeaderMetaSchema,
|
|
6023
6223
|
subject: SubjectSchema,
|
|
6024
|
-
kind:
|
|
6224
|
+
kind: z3.literal("usage"),
|
|
6025
6225
|
...envelopeTail,
|
|
6026
|
-
model:
|
|
6027
|
-
source:
|
|
6028
|
-
semantics:
|
|
6226
|
+
model: z3.string().nullable(),
|
|
6227
|
+
source: z3.string(),
|
|
6228
|
+
semantics: z3.enum(["cumulative", "delta"])
|
|
6029
6229
|
};
|
|
6030
|
-
var UsageEventSchema =
|
|
6031
|
-
|
|
6230
|
+
var UsageEventSchema = z3.discriminatedUnion("event", [
|
|
6231
|
+
z3.object({
|
|
6032
6232
|
...usageShared,
|
|
6033
|
-
event:
|
|
6233
|
+
event: z3.literal("observed"),
|
|
6034
6234
|
units: UsageUnitsSchema,
|
|
6035
|
-
unknown_reason:
|
|
6235
|
+
unknown_reason: z3.string().nullable()
|
|
6036
6236
|
}).strict()
|
|
6037
6237
|
]);
|
|
6038
|
-
var RoleAttemptOutcomeSchema =
|
|
6238
|
+
var RoleAttemptOutcomeSchema = z3.enum([
|
|
6039
6239
|
"completed",
|
|
6040
6240
|
"incomplete",
|
|
6041
6241
|
"infrastructure_failed",
|
|
@@ -6046,17 +6246,17 @@ var RoleAttemptOutcomeSchema = z2.enum([
|
|
|
6046
6246
|
var roleAttemptShared = {
|
|
6047
6247
|
meta: HeaderMetaSchema,
|
|
6048
6248
|
subject: SubjectSchema,
|
|
6049
|
-
kind:
|
|
6249
|
+
kind: z3.literal("role_attempt"),
|
|
6050
6250
|
...envelopeTail,
|
|
6051
|
-
actor:
|
|
6052
|
-
attempt:
|
|
6053
|
-
effect_id:
|
|
6054
|
-
model:
|
|
6251
|
+
actor: z3.string().nullable(),
|
|
6252
|
+
attempt: z3.number().int().nullable(),
|
|
6253
|
+
effect_id: z3.string(),
|
|
6254
|
+
model: z3.string().nullable()
|
|
6055
6255
|
};
|
|
6056
|
-
var RoleAttemptEventSchema =
|
|
6057
|
-
|
|
6256
|
+
var RoleAttemptEventSchema = z3.discriminatedUnion("event", [
|
|
6257
|
+
z3.object({
|
|
6058
6258
|
...roleAttemptShared,
|
|
6059
|
-
event:
|
|
6259
|
+
event: z3.literal("attempted"),
|
|
6060
6260
|
outcome: RoleAttemptOutcomeSchema,
|
|
6061
6261
|
usage: dispatchUsageField
|
|
6062
6262
|
}).strict()
|
|
@@ -6064,42 +6264,59 @@ var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
|
|
|
6064
6264
|
var handoffShared = {
|
|
6065
6265
|
meta: HeaderMetaSchema,
|
|
6066
6266
|
subject: SubjectSchema,
|
|
6067
|
-
kind:
|
|
6267
|
+
kind: z3.literal("handoff"),
|
|
6068
6268
|
...envelopeTail,
|
|
6069
|
-
class:
|
|
6070
|
-
reason:
|
|
6269
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
6270
|
+
reason: z3.string()
|
|
6071
6271
|
};
|
|
6072
|
-
var HandoffEventSchema =
|
|
6073
|
-
|
|
6272
|
+
var HandoffEventSchema = z3.discriminatedUnion("event", [
|
|
6273
|
+
z3.object({
|
|
6074
6274
|
...handoffShared,
|
|
6075
|
-
event:
|
|
6076
|
-
requested_decision:
|
|
6275
|
+
event: z3.literal("raised"),
|
|
6276
|
+
requested_decision: z3.string().nullable()
|
|
6077
6277
|
}).strict(),
|
|
6078
|
-
|
|
6278
|
+
z3.object({
|
|
6079
6279
|
...handoffShared,
|
|
6080
|
-
event:
|
|
6081
|
-
resolution:
|
|
6082
|
-
resolved_by:
|
|
6280
|
+
event: z3.literal("resolved"),
|
|
6281
|
+
resolution: z3.string().nullable(),
|
|
6282
|
+
resolved_by: z3.string().nullable()
|
|
6083
6283
|
}).strict()
|
|
6084
6284
|
]);
|
|
6085
|
-
var EffectTargetSchema =
|
|
6086
|
-
kind:
|
|
6087
|
-
ref:
|
|
6285
|
+
var EffectTargetSchema = z3.object({
|
|
6286
|
+
kind: z3.string(),
|
|
6287
|
+
ref: z3.string()
|
|
6088
6288
|
}).strict();
|
|
6089
6289
|
var effectShared = {
|
|
6090
6290
|
meta: HeaderMetaSchema,
|
|
6091
6291
|
subject: SubjectSchema,
|
|
6092
|
-
kind:
|
|
6292
|
+
kind: z3.literal("effect"),
|
|
6093
6293
|
...envelopeTail,
|
|
6094
|
-
effect_id:
|
|
6294
|
+
effect_id: z3.string(),
|
|
6095
6295
|
target: EffectTargetSchema
|
|
6096
6296
|
};
|
|
6097
|
-
var EffectEventSchema =
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6297
|
+
var EffectEventSchema = z3.discriminatedUnion("event", [
|
|
6298
|
+
z3.object({ ...effectShared, event: z3.literal("attempted") }).strict(),
|
|
6299
|
+
z3.object({ ...effectShared, event: z3.literal("observed"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict(),
|
|
6300
|
+
z3.object({ ...effectShared, event: z3.literal("verified"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict()
|
|
6101
6301
|
]);
|
|
6102
|
-
var
|
|
6302
|
+
var CustomFieldValueSchema = z3.union([z3.string().max(CUSTOM_TEXT_MAX_LENGTH), z3.number().finite(), z3.boolean()]);
|
|
6303
|
+
var customShared = {
|
|
6304
|
+
meta: HeaderMetaV3Schema,
|
|
6305
|
+
subject: SubjectSchema,
|
|
6306
|
+
kind: z3.literal("custom"),
|
|
6307
|
+
...envelopeTail
|
|
6308
|
+
};
|
|
6309
|
+
var CustomEventSchema = z3.discriminatedUnion("event", [
|
|
6310
|
+
z3.object({
|
|
6311
|
+
...customShared,
|
|
6312
|
+
event: z3.literal("recorded"),
|
|
6313
|
+
name: z3.string().max(CUSTOM_EVENT_NAME_MAX_LENGTH).regex(CUSTOM_EVENT_NAME_PATTERN),
|
|
6314
|
+
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, {
|
|
6315
|
+
message: `custom: at most ${CUSTOM_EVENT_MAX_FIELDS} fields`
|
|
6316
|
+
})
|
|
6317
|
+
}).strict()
|
|
6318
|
+
]);
|
|
6319
|
+
var LogEventSchema = z3.union([
|
|
6103
6320
|
DispatchEventSchema,
|
|
6104
6321
|
DevReviewLoopEventSchema,
|
|
6105
6322
|
ForgeWriteEventSchema,
|
|
@@ -6108,10 +6325,11 @@ var LogEventSchema = z2.union([
|
|
|
6108
6325
|
UsageEventSchema,
|
|
6109
6326
|
RoleAttemptEventSchema,
|
|
6110
6327
|
HandoffEventSchema,
|
|
6111
|
-
EffectEventSchema
|
|
6328
|
+
EffectEventSchema,
|
|
6329
|
+
CustomEventSchema
|
|
6112
6330
|
]);
|
|
6113
|
-
|
|
6114
6331
|
// ../../packages/aeg-core/src/log/envelope.ts
|
|
6332
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
6115
6333
|
function isRole(value) {
|
|
6116
6334
|
return value !== undefined && ROLE_VALUES.includes(value);
|
|
6117
6335
|
}
|
|
@@ -6148,18 +6366,27 @@ function roundFromEnv(round) {
|
|
|
6148
6366
|
const n = Number(round);
|
|
6149
6367
|
return Number.isInteger(n) ? n : undefined;
|
|
6150
6368
|
}
|
|
6369
|
+
function prFromEnv(pr) {
|
|
6370
|
+
if (pr === undefined || pr === "")
|
|
6371
|
+
return;
|
|
6372
|
+
const n = Number(pr);
|
|
6373
|
+
return Number.isInteger(n) && n > 0 ? n : undefined;
|
|
6374
|
+
}
|
|
6151
6375
|
function buildHeader(input) {
|
|
6152
6376
|
const role = isRole(input.env.role) ? input.env.role : "unattributed";
|
|
6153
6377
|
const round = roundFromEnv(input.env.round);
|
|
6378
|
+
const pr = prFromEnv(input.env.pr);
|
|
6154
6379
|
const subject = {
|
|
6155
6380
|
issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
|
|
6156
6381
|
role,
|
|
6157
6382
|
...round !== undefined ? { round } : {},
|
|
6383
|
+
...pr !== undefined ? { pr } : {},
|
|
6158
6384
|
...input.subject ?? {}
|
|
6159
6385
|
};
|
|
6386
|
+
const issue = subject.issue;
|
|
6160
6387
|
return {
|
|
6161
6388
|
meta: {
|
|
6162
|
-
schema:
|
|
6389
|
+
schema: 3,
|
|
6163
6390
|
ts: input.now.toISOString(),
|
|
6164
6391
|
run_id: input.runId,
|
|
6165
6392
|
seq: input.seq,
|
|
@@ -6182,7 +6409,19 @@ function buildHeader(input) {
|
|
|
6182
6409
|
ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
|
|
6183
6410
|
policy_digest: input.inputVersions?.policyDigest ?? null
|
|
6184
6411
|
},
|
|
6185
|
-
provenance: provenanceFor(input)
|
|
6412
|
+
provenance: provenanceFor(input),
|
|
6413
|
+
work: {
|
|
6414
|
+
ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
|
|
6415
|
+
repo: input.repo,
|
|
6416
|
+
change: null,
|
|
6417
|
+
revision: null
|
|
6418
|
+
},
|
|
6419
|
+
flow: {
|
|
6420
|
+
id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
|
|
6421
|
+
version: lineageFieldFromEnv(input.env.flowVersion)
|
|
6422
|
+
},
|
|
6423
|
+
runtime: lineageFieldFromEnv(input.env.runtime),
|
|
6424
|
+
source: lineageFieldFromEnv(input.env.source)
|
|
6186
6425
|
},
|
|
6187
6426
|
subject
|
|
6188
6427
|
};
|
|
@@ -6225,7 +6464,7 @@ function redact(value, home) {
|
|
|
6225
6464
|
return value;
|
|
6226
6465
|
}
|
|
6227
6466
|
// ../../packages/aeg-core/src/log/store.ts
|
|
6228
|
-
var KNOWN_SCHEMA_VERSIONS = [1, 2];
|
|
6467
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
|
|
6229
6468
|
function metaOf(obj) {
|
|
6230
6469
|
if (obj === null || typeof obj !== "object")
|
|
6231
6470
|
return null;
|
|
@@ -6291,7 +6530,7 @@ function classifyStoredLine(raw, home) {
|
|
|
6291
6530
|
return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
|
|
6292
6531
|
}
|
|
6293
6532
|
const redacted = redact(event, home);
|
|
6294
|
-
const provenance = version
|
|
6533
|
+
const provenance = version >= 2 ? event.meta.provenance ?? null : null;
|
|
6295
6534
|
return {
|
|
6296
6535
|
status: "ok",
|
|
6297
6536
|
identity,
|
|
@@ -6304,138 +6543,380 @@ function classifyStoredLine(raw, home) {
|
|
|
6304
6543
|
};
|
|
6305
6544
|
}
|
|
6306
6545
|
// ../../packages/aeg-core/src/control-store/records.ts
|
|
6307
|
-
import { z as
|
|
6308
|
-
var isoTimestamp =
|
|
6309
|
-
var taskId =
|
|
6310
|
-
var epochNumber =
|
|
6311
|
-
var RunRecordSchema =
|
|
6312
|
-
version:
|
|
6313
|
-
kind:
|
|
6546
|
+
import { z as z4 } from "zod";
|
|
6547
|
+
var isoTimestamp = z4.string().min(1);
|
|
6548
|
+
var taskId = z4.number().int().positive();
|
|
6549
|
+
var epochNumber = z4.number().int().nonnegative();
|
|
6550
|
+
var RunRecordSchema = z4.object({
|
|
6551
|
+
version: z4.literal(1),
|
|
6552
|
+
kind: z4.literal("run"),
|
|
6314
6553
|
task: taskId,
|
|
6315
|
-
runId:
|
|
6316
|
-
pid:
|
|
6317
|
-
host:
|
|
6554
|
+
runId: z4.string().min(1),
|
|
6555
|
+
pid: z4.number().int().positive(),
|
|
6556
|
+
host: z4.string().min(1),
|
|
6318
6557
|
startedAt: isoTimestamp,
|
|
6319
|
-
childStartedAt:
|
|
6320
|
-
childCommand:
|
|
6558
|
+
childStartedAt: z4.string().min(1).nullable().optional(),
|
|
6559
|
+
childCommand: z4.string().min(1).nullable().optional()
|
|
6321
6560
|
}).strict();
|
|
6322
|
-
var InputRecordSchema =
|
|
6323
|
-
version:
|
|
6324
|
-
kind:
|
|
6561
|
+
var InputRecordSchema = z4.object({
|
|
6562
|
+
version: z4.literal(1),
|
|
6563
|
+
kind: z4.literal("input"),
|
|
6325
6564
|
task: taskId,
|
|
6326
|
-
runId:
|
|
6327
|
-
source:
|
|
6328
|
-
pr:
|
|
6329
|
-
round:
|
|
6565
|
+
runId: z4.string().min(1),
|
|
6566
|
+
source: z4.union([z4.literal("fresh"), z4.literal("resume")]),
|
|
6567
|
+
pr: z4.number().int().positive().nullable(),
|
|
6568
|
+
round: z4.number().int().nonnegative(),
|
|
6330
6569
|
recordedAt: isoTimestamp
|
|
6331
6570
|
}).strict();
|
|
6332
|
-
var OwnershipRecordSchema =
|
|
6333
|
-
version:
|
|
6334
|
-
kind:
|
|
6571
|
+
var OwnershipRecordSchema = z4.object({
|
|
6572
|
+
version: z4.literal(1),
|
|
6573
|
+
kind: z4.literal("ownership"),
|
|
6335
6574
|
task: taskId,
|
|
6336
6575
|
epoch: epochNumber,
|
|
6337
|
-
ownerId:
|
|
6338
|
-
pid:
|
|
6339
|
-
host:
|
|
6576
|
+
ownerId: z4.string().min(1),
|
|
6577
|
+
pid: z4.number().int().positive(),
|
|
6578
|
+
host: z4.string().min(1),
|
|
6340
6579
|
acquiredAt: isoTimestamp
|
|
6341
6580
|
}).strict();
|
|
6342
|
-
var TransitionRecordSchema =
|
|
6343
|
-
version:
|
|
6344
|
-
kind:
|
|
6581
|
+
var TransitionRecordSchema = z4.object({
|
|
6582
|
+
version: z4.literal(1),
|
|
6583
|
+
kind: z4.literal("transition"),
|
|
6345
6584
|
task: taskId,
|
|
6346
6585
|
epoch: epochNumber,
|
|
6347
|
-
seq:
|
|
6348
|
-
from:
|
|
6349
|
-
to:
|
|
6350
|
-
detail:
|
|
6586
|
+
seq: z4.number().int().nonnegative(),
|
|
6587
|
+
from: z4.string().min(1),
|
|
6588
|
+
to: z4.string().min(1),
|
|
6589
|
+
detail: z4.string().optional(),
|
|
6351
6590
|
at: isoTimestamp
|
|
6352
6591
|
}).strict();
|
|
6353
|
-
var ManifestRecordSchema =
|
|
6354
|
-
version:
|
|
6355
|
-
kind:
|
|
6592
|
+
var ManifestRecordSchema = z4.object({
|
|
6593
|
+
version: z4.literal(1),
|
|
6594
|
+
kind: z4.literal("manifest"),
|
|
6356
6595
|
task: taskId,
|
|
6357
6596
|
round: epochNumber,
|
|
6358
|
-
repository:
|
|
6359
|
-
pr:
|
|
6360
|
-
branch:
|
|
6361
|
-
baseSha:
|
|
6362
|
-
headSha:
|
|
6363
|
-
briefHash:
|
|
6364
|
-
objectivesVersion:
|
|
6597
|
+
repository: z4.string().min(1),
|
|
6598
|
+
pr: z4.number().int().positive(),
|
|
6599
|
+
branch: z4.string().min(1),
|
|
6600
|
+
baseSha: z4.string().min(1).nullable(),
|
|
6601
|
+
headSha: z4.string().min(1),
|
|
6602
|
+
briefHash: z4.string().min(1).nullable(),
|
|
6603
|
+
objectivesVersion: z4.string().min(1).nullable(),
|
|
6365
6604
|
rulingOrdinal: epochNumber,
|
|
6366
|
-
policyDigest:
|
|
6605
|
+
policyDigest: z4.string().min(1),
|
|
6367
6606
|
recordedAt: isoTimestamp
|
|
6368
6607
|
}).strict();
|
|
6369
|
-
var roundHeadIdentity =
|
|
6370
|
-
var LoopBudgetsSchema =
|
|
6371
|
-
mechanicalRetries:
|
|
6372
|
-
reviewRounds:
|
|
6373
|
-
infrastructureRetries:
|
|
6608
|
+
var roundHeadIdentity = z4.object({ round: z4.number().int().positive(), head: z4.string().min(1) }).strict();
|
|
6609
|
+
var LoopBudgetsSchema = z4.object({
|
|
6610
|
+
mechanicalRetries: z4.number().int().nonnegative(),
|
|
6611
|
+
reviewRounds: z4.number().int().nonnegative(),
|
|
6612
|
+
infrastructureRetries: z4.number().int().nonnegative()
|
|
6374
6613
|
}).strict();
|
|
6375
|
-
var LoopStateRecordSchema =
|
|
6376
|
-
version:
|
|
6377
|
-
kind:
|
|
6614
|
+
var LoopStateRecordSchema = z4.object({
|
|
6615
|
+
version: z4.literal(1),
|
|
6616
|
+
kind: z4.literal("loop_state"),
|
|
6378
6617
|
task: taskId,
|
|
6379
|
-
round:
|
|
6380
|
-
phase:
|
|
6381
|
-
pauseReason:
|
|
6618
|
+
round: z4.number().int().positive(),
|
|
6619
|
+
phase: z4.string().min(1),
|
|
6620
|
+
pauseReason: z4.string().min(1).nullable(),
|
|
6382
6621
|
budgets: LoopBudgetsSchema,
|
|
6383
6622
|
heldResult: roundHeadIdentity.nullable(),
|
|
6384
6623
|
deliveredFindings: roundHeadIdentity.nullable(),
|
|
6385
|
-
repeatMemory:
|
|
6386
|
-
blockingFindings:
|
|
6387
|
-
lastFailure:
|
|
6624
|
+
repeatMemory: z4.object({
|
|
6625
|
+
blockingFindings: z4.array(z4.string()),
|
|
6626
|
+
lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
|
|
6388
6627
|
}).strict().optional(),
|
|
6628
|
+
publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
|
|
6629
|
+
taskStartedAt: isoTimestamp.optional(),
|
|
6630
|
+
phaseMs: z4.record(z4.string(), z4.number().nonnegative()).optional(),
|
|
6389
6631
|
recordedAt: isoTimestamp
|
|
6390
6632
|
}).strict();
|
|
6391
|
-
var EffectRecordSchema =
|
|
6392
|
-
version:
|
|
6393
|
-
kind:
|
|
6633
|
+
var EffectRecordSchema = z4.object({
|
|
6634
|
+
version: z4.literal(1),
|
|
6635
|
+
kind: z4.literal("effect"),
|
|
6394
6636
|
task: taskId,
|
|
6395
|
-
key:
|
|
6396
|
-
operation:
|
|
6397
|
-
target:
|
|
6398
|
-
inputVersion:
|
|
6399
|
-
payloadDigest:
|
|
6400
|
-
status:
|
|
6401
|
-
url:
|
|
6637
|
+
key: z4.string().min(1),
|
|
6638
|
+
operation: z4.string().min(1),
|
|
6639
|
+
target: z4.string().min(1),
|
|
6640
|
+
inputVersion: z4.number().int().nonnegative(),
|
|
6641
|
+
payloadDigest: z4.string().min(1),
|
|
6642
|
+
status: z4.union([z4.literal("started"), z4.literal("verified"), z4.literal("uncertain")]),
|
|
6643
|
+
url: z4.string().optional(),
|
|
6402
6644
|
recordedAt: isoTimestamp
|
|
6403
6645
|
}).strict();
|
|
6404
|
-
var EscalationRecordSchema =
|
|
6405
|
-
version:
|
|
6406
|
-
kind:
|
|
6646
|
+
var EscalationRecordSchema = z4.object({
|
|
6647
|
+
version: z4.literal(1),
|
|
6648
|
+
kind: z4.literal("escalation"),
|
|
6407
6649
|
task: taskId,
|
|
6408
|
-
escalationId:
|
|
6650
|
+
escalationId: z4.string().min(1),
|
|
6409
6651
|
round: epochNumber,
|
|
6410
|
-
head:
|
|
6411
|
-
branch:
|
|
6412
|
-
pr:
|
|
6413
|
-
runId:
|
|
6414
|
-
pid:
|
|
6415
|
-
host:
|
|
6416
|
-
agent:
|
|
6417
|
-
reason:
|
|
6418
|
-
detail:
|
|
6419
|
-
evidence:
|
|
6420
|
-
attemptedRecovery:
|
|
6421
|
-
requestedDecision:
|
|
6422
|
-
recipient:
|
|
6423
|
-
briefHash:
|
|
6424
|
-
objectivesVersion:
|
|
6652
|
+
head: z4.string().min(1),
|
|
6653
|
+
branch: z4.string().min(1),
|
|
6654
|
+
pr: z4.number().int().positive().nullable(),
|
|
6655
|
+
runId: z4.string().min(1),
|
|
6656
|
+
pid: z4.number().int().positive(),
|
|
6657
|
+
host: z4.string().min(1),
|
|
6658
|
+
agent: z4.string().min(1).optional(),
|
|
6659
|
+
reason: z4.string().min(1),
|
|
6660
|
+
detail: z4.string().optional(),
|
|
6661
|
+
evidence: z4.string().optional(),
|
|
6662
|
+
attemptedRecovery: z4.string().min(1),
|
|
6663
|
+
requestedDecision: z4.string().min(1),
|
|
6664
|
+
recipient: z4.string().min(1),
|
|
6665
|
+
briefHash: z4.string().min(1).nullable(),
|
|
6666
|
+
objectivesVersion: z4.string().min(1).nullable(),
|
|
6425
6667
|
rulingOrdinal: epochNumber,
|
|
6426
|
-
policyDigest:
|
|
6668
|
+
policyDigest: z4.string().min(1),
|
|
6427
6669
|
recordedAt: isoTimestamp
|
|
6428
6670
|
}).strict();
|
|
6429
|
-
var ResolutionRecordSchema =
|
|
6430
|
-
version:
|
|
6431
|
-
kind:
|
|
6671
|
+
var ResolutionRecordSchema = z4.object({
|
|
6672
|
+
version: z4.literal(1),
|
|
6673
|
+
kind: z4.literal("resolution"),
|
|
6432
6674
|
task: taskId,
|
|
6433
|
-
escalationId:
|
|
6434
|
-
decision:
|
|
6435
|
-
authenticatedBy:
|
|
6436
|
-
authenticatedFrom:
|
|
6675
|
+
escalationId: z4.string().min(1),
|
|
6676
|
+
decision: z4.union([z4.literal("resume"), z4.literal("cancel")]),
|
|
6677
|
+
authenticatedBy: z4.string().min(1),
|
|
6678
|
+
authenticatedFrom: z4.string().min(1),
|
|
6437
6679
|
consumedAt: isoTimestamp
|
|
6438
6680
|
}).strict();
|
|
6681
|
+
// ../../packages/aeg-core/src/control-store/local.ts
|
|
6682
|
+
var CONTROL_AREA_DIRNAME = "control";
|
|
6683
|
+
// src/lib/init-hook-paths.ts
|
|
6684
|
+
var TRACKED_HOOK_DIR = ".vinaya/hooks";
|
|
6685
|
+
var HOOK_DIRS = [".husky", ".git/hooks", TRACKED_HOOK_DIR];
|
|
6686
|
+
var INIT_HOOK_NAMES = ["pre-commit", "pre-push", "commit-msg"];
|
|
6687
|
+
function initHookPaths() {
|
|
6688
|
+
return HOOK_DIRS.flatMap((dir) => INIT_HOOK_NAMES.map((name) => `${dir}/${name}`));
|
|
6689
|
+
}
|
|
6690
|
+
|
|
6691
|
+
// src/lib/github-crossing-files.ts
|
|
6692
|
+
import { existsSync, readdirSync, readFileSync as readFileSync2, statSync } from "node:fs";
|
|
6693
|
+
function isGithubCrossingLine(line) {
|
|
6694
|
+
const createMatch = /\bgh\s+(pr|issue)\s+create\b/.test(line);
|
|
6695
|
+
const editWithBodyOrTitle = /\bgh\s+(pr|issue)\s+edit\b/.test(line) && /--body\b|--body-file\b|--title\b|(?:^|\s)-b(?:\s|$)|(?:^|\s)-F(?:\s|$)|(?:^|\s)-t(?:\s|$)/.test(line);
|
|
6696
|
+
const apiPost = /\bgh\s+api\b/.test(line) && /-X\s*POST\b|--method\s*POST\b|(?:^|\s)-f(?:\s|$)|(?:^|\s)-F(?:\s|$)/.test(line) && /(\/pulls|\/issues)(["'\s]|$)/.test(line);
|
|
6697
|
+
const apiPatch = /\bgh\s+api\b/.test(line) && /-X\s*PATCH\b|--method\s*PATCH\b/.test(line) && /(\/pulls|\/issues)\/[0-9]+(["'\s]|$)/.test(line);
|
|
6698
|
+
const curlWrite = /\b(curl|wget)\b/.test(line) && /api\.github\.com/.test(line) && /(\/pulls|\/issues)/.test(line) && /-X\s*(POST|PATCH|PUT)\b|--method\s*(POST|PATCH|PUT)\b|--data\b|(?:^|\s)-d(?:\s|$)|--json\b|--post-data\b/.test(line);
|
|
6699
|
+
return createMatch || editWithBodyOrTitle || apiPost || apiPatch || curlWrite;
|
|
6700
|
+
}
|
|
6701
|
+
function globCandidateFiles() {
|
|
6702
|
+
const out = [];
|
|
6703
|
+
if (existsSync(".husky")) {
|
|
6704
|
+
for (const name of readdirSync(".husky")) {
|
|
6705
|
+
if (name === "_")
|
|
6706
|
+
continue;
|
|
6707
|
+
const rel = `.husky/${name}`;
|
|
6708
|
+
if (statSync(rel).isFile())
|
|
6709
|
+
out.push(rel);
|
|
6710
|
+
}
|
|
6711
|
+
}
|
|
6712
|
+
if (existsSync(".claude/hooks")) {
|
|
6713
|
+
for (const name of readdirSync(".claude/hooks")) {
|
|
6714
|
+
if (name.endsWith(".sh"))
|
|
6715
|
+
out.push(`.claude/hooks/${name}`);
|
|
6716
|
+
}
|
|
6717
|
+
}
|
|
6718
|
+
return out;
|
|
6719
|
+
}
|
|
6720
|
+
function findCrossingFiles(candidateFiles) {
|
|
6721
|
+
return candidateFiles.filter((path) => readFileSync2(path, "utf8").split(`
|
|
6722
|
+
`).some((line) => isGithubCrossingLine(line)));
|
|
6723
|
+
}
|
|
6724
|
+
|
|
6725
|
+
// src/lib/log-producer-graph.ts
|
|
6726
|
+
import { readFileSync as readFileSync4 } from "node:fs";
|
|
6727
|
+
import { join as join2, relative } from "node:path";
|
|
6728
|
+
|
|
6729
|
+
// src/lib/test-selector.ts
|
|
6730
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync3, statSync as statSync2 } from "node:fs";
|
|
6731
|
+
import { dirname, extname, isAbsolute, join, resolve } from "node:path";
|
|
6732
|
+
|
|
6733
|
+
// src/lib/repo-scanner-tests.ts
|
|
6734
|
+
var TREE_READERS = new Set([
|
|
6735
|
+
"readdirSync",
|
|
6736
|
+
"readdir",
|
|
6737
|
+
"opendirSync",
|
|
6738
|
+
"opendir",
|
|
6739
|
+
"globSync",
|
|
6740
|
+
"globIterateSync",
|
|
6741
|
+
"readdirp"
|
|
6742
|
+
]);
|
|
6743
|
+
var SPAWN_CALLS = new Set(["execFileSync", "execSync", "spawnSync", "spawn", "exec", "execFile"]);
|
|
6744
|
+
var PROCESS_CALLS = new Set([...SPAWN_CALLS, "fork"]);
|
|
6745
|
+
|
|
6746
|
+
// src/lib/test-selector.ts
|
|
6747
|
+
var SOURCE_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"];
|
|
6748
|
+
var SKIP_DIRS = new Set(["node_modules", "dist", ".git", "build", "coverage"]);
|
|
6749
|
+
var OUTPUT_TO_SOURCE_EXTENSIONS = new Map([
|
|
6750
|
+
[".js", [".ts", ".tsx"]],
|
|
6751
|
+
[".jsx", [".tsx"]],
|
|
6752
|
+
[".mjs", [".mts"]],
|
|
6753
|
+
[".cjs", [".cts"]]
|
|
6754
|
+
]);
|
|
6755
|
+
var FROM_CLAUSE_RE = /^\s*(import|export)\b\s*([^'"]*?)\bfrom\s*(['"])([^'"]+)\3/gm;
|
|
6756
|
+
var QUOTED_LIST_CLAUSE_RE = /^\s*(import|export)\b\s*((?:type\s+)?(?:[A-Za-z_$][\w$]*\s*,\s*)?\{[^{}]*\})\s*from\s*(['"])([^'"]+)\3/gm;
|
|
6757
|
+
var SIDE_EFFECT_IMPORT_RE = /^\s*import\s*(['"])([^'"]+)\1/gm;
|
|
6758
|
+
var DYNAMIC_IMPORT_RE = /\bimport\s*\(\s*(['"])([^'"]+)\1\s*\)/g;
|
|
6759
|
+
var IMPORT_EQUALS_REQUIRE_RE = /^\s*(?:export\s+)?import\s+[A-Za-z_$][\w$]*\s*=\s*require\s*\(\s*(['"])([^'"]+)\1\s*\)/gm;
|
|
6760
|
+
var COMMENT_RE = /\/\*[\s\S]*?\*\/|\/\/[^\n]*/g;
|
|
6761
|
+
function parseNamedList(inside) {
|
|
6762
|
+
const names = [];
|
|
6763
|
+
let clean = true;
|
|
6764
|
+
const entries = inside.replace(COMMENT_RE, "").split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
6765
|
+
if (entries.length === 0)
|
|
6766
|
+
clean = false;
|
|
6767
|
+
for (const raw of entries) {
|
|
6768
|
+
const entry = raw.replace(/^type\s+/, "");
|
|
6769
|
+
const origin = entry.split(/\s+as\s+/)[0].trim();
|
|
6770
|
+
if (/^[A-Za-z_$][\w$]*$/.test(origin))
|
|
6771
|
+
names.push(origin);
|
|
6772
|
+
else
|
|
6773
|
+
clean = false;
|
|
6774
|
+
}
|
|
6775
|
+
return { names, clean };
|
|
6776
|
+
}
|
|
6777
|
+
function classifyFromClause(clause, specifier) {
|
|
6778
|
+
const c = clause.trim().replace(/^type\s+/, "");
|
|
6779
|
+
if (c.startsWith("*")) {
|
|
6780
|
+
return /^\*\s+as\s+/.test(c) ? { kind: "namespace", specifier } : { kind: "star", specifier };
|
|
6781
|
+
}
|
|
6782
|
+
if (c.startsWith("{")) {
|
|
6783
|
+
const { names, clean } = parseNamedList(c.slice(1, c.lastIndexOf("}")));
|
|
6784
|
+
return { kind: "named", specifier, names, clean };
|
|
6785
|
+
}
|
|
6786
|
+
return { kind: "default", specifier };
|
|
6787
|
+
}
|
|
6788
|
+
function collectRecords(source, includeExportFrom) {
|
|
6789
|
+
const records = [];
|
|
6790
|
+
FROM_CLAUSE_RE.lastIndex = 0;
|
|
6791
|
+
for (let m = FROM_CLAUSE_RE.exec(source);m !== null; m = FROM_CLAUSE_RE.exec(source)) {
|
|
6792
|
+
if (!includeExportFrom && m[1] !== "import")
|
|
6793
|
+
continue;
|
|
6794
|
+
records.push(classifyFromClause(m[2], m[4]));
|
|
6795
|
+
}
|
|
6796
|
+
QUOTED_LIST_CLAUSE_RE.lastIndex = 0;
|
|
6797
|
+
for (let m = QUOTED_LIST_CLAUSE_RE.exec(source);m !== null; m = QUOTED_LIST_CLAUSE_RE.exec(source)) {
|
|
6798
|
+
if (!/['"]/.test(m[2]))
|
|
6799
|
+
continue;
|
|
6800
|
+
if (!includeExportFrom && m[1] !== "import")
|
|
6801
|
+
continue;
|
|
6802
|
+
records.push(classifyFromClause(m[2], m[4]));
|
|
6803
|
+
}
|
|
6804
|
+
SIDE_EFFECT_IMPORT_RE.lastIndex = 0;
|
|
6805
|
+
for (let m = SIDE_EFFECT_IMPORT_RE.exec(source);m !== null; m = SIDE_EFFECT_IMPORT_RE.exec(source)) {
|
|
6806
|
+
records.push({ kind: "side-effect", specifier: m[2] });
|
|
6807
|
+
}
|
|
6808
|
+
DYNAMIC_IMPORT_RE.lastIndex = 0;
|
|
6809
|
+
for (let m = DYNAMIC_IMPORT_RE.exec(source);m !== null; m = DYNAMIC_IMPORT_RE.exec(source)) {
|
|
6810
|
+
records.push({ kind: "dynamic", specifier: m[2] });
|
|
6811
|
+
}
|
|
6812
|
+
IMPORT_EQUALS_REQUIRE_RE.lastIndex = 0;
|
|
6813
|
+
for (let m = IMPORT_EQUALS_REQUIRE_RE.exec(source);m !== null; m = IMPORT_EQUALS_REQUIRE_RE.exec(source)) {
|
|
6814
|
+
records.push({ kind: "namespace", specifier: m[2] });
|
|
6815
|
+
}
|
|
6816
|
+
return records;
|
|
6817
|
+
}
|
|
6818
|
+
function extractImportRecords(source) {
|
|
6819
|
+
return collectRecords(source, true);
|
|
6820
|
+
}
|
|
6821
|
+
function walkFiles(root) {
|
|
6822
|
+
const out = [];
|
|
6823
|
+
let entries;
|
|
6824
|
+
try {
|
|
6825
|
+
entries = readdirSync2(root);
|
|
6826
|
+
} catch {
|
|
6827
|
+
return out;
|
|
6828
|
+
}
|
|
6829
|
+
for (const entry of entries) {
|
|
6830
|
+
if (SKIP_DIRS.has(entry))
|
|
6831
|
+
continue;
|
|
6832
|
+
const abs = join(root, entry);
|
|
6833
|
+
let s;
|
|
6834
|
+
try {
|
|
6835
|
+
s = statSync2(abs);
|
|
6836
|
+
} catch {
|
|
6837
|
+
continue;
|
|
6838
|
+
}
|
|
6839
|
+
if (s.isDirectory()) {
|
|
6840
|
+
out.push(...walkFiles(abs));
|
|
6841
|
+
} else {
|
|
6842
|
+
out.push(abs);
|
|
6843
|
+
}
|
|
6844
|
+
}
|
|
6845
|
+
return out;
|
|
6846
|
+
}
|
|
6847
|
+
function resolveFileCandidate(base, knownFiles) {
|
|
6848
|
+
if (knownFiles.has(base))
|
|
6849
|
+
return base;
|
|
6850
|
+
const written = extname(base);
|
|
6851
|
+
for (const ext of OUTPUT_TO_SOURCE_EXTENSIONS.get(written) ?? []) {
|
|
6852
|
+
const source = base.slice(0, -written.length) + ext;
|
|
6853
|
+
if (knownFiles.has(source))
|
|
6854
|
+
return source;
|
|
6855
|
+
}
|
|
6856
|
+
for (const ext of SOURCE_EXTENSIONS) {
|
|
6857
|
+
if (knownFiles.has(base + ext))
|
|
6858
|
+
return base + ext;
|
|
6859
|
+
}
|
|
6860
|
+
for (const ext of SOURCE_EXTENSIONS) {
|
|
6861
|
+
const indexed = join(base, `index${ext}`);
|
|
6862
|
+
if (knownFiles.has(indexed))
|
|
6863
|
+
return indexed;
|
|
6864
|
+
}
|
|
6865
|
+
return null;
|
|
6866
|
+
}
|
|
6867
|
+
function resolveRelativeImport(fromFile, specifier, knownFiles) {
|
|
6868
|
+
if (!specifier.startsWith("."))
|
|
6869
|
+
return null;
|
|
6870
|
+
return resolveFileCandidate(resolve(dirname(fromFile), specifier), knownFiles);
|
|
6871
|
+
}
|
|
6872
|
+
var TYPE_ONLY_CONDITIONS = new Set(["types", "typings"]);
|
|
6873
|
+
|
|
6874
|
+
// src/lib/log-producer-graph.ts
|
|
6875
|
+
var CLI_SOURCE_DIR = "apps/cli/src";
|
|
6876
|
+
var LOG_SINK_PATH = "apps/cli/src/lib/log-sink.ts";
|
|
6877
|
+
var LOG_SINK_PRODUCER_NAMES = ["log", "logSync"];
|
|
6878
|
+
var NOT_REACHED_BY_IMPORT_CHECK_BIN = "a check bin: it runs only as a child of `vinaya check`, whose runner records one gate event per attempt, so no import of the sink is needed";
|
|
6879
|
+
var NOT_REACHED_STANDALONE_SCRIPT = "a standalone script outside the CLI package: the import resolution cannot follow it and no CLI source imports it; invoked directly, it records nothing of its own";
|
|
6880
|
+
var G7_EXEMPTIONS = {
|
|
6881
|
+
"apps/cli/src/checks/bin/check-review-gate.ts": NOT_REACHED_BY_IMPORT_CHECK_BIN,
|
|
6882
|
+
"apps/cli/src/checks/bin/check-main-branch-refusal.ts": NOT_REACHED_BY_IMPORT_CHECK_BIN,
|
|
6883
|
+
"apps/cli/src/checks/bin/check-token-collection-wired.ts": NOT_REACHED_BY_IMPORT_CHECK_BIN,
|
|
6884
|
+
"apps/cli/src/checks/resolver.ts": "the pure step that decides which checks `vinaya check` runs; the runner it feeds records each run and the invocation records its own operation at exit",
|
|
6885
|
+
"packages/aeg-core/bin/open-pr.ts": NOT_REACHED_STANDALONE_SCRIPT,
|
|
6886
|
+
"packages/aeg-core/bin/open-issue.ts": NOT_REACHED_STANDALONE_SCRIPT,
|
|
6887
|
+
"packages/aeg-core/bin/verify-dispatch.ts": NOT_REACHED_STANDALONE_SCRIPT,
|
|
6888
|
+
"packages/aeg-core/bin/verify-task.ts": NOT_REACHED_STANDALONE_SCRIPT,
|
|
6889
|
+
"packages/aeg-core/bin/check-branch-topology.ts": NOT_REACHED_STANDALONE_SCRIPT,
|
|
6890
|
+
"packages/aeg-core/bin/check-push-target.ts": NOT_REACHED_STANDALONE_SCRIPT,
|
|
6891
|
+
"packages/aeg-core/bin/check-first-push-dispatch.ts": NOT_REACHED_STANDALONE_SCRIPT,
|
|
6892
|
+
"packages/aeg-core/bin/assign-task-issue.ts": NOT_REACHED_STANDALONE_SCRIPT,
|
|
6893
|
+
"packages/aeg-core/src/brief-validation.ts": "a pure library outside the CLI package: it makes no call of its own, and the import resolution does not follow a workspace package"
|
|
6894
|
+
};
|
|
6895
|
+
function blockingGateFiles(ring0Rows, existsFn) {
|
|
6896
|
+
return [...new Set(ring0Rows.map((r) => r.implementation).filter((p) => p.endsWith(".ts") && existsFn(p)))];
|
|
6897
|
+
}
|
|
6898
|
+
function gatherLogProducerGraph(root) {
|
|
6899
|
+
const files = walkFiles(join2(root, CLI_SOURCE_DIR)).filter((f) => f.endsWith(".ts") && !f.endsWith(".test.ts"));
|
|
6900
|
+
const known = new Set(files);
|
|
6901
|
+
const sink = join2(root, LOG_SINK_PATH);
|
|
6902
|
+
const producers = new Set([LOG_SINK_PATH]);
|
|
6903
|
+
const imports = new Map;
|
|
6904
|
+
for (const file of files) {
|
|
6905
|
+
const deps = [];
|
|
6906
|
+
for (const record of extractImportRecords(readFileSync4(file, "utf8"))) {
|
|
6907
|
+
const target = resolveRelativeImport(file, record.specifier, known);
|
|
6908
|
+
if (target === null)
|
|
6909
|
+
continue;
|
|
6910
|
+
deps.push(relative(root, target));
|
|
6911
|
+
if (target === sink && record.kind === "named" && record.names.some((n) => LOG_SINK_PRODUCER_NAMES.includes(n))) {
|
|
6912
|
+
producers.add(relative(root, file));
|
|
6913
|
+
}
|
|
6914
|
+
}
|
|
6915
|
+
imports.set(relative(root, file), deps);
|
|
6916
|
+
}
|
|
6917
|
+
return { producers, imports };
|
|
6918
|
+
}
|
|
6919
|
+
|
|
6439
6920
|
// src/checks/contract.ts
|
|
6440
6921
|
var CHECK_SCHEMA_VERSION = 1;
|
|
6441
6922
|
function emitCheckError(error) {
|
|
@@ -6444,19 +6925,19 @@ function emitCheckError(error) {
|
|
|
6444
6925
|
}
|
|
6445
6926
|
|
|
6446
6927
|
// src/checks/registry.ts
|
|
6447
|
-
import {
|
|
6448
|
-
import {
|
|
6928
|
+
import { join as join4, relative as relative2, sep } from "node:path";
|
|
6929
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
6449
6930
|
|
|
6450
6931
|
// src/lib/package-root.ts
|
|
6451
|
-
import { existsSync } from "node:fs";
|
|
6452
|
-
import { dirname, join } from "node:path";
|
|
6932
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
6933
|
+
import { dirname as dirname2, join as join3 } from "node:path";
|
|
6453
6934
|
import { fileURLToPath } from "node:url";
|
|
6454
6935
|
function packageRoot(moduleUrl) {
|
|
6455
|
-
let dir =
|
|
6456
|
-
while (!
|
|
6457
|
-
if (
|
|
6936
|
+
let dir = dirname2(fileURLToPath(moduleUrl));
|
|
6937
|
+
while (!existsSync2(join3(dir, "package.json"))) {
|
|
6938
|
+
if (existsSync2(join3(dir, ".git")))
|
|
6458
6939
|
break;
|
|
6459
|
-
const parent =
|
|
6940
|
+
const parent = dirname2(dir);
|
|
6460
6941
|
if (parent === dir)
|
|
6461
6942
|
break;
|
|
6462
6943
|
dir = parent;
|
|
@@ -6465,12 +6946,16 @@ function packageRoot(moduleUrl) {
|
|
|
6465
6946
|
}
|
|
6466
6947
|
|
|
6467
6948
|
// src/checks/registry.ts
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6949
|
+
function resolveCheckBin(packageDir, moduleUrl) {
|
|
6950
|
+
const fromPackage = relative2(packageDir, fileURLToPath2(moduleUrl));
|
|
6951
|
+
const bundled = fromPackage === "dist" || fromPackage.startsWith(`dist${sep}`);
|
|
6952
|
+
return bundled ? { dir: join4(packageDir, "dist", "checks", "bin"), ext: ".js" } : { dir: join4(packageDir, "src", "checks", "bin"), ext: ".ts" };
|
|
6953
|
+
}
|
|
6954
|
+
var CHECK_BIN = resolveCheckBin(packageRoot(import.meta.url), import.meta.url);
|
|
6955
|
+
var BIN_DIR = CHECK_BIN.dir;
|
|
6956
|
+
var BIN_EXT = CHECK_BIN.ext;
|
|
6472
6957
|
function bin(name) {
|
|
6473
|
-
return
|
|
6958
|
+
return join4(BIN_DIR, `${name}${BIN_EXT}`);
|
|
6474
6959
|
}
|
|
6475
6960
|
var REGISTRY = [
|
|
6476
6961
|
[
|
|
@@ -6512,6 +6997,8 @@ var REGISTRY = [
|
|
|
6512
6997
|
timeoutMs: 15000,
|
|
6513
6998
|
env: {
|
|
6514
6999
|
BASE_SHA: { optional: true },
|
|
7000
|
+
GIT_INDEX_FILE: { optional: true },
|
|
7001
|
+
VINAYA_COMMIT_HOOK: { optional: true },
|
|
6515
7002
|
PR_BODY: { optional: true },
|
|
6516
7003
|
PR_BODY_FILE: { optional: true },
|
|
6517
7004
|
PR_NUMBER: { optional: true },
|
|
@@ -6666,23 +7153,6 @@ var REGISTRY = [
|
|
|
6666
7153
|
},
|
|
6667
7154
|
1
|
|
6668
7155
|
],
|
|
6669
|
-
[
|
|
6670
|
-
{
|
|
6671
|
-
name: "token-report",
|
|
6672
|
-
validates: "body",
|
|
6673
|
-
run: bin("check-token-report"),
|
|
6674
|
-
scope: "diff",
|
|
6675
|
-
timeoutMs: 15000,
|
|
6676
|
-
requiresOpenPr: true,
|
|
6677
|
-
env: {
|
|
6678
|
-
PR_BODY: { optional: true },
|
|
6679
|
-
BRANCH: { optional: true },
|
|
6680
|
-
CLAUDE_PROJECT_DIR: { optional: true },
|
|
6681
|
-
CLAUDE_CODE_SESSION_ID: { optional: true }
|
|
6682
|
-
}
|
|
6683
|
-
},
|
|
6684
|
-
1
|
|
6685
|
-
],
|
|
6686
7156
|
[
|
|
6687
7157
|
{
|
|
6688
7158
|
name: "no-disk-state",
|
|
@@ -7033,43 +7503,29 @@ var CHECK_NAME = "registry-gates";
|
|
|
7033
7503
|
var ENFORCEMENT_PATH = "aeg-root/enforcement.md";
|
|
7034
7504
|
var ROLES_DIR = "aeg-root/roles";
|
|
7035
7505
|
var CONTRACTS_DIR = "aeg-root/contracts";
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
const editWithBodyOrTitle = /\bgh\s+(pr|issue)\s+edit\b/.test(line) && /--body\b|--body-file\b|--title\b|(?:^|\s)-b(?:\s|$)|(?:^|\s)-F(?:\s|$)|(?:^|\s)-t(?:\s|$)/.test(line);
|
|
7039
|
-
const apiPost = /\bgh\s+api\b/.test(line) && /-X\s*POST\b|--method\s*POST\b|(?:^|\s)-f(?:\s|$)|(?:^|\s)-F(?:\s|$)/.test(line) && /(\/pulls|\/issues)(["'\s]|$)/.test(line);
|
|
7040
|
-
const apiPatch = /\bgh\s+api\b/.test(line) && /-X\s*PATCH\b|--method\s*PATCH\b/.test(line) && /(\/pulls|\/issues)\/[0-9]+(["'\s]|$)/.test(line);
|
|
7041
|
-
const curlWrite = /\b(curl|wget)\b/.test(line) && /api\.github\.com/.test(line) && /(\/pulls|\/issues)/.test(line) && /-X\s*(POST|PATCH|PUT)\b|--method\s*(POST|PATCH|PUT)\b|--data\b|(?:^|\s)-d(?:\s|$)|--json\b|--post-data\b/.test(line);
|
|
7042
|
-
return createMatch || editWithBodyOrTitle || apiPost || apiPatch || curlWrite;
|
|
7043
|
-
}
|
|
7044
|
-
function globCandidateFiles() {
|
|
7506
|
+
var DOCTRINE_DIR = "aeg-root";
|
|
7507
|
+
function readHookScanFiles(dir) {
|
|
7045
7508
|
const out = [];
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
out.push(rel);
|
|
7053
|
-
}
|
|
7054
|
-
}
|
|
7055
|
-
if (existsSync3(".claude/hooks")) {
|
|
7056
|
-
for (const name of readdirSync(".claude/hooks")) {
|
|
7057
|
-
if (name.endsWith(".sh"))
|
|
7058
|
-
out.push(`.claude/hooks/${name}`);
|
|
7059
|
-
}
|
|
7509
|
+
for (const entry of readdirSync3(dir, { withFileTypes: true })) {
|
|
7510
|
+
const rel = join5(dir, entry.name);
|
|
7511
|
+
if (entry.isDirectory())
|
|
7512
|
+
out.push(...readHookScanFiles(rel));
|
|
7513
|
+
else if (entry.name.endsWith(".md"))
|
|
7514
|
+
out.push({ path: rel, content: readFileSync5(rel, "utf8") });
|
|
7060
7515
|
}
|
|
7061
7516
|
return out;
|
|
7062
7517
|
}
|
|
7063
|
-
function
|
|
7064
|
-
|
|
7065
|
-
`).
|
|
7518
|
+
function shippedHookPaths() {
|
|
7519
|
+
const tracked = sh("git ls-files").split(`
|
|
7520
|
+
`).filter(Boolean);
|
|
7521
|
+
return new Set([...tracked, ...initHookPaths()]);
|
|
7066
7522
|
}
|
|
7067
7523
|
function readRoles() {
|
|
7068
7524
|
if (!existsSync3(ROLES_DIR))
|
|
7069
7525
|
return [];
|
|
7070
|
-
return
|
|
7526
|
+
return readdirSync3(ROLES_DIR).filter((name) => name.endsWith(".md")).map((name) => {
|
|
7071
7527
|
const rel = `${ROLES_DIR}/${name}`;
|
|
7072
|
-
const { data } = matter2(
|
|
7528
|
+
const { data } = matter2(readFileSync5(rel, "utf8"));
|
|
7073
7529
|
return {
|
|
7074
7530
|
file: rel,
|
|
7075
7531
|
role_id: typeof data.role_id === "string" ? data.role_id : "",
|
|
@@ -7081,9 +7537,9 @@ function readRoles() {
|
|
|
7081
7537
|
function readContracts() {
|
|
7082
7538
|
if (!existsSync3(CONTRACTS_DIR))
|
|
7083
7539
|
return [];
|
|
7084
|
-
return
|
|
7540
|
+
return readdirSync3(CONTRACTS_DIR).filter((name) => name.endsWith(".md")).map((name) => {
|
|
7085
7541
|
const rel = `${CONTRACTS_DIR}/${name}`;
|
|
7086
|
-
const { data } = matter2(
|
|
7542
|
+
const { data } = matter2(readFileSync5(rel, "utf8"));
|
|
7087
7543
|
return {
|
|
7088
7544
|
file: rel,
|
|
7089
7545
|
producer: typeof data.producer === "string" ? data.producer : "",
|
|
@@ -7164,7 +7620,7 @@ async function main() {
|
|
|
7164
7620
|
});
|
|
7165
7621
|
process.exit(0);
|
|
7166
7622
|
}
|
|
7167
|
-
const enforcementContent =
|
|
7623
|
+
const enforcementContent = readFileSync5(ENFORCEMENT_PATH, "utf8");
|
|
7168
7624
|
const rows = parseEnforcementRegistry(enforcementContent);
|
|
7169
7625
|
const ring0Rows = rows.filter((r) => r.ring === "ring0");
|
|
7170
7626
|
const candidateFiles = globCandidateFiles();
|
|
@@ -7182,18 +7638,29 @@ async function main() {
|
|
|
7182
7638
|
}
|
|
7183
7639
|
]
|
|
7184
7640
|
};
|
|
7185
|
-
const g1 = checkG1(rows, existsSync3);
|
|
7641
|
+
const g1 = checkG1(rows, existsSync3, { docs: readHookScanFiles(DOCTRINE_DIR), shipped: shippedHookPaths() });
|
|
7186
7642
|
const g2 = checkG2(rows, candidateFiles);
|
|
7187
7643
|
const g3 = checkG3(ring0Rows, crossingFiles);
|
|
7188
7644
|
const g5 = checkG5(roles, contracts);
|
|
7189
7645
|
const g6 = checkG6(rows, new Set(coreCheckRegistry().map((s) => s.name)));
|
|
7646
|
+
const { producers, imports } = gatherLogProducerGraph(process.cwd());
|
|
7647
|
+
const g7 = checkG7({
|
|
7648
|
+
enforcementMapPresent: true,
|
|
7649
|
+
crossingFiles,
|
|
7650
|
+
blockingFiles: blockingGateFiles(ring0Rows, existsSync3),
|
|
7651
|
+
producers,
|
|
7652
|
+
imports,
|
|
7653
|
+
exemptions: G7_EXEMPTIONS,
|
|
7654
|
+
existsFn: existsSync3
|
|
7655
|
+
});
|
|
7190
7656
|
emitResult(g1, true);
|
|
7191
7657
|
emitResult(g2, true);
|
|
7192
7658
|
emitResult(g3, true);
|
|
7193
7659
|
emitResult(g4Result, true);
|
|
7194
7660
|
emitResult(g5, true);
|
|
7195
7661
|
emitResult(g6, true);
|
|
7196
|
-
|
|
7662
|
+
emitResult(g7, true);
|
|
7663
|
+
const blockingFailed = [g1, g2, g3, g4Result, g5, g6, g7].some((r) => r.status === "fail");
|
|
7197
7664
|
process.exit(blockingFailed ? 1 : 0);
|
|
7198
7665
|
}
|
|
7199
7666
|
main();
|