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