@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,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/checks/bin/check-doctrine-portability.ts
|
|
4
4
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
5
|
-
import { readdirSync as readdirSync3, readFileSync as
|
|
5
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync8, statSync as statSync3 } from "node:fs";
|
|
6
6
|
import { join as join10 } from "node:path";
|
|
7
7
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
8
8
|
var GATE_AUDIENCE = {
|
|
@@ -629,6 +629,33 @@ function tasksFromIssues(issues) {
|
|
|
629
629
|
}
|
|
630
630
|
return tasks.sort((a, b) => compareTaskIds(a.id, b.id));
|
|
631
631
|
}
|
|
632
|
+
function resolveDuplicateTasks(tasks, isOpen) {
|
|
633
|
+
const byId = new Map;
|
|
634
|
+
for (const t of tasks)
|
|
635
|
+
byId.set(t.id, [...byId.get(t.id) ?? [], t]);
|
|
636
|
+
const resolved = [];
|
|
637
|
+
const conflicts = [];
|
|
638
|
+
for (const [id, group] of byId) {
|
|
639
|
+
const first = group[0];
|
|
640
|
+
if (!first)
|
|
641
|
+
continue;
|
|
642
|
+
if (group.length === 1) {
|
|
643
|
+
resolved.push(first);
|
|
644
|
+
continue;
|
|
645
|
+
}
|
|
646
|
+
const number = (t) => t.issue ?? 0;
|
|
647
|
+
const open = group.filter((t) => t.issue !== null && isOpen(t.issue)).sort((a, b) => number(a) - number(b));
|
|
648
|
+
if (open.length > 1) {
|
|
649
|
+
conflicts.push({ id, issues: open.map(number) });
|
|
650
|
+
resolved.push(open[0]);
|
|
651
|
+
} else if (open.length === 1) {
|
|
652
|
+
resolved.push(open[0]);
|
|
653
|
+
} else {
|
|
654
|
+
resolved.push([...group].sort((a, b) => number(b) - number(a))[0]);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
return { tasks: resolved.sort((a, b) => compareTaskIds(a.id, b.id)), conflicts };
|
|
658
|
+
}
|
|
632
659
|
async function fetchTrancheIssuesAsync(owner, repo, slug) {
|
|
633
660
|
return ghIssueListByAnyLabelAsync(owner, repo, [trancheLabel(slug)]);
|
|
634
661
|
}
|
|
@@ -1436,7 +1463,7 @@ function mapReviewDecision(decision) {
|
|
|
1436
1463
|
function buildBranchName(tranche, taskId) {
|
|
1437
1464
|
return `task/${tranche}/${taskId}`;
|
|
1438
1465
|
}
|
|
1439
|
-
async function
|
|
1466
|
+
async function fetchForgeFactsByIssue(input) {
|
|
1440
1467
|
const token = await resolveGithubToken(input.token);
|
|
1441
1468
|
if (!token) {
|
|
1442
1469
|
return {
|
|
@@ -1446,7 +1473,13 @@ async function fetchForgeFacts(input) {
|
|
|
1446
1473
|
reason: "No GitHub token available (set GITHUB_TOKEN/GH_TOKEN or `gh auth login`)."
|
|
1447
1474
|
};
|
|
1448
1475
|
}
|
|
1449
|
-
const
|
|
1476
|
+
const seen = new Set;
|
|
1477
|
+
const queriedTasks = input.tasks.filter((t) => {
|
|
1478
|
+
if (t.issue === null || seen.has(t.issue))
|
|
1479
|
+
return false;
|
|
1480
|
+
seen.add(t.issue);
|
|
1481
|
+
return true;
|
|
1482
|
+
});
|
|
1450
1483
|
if (queriedTasks.length === 0) {
|
|
1451
1484
|
return { facts: new Map, prRefs: new Map, unavailable: false };
|
|
1452
1485
|
}
|
|
@@ -1474,21 +1507,52 @@ async function fetchForgeFacts(input) {
|
|
|
1474
1507
|
};
|
|
1475
1508
|
}
|
|
1476
1509
|
for (const task of queriedTasks) {
|
|
1477
|
-
const
|
|
1478
|
-
const raw = extractRawFromResponse(response.repository, alias);
|
|
1510
|
+
const raw = extractRawFromResponse(response.repository, aliasFor(task.issue));
|
|
1479
1511
|
const mapped = mapForgeFacts(raw);
|
|
1480
1512
|
if (mapped)
|
|
1481
|
-
facts.set(task.
|
|
1513
|
+
facts.set(task.issue, mapped);
|
|
1482
1514
|
const pr = raw.pullRequest;
|
|
1483
1515
|
if (pr && typeof pr.number === "number" && typeof pr.url === "string") {
|
|
1484
|
-
prRefs.set(task.
|
|
1516
|
+
prRefs.set(task.issue, { number: pr.number, url: pr.url, state: pr.state });
|
|
1485
1517
|
}
|
|
1486
1518
|
}
|
|
1487
1519
|
return { facts, prRefs, unavailable: false };
|
|
1488
1520
|
}
|
|
1521
|
+
async function fetchForgeFacts(input) {
|
|
1522
|
+
const byIssue = await fetchForgeFactsByIssue(input);
|
|
1523
|
+
if (byIssue.unavailable) {
|
|
1524
|
+
return { facts: new Map, prRefs: new Map, unavailable: true, reason: byIssue.reason };
|
|
1525
|
+
}
|
|
1526
|
+
const facts = new Map;
|
|
1527
|
+
const prRefs = new Map;
|
|
1528
|
+
const winner = new Map;
|
|
1529
|
+
for (const task of input.tasks) {
|
|
1530
|
+
if (task.issue === null)
|
|
1531
|
+
continue;
|
|
1532
|
+
const current = winner.get(task.id);
|
|
1533
|
+
if (current === undefined || outranks(byIssue.facts, task.issue, current))
|
|
1534
|
+
winner.set(task.id, task.issue);
|
|
1535
|
+
}
|
|
1536
|
+
for (const [taskId, issue] of winner) {
|
|
1537
|
+
const f = byIssue.facts.get(issue);
|
|
1538
|
+
if (f)
|
|
1539
|
+
facts.set(taskId, f);
|
|
1540
|
+
const pr = byIssue.prRefs.get(issue);
|
|
1541
|
+
if (pr)
|
|
1542
|
+
prRefs.set(taskId, pr);
|
|
1543
|
+
}
|
|
1544
|
+
return { facts, prRefs, unavailable: false };
|
|
1545
|
+
}
|
|
1546
|
+
function outranks(facts, candidate, current) {
|
|
1547
|
+
const candidateOpen = facts.get(candidate)?.issueState === "open";
|
|
1548
|
+
const currentOpen = facts.get(current)?.issueState === "open";
|
|
1549
|
+
if (candidateOpen !== currentOpen)
|
|
1550
|
+
return candidateOpen;
|
|
1551
|
+
return candidate > current;
|
|
1552
|
+
}
|
|
1489
1553
|
function buildBatchQuery(tranche, tasks) {
|
|
1490
1554
|
const perTask = tasks.map((task) => {
|
|
1491
|
-
const a = aliasFor(task.
|
|
1555
|
+
const a = aliasFor(task.issue);
|
|
1492
1556
|
const branch = buildBranchName(tranche, task.id);
|
|
1493
1557
|
return `
|
|
1494
1558
|
${a}_issue: issue(number: ${task.issue}) {
|
|
@@ -1530,9 +1594,8 @@ function buildBatchQuery(tranche, tasks) {
|
|
|
1530
1594
|
}
|
|
1531
1595
|
}`;
|
|
1532
1596
|
}
|
|
1533
|
-
function aliasFor(
|
|
1534
|
-
|
|
1535
|
-
return `t_${sanitized}`;
|
|
1597
|
+
function aliasFor(issue) {
|
|
1598
|
+
return `i_${issue}`;
|
|
1536
1599
|
}
|
|
1537
1600
|
function extractRawFromResponse(repository, alias) {
|
|
1538
1601
|
const issue = repository[`${alias}_issue`];
|
|
@@ -1887,45 +1950,6 @@ var DERIVED_STATUSES = [
|
|
|
1887
1950
|
"incoherent"
|
|
1888
1951
|
];
|
|
1889
1952
|
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
1953
|
// ../../packages/aeg-core/src/waiver-label.ts
|
|
1930
1954
|
var WAIVER_LABEL = label("waiver-docs");
|
|
1931
1955
|
var WAIVER_LABEL_REVIEW = label("waiver-review");
|
|
@@ -1941,61 +1965,6 @@ function isWaiverLabelActorVerified(opts) {
|
|
|
1941
1965
|
return false;
|
|
1942
1966
|
return isPrincipal(opts.labelActor, opts.principalAllowlist);
|
|
1943
1967
|
}
|
|
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
1968
|
// ../../packages/aeg-core/src/verdict-extraction.ts
|
|
2000
1969
|
var HEAD_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged head:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
2001
1970
|
var OBJECTIVES_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Objectives version:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
@@ -2444,10 +2413,12 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive,
|
|
|
2444
2413
|
var CODE_REVIEW_SEVERITY_ORDER = ["BLOCKER", "MAJOR", "MINOR"];
|
|
2445
2414
|
var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
|
|
2446
2415
|
var DEFAULT_MAX_ROUNDS = 3;
|
|
2416
|
+
var DEFAULT_MAX_TASK_MINUTES = 180;
|
|
2447
2417
|
var DEFAULT_REVIEW_POLICY = {
|
|
2448
2418
|
codeReviewThreshold: "BLOCKER",
|
|
2449
2419
|
securityThreshold: "HIGH",
|
|
2450
|
-
maxRounds: DEFAULT_MAX_ROUNDS
|
|
2420
|
+
maxRounds: DEFAULT_MAX_ROUNDS,
|
|
2421
|
+
maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES
|
|
2451
2422
|
};
|
|
2452
2423
|
var FILE_SHAPED_LOCATION = /\.[a-zA-Z0-9]{1,10}(:\d+)?\s*$/;
|
|
2453
2424
|
var PROSE_LOCATION_PATTERNS = [/\bpr\s*body\b/i, /\bcomment\b/i];
|
|
@@ -2455,6 +2426,9 @@ var ROLE_FILE_LOCATION = /(^|\/)aeg-root\/roles\//i;
|
|
|
2455
2426
|
function isProseLocation(location) {
|
|
2456
2427
|
if (ROLE_FILE_LOCATION.test(location))
|
|
2457
2428
|
return true;
|
|
2429
|
+
return isBodyOrCommentLocation(location);
|
|
2430
|
+
}
|
|
2431
|
+
function isBodyOrCommentLocation(location) {
|
|
2458
2432
|
if (FILE_SHAPED_LOCATION.test(location))
|
|
2459
2433
|
return false;
|
|
2460
2434
|
return PROSE_LOCATION_PATTERNS.some((pattern) => pattern.test(location));
|
|
@@ -2481,7 +2455,7 @@ function classifyFinding(finding, scale, threshold, context = {}) {
|
|
|
2481
2455
|
const wouldBlock = blockingSeverities(scale, threshold).includes(effectiveSeverity);
|
|
2482
2456
|
if (!wouldBlock)
|
|
2483
2457
|
return { outcome: "non_blocking", deferralReason: null };
|
|
2484
|
-
const hasLocation = location !== undefined && location.length > 0;
|
|
2458
|
+
const hasLocation = location !== undefined && location.length > 0 && !isBodyOrCommentLocation(location);
|
|
2485
2459
|
if (hasLocation && context.inSurface && !context.inSurface(location)) {
|
|
2486
2460
|
return { outcome: "deferred", deferralReason: "outside-surface" };
|
|
2487
2461
|
}
|
|
@@ -2848,11 +2822,13 @@ function checkDocUpdateList(prBody) {
|
|
|
2848
2822
|
return headingCheck(prBody, "(?:documentation|doc)[- ]update(?:\\s+list)?", "Documentation-update list");
|
|
2849
2823
|
}
|
|
2850
2824
|
function checkWorktreeStep0(prBody) {
|
|
2851
|
-
if (/git worktree add/.test(prBody))
|
|
2825
|
+
if (/git worktree add/.test(prBody) || /cd \.worktrees\//.test(prBody) || /bun install --frozen-lockfile/.test(prBody))
|
|
2852
2826
|
return { status: "pass", errors: [] };
|
|
2853
2827
|
return {
|
|
2854
2828
|
status: "fail",
|
|
2855
|
-
errors: [
|
|
2829
|
+
errors: [
|
|
2830
|
+
"brief-validation worktree Step 0: no `git worktree add`, `cd .worktrees/`, or `bun install --frozen-lockfile` command found in the PR body."
|
|
2831
|
+
]
|
|
2856
2832
|
};
|
|
2857
2833
|
}
|
|
2858
2834
|
function checkStopConditions(prBody) {
|
|
@@ -3042,7 +3018,8 @@ function isCommandBlock(content) {
|
|
|
3042
3018
|
return COMMAND_WORDS.includes(commandWordOf(firstNonBlankLine(content)));
|
|
3043
3019
|
}
|
|
3044
3020
|
function isStep0Block(content) {
|
|
3045
|
-
|
|
3021
|
+
const first = firstNonBlankLine(content);
|
|
3022
|
+
return first.startsWith("git worktree add") || first.startsWith("cd .worktrees/") || first.startsWith("bun install --frozen-lockfile");
|
|
3046
3023
|
}
|
|
3047
3024
|
function checkCommandsCarryOutput(prBody) {
|
|
3048
3025
|
const errors = [];
|
|
@@ -3511,10 +3488,14 @@ function legacySlugPattern(legacySlugs) {
|
|
|
3511
3488
|
const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
3512
3489
|
return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
|
|
3513
3490
|
}
|
|
3491
|
+
function specGrandfatherPaths(specGrandfather) {
|
|
3492
|
+
return Array.isArray(specGrandfather) ? [...specGrandfather] : Object.keys(specGrandfather);
|
|
3493
|
+
}
|
|
3514
3494
|
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
3515
3495
|
const findings = [];
|
|
3516
3496
|
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
3517
|
-
const
|
|
3497
|
+
const grandfatheredWhole = new Set(Array.isArray(specGrandfather) ? specGrandfather : []);
|
|
3498
|
+
const limits = new Map(Array.isArray(specGrandfather) ? [] : Object.entries(specGrandfather));
|
|
3518
3499
|
const patterns = [
|
|
3519
3500
|
{ pattern: FORGE_NUMBER_PATTERN, what: "a forge number" },
|
|
3520
3501
|
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
|
|
@@ -3533,18 +3514,19 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
3533
3514
|
continue;
|
|
3534
3515
|
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
3535
3516
|
continue;
|
|
3536
|
-
if (cls === "spec" &&
|
|
3517
|
+
if (cls === "spec" && grandfatheredWhole.has(file.path))
|
|
3537
3518
|
continue;
|
|
3538
3519
|
const blocking = cls === "product" || cls === "spec";
|
|
3539
3520
|
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
3540
3521
|
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
3522
|
+
const fileFindings = [];
|
|
3541
3523
|
for (const { pattern, what, group } of patternsToRun) {
|
|
3542
3524
|
pattern.lastIndex = 0;
|
|
3543
3525
|
let match = pattern.exec(scrubbed);
|
|
3544
3526
|
while (match !== null) {
|
|
3545
3527
|
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
3546
3528
|
const citedIndex = match.index + match[0].indexOf(cited);
|
|
3547
|
-
|
|
3529
|
+
fileFindings.push({
|
|
3548
3530
|
file: file.path,
|
|
3549
3531
|
line: lineAt(scrubbed, citedIndex),
|
|
3550
3532
|
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
@@ -3553,6 +3535,15 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
3553
3535
|
match = pattern.exec(scrubbed);
|
|
3554
3536
|
}
|
|
3555
3537
|
}
|
|
3538
|
+
const limit = cls === "spec" ? limits.get(file.path) : undefined;
|
|
3539
|
+
if (limit !== undefined) {
|
|
3540
|
+
if (fileFindings.length <= limit)
|
|
3541
|
+
continue;
|
|
3542
|
+
for (const f of fileFindings) {
|
|
3543
|
+
f.message += `; ${file.path} carries ${fileFindings.length} such findings, over its proseGates.specGrandfather limit of ${limit}`;
|
|
3544
|
+
}
|
|
3545
|
+
}
|
|
3546
|
+
findings.push(...fileFindings);
|
|
3556
3547
|
}
|
|
3557
3548
|
return findings;
|
|
3558
3549
|
}
|
|
@@ -4134,6 +4125,8 @@ var FILE_EXTENSIONS = new Set([
|
|
|
4134
4125
|
"html",
|
|
4135
4126
|
"css"
|
|
4136
4127
|
]);
|
|
4128
|
+
var CI_SHARD_DIR = "apps/cli/tests/ci-shards";
|
|
4129
|
+
var CI_SHARD_PROBE = `${CI_SHARD_DIR}/shard-1.txt`;
|
|
4137
4130
|
|
|
4138
4131
|
// ../../packages/aeg-core/src/task-branch-identity.ts
|
|
4139
4132
|
var ISSUE_BRANCH_PATTERN = /^task\/issue-(\d+)$/;
|
|
@@ -4512,8 +4505,7 @@ function briefHash(brief) {
|
|
|
4512
4505
|
function policyDigest(policy) {
|
|
4513
4506
|
return createHash4("sha256").update(JSON.stringify({
|
|
4514
4507
|
codeReviewThreshold: policy.codeReviewThreshold,
|
|
4515
|
-
securityThreshold: policy.securityThreshold
|
|
4516
|
-
maxRounds: policy.maxRounds
|
|
4508
|
+
securityThreshold: policy.securityThreshold
|
|
4517
4509
|
})).digest("hex");
|
|
4518
4510
|
}
|
|
4519
4511
|
function isBoundToHead(echoed, headSha) {
|
|
@@ -4826,7 +4818,46 @@ function parseEnforcementRegistry(content) {
|
|
|
4826
4818
|
return result;
|
|
4827
4819
|
}
|
|
4828
4820
|
// ../../packages/aeg-core/src/registry-checks.ts
|
|
4829
|
-
|
|
4821
|
+
var HOOK_DIR_PREFIXES = [".claude/hooks/", ".vinaya/hooks/", ".husky/", ".git/hooks/"];
|
|
4822
|
+
var BARE_HOOK_NAME = /^check-[A-Za-z0-9_.-]*\.sh$/;
|
|
4823
|
+
function basename(path) {
|
|
4824
|
+
return path.slice(path.lastIndexOf("/") + 1);
|
|
4825
|
+
}
|
|
4826
|
+
function lineOf(content, index) {
|
|
4827
|
+
let line = 1;
|
|
4828
|
+
for (let i = 0;i < index; i++)
|
|
4829
|
+
if (content.charCodeAt(i) === 10)
|
|
4830
|
+
line++;
|
|
4831
|
+
return line;
|
|
4832
|
+
}
|
|
4833
|
+
function findUnshippedHookRefs(docs, shipped) {
|
|
4834
|
+
const shippedNames = new Set([...shipped].map(basename));
|
|
4835
|
+
const findings = [];
|
|
4836
|
+
const flag = (doc, token, index) => {
|
|
4837
|
+
findings.push({
|
|
4838
|
+
path: doc.path,
|
|
4839
|
+
reason: `${doc.path}:${lineOf(doc.content, index)} names hook "${token}", which is neither tracked in git nor emitted by \`vinaya init\``
|
|
4840
|
+
});
|
|
4841
|
+
};
|
|
4842
|
+
for (const doc of docs) {
|
|
4843
|
+
for (const { cited, index } of extractCitedPaths(doc.content)) {
|
|
4844
|
+
if (cited.endsWith("/") || !HOOK_DIR_PREFIXES.some((p) => cited.startsWith(p)))
|
|
4845
|
+
continue;
|
|
4846
|
+
if (!shipped.has(cited))
|
|
4847
|
+
flag(doc, cited, index);
|
|
4848
|
+
}
|
|
4849
|
+
const spanPattern = /`([^`\n]+)`/g;
|
|
4850
|
+
let match = spanPattern.exec(doc.content);
|
|
4851
|
+
while (match !== null) {
|
|
4852
|
+
const token = match[1] ?? "";
|
|
4853
|
+
if (BARE_HOOK_NAME.test(token) && !shippedNames.has(token))
|
|
4854
|
+
flag(doc, token, match.index);
|
|
4855
|
+
match = spanPattern.exec(doc.content);
|
|
4856
|
+
}
|
|
4857
|
+
}
|
|
4858
|
+
return findings;
|
|
4859
|
+
}
|
|
4860
|
+
function checkG1(rows, existsFn, hookRefs) {
|
|
4830
4861
|
const findings = [];
|
|
4831
4862
|
for (const row of rows) {
|
|
4832
4863
|
if (row.implementation === "")
|
|
@@ -4839,6 +4870,8 @@ function checkG1(rows, existsFn) {
|
|
|
4839
4870
|
});
|
|
4840
4871
|
}
|
|
4841
4872
|
}
|
|
4873
|
+
if (hookRefs)
|
|
4874
|
+
findings.push(...findUnshippedHookRefs(hookRefs.docs, hookRefs.shipped));
|
|
4842
4875
|
return { check: "G1", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4843
4876
|
}
|
|
4844
4877
|
var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
|
|
@@ -4971,6 +5004,55 @@ function checkG6(rows, registeredCheckNames) {
|
|
|
4971
5004
|
}
|
|
4972
5005
|
return { check: "G6", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4973
5006
|
}
|
|
5007
|
+
function reachesProducer(file, producers, imports) {
|
|
5008
|
+
const seen = new Set([file]);
|
|
5009
|
+
const queue = [file];
|
|
5010
|
+
for (let next = queue.pop();next !== undefined; next = queue.pop()) {
|
|
5011
|
+
if (producers.has(next))
|
|
5012
|
+
return true;
|
|
5013
|
+
for (const dep of imports.get(next) ?? []) {
|
|
5014
|
+
if (!seen.has(dep)) {
|
|
5015
|
+
seen.add(dep);
|
|
5016
|
+
queue.push(dep);
|
|
5017
|
+
}
|
|
5018
|
+
}
|
|
5019
|
+
}
|
|
5020
|
+
return false;
|
|
5021
|
+
}
|
|
5022
|
+
function checkG7(input) {
|
|
5023
|
+
if (!input.enforcementMapPresent)
|
|
5024
|
+
return { check: "G7", status: "info", findings: [] };
|
|
5025
|
+
const subjects = new Set([...input.crossingFiles, ...input.blockingFiles]);
|
|
5026
|
+
const findings = [];
|
|
5027
|
+
for (const path of subjects) {
|
|
5028
|
+
if (path in input.exemptions)
|
|
5029
|
+
continue;
|
|
5030
|
+
if (!reachesProducer(path, input.producers, input.imports)) {
|
|
5031
|
+
findings.push({
|
|
5032
|
+
path,
|
|
5033
|
+
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`
|
|
5034
|
+
});
|
|
5035
|
+
}
|
|
5036
|
+
}
|
|
5037
|
+
for (const [path, reason] of Object.entries(input.exemptions)) {
|
|
5038
|
+
if (reason.trim() === "") {
|
|
5039
|
+
findings.push({ path, reason: `exemption for "${path}" states no reason` });
|
|
5040
|
+
} else if (!input.existsFn(path)) {
|
|
5041
|
+
findings.push({ path, reason: `exemption names "${path}", which no longer exists` });
|
|
5042
|
+
} else if (!subjects.has(path)) {
|
|
5043
|
+
findings.push({
|
|
5044
|
+
path,
|
|
5045
|
+
reason: `exemption names "${path}", which is neither a GitHub-writing file nor a blocking gate's implementation`
|
|
5046
|
+
});
|
|
5047
|
+
} else if (reachesProducer(path, input.producers, input.imports)) {
|
|
5048
|
+
findings.push({
|
|
5049
|
+
path,
|
|
5050
|
+
reason: `exemption names "${path}", which does reach a log producer — remove the exemption`
|
|
5051
|
+
});
|
|
5052
|
+
}
|
|
5053
|
+
}
|
|
5054
|
+
return { check: "G7", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
5055
|
+
}
|
|
4974
5056
|
// ../../packages/aeg-core/src/dead-branch-push-guard.ts
|
|
4975
5057
|
function checkDeadBranchPush(input) {
|
|
4976
5058
|
const { branch, prState, prNumber } = input;
|
|
@@ -5150,6 +5232,11 @@ function checkDispatchReadiness(input) {
|
|
|
5150
5232
|
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
5233
|
continue;
|
|
5152
5234
|
}
|
|
5235
|
+
if (dep.readFailed === true) {
|
|
5236
|
+
const issueStr = dep.issue !== null ? ` (#${dep.issue})` : "";
|
|
5237
|
+
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.`);
|
|
5238
|
+
continue;
|
|
5239
|
+
}
|
|
5153
5240
|
if (!dep.merged && !isHandClosedByRecognizedPrincipal(dep, principalAllowlist)) {
|
|
5154
5241
|
const issueStr = dep.issue !== null ? ` (#${dep.issue})` : "";
|
|
5155
5242
|
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 +5479,6 @@ var TaskPrPauseSchema = z.object({
|
|
|
5392
5479
|
var TaskPrReviewRecordSchema = z.object({
|
|
5393
5480
|
verdicts: z.array(TaskPrVerdictSchema),
|
|
5394
5481
|
roundMarkers: z.array(z.number().int().nonnegative()),
|
|
5395
|
-
summaryTable: z.string().nullable(),
|
|
5396
5482
|
pause: TaskPrPauseSchema.nullable()
|
|
5397
5483
|
});
|
|
5398
5484
|
var TaskPrReadInputSchema = z.object({
|
|
@@ -5439,16 +5525,6 @@ var TaskCancelResultSchema = z.object({
|
|
|
5439
5525
|
authenticatedFrom: z.string().min(1),
|
|
5440
5526
|
fencedEffectKeys: z.array(z.string())
|
|
5441
5527
|
});
|
|
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
5528
|
// ../../packages/aeg-core/src/first-push-dispatch-gate.ts
|
|
5453
5529
|
function parseTaskBranch(branch) {
|
|
5454
5530
|
const m = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
|
|
@@ -5679,16 +5755,71 @@ var NO_GATE_CUTOVERS = {
|
|
|
5679
5755
|
briefRulesSincePr: null,
|
|
5680
5756
|
agentBoxesRefusedSincePr: null
|
|
5681
5757
|
};
|
|
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
5758
|
// ../../packages/aeg-core/src/log/schema.ts
|
|
5759
|
+
import { z as z3 } from "zod";
|
|
5760
|
+
|
|
5761
|
+
// ../../packages/aeg-core/src/log/custom.ts
|
|
5690
5762
|
import { z as z2 } from "zod";
|
|
5763
|
+
var CUSTOM_EVENT_NAME_PATTERN = /^[a-z][a-z0-9_]*\.[a-z][a-z0-9_.]*$/;
|
|
5764
|
+
var CUSTOM_EVENT_NAME_MAX_LENGTH = 64;
|
|
5765
|
+
var CUSTOM_EVENT_RESERVED_NAMESPACE = "vinaya";
|
|
5766
|
+
var CUSTOM_EVENT_MAX_FIELDS = 20;
|
|
5767
|
+
var CUSTOM_FIELD_NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
5768
|
+
var CUSTOM_FIELD_NAME_MAX_LENGTH = 64;
|
|
5769
|
+
var CUSTOM_TEXT_MAX_LENGTH = 500;
|
|
5770
|
+
var CUSTOM_WORD_PATTERN = /^[a-z0-9][a-z0-9_-]*$/;
|
|
5771
|
+
var CUSTOM_WORD_MAX_LENGTH = 64;
|
|
5772
|
+
var CUSTOM_FIELD_MAX_WORDS = 50;
|
|
5773
|
+
var CustomFieldTypeSchema = z2.union([z2.enum(["text", "number", "boolean"]), z2.array(z2.string())]);
|
|
5774
|
+
var CustomEventDeclarationsSchema = z2.record(z2.string(), z2.object({
|
|
5775
|
+
fields: z2.record(z2.string(), CustomFieldTypeSchema)
|
|
5776
|
+
}).strict()).superRefine((events, ctx) => {
|
|
5777
|
+
for (const [name, declaration] of Object.entries(events)) {
|
|
5778
|
+
const refuse = (message, path = []) => {
|
|
5779
|
+
ctx.addIssue({
|
|
5780
|
+
code: z2.ZodIssueCode.custom,
|
|
5781
|
+
path: [name, ...path],
|
|
5782
|
+
message: `logs.events "${name}": ${message}`
|
|
5783
|
+
});
|
|
5784
|
+
};
|
|
5785
|
+
if (name.length > CUSTOM_EVENT_NAME_MAX_LENGTH) {
|
|
5786
|
+
refuse(`the name must be at most ${CUSTOM_EVENT_NAME_MAX_LENGTH} characters`);
|
|
5787
|
+
}
|
|
5788
|
+
if (!CUSTOM_EVENT_NAME_PATTERN.test(name)) {
|
|
5789
|
+
refuse("the name must be `<namespace>.<event>` — lowercase letters, digits and `_`, a dot between them");
|
|
5790
|
+
} else if (name.split(".")[0] === CUSTOM_EVENT_RESERVED_NAMESPACE) {
|
|
5791
|
+
refuse(`the \`${CUSTOM_EVENT_RESERVED_NAMESPACE}.\` namespace is reserved for Vinaya's own events`);
|
|
5792
|
+
}
|
|
5793
|
+
const fieldEntries = Object.entries(declaration.fields);
|
|
5794
|
+
if (fieldEntries.length > CUSTOM_EVENT_MAX_FIELDS) {
|
|
5795
|
+
refuse(`at most ${CUSTOM_EVENT_MAX_FIELDS} fields may be declared (found ${fieldEntries.length})`, ["fields"]);
|
|
5796
|
+
}
|
|
5797
|
+
for (const [field, type] of fieldEntries) {
|
|
5798
|
+
if (field.length > CUSTOM_FIELD_NAME_MAX_LENGTH || !CUSTOM_FIELD_NAME_PATTERN.test(field)) {
|
|
5799
|
+
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]);
|
|
5800
|
+
}
|
|
5801
|
+
if (typeof type === "string")
|
|
5802
|
+
continue;
|
|
5803
|
+
if (type.length === 0) {
|
|
5804
|
+
refuse(`field "${field}": a list of words must name at least one word`, ["fields", field]);
|
|
5805
|
+
}
|
|
5806
|
+
if (type.length > CUSTOM_FIELD_MAX_WORDS) {
|
|
5807
|
+
refuse(`field "${field}": a list of words may name at most ${CUSTOM_FIELD_MAX_WORDS}`, ["fields", field]);
|
|
5808
|
+
}
|
|
5809
|
+
const bad = type.filter((w) => w.length > CUSTOM_WORD_MAX_LENGTH || !CUSTOM_WORD_PATTERN.test(w));
|
|
5810
|
+
if (bad.length > 0) {
|
|
5811
|
+
refuse(`field "${field}": a listed word is lowercase letters, digits, \`_\` and \`-\`, at most ${CUSTOM_WORD_MAX_LENGTH} characters`, ["fields", field]);
|
|
5812
|
+
}
|
|
5813
|
+
if (new Set(type).size !== type.length) {
|
|
5814
|
+
refuse(`field "${field}": a list of words names a word twice`, ["fields", field]);
|
|
5815
|
+
}
|
|
5816
|
+
}
|
|
5817
|
+
}
|
|
5818
|
+
});
|
|
5819
|
+
|
|
5820
|
+
// ../../packages/aeg-core/src/log/schema.ts
|
|
5691
5821
|
var CONFIDENCE_REASON_MAX_LENGTH = 280;
|
|
5822
|
+
var REVIEW_FINDING_DESCRIPTION_MAX_LENGTH = 1000;
|
|
5692
5823
|
var ROLE_VALUES = [
|
|
5693
5824
|
"planner",
|
|
5694
5825
|
"developer",
|
|
@@ -5698,178 +5829,214 @@ var ROLE_VALUES = [
|
|
|
5698
5829
|
"archivist",
|
|
5699
5830
|
"architect"
|
|
5700
5831
|
];
|
|
5701
|
-
var RoleSchema =
|
|
5832
|
+
var RoleSchema = z3.enum(ROLE_VALUES);
|
|
5702
5833
|
var HOST_VALUES = ["hook", "ci", "cli", "loop"];
|
|
5703
|
-
var HostSchema =
|
|
5834
|
+
var HostSchema = z3.enum(HOST_VALUES);
|
|
5704
5835
|
var RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
|
|
5705
5836
|
var headerMetaCore = {
|
|
5706
|
-
ts:
|
|
5707
|
-
run_id:
|
|
5708
|
-
seq:
|
|
5709
|
-
repo:
|
|
5710
|
-
vinaya:
|
|
5711
|
-
doctrine:
|
|
5837
|
+
ts: z3.string(),
|
|
5838
|
+
run_id: z3.string().regex(RUN_ID_PATTERN),
|
|
5839
|
+
seq: z3.number().int().nonnegative(),
|
|
5840
|
+
repo: z3.string().nullable(),
|
|
5841
|
+
vinaya: z3.string(),
|
|
5842
|
+
doctrine: z3.string(),
|
|
5712
5843
|
host: HostSchema,
|
|
5713
|
-
machine:
|
|
5844
|
+
machine: z3.string()
|
|
5714
5845
|
};
|
|
5715
|
-
var HeaderMetaV1Schema =
|
|
5716
|
-
schema:
|
|
5846
|
+
var HeaderMetaV1Schema = z3.object({
|
|
5847
|
+
schema: z3.literal(1),
|
|
5717
5848
|
...headerMetaCore
|
|
5718
5849
|
}).strict();
|
|
5719
|
-
var LineageSchema =
|
|
5720
|
-
run:
|
|
5721
|
-
attempt:
|
|
5722
|
-
parent:
|
|
5850
|
+
var LineageSchema = z3.object({
|
|
5851
|
+
run: z3.string().nullable(),
|
|
5852
|
+
attempt: z3.number().int().nullable(),
|
|
5853
|
+
parent: z3.string().nullable()
|
|
5723
5854
|
}).strict();
|
|
5724
|
-
var InputVersionsSchema =
|
|
5725
|
-
objectives_version:
|
|
5726
|
-
brief_hash:
|
|
5727
|
-
ruling_ordinal:
|
|
5728
|
-
policy_digest:
|
|
5855
|
+
var InputVersionsSchema = z3.object({
|
|
5856
|
+
objectives_version: z3.string().nullable(),
|
|
5857
|
+
brief_hash: z3.string().nullable(),
|
|
5858
|
+
ruling_ordinal: z3.number().int().nullable(),
|
|
5859
|
+
policy_digest: z3.string().nullable()
|
|
5729
5860
|
}).strict();
|
|
5730
|
-
var ProvenanceSchema =
|
|
5731
|
-
var HeaderMetaV2Schema =
|
|
5732
|
-
schema:
|
|
5861
|
+
var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
|
|
5862
|
+
var HeaderMetaV2Schema = z3.object({
|
|
5863
|
+
schema: z3.literal(2),
|
|
5733
5864
|
...headerMetaCore,
|
|
5734
|
-
event_id:
|
|
5735
|
-
process_id:
|
|
5736
|
-
actor_id:
|
|
5865
|
+
event_id: z3.string().min(1),
|
|
5866
|
+
process_id: z3.string().min(1),
|
|
5867
|
+
actor_id: z3.string().nullable(),
|
|
5737
5868
|
lineage: LineageSchema,
|
|
5738
5869
|
input_versions: InputVersionsSchema,
|
|
5739
5870
|
provenance: ProvenanceSchema
|
|
5740
5871
|
}).strict();
|
|
5741
|
-
var
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5872
|
+
var WorkSchema = z3.object({
|
|
5873
|
+
ref: z3.string().nullable(),
|
|
5874
|
+
repo: z3.string().nullable(),
|
|
5875
|
+
change: z3.string().nullable(),
|
|
5876
|
+
revision: z3.string().nullable()
|
|
5877
|
+
}).strict();
|
|
5878
|
+
var FlowSchema = z3.object({
|
|
5879
|
+
id: z3.string().nullable(),
|
|
5880
|
+
version: z3.string().nullable()
|
|
5881
|
+
}).strict();
|
|
5882
|
+
var HeaderMetaV3Schema = z3.object({
|
|
5883
|
+
schema: z3.literal(3),
|
|
5884
|
+
...headerMetaCore,
|
|
5885
|
+
event_id: z3.string().min(1),
|
|
5886
|
+
process_id: z3.string().min(1),
|
|
5887
|
+
actor_id: z3.string().nullable(),
|
|
5888
|
+
lineage: LineageSchema,
|
|
5889
|
+
input_versions: InputVersionsSchema,
|
|
5890
|
+
provenance: ProvenanceSchema,
|
|
5891
|
+
work: WorkSchema,
|
|
5892
|
+
flow: FlowSchema,
|
|
5893
|
+
runtime: z3.string().nullable(),
|
|
5894
|
+
source: z3.string().nullable()
|
|
5749
5895
|
}).strict();
|
|
5750
|
-
var
|
|
5896
|
+
var HeaderMetaSchema = z3.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema, HeaderMetaV3Schema]);
|
|
5897
|
+
var SubjectSchema = z3.object({
|
|
5898
|
+
issue: z3.number().int().nullable(),
|
|
5899
|
+
pr: z3.number().int().optional(),
|
|
5900
|
+
sha: z3.string().optional(),
|
|
5901
|
+
role: z3.union([RoleSchema, z3.literal("unattributed")]),
|
|
5902
|
+
round: z3.number().int().optional(),
|
|
5903
|
+
objectives_version: z3.string().optional()
|
|
5904
|
+
}).strict();
|
|
5905
|
+
var HeaderSchema = z3.object({
|
|
5751
5906
|
meta: HeaderMetaSchema,
|
|
5752
5907
|
subject: SubjectSchema
|
|
5753
5908
|
}).strict();
|
|
5754
5909
|
var envelopeTail = {
|
|
5755
|
-
duration_ms:
|
|
5756
|
-
payload:
|
|
5910
|
+
duration_ms: z3.number().nonnegative().optional(),
|
|
5911
|
+
payload: z3.object({}).strict()
|
|
5757
5912
|
};
|
|
5758
|
-
var ReviewFindingSchema =
|
|
5759
|
-
id:
|
|
5760
|
-
severity:
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5913
|
+
var ReviewFindingSchema = z3.object({
|
|
5914
|
+
id: z3.string(),
|
|
5915
|
+
severity: z3.string(),
|
|
5916
|
+
location: z3.string().optional(),
|
|
5917
|
+
deferral_reason: z3.enum(["outside-surface", "unchanged-line"]).optional(),
|
|
5918
|
+
description: z3.string().max(REVIEW_FINDING_DESCRIPTION_MAX_LENGTH).optional(),
|
|
5919
|
+
state: z3.string().optional(),
|
|
5920
|
+
severity_scale: z3.string().optional(),
|
|
5921
|
+
policy_treatment: z3.enum(["blocking", "non_blocking", "unavailable"]).optional(),
|
|
5922
|
+
confidence: z3.number().min(0).max(1).optional(),
|
|
5923
|
+
confidence_scale: z3.string().optional(),
|
|
5924
|
+
confidence_source: z3.string().optional()
|
|
5767
5925
|
}).strict();
|
|
5768
|
-
var DispatchOutcomeSchema =
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
type:
|
|
5772
|
-
pr:
|
|
5773
|
-
head:
|
|
5774
|
-
comment_id:
|
|
5926
|
+
var DispatchOutcomeSchema = z3.discriminatedUnion("type", [
|
|
5927
|
+
z3.object({ type: z3.literal("pr_opened"), pr: z3.number().int(), head: z3.string() }).strict(),
|
|
5928
|
+
z3.object({
|
|
5929
|
+
type: z3.literal("round_pushed"),
|
|
5930
|
+
pr: z3.number().int(),
|
|
5931
|
+
head: z3.string(),
|
|
5932
|
+
comment_id: z3.number().int()
|
|
5775
5933
|
}).strict(),
|
|
5776
|
-
|
|
5777
|
-
type:
|
|
5778
|
-
verdict:
|
|
5779
|
-
head:
|
|
5780
|
-
comment_id:
|
|
5781
|
-
objectives:
|
|
5782
|
-
findings:
|
|
5934
|
+
z3.object({
|
|
5935
|
+
type: z3.literal("verdict"),
|
|
5936
|
+
verdict: z3.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
|
|
5937
|
+
head: z3.string(),
|
|
5938
|
+
comment_id: z3.number().int(),
|
|
5939
|
+
objectives: z3.array(z3.object({ id: z3.string(), met: z3.boolean() }).strict()),
|
|
5940
|
+
findings: z3.array(ReviewFindingSchema)
|
|
5783
5941
|
}).strict(),
|
|
5784
|
-
|
|
5785
|
-
type:
|
|
5786
|
-
class:
|
|
5787
|
-
comment_id:
|
|
5942
|
+
z3.object({
|
|
5943
|
+
type: z3.literal("escalation"),
|
|
5944
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
5945
|
+
comment_id: z3.number().int()
|
|
5788
5946
|
}).strict(),
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5947
|
+
z3.object({ type: z3.literal("brief"), comment_id: z3.number().int(), hash: z3.string() }).strict(),
|
|
5948
|
+
z3.object({ type: z3.literal("plan"), issues: z3.array(z3.number().int()) }).strict(),
|
|
5949
|
+
z3.object({ type: z3.literal("archive"), provenance_comment_id: z3.number().int() }).strict(),
|
|
5950
|
+
z3.object({ type: z3.literal("completed") }).strict()
|
|
5793
5951
|
]);
|
|
5794
5952
|
var dispatchShared = {
|
|
5795
5953
|
meta: HeaderMetaSchema,
|
|
5796
5954
|
subject: SubjectSchema,
|
|
5797
|
-
kind:
|
|
5955
|
+
kind: z3.literal("dispatch"),
|
|
5798
5956
|
...envelopeTail,
|
|
5799
5957
|
target_role: RoleSchema,
|
|
5800
|
-
model:
|
|
5801
|
-
round:
|
|
5802
|
-
effect_id:
|
|
5958
|
+
model: z3.string(),
|
|
5959
|
+
round: z3.number().int().optional(),
|
|
5960
|
+
effect_id: z3.string()
|
|
5803
5961
|
};
|
|
5804
|
-
var dispatchUsageField =
|
|
5805
|
-
var DispatchEventSchema =
|
|
5806
|
-
|
|
5807
|
-
|
|
5962
|
+
var dispatchUsageField = z3.object({ input: z3.number().nonnegative(), output: z3.number().nonnegative() }).strict().nullable();
|
|
5963
|
+
var DispatchEventSchema = z3.discriminatedUnion("event", [
|
|
5964
|
+
z3.object({ ...dispatchShared, event: z3.literal("dispatched"), prompt_hash: z3.string() }).strict(),
|
|
5965
|
+
z3.object({
|
|
5808
5966
|
...dispatchShared,
|
|
5809
|
-
event:
|
|
5967
|
+
event: z3.literal("outcome_received"),
|
|
5810
5968
|
outcome: DispatchOutcomeSchema,
|
|
5811
5969
|
usage: dispatchUsageField
|
|
5812
5970
|
}).strict(),
|
|
5813
|
-
|
|
5971
|
+
z3.object({
|
|
5814
5972
|
...dispatchShared,
|
|
5815
|
-
event:
|
|
5816
|
-
reason:
|
|
5973
|
+
event: z3.literal("dispatch_failed"),
|
|
5974
|
+
reason: z3.enum(["timeout", "crash", "refused", "unattributed_write", "usage_limit"]),
|
|
5975
|
+
usage_limit: z3.object({ agent: z3.string().min(1), reset_at: z3.string().nullable() }).strict().optional(),
|
|
5817
5976
|
usage: dispatchUsageField
|
|
5818
5977
|
}).strict()
|
|
5819
5978
|
]);
|
|
5979
|
+
var CODE_TOKEN_PATTERN = /^[A-Za-z0-9._-]{1,64}$/;
|
|
5980
|
+
var CodeTokenSchema = z3.string().regex(CODE_TOKEN_PATTERN);
|
|
5981
|
+
var ReviewerVerdictSchema = z3.object({
|
|
5982
|
+
role: RoleSchema,
|
|
5983
|
+
outcome: z3.enum(["approve", "changes_requested", "not_reviewed"]),
|
|
5984
|
+
blockers: z3.number().int().nonnegative()
|
|
5985
|
+
}).strict();
|
|
5820
5986
|
var loopShared = {
|
|
5821
5987
|
meta: HeaderMetaSchema,
|
|
5822
5988
|
subject: SubjectSchema,
|
|
5823
|
-
kind:
|
|
5989
|
+
kind: z3.literal("dev_review_loop"),
|
|
5824
5990
|
...envelopeTail,
|
|
5825
|
-
loop_id:
|
|
5991
|
+
loop_id: z3.string()
|
|
5826
5992
|
};
|
|
5827
|
-
var DevReviewLoopEventSchema =
|
|
5828
|
-
|
|
5993
|
+
var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
|
|
5994
|
+
z3.object({
|
|
5829
5995
|
...loopShared,
|
|
5830
|
-
event:
|
|
5831
|
-
task:
|
|
5832
|
-
policy:
|
|
5833
|
-
max_rounds:
|
|
5834
|
-
reviewers:
|
|
5835
|
-
models:
|
|
5996
|
+
event: z3.literal("loop_started"),
|
|
5997
|
+
task: z3.number().int(),
|
|
5998
|
+
policy: z3.object({
|
|
5999
|
+
max_rounds: z3.number().int().nonnegative(),
|
|
6000
|
+
reviewers: z3.array(RoleSchema),
|
|
6001
|
+
models: z3.record(RoleSchema, z3.string())
|
|
5836
6002
|
}).strict()
|
|
5837
6003
|
}).strict(),
|
|
5838
|
-
|
|
5839
|
-
|
|
6004
|
+
z3.object({ ...loopShared, event: z3.literal("round_started"), round: z3.number().int(), base_head: z3.string() }).strict(),
|
|
6005
|
+
z3.object({
|
|
5840
6006
|
...loopShared,
|
|
5841
|
-
event:
|
|
5842
|
-
round:
|
|
5843
|
-
head:
|
|
5844
|
-
green:
|
|
5845
|
-
confidence_value:
|
|
5846
|
-
confidence_reason:
|
|
5847
|
-
confidence_unavailable:
|
|
5848
|
-
extra_turn_spent:
|
|
6007
|
+
event: z3.literal("gate_result_read"),
|
|
6008
|
+
round: z3.number().int(),
|
|
6009
|
+
head: z3.string(),
|
|
6010
|
+
green: z3.boolean(),
|
|
6011
|
+
confidence_value: z3.number().int().min(0).max(100).optional(),
|
|
6012
|
+
confidence_reason: z3.string().max(CONFIDENCE_REASON_MAX_LENGTH).optional(),
|
|
6013
|
+
confidence_unavailable: z3.boolean().optional(),
|
|
6014
|
+
extra_turn_spent: z3.boolean().optional()
|
|
5849
6015
|
}).strict(),
|
|
5850
|
-
|
|
6016
|
+
z3.object({
|
|
5851
6017
|
...loopShared,
|
|
5852
|
-
event:
|
|
5853
|
-
round:
|
|
5854
|
-
head:
|
|
5855
|
-
all_approve:
|
|
5856
|
-
blockers:
|
|
5857
|
-
findings:
|
|
6018
|
+
event: z3.literal("verdicts_read"),
|
|
6019
|
+
round: z3.number().int(),
|
|
6020
|
+
head: z3.string(),
|
|
6021
|
+
all_approve: z3.boolean(),
|
|
6022
|
+
blockers: z3.number().int().nonnegative(),
|
|
6023
|
+
findings: z3.array(ReviewFindingSchema).optional(),
|
|
6024
|
+
reviewers: z3.array(ReviewerVerdictSchema).optional()
|
|
5858
6025
|
}).strict(),
|
|
5859
|
-
|
|
6026
|
+
z3.object({
|
|
5860
6027
|
...loopShared,
|
|
5861
|
-
event:
|
|
5862
|
-
round:
|
|
5863
|
-
open:
|
|
5864
|
-
resolved:
|
|
5865
|
-
new:
|
|
5866
|
-
recurring:
|
|
6028
|
+
event: z3.literal("findings_compared"),
|
|
6029
|
+
round: z3.number().int(),
|
|
6030
|
+
open: z3.array(z3.string()),
|
|
6031
|
+
resolved: z3.array(z3.string()),
|
|
6032
|
+
new: z3.array(z3.string()),
|
|
6033
|
+
recurring: z3.array(z3.string())
|
|
5867
6034
|
}).strict(),
|
|
5868
|
-
|
|
6035
|
+
z3.object({
|
|
5869
6036
|
...loopShared,
|
|
5870
|
-
event:
|
|
5871
|
-
round:
|
|
5872
|
-
condition:
|
|
6037
|
+
event: z3.literal("stop_condition_met"),
|
|
6038
|
+
round: z3.number().int(),
|
|
6039
|
+
condition: z3.enum([
|
|
5873
6040
|
"green",
|
|
5874
6041
|
"max_rounds",
|
|
5875
6042
|
"no_progress",
|
|
@@ -5878,66 +6045,85 @@ var DevReviewLoopEventSchema = z2.discriminatedUnion("event", [
|
|
|
5878
6045
|
"confidence",
|
|
5879
6046
|
"reappearance",
|
|
5880
6047
|
"repeat_finding",
|
|
5881
|
-
"repeat_failure"
|
|
6048
|
+
"repeat_failure",
|
|
6049
|
+
"time_budget"
|
|
5882
6050
|
])
|
|
5883
6051
|
}).strict(),
|
|
5884
|
-
|
|
6052
|
+
z3.object({
|
|
6053
|
+
...loopShared,
|
|
6054
|
+
event: z3.literal("paused"),
|
|
6055
|
+
round: z3.number().int(),
|
|
6056
|
+
reason: z3.enum(["escalation", "principal_item", "refreeze_needed"]),
|
|
6057
|
+
reason_code: CodeTokenSchema.optional()
|
|
6058
|
+
}).strict(),
|
|
6059
|
+
z3.object({
|
|
6060
|
+
...loopShared,
|
|
6061
|
+
event: z3.literal("resumed"),
|
|
6062
|
+
round: z3.number().int(),
|
|
6063
|
+
by: z3.enum(["principal", "driver"])
|
|
6064
|
+
}).strict(),
|
|
6065
|
+
z3.object({
|
|
5885
6066
|
...loopShared,
|
|
5886
|
-
event:
|
|
5887
|
-
round:
|
|
5888
|
-
|
|
6067
|
+
event: z3.literal("cancelled"),
|
|
6068
|
+
round: z3.number().int(),
|
|
6069
|
+
by: z3.literal("principal")
|
|
5889
6070
|
}).strict(),
|
|
5890
|
-
|
|
6071
|
+
z3.object({
|
|
5891
6072
|
...loopShared,
|
|
5892
|
-
event:
|
|
5893
|
-
round:
|
|
5894
|
-
|
|
6073
|
+
event: z3.literal("unpushed_work_resume"),
|
|
6074
|
+
round: z3.number().int(),
|
|
6075
|
+
branch: z3.string(),
|
|
6076
|
+
detail: z3.string()
|
|
5895
6077
|
}).strict(),
|
|
5896
|
-
|
|
6078
|
+
z3.object({
|
|
5897
6079
|
...loopShared,
|
|
5898
|
-
event:
|
|
5899
|
-
round:
|
|
5900
|
-
|
|
6080
|
+
event: z3.literal("round_ended"),
|
|
6081
|
+
round: z3.number().int(),
|
|
6082
|
+
base_head: z3.string(),
|
|
6083
|
+
head: z3.string(),
|
|
6084
|
+
files_changed: z3.number().int().nonnegative(),
|
|
6085
|
+
insertions: z3.number().int().nonnegative(),
|
|
6086
|
+
deletions: z3.number().int().nonnegative(),
|
|
6087
|
+
wall_ms: z3.number().nonnegative(),
|
|
6088
|
+
outcome: z3.enum(["green", "changes_requested", "escalated"])
|
|
5901
6089
|
}).strict(),
|
|
5902
|
-
|
|
6090
|
+
z3.object({
|
|
5903
6091
|
...loopShared,
|
|
5904
|
-
event:
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
6092
|
+
event: z3.literal("journal_finalized"),
|
|
6093
|
+
rounds: z3.number().int().nonnegative(),
|
|
6094
|
+
total_wall_ms: z3.number().nonnegative(),
|
|
6095
|
+
time_to_green_ms: z3.number().nonnegative().nullable(),
|
|
6096
|
+
files_changed_total: z3.number().int().nonnegative(),
|
|
6097
|
+
final_head: z3.string(),
|
|
6098
|
+
result: z3.enum(["merged_ready", "stopped"])
|
|
5908
6099
|
}).strict(),
|
|
5909
|
-
|
|
6100
|
+
z3.object({
|
|
5910
6101
|
...loopShared,
|
|
5911
|
-
event:
|
|
5912
|
-
round:
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
insertions: z2.number().int().nonnegative(),
|
|
5917
|
-
deletions: z2.number().int().nonnegative(),
|
|
5918
|
-
wall_ms: z2.number().nonnegative(),
|
|
5919
|
-
outcome: z2.enum(["green", "changes_requested", "escalated"])
|
|
6102
|
+
event: z3.literal("infrastructure_retry"),
|
|
6103
|
+
round: z3.number().int(),
|
|
6104
|
+
failure_kind: z3.enum(["pause_comment_post", "developer_connection"]),
|
|
6105
|
+
attempts: z3.number().int().positive(),
|
|
6106
|
+
outcome: z3.enum(["recovered", "exhausted"])
|
|
5920
6107
|
}).strict(),
|
|
5921
|
-
|
|
6108
|
+
z3.object({
|
|
5922
6109
|
...loopShared,
|
|
5923
|
-
event:
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
final_head: z2.string(),
|
|
5929
|
-
result: z2.enum(["merged_ready", "stopped"])
|
|
6110
|
+
event: z3.literal("driver_heartbeat"),
|
|
6111
|
+
task: z3.number().int(),
|
|
6112
|
+
pr: z3.number().int().positive().optional(),
|
|
6113
|
+
round: z3.number().int(),
|
|
6114
|
+
phase: z3.string()
|
|
5930
6115
|
}).strict(),
|
|
5931
|
-
|
|
6116
|
+
z3.object({
|
|
5932
6117
|
...loopShared,
|
|
5933
|
-
event:
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
6118
|
+
event: z3.literal("driver_exited"),
|
|
6119
|
+
task: z3.number().int(),
|
|
6120
|
+
reason: z3.enum(["finished", "paused", "reexec", "error", "signal"]),
|
|
6121
|
+
last_decision: z3.string(),
|
|
6122
|
+
exit_code: z3.number().int().optional(),
|
|
6123
|
+
error_class: CodeTokenSchema.optional()
|
|
5938
6124
|
}).strict()
|
|
5939
6125
|
]);
|
|
5940
|
-
var ForgeOpSchema =
|
|
6126
|
+
var ForgeOpSchema = z3.enum([
|
|
5941
6127
|
"pr.create",
|
|
5942
6128
|
"pr.comment",
|
|
5943
6129
|
"pr.body.replace",
|
|
@@ -5951,24 +6137,24 @@ var ForgeOpSchema = z2.enum([
|
|
|
5951
6137
|
"label.add",
|
|
5952
6138
|
"label.remove"
|
|
5953
6139
|
]);
|
|
5954
|
-
var ForgeWriteTargetSchema =
|
|
5955
|
-
issue:
|
|
5956
|
-
pr:
|
|
6140
|
+
var ForgeWriteTargetSchema = z3.object({
|
|
6141
|
+
issue: z3.number().int().optional(),
|
|
6142
|
+
pr: z3.number().int().optional()
|
|
5957
6143
|
}).strict();
|
|
5958
6144
|
var forgeWriteShared = {
|
|
5959
6145
|
meta: HeaderMetaSchema,
|
|
5960
6146
|
subject: SubjectSchema,
|
|
5961
|
-
kind:
|
|
6147
|
+
kind: z3.literal("forge_write"),
|
|
5962
6148
|
...envelopeTail,
|
|
5963
6149
|
op: ForgeOpSchema,
|
|
5964
6150
|
target: ForgeWriteTargetSchema
|
|
5965
6151
|
};
|
|
5966
|
-
var ForgeWriteEventSchema =
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
6152
|
+
var ForgeWriteEventSchema = z3.discriminatedUnion("event", [
|
|
6153
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("validated") }).strict(),
|
|
6154
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("refused"), reason: z3.string() }).strict(),
|
|
6155
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("written"), comment_ids: z3.array(z3.string()) }).strict()
|
|
5970
6156
|
]);
|
|
5971
|
-
var GateOutcomeSchema =
|
|
6157
|
+
var GateOutcomeSchema = z3.enum([
|
|
5972
6158
|
"pass",
|
|
5973
6159
|
"fail",
|
|
5974
6160
|
"wait",
|
|
@@ -5981,61 +6167,74 @@ var GateOutcomeSchema = z2.enum([
|
|
|
5981
6167
|
var gateShared = {
|
|
5982
6168
|
meta: HeaderMetaSchema,
|
|
5983
6169
|
subject: SubjectSchema,
|
|
5984
|
-
kind:
|
|
6170
|
+
kind: z3.literal("gate"),
|
|
5985
6171
|
...envelopeTail,
|
|
5986
|
-
check:
|
|
5987
|
-
check_version:
|
|
5988
|
-
policy_version:
|
|
5989
|
-
input_fingerprint:
|
|
6172
|
+
check: z3.string(),
|
|
6173
|
+
check_version: z3.string().nullable(),
|
|
6174
|
+
policy_version: z3.string().nullable(),
|
|
6175
|
+
input_fingerprint: z3.string().nullable()
|
|
5990
6176
|
};
|
|
5991
|
-
var GateEventSchema =
|
|
5992
|
-
|
|
6177
|
+
var GateEventSchema = z3.discriminatedUnion("event", [
|
|
6178
|
+
z3.object({
|
|
5993
6179
|
...gateShared,
|
|
5994
|
-
event:
|
|
6180
|
+
event: z3.literal("checked"),
|
|
5995
6181
|
outcome: GateOutcomeSchema,
|
|
5996
|
-
reason:
|
|
6182
|
+
reason: z3.string().optional()
|
|
6183
|
+
}).strict(),
|
|
6184
|
+
z3.object({
|
|
6185
|
+
meta: HeaderMetaSchema,
|
|
6186
|
+
subject: SubjectSchema,
|
|
6187
|
+
kind: z3.literal("gate"),
|
|
6188
|
+
...envelopeTail,
|
|
6189
|
+
event: z3.literal("summary"),
|
|
6190
|
+
ran: z3.number().int().nonnegative(),
|
|
6191
|
+
passed: z3.number().int().nonnegative(),
|
|
6192
|
+
failed: z3.number().int().nonnegative(),
|
|
6193
|
+
skipped: z3.number().int().nonnegative(),
|
|
6194
|
+
failed_checks: z3.array(z3.string())
|
|
5997
6195
|
}).strict()
|
|
5998
6196
|
]);
|
|
5999
|
-
var OperationResultSchema =
|
|
6197
|
+
var OperationResultSchema = z3.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
|
|
6000
6198
|
var operationShared = {
|
|
6001
6199
|
meta: HeaderMetaSchema,
|
|
6002
6200
|
subject: SubjectSchema,
|
|
6003
|
-
kind:
|
|
6201
|
+
kind: z3.literal("operation"),
|
|
6004
6202
|
...envelopeTail,
|
|
6005
|
-
operation:
|
|
6006
|
-
target:
|
|
6203
|
+
operation: z3.string(),
|
|
6204
|
+
target: z3.string().nullable()
|
|
6007
6205
|
};
|
|
6008
|
-
var OperationEventSchema =
|
|
6009
|
-
|
|
6206
|
+
var OperationEventSchema = z3.discriminatedUnion("event", [
|
|
6207
|
+
z3.object({
|
|
6010
6208
|
...operationShared,
|
|
6011
|
-
event:
|
|
6209
|
+
event: z3.literal("completed"),
|
|
6012
6210
|
result: OperationResultSchema,
|
|
6013
|
-
error_class:
|
|
6211
|
+
error_class: z3.string().nullable(),
|
|
6212
|
+
field_names: z3.array(z3.string().max(CUSTOM_FIELD_NAME_MAX_LENGTH)).max(CUSTOM_EVENT_MAX_FIELDS).optional()
|
|
6014
6213
|
}).strict()
|
|
6015
6214
|
]);
|
|
6016
|
-
var UsageUnitsSchema =
|
|
6017
|
-
input:
|
|
6018
|
-
output:
|
|
6019
|
-
cache:
|
|
6215
|
+
var UsageUnitsSchema = z3.object({
|
|
6216
|
+
input: z3.number().nonnegative().nullable(),
|
|
6217
|
+
output: z3.number().nonnegative().nullable(),
|
|
6218
|
+
cache: z3.number().nonnegative().nullable()
|
|
6020
6219
|
}).strict();
|
|
6021
6220
|
var usageShared = {
|
|
6022
6221
|
meta: HeaderMetaSchema,
|
|
6023
6222
|
subject: SubjectSchema,
|
|
6024
|
-
kind:
|
|
6223
|
+
kind: z3.literal("usage"),
|
|
6025
6224
|
...envelopeTail,
|
|
6026
|
-
model:
|
|
6027
|
-
source:
|
|
6028
|
-
semantics:
|
|
6225
|
+
model: z3.string().nullable(),
|
|
6226
|
+
source: z3.string(),
|
|
6227
|
+
semantics: z3.enum(["cumulative", "delta"])
|
|
6029
6228
|
};
|
|
6030
|
-
var UsageEventSchema =
|
|
6031
|
-
|
|
6229
|
+
var UsageEventSchema = z3.discriminatedUnion("event", [
|
|
6230
|
+
z3.object({
|
|
6032
6231
|
...usageShared,
|
|
6033
|
-
event:
|
|
6232
|
+
event: z3.literal("observed"),
|
|
6034
6233
|
units: UsageUnitsSchema,
|
|
6035
|
-
unknown_reason:
|
|
6234
|
+
unknown_reason: z3.string().nullable()
|
|
6036
6235
|
}).strict()
|
|
6037
6236
|
]);
|
|
6038
|
-
var RoleAttemptOutcomeSchema =
|
|
6237
|
+
var RoleAttemptOutcomeSchema = z3.enum([
|
|
6039
6238
|
"completed",
|
|
6040
6239
|
"incomplete",
|
|
6041
6240
|
"infrastructure_failed",
|
|
@@ -6046,17 +6245,17 @@ var RoleAttemptOutcomeSchema = z2.enum([
|
|
|
6046
6245
|
var roleAttemptShared = {
|
|
6047
6246
|
meta: HeaderMetaSchema,
|
|
6048
6247
|
subject: SubjectSchema,
|
|
6049
|
-
kind:
|
|
6248
|
+
kind: z3.literal("role_attempt"),
|
|
6050
6249
|
...envelopeTail,
|
|
6051
|
-
actor:
|
|
6052
|
-
attempt:
|
|
6053
|
-
effect_id:
|
|
6054
|
-
model:
|
|
6250
|
+
actor: z3.string().nullable(),
|
|
6251
|
+
attempt: z3.number().int().nullable(),
|
|
6252
|
+
effect_id: z3.string(),
|
|
6253
|
+
model: z3.string().nullable()
|
|
6055
6254
|
};
|
|
6056
|
-
var RoleAttemptEventSchema =
|
|
6057
|
-
|
|
6255
|
+
var RoleAttemptEventSchema = z3.discriminatedUnion("event", [
|
|
6256
|
+
z3.object({
|
|
6058
6257
|
...roleAttemptShared,
|
|
6059
|
-
event:
|
|
6258
|
+
event: z3.literal("attempted"),
|
|
6060
6259
|
outcome: RoleAttemptOutcomeSchema,
|
|
6061
6260
|
usage: dispatchUsageField
|
|
6062
6261
|
}).strict()
|
|
@@ -6064,42 +6263,59 @@ var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
|
|
|
6064
6263
|
var handoffShared = {
|
|
6065
6264
|
meta: HeaderMetaSchema,
|
|
6066
6265
|
subject: SubjectSchema,
|
|
6067
|
-
kind:
|
|
6266
|
+
kind: z3.literal("handoff"),
|
|
6068
6267
|
...envelopeTail,
|
|
6069
|
-
class:
|
|
6070
|
-
reason:
|
|
6268
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
6269
|
+
reason: z3.string()
|
|
6071
6270
|
};
|
|
6072
|
-
var HandoffEventSchema =
|
|
6073
|
-
|
|
6271
|
+
var HandoffEventSchema = z3.discriminatedUnion("event", [
|
|
6272
|
+
z3.object({
|
|
6074
6273
|
...handoffShared,
|
|
6075
|
-
event:
|
|
6076
|
-
requested_decision:
|
|
6274
|
+
event: z3.literal("raised"),
|
|
6275
|
+
requested_decision: z3.string().nullable()
|
|
6077
6276
|
}).strict(),
|
|
6078
|
-
|
|
6277
|
+
z3.object({
|
|
6079
6278
|
...handoffShared,
|
|
6080
|
-
event:
|
|
6081
|
-
resolution:
|
|
6082
|
-
resolved_by:
|
|
6279
|
+
event: z3.literal("resolved"),
|
|
6280
|
+
resolution: z3.string().nullable(),
|
|
6281
|
+
resolved_by: z3.string().nullable()
|
|
6083
6282
|
}).strict()
|
|
6084
6283
|
]);
|
|
6085
|
-
var EffectTargetSchema =
|
|
6086
|
-
kind:
|
|
6087
|
-
ref:
|
|
6284
|
+
var EffectTargetSchema = z3.object({
|
|
6285
|
+
kind: z3.string(),
|
|
6286
|
+
ref: z3.string()
|
|
6088
6287
|
}).strict();
|
|
6089
6288
|
var effectShared = {
|
|
6090
6289
|
meta: HeaderMetaSchema,
|
|
6091
6290
|
subject: SubjectSchema,
|
|
6092
|
-
kind:
|
|
6291
|
+
kind: z3.literal("effect"),
|
|
6093
6292
|
...envelopeTail,
|
|
6094
|
-
effect_id:
|
|
6293
|
+
effect_id: z3.string(),
|
|
6095
6294
|
target: EffectTargetSchema
|
|
6096
6295
|
};
|
|
6097
|
-
var EffectEventSchema =
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6296
|
+
var EffectEventSchema = z3.discriminatedUnion("event", [
|
|
6297
|
+
z3.object({ ...effectShared, event: z3.literal("attempted") }).strict(),
|
|
6298
|
+
z3.object({ ...effectShared, event: z3.literal("observed"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict(),
|
|
6299
|
+
z3.object({ ...effectShared, event: z3.literal("verified"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict()
|
|
6300
|
+
]);
|
|
6301
|
+
var CustomFieldValueSchema = z3.union([z3.string().max(CUSTOM_TEXT_MAX_LENGTH), z3.number().finite(), z3.boolean()]);
|
|
6302
|
+
var customShared = {
|
|
6303
|
+
meta: HeaderMetaV3Schema,
|
|
6304
|
+
subject: SubjectSchema,
|
|
6305
|
+
kind: z3.literal("custom"),
|
|
6306
|
+
...envelopeTail
|
|
6307
|
+
};
|
|
6308
|
+
var CustomEventSchema = z3.discriminatedUnion("event", [
|
|
6309
|
+
z3.object({
|
|
6310
|
+
...customShared,
|
|
6311
|
+
event: z3.literal("recorded"),
|
|
6312
|
+
name: z3.string().max(CUSTOM_EVENT_NAME_MAX_LENGTH).regex(CUSTOM_EVENT_NAME_PATTERN),
|
|
6313
|
+
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, {
|
|
6314
|
+
message: `custom: at most ${CUSTOM_EVENT_MAX_FIELDS} fields`
|
|
6315
|
+
})
|
|
6316
|
+
}).strict()
|
|
6101
6317
|
]);
|
|
6102
|
-
var LogEventSchema =
|
|
6318
|
+
var LogEventSchema = z3.union([
|
|
6103
6319
|
DispatchEventSchema,
|
|
6104
6320
|
DevReviewLoopEventSchema,
|
|
6105
6321
|
ForgeWriteEventSchema,
|
|
@@ -6108,10 +6324,11 @@ var LogEventSchema = z2.union([
|
|
|
6108
6324
|
UsageEventSchema,
|
|
6109
6325
|
RoleAttemptEventSchema,
|
|
6110
6326
|
HandoffEventSchema,
|
|
6111
|
-
EffectEventSchema
|
|
6327
|
+
EffectEventSchema,
|
|
6328
|
+
CustomEventSchema
|
|
6112
6329
|
]);
|
|
6113
|
-
|
|
6114
6330
|
// ../../packages/aeg-core/src/log/envelope.ts
|
|
6331
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
6115
6332
|
function isRole(value) {
|
|
6116
6333
|
return value !== undefined && ROLE_VALUES.includes(value);
|
|
6117
6334
|
}
|
|
@@ -6148,18 +6365,27 @@ function roundFromEnv(round) {
|
|
|
6148
6365
|
const n = Number(round);
|
|
6149
6366
|
return Number.isInteger(n) ? n : undefined;
|
|
6150
6367
|
}
|
|
6368
|
+
function prFromEnv(pr) {
|
|
6369
|
+
if (pr === undefined || pr === "")
|
|
6370
|
+
return;
|
|
6371
|
+
const n = Number(pr);
|
|
6372
|
+
return Number.isInteger(n) && n > 0 ? n : undefined;
|
|
6373
|
+
}
|
|
6151
6374
|
function buildHeader(input) {
|
|
6152
6375
|
const role = isRole(input.env.role) ? input.env.role : "unattributed";
|
|
6153
6376
|
const round = roundFromEnv(input.env.round);
|
|
6377
|
+
const pr = prFromEnv(input.env.pr);
|
|
6154
6378
|
const subject = {
|
|
6155
6379
|
issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
|
|
6156
6380
|
role,
|
|
6157
6381
|
...round !== undefined ? { round } : {},
|
|
6382
|
+
...pr !== undefined ? { pr } : {},
|
|
6158
6383
|
...input.subject ?? {}
|
|
6159
6384
|
};
|
|
6385
|
+
const issue = subject.issue;
|
|
6160
6386
|
return {
|
|
6161
6387
|
meta: {
|
|
6162
|
-
schema:
|
|
6388
|
+
schema: 3,
|
|
6163
6389
|
ts: input.now.toISOString(),
|
|
6164
6390
|
run_id: input.runId,
|
|
6165
6391
|
seq: input.seq,
|
|
@@ -6182,7 +6408,19 @@ function buildHeader(input) {
|
|
|
6182
6408
|
ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
|
|
6183
6409
|
policy_digest: input.inputVersions?.policyDigest ?? null
|
|
6184
6410
|
},
|
|
6185
|
-
provenance: provenanceFor(input)
|
|
6411
|
+
provenance: provenanceFor(input),
|
|
6412
|
+
work: {
|
|
6413
|
+
ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
|
|
6414
|
+
repo: input.repo,
|
|
6415
|
+
change: null,
|
|
6416
|
+
revision: null
|
|
6417
|
+
},
|
|
6418
|
+
flow: {
|
|
6419
|
+
id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
|
|
6420
|
+
version: lineageFieldFromEnv(input.env.flowVersion)
|
|
6421
|
+
},
|
|
6422
|
+
runtime: lineageFieldFromEnv(input.env.runtime),
|
|
6423
|
+
source: lineageFieldFromEnv(input.env.source)
|
|
6186
6424
|
},
|
|
6187
6425
|
subject
|
|
6188
6426
|
};
|
|
@@ -6225,7 +6463,7 @@ function redact(value, home) {
|
|
|
6225
6463
|
return value;
|
|
6226
6464
|
}
|
|
6227
6465
|
// ../../packages/aeg-core/src/log/store.ts
|
|
6228
|
-
var KNOWN_SCHEMA_VERSIONS = [1, 2];
|
|
6466
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
|
|
6229
6467
|
function metaOf(obj) {
|
|
6230
6468
|
if (obj === null || typeof obj !== "object")
|
|
6231
6469
|
return null;
|
|
@@ -6291,7 +6529,7 @@ function classifyStoredLine(raw, home) {
|
|
|
6291
6529
|
return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
|
|
6292
6530
|
}
|
|
6293
6531
|
const redacted = redact(event, home);
|
|
6294
|
-
const provenance = version
|
|
6532
|
+
const provenance = version >= 2 ? event.meta.provenance ?? null : null;
|
|
6295
6533
|
return {
|
|
6296
6534
|
status: "ok",
|
|
6297
6535
|
identity,
|
|
@@ -6304,189 +6542,172 @@ function classifyStoredLine(raw, home) {
|
|
|
6304
6542
|
};
|
|
6305
6543
|
}
|
|
6306
6544
|
// ../../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:
|
|
6545
|
+
import { z as z4 } from "zod";
|
|
6546
|
+
var isoTimestamp = z4.string().min(1);
|
|
6547
|
+
var taskId = z4.number().int().positive();
|
|
6548
|
+
var epochNumber = z4.number().int().nonnegative();
|
|
6549
|
+
var RunRecordSchema = z4.object({
|
|
6550
|
+
version: z4.literal(1),
|
|
6551
|
+
kind: z4.literal("run"),
|
|
6314
6552
|
task: taskId,
|
|
6315
|
-
runId:
|
|
6316
|
-
pid:
|
|
6317
|
-
host:
|
|
6553
|
+
runId: z4.string().min(1),
|
|
6554
|
+
pid: z4.number().int().positive(),
|
|
6555
|
+
host: z4.string().min(1),
|
|
6318
6556
|
startedAt: isoTimestamp,
|
|
6319
|
-
childStartedAt:
|
|
6320
|
-
childCommand:
|
|
6557
|
+
childStartedAt: z4.string().min(1).nullable().optional(),
|
|
6558
|
+
childCommand: z4.string().min(1).nullable().optional()
|
|
6321
6559
|
}).strict();
|
|
6322
|
-
var InputRecordSchema =
|
|
6323
|
-
version:
|
|
6324
|
-
kind:
|
|
6560
|
+
var InputRecordSchema = z4.object({
|
|
6561
|
+
version: z4.literal(1),
|
|
6562
|
+
kind: z4.literal("input"),
|
|
6325
6563
|
task: taskId,
|
|
6326
|
-
runId:
|
|
6327
|
-
source:
|
|
6328
|
-
pr:
|
|
6329
|
-
round:
|
|
6564
|
+
runId: z4.string().min(1),
|
|
6565
|
+
source: z4.union([z4.literal("fresh"), z4.literal("resume")]),
|
|
6566
|
+
pr: z4.number().int().positive().nullable(),
|
|
6567
|
+
round: z4.number().int().nonnegative(),
|
|
6330
6568
|
recordedAt: isoTimestamp
|
|
6331
6569
|
}).strict();
|
|
6332
|
-
var OwnershipRecordSchema =
|
|
6333
|
-
version:
|
|
6334
|
-
kind:
|
|
6570
|
+
var OwnershipRecordSchema = z4.object({
|
|
6571
|
+
version: z4.literal(1),
|
|
6572
|
+
kind: z4.literal("ownership"),
|
|
6335
6573
|
task: taskId,
|
|
6336
6574
|
epoch: epochNumber,
|
|
6337
|
-
ownerId:
|
|
6338
|
-
pid:
|
|
6339
|
-
host:
|
|
6575
|
+
ownerId: z4.string().min(1),
|
|
6576
|
+
pid: z4.number().int().positive(),
|
|
6577
|
+
host: z4.string().min(1),
|
|
6340
6578
|
acquiredAt: isoTimestamp
|
|
6341
6579
|
}).strict();
|
|
6342
|
-
var TransitionRecordSchema =
|
|
6343
|
-
version:
|
|
6344
|
-
kind:
|
|
6580
|
+
var TransitionRecordSchema = z4.object({
|
|
6581
|
+
version: z4.literal(1),
|
|
6582
|
+
kind: z4.literal("transition"),
|
|
6345
6583
|
task: taskId,
|
|
6346
6584
|
epoch: epochNumber,
|
|
6347
|
-
seq:
|
|
6348
|
-
from:
|
|
6349
|
-
to:
|
|
6350
|
-
detail:
|
|
6585
|
+
seq: z4.number().int().nonnegative(),
|
|
6586
|
+
from: z4.string().min(1),
|
|
6587
|
+
to: z4.string().min(1),
|
|
6588
|
+
detail: z4.string().optional(),
|
|
6351
6589
|
at: isoTimestamp
|
|
6352
6590
|
}).strict();
|
|
6353
|
-
var ManifestRecordSchema =
|
|
6354
|
-
version:
|
|
6355
|
-
kind:
|
|
6591
|
+
var ManifestRecordSchema = z4.object({
|
|
6592
|
+
version: z4.literal(1),
|
|
6593
|
+
kind: z4.literal("manifest"),
|
|
6356
6594
|
task: taskId,
|
|
6357
6595
|
round: epochNumber,
|
|
6358
|
-
repository:
|
|
6359
|
-
pr:
|
|
6360
|
-
branch:
|
|
6361
|
-
baseSha:
|
|
6362
|
-
headSha:
|
|
6363
|
-
briefHash:
|
|
6364
|
-
objectivesVersion:
|
|
6596
|
+
repository: z4.string().min(1),
|
|
6597
|
+
pr: z4.number().int().positive(),
|
|
6598
|
+
branch: z4.string().min(1),
|
|
6599
|
+
baseSha: z4.string().min(1).nullable(),
|
|
6600
|
+
headSha: z4.string().min(1),
|
|
6601
|
+
briefHash: z4.string().min(1).nullable(),
|
|
6602
|
+
objectivesVersion: z4.string().min(1).nullable(),
|
|
6365
6603
|
rulingOrdinal: epochNumber,
|
|
6366
|
-
policyDigest:
|
|
6604
|
+
policyDigest: z4.string().min(1),
|
|
6367
6605
|
recordedAt: isoTimestamp
|
|
6368
6606
|
}).strict();
|
|
6369
|
-
var roundHeadIdentity =
|
|
6370
|
-
var LoopBudgetsSchema =
|
|
6371
|
-
mechanicalRetries:
|
|
6372
|
-
reviewRounds:
|
|
6373
|
-
infrastructureRetries:
|
|
6607
|
+
var roundHeadIdentity = z4.object({ round: z4.number().int().positive(), head: z4.string().min(1) }).strict();
|
|
6608
|
+
var LoopBudgetsSchema = z4.object({
|
|
6609
|
+
mechanicalRetries: z4.number().int().nonnegative(),
|
|
6610
|
+
reviewRounds: z4.number().int().nonnegative(),
|
|
6611
|
+
infrastructureRetries: z4.number().int().nonnegative()
|
|
6374
6612
|
}).strict();
|
|
6375
|
-
var LoopStateRecordSchema =
|
|
6376
|
-
version:
|
|
6377
|
-
kind:
|
|
6613
|
+
var LoopStateRecordSchema = z4.object({
|
|
6614
|
+
version: z4.literal(1),
|
|
6615
|
+
kind: z4.literal("loop_state"),
|
|
6378
6616
|
task: taskId,
|
|
6379
|
-
round:
|
|
6380
|
-
phase:
|
|
6381
|
-
pauseReason:
|
|
6617
|
+
round: z4.number().int().positive(),
|
|
6618
|
+
phase: z4.string().min(1),
|
|
6619
|
+
pauseReason: z4.string().min(1).nullable(),
|
|
6382
6620
|
budgets: LoopBudgetsSchema,
|
|
6383
6621
|
heldResult: roundHeadIdentity.nullable(),
|
|
6384
6622
|
deliveredFindings: roundHeadIdentity.nullable(),
|
|
6385
|
-
repeatMemory:
|
|
6386
|
-
blockingFindings:
|
|
6387
|
-
lastFailure:
|
|
6623
|
+
repeatMemory: z4.object({
|
|
6624
|
+
blockingFindings: z4.array(z4.string()),
|
|
6625
|
+
lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
|
|
6388
6626
|
}).strict().optional(),
|
|
6627
|
+
publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
|
|
6628
|
+
taskStartedAt: isoTimestamp.optional(),
|
|
6629
|
+
phaseMs: z4.record(z4.string(), z4.number().nonnegative()).optional(),
|
|
6389
6630
|
recordedAt: isoTimestamp
|
|
6390
6631
|
}).strict();
|
|
6391
|
-
var EffectRecordSchema =
|
|
6392
|
-
version:
|
|
6393
|
-
kind:
|
|
6632
|
+
var EffectRecordSchema = z4.object({
|
|
6633
|
+
version: z4.literal(1),
|
|
6634
|
+
kind: z4.literal("effect"),
|
|
6394
6635
|
task: taskId,
|
|
6395
|
-
key:
|
|
6396
|
-
operation:
|
|
6397
|
-
target:
|
|
6398
|
-
inputVersion:
|
|
6399
|
-
payloadDigest:
|
|
6400
|
-
status:
|
|
6401
|
-
url:
|
|
6636
|
+
key: z4.string().min(1),
|
|
6637
|
+
operation: z4.string().min(1),
|
|
6638
|
+
target: z4.string().min(1),
|
|
6639
|
+
inputVersion: z4.number().int().nonnegative(),
|
|
6640
|
+
payloadDigest: z4.string().min(1),
|
|
6641
|
+
status: z4.union([z4.literal("started"), z4.literal("verified"), z4.literal("uncertain")]),
|
|
6642
|
+
url: z4.string().optional(),
|
|
6402
6643
|
recordedAt: isoTimestamp
|
|
6403
6644
|
}).strict();
|
|
6404
|
-
var EscalationRecordSchema =
|
|
6405
|
-
version:
|
|
6406
|
-
kind:
|
|
6645
|
+
var EscalationRecordSchema = z4.object({
|
|
6646
|
+
version: z4.literal(1),
|
|
6647
|
+
kind: z4.literal("escalation"),
|
|
6407
6648
|
task: taskId,
|
|
6408
|
-
escalationId:
|
|
6649
|
+
escalationId: z4.string().min(1),
|
|
6409
6650
|
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:
|
|
6651
|
+
head: z4.string().min(1),
|
|
6652
|
+
branch: z4.string().min(1),
|
|
6653
|
+
pr: z4.number().int().positive().nullable(),
|
|
6654
|
+
runId: z4.string().min(1),
|
|
6655
|
+
pid: z4.number().int().positive(),
|
|
6656
|
+
host: z4.string().min(1),
|
|
6657
|
+
agent: z4.string().min(1).optional(),
|
|
6658
|
+
reason: z4.string().min(1),
|
|
6659
|
+
detail: z4.string().optional(),
|
|
6660
|
+
evidence: z4.string().optional(),
|
|
6661
|
+
attemptedRecovery: z4.string().min(1),
|
|
6662
|
+
requestedDecision: z4.string().min(1),
|
|
6663
|
+
recipient: z4.string().min(1),
|
|
6664
|
+
briefHash: z4.string().min(1).nullable(),
|
|
6665
|
+
objectivesVersion: z4.string().min(1).nullable(),
|
|
6425
6666
|
rulingOrdinal: epochNumber,
|
|
6426
|
-
policyDigest:
|
|
6667
|
+
policyDigest: z4.string().min(1),
|
|
6427
6668
|
recordedAt: isoTimestamp
|
|
6428
6669
|
}).strict();
|
|
6429
|
-
var ResolutionRecordSchema =
|
|
6430
|
-
version:
|
|
6431
|
-
kind:
|
|
6670
|
+
var ResolutionRecordSchema = z4.object({
|
|
6671
|
+
version: z4.literal(1),
|
|
6672
|
+
kind: z4.literal("resolution"),
|
|
6432
6673
|
task: taskId,
|
|
6433
|
-
escalationId:
|
|
6434
|
-
decision:
|
|
6435
|
-
authenticatedBy:
|
|
6436
|
-
authenticatedFrom:
|
|
6674
|
+
escalationId: z4.string().min(1),
|
|
6675
|
+
decision: z4.union([z4.literal("resume"), z4.literal("cancel")]),
|
|
6676
|
+
authenticatedBy: z4.string().min(1),
|
|
6677
|
+
authenticatedFrom: z4.string().min(1),
|
|
6437
6678
|
consumedAt: isoTimestamp
|
|
6438
6679
|
}).strict();
|
|
6680
|
+
// ../../packages/aeg-core/src/control-store/local.ts
|
|
6681
|
+
var CONTROL_AREA_DIRNAME = "control";
|
|
6439
6682
|
// src/lib/config.ts
|
|
6440
|
-
import { execFile as execFile4, execFileSync as
|
|
6683
|
+
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
6441
6684
|
import { promisify as promisify4 } from "node:util";
|
|
6442
6685
|
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
|
|
6443
6686
|
import { homedir } from "node:os";
|
|
6444
6687
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
6445
|
-
import { z as
|
|
6688
|
+
import { z as z5 } from "zod";
|
|
6446
6689
|
|
|
6447
6690
|
// src/lib/agent-vendors.ts
|
|
6448
6691
|
var AGENT_VENDORS = ["skills", "claude", "gemini"];
|
|
6449
6692
|
|
|
6450
|
-
// src/lib/worker-boundary.ts
|
|
6451
|
-
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
6452
|
-
var LOG_HEADER_KEYCHAIN_SERVICE = "Vinaya Log";
|
|
6453
|
-
var logHeaderKeychainCache = new Map;
|
|
6454
|
-
function readRealLogHeaderKeychainCredential(variable) {
|
|
6455
|
-
if (process.platform !== "darwin")
|
|
6456
|
-
return null;
|
|
6457
|
-
try {
|
|
6458
|
-
return execFileSync2("/usr/bin/security", ["find-generic-password", "-s", LOG_HEADER_KEYCHAIN_SERVICE, "-a", variable, "-w"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 5000, maxBuffer: 1024 * 1024 }).replace(/\n$/, "");
|
|
6459
|
-
} catch {
|
|
6460
|
-
return null;
|
|
6461
|
-
}
|
|
6462
|
-
}
|
|
6463
|
-
function readLogHeaderKeychainCredential(variable) {
|
|
6464
|
-
const cached = logHeaderKeychainCache.get(variable);
|
|
6465
|
-
if (cached !== undefined)
|
|
6466
|
-
return cached;
|
|
6467
|
-
const value = readRealLogHeaderKeychainCredential(variable);
|
|
6468
|
-
logHeaderKeychainCache.set(variable, value);
|
|
6469
|
-
return value;
|
|
6470
|
-
}
|
|
6471
|
-
|
|
6472
6693
|
// src/lib/config.ts
|
|
6473
|
-
var EnvEntrySchema =
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6694
|
+
var EnvEntrySchema = z5.union([
|
|
6695
|
+
z5.literal(true),
|
|
6696
|
+
z5.object({ optional: z5.literal(true) }),
|
|
6697
|
+
z5.object({ anyOf: z5.array(z5.string()).min(2) }),
|
|
6698
|
+
z5.string()
|
|
6478
6699
|
]);
|
|
6479
|
-
var CheckEntrySchema =
|
|
6480
|
-
run:
|
|
6481
|
-
scope:
|
|
6482
|
-
include:
|
|
6483
|
-
args:
|
|
6484
|
-
timeoutMs:
|
|
6485
|
-
env:
|
|
6486
|
-
requiresOpenPr:
|
|
6487
|
-
ownWorkflow:
|
|
6488
|
-
principalOwed:
|
|
6489
|
-
validates:
|
|
6700
|
+
var CheckEntrySchema = z5.object({
|
|
6701
|
+
run: z5.string(),
|
|
6702
|
+
scope: z5.enum(["diff", "full"]),
|
|
6703
|
+
include: z5.array(z5.string()).optional(),
|
|
6704
|
+
args: z5.array(z5.string()).optional(),
|
|
6705
|
+
timeoutMs: z5.number().optional(),
|
|
6706
|
+
env: z5.record(z5.string(), EnvEntrySchema).optional(),
|
|
6707
|
+
requiresOpenPr: z5.boolean().optional(),
|
|
6708
|
+
ownWorkflow: z5.boolean().optional(),
|
|
6709
|
+
principalOwed: z5.literal(true).optional(),
|
|
6710
|
+
validates: z5.enum(["body", "issue"]).optional()
|
|
6490
6711
|
}).superRefine((entry, ctx) => {
|
|
6491
6712
|
if (!entry.env)
|
|
6492
6713
|
return;
|
|
@@ -6496,22 +6717,22 @@ var CheckEntrySchema = z4.object({
|
|
|
6496
6717
|
const members = value.anyOf;
|
|
6497
6718
|
if (new Set(members).size !== members.length) {
|
|
6498
6719
|
ctx.addIssue({
|
|
6499
|
-
code:
|
|
6720
|
+
code: z5.ZodIssueCode.custom,
|
|
6500
6721
|
message: `env.${key}.anyOf has duplicate members`,
|
|
6501
6722
|
path: ["env", key, "anyOf"]
|
|
6502
6723
|
});
|
|
6503
6724
|
}
|
|
6504
6725
|
if (!members.includes(key)) {
|
|
6505
6726
|
ctx.addIssue({
|
|
6506
|
-
code:
|
|
6727
|
+
code: z5.ZodIssueCode.custom,
|
|
6507
6728
|
message: `env.${key}.anyOf must include "${key}" itself as a member`,
|
|
6508
6729
|
path: ["env", key, "anyOf"]
|
|
6509
6730
|
});
|
|
6510
6731
|
}
|
|
6511
6732
|
}
|
|
6512
6733
|
});
|
|
6513
|
-
var RoleEntrySchema =
|
|
6514
|
-
contract:
|
|
6734
|
+
var RoleEntrySchema = z5.object({
|
|
6735
|
+
contract: z5.string().refine((p) => p.includes("/"), {
|
|
6515
6736
|
message: 'must be a path (contain at least one "/"), not a bare filename'
|
|
6516
6737
|
})
|
|
6517
6738
|
});
|
|
@@ -6535,17 +6756,17 @@ var BRIEF_BUILTINS = [
|
|
|
6535
6756
|
"briefSections",
|
|
6536
6757
|
"milestoneShape"
|
|
6537
6758
|
];
|
|
6538
|
-
var BriefSectionSchema =
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6759
|
+
var BriefSectionSchema = z5.union([
|
|
6760
|
+
z5.object({ builtin: z5.enum(BRIEF_BUILTINS) }),
|
|
6761
|
+
z5.object({ heading: z5.string().min(1), name: z5.string().optional() }),
|
|
6762
|
+
z5.object({ field: z5.string().min(1), name: z5.string().optional() }),
|
|
6763
|
+
z5.object({ phrase: z5.string().min(1), name: z5.string().optional() })
|
|
6543
6764
|
]);
|
|
6544
|
-
var BriefSchemaSchema =
|
|
6545
|
-
pr:
|
|
6546
|
-
issue:
|
|
6547
|
-
milestone:
|
|
6548
|
-
ack:
|
|
6765
|
+
var BriefSchemaSchema = z5.object({
|
|
6766
|
+
pr: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
6767
|
+
issue: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
6768
|
+
milestone: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
|
|
6769
|
+
ack: z5.array(z5.enum(BRIEF_BUILTINS)).optional()
|
|
6549
6770
|
});
|
|
6550
6771
|
function isSafeRepoRelPath(p) {
|
|
6551
6772
|
if (p.length === 0)
|
|
@@ -6554,7 +6775,7 @@ function isSafeRepoRelPath(p) {
|
|
|
6554
6775
|
return false;
|
|
6555
6776
|
return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
|
|
6556
6777
|
}
|
|
6557
|
-
var SafeRepoRelPath =
|
|
6778
|
+
var SafeRepoRelPath = z5.string().refine(isSafeRepoRelPath, {
|
|
6558
6779
|
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
6559
6780
|
});
|
|
6560
6781
|
var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
@@ -6564,22 +6785,22 @@ function isCanonicalHookBlockPath(p) {
|
|
|
6564
6785
|
var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
|
|
6565
6786
|
message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
|
|
6566
6787
|
});
|
|
6567
|
-
var ManagedBlockRecordSchema =
|
|
6788
|
+
var ManagedBlockRecordSchema = z5.object({
|
|
6568
6789
|
path: ManagedHookBlockPath,
|
|
6569
|
-
marker:
|
|
6570
|
-
comment:
|
|
6790
|
+
marker: z5.string(),
|
|
6791
|
+
comment: z5.enum(["hash", "html"])
|
|
6571
6792
|
});
|
|
6572
|
-
var ManagedManifestSchema =
|
|
6573
|
-
version:
|
|
6574
|
-
files:
|
|
6575
|
-
blocks:
|
|
6576
|
-
labels:
|
|
6577
|
-
agents:
|
|
6793
|
+
var ManagedManifestSchema = z5.object({
|
|
6794
|
+
version: z5.number().int().positive(),
|
|
6795
|
+
files: z5.array(SafeRepoRelPath),
|
|
6796
|
+
blocks: z5.array(ManagedBlockRecordSchema),
|
|
6797
|
+
labels: z5.array(z5.string()),
|
|
6798
|
+
agents: z5.array(z5.enum(AGENT_VENDORS)).optional()
|
|
6578
6799
|
});
|
|
6579
|
-
var ProjectEntrySchema =
|
|
6580
|
-
name:
|
|
6581
|
-
description:
|
|
6582
|
-
path:
|
|
6800
|
+
var ProjectEntrySchema = z5.object({
|
|
6801
|
+
name: z5.string().min(1),
|
|
6802
|
+
description: z5.string().min(1).optional(),
|
|
6803
|
+
path: z5.string().min(1).optional()
|
|
6583
6804
|
});
|
|
6584
6805
|
function parseTokensCollectDeclaration(value) {
|
|
6585
6806
|
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
@@ -6590,90 +6811,97 @@ function parseTokensCollectDeclaration(value) {
|
|
|
6590
6811
|
return null;
|
|
6591
6812
|
return { interpreter, script };
|
|
6592
6813
|
}
|
|
6593
|
-
var VinayaConfigSchema =
|
|
6594
|
-
rings:
|
|
6595
|
-
ring1_forgeWriteInterception:
|
|
6596
|
-
ring2_asyncAudits:
|
|
6814
|
+
var VinayaConfigSchema = z5.object({
|
|
6815
|
+
rings: z5.object({
|
|
6816
|
+
ring1_forgeWriteInterception: z5.boolean(),
|
|
6817
|
+
ring2_asyncAudits: z5.boolean()
|
|
6597
6818
|
}).optional(),
|
|
6598
|
-
checks:
|
|
6599
|
-
roles:
|
|
6819
|
+
checks: z5.record(z5.string(), CheckEntrySchema).optional(),
|
|
6820
|
+
roles: z5.record(z5.string(), RoleEntrySchema).optional(),
|
|
6600
6821
|
briefSchema: BriefSchemaSchema.optional(),
|
|
6601
6822
|
managed: ManagedManifestSchema.optional(),
|
|
6602
|
-
principals:
|
|
6603
|
-
releaseActor:
|
|
6604
|
-
ci:
|
|
6605
|
-
tokens:
|
|
6606
|
-
collect:
|
|
6823
|
+
principals: z5.array(z5.string()).min(1).optional(),
|
|
6824
|
+
releaseActor: z5.string().min(1).optional(),
|
|
6825
|
+
ci: z5.object({ setup: z5.string().min(1) }).optional(),
|
|
6826
|
+
tokens: z5.object({
|
|
6827
|
+
collect: z5.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
6607
6828
|
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
6608
6829
|
})
|
|
6609
6830
|
}).optional(),
|
|
6610
|
-
blastRadius:
|
|
6611
|
-
proseGates:
|
|
6612
|
-
doctrineRoot:
|
|
6613
|
-
readerFacingPrefix:
|
|
6614
|
-
readerFacingSuffix:
|
|
6615
|
-
legacySlugDir:
|
|
6616
|
-
sourceComments:
|
|
6617
|
-
globs:
|
|
6618
|
-
allowlist:
|
|
6619
|
-
severity:
|
|
6831
|
+
blastRadius: z5.object({ extraDomains: z5.array(z5.string()).optional() }).optional(),
|
|
6832
|
+
proseGates: z5.object({
|
|
6833
|
+
doctrineRoot: z5.string().min(1).optional(),
|
|
6834
|
+
readerFacingPrefix: z5.string().min(1).optional(),
|
|
6835
|
+
readerFacingSuffix: z5.string().min(1).optional(),
|
|
6836
|
+
legacySlugDir: z5.string().min(1).optional(),
|
|
6837
|
+
sourceComments: z5.object({
|
|
6838
|
+
globs: z5.array(z5.string().min(1)).optional(),
|
|
6839
|
+
allowlist: z5.array(z5.string().min(1)).optional(),
|
|
6840
|
+
severity: z5.enum(["warning", "error"]).optional()
|
|
6620
6841
|
}).optional(),
|
|
6621
|
-
specGrandfather:
|
|
6622
|
-
specPaths:
|
|
6842
|
+
specGrandfather: z5.union([z5.array(z5.string().min(1)), z5.record(z5.string().min(1), z5.number().int().min(0))]).optional(),
|
|
6843
|
+
specPaths: z5.array(z5.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
|
|
6623
6844
|
message: "must be a repository-relative path, not an absolute one"
|
|
6624
6845
|
}).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
|
|
6625
6846
|
message: "must stay inside the repository — no `..` segment"
|
|
6626
6847
|
})).optional()
|
|
6627
6848
|
}).optional(),
|
|
6628
|
-
projects:
|
|
6629
|
-
dispatch:
|
|
6630
|
-
timeoutMs:
|
|
6631
|
-
killGraceMs:
|
|
6632
|
-
agent:
|
|
6633
|
-
|
|
6849
|
+
projects: z5.array(ProjectEntrySchema).optional(),
|
|
6850
|
+
dispatch: z5.object({
|
|
6851
|
+
timeoutMs: z5.number().int().positive().optional(),
|
|
6852
|
+
killGraceMs: z5.number().int().positive().optional(),
|
|
6853
|
+
agent: z5.enum(["claude", "codex", "gemini"]).optional()
|
|
6854
|
+
}).optional(),
|
|
6855
|
+
reviewPolicy: z5.object({
|
|
6856
|
+
codeReviewThreshold: z5.string().min(1).optional(),
|
|
6857
|
+
securityThreshold: z5.string().min(1).optional(),
|
|
6858
|
+
maxRounds: z5.number().optional(),
|
|
6859
|
+
maxTaskMinutes: z5.number().optional()
|
|
6634
6860
|
}).optional(),
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
securityThreshold: z4.string().min(1).optional(),
|
|
6638
|
-
maxRounds: z4.number().optional()
|
|
6861
|
+
securityScan: z5.object({
|
|
6862
|
+
command: z5.array(z5.string().min(1)).min(1)
|
|
6639
6863
|
}).optional(),
|
|
6640
|
-
gateCutovers:
|
|
6641
|
-
objectivesSinceIssue:
|
|
6642
|
-
briefSectionsSinceIssue:
|
|
6643
|
-
documentationSinceIssue:
|
|
6644
|
-
briefRulesSincePr:
|
|
6645
|
-
agentBoxesRefusedSincePr:
|
|
6864
|
+
gateCutovers: z5.object({
|
|
6865
|
+
objectivesSinceIssue: z5.number().int().nonnegative().optional(),
|
|
6866
|
+
briefSectionsSinceIssue: z5.number().int().nonnegative().optional(),
|
|
6867
|
+
documentationSinceIssue: z5.number().int().nonnegative().optional(),
|
|
6868
|
+
briefRulesSincePr: z5.number().int().nonnegative().optional(),
|
|
6869
|
+
agentBoxesRefusedSincePr: z5.number().int().nonnegative().optional()
|
|
6646
6870
|
}).optional(),
|
|
6647
|
-
planning:
|
|
6648
|
-
collisionThreshold:
|
|
6871
|
+
planning: z5.object({
|
|
6872
|
+
collisionThreshold: z5.number().int().nonnegative().optional()
|
|
6649
6873
|
}).optional(),
|
|
6650
|
-
prePush:
|
|
6651
|
-
alwaysRun:
|
|
6874
|
+
prePush: z5.object({
|
|
6875
|
+
alwaysRun: z5.array(z5.string()).optional()
|
|
6652
6876
|
}).optional(),
|
|
6653
|
-
report:
|
|
6654
|
-
commandTimeoutMs:
|
|
6877
|
+
report: z5.object({
|
|
6878
|
+
commandTimeoutMs: z5.number().int().positive().optional()
|
|
6655
6879
|
}).superRefine((report, ctx) => {
|
|
6656
6880
|
const commandTimeoutMs = report.commandTimeoutMs;
|
|
6657
6881
|
if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
|
|
6658
6882
|
ctx.addIssue({
|
|
6659
|
-
code:
|
|
6883
|
+
code: z5.ZodIssueCode.custom,
|
|
6660
6884
|
path: ["commandTimeoutMs"],
|
|
6661
6885
|
message: "must be at most 3600000 (1 hour)"
|
|
6662
6886
|
});
|
|
6663
6887
|
}
|
|
6664
6888
|
}).optional(),
|
|
6665
|
-
logPublish:
|
|
6889
|
+
logPublish: z5.unknown().refine((v) => v === undefined, {
|
|
6666
6890
|
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
6667
6891
|
}),
|
|
6668
|
-
runtimeDir:
|
|
6669
|
-
logs:
|
|
6670
|
-
folder:
|
|
6671
|
-
url:
|
|
6672
|
-
headers:
|
|
6892
|
+
runtimeDir: z5.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
6893
|
+
logs: z5.object({
|
|
6894
|
+
folder: z5.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
6895
|
+
url: z5.string().url().optional(),
|
|
6896
|
+
headers: z5.record(z5.string()).optional(),
|
|
6897
|
+
readHeaders: z5.record(z5.string()).optional(),
|
|
6898
|
+
events: CustomEventDeclarationsSchema.optional()
|
|
6673
6899
|
}).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
|
|
6674
6900
|
message: "logs: set at most one of folder/url"
|
|
6675
6901
|
}).refine((v) => v.headers === undefined || v.url !== undefined, {
|
|
6676
6902
|
message: "logs: headers requires url"
|
|
6903
|
+
}).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
|
|
6904
|
+
message: "logs: readHeaders requires url"
|
|
6677
6905
|
}).optional()
|
|
6678
6906
|
});
|
|
6679
6907
|
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
@@ -6778,10 +7006,15 @@ function resolveReviewPolicy(config) {
|
|
|
6778
7006
|
if (!Number.isInteger(maxRounds) || maxRounds < 1) {
|
|
6779
7007
|
throw new Error(`vinaya.config.json: reviewPolicy.maxRounds "${maxRounds}" is not a positive integer — fix the config, this never falls back to a default.`);
|
|
6780
7008
|
}
|
|
7009
|
+
const maxTaskMinutes = raw.maxTaskMinutes ?? DEFAULT_REVIEW_POLICY.maxTaskMinutes;
|
|
7010
|
+
if (!Number.isInteger(maxTaskMinutes) || maxTaskMinutes < 0) {
|
|
7011
|
+
throw new Error(`vinaya.config.json: reviewPolicy.maxTaskMinutes "${maxTaskMinutes}" is not a non-negative integer (0 turns the budget off) — fix the config, this never falls back to a default.`);
|
|
7012
|
+
}
|
|
6781
7013
|
return {
|
|
6782
7014
|
codeReviewThreshold,
|
|
6783
7015
|
securityThreshold,
|
|
6784
|
-
maxRounds
|
|
7016
|
+
maxRounds,
|
|
7017
|
+
maxTaskMinutes
|
|
6785
7018
|
};
|
|
6786
7019
|
}
|
|
6787
7020
|
function resolveGateCutovers(config) {
|
|
@@ -6821,17 +7054,12 @@ function resolveTrustAnchorLogsDestination(local, trustAnchorConfig) {
|
|
|
6821
7054
|
return "url" in anchored && anchored.url === local.url ? anchored : null;
|
|
6822
7055
|
return "folder" in anchored && anchored.folder === local.folder ? anchored : null;
|
|
6823
7056
|
}
|
|
6824
|
-
function resolveLogsHeaderValues(headers, env
|
|
7057
|
+
function resolveLogsHeaderValues(headers, env) {
|
|
6825
7058
|
if (!headers)
|
|
6826
7059
|
return;
|
|
6827
7060
|
const resolved = {};
|
|
6828
7061
|
for (const [key, value] of Object.entries(headers)) {
|
|
6829
|
-
resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) =>
|
|
6830
|
-
const fromEnv = env[name];
|
|
6831
|
-
if (fromEnv !== undefined)
|
|
6832
|
-
return fromEnv;
|
|
6833
|
-
return readKeychain(name) ?? "";
|
|
6834
|
-
});
|
|
7062
|
+
resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => env[name] ?? "");
|
|
6835
7063
|
}
|
|
6836
7064
|
return resolved;
|
|
6837
7065
|
}
|
|
@@ -6840,7 +7068,7 @@ function trustAnchorRepo() {
|
|
|
6840
7068
|
if (fromRunner)
|
|
6841
7069
|
return fromRunner;
|
|
6842
7070
|
try {
|
|
6843
|
-
const url =
|
|
7071
|
+
const url = execFileSync2("git", ["remote", "get-url", "origin"], {
|
|
6844
7072
|
encoding: "utf-8",
|
|
6845
7073
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6846
7074
|
});
|
|
@@ -6887,7 +7115,7 @@ function resolveCiTrustAnchorProbeRef(env = process.env) {
|
|
|
6887
7115
|
return ref;
|
|
6888
7116
|
}
|
|
6889
7117
|
function readTrustAnchorConfigAtRef(ref) {
|
|
6890
|
-
const raw =
|
|
7118
|
+
const raw = execFileSync2("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
|
|
6891
7119
|
encoding: "utf-8",
|
|
6892
7120
|
stdio: ["ignore", "pipe", "pipe"],
|
|
6893
7121
|
timeout: 1e4
|
|
@@ -6901,7 +7129,7 @@ function ghFetchTrustAnchorConfig() {
|
|
|
6901
7129
|
const repo = trustAnchorRepo();
|
|
6902
7130
|
if (!repo)
|
|
6903
7131
|
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
6904
|
-
return
|
|
7132
|
+
return execFileSync2("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], {
|
|
6905
7133
|
encoding: "utf-8",
|
|
6906
7134
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6907
7135
|
});
|
|
@@ -6993,10 +7221,10 @@ var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.j
|
|
|
6993
7221
|
|
|
6994
7222
|
// src/lib/diff-evidence.ts
|
|
6995
7223
|
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
6996
|
-
import { join as join9, relative, resolve as resolve2 } from "node:path";
|
|
7224
|
+
import { join as join9, relative as relative2, resolve as resolve2 } from "node:path";
|
|
6997
7225
|
|
|
6998
7226
|
// src/lib/brief-assembly.ts
|
|
6999
|
-
import { execFileSync as
|
|
7227
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
7000
7228
|
import { existsSync as existsSync4, readFileSync as readFileSync4, readdirSync as readdirSync2 } from "node:fs";
|
|
7001
7229
|
import { join as join4 } from "node:path";
|
|
7002
7230
|
|
|
@@ -7148,20 +7376,31 @@ var COMMANDS = [
|
|
|
7148
7376
|
{
|
|
7149
7377
|
flag: "--agent <claude|codex|gemini>",
|
|
7150
7378
|
description: "Vendor for the developer and both reviewers this run dispatches"
|
|
7379
|
+
},
|
|
7380
|
+
{
|
|
7381
|
+
flag: "--quiet",
|
|
7382
|
+
description: "Hide the detail lines (an agent's prose, full commands, failed-result tails) on the live terminal; the driver log file keeps them"
|
|
7151
7383
|
}
|
|
7152
7384
|
],
|
|
7153
7385
|
details: [
|
|
7154
7386
|
"Composes `task brief`'s own preparation (`prepareTask`) with the watching driver (`runDriverLoop`, `dev-review-loop.ts`) — nothing else. Preparation starts no agent; the loop's own round 1 reads the frozen brief off the Issue and is the only place a developer is ever dispatched from a fresh task, so exactly one developer is started by construction.",
|
|
7155
7387
|
"A brief already frozen on the Issue is reused, never re-posted — the second `task dispatch`/`task brief` call this composes around does not fail the whole run, it just skips straight to running the loop. A task whose Issue refuses preparation (a missing brief section, an unmet dispatch gate) is refused before any agent starts, with nothing posted.",
|
|
7156
7388
|
"Refuses when the frozen brief's developer branch already has an open pull request AND a driver is still live for it — a driver that crashed or was killed leaves its PR behind, and this command is the one that revives it, in any state, pause held or not.",
|
|
7157
|
-
"issue-711 O4: a pause never ends this process — it keeps running and watches the pull request, continuing on its own once a newer Principal ruling appears (or, for an `'infrastructure'`/`'stale_driver'` pause, after a bounded backoff), with no `--resume` command needed for the ordinary case. Exit and printed summary distinguish a published pull request OR a watched pause's own genuine end — merged, closed, or an operator's own `--cancel` (exit `0` either way, the PR URL) — from the one pause this process can never watch (no pull request exists yet — exit `1`, with the
|
|
7389
|
+
"issue-711 O4: a pause never ends this process — it keeps running and watches the pull request, continuing on its own once a newer Principal ruling appears (or, for an `'infrastructure'`/`'stale_driver'` pause, after a bounded backoff), with no `--resume` command needed for the ordinary case. Exit and printed summary distinguish a published pull request OR a watched pause's own genuine end — merged, closed, or an operator's own `--cancel` (exit `0` either way, the PR URL) — from the one pause this process can never watch (no pull request exists yet — exit `1`, with the working `vinaya task run` command for this task's own branch to continue by hand — `<tranche> <n>` for a tranche task, `--issue <n>` for a backlog one — never a `dev-review-loop --resume` line naming a pull-request number this pause does not have), a usage/argv error (exit `2`), and any other failure (exit `3`)."
|
|
7158
7390
|
],
|
|
7159
7391
|
status: "shipped"
|
|
7160
7392
|
},
|
|
7161
7393
|
{
|
|
7162
7394
|
name: "task status",
|
|
7163
7395
|
description: "Every open task with a frozen brief, its pull request, and whether its loop is running, paused, or published",
|
|
7164
|
-
flags: [
|
|
7396
|
+
flags: [
|
|
7397
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" },
|
|
7398
|
+
{
|
|
7399
|
+
flag: "--follow",
|
|
7400
|
+
description: "Tail the task's driver log live, with its detail lines, on either the `<tranche> <n>` form or `--issue <n>`"
|
|
7401
|
+
},
|
|
7402
|
+
{ flag: "--quiet", description: "With `--follow`, hide the detail lines; the log file is unchanged" }
|
|
7403
|
+
],
|
|
7165
7404
|
details: [
|
|
7166
7405
|
"Read-only: one `gh issue list` for every open task Issue across every tranche (title/label resolved through the same `resolveTaskIssueRef` `list-tasks.ts` already uses), the open pull request per branch, and the driver pid record / pause record / publish effect markers under `<outboxRoot>/dev-review-loop/<task>/` — never a `ps` scan, never a re-parse of posted verdict comments to decide `published`.",
|
|
7167
7406
|
"`running` names the driver's pid (`review-validity-v1` task 7's pid record); `paused` names the reason from the pause record; `published` means the newest round's reviewer and security verdict effect markers both read `posted`; `no driver` is the fallback when none of the above holds.",
|
|
@@ -7197,6 +7436,26 @@ var COMMANDS = [
|
|
|
7197
7436
|
],
|
|
7198
7437
|
status: "shipped"
|
|
7199
7438
|
},
|
|
7439
|
+
{
|
|
7440
|
+
name: "task-tools result-proof",
|
|
7441
|
+
description: "Prove, live on this host, that a CLI delivers the Developer's turn result as its own structured final output",
|
|
7442
|
+
flags: [{ flag: "--agent <claude|codex>", description: "The CLI to prove" }],
|
|
7443
|
+
details: [
|
|
7444
|
+
"Runs real Developer-shaped dispatches on this host — the driver-run dev-tools registered and called, the agent's own sandbox where the host supports it, the subscription login, and the dispatch's own argv — and asks for the versioned `DeveloperTurnResult` (`completed`, `blocked` or `needs_ruling`) through the CLI's native structured output: Claude Code `--json-schema` under `--output-format stream-json`, with the dispatch's Stop hook plus one that rejects the first stop; Codex `--output-schema` under `exec --json` and `exec resume --json`.",
|
|
7445
|
+
"Cases: a first and a resumed session (the same provider session, a fresh result, exactly one accepted); a schema-valid but semantically invalid result (an unknown finding id, a ruling request naming no permissible decision), which the driver rejects; malformed output, which never reaches the driver; and a cancelled run, a provider error and context exhaustion, each ending with no accepted result. Each case prints whether a schema-valid result reached the driver, the result, and the event it was read from; exits 1 when any case fails. Never publishes, opens a pull request or writes the forge."
|
|
7446
|
+
],
|
|
7447
|
+
status: "shipped"
|
|
7448
|
+
},
|
|
7449
|
+
{
|
|
7450
|
+
name: "task-tools review-result-proof",
|
|
7451
|
+
description: "Prove, live on this host, that a CLI delivers a reviewer's result as its own structured final output, concurrent and fresh",
|
|
7452
|
+
flags: [{ flag: "--agent <claude|codex>", description: "The CLI to prove" }],
|
|
7453
|
+
details: [
|
|
7454
|
+
"Runs real reviewer-shaped dispatches on this host — fresh, non-resumed sessions, the agent's own sandbox where the host supports it, the subscription login, read-only grants, and the staged diff and review-input manifest — and asks for the versioned `ReviewResult` (`completed` or `blocked`, bound to the controller's role, head and manifest digest) through the CLI's native structured output: Claude Code `--json-schema` under `--output-format stream-json`; Codex `--output-schema` under `exec --json`. Both the code-reviewer and the security-reviewer role run, concurrently against one manifest, each accepted result attributed to its own role.",
|
|
7455
|
+
"Cases: a role mismatch, a wrong head and a wrong manifest digest; an objective id outside the brief, a severity outside the role's scale and a finding without a file (all refused) and a finding without a line (accepted); and a blocked, malformed, missing, cancelled, provider-error and context-exhausted outcome, each recorded as no review, never approval. Each case prints whether a schema-valid result reached the driver and what the controller made of it; exits 1 when any case fails. Never writes the forge and leaves the loop's reviewer dispatch and result files untouched."
|
|
7456
|
+
],
|
|
7457
|
+
status: "shipped"
|
|
7458
|
+
},
|
|
7200
7459
|
{
|
|
7201
7460
|
name: "pr create",
|
|
7202
7461
|
description: "Open a pull request after full brief-schema validation",
|
|
@@ -7239,13 +7498,14 @@ var COMMANDS = [
|
|
|
7239
7498
|
},
|
|
7240
7499
|
{
|
|
7241
7500
|
flag: "--push",
|
|
7242
|
-
description: "PR number; splices the same content into that PR's LIVE body (fetched from the forge) and pushes it via `gh pr edit`, self-verifying nothing outside the AEG:EVIDENCE
|
|
7501
|
+
description: "PR number; splices the same content into that PR's LIVE body (fetched from the forge) and pushes it via `gh pr edit`, self-verifying nothing outside the AEG:EVIDENCE region changed. Mutually exclusive with --write."
|
|
7243
7502
|
}
|
|
7244
7503
|
],
|
|
7245
7504
|
details: [
|
|
7246
7505
|
"Two groups: Group A (recomputable) is the head sha and a width-invariant `git diff --numstat` against the merge-base with `BASE_SHA` (else `origin/main`, then `main`) — `check-evidence-fresh` recomputes and byte-compares this exactly. Group B (attested) is the result of `vinaya check --all --diff-only`, this CLI's own portable gate suite — `check-evidence-fresh` can only check it for staleness (the block's recorded head still matches the PR's real head), never re-run it.",
|
|
7247
7506
|
"With no `--write`/`--push`, prints the block to stdout instead of writing a file. Exits non-zero whenever the gate run failed, whether or not `--write`/`--push` was given — the block records a failing result rather than hiding one, and a non-zero exit stops a scripted `--write && open-pr` (or `--push`) from carrying a failing suite onto the forge.",
|
|
7248
|
-
"`--push` refuses before writing anything when the live body carries no real `AEG:EVIDENCE` pair (it never appends one, unlike `--write`), when the anchor resolves differently before and after normalisation, or when `<pr>` isn't a bare number.
|
|
7507
|
+
"`--push` refuses before writing anything when the live body carries no real `AEG:EVIDENCE` pair (it never appends one, unlike `--write`), when the anchor resolves differently before and after normalisation, or when `<pr>` isn't a bare number. After pushing, it re-reads the live body and restores the pre-edit body — exiting non-zero — if anything outside that one anchored region changed.",
|
|
7508
|
+
"A pull-request body carries no token table, and this command writes none: a dispatched turn's token use is recorded as the Vinaya log's own `usage` event instead. A body that still carries an older run's table keeps it byte for byte — it is prose this command does not own, and a change inside it reads as real drift."
|
|
7249
7509
|
],
|
|
7250
7510
|
status: "shipped"
|
|
7251
7511
|
},
|
|
@@ -7270,7 +7530,7 @@ var COMMANDS = [
|
|
|
7270
7530
|
"Deliberately a command, not a check: `evidence-fresh` runs inside `vinaya check --all`, and `pr report` runs `vinaya check --all --diff-only`, so a check that regenerated the block would run the suite containing itself. That recursion is why `evidence-fresh` verifies Group A only and leaves Group B attested.",
|
|
7271
7531
|
"Must be run from the repository ROOT of a CLEAN checkout at the pull request's head, and refuses otherwise. The regeneration inherits the working directory and several gates resolve their scan root from it, so a subdirectory silently narrows what the fresh run inspects. On cleanliness: Group B is regenerated by diff-scoped checks, so uncommitted or untracked files change which files are scanned and can produce a MATCH a clean checkout would not. Ignored paths are deliberately NOT inspected — `git diff` never reports one, so they cannot change the scope, and including them would refuse in every real checkout since `node_modules` is ignored and always present. The head is read from the forge and both a mismatch AND an unreadable head refuse — the verdict is bound to a commit, never merely attested. `BASE_SHA` is refused as well, since it steers the regeneration's merge-base.",
|
|
7272
7532
|
"Exits 0 on MATCH; 1 on DIFFERS, HIDDEN, or no block; 2 on a refusal (dirty worktree, wrong head, usage error). HIDDEN means the anchor pair sits inside a collapsed `<details>` block, where `body-bare-digits` blanks every digit and nothing can verify what it claims.",
|
|
7273
|
-
"Comparison is a multiset of repo-relative, control-stripped lines: absolute paths (local AND foreign, so a block generated in CI compares against one generated on a laptop) and line order are ignored — a reorder is not a fabrication. Only the AEG:EVIDENCE region is read
|
|
7533
|
+
"Comparison is a multiset of repo-relative, control-stripped lines: absolute paths (local AND foreign, so a block generated in CI compares against one generated on a laptop) and line order are ignored — a reorder is not a fabrication. Only the AEG:EVIDENCE region is read: every other section of the body is prose no regeneration reproduces. A moved merge-base is reported ALONGSIDE the differing lines, never instead of them."
|
|
7274
7534
|
],
|
|
7275
7535
|
status: "shipped"
|
|
7276
7536
|
},
|
|
@@ -7441,7 +7701,7 @@ var COMMANDS = [
|
|
|
7441
7701
|
{ flag: "--secrets", description: "security only: the SECRETS line" },
|
|
7442
7702
|
{
|
|
7443
7703
|
flag: "--secrets-evidence-file",
|
|
7444
|
-
description: 'security only: required whenever `--secrets` claims "none found" — the
|
|
7704
|
+
description: 'security only: required whenever `--secrets` claims "none found" — the passing `atta-labs/secret-scan` check result on the judged head that backs it; never run or paste the scanner'
|
|
7445
7705
|
},
|
|
7446
7706
|
{ flag: "--task-id", description: "the closing `Tokens:` line's task id" },
|
|
7447
7707
|
{ flag: "--model", description: "the closing `Tokens:` line's model name" },
|
|
@@ -7549,7 +7809,20 @@ var COMMANDS = [
|
|
|
7549
7809
|
flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
|
|
7550
7810
|
details: [
|
|
7551
7811
|
"Refuses if any task Issue attached to the named tranche is still open, naming each one — closing a tranche with unresolved work is never silently allowed.",
|
|
7552
|
-
"Once every task Issue is closed, prompts for confirmation (unless `--yes`) and closes
|
|
7812
|
+
"Once every task Issue is closed, prompts for confirmation (unless `--yes`), records the tranche's retrospective in the Milestone its task Issues are attached to, and closes that Milestone once nothing else in it is still open.",
|
|
7813
|
+
"A tranche none of whose task Issues carry a Milestone gets one: a Milestone titled with the tranche's slug is created, the tranche's closed task Issues are attached to it, the retrospective is recorded, and it is closed — so the tranche reads as archived. An Issue already on a Milestone is never moved.",
|
|
7814
|
+
"Idempotent: on a tranche whose Milestone is already closed and carries its retrospective, changes nothing and says it is already archived.",
|
|
7815
|
+
"The generated `vinaya-archivist.yml` workflow runs it after a task pull request merges, and again when an Issue labeled with the tranche closes without a merge (dropped, replaced or closed by hand) — the tranche's slug read from that Issue's own label."
|
|
7816
|
+
],
|
|
7817
|
+
status: "shipped"
|
|
7818
|
+
},
|
|
7819
|
+
{
|
|
7820
|
+
name: "archive tranches",
|
|
7821
|
+
description: "Archive every finished tranche that has no closed Milestone carrying its retrospective",
|
|
7822
|
+
flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
|
|
7823
|
+
details: [
|
|
7824
|
+
"Walks every `vinaya/tranche:<slug>` label, skips each tranche that still has an open task Issue, and runs `archive tranche` for each finished one whose Milestone is not already closed with its retrospective. One tranche failing does not stop the others; the exit code reports it.",
|
|
7825
|
+
"The generated `vinaya-archivist.yml` workflow calls it on its daily scheduled run, so a tranche that finished before the workflow could see it is archived within a day. Running it again when every finished tranche is archived changes nothing and says so."
|
|
7553
7826
|
],
|
|
7554
7827
|
status: "shipped"
|
|
7555
7828
|
},
|
|
@@ -7693,6 +7966,29 @@ var COMMANDS = [
|
|
|
7693
7966
|
],
|
|
7694
7967
|
status: "shipped"
|
|
7695
7968
|
},
|
|
7969
|
+
{
|
|
7970
|
+
name: "log selftest",
|
|
7971
|
+
description: "Prove log delivery works end to end: send one marked test event and read it back — PASS (exit 0) or FAIL with the one reason (exit 1)",
|
|
7972
|
+
details: [
|
|
7973
|
+
"Resolves the destination exactly as an UNATTENDED review-loop run does in this repository — the same trust-anchor read and credential lookup, forced unattended so running it by hand proves the launch path's own resolution, not a human's. It sends one test event to the configured `logs.url` server, then reads it back from the server by the event's own id through the server's cursor read.",
|
|
7974
|
+
"PASS (exit 0) only when the event round-trips. Otherwise FAIL (exit 1) with the ONE reason that stopped it: no server is configured, the default branch's config could not be read to confirm the url (and why), this host holds no ingest or read credential, the server refused with its status, or the event could not be read back. It never prints a credential value.",
|
|
7975
|
+
"The read-back needs a READ credential distinct from the write-only ingest one the server refuses on a read route: set `logs.readHeaders` in vinaya.config.json to the server's read token (referenced by variable name, resolved from the environment exactly as `logs.headers` is). The test event is marked `operation: 'log.selftest'` so a reader can exclude it from real telemetry."
|
|
7976
|
+
],
|
|
7977
|
+
status: "shipped"
|
|
7978
|
+
},
|
|
7979
|
+
{
|
|
7980
|
+
name: "log emit",
|
|
7981
|
+
description: "Record a consumer-declared event (`logs.events` in vinaya.config.json) from a script or agent outside Vinaya",
|
|
7982
|
+
flags: [
|
|
7983
|
+
{ flag: "--json '<json>'", description: "The field values as one JSON object (else read from standard input)" }
|
|
7984
|
+
],
|
|
7985
|
+
details: [
|
|
7986
|
+
"Reads the field values as ONE JSON object — `--json '<json>'` or piped on standard input, never positional arguments — and records them through `emitCustomEvent`, the same chokepoint every custom event goes through, so the refusal event and the redaction stay in one place.",
|
|
7987
|
+
"A declared event with every field present and of its declared type exits 0 and prints the event name and the kind of destination it was recorded toward (`folder`, `server`, or `none`) — never a field value. A refused event (an undeclared name, or a missing, extra, wrong-typed or too-long field) exits 1 and prints the reason class and the field names — never a value, since a rejected value may be the secret. A missing event name, unreadable JSON, or JSON that is not a flat object is a usage error: exit 2, before anything is recorded.",
|
|
7988
|
+
"A process with only `VINAYA_WORK_REF` and `VINAYA_FLOW` set, and no Vinaya role or task, still gets a header carrying that work reference and way-of-working id — the same environment read every event already honours (`apps/cli/specs/log.md` § Attribution)."
|
|
7989
|
+
],
|
|
7990
|
+
status: "shipped"
|
|
7991
|
+
},
|
|
7696
7992
|
{
|
|
7697
7993
|
name: "log send",
|
|
7698
7994
|
description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
|
|
@@ -7705,12 +8001,19 @@ var COMMANDS = [
|
|
|
7705
8001
|
status: "shipped"
|
|
7706
8002
|
},
|
|
7707
8003
|
{
|
|
7708
|
-
name: "
|
|
7709
|
-
description: "
|
|
8004
|
+
name: "sync",
|
|
8005
|
+
description: "Fill, resume and rebuild the local log cache from this repository's configured destination (read-only)",
|
|
8006
|
+
flags: [
|
|
8007
|
+
{
|
|
8008
|
+
flag: "--rebuild",
|
|
8009
|
+
description: "Delete the cache file and sync from the beginning of what the destination still retains"
|
|
8010
|
+
},
|
|
8011
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
8012
|
+
],
|
|
7710
8013
|
details: [
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
"
|
|
8014
|
+
"Resolves the destination exactly the way a normal event does — the sink's own decision over `vinaya.config.json`'s `logs` setting, trust-anchor-gated for an unattended caller — then reads a folder destination through the folder source or a server destination through the server source (with the configured `logs.readHeaders`, substituted from the environment), and runs the bounded sync engine against the durable cache this repository holds under its runtime directory. Prints pages read, rows stored, duplicates, edits, deletions, gaps, quarantined lines and, for a server destination, its lost-event diagnostic. Reads the destination and writes only its own cache directory — never the folder, the server, or the forge.",
|
|
8015
|
+
"Exits 0 when the run completed or stopped cleanly on its page bound (and says more is available), 1 when it failed part way (the progress made is kept — a second run resumes from the stored cursor), and 2 for a usage or configuration problem: no destination is configured, or a server destination is configured with no usable read credential. A missing credential names the environment variable to set and never prints its value.",
|
|
8016
|
+
"`--rebuild` deletes the cache file ALONE — never anything else under the cache directory — and syncs again from the beginning of what the destination still retains; an event already rotated out of a folder's single backup slot, or no longer retained by the destination, cannot be recovered and shows up as a gap, never silently."
|
|
7714
8017
|
],
|
|
7715
8018
|
status: "shipped"
|
|
7716
8019
|
}
|
|
@@ -7724,13 +8027,13 @@ function createForgeSource(config) {
|
|
|
7724
8027
|
};
|
|
7725
8028
|
}
|
|
7726
8029
|
// ../../packages/sources/src/select-source.ts
|
|
7727
|
-
import { z as
|
|
7728
|
-
var StateSourceConfigSchema =
|
|
7729
|
-
|
|
7730
|
-
|
|
8030
|
+
import { z as z6 } from "zod";
|
|
8031
|
+
var StateSourceConfigSchema = z6.discriminatedUnion("kind", [
|
|
8032
|
+
z6.object({ kind: z6.literal("forge"), owner: z6.string(), repo: z6.string() }),
|
|
8033
|
+
z6.object({ kind: z6.literal("file"), root: z6.string().optional() })
|
|
7731
8034
|
]);
|
|
7732
8035
|
// src/checks/edge-resolve.ts
|
|
7733
|
-
import { execFileSync as
|
|
8036
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
7734
8037
|
var DIRECT_ISSUE_REF = /#(\d+)/;
|
|
7735
8038
|
var issueCache = new Map;
|
|
7736
8039
|
function fetchIssueState(num, repo) {
|
|
@@ -7739,7 +8042,7 @@ function fetchIssueState(num, repo) {
|
|
|
7739
8042
|
return issueCache.get(key) ?? null;
|
|
7740
8043
|
let out = null;
|
|
7741
8044
|
try {
|
|
7742
|
-
const raw =
|
|
8045
|
+
const raw = execFileSync3("gh", [
|
|
7743
8046
|
"issue",
|
|
7744
8047
|
"view",
|
|
7745
8048
|
String(num),
|
|
@@ -7865,17 +8168,26 @@ function packageRoot(moduleUrl) {
|
|
|
7865
8168
|
}
|
|
7866
8169
|
|
|
7867
8170
|
// src/commands/doctrine.ts
|
|
7868
|
-
import { execFileSync as
|
|
8171
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
7869
8172
|
import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync3 } from "node:fs";
|
|
7870
8173
|
import { dirname as dirname3, join as join3, sep } from "node:path";
|
|
8174
|
+
import matter4 from "gray-matter";
|
|
8175
|
+
|
|
8176
|
+
// ../../packages/aeg-core/src/docs/parse-doc.ts
|
|
7871
8177
|
import matter2 from "gray-matter";
|
|
8178
|
+
// ../../packages/aeg-core/src/docs/surfaced-manifest.ts
|
|
8179
|
+
var NO_MODEL_BACKED_PATHS = new Set;
|
|
8180
|
+
// src/roles/contract.ts
|
|
8181
|
+
import matter3 from "gray-matter";
|
|
8182
|
+
|
|
8183
|
+
// src/commands/doctrine.ts
|
|
7872
8184
|
var ENTRY_SEGMENTS = ["skills", "aeg", "SKILL.md"];
|
|
7873
8185
|
function resolveDoctrineRoot(pkg = packageRoot(import.meta.url), cwd = process.cwd()) {
|
|
7874
8186
|
return resolveDoctrineRootInfo(pkg, cwd)?.root ?? null;
|
|
7875
8187
|
}
|
|
7876
8188
|
function gitToplevel(cwd) {
|
|
7877
8189
|
try {
|
|
7878
|
-
return
|
|
8190
|
+
return execFileSync4("git", ["-C", cwd, "rev-parse", "--show-toplevel"], {
|
|
7879
8191
|
encoding: "utf8",
|
|
7880
8192
|
stdio: ["ignore", "pipe", "pipe"]
|
|
7881
8193
|
}).trim();
|
|
@@ -7904,7 +8216,7 @@ var PACKAGED_TEMPLATE_PATH = join4(PACKAGE_ROOT, "aeg-root", "templates", "brief
|
|
|
7904
8216
|
var TEMPLATE_PATH = existsSync4(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH : join4(PACKAGE_ROOT, "..", "..", "aeg-root", "templates", "brief-template.md");
|
|
7905
8217
|
function git(args) {
|
|
7906
8218
|
try {
|
|
7907
|
-
return
|
|
8219
|
+
return execFileSync5("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
7908
8220
|
} catch {
|
|
7909
8221
|
return "";
|
|
7910
8222
|
}
|
|
@@ -7917,12 +8229,16 @@ function expandGlob(glob) {
|
|
|
7917
8229
|
var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
7918
8230
|
|
|
7919
8231
|
// src/checks/registry.ts
|
|
7920
|
-
import {
|
|
7921
|
-
import {
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
8232
|
+
import { join as join5, relative, sep as sep2 } from "node:path";
|
|
8233
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8234
|
+
function resolveCheckBin(packageDir, moduleUrl) {
|
|
8235
|
+
const fromPackage = relative(packageDir, fileURLToPath2(moduleUrl));
|
|
8236
|
+
const bundled = fromPackage === "dist" || fromPackage.startsWith(`dist${sep2}`);
|
|
8237
|
+
return bundled ? { dir: join5(packageDir, "dist", "checks", "bin"), ext: ".js" } : { dir: join5(packageDir, "src", "checks", "bin"), ext: ".ts" };
|
|
8238
|
+
}
|
|
8239
|
+
var CHECK_BIN = resolveCheckBin(packageRoot(import.meta.url), import.meta.url);
|
|
8240
|
+
var BIN_DIR = CHECK_BIN.dir;
|
|
8241
|
+
var BIN_EXT = CHECK_BIN.ext;
|
|
7926
8242
|
function bin(name) {
|
|
7927
8243
|
return join5(BIN_DIR, `${name}${BIN_EXT}`);
|
|
7928
8244
|
}
|
|
@@ -7966,6 +8282,8 @@ var REGISTRY = [
|
|
|
7966
8282
|
timeoutMs: 15000,
|
|
7967
8283
|
env: {
|
|
7968
8284
|
BASE_SHA: { optional: true },
|
|
8285
|
+
GIT_INDEX_FILE: { optional: true },
|
|
8286
|
+
VINAYA_COMMIT_HOOK: { optional: true },
|
|
7969
8287
|
PR_BODY: { optional: true },
|
|
7970
8288
|
PR_BODY_FILE: { optional: true },
|
|
7971
8289
|
PR_NUMBER: { optional: true },
|
|
@@ -8120,23 +8438,6 @@ var REGISTRY = [
|
|
|
8120
8438
|
},
|
|
8121
8439
|
1
|
|
8122
8440
|
],
|
|
8123
|
-
[
|
|
8124
|
-
{
|
|
8125
|
-
name: "token-report",
|
|
8126
|
-
validates: "body",
|
|
8127
|
-
run: bin("check-token-report"),
|
|
8128
|
-
scope: "diff",
|
|
8129
|
-
timeoutMs: 15000,
|
|
8130
|
-
requiresOpenPr: true,
|
|
8131
|
-
env: {
|
|
8132
|
-
PR_BODY: { optional: true },
|
|
8133
|
-
BRANCH: { optional: true },
|
|
8134
|
-
CLAUDE_PROJECT_DIR: { optional: true },
|
|
8135
|
-
CLAUDE_CODE_SESSION_ID: { optional: true }
|
|
8136
|
-
}
|
|
8137
|
-
},
|
|
8138
|
-
1
|
|
8139
|
-
],
|
|
8140
8441
|
[
|
|
8141
8442
|
{
|
|
8142
8443
|
name: "no-disk-state",
|
|
@@ -8486,23 +8787,35 @@ var CORE_CHECK_RING = Object.fromEntries(REGISTRY.map(([spec, ring]) => [spec.na
|
|
|
8486
8787
|
import { execFile as execFile5 } from "node:child_process";
|
|
8487
8788
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
8488
8789
|
import {
|
|
8489
|
-
|
|
8490
|
-
|
|
8790
|
+
appendFileSync,
|
|
8791
|
+
closeSync as closeSync4,
|
|
8792
|
+
constants as fsConstants4,
|
|
8491
8793
|
existsSync as existsSync7,
|
|
8492
|
-
fstatSync as
|
|
8493
|
-
mkdirSync as
|
|
8494
|
-
|
|
8495
|
-
|
|
8794
|
+
fstatSync as fstatSync3,
|
|
8795
|
+
mkdirSync as mkdirSync4,
|
|
8796
|
+
lstatSync as lstatSync2,
|
|
8797
|
+
openSync as openSync4,
|
|
8798
|
+
readFileSync as readFileSync7,
|
|
8496
8799
|
renameSync as renameSync2,
|
|
8497
|
-
|
|
8800
|
+
writeFileSync as writeFileSync3,
|
|
8801
|
+
writeSync as writeSync3
|
|
8498
8802
|
} from "node:fs";
|
|
8499
8803
|
import { hostname as osHostname, homedir as homedir3 } from "node:os";
|
|
8500
|
-
import { dirname as
|
|
8804
|
+
import { dirname as dirname7, join as join8 } from "node:path";
|
|
8501
8805
|
import { promisify as promisify5 } from "node:util";
|
|
8502
8806
|
|
|
8503
8807
|
// src/lib/run-paths.ts
|
|
8504
|
-
import {
|
|
8808
|
+
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
8809
|
+
import { chmodSync, existsSync as existsSync5, realpathSync as realpathSync2 } from "node:fs";
|
|
8505
8810
|
import { dirname as dirname4, join as join6, resolve as resolvePath } from "node:path";
|
|
8811
|
+
var TASKS_EXECUTION_DIRNAME = "tasks-execution";
|
|
8812
|
+
var RUN_AREA_DIRNAMES = {
|
|
8813
|
+
control: CONTROL_AREA_DIRNAME,
|
|
8814
|
+
sessions: "sessions",
|
|
8815
|
+
hooks: "hooks",
|
|
8816
|
+
output: "output",
|
|
8817
|
+
rounds: "rounds"
|
|
8818
|
+
};
|
|
8506
8819
|
var SAFE_PATH_SEGMENT = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
8507
8820
|
function isSafeRepoSegment(segment) {
|
|
8508
8821
|
return SAFE_PATH_SEGMENT.test(segment) && !segment.includes("..");
|
|
@@ -8533,12 +8846,52 @@ function isInsideRepo(candidate, repoRoot) {
|
|
|
8533
8846
|
const target = resolvePath(candidate);
|
|
8534
8847
|
return target === root || target.startsWith(`${root}/`);
|
|
8535
8848
|
}
|
|
8849
|
+
function runPath(runtimeDir, scope, location) {
|
|
8850
|
+
const dir = join6(runtimeDir, TASKS_EXECUTION_DIRNAME, scopeSegment(scope));
|
|
8851
|
+
switch (location.area) {
|
|
8852
|
+
case "task":
|
|
8853
|
+
return location.file ? join6(dir, location.file) : dir;
|
|
8854
|
+
case "control": {
|
|
8855
|
+
const controlDir = join6(dir, RUN_AREA_DIRNAMES.control);
|
|
8856
|
+
return location.file ? join6(controlDir, location.file) : controlDir;
|
|
8857
|
+
}
|
|
8858
|
+
case "rounds":
|
|
8859
|
+
return join6(dir, RUN_AREA_DIRNAMES.rounds);
|
|
8860
|
+
case "round": {
|
|
8861
|
+
const roundDir = join6(dir, RUN_AREA_DIRNAMES.rounds, String(location.round));
|
|
8862
|
+
return location.file ? join6(roundDir, location.file) : roundDir;
|
|
8863
|
+
}
|
|
8864
|
+
case "developer": {
|
|
8865
|
+
const developerDir = join6(dir, RUN_AREA_DIRNAMES.rounds, String(location.round), "developer");
|
|
8866
|
+
return location.file ? join6(developerDir, location.file) : developerDir;
|
|
8867
|
+
}
|
|
8868
|
+
default: {
|
|
8869
|
+
const areaDir = join6(dir, RUN_AREA_DIRNAMES[location.area]);
|
|
8870
|
+
return location.file ? join6(areaDir, location.file) : areaDir;
|
|
8871
|
+
}
|
|
8872
|
+
}
|
|
8873
|
+
}
|
|
8874
|
+
function scopeSegment(scope) {
|
|
8875
|
+
if (scope === "unscoped")
|
|
8876
|
+
return "unscoped";
|
|
8877
|
+
if (typeof scope === "number")
|
|
8878
|
+
return String(scope);
|
|
8879
|
+
return `pr-${scope.pr}`;
|
|
8880
|
+
}
|
|
8536
8881
|
var UNATTENDED_ENV_KEY = "VINAYA_UNATTENDED";
|
|
8537
8882
|
var RUNTIME_DIR_ENV_KEY = "VINAYA_RUNTIME_DIR";
|
|
8538
8883
|
function isUnattendedProcess(env = process.env) {
|
|
8539
8884
|
return env[UNATTENDED_ENV_KEY] === "1" || (env.VINAYA_ROLE ?? "") !== "";
|
|
8540
8885
|
}
|
|
8541
8886
|
var memoized = null;
|
|
8887
|
+
function runtimeDirForRepo(repo) {
|
|
8888
|
+
const key = repoSegment(repo);
|
|
8889
|
+
if (memoized?.key === key)
|
|
8890
|
+
return memoized.value;
|
|
8891
|
+
const value = resolveRuntimeDirUncached(repo);
|
|
8892
|
+
memoized = { key, value };
|
|
8893
|
+
return value;
|
|
8894
|
+
}
|
|
8542
8895
|
async function runtimeDirForRepoAsync(repo) {
|
|
8543
8896
|
const key = repoSegment(repo);
|
|
8544
8897
|
if (memoized?.key === key)
|
|
@@ -8554,6 +8907,16 @@ async function runtimeDirForRepoAsync(repo) {
|
|
|
8554
8907
|
memoized = { key, value };
|
|
8555
8908
|
return value;
|
|
8556
8909
|
}
|
|
8910
|
+
function resolveRuntimeDirUncached(repo) {
|
|
8911
|
+
const inputs = runtimeDirInputs();
|
|
8912
|
+
if (typeof inputs === "string")
|
|
8913
|
+
return inputs;
|
|
8914
|
+
return resolveRuntimeDir({
|
|
8915
|
+
repo,
|
|
8916
|
+
...inputs.base,
|
|
8917
|
+
trustAnchorConfig: inputs.needsAnchor ? loadTrustAnchorConfig() : null
|
|
8918
|
+
});
|
|
8919
|
+
}
|
|
8557
8920
|
function runtimeDirInputs() {
|
|
8558
8921
|
const handedDown = process.env[RUNTIME_DIR_ENV_KEY];
|
|
8559
8922
|
if (handedDown)
|
|
@@ -8573,7 +8936,7 @@ function repoRootSync(start = process.cwd()) {
|
|
|
8573
8936
|
return null;
|
|
8574
8937
|
}
|
|
8575
8938
|
for (;; ) {
|
|
8576
|
-
if (
|
|
8939
|
+
if (existsSync5(join6(dir, ".git")))
|
|
8577
8940
|
return dir;
|
|
8578
8941
|
const parent = dirname4(dir);
|
|
8579
8942
|
if (parent === dir)
|
|
@@ -8581,26 +8944,94 @@ function repoRootSync(start = process.cwd()) {
|
|
|
8581
8944
|
dir = parent;
|
|
8582
8945
|
}
|
|
8583
8946
|
}
|
|
8947
|
+
function resolveRepoSync() {
|
|
8948
|
+
const fromEnv = process.env.AEG_REPO;
|
|
8949
|
+
if (fromEnv) {
|
|
8950
|
+
const m = /^([^/]+)\/(.+)$/.exec(fromEnv);
|
|
8951
|
+
if (m?.[1] && m[2])
|
|
8952
|
+
return { owner: m[1], repo: m[2] };
|
|
8953
|
+
}
|
|
8954
|
+
let url;
|
|
8955
|
+
try {
|
|
8956
|
+
url = execFileSync6("git", ["remote", "get-url", "origin"], {
|
|
8957
|
+
encoding: "utf-8",
|
|
8958
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
8959
|
+
}).trim();
|
|
8960
|
+
} catch {
|
|
8961
|
+
return null;
|
|
8962
|
+
}
|
|
8963
|
+
const ssh = /^git@github\.com:([^/]+)\/(.+?)(?:\.git)?$/.exec(url);
|
|
8964
|
+
if (ssh?.[1] && ssh[2])
|
|
8965
|
+
return { owner: ssh[1], repo: ssh[2] };
|
|
8966
|
+
const https = /^https?:\/\/(?:[^@]+@)?github\.com\/([^/]+)\/(.+?)(?:\.git)?\/?$/.exec(url);
|
|
8967
|
+
if (https?.[1] && https[2])
|
|
8968
|
+
return { owner: https[1], repo: https[2] };
|
|
8969
|
+
return null;
|
|
8970
|
+
}
|
|
8971
|
+
var memoizedThisRepo = null;
|
|
8972
|
+
function runtimeDirForThisRepo() {
|
|
8973
|
+
if (memoizedThisRepo !== null)
|
|
8974
|
+
return memoizedThisRepo;
|
|
8975
|
+
memoizedThisRepo = runtimeDirForRepo(resolveRepoSync());
|
|
8976
|
+
return memoizedThisRepo;
|
|
8977
|
+
}
|
|
8584
8978
|
|
|
8585
|
-
// src/lib/log
|
|
8979
|
+
// src/lib/loop-log.ts
|
|
8586
8980
|
import {
|
|
8587
8981
|
closeSync as closeSync2,
|
|
8588
8982
|
constants as fsConstants2,
|
|
8589
|
-
|
|
8983
|
+
existsSync as existsSync6,
|
|
8984
|
+
fstatSync as fstatSync2,
|
|
8590
8985
|
mkdirSync as mkdirSync2,
|
|
8591
8986
|
openSync as openSync2,
|
|
8592
|
-
linkSync,
|
|
8593
8987
|
readFileSync as readFileSync5,
|
|
8594
|
-
|
|
8988
|
+
readSync,
|
|
8595
8989
|
statSync,
|
|
8990
|
+
writeSync
|
|
8991
|
+
} from "node:fs";
|
|
8992
|
+
import { dirname as dirname5 } from "node:path";
|
|
8993
|
+
function loopsRoot() {
|
|
8994
|
+
return runtimeDirForThisRepo();
|
|
8995
|
+
}
|
|
8996
|
+
function loopLogPathFor(_repo, issue, root = loopsRoot()) {
|
|
8997
|
+
return runPath(root, issue, { area: "output", file: "driver.log" });
|
|
8998
|
+
}
|
|
8999
|
+
var LOOP_LOG_MAX_BYTES = 8 * 1024 * 1024;
|
|
9000
|
+
function appendLoopLogLine(path, line) {
|
|
9001
|
+
try {
|
|
9002
|
+
mkdirSync2(dirname5(path), { recursive: true, mode: 448 });
|
|
9003
|
+
const fd = openSync2(path, fsConstants2.O_WRONLY | fsConstants2.O_APPEND | fsConstants2.O_CREAT | fsConstants2.O_NOFOLLOW, 384);
|
|
9004
|
+
try {
|
|
9005
|
+
const stat = fstatSync2(fd);
|
|
9006
|
+
if (stat.isFile() && stat.size < LOOP_LOG_MAX_BYTES) {
|
|
9007
|
+
writeSync(fd, `${line}
|
|
9008
|
+
`);
|
|
9009
|
+
}
|
|
9010
|
+
} finally {
|
|
9011
|
+
closeSync2(fd);
|
|
9012
|
+
}
|
|
9013
|
+
} catch {}
|
|
9014
|
+
}
|
|
9015
|
+
|
|
9016
|
+
// src/lib/log-webhook-drain.ts
|
|
9017
|
+
import {
|
|
9018
|
+
closeSync as closeSync3,
|
|
9019
|
+
constants as fsConstants3,
|
|
9020
|
+
lstatSync,
|
|
9021
|
+
mkdirSync as mkdirSync3,
|
|
9022
|
+
openSync as openSync3,
|
|
9023
|
+
linkSync,
|
|
9024
|
+
readFileSync as readFileSync6,
|
|
9025
|
+
renameSync,
|
|
9026
|
+
statSync as statSync2,
|
|
8596
9027
|
unlinkSync,
|
|
8597
9028
|
utimesSync,
|
|
8598
9029
|
writeFileSync as writeFileSync2,
|
|
8599
|
-
writeSync
|
|
9030
|
+
writeSync as writeSync2
|
|
8600
9031
|
} from "node:fs";
|
|
8601
9032
|
import { randomUUID } from "node:crypto";
|
|
8602
9033
|
import { homedir as homedir2 } from "node:os";
|
|
8603
|
-
import { dirname as
|
|
9034
|
+
import { dirname as dirname6, join as join7 } from "node:path";
|
|
8604
9035
|
var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
|
|
8605
9036
|
var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
|
|
8606
9037
|
var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
@@ -8616,13 +9047,13 @@ function isEnoent(err) {
|
|
|
8616
9047
|
var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
|
|
8617
9048
|
function tryCreateLock(lockPath, token) {
|
|
8618
9049
|
try {
|
|
8619
|
-
|
|
8620
|
-
const fd =
|
|
9050
|
+
mkdirSync3(dirname6(lockPath), { recursive: true, mode: 448 });
|
|
9051
|
+
const fd = openSync3(lockPath, fsConstants3.O_WRONLY | fsConstants3.O_CREAT | fsConstants3.O_EXCL, 384);
|
|
8621
9052
|
try {
|
|
8622
|
-
|
|
9053
|
+
writeSync2(fd, `${token}
|
|
8623
9054
|
`);
|
|
8624
9055
|
} finally {
|
|
8625
|
-
|
|
9056
|
+
closeSync3(fd);
|
|
8626
9057
|
}
|
|
8627
9058
|
return true;
|
|
8628
9059
|
} catch (err) {
|
|
@@ -8637,7 +9068,7 @@ function acquireDrainLock(lockPath) {
|
|
|
8637
9068
|
return token;
|
|
8638
9069
|
let observedMtimeMs;
|
|
8639
9070
|
try {
|
|
8640
|
-
observedMtimeMs =
|
|
9071
|
+
observedMtimeMs = statSync2(lockPath).mtimeMs;
|
|
8641
9072
|
} catch (err) {
|
|
8642
9073
|
if (!isEnoent(err))
|
|
8643
9074
|
throw err;
|
|
@@ -8655,7 +9086,7 @@ function acquireDrainLock(lockPath) {
|
|
|
8655
9086
|
}
|
|
8656
9087
|
let claimedMtimeMs = null;
|
|
8657
9088
|
try {
|
|
8658
|
-
claimedMtimeMs =
|
|
9089
|
+
claimedMtimeMs = statSync2(claimed).mtimeMs;
|
|
8659
9090
|
} catch (err) {
|
|
8660
9091
|
if (!isEnoent(err))
|
|
8661
9092
|
throw err;
|
|
@@ -8681,7 +9112,7 @@ function acquireDrainLock(lockPath) {
|
|
|
8681
9112
|
function renewDrainLock(lockPath, token) {
|
|
8682
9113
|
let holder;
|
|
8683
9114
|
try {
|
|
8684
|
-
holder =
|
|
9115
|
+
holder = readFileSync6(lockPath, "utf8").trim();
|
|
8685
9116
|
} catch (err) {
|
|
8686
9117
|
if (!isEnoent(err))
|
|
8687
9118
|
throw err;
|
|
@@ -8701,7 +9132,7 @@ function renewDrainLock(lockPath, token) {
|
|
|
8701
9132
|
}
|
|
8702
9133
|
function releaseDrainLock(lockPath, token) {
|
|
8703
9134
|
try {
|
|
8704
|
-
const holder =
|
|
9135
|
+
const holder = readFileSync6(lockPath, "utf8").trim();
|
|
8705
9136
|
if (holder !== token)
|
|
8706
9137
|
return;
|
|
8707
9138
|
unlinkSync(lockPath);
|
|
@@ -8751,7 +9182,7 @@ function queueLines(buf) {
|
|
|
8751
9182
|
return lines;
|
|
8752
9183
|
}
|
|
8753
9184
|
function removeQueueHead(path, cut) {
|
|
8754
|
-
const remaining =
|
|
9185
|
+
const remaining = readFileSync6(path);
|
|
8755
9186
|
writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
|
|
8756
9187
|
}
|
|
8757
9188
|
function queueBucketSize(path) {
|
|
@@ -8772,7 +9203,7 @@ function queueBucketSize(path) {
|
|
|
8772
9203
|
function readQueueFile(path) {
|
|
8773
9204
|
if (queueBucketSize(path) === null)
|
|
8774
9205
|
return null;
|
|
8775
|
-
return
|
|
9206
|
+
return readFileSync6(path);
|
|
8776
9207
|
}
|
|
8777
9208
|
function rejectLine(rejectedPath, reason, status, identity, raw) {
|
|
8778
9209
|
const record = JSON.stringify({
|
|
@@ -8954,13 +9385,19 @@ function logsCredentialMissing(headers, env) {
|
|
|
8954
9385
|
const varPattern = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
|
|
8955
9386
|
for (const value of Object.values(headers)) {
|
|
8956
9387
|
for (const match of value.matchAll(varPattern)) {
|
|
8957
|
-
|
|
8958
|
-
|
|
9388
|
+
const name = match[1];
|
|
9389
|
+
if (env[name])
|
|
9390
|
+
continue;
|
|
9391
|
+
return true;
|
|
8959
9392
|
}
|
|
8960
9393
|
}
|
|
8961
9394
|
return false;
|
|
8962
9395
|
}
|
|
8963
9396
|
function resolveLogDestinationFrom(input) {
|
|
9397
|
+
const spoolDir = input.env.VINAYA_LOG_SPOOL_DIR;
|
|
9398
|
+
if (spoolDir !== undefined && spoolDir.trim() !== "") {
|
|
9399
|
+
return { kind: "folder", folder: spoolDir };
|
|
9400
|
+
}
|
|
8964
9401
|
const local = resolveLogsSetting(input.localConfig);
|
|
8965
9402
|
let effective = null;
|
|
8966
9403
|
let fallbackReason;
|
|
@@ -9000,24 +9437,73 @@ function resolveLogDestinationFrom(input) {
|
|
|
9000
9437
|
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
9001
9438
|
return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
|
|
9002
9439
|
}
|
|
9003
|
-
var
|
|
9004
|
-
function processTrustAnchor() {
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9440
|
+
var processTrustAnchorByRepo = new Map;
|
|
9441
|
+
function processTrustAnchor(repoRoot) {
|
|
9442
|
+
const cached = processTrustAnchorByRepo.get(repoRoot);
|
|
9443
|
+
if (cached !== undefined)
|
|
9444
|
+
return cached;
|
|
9445
|
+
const reading = safeLoadTrustAnchorConfig();
|
|
9446
|
+
processTrustAnchorByRepo.set(repoRoot, reading);
|
|
9447
|
+
return reading;
|
|
9008
9448
|
}
|
|
9009
9449
|
async function defaultResolveLogDestination(repo, env) {
|
|
9010
9450
|
const localConfig = loadConfig();
|
|
9011
9451
|
const unattended = isUnattendedProcess(process.env);
|
|
9452
|
+
const repoRoot = repoRootSync();
|
|
9012
9453
|
return resolveLogDestinationFrom({
|
|
9013
9454
|
localConfig,
|
|
9014
|
-
trustAnchorConfig: unattended ? await processTrustAnchor() : null,
|
|
9455
|
+
trustAnchorConfig: unattended ? await processTrustAnchor(repoRoot) : null,
|
|
9015
9456
|
unattended,
|
|
9016
9457
|
env,
|
|
9017
9458
|
defaultFolder: join8(await runtimeDirForRepoAsync(repo), "logs"),
|
|
9018
|
-
repoRoot
|
|
9459
|
+
repoRoot
|
|
9019
9460
|
});
|
|
9020
9461
|
}
|
|
9462
|
+
function unresolvedLogDestination(env) {
|
|
9463
|
+
if (hostFromEnv(env) === "ci") {
|
|
9464
|
+
return {
|
|
9465
|
+
kind: "none",
|
|
9466
|
+
reason: "the process ended before its log destination was resolved, and a CI job never records to a folder"
|
|
9467
|
+
};
|
|
9468
|
+
}
|
|
9469
|
+
const loaded = loadConfig();
|
|
9470
|
+
const localConfig = loaded?.logs?.url !== undefined ? { ...loaded, logs: undefined } : loaded;
|
|
9471
|
+
const unattended = isUnattendedProcess(process.env);
|
|
9472
|
+
const repoRoot = repoRootSync();
|
|
9473
|
+
const runtimeDir = process.env[RUNTIME_DIR_ENV_KEY] || resolveRuntimeDir({ repo: null, localConfig, trustAnchorConfig: null, unattended, repoRoot });
|
|
9474
|
+
const defaultFolder = join8(runtimeDir, "logs");
|
|
9475
|
+
const resolved = resolveLogDestinationFrom({
|
|
9476
|
+
localConfig,
|
|
9477
|
+
trustAnchorConfig: null,
|
|
9478
|
+
unattended,
|
|
9479
|
+
env,
|
|
9480
|
+
defaultFolder,
|
|
9481
|
+
repoRoot
|
|
9482
|
+
});
|
|
9483
|
+
return resolved.kind === "folder" ? resolved : { kind: "folder", folder: defaultFolder };
|
|
9484
|
+
}
|
|
9485
|
+
function folderFallbackStatePath(repo, stateRoot = GLOBAL_VINAYA_HOME) {
|
|
9486
|
+
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
9487
|
+
return join8(stateRoot, "fallback", `${dirName}.json`);
|
|
9488
|
+
}
|
|
9489
|
+
function recordFolderFallback(repo, issue, reason, now, runtimeDir, stateRoot = GLOBAL_VINAYA_HOME) {
|
|
9490
|
+
const message = describeFolderFallback(reason);
|
|
9491
|
+
if (issue !== null) {
|
|
9492
|
+
appendLoopLogLine(loopLogPathFor(repo, issue, runtimeDir), `[log] ${message}`);
|
|
9493
|
+
}
|
|
9494
|
+
try {
|
|
9495
|
+
const record = {
|
|
9496
|
+
at: now.toISOString(),
|
|
9497
|
+
reason: message,
|
|
9498
|
+
intendedUrl: reason.intendedUrl,
|
|
9499
|
+
kind: reason.kind
|
|
9500
|
+
};
|
|
9501
|
+
const path = folderFallbackStatePath(repo, stateRoot);
|
|
9502
|
+
mkdirSync4(dirname7(path), { recursive: true, mode: 448 });
|
|
9503
|
+
writeFileSync3(path, `${JSON.stringify(record)}
|
|
9504
|
+
`, { mode: 384 });
|
|
9505
|
+
} catch {}
|
|
9506
|
+
}
|
|
9021
9507
|
function isEnoent2(err) {
|
|
9022
9508
|
return typeof err === "object" && err !== null && err.code === "ENOENT";
|
|
9023
9509
|
}
|
|
@@ -9130,7 +9616,7 @@ async function resolveBranchIssue(cwd, env = process.env, repo = null) {
|
|
|
9130
9616
|
}
|
|
9131
9617
|
function readVinayaVersion() {
|
|
9132
9618
|
try {
|
|
9133
|
-
const pkg = JSON.parse(
|
|
9619
|
+
const pkg = JSON.parse(readFileSync7(join8(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
9134
9620
|
return pkg.version ?? "unknown";
|
|
9135
9621
|
} catch {
|
|
9136
9622
|
return "unknown";
|
|
@@ -9168,6 +9654,7 @@ function defaultStderr(message) {
|
|
|
9168
9654
|
}
|
|
9169
9655
|
var branchIssueFallbackEnabled = true;
|
|
9170
9656
|
var branchIssueByCwd = new Map;
|
|
9657
|
+
var branchIssueSettledByCwd = new Map;
|
|
9171
9658
|
function branchIssueRead(key, read, shared) {
|
|
9172
9659
|
if (!shared)
|
|
9173
9660
|
return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
@@ -9176,8 +9663,30 @@ function branchIssueRead(key, read, shared) {
|
|
|
9176
9663
|
return cached;
|
|
9177
9664
|
const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9178
9665
|
branchIssueByCwd.set(key, reading);
|
|
9666
|
+
reading.then((value) => branchIssueSettledByCwd.set(key, value));
|
|
9667
|
+
return reading;
|
|
9668
|
+
}
|
|
9669
|
+
var headShaByCwd = new Map;
|
|
9670
|
+
var headShaSettledByCwd = new Map;
|
|
9671
|
+
function headShaRead(key, read, shared) {
|
|
9672
|
+
if (!shared)
|
|
9673
|
+
return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9674
|
+
const cached = headShaByCwd.get(key);
|
|
9675
|
+
if (cached !== undefined)
|
|
9676
|
+
return cached;
|
|
9677
|
+
const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
9678
|
+
headShaByCwd.set(key, reading);
|
|
9679
|
+
reading.then((value) => headShaSettledByCwd.set(key, value));
|
|
9179
9680
|
return reading;
|
|
9180
9681
|
}
|
|
9682
|
+
async function resolveHeadSha(cwd) {
|
|
9683
|
+
try {
|
|
9684
|
+
const out = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "HEAD"], { encoding: "utf8" })).stdout.trim();
|
|
9685
|
+
return /^[0-9a-f]{40}$/.test(out) ? out : null;
|
|
9686
|
+
} catch {
|
|
9687
|
+
return null;
|
|
9688
|
+
}
|
|
9689
|
+
}
|
|
9181
9690
|
function defaultDeps() {
|
|
9182
9691
|
return {
|
|
9183
9692
|
outboxRoot: () => join8(GLOBAL_VINAYA_HOME, "outbox"),
|
|
@@ -9192,29 +9701,30 @@ function defaultDeps() {
|
|
|
9192
9701
|
inputVersions: () => {
|
|
9193
9702
|
return;
|
|
9194
9703
|
},
|
|
9195
|
-
resolveLogDestination: defaultResolveLogDestination
|
|
9704
|
+
resolveLogDestination: defaultResolveLogDestination,
|
|
9705
|
+
unresolvedLogDestination
|
|
9196
9706
|
};
|
|
9197
9707
|
}
|
|
9198
|
-
var APPEND_OPEN_FLAGS =
|
|
9708
|
+
var APPEND_OPEN_FLAGS = fsConstants4.O_WRONLY | fsConstants4.O_APPEND | fsConstants4.O_CREAT | fsConstants4.O_NOFOLLOW | fsConstants4.O_NONBLOCK;
|
|
9199
9709
|
function guardedAppendOpen(path) {
|
|
9200
9710
|
try {
|
|
9201
|
-
return
|
|
9711
|
+
return openSync4(path, APPEND_OPEN_FLAGS, 384);
|
|
9202
9712
|
} catch {
|
|
9203
9713
|
return;
|
|
9204
9714
|
}
|
|
9205
9715
|
}
|
|
9206
9716
|
function appendHardenedLine(path, line) {
|
|
9207
9717
|
try {
|
|
9208
|
-
|
|
9718
|
+
mkdirSync4(dirname7(path), { recursive: true, mode: 448 });
|
|
9209
9719
|
const fd = guardedAppendOpen(path);
|
|
9210
9720
|
if (fd === undefined)
|
|
9211
9721
|
return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
|
|
9212
9722
|
try {
|
|
9213
|
-
if (!
|
|
9723
|
+
if (!fstatSync3(fd).isFile())
|
|
9214
9724
|
return `target is not a regular file: ${path}`;
|
|
9215
|
-
|
|
9725
|
+
writeSync3(fd, line);
|
|
9216
9726
|
} finally {
|
|
9217
|
-
|
|
9727
|
+
closeSync4(fd);
|
|
9218
9728
|
}
|
|
9219
9729
|
return null;
|
|
9220
9730
|
} catch (err) {
|
|
@@ -9224,7 +9734,7 @@ function appendHardenedLine(path, line) {
|
|
|
9224
9734
|
function reportRotationOverflow(backupPath, warn) {
|
|
9225
9735
|
let raw;
|
|
9226
9736
|
try {
|
|
9227
|
-
raw =
|
|
9737
|
+
raw = readFileSync7(backupPath, "utf8");
|
|
9228
9738
|
} catch {
|
|
9229
9739
|
return;
|
|
9230
9740
|
}
|
|
@@ -9247,7 +9757,7 @@ function reportRotationOverflow(backupPath, warn) {
|
|
|
9247
9757
|
}
|
|
9248
9758
|
function appendLine(path, line, warn) {
|
|
9249
9759
|
try {
|
|
9250
|
-
|
|
9760
|
+
mkdirSync4(dirname7(path), { recursive: true, mode: 448 });
|
|
9251
9761
|
let fd = guardedAppendOpen(path);
|
|
9252
9762
|
if (fd === undefined) {
|
|
9253
9763
|
warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
|
|
@@ -9256,14 +9766,14 @@ function appendLine(path, line, warn) {
|
|
|
9256
9766
|
}
|
|
9257
9767
|
let closed = false;
|
|
9258
9768
|
try {
|
|
9259
|
-
const stat =
|
|
9769
|
+
const stat = fstatSync3(fd);
|
|
9260
9770
|
if (!stat.isFile()) {
|
|
9261
9771
|
warn(`vinaya: log outbox target is not a regular file — refusing to write: ${path}
|
|
9262
9772
|
`);
|
|
9263
9773
|
return;
|
|
9264
9774
|
}
|
|
9265
9775
|
if (stat.size > OUTBOX_MAX_BYTES) {
|
|
9266
|
-
|
|
9776
|
+
closeSync4(fd);
|
|
9267
9777
|
closed = true;
|
|
9268
9778
|
const backupPath = path.replace(/\.ndjson$/, ".1.ndjson");
|
|
9269
9779
|
reportRotationOverflow(backupPath, warn);
|
|
@@ -9277,10 +9787,10 @@ function appendLine(path, line, warn) {
|
|
|
9277
9787
|
fd = rotated;
|
|
9278
9788
|
closed = false;
|
|
9279
9789
|
}
|
|
9280
|
-
|
|
9790
|
+
writeSync3(fd, line);
|
|
9281
9791
|
} finally {
|
|
9282
9792
|
if (!closed)
|
|
9283
|
-
|
|
9793
|
+
closeSync4(fd);
|
|
9284
9794
|
}
|
|
9285
9795
|
} catch (err) {
|
|
9286
9796
|
warn(`vinaya: log outbox write failed — ${err instanceof Error ? err.message : String(err)}
|
|
@@ -9291,12 +9801,14 @@ function createLogSink(overrides = {}) {
|
|
|
9291
9801
|
const deps = {
|
|
9292
9802
|
...defaultDeps(),
|
|
9293
9803
|
resolveBranchIssue: (repo) => resolveBranchIssue(deps.cwd(), deps.env(), repo),
|
|
9804
|
+
resolveHeadSha: () => resolveHeadSha(deps.cwd()),
|
|
9294
9805
|
...overrides
|
|
9295
9806
|
};
|
|
9296
9807
|
const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
|
|
9297
9808
|
const processId = randomUUID2();
|
|
9298
9809
|
let seq = 0;
|
|
9299
9810
|
let warned = false;
|
|
9811
|
+
let folderFallbackRecorded = false;
|
|
9300
9812
|
const warnOnce = (message) => {
|
|
9301
9813
|
if (warned)
|
|
9302
9814
|
return;
|
|
@@ -9314,6 +9826,7 @@ function createLogSink(overrides = {}) {
|
|
|
9314
9826
|
};
|
|
9315
9827
|
const readerIsReal = overrides.resolveBranchIssue === undefined;
|
|
9316
9828
|
let ownBranchIssue;
|
|
9829
|
+
let ownBranchIssueSettled = null;
|
|
9317
9830
|
const branchIssueOnce = (repo) => {
|
|
9318
9831
|
if (!branchIssueFallbackEnabled)
|
|
9319
9832
|
return Promise.resolve(null);
|
|
@@ -9321,10 +9834,36 @@ function createLogSink(overrides = {}) {
|
|
|
9321
9834
|
const read = () => deps.resolveBranchIssue(slug);
|
|
9322
9835
|
if (readerIsReal)
|
|
9323
9836
|
return branchIssueRead(`${deps.cwd()}\x00${slug ?? ""}`, read, true);
|
|
9324
|
-
if (ownBranchIssue === undefined)
|
|
9837
|
+
if (ownBranchIssue === undefined) {
|
|
9325
9838
|
ownBranchIssue = branchIssueRead(deps.cwd(), read, false);
|
|
9839
|
+
ownBranchIssue.then((value) => {
|
|
9840
|
+
ownBranchIssueSettled = value;
|
|
9841
|
+
});
|
|
9842
|
+
}
|
|
9326
9843
|
return ownBranchIssue;
|
|
9327
9844
|
};
|
|
9845
|
+
const branchIssueIfSettled = (repo) => {
|
|
9846
|
+
if (!branchIssueFallbackEnabled)
|
|
9847
|
+
return null;
|
|
9848
|
+
if (!readerIsReal)
|
|
9849
|
+
return ownBranchIssueSettled;
|
|
9850
|
+
return branchIssueSettledByCwd.get(`${deps.cwd()}\x00${safeRepoSlug(repo) ?? ""}`) ?? null;
|
|
9851
|
+
};
|
|
9852
|
+
const headShaReaderIsReal = overrides.resolveHeadSha === undefined;
|
|
9853
|
+
let ownHeadSha;
|
|
9854
|
+
let ownHeadShaSettled = null;
|
|
9855
|
+
const headShaOnce = () => {
|
|
9856
|
+
if (headShaReaderIsReal)
|
|
9857
|
+
return headShaRead(deps.cwd(), deps.resolveHeadSha, true);
|
|
9858
|
+
if (ownHeadSha === undefined) {
|
|
9859
|
+
ownHeadSha = headShaRead(deps.cwd(), deps.resolveHeadSha, false);
|
|
9860
|
+
ownHeadSha.then((value) => {
|
|
9861
|
+
ownHeadShaSettled = value;
|
|
9862
|
+
});
|
|
9863
|
+
}
|
|
9864
|
+
return ownHeadSha;
|
|
9865
|
+
};
|
|
9866
|
+
const headShaIfSettled = () => headShaReaderIsReal ? headShaSettledByCwd.get(deps.cwd()) ?? null : ownHeadShaSettled;
|
|
9328
9867
|
let resolveRepoCache;
|
|
9329
9868
|
const resolveRepoOnce = () => {
|
|
9330
9869
|
if (resolveRepoCache === undefined)
|
|
@@ -9332,6 +9871,7 @@ function createLogSink(overrides = {}) {
|
|
|
9332
9871
|
return resolveRepoCache;
|
|
9333
9872
|
};
|
|
9334
9873
|
let contextCache;
|
|
9874
|
+
let settledContext;
|
|
9335
9875
|
const context = () => {
|
|
9336
9876
|
if (contextCache === undefined) {
|
|
9337
9877
|
const env = deps.env();
|
|
@@ -9340,11 +9880,16 @@ function createLogSink(overrides = {}) {
|
|
|
9340
9880
|
doctrine()
|
|
9341
9881
|
]).then(async ([resolved, doctrineValue]) => {
|
|
9342
9882
|
const repo = resolved && isSafeRepoSegment3(resolved.owner) && isSafeRepoSegment3(resolved.repo) ? resolved : null;
|
|
9343
|
-
|
|
9883
|
+
settledContext = { repo, doctrine: doctrineValue, destination: await deps.resolveLogDestination(repo, env) };
|
|
9884
|
+
return settledContext;
|
|
9344
9885
|
});
|
|
9345
9886
|
}
|
|
9346
9887
|
return contextCache;
|
|
9347
9888
|
};
|
|
9889
|
+
const resetContext = () => {
|
|
9890
|
+
contextCache = undefined;
|
|
9891
|
+
settledContext = undefined;
|
|
9892
|
+
};
|
|
9348
9893
|
let drainChain = Promise.resolve();
|
|
9349
9894
|
const pendingWrites = new Set;
|
|
9350
9895
|
let writeChain = Promise.resolve();
|
|
@@ -9356,63 +9901,88 @@ function createLogSink(overrides = {}) {
|
|
|
9356
9901
|
`);
|
|
9357
9902
|
});
|
|
9358
9903
|
};
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9904
|
+
const snapshot = () => {
|
|
9905
|
+
const env = deps.env();
|
|
9906
|
+
return {
|
|
9907
|
+
host: hostFromEnv(env),
|
|
9908
|
+
now: deps.now(),
|
|
9909
|
+
seq: seq++,
|
|
9910
|
+
envFields: {
|
|
9366
9911
|
role: env.VINAYA_ROLE,
|
|
9367
9912
|
task: env.VINAYA_TASK,
|
|
9368
9913
|
round: env.VINAYA_ROUND,
|
|
9914
|
+
pr: env.VINAYA_PR,
|
|
9369
9915
|
run: env.VINAYA_RUN || runId,
|
|
9370
9916
|
attempt: env.VINAYA_ATTEMPT,
|
|
9371
|
-
parent: env.VINAYA_PARENT_EVENT
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9917
|
+
parent: env.VINAYA_PARENT_EVENT,
|
|
9918
|
+
workRef: env.VINAYA_WORK_REF,
|
|
9919
|
+
flow: env.VINAYA_FLOW,
|
|
9920
|
+
flowVersion: env.VINAYA_FLOW_VERSION,
|
|
9921
|
+
runtime: env.VINAYA_RUNTIME,
|
|
9922
|
+
source: env.VINAYA_SOURCE
|
|
9923
|
+
}
|
|
9924
|
+
};
|
|
9925
|
+
};
|
|
9926
|
+
const writeEvent = (e, call, ctx, branchIssue, headSha, deliver) => {
|
|
9927
|
+
const { repo, doctrine: doctrineValue, destination } = ctx;
|
|
9928
|
+
if (destination.kind === "none") {
|
|
9929
|
+
warnOnce(`vinaya: not recording — ${destination.reason}
|
|
9377
9930
|
`);
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9931
|
+
return;
|
|
9932
|
+
}
|
|
9933
|
+
if (destination.kind === "folder" && destination.fallbackReason) {
|
|
9934
|
+
warnOnce(`vinaya: ${describeFolderFallback(destination.fallbackReason)}
|
|
9382
9935
|
`);
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
|
|
9936
|
+
}
|
|
9937
|
+
const built = buildHeader({
|
|
9938
|
+
now: call.now,
|
|
9939
|
+
runId,
|
|
9940
|
+
seq: call.seq,
|
|
9941
|
+
repo: repo ? `${repo.owner}/${repo.repo}` : null,
|
|
9942
|
+
vinaya: deps.vinayaVersion(),
|
|
9943
|
+
doctrine: doctrineValue,
|
|
9944
|
+
host: call.host,
|
|
9945
|
+
hostname: deps.hostname(),
|
|
9946
|
+
env: call.envFields,
|
|
9947
|
+
branchIssue,
|
|
9948
|
+
eventId: randomUUID2(),
|
|
9949
|
+
processId,
|
|
9950
|
+
inputVersions: deps.inputVersions()
|
|
9951
|
+
});
|
|
9952
|
+
const header = headSha === null ? built : { ...built, subject: { ...built.subject, sha: headSha } };
|
|
9953
|
+
if (destination.kind === "folder" && destination.fallbackReason && !folderFallbackRecorded) {
|
|
9954
|
+
folderFallbackRecorded = true;
|
|
9955
|
+
recordFolderFallback(repo, header.subject.issue, destination.fallbackReason, call.now, dirname7(destination.folder), join8(deps.home(), ".vinaya"));
|
|
9956
|
+
}
|
|
9957
|
+
const full = { ...e, ...header };
|
|
9958
|
+
const parsed = LogEventSchema.safeParse(full);
|
|
9959
|
+
if (!parsed.success) {
|
|
9960
|
+
warnOnce(`vinaya: log() refused an invalid payload — ${parsed.error.issues[0]?.message ?? "schema violation"}
|
|
9404
9961
|
`);
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
|
|
9962
|
+
return;
|
|
9963
|
+
}
|
|
9964
|
+
const line = `${JSON.stringify(redact(parsed.data, deps.home()))}
|
|
9408
9965
|
`;
|
|
9409
|
-
|
|
9410
|
-
|
|
9411
|
-
|
|
9412
|
-
|
|
9413
|
-
|
|
9414
|
-
|
|
9966
|
+
if (destination.kind === "server") {
|
|
9967
|
+
appendLine(outboxPathFor(deps, repo, header.subject.issue), line, warnOnce);
|
|
9968
|
+
if (deliver)
|
|
9969
|
+
scheduleWebhookDrain(header.subject.issue, destination.url, destination.headers);
|
|
9970
|
+
} else {
|
|
9971
|
+
appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
|
|
9972
|
+
}
|
|
9973
|
+
};
|
|
9974
|
+
function log(e) {
|
|
9975
|
+
try {
|
|
9976
|
+
const call = snapshot();
|
|
9977
|
+
const write = async () => {
|
|
9978
|
+
const ctx = await context();
|
|
9979
|
+
if (ctx.destination.kind === "none") {
|
|
9980
|
+
writeEvent(e, call, ctx, null, null, true);
|
|
9981
|
+
return;
|
|
9415
9982
|
}
|
|
9983
|
+
const branchIssue = call.envFields.task ? null : await branchIssueOnce(ctx.repo);
|
|
9984
|
+
const headSha = e.kind === "gate" ? await headShaOnce() : null;
|
|
9985
|
+
writeEvent(e, call, ctx, branchIssue, headSha, true);
|
|
9416
9986
|
};
|
|
9417
9987
|
const written = writeChain.then(write).catch((err) => {
|
|
9418
9988
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
@@ -9423,6 +9993,26 @@ function createLogSink(overrides = {}) {
|
|
|
9423
9993
|
written.finally(() => pendingWrites.delete(written));
|
|
9424
9994
|
} catch (err) {
|
|
9425
9995
|
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
9996
|
+
`);
|
|
9997
|
+
}
|
|
9998
|
+
}
|
|
9999
|
+
function logSync(e, opts = {}) {
|
|
10000
|
+
try {
|
|
10001
|
+
const call = snapshot();
|
|
10002
|
+
let ctx = settledContext;
|
|
10003
|
+
if (ctx === undefined) {
|
|
10004
|
+
const destination = deps.unresolvedLogDestination(deps.env());
|
|
10005
|
+
if (destination.kind === "folder" && !opts.quiet) {
|
|
10006
|
+
warnOnce(`vinaya: the process ended before its log destination was resolved — the event is written to ${destination.folder}; \`vinaya log send\` delivers it to a configured server later
|
|
10007
|
+
`);
|
|
10008
|
+
}
|
|
10009
|
+
ctx = { repo: null, doctrine: "unknown", destination };
|
|
10010
|
+
}
|
|
10011
|
+
const branchIssue = ctx.destination.kind === "none" || call.envFields.task ? null : branchIssueIfSettled(ctx.repo);
|
|
10012
|
+
const headSha = e.kind === "gate" && ctx.destination.kind !== "none" ? headShaIfSettled() : null;
|
|
10013
|
+
writeEvent(e, call, ctx, branchIssue, headSha, false);
|
|
10014
|
+
} catch (err) {
|
|
10015
|
+
warnOnce(`vinaya: logSync() failed — ${err instanceof Error ? err.message : String(err)}
|
|
9426
10016
|
`);
|
|
9427
10017
|
}
|
|
9428
10018
|
}
|
|
@@ -9443,7 +10033,7 @@ function createLogSink(overrides = {}) {
|
|
|
9443
10033
|
return;
|
|
9444
10034
|
});
|
|
9445
10035
|
};
|
|
9446
|
-
return { log, runId, warmup, drain };
|
|
10036
|
+
return { log, logSync, runId, warmup, drain, resetContext };
|
|
9447
10037
|
}
|
|
9448
10038
|
var defaultSink = createLogSink();
|
|
9449
10039
|
|
|
@@ -9576,7 +10166,7 @@ function findingsInThisDiff(findings) {
|
|
|
9576
10166
|
const abs = resolve2(diff.root, f.file);
|
|
9577
10167
|
if (!changed.has(abs))
|
|
9578
10168
|
return false;
|
|
9579
|
-
const relPath =
|
|
10169
|
+
const relPath = relative2(diff.root, abs);
|
|
9580
10170
|
if (!ranges.has(relPath))
|
|
9581
10171
|
ranges.set(relPath, changedLineRanges(diff.base, relPath));
|
|
9582
10172
|
const fileRanges = ranges.get(relPath) ?? null;
|
|
@@ -9606,7 +10196,7 @@ function collectWorkingTree(dir, out = []) {
|
|
|
9606
10196
|
const full = join10(dir, name);
|
|
9607
10197
|
let isDir;
|
|
9608
10198
|
try {
|
|
9609
|
-
isDir =
|
|
10199
|
+
isDir = statSync3(full).isDirectory();
|
|
9610
10200
|
} catch {
|
|
9611
10201
|
continue;
|
|
9612
10202
|
}
|
|
@@ -9621,7 +10211,7 @@ function collectWorkingTree(dir, out = []) {
|
|
|
9621
10211
|
return out;
|
|
9622
10212
|
}
|
|
9623
10213
|
function readWorkingTree(paths) {
|
|
9624
|
-
return paths.map((p) => ({ path: p, content:
|
|
10214
|
+
return paths.map((p) => ({ path: p, content: readFileSync8(p, "utf8") }));
|
|
9625
10215
|
}
|
|
9626
10216
|
function collectAtRef(ref, dir) {
|
|
9627
10217
|
const listing = git2(["ls-tree", "-r", "--name-only", ref, "--", dir]);
|