@attalabs/vinaya 0.35.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/aeg-root/contracts/developer-reviewer.md +1 -1
- package/aeg-root/contracts/planner-operator.md +1 -1
- package/aeg-root/contracts/principal-operator.md +6 -6
- package/aeg-root/contracts/security-archivist.md +1 -1
- package/aeg-root/enforcement.md +9 -10
- package/aeg-root/process.md +3 -1
- package/aeg-root/roles/archivist.md +2 -2
- package/aeg-root/roles/developer/reference.md +13 -16
- package/aeg-root/roles/developer.md +7 -3
- package/aeg-root/roles/operator.md +18 -18
- package/aeg-root/roles/planner/reference.md +23 -8
- package/aeg-root/roles/planner.md +2 -0
- package/aeg-root/roles/principal.md +6 -1
- package/aeg-root/roles/reviewer.md +11 -3
- package/aeg-root/roles/security.md +19 -9
- package/aeg-root/roles/tranche-archivist.md +14 -2
- package/aeg-root/state-machine.md +11 -10
- package/aeg-root/templates/brief-template.md +10 -4
- package/aeg-root/templates/pr-report-template.md +1 -9
- package/aeg-root/tranche-model.md +4 -4
- package/dist/checks/bin/check-body-bare-digits.js +2081 -1883
- package/dist/checks/bin/check-branch-topology.js +1376 -1139
- package/dist/checks/bin/check-brief-shape.js +2081 -1883
- package/dist/checks/bin/check-changeset-coverage.js +2564 -2025
- package/dist/checks/bin/check-closes-n.js +1376 -1139
- package/dist/checks/bin/check-coherence.js +1480 -1228
- package/dist/checks/bin/check-dead-branch-push.js +1339 -1156
- package/dist/checks/bin/check-dispatch-readiness.js +1480 -1228
- package/dist/checks/bin/check-doc-coverage-push.js +2563 -2024
- package/dist/checks/bin/check-doc-coverage.js +2565 -2026
- package/dist/checks/bin/check-doctrine-no-procedures.js +2081 -1883
- package/dist/checks/bin/check-doctrine-portability.js +2563 -2024
- package/dist/checks/bin/check-evidence-fresh.js +1906 -1536
- package/dist/checks/bin/check-exec-bits.js +2136 -1597
- package/dist/checks/bin/check-first-push-dispatch.js +1480 -1228
- package/dist/checks/bin/check-issue-assignment.js +1376 -1139
- package/dist/checks/bin/check-issue-milestone-attach.js +1339 -1156
- package/dist/checks/bin/check-issue-objectives-numbering.js +2081 -1883
- package/dist/checks/bin/check-issue-parts-coverage.js +1339 -1156
- package/dist/checks/bin/check-issue-surface-globs.js +1488 -1227
- package/dist/checks/bin/check-issue-title-grammar.js +1339 -1156
- package/dist/checks/bin/check-issue-tranche-label.js +1339 -1156
- package/dist/checks/bin/check-main-branch-refusal.js +1342 -1159
- package/dist/checks/bin/check-no-disk-state.js +1342 -1159
- package/dist/checks/bin/check-pr-premise-reassert.js +2081 -1883
- package/dist/checks/bin/check-pr-report-density.js +1342 -1159
- package/dist/checks/bin/check-principal-test-plan-wait.js +1342 -1159
- package/dist/checks/bin/check-quoted-command.js +4063 -3526
- package/dist/checks/bin/check-reader-resolvable-prose.js +4082 -3533
- package/dist/checks/bin/check-registry-gates.js +1363 -1167
- package/dist/checks/bin/check-retired-vocabulary.js +4057 -3520
- package/dist/checks/bin/check-review-gate.js +2081 -1883
- package/dist/checks/bin/check-single-plan-pr.js +1339 -1156
- package/dist/checks/bin/check-surface-scope.js +1376 -1139
- package/dist/checks/bin/check-test-plan.js +1339 -1156
- package/dist/checks/bin/check-token-collection-wired.js +1342 -1159
- package/dist/checks/bin/check-token-report.js +1409 -1342
- package/dist/checks/bin/check-workspace-escape.js +2562 -2023
- package/dist/index.js +14171 -6490
- package/dist/lib/pre-push-cache-test-run.js +1044 -641
- package/dist/lib/pre-push-select-tests.js +641 -444
- package/package.json +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +38 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +19 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +257 -10
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +7 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +2 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +69 -11
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +139 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +32 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +27 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +757 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +8 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +52 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +163 -21
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/app-path-routes-manifest.json +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/required-server-files.json +0 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/routes-manifest.json +0 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +5 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app-paths-manifest.json +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/044u_vinaya-studio_web_src_app_studio_backlog__components_BacklogTable_tsx_0oha0bt._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1bh2awk._.js → [root-of-the-server]__038scsm._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1widio3._.js → [root-of-the-server]__03__s45._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_15gdg48._.js → [root-of-the-server]__04adkz-._.js} +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__05zwn98._.js +14 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__10riywf._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13znegp._.js → [root-of-the-server]__134x-65._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0zc_0gx._.js → [root-of-the-server]__14ui9sz._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13eeix2._.js → [root-of-the-server]__1_l_l1u._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1f4bb3_._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1dky4g0._.js → [root-of-the-server]__1my83lt._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1ng2x88._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__040smoa._.js → [root-of-the-server]__1qpc6at._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +56 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_06h3wbl._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0gs4gvl._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_121lrn5._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1o4v6lb._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1q7h5mz._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1ztd4i3._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_209-ugd._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_214d71c._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_17dho0f._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_next_dist_1lzmr5o._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_animate_components_index_ts_186fje1._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_index_ts_0xk1vda._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/09fcolor69bun.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0lcwmwzxacdie.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ojry7lrbzkfd.css +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vtfb0g813gki.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1giu47hrbhroj.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1shz6lwruld25.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1ytvuy1mmnc6j.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3oxhhhm_psozq.js → 21a6_5cr956wj.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2g8mwnydod96u.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3li0ueedy-ozv.js → 2nrnuawd5fwpv.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2nw47832_uvfe.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qdxnj8wk2h0s.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3b9q75p-z5ma5.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3cv-oe7153242.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3ip5z3cf43bgo.js → 3l56x8wjdzvaw.js} +5 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3m310lbjj4p5u.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3goaig_rysc6p.js → 3qtt1v3ya-ofe.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/server.js +1 -1
- package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core/bin/verify-coherence.ts +0 -1089
- package/studio-standalone/_node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +0 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/app-paths-manifest.json +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/build-manifest.json +0 -9
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/server-reference-manifest.json +0 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +0 -6
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.map +0 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route_client-reference-manifest.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/044u_vinaya-studio_web__next-internal_server_app_api_coherence_route_actions_1rnzea1.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[externals]__0cki-x_._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +0 -15
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[turbopack]_runtime.js +0 -903
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ln09ua._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0oegopp._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__13yxbjd._.js +0 -51
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1duqmtm._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1z7dml9._.js +0 -9
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0bfs_u4._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0g8_eot._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0hrh_v-._.js +0 -181
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0i4-dea._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0o54suy._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0rxd7s0._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_151m4rz._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1a9dieq._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sxsf5q._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sy_yfr._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_219v2an._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_05ufo8i._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_form_input_tsx_0es8d8b._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_brutal_components_index_ts_0n_lcc4._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_0wvpm_z._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0c8uwz_-m8s99.js +0 -165
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ct0c-xj0baf6.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0t5n_r4xm__t-.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vc2u252q5q6o.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/16r_o07lw0vm0.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1cah7_e5a1zvu.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1gjo9-6dz7nup.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/24tz8aro1uto4.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ef2g5fozszw7.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ka8dg687auhj.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2pf3f50gbrkyv.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qq49pct3q51-.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3et66z7glk65w.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3u9emqjwpd0t9.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3y6u3prmrkea-.js +0 -1
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{ca66rAHI_w9D7S7ceXDvR → yR5RsCxb1OGnYggiaO09S}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{ca66rAHI_w9D7S7ceXDvR → yR5RsCxb1OGnYggiaO09S}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{ca66rAHI_w9D7S7ceXDvR → yR5RsCxb1OGnYggiaO09S}/_ssgManifest.js +0 -0
|
@@ -1884,45 +1884,6 @@ var DERIVED_STATUSES = [
|
|
|
1884
1884
|
"incoherent"
|
|
1885
1885
|
];
|
|
1886
1886
|
var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
|
|
1887
|
-
// ../../packages/aeg-core/src/parse-ledger.ts
|
|
1888
|
-
function rowFromCells(cells) {
|
|
1889
|
-
if (cells.length < 7)
|
|
1890
|
-
return null;
|
|
1891
|
-
const phase = (cells[0] ?? "").trim();
|
|
1892
|
-
if (!phase)
|
|
1893
|
-
return null;
|
|
1894
|
-
return {
|
|
1895
|
-
phase,
|
|
1896
|
-
role: (cells[1] ?? "").trim(),
|
|
1897
|
-
agentModel: (cells[2] ?? "").trim(),
|
|
1898
|
-
tokensIn: parseIntCell(cells[3] ?? ""),
|
|
1899
|
-
tokensOut: parseIntCell(cells[4] ?? ""),
|
|
1900
|
-
cost: parseCostCell(cells[5] ?? ""),
|
|
1901
|
-
date: (cells[6] ?? "").trim()
|
|
1902
|
-
};
|
|
1903
|
-
}
|
|
1904
|
-
function parseIntCell(cell) {
|
|
1905
|
-
const trimmed = cell.replace(/`/g, "").trim();
|
|
1906
|
-
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1907
|
-
return null;
|
|
1908
|
-
const normalized = trimmed.replace(/[,_\s]/g, "");
|
|
1909
|
-
if (!/^-?\d+$/.test(normalized))
|
|
1910
|
-
return null;
|
|
1911
|
-
return Number(normalized);
|
|
1912
|
-
}
|
|
1913
|
-
function parseCostCell(cell) {
|
|
1914
|
-
const trimmed = cell.replace(/`/g, "").trim();
|
|
1915
|
-
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1916
|
-
return null;
|
|
1917
|
-
const normalized = trimmed.replace(/^\$/, "").replace(/[,_\s]/g, "");
|
|
1918
|
-
if (!/^-?\d+(\.\d+)?$/.test(normalized))
|
|
1919
|
-
return null;
|
|
1920
|
-
return Number(normalized);
|
|
1921
|
-
}
|
|
1922
|
-
function isEmDashOrDash(s) {
|
|
1923
|
-
const t = s.trim();
|
|
1924
|
-
return t === "—" || t === "-" || t === "–";
|
|
1925
|
-
}
|
|
1926
1887
|
// ../../packages/aeg-core/src/waiver-label.ts
|
|
1927
1888
|
var WAIVER_LABEL = label("waiver-docs");
|
|
1928
1889
|
var WAIVER_LABEL_REVIEW = label("waiver-review");
|
|
@@ -1938,61 +1899,6 @@ function isWaiverLabelActorVerified(opts) {
|
|
|
1938
1899
|
return false;
|
|
1939
1900
|
return isPrincipal(opts.labelActor, opts.principalAllowlist);
|
|
1940
1901
|
}
|
|
1941
|
-
|
|
1942
|
-
// ../../packages/aeg-core/src/parse-token-report.ts
|
|
1943
|
-
var TOKEN_REPORT_HEADING = /^\s*(?:#{1,6}\s*Token report\s*|\*\*Token report\*\*)\s*$/i;
|
|
1944
|
-
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;
|
|
1945
|
-
function parseTokenReportEntries(body) {
|
|
1946
|
-
const lines = body.split(/\r?\n/);
|
|
1947
|
-
const headingIdxs = [];
|
|
1948
|
-
lines.forEach((line, i) => {
|
|
1949
|
-
if (TOKEN_REPORT_HEADING.test(line))
|
|
1950
|
-
headingIdxs.push(i);
|
|
1951
|
-
});
|
|
1952
|
-
const out = [];
|
|
1953
|
-
for (let h = 0;h < headingIdxs.length; h++) {
|
|
1954
|
-
const start = headingIdxs[h] + 1;
|
|
1955
|
-
const end = h + 1 < headingIdxs.length ? headingIdxs[h + 1] : lines.length;
|
|
1956
|
-
const section = lines.slice(start, end).join(`
|
|
1957
|
-
`);
|
|
1958
|
-
const tableRows = parseTableSection(section);
|
|
1959
|
-
if (tableRows.length > 0) {
|
|
1960
|
-
out.push(...tableRows);
|
|
1961
|
-
continue;
|
|
1962
|
-
}
|
|
1963
|
-
const inlineRow = parseInlineFieldList(section);
|
|
1964
|
-
if (inlineRow)
|
|
1965
|
-
out.push(inlineRow);
|
|
1966
|
-
}
|
|
1967
|
-
return out;
|
|
1968
|
-
}
|
|
1969
|
-
function parseTableSection(section) {
|
|
1970
|
-
const lines = section.split(/\r?\n/);
|
|
1971
|
-
let i = 0;
|
|
1972
|
-
for (;i < lines.length; i++) {
|
|
1973
|
-
if ((lines[i] ?? "").trim().startsWith("|"))
|
|
1974
|
-
break;
|
|
1975
|
-
}
|
|
1976
|
-
if (i + 1 >= lines.length)
|
|
1977
|
-
return [];
|
|
1978
|
-
i += 2;
|
|
1979
|
-
const out = [];
|
|
1980
|
-
for (;i < lines.length; i++) {
|
|
1981
|
-
const trimmed = (lines[i] ?? "").trim();
|
|
1982
|
-
if (!trimmed.startsWith("|"))
|
|
1983
|
-
break;
|
|
1984
|
-
const row = rowFromCells(splitTableRow(trimmed));
|
|
1985
|
-
if (row)
|
|
1986
|
-
out.push(row);
|
|
1987
|
-
}
|
|
1988
|
-
return out;
|
|
1989
|
-
}
|
|
1990
|
-
function parseInlineFieldList(section) {
|
|
1991
|
-
const m = section.match(INLINE_FIELD_LIST);
|
|
1992
|
-
if (!m)
|
|
1993
|
-
return null;
|
|
1994
|
-
return rowFromCells([m[1], m[2], m[3], m[4], m[5], m[6], m[7]]);
|
|
1995
|
-
}
|
|
1996
1902
|
// ../../packages/aeg-core/src/verdict-extraction.ts
|
|
1997
1903
|
var HEAD_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged head:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
1998
1904
|
var OBJECTIVES_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Objectives version:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
@@ -2441,10 +2347,12 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive,
|
|
|
2441
2347
|
var CODE_REVIEW_SEVERITY_ORDER = ["BLOCKER", "MAJOR", "MINOR"];
|
|
2442
2348
|
var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
|
|
2443
2349
|
var DEFAULT_MAX_ROUNDS = 3;
|
|
2350
|
+
var DEFAULT_MAX_TASK_MINUTES = 180;
|
|
2444
2351
|
var DEFAULT_REVIEW_POLICY = {
|
|
2445
2352
|
codeReviewThreshold: "BLOCKER",
|
|
2446
2353
|
securityThreshold: "HIGH",
|
|
2447
|
-
maxRounds: DEFAULT_MAX_ROUNDS
|
|
2354
|
+
maxRounds: DEFAULT_MAX_ROUNDS,
|
|
2355
|
+
maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES
|
|
2448
2356
|
};
|
|
2449
2357
|
var FILE_SHAPED_LOCATION = /\.[a-zA-Z0-9]{1,10}(:\d+)?\s*$/;
|
|
2450
2358
|
var PROSE_LOCATION_PATTERNS = [/\bpr\s*body\b/i, /\bcomment\b/i];
|
|
@@ -2464,16 +2372,42 @@ function blockingSeverities(scale, threshold) {
|
|
|
2464
2372
|
}
|
|
2465
2373
|
return scale.slice(0, idx + 1);
|
|
2466
2374
|
}
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2375
|
+
var DEFERRAL_REASON_TEXT = {
|
|
2376
|
+
"unchanged-line": "unchanged line",
|
|
2377
|
+
"outside-surface": "outside the Surface"
|
|
2378
|
+
};
|
|
2379
|
+
var SECURITY_HIGH_AND_ABOVE = blockingSeverities(SECURITY_SEVERITY_ORDER, "HIGH");
|
|
2380
|
+
function classifyFinding(finding, scale, threshold, context = {}) {
|
|
2381
|
+
if (!scale.includes(finding.severity)) {
|
|
2382
|
+
throw new Error(`classifyFinding: severity "${finding.severity}" is not one of ${scale.join(" > ")}`);
|
|
2383
|
+
}
|
|
2384
|
+
const location = finding.location;
|
|
2385
|
+
const effectiveSeverity = location !== undefined && isProseLocation(location) ? PROSE_CAP_SEVERITY : finding.severity;
|
|
2386
|
+
const wouldBlock = blockingSeverities(scale, threshold).includes(effectiveSeverity);
|
|
2387
|
+
if (!wouldBlock)
|
|
2388
|
+
return { outcome: "non_blocking", deferralReason: null };
|
|
2389
|
+
const hasLocation = location !== undefined && location.length > 0;
|
|
2390
|
+
if (hasLocation && context.inSurface && !context.inSurface(location)) {
|
|
2391
|
+
return { outcome: "deferred", deferralReason: "outside-surface" };
|
|
2392
|
+
}
|
|
2393
|
+
if (hasLocation && context.changedLine && !SECURITY_HIGH_AND_ABOVE.includes(effectiveSeverity)) {
|
|
2394
|
+
if (!context.changedLine(location)) {
|
|
2395
|
+
return { outcome: "deferred", deferralReason: "unchanged-line" };
|
|
2472
2396
|
}
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2397
|
+
}
|
|
2398
|
+
return { outcome: "blocking", deferralReason: null };
|
|
2399
|
+
}
|
|
2400
|
+
function evaluateReviewFindings(findings, scale, threshold, context = {}) {
|
|
2401
|
+
const blockingFindings = [];
|
|
2402
|
+
const deferredFindings = [];
|
|
2403
|
+
for (const f of findings) {
|
|
2404
|
+
const c = classifyFinding(f, scale, threshold, context);
|
|
2405
|
+
if (c.outcome === "blocking")
|
|
2406
|
+
blockingFindings.push(f);
|
|
2407
|
+
else if (c.outcome === "deferred")
|
|
2408
|
+
deferredFindings.push({ finding: f, reason: c.deferralReason });
|
|
2409
|
+
}
|
|
2410
|
+
return { outcome: blockingFindings.length > 0 ? "blocked" : "clean", blockingFindings, deferredFindings };
|
|
2477
2411
|
}
|
|
2478
2412
|
function isConsequentialFinding(finding) {
|
|
2479
2413
|
return finding.state !== "resolved";
|
|
@@ -2481,11 +2415,11 @@ function isConsequentialFinding(finding) {
|
|
|
2481
2415
|
function consequentialFindings(findings) {
|
|
2482
2416
|
return findings.filter((f) => isConsequentialFinding(f));
|
|
2483
2417
|
}
|
|
2484
|
-
function evaluateCodeReview(findings, policy) {
|
|
2485
|
-
return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold);
|
|
2418
|
+
function evaluateCodeReview(findings, policy, context = {}) {
|
|
2419
|
+
return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold, context);
|
|
2486
2420
|
}
|
|
2487
|
-
function evaluateSecurityReview(findings, policy) {
|
|
2488
|
-
return evaluateReviewFindings(findings, SECURITY_SEVERITY_ORDER, policy.securityThreshold);
|
|
2421
|
+
function evaluateSecurityReview(findings, policy, context = {}) {
|
|
2422
|
+
return evaluateReviewFindings(findings, SECURITY_SEVERITY_ORDER, policy.securityThreshold, context);
|
|
2489
2423
|
}
|
|
2490
2424
|
function isKnownSeverity(scale, value) {
|
|
2491
2425
|
return scale.includes(value);
|
|
@@ -2819,11 +2753,13 @@ function checkDocUpdateList(prBody) {
|
|
|
2819
2753
|
return headingCheck(prBody, "(?:documentation|doc)[- ]update(?:\\s+list)?", "Documentation-update list");
|
|
2820
2754
|
}
|
|
2821
2755
|
function checkWorktreeStep0(prBody) {
|
|
2822
|
-
if (/git worktree add/.test(prBody))
|
|
2756
|
+
if (/git worktree add/.test(prBody) || /cd \.worktrees\//.test(prBody) || /bun install --frozen-lockfile/.test(prBody))
|
|
2823
2757
|
return { status: "pass", errors: [] };
|
|
2824
2758
|
return {
|
|
2825
2759
|
status: "fail",
|
|
2826
|
-
errors: [
|
|
2760
|
+
errors: [
|
|
2761
|
+
"brief-validation worktree Step 0: no `git worktree add`, `cd .worktrees/`, or `bun install --frozen-lockfile` command found in the PR body."
|
|
2762
|
+
]
|
|
2827
2763
|
};
|
|
2828
2764
|
}
|
|
2829
2765
|
function checkStopConditions(prBody) {
|
|
@@ -3013,7 +2949,8 @@ function isCommandBlock(content) {
|
|
|
3013
2949
|
return COMMAND_WORDS.includes(commandWordOf(firstNonBlankLine(content)));
|
|
3014
2950
|
}
|
|
3015
2951
|
function isStep0Block(content) {
|
|
3016
|
-
|
|
2952
|
+
const first = firstNonBlankLine(content);
|
|
2953
|
+
return first.startsWith("git worktree add") || first.startsWith("cd .worktrees/") || first.startsWith("bun install --frozen-lockfile");
|
|
3017
2954
|
}
|
|
3018
2955
|
function checkCommandsCarryOutput(prBody) {
|
|
3019
2956
|
const errors = [];
|
|
@@ -3399,159 +3336,590 @@ function checkPrReportDensity(prBody) {
|
|
|
3399
3336
|
const results = [checkDecisionsDensity(prBody), checkScopeDensity(prBody)];
|
|
3400
3337
|
return { errors: results.flatMap((r) => r.errors) };
|
|
3401
3338
|
}
|
|
3402
|
-
// ../../packages/aeg-core/src/
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
{ name: "Sizing", pattern: "Sizing" },
|
|
3410
|
-
{ name: "Project(s) + blast radius", pattern: "Project\\(s\\)|Project(?:s)?\\s*\\+|blast radius" },
|
|
3411
|
-
{ name: "Dependency rationale", pattern: "Dependency rationale|Depends[- ]on" },
|
|
3412
|
-
{ name: "Traps to avoid", pattern: "Traps" },
|
|
3413
|
-
{ name: "Suggested agent-class", pattern: "(?:Suggested\\s+)?agent-class" },
|
|
3414
|
-
{ name: "Stop-and-escalate", pattern: "Stop-and-escalate" },
|
|
3415
|
-
{ name: "Docs to keep coherent", pattern: "Docs to keep coherent|§7" }
|
|
3339
|
+
// ../../packages/aeg-core/src/reader-resolvable-prose.ts
|
|
3340
|
+
var PRODUCT_SLUG_SCOPE = [
|
|
3341
|
+
"apps/cli/src",
|
|
3342
|
+
".github/workflows",
|
|
3343
|
+
".vinaya",
|
|
3344
|
+
"apps/cli/README.md",
|
|
3345
|
+
"packages/sources/README.md"
|
|
3416
3346
|
];
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
const errors = [];
|
|
3420
|
-
for (const f of RATIONALE_FIELDS) {
|
|
3421
|
-
if (!hasRationaleField(body, f.pattern)) {
|
|
3422
|
-
errors.push(`issue-validation ${f.name}: rationale field not found in the Issue body — every task Issue carries the full Planner's rationale (aeg-root/contracts/planner-brief.md).`);
|
|
3423
|
-
continue;
|
|
3424
|
-
}
|
|
3425
|
-
if (f.name === DEPENDENCY_RATIONALE_FIELD_NAME && !SECTION_HEADER.test(body)) {
|
|
3426
|
-
errors.push(`issue-validation ${f.name}: rationale field found, but not in the form amend-deps requires — ` + "write `**Dependency rationale** — …`, not `**Dependency rationale:** …`. " + "`amendRationaleDeps` (the only sanctioned way to edit Depends-on/Conflicts-with) locates this " + "section by the exact anchor `**Dependency rationale**`; a colon inside the bold breaks that match " + "and the Issue becomes unamendable.");
|
|
3427
|
-
}
|
|
3428
|
-
}
|
|
3429
|
-
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3430
|
-
}
|
|
3431
|
-
var OBJECTIVES_SINCE_ISSUE = 404;
|
|
3432
|
-
function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
|
|
3433
|
-
if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
|
|
3434
|
-
return { status: "pass", errors: [] };
|
|
3435
|
-
const result = objectivesOf(body);
|
|
3436
|
-
if (result.ok)
|
|
3437
|
-
return { status: "pass", errors: [] };
|
|
3438
|
-
return { status: "fail", errors: result.errors.map((e) => `issue-validation objectives: ${e}`) };
|
|
3347
|
+
function isUnderOrEqual(path, prefix) {
|
|
3348
|
+
return path === prefix || path.startsWith(`${prefix}/`);
|
|
3439
3349
|
}
|
|
3440
|
-
function
|
|
3441
|
-
|
|
3442
|
-
const heading = headingRe.exec(body);
|
|
3443
|
-
if (!heading)
|
|
3444
|
-
return null;
|
|
3445
|
-
const afterHeading = body.slice(heading.index + heading[0].length);
|
|
3446
|
-
const next = /^##[ \t]/m.exec(afterHeading);
|
|
3447
|
-
return next ? afterHeading.slice(0, next.index) : afterHeading;
|
|
3350
|
+
function isProductScopeFile(path) {
|
|
3351
|
+
return PRODUCT_SLUG_SCOPE.some((prefix) => isUnderOrEqual(path, prefix));
|
|
3448
3352
|
}
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
const start = text.indexOf("`", i);
|
|
3453
|
-
if (start === -1)
|
|
3454
|
-
return false;
|
|
3455
|
-
const end = text.indexOf("`", start + 1);
|
|
3456
|
-
if (end === -1)
|
|
3457
|
-
return false;
|
|
3458
|
-
if (text.slice(start + 1, end).includes("/"))
|
|
3459
|
-
return true;
|
|
3460
|
-
i = end + 1;
|
|
3461
|
-
}
|
|
3462
|
-
return false;
|
|
3353
|
+
var SHIPS_PREFIX = "aeg-root/";
|
|
3354
|
+
function shipsArchivePrefix(shipsPrefix) {
|
|
3355
|
+
return `${shipsPrefix}tranches/completed/`;
|
|
3463
3356
|
}
|
|
3464
|
-
var
|
|
3465
|
-
function
|
|
3466
|
-
|
|
3357
|
+
var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
|
|
3358
|
+
function normalizeSpecPath(entry) {
|
|
3359
|
+
let out = entry.replace(/\\/g, "/");
|
|
3360
|
+
while (out.startsWith("./"))
|
|
3361
|
+
out = out.slice(2);
|
|
3362
|
+
out = out.replace(/\/{2,}/g, "/");
|
|
3363
|
+
while (out.endsWith("/"))
|
|
3364
|
+
out = out.slice(0, -1);
|
|
3365
|
+
return out;
|
|
3467
3366
|
}
|
|
3468
|
-
function
|
|
3469
|
-
|
|
3367
|
+
function isSpecFile2(path, specPaths) {
|
|
3368
|
+
if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
|
|
3369
|
+
return true;
|
|
3370
|
+
if (!path.endsWith(".md"))
|
|
3371
|
+
return false;
|
|
3372
|
+
return specPaths.some((entry) => isUnderOrEqual(path, normalizeSpecPath(entry)));
|
|
3470
3373
|
}
|
|
3471
|
-
function
|
|
3472
|
-
|
|
3473
|
-
const lastSegment = stripped.split("/").pop() ?? stripped;
|
|
3474
|
-
const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
|
|
3475
|
-
return extMatch !== null && extMatch.index > 0;
|
|
3374
|
+
function isClaudeMdFile(path) {
|
|
3375
|
+
return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
|
|
3476
3376
|
}
|
|
3477
|
-
function
|
|
3478
|
-
|
|
3377
|
+
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
|
|
3378
|
+
if (path.startsWith(shipsPrefix)) {
|
|
3379
|
+
return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
|
|
3380
|
+
}
|
|
3381
|
+
if (path.startsWith(readerFacingPrefix) && path.endsWith(readerFacingSuffix)) {
|
|
3382
|
+
return "reader-facing";
|
|
3383
|
+
}
|
|
3384
|
+
if (isClaudeMdFile(path))
|
|
3385
|
+
return "internal";
|
|
3386
|
+
if (isSpecFile2(path, specPaths))
|
|
3387
|
+
return "spec";
|
|
3388
|
+
if (isProductScopeFile(path))
|
|
3389
|
+
return "product";
|
|
3390
|
+
return null;
|
|
3479
3391
|
}
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
if (
|
|
3483
|
-
return
|
|
3484
|
-
const inLine = /^in:\s*(.+)$/im.exec(section);
|
|
3485
|
-
const outLine = /^out:\s*(.+)$/im.exec(section);
|
|
3486
|
-
const errors = [];
|
|
3487
|
-
if (!inLine)
|
|
3488
|
-
errors.push("`## Surface` has no `in:` line.");
|
|
3489
|
-
if (!outLine)
|
|
3490
|
-
errors.push("`## Surface` has no `out:` line.");
|
|
3491
|
-
if (errors.length > 0)
|
|
3492
|
-
return { ok: false, errors };
|
|
3493
|
-
const inGlobs = splitGlobList(inLine[1]);
|
|
3494
|
-
const outGlobs = splitGlobList(outLine[1]);
|
|
3495
|
-
for (const g of [...inGlobs, ...outGlobs]) {
|
|
3496
|
-
if (looksLikeFilePath(g)) {
|
|
3497
|
-
errors.push(`\`${g}\` in \`## Surface\` looks like a file path — Surface entries are directory-level globs, never file paths.`);
|
|
3498
|
-
}
|
|
3392
|
+
var SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
3393
|
+
function stripNonProse(path, content) {
|
|
3394
|
+
if (path.endsWith(".md")) {
|
|
3395
|
+
return content.replace(/```.*?```/gs, (m) => m.replace(/[^\n]/g, "")).replace(/`[^`\n]*`/g, (m) => m.replace(/[^\n]/g, ""));
|
|
3499
3396
|
}
|
|
3500
|
-
if (
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
return { ok: true, value: { in: inGlobs, out: outGlobs } };
|
|
3397
|
+
if (path.endsWith(".tsx") || path.endsWith(".ts")) {
|
|
3398
|
+
return content.replace(/\/\*.*?\*\//gs, (m) => m.replace(/[^\n]/g, "")).replace(/(^|[^:])\/\/[^\n]*/g, (m) => m.replace(/[^\n]/g, ""));
|
|
3399
|
+
}
|
|
3400
|
+
return content;
|
|
3505
3401
|
}
|
|
3506
|
-
function
|
|
3507
|
-
|
|
3508
|
-
const p = path.replace(/\/+$/, "");
|
|
3509
|
-
if (g === "*")
|
|
3510
|
-
return !p.includes("/");
|
|
3511
|
-
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
3402
|
+
function stripNonProseForProduct(path, content) {
|
|
3403
|
+
return path.endsWith(".md") ? stripNonProse(path, content) : content;
|
|
3512
3404
|
}
|
|
3513
|
-
function
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
for (const glob of surface.value.in) {
|
|
3519
|
-
if (!resolvesToFile(glob)) {
|
|
3520
|
-
errors.push(`issue-validation Surface: \`${glob}\` in \`## Surface\`'s \`in:\` list matches no tracked file — a Surface that cannot resolve cannot render a brief's file list.`);
|
|
3521
|
-
}
|
|
3405
|
+
function lineAt(content, index) {
|
|
3406
|
+
let line = 1;
|
|
3407
|
+
for (let i = 0;i < index; i++) {
|
|
3408
|
+
if (content.charCodeAt(i) === 10)
|
|
3409
|
+
line++;
|
|
3522
3410
|
}
|
|
3523
|
-
return
|
|
3411
|
+
return line;
|
|
3524
3412
|
}
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
}
|
|
3534
|
-
return violations.length > 0 ? { ok: false, violations } : { ok: true };
|
|
3413
|
+
var FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g;
|
|
3414
|
+
var TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g;
|
|
3415
|
+
var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
|
|
3416
|
+
function legacySlugPattern(legacySlugs) {
|
|
3417
|
+
if (legacySlugs.length === 0)
|
|
3418
|
+
return null;
|
|
3419
|
+
const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
3420
|
+
return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
|
|
3535
3421
|
}
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
const
|
|
3542
|
-
const
|
|
3543
|
-
const
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3422
|
+
function specGrandfatherPaths(specGrandfather) {
|
|
3423
|
+
return Array.isArray(specGrandfather) ? [...specGrandfather] : Object.keys(specGrandfather);
|
|
3424
|
+
}
|
|
3425
|
+
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
3426
|
+
const findings = [];
|
|
3427
|
+
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
3428
|
+
const grandfatheredWhole = new Set(Array.isArray(specGrandfather) ? specGrandfather : []);
|
|
3429
|
+
const limits = new Map(Array.isArray(specGrandfather) ? [] : Object.entries(specGrandfather));
|
|
3430
|
+
const patterns = [
|
|
3431
|
+
{ pattern: FORGE_NUMBER_PATTERN, what: "a forge number" },
|
|
3432
|
+
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
|
|
3433
|
+
...legacyPattern ? [{ pattern: legacyPattern, what: "an internal tranche slug", group: 2 }] : []
|
|
3434
|
+
];
|
|
3435
|
+
const productPatterns = [
|
|
3436
|
+
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
|
|
3437
|
+
];
|
|
3438
|
+
const specPatterns = [
|
|
3439
|
+
...patterns,
|
|
3440
|
+
{ pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
|
|
3441
|
+
];
|
|
3442
|
+
for (const file of files) {
|
|
3443
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
|
|
3444
|
+
if (!cls || cls === "internal")
|
|
3445
|
+
continue;
|
|
3446
|
+
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
3447
|
+
continue;
|
|
3448
|
+
if (cls === "spec" && grandfatheredWhole.has(file.path))
|
|
3449
|
+
continue;
|
|
3450
|
+
const blocking = cls === "product" || cls === "spec";
|
|
3451
|
+
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
3452
|
+
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
3453
|
+
const fileFindings = [];
|
|
3454
|
+
for (const { pattern, what, group } of patternsToRun) {
|
|
3455
|
+
pattern.lastIndex = 0;
|
|
3456
|
+
let match = pattern.exec(scrubbed);
|
|
3457
|
+
while (match !== null) {
|
|
3458
|
+
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
3459
|
+
const citedIndex = match.index + match[0].indexOf(cited);
|
|
3460
|
+
fileFindings.push({
|
|
3461
|
+
file: file.path,
|
|
3462
|
+
line: lineAt(scrubbed, citedIndex),
|
|
3463
|
+
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
3464
|
+
blocking
|
|
3465
|
+
});
|
|
3466
|
+
match = pattern.exec(scrubbed);
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3469
|
+
const limit = cls === "spec" ? limits.get(file.path) : undefined;
|
|
3470
|
+
if (limit !== undefined) {
|
|
3471
|
+
if (fileFindings.length <= limit)
|
|
3472
|
+
continue;
|
|
3473
|
+
for (const f of fileFindings) {
|
|
3474
|
+
f.message += `; ${file.path} carries ${fileFindings.length} such findings, over its proseGates.specGrandfather limit of ${limit}`;
|
|
3475
|
+
}
|
|
3476
|
+
}
|
|
3477
|
+
findings.push(...fileFindings);
|
|
3478
|
+
}
|
|
3479
|
+
return findings;
|
|
3480
|
+
}
|
|
3481
|
+
function escapeTerm(term) {
|
|
3482
|
+
return term.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3483
|
+
}
|
|
3484
|
+
function containsWholeWord(text, term) {
|
|
3485
|
+
const escaped = escapeTerm(term);
|
|
3486
|
+
const re = new RegExp(`(^|[^a-zA-Z])${escaped}([^a-zA-Z]|$)`, "i");
|
|
3487
|
+
return re.test(text);
|
|
3488
|
+
}
|
|
3489
|
+
function findWholeWordLine(content, term) {
|
|
3490
|
+
const lines = content.split(`
|
|
3491
|
+
`);
|
|
3492
|
+
let lineNo = 0;
|
|
3493
|
+
for (const line of lines) {
|
|
3494
|
+
lineNo++;
|
|
3495
|
+
if (containsWholeWord(line, term))
|
|
3496
|
+
return lineNo;
|
|
3497
|
+
}
|
|
3498
|
+
return null;
|
|
3499
|
+
}
|
|
3500
|
+
function definesOrLinksGlossary(content, term) {
|
|
3501
|
+
const escaped = escapeTerm(term);
|
|
3502
|
+
const definesInline = new RegExp(`(^|[^a-zA-Z])${escaped}([^a-zA-Z]|$)[^\\n]{0,3}—`, "i").test(content);
|
|
3503
|
+
if (definesInline)
|
|
3504
|
+
return true;
|
|
3505
|
+
return /docs\/glossary|glossary\.md/i.test(content);
|
|
3506
|
+
}
|
|
3507
|
+
function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
|
|
3508
|
+
const findings = [];
|
|
3509
|
+
for (const file of files) {
|
|
3510
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
3511
|
+
if (!cls || !SWEPT_CLASSES.has(cls))
|
|
3512
|
+
continue;
|
|
3513
|
+
const scrubbed = stripNonProse(file.path, file.content);
|
|
3514
|
+
for (const term of glossaryTerms) {
|
|
3515
|
+
const line = findWholeWordLine(scrubbed, term);
|
|
3516
|
+
if (line === null)
|
|
3517
|
+
continue;
|
|
3518
|
+
if (definesOrLinksGlossary(scrubbed, term))
|
|
3519
|
+
continue;
|
|
3520
|
+
findings.push({
|
|
3521
|
+
file: file.path,
|
|
3522
|
+
line,
|
|
3523
|
+
message: `uses coined term "${term}" without defining it inline or linking the glossary`,
|
|
3524
|
+
blocking: false
|
|
3525
|
+
});
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3528
|
+
return findings;
|
|
3529
|
+
}
|
|
3530
|
+
var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = /[a-z0-9]+(?:-[a-z0-9]+)*-v[0-9]+/g;
|
|
3531
|
+
var SOURCE_COMMENT_FORGE_NUMBER_PATTERN = /#[0-9]{2,}/g;
|
|
3532
|
+
function extractComments(path, content) {
|
|
3533
|
+
if (!path.endsWith(".ts") && !path.endsWith(".tsx"))
|
|
3534
|
+
return content.replace(/[^\n]/g, "");
|
|
3535
|
+
let state = "code";
|
|
3536
|
+
let out = "";
|
|
3537
|
+
const n = content.length;
|
|
3538
|
+
let i = 0;
|
|
3539
|
+
const blank = (ch) => ch === `
|
|
3540
|
+
` ? `
|
|
3541
|
+
` : " ";
|
|
3542
|
+
while (i < n) {
|
|
3543
|
+
const c = content[i];
|
|
3544
|
+
const next = i + 1 < n ? content[i + 1] : "";
|
|
3545
|
+
if (state === "code") {
|
|
3546
|
+
if (c === "/" && next === "/") {
|
|
3547
|
+
state = "line-comment";
|
|
3548
|
+
out += c;
|
|
3549
|
+
i++;
|
|
3550
|
+
continue;
|
|
3551
|
+
}
|
|
3552
|
+
if (c === "/" && next === "*") {
|
|
3553
|
+
state = "block-comment";
|
|
3554
|
+
out += c;
|
|
3555
|
+
i++;
|
|
3556
|
+
continue;
|
|
3557
|
+
}
|
|
3558
|
+
if (c === "'") {
|
|
3559
|
+
state = "single-quote";
|
|
3560
|
+
out += blank(c);
|
|
3561
|
+
i++;
|
|
3562
|
+
continue;
|
|
3563
|
+
}
|
|
3564
|
+
if (c === '"') {
|
|
3565
|
+
state = "double-quote";
|
|
3566
|
+
out += blank(c);
|
|
3567
|
+
i++;
|
|
3568
|
+
continue;
|
|
3569
|
+
}
|
|
3570
|
+
if (c === "`") {
|
|
3571
|
+
state = "template";
|
|
3572
|
+
out += blank(c);
|
|
3573
|
+
i++;
|
|
3574
|
+
continue;
|
|
3575
|
+
}
|
|
3576
|
+
out += blank(c);
|
|
3577
|
+
i++;
|
|
3578
|
+
continue;
|
|
3579
|
+
}
|
|
3580
|
+
if (state === "line-comment") {
|
|
3581
|
+
if (c === `
|
|
3582
|
+
`) {
|
|
3583
|
+
state = "code";
|
|
3584
|
+
out += `
|
|
3585
|
+
`;
|
|
3586
|
+
i++;
|
|
3587
|
+
continue;
|
|
3588
|
+
}
|
|
3589
|
+
out += c;
|
|
3590
|
+
i++;
|
|
3591
|
+
continue;
|
|
3592
|
+
}
|
|
3593
|
+
if (state === "block-comment") {
|
|
3594
|
+
if (c === "*" && next === "/") {
|
|
3595
|
+
out += c;
|
|
3596
|
+
out += next;
|
|
3597
|
+
state = "code";
|
|
3598
|
+
i += 2;
|
|
3599
|
+
continue;
|
|
3600
|
+
}
|
|
3601
|
+
out += c === `
|
|
3602
|
+
` ? `
|
|
3603
|
+
` : c;
|
|
3604
|
+
i++;
|
|
3605
|
+
continue;
|
|
3606
|
+
}
|
|
3607
|
+
const closer = state === "single-quote" ? "'" : state === "double-quote" ? '"' : "`";
|
|
3608
|
+
if (c === "\\") {
|
|
3609
|
+
out += blank(c);
|
|
3610
|
+
i++;
|
|
3611
|
+
if (i < n) {
|
|
3612
|
+
out += blank(content[i]);
|
|
3613
|
+
i++;
|
|
3614
|
+
}
|
|
3615
|
+
continue;
|
|
3616
|
+
}
|
|
3617
|
+
if (c === closer) {
|
|
3618
|
+
state = "code";
|
|
3619
|
+
out += blank(c);
|
|
3620
|
+
i++;
|
|
3621
|
+
continue;
|
|
3622
|
+
}
|
|
3623
|
+
out += blank(c);
|
|
3624
|
+
i++;
|
|
3625
|
+
}
|
|
3626
|
+
return out;
|
|
3627
|
+
}
|
|
3628
|
+
function checkSourceComments(files, allowlist = []) {
|
|
3629
|
+
const findings = [];
|
|
3630
|
+
const allowed = new Set(allowlist);
|
|
3631
|
+
const patterns = [
|
|
3632
|
+
{ pattern: SOURCE_COMMENT_TRANCHE_SLUG_PATTERN, what: "a tranche-slug citation" },
|
|
3633
|
+
{ pattern: SOURCE_COMMENT_FORGE_NUMBER_PATTERN, what: "a forge-number citation" }
|
|
3634
|
+
];
|
|
3635
|
+
for (const file of files) {
|
|
3636
|
+
if (!file.path.endsWith(".ts"))
|
|
3637
|
+
continue;
|
|
3638
|
+
if (allowed.has(file.path))
|
|
3639
|
+
continue;
|
|
3640
|
+
const comments = extractComments(file.path, file.content);
|
|
3641
|
+
for (const { pattern, what } of patterns) {
|
|
3642
|
+
pattern.lastIndex = 0;
|
|
3643
|
+
let match = pattern.exec(comments);
|
|
3644
|
+
while (match !== null) {
|
|
3645
|
+
findings.push({
|
|
3646
|
+
file: file.path,
|
|
3647
|
+
line: lineAt(comments, match.index),
|
|
3648
|
+
message: `comment cites ${what} ("${match[0]}") a reader outside this repo's tracker cannot resolve`,
|
|
3649
|
+
blocking: false
|
|
3650
|
+
});
|
|
3651
|
+
match = pattern.exec(comments);
|
|
3652
|
+
}
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3655
|
+
return findings;
|
|
3656
|
+
}
|
|
3657
|
+
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
3658
|
+
return [
|
|
3659
|
+
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
|
|
3660
|
+
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
3661
|
+
];
|
|
3662
|
+
}
|
|
3663
|
+
function parseGlossaryTerms(glossaryContent) {
|
|
3664
|
+
const terms = [];
|
|
3665
|
+
const re = /^\*\*(.+?)\*\* —/gm;
|
|
3666
|
+
let match = re.exec(glossaryContent);
|
|
3667
|
+
while (match !== null) {
|
|
3668
|
+
if (match[1] !== undefined)
|
|
3669
|
+
terms.push(match[1]);
|
|
3670
|
+
match = re.exec(glossaryContent);
|
|
3671
|
+
}
|
|
3672
|
+
return terms;
|
|
3673
|
+
}
|
|
3674
|
+
|
|
3675
|
+
// ../../packages/aeg-core/src/quoted-command.ts
|
|
3676
|
+
var QUOTED_COMMAND_SHIPS_PREFIX = "aeg-root/";
|
|
3677
|
+
var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
3678
|
+
var START_PATTERN = /<!--\s*AEG:QUOTES-FILE:START:(\S+?)\s*-->/g;
|
|
3679
|
+
var END_PATTERN = /<!--\s*AEG:QUOTES-FILE:END\s*-->/;
|
|
3680
|
+
function isValidCitedFilePath(path) {
|
|
3681
|
+
if (path.length === 0)
|
|
3682
|
+
return false;
|
|
3683
|
+
if (path.startsWith("/") || path.startsWith("\\"))
|
|
3684
|
+
return false;
|
|
3685
|
+
if (/^[A-Za-z]:[\\/]/.test(path))
|
|
3686
|
+
return false;
|
|
3687
|
+
return !path.split(/[\\/]+/).includes("..");
|
|
3688
|
+
}
|
|
3689
|
+
function quotedCommandLineAt(content, index) {
|
|
3690
|
+
let line = 1;
|
|
3691
|
+
for (let i = 0;i < index; i++) {
|
|
3692
|
+
if (content.charCodeAt(i) === 10)
|
|
3693
|
+
line++;
|
|
3694
|
+
}
|
|
3695
|
+
return line;
|
|
3696
|
+
}
|
|
3697
|
+
function extractQuotedText(raw) {
|
|
3698
|
+
const trimmed = raw.trim();
|
|
3699
|
+
const fenced = /^(?:`{3,}|~{3,})[^\n]*\n([\s\S]*?)\n?(?:`{3,}|~{3,})$/.exec(trimmed);
|
|
3700
|
+
if (fenced)
|
|
3701
|
+
return (fenced[1] ?? "").trim();
|
|
3702
|
+
const inline = /^`([^`]+)`$/.exec(trimmed);
|
|
3703
|
+
if (inline)
|
|
3704
|
+
return (inline[1] ?? "").trim();
|
|
3705
|
+
return trimmed;
|
|
3706
|
+
}
|
|
3707
|
+
function findQuotesInFile(path, content) {
|
|
3708
|
+
const masked = maskCode(content);
|
|
3709
|
+
const quotes = [];
|
|
3710
|
+
START_PATTERN.lastIndex = 0;
|
|
3711
|
+
let start = START_PATTERN.exec(masked);
|
|
3712
|
+
while (start !== null) {
|
|
3713
|
+
const citedFile = start[1];
|
|
3714
|
+
const innerStart = start.index + start[0].length;
|
|
3715
|
+
const end = END_PATTERN.exec(masked.slice(innerStart));
|
|
3716
|
+
if (end === null) {
|
|
3717
|
+
START_PATTERN.lastIndex = innerStart;
|
|
3718
|
+
start = START_PATTERN.exec(masked);
|
|
3719
|
+
continue;
|
|
3720
|
+
}
|
|
3721
|
+
const innerEnd = innerStart + end.index;
|
|
3722
|
+
if (isValidCitedFilePath(citedFile)) {
|
|
3723
|
+
const quotedText = extractQuotedText(content.slice(innerStart, innerEnd));
|
|
3724
|
+
if (quotedText.length > 0) {
|
|
3725
|
+
quotes.push({ file: path, line: quotedCommandLineAt(content, innerStart), quotedText, citedFile });
|
|
3726
|
+
}
|
|
3727
|
+
}
|
|
3728
|
+
START_PATTERN.lastIndex = innerEnd + end[0].length;
|
|
3729
|
+
start = START_PATTERN.exec(masked);
|
|
3730
|
+
}
|
|
3731
|
+
return quotes;
|
|
3732
|
+
}
|
|
3733
|
+
function findCitedQuotes(files, readerFacingPrefix, readerFacingSuffix, shipsPrefix = QUOTED_COMMAND_SHIPS_PREFIX) {
|
|
3734
|
+
const quotes = [];
|
|
3735
|
+
for (const file of files) {
|
|
3736
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
3737
|
+
if (!cls || !QUOTED_COMMAND_SWEPT_CLASSES.has(cls))
|
|
3738
|
+
continue;
|
|
3739
|
+
quotes.push(...findQuotesInFile(file.path, file.content));
|
|
3740
|
+
}
|
|
3741
|
+
return quotes;
|
|
3742
|
+
}
|
|
3743
|
+
function evaluateCitedQuotes(citedQuotes, citedFileContents) {
|
|
3744
|
+
const findings = [];
|
|
3745
|
+
for (const quote of citedQuotes) {
|
|
3746
|
+
const content = citedFileContents.get(quote.citedFile);
|
|
3747
|
+
if (content === undefined) {
|
|
3748
|
+
findings.push({
|
|
3749
|
+
file: quote.file,
|
|
3750
|
+
line: quote.line,
|
|
3751
|
+
citedFile: quote.citedFile,
|
|
3752
|
+
quotedText: quote.quotedText,
|
|
3753
|
+
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but that file could not be read`
|
|
3754
|
+
});
|
|
3755
|
+
continue;
|
|
3756
|
+
}
|
|
3757
|
+
if (!content.includes(quote.quotedText)) {
|
|
3758
|
+
findings.push({
|
|
3759
|
+
file: quote.file,
|
|
3760
|
+
line: quote.line,
|
|
3761
|
+
citedFile: quote.citedFile,
|
|
3762
|
+
quotedText: quote.quotedText,
|
|
3763
|
+
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but \`${quote.citedFile}\` no longer contains that text verbatim`
|
|
3764
|
+
});
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3767
|
+
return findings;
|
|
3768
|
+
}
|
|
3769
|
+
|
|
3770
|
+
// ../../packages/aeg-core/src/issue-validation.ts
|
|
3771
|
+
function hasRationaleField(body, labelPattern) {
|
|
3772
|
+
const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})`, "im");
|
|
3773
|
+
return re.test(body);
|
|
3774
|
+
}
|
|
3775
|
+
var RATIONALE_FIELDS = [
|
|
3776
|
+
{ name: "Boundary", pattern: "Boundary" },
|
|
3777
|
+
{ name: "Sizing", pattern: "Sizing" },
|
|
3778
|
+
{ name: "Project(s) + blast radius", pattern: "Project\\(s\\)|Project(?:s)?\\s*\\+|blast radius" },
|
|
3779
|
+
{ name: "Dependency rationale", pattern: "Dependency rationale|Depends[- ]on" },
|
|
3780
|
+
{ name: "Traps to avoid", pattern: "Traps" },
|
|
3781
|
+
{ name: "Suggested agent-class", pattern: "(?:Suggested\\s+)?agent-class" },
|
|
3782
|
+
{ name: "Stop-and-escalate", pattern: "Stop-and-escalate" },
|
|
3783
|
+
{ name: "Docs to keep coherent", pattern: "Docs to keep coherent|§7" }
|
|
3784
|
+
];
|
|
3785
|
+
var DEPENDENCY_RATIONALE_FIELD_NAME = "Dependency rationale";
|
|
3786
|
+
function checkIssueRationale(body) {
|
|
3787
|
+
const errors = [];
|
|
3788
|
+
for (const f of RATIONALE_FIELDS) {
|
|
3789
|
+
if (!hasRationaleField(body, f.pattern)) {
|
|
3790
|
+
errors.push(`issue-validation ${f.name}: rationale field not found in the Issue body — every task Issue carries the full Planner's rationale (aeg-root/contracts/planner-brief.md).`);
|
|
3791
|
+
continue;
|
|
3792
|
+
}
|
|
3793
|
+
if (f.name === DEPENDENCY_RATIONALE_FIELD_NAME && !SECTION_HEADER.test(body)) {
|
|
3794
|
+
errors.push(`issue-validation ${f.name}: rationale field found, but not in the form amend-deps requires — ` + "write `**Dependency rationale** — …`, not `**Dependency rationale:** …`. " + "`amendRationaleDeps` (the only sanctioned way to edit Depends-on/Conflicts-with) locates this " + "section by the exact anchor `**Dependency rationale**`; a colon inside the bold breaks that match " + "and the Issue becomes unamendable.");
|
|
3795
|
+
}
|
|
3796
|
+
}
|
|
3797
|
+
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3798
|
+
}
|
|
3799
|
+
var OBJECTIVES_SINCE_ISSUE = 404;
|
|
3800
|
+
function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
|
|
3801
|
+
if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
|
|
3802
|
+
return { status: "pass", errors: [] };
|
|
3803
|
+
const result = objectivesOf(body);
|
|
3804
|
+
if (result.ok)
|
|
3805
|
+
return { status: "pass", errors: [] };
|
|
3806
|
+
return { status: "fail", errors: result.errors.map((e) => `issue-validation objectives: ${e}`) };
|
|
3807
|
+
}
|
|
3808
|
+
function topLevelSectionText(body, headingName) {
|
|
3809
|
+
const headingRe = new RegExp(`^##[ \\t]*${headingName}[ \\t]*$`, "im");
|
|
3810
|
+
const heading = headingRe.exec(body);
|
|
3811
|
+
if (!heading)
|
|
3812
|
+
return null;
|
|
3813
|
+
const afterHeading = body.slice(heading.index + heading[0].length);
|
|
3814
|
+
const next = /^##[ \t]/m.exec(afterHeading);
|
|
3815
|
+
return next ? afterHeading.slice(0, next.index) : afterHeading;
|
|
3816
|
+
}
|
|
3817
|
+
function partHasBacktickedPath(text) {
|
|
3818
|
+
let i = 0;
|
|
3819
|
+
while (i < text.length) {
|
|
3820
|
+
const start = text.indexOf("`", i);
|
|
3821
|
+
if (start === -1)
|
|
3822
|
+
return false;
|
|
3823
|
+
const end = text.indexOf("`", start + 1);
|
|
3824
|
+
if (end === -1)
|
|
3825
|
+
return false;
|
|
3826
|
+
if (text.slice(start + 1, end).includes("/"))
|
|
3827
|
+
return true;
|
|
3828
|
+
i = end + 1;
|
|
3829
|
+
}
|
|
3830
|
+
return false;
|
|
3831
|
+
}
|
|
3832
|
+
var PART_MIN_WORDS_OUTSIDE_BACKTICKS = 3;
|
|
3833
|
+
function stripPartBackticks(text) {
|
|
3834
|
+
return text.replace(/`[^`\n]*`/g, " ");
|
|
3835
|
+
}
|
|
3836
|
+
function partWordCount(text) {
|
|
3837
|
+
return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
|
|
3838
|
+
}
|
|
3839
|
+
function looksLikeFilePath(entry) {
|
|
3840
|
+
const stripped = entry.replace(/\/\*\*?$/, "");
|
|
3841
|
+
const lastSegment = stripped.split("/").pop() ?? stripped;
|
|
3842
|
+
const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
|
|
3843
|
+
return extMatch !== null && extMatch.index > 0;
|
|
3844
|
+
}
|
|
3845
|
+
function splitGlobList(raw) {
|
|
3846
|
+
return raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
3847
|
+
}
|
|
3848
|
+
function parseIssueSurface(body) {
|
|
3849
|
+
const section = topLevelSectionText(body, "Surface");
|
|
3850
|
+
if (section === null)
|
|
3851
|
+
return { ok: false, errors: ["no `## Surface` heading found in the body."] };
|
|
3852
|
+
const inLine = /^in:\s*(.+)$/im.exec(section);
|
|
3853
|
+
const outLine = /^out:\s*(.+)$/im.exec(section);
|
|
3854
|
+
const errors = [];
|
|
3855
|
+
if (!inLine)
|
|
3856
|
+
errors.push("`## Surface` has no `in:` line.");
|
|
3857
|
+
if (!outLine)
|
|
3858
|
+
errors.push("`## Surface` has no `out:` line.");
|
|
3859
|
+
if (errors.length > 0)
|
|
3860
|
+
return { ok: false, errors };
|
|
3861
|
+
const inGlobs = splitGlobList(inLine[1]);
|
|
3862
|
+
const outGlobs = splitGlobList(outLine[1]);
|
|
3863
|
+
for (const g of [...inGlobs, ...outGlobs]) {
|
|
3864
|
+
if (looksLikeFilePath(g)) {
|
|
3865
|
+
errors.push(`\`${g}\` in \`## Surface\` looks like a file path — Surface entries are directory-level globs, never file paths.`);
|
|
3866
|
+
}
|
|
3867
|
+
}
|
|
3868
|
+
if (inGlobs.length === 0)
|
|
3869
|
+
errors.push("`## Surface`'s `in:` line resolved to zero globs.");
|
|
3870
|
+
if (errors.length > 0)
|
|
3871
|
+
return { ok: false, errors };
|
|
3872
|
+
return { ok: true, value: { in: inGlobs, out: outGlobs } };
|
|
3873
|
+
}
|
|
3874
|
+
function globCoversPath(glob, path) {
|
|
3875
|
+
const g = glob.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
|
|
3876
|
+
const p = path.replace(/\/+$/, "");
|
|
3877
|
+
if (g === "*")
|
|
3878
|
+
return !p.includes("/");
|
|
3879
|
+
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
3880
|
+
}
|
|
3881
|
+
function checkSurfaceGlobsResolve(body, resolvesToFile) {
|
|
3882
|
+
const surface = parseIssueSurface(body);
|
|
3883
|
+
if (!surface.ok)
|
|
3884
|
+
return { status: "pass", errors: [] };
|
|
3885
|
+
const errors = [];
|
|
3886
|
+
for (const glob of surface.value.in) {
|
|
3887
|
+
if (!resolvesToFile(glob)) {
|
|
3888
|
+
errors.push(`issue-validation Surface: \`${glob}\` in \`## Surface\`'s \`in:\` list matches no tracked file — a Surface that cannot resolve cannot render a brief's file list.`);
|
|
3889
|
+
}
|
|
3890
|
+
}
|
|
3891
|
+
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3892
|
+
}
|
|
3893
|
+
function checkSurfaceScope(changedFiles, outGlobs) {
|
|
3894
|
+
if (outGlobs.length === 0)
|
|
3895
|
+
return { ok: true };
|
|
3896
|
+
const violations = [];
|
|
3897
|
+
for (const file of changedFiles) {
|
|
3898
|
+
const glob = outGlobs.find((g) => globCoversPath(g, file));
|
|
3899
|
+
if (glob)
|
|
3900
|
+
violations.push({ file, glob });
|
|
3901
|
+
}
|
|
3902
|
+
return violations.length > 0 ? { ok: false, violations } : { ok: true };
|
|
3903
|
+
}
|
|
3904
|
+
var ISSUE_PART_LINE_RE = /^Part\s+(\d+)\s*\(([^)]*)\)\s*[-—–]\s*(.*)$/i;
|
|
3905
|
+
function parseIssueParts(body) {
|
|
3906
|
+
const section = topLevelSectionText(body, "Parts");
|
|
3907
|
+
if (section === null)
|
|
3908
|
+
return { ok: false, errors: ["no `## Parts` heading found in the body."] };
|
|
3909
|
+
const lines = section.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0);
|
|
3910
|
+
const parts = [];
|
|
3911
|
+
const errors = [];
|
|
3912
|
+
for (const line of lines) {
|
|
3913
|
+
const m = ISSUE_PART_LINE_RE.exec(line);
|
|
3914
|
+
if (!m) {
|
|
3915
|
+
errors.push(`"${line}" is not a well-formed Parts line — expected \`Part <n> (<refs>) — <outcome>\`.`);
|
|
3916
|
+
continue;
|
|
3917
|
+
}
|
|
3918
|
+
const n = Number.parseInt(m[1], 10);
|
|
3919
|
+
const refs = m[2];
|
|
3920
|
+
const text = m[3].trim();
|
|
3921
|
+
if (text.length === 0) {
|
|
3922
|
+
errors.push(`Part ${n} has no outcome text after the dash — every Part states one observable outcome.`);
|
|
3555
3923
|
continue;
|
|
3556
3924
|
}
|
|
3557
3925
|
if (partHasBacktickedPath(text) && partWordCount(stripPartBackticks(text)) < PART_MIN_WORDS_OUTSIDE_BACKTICKS) {
|
|
@@ -3667,6 +4035,27 @@ function checkProjectsRegistered(body, _labels, registeredNames) {
|
|
|
3667
4035
|
}
|
|
3668
4036
|
var DOC_PATH_RE = /(?:(?:aeg-root|apps|packages|specs|docs|tools|\.claude|\.github)\/[\w./@-]*\.(?:md|mdx)|\.claude\/(?:skills|rules)\/[\w./-]+|\b(?:docs-index|decisions|projects|state-machine|enforcement|process|README|CLAUDE)\.md\b|\b[\w-]+-(?:spec|decisions|backlog)\.md\b)/i;
|
|
3669
4037
|
var DOC_PATH_RE_GLOBAL = new RegExp(DOC_PATH_RE.source, "gi");
|
|
4038
|
+
var FILE_EXTENSIONS = new Set([
|
|
4039
|
+
"ts",
|
|
4040
|
+
"tsx",
|
|
4041
|
+
"js",
|
|
4042
|
+
"jsx",
|
|
4043
|
+
"mjs",
|
|
4044
|
+
"cjs",
|
|
4045
|
+
"json",
|
|
4046
|
+
"jsonc",
|
|
4047
|
+
"md",
|
|
4048
|
+
"mdx",
|
|
4049
|
+
"yml",
|
|
4050
|
+
"yaml",
|
|
4051
|
+
"txt",
|
|
4052
|
+
"sh",
|
|
4053
|
+
"lock",
|
|
4054
|
+
"toml",
|
|
4055
|
+
"ndjson",
|
|
4056
|
+
"html",
|
|
4057
|
+
"css"
|
|
4058
|
+
]);
|
|
3670
4059
|
|
|
3671
4060
|
// ../../packages/aeg-core/src/task-branch-identity.ts
|
|
3672
4061
|
var ISSUE_BRANCH_PATTERN = /^task\/issue-(\d+)$/;
|
|
@@ -4045,8 +4434,7 @@ function briefHash(brief) {
|
|
|
4045
4434
|
function policyDigest(policy) {
|
|
4046
4435
|
return createHash4("sha256").update(JSON.stringify({
|
|
4047
4436
|
codeReviewThreshold: policy.codeReviewThreshold,
|
|
4048
|
-
securityThreshold: policy.securityThreshold
|
|
4049
|
-
maxRounds: policy.maxRounds
|
|
4437
|
+
securityThreshold: policy.securityThreshold
|
|
4050
4438
|
})).digest("hex");
|
|
4051
4439
|
}
|
|
4052
4440
|
function isBoundToHead(echoed, headSha) {
|
|
@@ -4112,6 +4500,15 @@ function compareManifest(echoed, current, patchIdOf) {
|
|
|
4112
4500
|
}
|
|
4113
4501
|
|
|
4114
4502
|
// ../../packages/aeg-core/src/review-gate.ts
|
|
4503
|
+
function renderGateDeferred(deferred) {
|
|
4504
|
+
if (deferred.length === 0)
|
|
4505
|
+
return "";
|
|
4506
|
+
const items = deferred.map((d) => {
|
|
4507
|
+
const where = d.finding.location && d.finding.location.length > 0 ? d.finding.location : "(no location)";
|
|
4508
|
+
return `${d.finding.severity} ${where} (${DEFERRAL_REASON_TEXT[d.reason]})`;
|
|
4509
|
+
}).join("; ");
|
|
4510
|
+
return ` ${deferred.length} finding(s) deferred, not blocking this round: ${items}.`;
|
|
4511
|
+
}
|
|
4115
4512
|
function checkReviewGate(input) {
|
|
4116
4513
|
const principalAllowlist = input.principalAllowlist ?? PRINCIPAL_ALLOWLIST;
|
|
4117
4514
|
const waived = isWaiverLabelActorVerified({
|
|
@@ -4136,8 +4533,8 @@ function checkReviewGate(input) {
|
|
|
4136
4533
|
let codeReviewPolicyEvaluation;
|
|
4137
4534
|
let securityPolicyEvaluation;
|
|
4138
4535
|
try {
|
|
4139
|
-
codeReviewPolicyEvaluation = evaluateCodeReview(consequentialFindings(codeReview.findingSeverities), policy);
|
|
4140
|
-
securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy);
|
|
4536
|
+
codeReviewPolicyEvaluation = evaluateCodeReview(consequentialFindings(codeReview.findingSeverities), policy, input.deferralContext);
|
|
4537
|
+
securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy, input.deferralContext);
|
|
4141
4538
|
} catch (err) {
|
|
4142
4539
|
return {
|
|
4143
4540
|
verdict: "fail",
|
|
@@ -4183,10 +4580,14 @@ function checkReviewGate(input) {
|
|
|
4183
4580
|
const securityObjectivesBound = securityBinding.objectivesVersion;
|
|
4184
4581
|
const codeReviewRulingsBound = codeReviewBinding.rulingOrdinal;
|
|
4185
4582
|
const securityRulingsBound = securityBinding.rulingOrdinal;
|
|
4583
|
+
const deferredNote = renderGateDeferred([
|
|
4584
|
+
...codeReviewPolicyEvaluation.deferredFindings,
|
|
4585
|
+
...securityPolicyEvaluation.deferredFindings
|
|
4586
|
+
]);
|
|
4186
4587
|
if (codeReviewClean && codeReviewBinding.bound && securityClean && securityBinding.bound) {
|
|
4187
4588
|
return {
|
|
4188
4589
|
verdict: "pass",
|
|
4189
|
-
reason: `code-reviewer verdict is a clean APPROVE and security-review verdict is a clean PASS, both covering head ${input.headSha}
|
|
4590
|
+
reason: `code-reviewer verdict is a clean APPROVE and security-review verdict is a clean PASS, both covering head ${input.headSha}.${deferredNote}`,
|
|
4190
4591
|
waived: false
|
|
4191
4592
|
};
|
|
4192
4593
|
}
|
|
@@ -4228,7 +4629,7 @@ function checkReviewGate(input) {
|
|
|
4228
4629
|
const ignoredNote = ignoredCount > 0 ? ` ${ignoredCount} verdict-shaped comment(s) from authors outside the principal allowlist were ignored.` : "";
|
|
4229
4630
|
return {
|
|
4230
4631
|
verdict: "fail",
|
|
4231
|
-
reason: `${problems.join("; ")}. A principal can apply an actor-verified \`${WAIVER_LABEL_REVIEW}\` label to skip this requirement, or post the missing/clean verdict comment(s).${ignoredNote}`,
|
|
4632
|
+
reason: `${problems.join("; ")}. A principal can apply an actor-verified \`${WAIVER_LABEL_REVIEW}\` label to skip this requirement, or post the missing/clean verdict comment(s).${ignoredNote}${deferredNote}`,
|
|
4232
4633
|
waived: false
|
|
4233
4634
|
};
|
|
4234
4635
|
}
|
|
@@ -4302,610 +4703,235 @@ import matter from "gray-matter";
|
|
|
4302
4703
|
var RING_HEADINGS = [
|
|
4303
4704
|
{ ring: "ring0", pattern: /^##\s+Ring 0\b/ },
|
|
4304
4705
|
{ ring: "ring1", pattern: /^##\s+Ring 1\b/ },
|
|
4305
|
-
{ ring: "ring2", pattern: /^##\s+Ring 2\b/ }
|
|
4306
|
-
];
|
|
4307
|
-
function stripBackticks2(cell) {
|
|
4308
|
-
const trimmed = cell.trim();
|
|
4309
|
-
if (trimmed.length >= 2 && trimmed.startsWith("`") && trimmed.endsWith("`")) {
|
|
4310
|
-
return trimmed.slice(1, -1);
|
|
4311
|
-
}
|
|
4312
|
-
return trimmed;
|
|
4313
|
-
}
|
|
4314
|
-
function stripBold(cell) {
|
|
4315
|
-
return cell.trim().replace(/\*\*/g, "");
|
|
4316
|
-
}
|
|
4317
|
-
function parseEnforcementRegistry(content) {
|
|
4318
|
-
const lines = content.split(`
|
|
4319
|
-
`);
|
|
4320
|
-
const result = [];
|
|
4321
|
-
for (const { ring, pattern } of RING_HEADINGS) {
|
|
4322
|
-
const headingLine = findHeadingLine(lines, pattern);
|
|
4323
|
-
if (headingLine === null)
|
|
4324
|
-
continue;
|
|
4325
|
-
const table = findTable(lines, headingLine + 1);
|
|
4326
|
-
if (!table)
|
|
4327
|
-
continue;
|
|
4328
|
-
const descriptionIndex = table.headers.findIndex((h) => h.trim().toLowerCase() === "description");
|
|
4329
|
-
const implementationIndex = table.headers.findIndex((h) => h.trim().toLowerCase() === "implementation");
|
|
4330
|
-
const audienceIndex = table.headers.findIndex((h) => h.trim().toLowerCase() === "audience");
|
|
4331
|
-
for (const row of table.rows) {
|
|
4332
|
-
const cells = row.cells;
|
|
4333
|
-
if (cells.length < 3)
|
|
4334
|
-
continue;
|
|
4335
|
-
const action = stripBold(cells[0] ?? "");
|
|
4336
|
-
const summary = stripBackticks2(cells[1] ?? "");
|
|
4337
|
-
const category = stripBackticks2(cells[2] ?? "");
|
|
4338
|
-
const implementation = stripBackticks2((implementationIndex === -1 ? cells[cells.length - 1] : cells[implementationIndex]) ?? "");
|
|
4339
|
-
const description = descriptionIndex === -1 ? undefined : stripBackticks2(cells[descriptionIndex] ?? "") || undefined;
|
|
4340
|
-
const specIndex = (audienceIndex === -1 ? cells.length - 1 : audienceIndex) - 1;
|
|
4341
|
-
const spec = specIndex >= 3 ? stripBackticks2(cells[specIndex] ?? "") || undefined : undefined;
|
|
4342
|
-
const audience = audienceIndex === -1 ? "repo-own" : stripBackticks2(cells[audienceIndex] ?? "") === "product" ? "product" : "repo-own";
|
|
4343
|
-
result.push({ ring, action, summary, category, description, spec, implementation, audience, line: row.line });
|
|
4344
|
-
}
|
|
4345
|
-
}
|
|
4346
|
-
return result;
|
|
4347
|
-
}
|
|
4348
|
-
// ../../packages/aeg-core/src/registry-checks.ts
|
|
4349
|
-
function checkG1(rows, existsFn) {
|
|
4350
|
-
const findings = [];
|
|
4351
|
-
for (const row of rows) {
|
|
4352
|
-
if (row.implementation === "")
|
|
4353
|
-
continue;
|
|
4354
|
-
if (!existsFn(row.implementation)) {
|
|
4355
|
-
findings.push({
|
|
4356
|
-
row: row.action,
|
|
4357
|
-
path: row.implementation,
|
|
4358
|
-
reason: `${row.ring} row "${row.action}" names implementation "${row.implementation}", which does not exist on disk`
|
|
4359
|
-
});
|
|
4360
|
-
}
|
|
4361
|
-
}
|
|
4362
|
-
return { check: "G1", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4363
|
-
}
|
|
4364
|
-
var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
|
|
4365
|
-
var NON_GATE_BIN_NAMES = NON_GATE_BINS;
|
|
4366
|
-
var TWIN_CANDIDATE_EXCEPTIONS = {
|
|
4367
|
-
"apps/cli/src/checks/bin/check-dead-branch-push.ts": 'Ring 0 "Pushing to a branch whose pull request already resolved" (implementation: check-push-target.ts)',
|
|
4368
|
-
"apps/cli/src/checks/bin/check-issue-assignment.ts": `Ring 0 "A task branch's first push (Issue self-assignment)" (implementation: assign-task-issue.ts)`,
|
|
4369
|
-
"apps/cli/src/checks/bin/check-closes-n.ts": 'Ring 1 "Closes linkage" (implementation: verify-coherence.ts)'
|
|
4370
|
-
};
|
|
4371
|
-
var NON_GATE_HOOK_SCRIPTS = [".claude/hooks/track-transcript.sh"];
|
|
4372
|
-
function checkG2(rows, candidateFiles) {
|
|
4373
|
-
const implementations = new Set(rows.map((r) => r.implementation).filter((p) => p !== ""));
|
|
4374
|
-
const claimedNames = new Set(rows.flatMap((r) => claimedCheckNames(r.implementation)));
|
|
4375
|
-
const findings = [];
|
|
4376
|
-
for (const path of candidateFiles) {
|
|
4377
|
-
if (implementations.has(path))
|
|
4378
|
-
continue;
|
|
4379
|
-
if (path.startsWith(AEG_CORE_BIN_PATH_PREFIX) && NON_GATE_BIN_NAMES.includes(basenameNoExt(path)))
|
|
4380
|
-
continue;
|
|
4381
|
-
if (NON_GATE_HOOK_SCRIPTS.includes(path))
|
|
4382
|
-
continue;
|
|
4383
|
-
if (path in TWIN_CANDIDATE_EXCEPTIONS)
|
|
4384
|
-
continue;
|
|
4385
|
-
const candidateNames = claimedCheckNames(path);
|
|
4386
|
-
if (candidateNames.length > 0 && candidateNames.some((n) => claimedNames.has(n)))
|
|
4387
|
-
continue;
|
|
4388
|
-
findings.push({
|
|
4389
|
-
path,
|
|
4390
|
-
reason: `"${path}" is not named as the implementation of any row in enforcement.md's ring tables`
|
|
4391
|
-
});
|
|
4392
|
-
}
|
|
4393
|
-
for (const row of rows) {
|
|
4394
|
-
const carriesPlaceholder = [row.summary, row.description, row.spec].some((cell) => cell === SCAFFOLD_PLACEHOLDER);
|
|
4395
|
-
if (carriesPlaceholder) {
|
|
4396
|
-
findings.push({
|
|
4397
|
-
row: row.action,
|
|
4398
|
-
path: row.implementation,
|
|
4399
|
-
reason: `${row.ring} row "${row.action}" still carries the scaffold placeholder marker — the why is owed`
|
|
4400
|
-
});
|
|
4401
|
-
}
|
|
4402
|
-
}
|
|
4403
|
-
return { check: "G2", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4404
|
-
}
|
|
4405
|
-
function checkG3(ring0Rows, crossingFiles) {
|
|
4406
|
-
const ring0Implementations = new Set(ring0Rows.map((r) => r.implementation));
|
|
4407
|
-
const findings = [];
|
|
4408
|
-
for (const path of crossingFiles) {
|
|
4409
|
-
if (!ring0Implementations.has(path)) {
|
|
4410
|
-
findings.push({
|
|
4411
|
-
path,
|
|
4412
|
-
reason: `"${path}" makes a GitHub-crossing call but is not named by any Ring-0 row's implementation — a seventh, unlisted way into GitHub`
|
|
4413
|
-
});
|
|
4414
|
-
}
|
|
4415
|
-
}
|
|
4416
|
-
return { check: "G3", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4417
|
-
}
|
|
4418
|
-
function checkG4(content, resolveFn) {
|
|
4419
|
-
const cited = new Set;
|
|
4420
|
-
for (const hit of content.matchAll(/#(\d{3,})\b/g)) {
|
|
4421
|
-
cited.add(Number(hit[1]));
|
|
4422
|
-
}
|
|
4423
|
-
const findings = [];
|
|
4424
|
-
for (const n of cited) {
|
|
4425
|
-
if (!resolveFn(n)) {
|
|
4426
|
-
findings.push({
|
|
4427
|
-
reason: `#${n} is cited in enforcement.md but does not resolve to a real Issue or PR in the forge`
|
|
4428
|
-
});
|
|
4429
|
-
}
|
|
4430
|
-
}
|
|
4431
|
-
return { check: "G4", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4432
|
-
}
|
|
4433
|
-
function checkG5(roles, contracts) {
|
|
4434
|
-
const roleIds = new Set(roles.map((r) => r.role_id));
|
|
4435
|
-
const findings = [];
|
|
4436
|
-
for (const contract of contracts) {
|
|
4437
|
-
if (!roleIds.has(contract.producer)) {
|
|
4438
|
-
findings.push({
|
|
4439
|
-
path: contract.file,
|
|
4440
|
-
reason: `contract "${contract.file}" names producer "${contract.producer}", which is not a real role_id`
|
|
4441
|
-
});
|
|
4442
|
-
}
|
|
4443
|
-
if (!roleIds.has(contract.consumer)) {
|
|
4444
|
-
findings.push({
|
|
4445
|
-
path: contract.file,
|
|
4446
|
-
reason: `contract "${contract.file}" names consumer "${contract.consumer}", which is not a real role_id`
|
|
4447
|
-
});
|
|
4448
|
-
}
|
|
4449
|
-
}
|
|
4450
|
-
for (const role of roles) {
|
|
4451
|
-
if (role.performs.length === 0) {
|
|
4452
|
-
findings.push({ path: role.file, reason: `role "${role.role_id}" has an empty performs array` });
|
|
4453
|
-
}
|
|
4454
|
-
if (role.refuses_when.trim() === "") {
|
|
4455
|
-
findings.push({ path: role.file, reason: `role "${role.role_id}" has an empty refuses_when` });
|
|
4456
|
-
}
|
|
4457
|
-
}
|
|
4458
|
-
return { check: "G5", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4459
|
-
}
|
|
4460
|
-
var SHIPPED_BIN_PATH_PREFIX = "apps/cli/src/checks/bin/check-";
|
|
4461
|
-
var AEG_CORE_BIN_PATH_PREFIX = "packages/aeg-core/bin/";
|
|
4462
|
-
function basenameNoExt(path) {
|
|
4463
|
-
const base = path.slice(path.lastIndexOf("/") + 1);
|
|
4464
|
-
return base.replace(/\.ts$/, "");
|
|
4465
|
-
}
|
|
4466
|
-
function claimedCheckNames(implementation) {
|
|
4467
|
-
if (implementation.startsWith(SHIPPED_BIN_PATH_PREFIX) && implementation.endsWith(".ts")) {
|
|
4468
|
-
return [implementation.slice(SHIPPED_BIN_PATH_PREFIX.length, -".ts".length)];
|
|
4469
|
-
}
|
|
4470
|
-
if (implementation.startsWith(AEG_CORE_BIN_PATH_PREFIX)) {
|
|
4471
|
-
const audience = GATE_AUDIENCE[basenameNoExt(implementation)];
|
|
4472
|
-
if (audience && isShipped(audience)) {
|
|
4473
|
-
return Array.isArray(audience.shippedAs) ? audience.shippedAs : [audience.shippedAs];
|
|
4474
|
-
}
|
|
4475
|
-
}
|
|
4476
|
-
return [];
|
|
4477
|
-
}
|
|
4478
|
-
function checkG6(rows, registeredCheckNames) {
|
|
4479
|
-
const findings = [];
|
|
4480
|
-
for (const row of rows) {
|
|
4481
|
-
if (row.audience !== "product")
|
|
4482
|
-
continue;
|
|
4483
|
-
const candidates = claimedCheckNames(row.implementation);
|
|
4484
|
-
if (!candidates.some((name) => registeredCheckNames.has(name))) {
|
|
4485
|
-
findings.push({
|
|
4486
|
-
row: row.action,
|
|
4487
|
-
path: row.implementation,
|
|
4488
|
-
reason: `${row.ring} row "${row.action}" is marked \`product\` but its implementation "${row.implementation}" does not resolve to a coreCheckRegistry() entry`
|
|
4489
|
-
});
|
|
4490
|
-
}
|
|
4491
|
-
}
|
|
4492
|
-
return { check: "G6", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4493
|
-
}
|
|
4494
|
-
// ../../packages/aeg-core/src/reader-resolvable-prose.ts
|
|
4495
|
-
var PRODUCT_SLUG_SCOPE = [
|
|
4496
|
-
"apps/cli/src",
|
|
4497
|
-
".github/workflows",
|
|
4498
|
-
".vinaya",
|
|
4499
|
-
"apps/cli/README.md",
|
|
4500
|
-
"packages/sources/README.md"
|
|
4501
|
-
];
|
|
4502
|
-
function isUnderOrEqual(path, prefix) {
|
|
4503
|
-
return path === prefix || path.startsWith(`${prefix}/`);
|
|
4504
|
-
}
|
|
4505
|
-
function isProductScopeFile(path) {
|
|
4506
|
-
return PRODUCT_SLUG_SCOPE.some((prefix) => isUnderOrEqual(path, prefix));
|
|
4507
|
-
}
|
|
4508
|
-
var SHIPS_PREFIX = "aeg-root/";
|
|
4509
|
-
function shipsArchivePrefix(shipsPrefix) {
|
|
4510
|
-
return `${shipsPrefix}tranches/completed/`;
|
|
4511
|
-
}
|
|
4512
|
-
var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
|
|
4513
|
-
function normalizeSpecPath(entry) {
|
|
4514
|
-
let out = entry.replace(/\\/g, "/");
|
|
4515
|
-
while (out.startsWith("./"))
|
|
4516
|
-
out = out.slice(2);
|
|
4517
|
-
out = out.replace(/\/{2,}/g, "/");
|
|
4518
|
-
while (out.endsWith("/"))
|
|
4519
|
-
out = out.slice(0, -1);
|
|
4520
|
-
return out;
|
|
4521
|
-
}
|
|
4522
|
-
function isSpecFile2(path, specPaths) {
|
|
4523
|
-
if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
|
|
4524
|
-
return true;
|
|
4525
|
-
if (!path.endsWith(".md"))
|
|
4526
|
-
return false;
|
|
4527
|
-
return specPaths.some((entry) => isUnderOrEqual(path, normalizeSpecPath(entry)));
|
|
4528
|
-
}
|
|
4529
|
-
function isClaudeMdFile(path) {
|
|
4530
|
-
return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
|
|
4531
|
-
}
|
|
4532
|
-
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
|
|
4533
|
-
if (path.startsWith(shipsPrefix)) {
|
|
4534
|
-
return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
|
|
4535
|
-
}
|
|
4536
|
-
if (path.startsWith(readerFacingPrefix) && path.endsWith(readerFacingSuffix)) {
|
|
4537
|
-
return "reader-facing";
|
|
4538
|
-
}
|
|
4539
|
-
if (isClaudeMdFile(path))
|
|
4540
|
-
return "internal";
|
|
4541
|
-
if (isSpecFile2(path, specPaths))
|
|
4542
|
-
return "spec";
|
|
4543
|
-
if (isProductScopeFile(path))
|
|
4544
|
-
return "product";
|
|
4545
|
-
return null;
|
|
4546
|
-
}
|
|
4547
|
-
var SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
4548
|
-
function stripNonProse(path, content) {
|
|
4549
|
-
if (path.endsWith(".md")) {
|
|
4550
|
-
return content.replace(/```.*?```/gs, (m) => m.replace(/[^\n]/g, "")).replace(/`[^`\n]*`/g, (m) => m.replace(/[^\n]/g, ""));
|
|
4706
|
+
{ ring: "ring2", pattern: /^##\s+Ring 2\b/ }
|
|
4707
|
+
];
|
|
4708
|
+
function stripBackticks2(cell) {
|
|
4709
|
+
const trimmed = cell.trim();
|
|
4710
|
+
if (trimmed.length >= 2 && trimmed.startsWith("`") && trimmed.endsWith("`")) {
|
|
4711
|
+
return trimmed.slice(1, -1);
|
|
4551
4712
|
}
|
|
4552
|
-
|
|
4553
|
-
|
|
4713
|
+
return trimmed;
|
|
4714
|
+
}
|
|
4715
|
+
function stripBold(cell) {
|
|
4716
|
+
return cell.trim().replace(/\*\*/g, "");
|
|
4717
|
+
}
|
|
4718
|
+
function parseEnforcementRegistry(content) {
|
|
4719
|
+
const lines = content.split(`
|
|
4720
|
+
`);
|
|
4721
|
+
const result = [];
|
|
4722
|
+
for (const { ring, pattern } of RING_HEADINGS) {
|
|
4723
|
+
const headingLine = findHeadingLine(lines, pattern);
|
|
4724
|
+
if (headingLine === null)
|
|
4725
|
+
continue;
|
|
4726
|
+
const table = findTable(lines, headingLine + 1);
|
|
4727
|
+
if (!table)
|
|
4728
|
+
continue;
|
|
4729
|
+
const descriptionIndex = table.headers.findIndex((h) => h.trim().toLowerCase() === "description");
|
|
4730
|
+
const implementationIndex = table.headers.findIndex((h) => h.trim().toLowerCase() === "implementation");
|
|
4731
|
+
const audienceIndex = table.headers.findIndex((h) => h.trim().toLowerCase() === "audience");
|
|
4732
|
+
for (const row of table.rows) {
|
|
4733
|
+
const cells = row.cells;
|
|
4734
|
+
if (cells.length < 3)
|
|
4735
|
+
continue;
|
|
4736
|
+
const action = stripBold(cells[0] ?? "");
|
|
4737
|
+
const summary = stripBackticks2(cells[1] ?? "");
|
|
4738
|
+
const category = stripBackticks2(cells[2] ?? "");
|
|
4739
|
+
const implementation = stripBackticks2((implementationIndex === -1 ? cells[cells.length - 1] : cells[implementationIndex]) ?? "");
|
|
4740
|
+
const description = descriptionIndex === -1 ? undefined : stripBackticks2(cells[descriptionIndex] ?? "") || undefined;
|
|
4741
|
+
const specIndex = (audienceIndex === -1 ? cells.length - 1 : audienceIndex) - 1;
|
|
4742
|
+
const spec = specIndex >= 3 ? stripBackticks2(cells[specIndex] ?? "") || undefined : undefined;
|
|
4743
|
+
const audience = audienceIndex === -1 ? "repo-own" : stripBackticks2(cells[audienceIndex] ?? "") === "product" ? "product" : "repo-own";
|
|
4744
|
+
result.push({ ring, action, summary, category, description, spec, implementation, audience, line: row.line });
|
|
4745
|
+
}
|
|
4554
4746
|
}
|
|
4555
|
-
return
|
|
4747
|
+
return result;
|
|
4556
4748
|
}
|
|
4557
|
-
|
|
4558
|
-
|
|
4749
|
+
// ../../packages/aeg-core/src/registry-checks.ts
|
|
4750
|
+
var HOOK_DIR_PREFIXES = [".claude/hooks/", ".vinaya/hooks/", ".husky/", ".git/hooks/"];
|
|
4751
|
+
var BARE_HOOK_NAME = /^check-[A-Za-z0-9_.-]*\.sh$/;
|
|
4752
|
+
function basename(path) {
|
|
4753
|
+
return path.slice(path.lastIndexOf("/") + 1);
|
|
4559
4754
|
}
|
|
4560
|
-
function
|
|
4755
|
+
function lineOf(content, index) {
|
|
4561
4756
|
let line = 1;
|
|
4562
|
-
for (let i = 0;i < index; i++)
|
|
4757
|
+
for (let i = 0;i < index; i++)
|
|
4563
4758
|
if (content.charCodeAt(i) === 10)
|
|
4564
4759
|
line++;
|
|
4565
|
-
}
|
|
4566
4760
|
return line;
|
|
4567
4761
|
}
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
|
|
4571
|
-
function legacySlugPattern(legacySlugs) {
|
|
4572
|
-
if (legacySlugs.length === 0)
|
|
4573
|
-
return null;
|
|
4574
|
-
const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
|
|
4575
|
-
return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
|
|
4576
|
-
}
|
|
4577
|
-
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4762
|
+
function findUnshippedHookRefs(docs, shipped) {
|
|
4763
|
+
const shippedNames = new Set([...shipped].map(basename));
|
|
4578
4764
|
const findings = [];
|
|
4579
|
-
const
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
if (cls === "spec" && grandfathered.has(file.path))
|
|
4600
|
-
continue;
|
|
4601
|
-
const blocking = cls === "product" || cls === "spec";
|
|
4602
|
-
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
4603
|
-
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
4604
|
-
for (const { pattern, what, group } of patternsToRun) {
|
|
4605
|
-
pattern.lastIndex = 0;
|
|
4606
|
-
let match = pattern.exec(scrubbed);
|
|
4607
|
-
while (match !== null) {
|
|
4608
|
-
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
4609
|
-
const citedIndex = match.index + match[0].indexOf(cited);
|
|
4610
|
-
findings.push({
|
|
4611
|
-
file: file.path,
|
|
4612
|
-
line: lineAt(scrubbed, citedIndex),
|
|
4613
|
-
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4614
|
-
blocking
|
|
4615
|
-
});
|
|
4616
|
-
match = pattern.exec(scrubbed);
|
|
4617
|
-
}
|
|
4765
|
+
const flag = (doc, token, index) => {
|
|
4766
|
+
findings.push({
|
|
4767
|
+
path: doc.path,
|
|
4768
|
+
reason: `${doc.path}:${lineOf(doc.content, index)} names hook "${token}", which is neither tracked in git nor emitted by \`vinaya init\``
|
|
4769
|
+
});
|
|
4770
|
+
};
|
|
4771
|
+
for (const doc of docs) {
|
|
4772
|
+
for (const { cited, index } of extractCitedPaths(doc.content)) {
|
|
4773
|
+
if (cited.endsWith("/") || !HOOK_DIR_PREFIXES.some((p) => cited.startsWith(p)))
|
|
4774
|
+
continue;
|
|
4775
|
+
if (!shipped.has(cited))
|
|
4776
|
+
flag(doc, cited, index);
|
|
4777
|
+
}
|
|
4778
|
+
const spanPattern = /`([^`\n]+)`/g;
|
|
4779
|
+
let match = spanPattern.exec(doc.content);
|
|
4780
|
+
while (match !== null) {
|
|
4781
|
+
const token = match[1] ?? "";
|
|
4782
|
+
if (BARE_HOOK_NAME.test(token) && !shippedNames.has(token))
|
|
4783
|
+
flag(doc, token, match.index);
|
|
4784
|
+
match = spanPattern.exec(doc.content);
|
|
4618
4785
|
}
|
|
4619
4786
|
}
|
|
4620
4787
|
return findings;
|
|
4621
4788
|
}
|
|
4622
|
-
function
|
|
4623
|
-
return term.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4624
|
-
}
|
|
4625
|
-
function containsWholeWord(text, term) {
|
|
4626
|
-
const escaped = escapeTerm(term);
|
|
4627
|
-
const re = new RegExp(`(^|[^a-zA-Z])${escaped}([^a-zA-Z]|$)`, "i");
|
|
4628
|
-
return re.test(text);
|
|
4629
|
-
}
|
|
4630
|
-
function findWholeWordLine(content, term) {
|
|
4631
|
-
const lines = content.split(`
|
|
4632
|
-
`);
|
|
4633
|
-
let lineNo = 0;
|
|
4634
|
-
for (const line of lines) {
|
|
4635
|
-
lineNo++;
|
|
4636
|
-
if (containsWholeWord(line, term))
|
|
4637
|
-
return lineNo;
|
|
4638
|
-
}
|
|
4639
|
-
return null;
|
|
4640
|
-
}
|
|
4641
|
-
function definesOrLinksGlossary(content, term) {
|
|
4642
|
-
const escaped = escapeTerm(term);
|
|
4643
|
-
const definesInline = new RegExp(`(^|[^a-zA-Z])${escaped}([^a-zA-Z]|$)[^\\n]{0,3}—`, "i").test(content);
|
|
4644
|
-
if (definesInline)
|
|
4645
|
-
return true;
|
|
4646
|
-
return /docs\/glossary|glossary\.md/i.test(content);
|
|
4647
|
-
}
|
|
4648
|
-
function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
|
|
4789
|
+
function checkG1(rows, existsFn, hookRefs) {
|
|
4649
4790
|
const findings = [];
|
|
4650
|
-
for (const
|
|
4651
|
-
|
|
4652
|
-
if (!cls || !SWEPT_CLASSES.has(cls))
|
|
4791
|
+
for (const row of rows) {
|
|
4792
|
+
if (row.implementation === "")
|
|
4653
4793
|
continue;
|
|
4654
|
-
|
|
4655
|
-
for (const term of glossaryTerms) {
|
|
4656
|
-
const line = findWholeWordLine(scrubbed, term);
|
|
4657
|
-
if (line === null)
|
|
4658
|
-
continue;
|
|
4659
|
-
if (definesOrLinksGlossary(scrubbed, term))
|
|
4660
|
-
continue;
|
|
4794
|
+
if (!existsFn(row.implementation)) {
|
|
4661
4795
|
findings.push({
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
blocking: false
|
|
4796
|
+
row: row.action,
|
|
4797
|
+
path: row.implementation,
|
|
4798
|
+
reason: `${row.ring} row "${row.action}" names implementation "${row.implementation}", which does not exist on disk`
|
|
4666
4799
|
});
|
|
4667
4800
|
}
|
|
4668
4801
|
}
|
|
4669
|
-
|
|
4802
|
+
if (hookRefs)
|
|
4803
|
+
findings.push(...findUnshippedHookRefs(hookRefs.docs, hookRefs.shipped));
|
|
4804
|
+
return { check: "G1", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4670
4805
|
}
|
|
4671
|
-
var
|
|
4672
|
-
var
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
const
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
const next = i + 1 < n ? content[i + 1] : "";
|
|
4686
|
-
if (state === "code") {
|
|
4687
|
-
if (c === "/" && next === "/") {
|
|
4688
|
-
state = "line-comment";
|
|
4689
|
-
out += c;
|
|
4690
|
-
i++;
|
|
4691
|
-
continue;
|
|
4692
|
-
}
|
|
4693
|
-
if (c === "/" && next === "*") {
|
|
4694
|
-
state = "block-comment";
|
|
4695
|
-
out += c;
|
|
4696
|
-
i++;
|
|
4697
|
-
continue;
|
|
4698
|
-
}
|
|
4699
|
-
if (c === "'") {
|
|
4700
|
-
state = "single-quote";
|
|
4701
|
-
out += blank(c);
|
|
4702
|
-
i++;
|
|
4703
|
-
continue;
|
|
4704
|
-
}
|
|
4705
|
-
if (c === '"') {
|
|
4706
|
-
state = "double-quote";
|
|
4707
|
-
out += blank(c);
|
|
4708
|
-
i++;
|
|
4709
|
-
continue;
|
|
4710
|
-
}
|
|
4711
|
-
if (c === "`") {
|
|
4712
|
-
state = "template";
|
|
4713
|
-
out += blank(c);
|
|
4714
|
-
i++;
|
|
4715
|
-
continue;
|
|
4716
|
-
}
|
|
4717
|
-
out += blank(c);
|
|
4718
|
-
i++;
|
|
4806
|
+
var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
|
|
4807
|
+
var NON_GATE_BIN_NAMES = NON_GATE_BINS;
|
|
4808
|
+
var TWIN_CANDIDATE_EXCEPTIONS = {
|
|
4809
|
+
"apps/cli/src/checks/bin/check-dead-branch-push.ts": 'Ring 0 "Pushing to a branch whose pull request already resolved" (implementation: check-push-target.ts)',
|
|
4810
|
+
"apps/cli/src/checks/bin/check-issue-assignment.ts": `Ring 0 "A task branch's first push (Issue self-assignment)" (implementation: assign-task-issue.ts)`,
|
|
4811
|
+
"apps/cli/src/checks/bin/check-closes-n.ts": 'Ring 1 "Closes linkage" (implementation: verify-coherence.ts)'
|
|
4812
|
+
};
|
|
4813
|
+
var NON_GATE_HOOK_SCRIPTS = [".claude/hooks/track-transcript.sh"];
|
|
4814
|
+
function checkG2(rows, candidateFiles) {
|
|
4815
|
+
const implementations = new Set(rows.map((r) => r.implementation).filter((p) => p !== ""));
|
|
4816
|
+
const claimedNames = new Set(rows.flatMap((r) => claimedCheckNames(r.implementation)));
|
|
4817
|
+
const findings = [];
|
|
4818
|
+
for (const path of candidateFiles) {
|
|
4819
|
+
if (implementations.has(path))
|
|
4719
4820
|
continue;
|
|
4720
|
-
|
|
4721
|
-
if (state === "line-comment") {
|
|
4722
|
-
if (c === `
|
|
4723
|
-
`) {
|
|
4724
|
-
state = "code";
|
|
4725
|
-
out += `
|
|
4726
|
-
`;
|
|
4727
|
-
i++;
|
|
4728
|
-
continue;
|
|
4729
|
-
}
|
|
4730
|
-
out += c;
|
|
4731
|
-
i++;
|
|
4821
|
+
if (path.startsWith(AEG_CORE_BIN_PATH_PREFIX) && NON_GATE_BIN_NAMES.includes(basenameNoExt(path)))
|
|
4732
4822
|
continue;
|
|
4733
|
-
|
|
4734
|
-
if (state === "block-comment") {
|
|
4735
|
-
if (c === "*" && next === "/") {
|
|
4736
|
-
out += c;
|
|
4737
|
-
out += next;
|
|
4738
|
-
state = "code";
|
|
4739
|
-
i += 2;
|
|
4740
|
-
continue;
|
|
4741
|
-
}
|
|
4742
|
-
out += c === `
|
|
4743
|
-
` ? `
|
|
4744
|
-
` : c;
|
|
4745
|
-
i++;
|
|
4823
|
+
if (NON_GATE_HOOK_SCRIPTS.includes(path))
|
|
4746
4824
|
continue;
|
|
4747
|
-
|
|
4748
|
-
const closer = state === "single-quote" ? "'" : state === "double-quote" ? '"' : "`";
|
|
4749
|
-
if (c === "\\") {
|
|
4750
|
-
out += blank(c);
|
|
4751
|
-
i++;
|
|
4752
|
-
if (i < n) {
|
|
4753
|
-
out += blank(content[i]);
|
|
4754
|
-
i++;
|
|
4755
|
-
}
|
|
4825
|
+
if (path in TWIN_CANDIDATE_EXCEPTIONS)
|
|
4756
4826
|
continue;
|
|
4757
|
-
|
|
4758
|
-
if (
|
|
4759
|
-
state = "code";
|
|
4760
|
-
out += blank(c);
|
|
4761
|
-
i++;
|
|
4827
|
+
const candidateNames = claimedCheckNames(path);
|
|
4828
|
+
if (candidateNames.length > 0 && candidateNames.some((n) => claimedNames.has(n)))
|
|
4762
4829
|
continue;
|
|
4830
|
+
findings.push({
|
|
4831
|
+
path,
|
|
4832
|
+
reason: `"${path}" is not named as the implementation of any row in enforcement.md's ring tables`
|
|
4833
|
+
});
|
|
4834
|
+
}
|
|
4835
|
+
for (const row of rows) {
|
|
4836
|
+
const carriesPlaceholder = [row.summary, row.description, row.spec].some((cell) => cell === SCAFFOLD_PLACEHOLDER);
|
|
4837
|
+
if (carriesPlaceholder) {
|
|
4838
|
+
findings.push({
|
|
4839
|
+
row: row.action,
|
|
4840
|
+
path: row.implementation,
|
|
4841
|
+
reason: `${row.ring} row "${row.action}" still carries the scaffold placeholder marker — the why is owed`
|
|
4842
|
+
});
|
|
4763
4843
|
}
|
|
4764
|
-
out += blank(c);
|
|
4765
|
-
i++;
|
|
4766
4844
|
}
|
|
4767
|
-
return
|
|
4845
|
+
return { check: "G2", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4768
4846
|
}
|
|
4769
|
-
function
|
|
4847
|
+
function checkG3(ring0Rows, crossingFiles) {
|
|
4848
|
+
const ring0Implementations = new Set(ring0Rows.map((r) => r.implementation));
|
|
4770
4849
|
const findings = [];
|
|
4771
|
-
const
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
if (!file.path.endsWith(".ts"))
|
|
4778
|
-
continue;
|
|
4779
|
-
if (allowed.has(file.path))
|
|
4780
|
-
continue;
|
|
4781
|
-
const comments = extractComments(file.path, file.content);
|
|
4782
|
-
for (const { pattern, what } of patterns) {
|
|
4783
|
-
pattern.lastIndex = 0;
|
|
4784
|
-
let match = pattern.exec(comments);
|
|
4785
|
-
while (match !== null) {
|
|
4786
|
-
findings.push({
|
|
4787
|
-
file: file.path,
|
|
4788
|
-
line: lineAt(comments, match.index),
|
|
4789
|
-
message: `comment cites ${what} ("${match[0]}") a reader outside this repo's tracker cannot resolve`,
|
|
4790
|
-
blocking: false
|
|
4791
|
-
});
|
|
4792
|
-
match = pattern.exec(comments);
|
|
4793
|
-
}
|
|
4850
|
+
for (const path of crossingFiles) {
|
|
4851
|
+
if (!ring0Implementations.has(path)) {
|
|
4852
|
+
findings.push({
|
|
4853
|
+
path,
|
|
4854
|
+
reason: `"${path}" makes a GitHub-crossing call but is not named by any Ring-0 row's implementation — a seventh, unlisted way into GitHub`
|
|
4855
|
+
});
|
|
4794
4856
|
}
|
|
4795
4857
|
}
|
|
4796
|
-
return findings;
|
|
4797
|
-
}
|
|
4798
|
-
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4799
|
-
return [
|
|
4800
|
-
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
|
|
4801
|
-
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
4802
|
-
];
|
|
4858
|
+
return { check: "G3", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4803
4859
|
}
|
|
4804
|
-
function
|
|
4805
|
-
const
|
|
4806
|
-
const
|
|
4807
|
-
|
|
4808
|
-
while (match !== null) {
|
|
4809
|
-
if (match[1] !== undefined)
|
|
4810
|
-
terms.push(match[1]);
|
|
4811
|
-
match = re.exec(glossaryContent);
|
|
4860
|
+
function checkG4(content, resolveFn) {
|
|
4861
|
+
const cited = new Set;
|
|
4862
|
+
for (const hit of content.matchAll(/#(\d{3,})\b/g)) {
|
|
4863
|
+
cited.add(Number(hit[1]));
|
|
4812
4864
|
}
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
var END_PATTERN = /<!--\s*AEG:QUOTES-FILE:END\s*-->/;
|
|
4821
|
-
function isValidCitedFilePath(path) {
|
|
4822
|
-
if (path.length === 0)
|
|
4823
|
-
return false;
|
|
4824
|
-
if (path.startsWith("/") || path.startsWith("\\"))
|
|
4825
|
-
return false;
|
|
4826
|
-
if (/^[A-Za-z]:[\\/]/.test(path))
|
|
4827
|
-
return false;
|
|
4828
|
-
return !path.split(/[\\/]+/).includes("..");
|
|
4829
|
-
}
|
|
4830
|
-
function quotedCommandLineAt(content, index) {
|
|
4831
|
-
let line = 1;
|
|
4832
|
-
for (let i = 0;i < index; i++) {
|
|
4833
|
-
if (content.charCodeAt(i) === 10)
|
|
4834
|
-
line++;
|
|
4865
|
+
const findings = [];
|
|
4866
|
+
for (const n of cited) {
|
|
4867
|
+
if (!resolveFn(n)) {
|
|
4868
|
+
findings.push({
|
|
4869
|
+
reason: `#${n} is cited in enforcement.md but does not resolve to a real Issue or PR in the forge`
|
|
4870
|
+
});
|
|
4871
|
+
}
|
|
4835
4872
|
}
|
|
4836
|
-
return
|
|
4837
|
-
}
|
|
4838
|
-
function extractQuotedText(raw) {
|
|
4839
|
-
const trimmed = raw.trim();
|
|
4840
|
-
const fenced = /^(?:`{3,}|~{3,})[^\n]*\n([\s\S]*?)\n?(?:`{3,}|~{3,})$/.exec(trimmed);
|
|
4841
|
-
if (fenced)
|
|
4842
|
-
return (fenced[1] ?? "").trim();
|
|
4843
|
-
const inline = /^`([^`]+)`$/.exec(trimmed);
|
|
4844
|
-
if (inline)
|
|
4845
|
-
return (inline[1] ?? "").trim();
|
|
4846
|
-
return trimmed;
|
|
4873
|
+
return { check: "G4", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4847
4874
|
}
|
|
4848
|
-
function
|
|
4849
|
-
const
|
|
4850
|
-
const
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
if (end === null) {
|
|
4858
|
-
START_PATTERN.lastIndex = innerStart;
|
|
4859
|
-
start = START_PATTERN.exec(masked);
|
|
4860
|
-
continue;
|
|
4875
|
+
function checkG5(roles, contracts) {
|
|
4876
|
+
const roleIds = new Set(roles.map((r) => r.role_id));
|
|
4877
|
+
const findings = [];
|
|
4878
|
+
for (const contract of contracts) {
|
|
4879
|
+
if (!roleIds.has(contract.producer)) {
|
|
4880
|
+
findings.push({
|
|
4881
|
+
path: contract.file,
|
|
4882
|
+
reason: `contract "${contract.file}" names producer "${contract.producer}", which is not a real role_id`
|
|
4883
|
+
});
|
|
4861
4884
|
}
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
}
|
|
4885
|
+
if (!roleIds.has(contract.consumer)) {
|
|
4886
|
+
findings.push({
|
|
4887
|
+
path: contract.file,
|
|
4888
|
+
reason: `contract "${contract.file}" names consumer "${contract.consumer}", which is not a real role_id`
|
|
4889
|
+
});
|
|
4868
4890
|
}
|
|
4869
|
-
START_PATTERN.lastIndex = innerEnd + end[0].length;
|
|
4870
|
-
start = START_PATTERN.exec(masked);
|
|
4871
4891
|
}
|
|
4872
|
-
|
|
4892
|
+
for (const role of roles) {
|
|
4893
|
+
if (role.performs.length === 0) {
|
|
4894
|
+
findings.push({ path: role.file, reason: `role "${role.role_id}" has an empty performs array` });
|
|
4895
|
+
}
|
|
4896
|
+
if (role.refuses_when.trim() === "") {
|
|
4897
|
+
findings.push({ path: role.file, reason: `role "${role.role_id}" has an empty refuses_when` });
|
|
4898
|
+
}
|
|
4899
|
+
}
|
|
4900
|
+
return { check: "G5", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4873
4901
|
}
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4902
|
+
var SHIPPED_BIN_PATH_PREFIX = "apps/cli/src/checks/bin/check-";
|
|
4903
|
+
var AEG_CORE_BIN_PATH_PREFIX = "packages/aeg-core/bin/";
|
|
4904
|
+
function basenameNoExt(path) {
|
|
4905
|
+
const base = path.slice(path.lastIndexOf("/") + 1);
|
|
4906
|
+
return base.replace(/\.ts$/, "");
|
|
4907
|
+
}
|
|
4908
|
+
function claimedCheckNames(implementation) {
|
|
4909
|
+
if (implementation.startsWith(SHIPPED_BIN_PATH_PREFIX) && implementation.endsWith(".ts")) {
|
|
4910
|
+
return [implementation.slice(SHIPPED_BIN_PATH_PREFIX.length, -".ts".length)];
|
|
4881
4911
|
}
|
|
4882
|
-
|
|
4912
|
+
if (implementation.startsWith(AEG_CORE_BIN_PATH_PREFIX)) {
|
|
4913
|
+
const audience = GATE_AUDIENCE[basenameNoExt(implementation)];
|
|
4914
|
+
if (audience && isShipped(audience)) {
|
|
4915
|
+
return Array.isArray(audience.shippedAs) ? audience.shippedAs : [audience.shippedAs];
|
|
4916
|
+
}
|
|
4917
|
+
}
|
|
4918
|
+
return [];
|
|
4883
4919
|
}
|
|
4884
|
-
function
|
|
4920
|
+
function checkG6(rows, registeredCheckNames) {
|
|
4885
4921
|
const findings = [];
|
|
4886
|
-
for (const
|
|
4887
|
-
|
|
4888
|
-
if (content === undefined) {
|
|
4889
|
-
findings.push({
|
|
4890
|
-
file: quote.file,
|
|
4891
|
-
line: quote.line,
|
|
4892
|
-
citedFile: quote.citedFile,
|
|
4893
|
-
quotedText: quote.quotedText,
|
|
4894
|
-
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but that file could not be read`
|
|
4895
|
-
});
|
|
4922
|
+
for (const row of rows) {
|
|
4923
|
+
if (row.audience !== "product")
|
|
4896
4924
|
continue;
|
|
4897
|
-
|
|
4898
|
-
if (!
|
|
4925
|
+
const candidates = claimedCheckNames(row.implementation);
|
|
4926
|
+
if (!candidates.some((name) => registeredCheckNames.has(name))) {
|
|
4899
4927
|
findings.push({
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
quotedText: quote.quotedText,
|
|
4904
|
-
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but \`${quote.citedFile}\` no longer contains that text verbatim`
|
|
4928
|
+
row: row.action,
|
|
4929
|
+
path: row.implementation,
|
|
4930
|
+
reason: `${row.ring} row "${row.action}" is marked \`product\` but its implementation "${row.implementation}" does not resolve to a coreCheckRegistry() entry`
|
|
4905
4931
|
});
|
|
4906
4932
|
}
|
|
4907
4933
|
}
|
|
4908
|
-
return findings;
|
|
4934
|
+
return { check: "G6", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
4909
4935
|
}
|
|
4910
4936
|
// ../../packages/aeg-core/src/dead-branch-push-guard.ts
|
|
4911
4937
|
function checkDeadBranchPush(input) {
|
|
@@ -5328,7 +5354,6 @@ var TaskPrPauseSchema = z.object({
|
|
|
5328
5354
|
var TaskPrReviewRecordSchema = z.object({
|
|
5329
5355
|
verdicts: z.array(TaskPrVerdictSchema),
|
|
5330
5356
|
roundMarkers: z.array(z.number().int().nonnegative()),
|
|
5331
|
-
summaryTable: z.string().nullable(),
|
|
5332
5357
|
pause: TaskPrPauseSchema.nullable()
|
|
5333
5358
|
});
|
|
5334
5359
|
var TaskPrReadInputSchema = z.object({
|
|
@@ -5375,16 +5400,6 @@ var TaskCancelResultSchema = z.object({
|
|
|
5375
5400
|
authenticatedFrom: z.string().min(1),
|
|
5376
5401
|
fencedEffectKeys: z.array(z.string())
|
|
5377
5402
|
});
|
|
5378
|
-
var TASK_TOOL_NAMES = [
|
|
5379
|
-
"task_start",
|
|
5380
|
-
"task_status",
|
|
5381
|
-
"task_escalation_read",
|
|
5382
|
-
"task_pr_read",
|
|
5383
|
-
"task_resume",
|
|
5384
|
-
"task_cancel"
|
|
5385
|
-
];
|
|
5386
|
-
var OPERATOR_STATUS_FOLLOW = "task_status_follow";
|
|
5387
|
-
var OPERATOR_TOOL_GRANT = [...TASK_TOOL_NAMES, OPERATOR_STATUS_FOLLOW];
|
|
5388
5403
|
// ../../packages/aeg-core/src/first-push-dispatch-gate.ts
|
|
5389
5404
|
function parseTaskBranch(branch) {
|
|
5390
5405
|
const m = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
|
|
@@ -5615,15 +5630,69 @@ var NO_GATE_CUTOVERS = {
|
|
|
5615
5630
|
briefRulesSincePr: null,
|
|
5616
5631
|
agentBoxesRefusedSincePr: null
|
|
5617
5632
|
};
|
|
5618
|
-
// ../../packages/aeg-core/src/dev-review-loop/types.ts
|
|
5619
|
-
var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
|
|
5620
|
-
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
5621
|
-
var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
|
|
5622
|
-
// ../../packages/aeg-core/src/log/envelope.ts
|
|
5623
|
-
import { createHash as createHash5 } from "node:crypto";
|
|
5624
|
-
|
|
5625
5633
|
// ../../packages/aeg-core/src/log/schema.ts
|
|
5634
|
+
import { z as z3 } from "zod";
|
|
5635
|
+
|
|
5636
|
+
// ../../packages/aeg-core/src/log/custom.ts
|
|
5626
5637
|
import { z as z2 } from "zod";
|
|
5638
|
+
var CUSTOM_EVENT_NAME_PATTERN = /^[a-z][a-z0-9_]*\.[a-z][a-z0-9_.]*$/;
|
|
5639
|
+
var CUSTOM_EVENT_NAME_MAX_LENGTH = 64;
|
|
5640
|
+
var CUSTOM_EVENT_RESERVED_NAMESPACE = "vinaya";
|
|
5641
|
+
var CUSTOM_EVENT_MAX_FIELDS = 20;
|
|
5642
|
+
var CUSTOM_FIELD_NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
|
|
5643
|
+
var CUSTOM_FIELD_NAME_MAX_LENGTH = 64;
|
|
5644
|
+
var CUSTOM_TEXT_MAX_LENGTH = 500;
|
|
5645
|
+
var CUSTOM_WORD_PATTERN = /^[a-z0-9][a-z0-9_-]*$/;
|
|
5646
|
+
var CUSTOM_WORD_MAX_LENGTH = 64;
|
|
5647
|
+
var CUSTOM_FIELD_MAX_WORDS = 50;
|
|
5648
|
+
var CustomFieldTypeSchema = z2.union([z2.enum(["text", "number", "boolean"]), z2.array(z2.string())]);
|
|
5649
|
+
var CustomEventDeclarationsSchema = z2.record(z2.string(), z2.object({
|
|
5650
|
+
fields: z2.record(z2.string(), CustomFieldTypeSchema)
|
|
5651
|
+
}).strict()).superRefine((events, ctx) => {
|
|
5652
|
+
for (const [name, declaration] of Object.entries(events)) {
|
|
5653
|
+
const refuse = (message, path = []) => {
|
|
5654
|
+
ctx.addIssue({
|
|
5655
|
+
code: z2.ZodIssueCode.custom,
|
|
5656
|
+
path: [name, ...path],
|
|
5657
|
+
message: `logs.events "${name}": ${message}`
|
|
5658
|
+
});
|
|
5659
|
+
};
|
|
5660
|
+
if (name.length > CUSTOM_EVENT_NAME_MAX_LENGTH) {
|
|
5661
|
+
refuse(`the name must be at most ${CUSTOM_EVENT_NAME_MAX_LENGTH} characters`);
|
|
5662
|
+
}
|
|
5663
|
+
if (!CUSTOM_EVENT_NAME_PATTERN.test(name)) {
|
|
5664
|
+
refuse("the name must be `<namespace>.<event>` — lowercase letters, digits and `_`, a dot between them");
|
|
5665
|
+
} else if (name.split(".")[0] === CUSTOM_EVENT_RESERVED_NAMESPACE) {
|
|
5666
|
+
refuse(`the \`${CUSTOM_EVENT_RESERVED_NAMESPACE}.\` namespace is reserved for Vinaya's own events`);
|
|
5667
|
+
}
|
|
5668
|
+
const fieldEntries = Object.entries(declaration.fields);
|
|
5669
|
+
if (fieldEntries.length > CUSTOM_EVENT_MAX_FIELDS) {
|
|
5670
|
+
refuse(`at most ${CUSTOM_EVENT_MAX_FIELDS} fields may be declared (found ${fieldEntries.length})`, ["fields"]);
|
|
5671
|
+
}
|
|
5672
|
+
for (const [field, type] of fieldEntries) {
|
|
5673
|
+
if (field.length > CUSTOM_FIELD_NAME_MAX_LENGTH || !CUSTOM_FIELD_NAME_PATTERN.test(field)) {
|
|
5674
|
+
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]);
|
|
5675
|
+
}
|
|
5676
|
+
if (typeof type === "string")
|
|
5677
|
+
continue;
|
|
5678
|
+
if (type.length === 0) {
|
|
5679
|
+
refuse(`field "${field}": a list of words must name at least one word`, ["fields", field]);
|
|
5680
|
+
}
|
|
5681
|
+
if (type.length > CUSTOM_FIELD_MAX_WORDS) {
|
|
5682
|
+
refuse(`field "${field}": a list of words may name at most ${CUSTOM_FIELD_MAX_WORDS}`, ["fields", field]);
|
|
5683
|
+
}
|
|
5684
|
+
const bad = type.filter((w) => w.length > CUSTOM_WORD_MAX_LENGTH || !CUSTOM_WORD_PATTERN.test(w));
|
|
5685
|
+
if (bad.length > 0) {
|
|
5686
|
+
refuse(`field "${field}": a listed word is lowercase letters, digits, \`_\` and \`-\`, at most ${CUSTOM_WORD_MAX_LENGTH} characters`, ["fields", field]);
|
|
5687
|
+
}
|
|
5688
|
+
if (new Set(type).size !== type.length) {
|
|
5689
|
+
refuse(`field "${field}": a list of words names a word twice`, ["fields", field]);
|
|
5690
|
+
}
|
|
5691
|
+
}
|
|
5692
|
+
}
|
|
5693
|
+
});
|
|
5694
|
+
|
|
5695
|
+
// ../../packages/aeg-core/src/log/schema.ts
|
|
5627
5696
|
var CONFIDENCE_REASON_MAX_LENGTH = 280;
|
|
5628
5697
|
var ROLE_VALUES = [
|
|
5629
5698
|
"planner",
|
|
@@ -5634,244 +5703,297 @@ var ROLE_VALUES = [
|
|
|
5634
5703
|
"archivist",
|
|
5635
5704
|
"architect"
|
|
5636
5705
|
];
|
|
5637
|
-
var RoleSchema =
|
|
5706
|
+
var RoleSchema = z3.enum(ROLE_VALUES);
|
|
5638
5707
|
var HOST_VALUES = ["hook", "ci", "cli", "loop"];
|
|
5639
|
-
var HostSchema =
|
|
5708
|
+
var HostSchema = z3.enum(HOST_VALUES);
|
|
5640
5709
|
var RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
|
|
5641
5710
|
var headerMetaCore = {
|
|
5642
|
-
ts:
|
|
5643
|
-
run_id:
|
|
5644
|
-
seq:
|
|
5645
|
-
repo:
|
|
5646
|
-
vinaya:
|
|
5647
|
-
doctrine:
|
|
5711
|
+
ts: z3.string(),
|
|
5712
|
+
run_id: z3.string().regex(RUN_ID_PATTERN),
|
|
5713
|
+
seq: z3.number().int().nonnegative(),
|
|
5714
|
+
repo: z3.string().nullable(),
|
|
5715
|
+
vinaya: z3.string(),
|
|
5716
|
+
doctrine: z3.string(),
|
|
5648
5717
|
host: HostSchema,
|
|
5649
|
-
machine:
|
|
5718
|
+
machine: z3.string()
|
|
5650
5719
|
};
|
|
5651
|
-
var HeaderMetaV1Schema =
|
|
5652
|
-
schema:
|
|
5720
|
+
var HeaderMetaV1Schema = z3.object({
|
|
5721
|
+
schema: z3.literal(1),
|
|
5653
5722
|
...headerMetaCore
|
|
5654
5723
|
}).strict();
|
|
5655
|
-
var LineageSchema =
|
|
5656
|
-
run:
|
|
5657
|
-
attempt:
|
|
5658
|
-
parent:
|
|
5724
|
+
var LineageSchema = z3.object({
|
|
5725
|
+
run: z3.string().nullable(),
|
|
5726
|
+
attempt: z3.number().int().nullable(),
|
|
5727
|
+
parent: z3.string().nullable()
|
|
5659
5728
|
}).strict();
|
|
5660
|
-
var InputVersionsSchema =
|
|
5661
|
-
objectives_version:
|
|
5662
|
-
brief_hash:
|
|
5663
|
-
ruling_ordinal:
|
|
5664
|
-
policy_digest:
|
|
5729
|
+
var InputVersionsSchema = z3.object({
|
|
5730
|
+
objectives_version: z3.string().nullable(),
|
|
5731
|
+
brief_hash: z3.string().nullable(),
|
|
5732
|
+
ruling_ordinal: z3.number().int().nullable(),
|
|
5733
|
+
policy_digest: z3.string().nullable()
|
|
5665
5734
|
}).strict();
|
|
5666
|
-
var ProvenanceSchema =
|
|
5667
|
-
var HeaderMetaV2Schema =
|
|
5668
|
-
schema:
|
|
5735
|
+
var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
|
|
5736
|
+
var HeaderMetaV2Schema = z3.object({
|
|
5737
|
+
schema: z3.literal(2),
|
|
5669
5738
|
...headerMetaCore,
|
|
5670
|
-
event_id:
|
|
5671
|
-
process_id:
|
|
5672
|
-
actor_id:
|
|
5739
|
+
event_id: z3.string().min(1),
|
|
5740
|
+
process_id: z3.string().min(1),
|
|
5741
|
+
actor_id: z3.string().nullable(),
|
|
5673
5742
|
lineage: LineageSchema,
|
|
5674
5743
|
input_versions: InputVersionsSchema,
|
|
5675
5744
|
provenance: ProvenanceSchema
|
|
5676
5745
|
}).strict();
|
|
5677
|
-
var
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5746
|
+
var WorkSchema = z3.object({
|
|
5747
|
+
ref: z3.string().nullable(),
|
|
5748
|
+
repo: z3.string().nullable(),
|
|
5749
|
+
change: z3.string().nullable(),
|
|
5750
|
+
revision: z3.string().nullable()
|
|
5751
|
+
}).strict();
|
|
5752
|
+
var FlowSchema = z3.object({
|
|
5753
|
+
id: z3.string().nullable(),
|
|
5754
|
+
version: z3.string().nullable()
|
|
5755
|
+
}).strict();
|
|
5756
|
+
var HeaderMetaV3Schema = z3.object({
|
|
5757
|
+
schema: z3.literal(3),
|
|
5758
|
+
...headerMetaCore,
|
|
5759
|
+
event_id: z3.string().min(1),
|
|
5760
|
+
process_id: z3.string().min(1),
|
|
5761
|
+
actor_id: z3.string().nullable(),
|
|
5762
|
+
lineage: LineageSchema,
|
|
5763
|
+
input_versions: InputVersionsSchema,
|
|
5764
|
+
provenance: ProvenanceSchema,
|
|
5765
|
+
work: WorkSchema,
|
|
5766
|
+
flow: FlowSchema,
|
|
5767
|
+
runtime: z3.string().nullable(),
|
|
5768
|
+
source: z3.string().nullable()
|
|
5769
|
+
}).strict();
|
|
5770
|
+
var HeaderMetaSchema = z3.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema, HeaderMetaV3Schema]);
|
|
5771
|
+
var SubjectSchema = z3.object({
|
|
5772
|
+
issue: z3.number().int().nullable(),
|
|
5773
|
+
pr: z3.number().int().optional(),
|
|
5774
|
+
sha: z3.string().optional(),
|
|
5775
|
+
role: z3.union([RoleSchema, z3.literal("unattributed")]),
|
|
5776
|
+
round: z3.number().int().optional(),
|
|
5777
|
+
objectives_version: z3.string().optional()
|
|
5685
5778
|
}).strict();
|
|
5686
|
-
var HeaderSchema =
|
|
5779
|
+
var HeaderSchema = z3.object({
|
|
5687
5780
|
meta: HeaderMetaSchema,
|
|
5688
5781
|
subject: SubjectSchema
|
|
5689
5782
|
}).strict();
|
|
5690
5783
|
var envelopeTail = {
|
|
5691
|
-
duration_ms:
|
|
5692
|
-
payload:
|
|
5784
|
+
duration_ms: z3.number().nonnegative().optional(),
|
|
5785
|
+
payload: z3.object({}).strict()
|
|
5693
5786
|
};
|
|
5694
|
-
var ReviewFindingSchema =
|
|
5695
|
-
id:
|
|
5696
|
-
severity:
|
|
5697
|
-
state:
|
|
5698
|
-
severity_scale:
|
|
5699
|
-
policy_treatment:
|
|
5700
|
-
confidence:
|
|
5701
|
-
confidence_scale:
|
|
5702
|
-
confidence_source:
|
|
5787
|
+
var ReviewFindingSchema = z3.object({
|
|
5788
|
+
id: z3.string(),
|
|
5789
|
+
severity: z3.string(),
|
|
5790
|
+
state: z3.string().optional(),
|
|
5791
|
+
severity_scale: z3.string().optional(),
|
|
5792
|
+
policy_treatment: z3.enum(["blocking", "non_blocking", "unavailable"]).optional(),
|
|
5793
|
+
confidence: z3.number().min(0).max(1).optional(),
|
|
5794
|
+
confidence_scale: z3.string().optional(),
|
|
5795
|
+
confidence_source: z3.string().optional()
|
|
5703
5796
|
}).strict();
|
|
5704
|
-
var DispatchOutcomeSchema =
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
type:
|
|
5708
|
-
pr:
|
|
5709
|
-
head:
|
|
5710
|
-
comment_id:
|
|
5797
|
+
var DispatchOutcomeSchema = z3.discriminatedUnion("type", [
|
|
5798
|
+
z3.object({ type: z3.literal("pr_opened"), pr: z3.number().int(), head: z3.string() }).strict(),
|
|
5799
|
+
z3.object({
|
|
5800
|
+
type: z3.literal("round_pushed"),
|
|
5801
|
+
pr: z3.number().int(),
|
|
5802
|
+
head: z3.string(),
|
|
5803
|
+
comment_id: z3.number().int()
|
|
5711
5804
|
}).strict(),
|
|
5712
|
-
|
|
5713
|
-
type:
|
|
5714
|
-
verdict:
|
|
5715
|
-
head:
|
|
5716
|
-
comment_id:
|
|
5717
|
-
objectives:
|
|
5718
|
-
findings:
|
|
5805
|
+
z3.object({
|
|
5806
|
+
type: z3.literal("verdict"),
|
|
5807
|
+
verdict: z3.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
|
|
5808
|
+
head: z3.string(),
|
|
5809
|
+
comment_id: z3.number().int(),
|
|
5810
|
+
objectives: z3.array(z3.object({ id: z3.string(), met: z3.boolean() }).strict()),
|
|
5811
|
+
findings: z3.array(ReviewFindingSchema)
|
|
5719
5812
|
}).strict(),
|
|
5720
|
-
|
|
5721
|
-
type:
|
|
5722
|
-
class:
|
|
5723
|
-
comment_id:
|
|
5813
|
+
z3.object({
|
|
5814
|
+
type: z3.literal("escalation"),
|
|
5815
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
5816
|
+
comment_id: z3.number().int()
|
|
5724
5817
|
}).strict(),
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5818
|
+
z3.object({ type: z3.literal("brief"), comment_id: z3.number().int(), hash: z3.string() }).strict(),
|
|
5819
|
+
z3.object({ type: z3.literal("plan"), issues: z3.array(z3.number().int()) }).strict(),
|
|
5820
|
+
z3.object({ type: z3.literal("archive"), provenance_comment_id: z3.number().int() }).strict(),
|
|
5821
|
+
z3.object({ type: z3.literal("completed") }).strict()
|
|
5729
5822
|
]);
|
|
5730
5823
|
var dispatchShared = {
|
|
5731
5824
|
meta: HeaderMetaSchema,
|
|
5732
5825
|
subject: SubjectSchema,
|
|
5733
|
-
kind:
|
|
5826
|
+
kind: z3.literal("dispatch"),
|
|
5734
5827
|
...envelopeTail,
|
|
5735
5828
|
target_role: RoleSchema,
|
|
5736
|
-
model:
|
|
5737
|
-
round:
|
|
5738
|
-
effect_id:
|
|
5829
|
+
model: z3.string(),
|
|
5830
|
+
round: z3.number().int().optional(),
|
|
5831
|
+
effect_id: z3.string()
|
|
5739
5832
|
};
|
|
5740
|
-
var dispatchUsageField =
|
|
5741
|
-
var DispatchEventSchema =
|
|
5742
|
-
|
|
5743
|
-
|
|
5833
|
+
var dispatchUsageField = z3.object({ input: z3.number().nonnegative(), output: z3.number().nonnegative() }).strict().nullable();
|
|
5834
|
+
var DispatchEventSchema = z3.discriminatedUnion("event", [
|
|
5835
|
+
z3.object({ ...dispatchShared, event: z3.literal("dispatched"), prompt_hash: z3.string() }).strict(),
|
|
5836
|
+
z3.object({
|
|
5744
5837
|
...dispatchShared,
|
|
5745
|
-
event:
|
|
5838
|
+
event: z3.literal("outcome_received"),
|
|
5746
5839
|
outcome: DispatchOutcomeSchema,
|
|
5747
5840
|
usage: dispatchUsageField
|
|
5748
5841
|
}).strict(),
|
|
5749
|
-
|
|
5842
|
+
z3.object({
|
|
5750
5843
|
...dispatchShared,
|
|
5751
|
-
event:
|
|
5752
|
-
reason:
|
|
5844
|
+
event: z3.literal("dispatch_failed"),
|
|
5845
|
+
reason: z3.enum(["timeout", "crash", "refused", "unattributed_write"]),
|
|
5753
5846
|
usage: dispatchUsageField
|
|
5754
5847
|
}).strict()
|
|
5755
5848
|
]);
|
|
5849
|
+
var CODE_TOKEN_PATTERN = /^[A-Za-z0-9._-]{1,64}$/;
|
|
5850
|
+
var CodeTokenSchema = z3.string().regex(CODE_TOKEN_PATTERN);
|
|
5851
|
+
var ReviewerVerdictSchema = z3.object({
|
|
5852
|
+
role: RoleSchema,
|
|
5853
|
+
outcome: z3.enum(["approve", "changes_requested", "not_reviewed"]),
|
|
5854
|
+
blockers: z3.number().int().nonnegative()
|
|
5855
|
+
}).strict();
|
|
5756
5856
|
var loopShared = {
|
|
5757
5857
|
meta: HeaderMetaSchema,
|
|
5758
5858
|
subject: SubjectSchema,
|
|
5759
|
-
kind:
|
|
5859
|
+
kind: z3.literal("dev_review_loop"),
|
|
5760
5860
|
...envelopeTail,
|
|
5761
|
-
loop_id:
|
|
5861
|
+
loop_id: z3.string()
|
|
5762
5862
|
};
|
|
5763
|
-
var DevReviewLoopEventSchema =
|
|
5764
|
-
|
|
5863
|
+
var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
|
|
5864
|
+
z3.object({
|
|
5765
5865
|
...loopShared,
|
|
5766
|
-
event:
|
|
5767
|
-
task:
|
|
5768
|
-
policy:
|
|
5769
|
-
max_rounds:
|
|
5770
|
-
reviewers:
|
|
5771
|
-
models:
|
|
5866
|
+
event: z3.literal("loop_started"),
|
|
5867
|
+
task: z3.number().int(),
|
|
5868
|
+
policy: z3.object({
|
|
5869
|
+
max_rounds: z3.number().int().nonnegative(),
|
|
5870
|
+
reviewers: z3.array(RoleSchema),
|
|
5871
|
+
models: z3.record(RoleSchema, z3.string())
|
|
5772
5872
|
}).strict()
|
|
5773
5873
|
}).strict(),
|
|
5774
|
-
|
|
5775
|
-
|
|
5874
|
+
z3.object({ ...loopShared, event: z3.literal("round_started"), round: z3.number().int(), base_head: z3.string() }).strict(),
|
|
5875
|
+
z3.object({
|
|
5776
5876
|
...loopShared,
|
|
5777
|
-
event:
|
|
5778
|
-
round:
|
|
5779
|
-
head:
|
|
5780
|
-
green:
|
|
5781
|
-
confidence_value:
|
|
5782
|
-
confidence_reason:
|
|
5783
|
-
confidence_unavailable:
|
|
5784
|
-
extra_turn_spent:
|
|
5877
|
+
event: z3.literal("gate_result_read"),
|
|
5878
|
+
round: z3.number().int(),
|
|
5879
|
+
head: z3.string(),
|
|
5880
|
+
green: z3.boolean(),
|
|
5881
|
+
confidence_value: z3.number().int().min(0).max(100).optional(),
|
|
5882
|
+
confidence_reason: z3.string().max(CONFIDENCE_REASON_MAX_LENGTH).optional(),
|
|
5883
|
+
confidence_unavailable: z3.boolean().optional(),
|
|
5884
|
+
extra_turn_spent: z3.boolean().optional()
|
|
5785
5885
|
}).strict(),
|
|
5786
|
-
|
|
5886
|
+
z3.object({
|
|
5787
5887
|
...loopShared,
|
|
5788
|
-
event:
|
|
5789
|
-
round:
|
|
5790
|
-
head:
|
|
5791
|
-
all_approve:
|
|
5792
|
-
blockers:
|
|
5793
|
-
findings:
|
|
5888
|
+
event: z3.literal("verdicts_read"),
|
|
5889
|
+
round: z3.number().int(),
|
|
5890
|
+
head: z3.string(),
|
|
5891
|
+
all_approve: z3.boolean(),
|
|
5892
|
+
blockers: z3.number().int().nonnegative(),
|
|
5893
|
+
findings: z3.array(ReviewFindingSchema).optional(),
|
|
5894
|
+
reviewers: z3.array(ReviewerVerdictSchema).optional()
|
|
5794
5895
|
}).strict(),
|
|
5795
|
-
|
|
5896
|
+
z3.object({
|
|
5796
5897
|
...loopShared,
|
|
5797
|
-
event:
|
|
5798
|
-
round:
|
|
5799
|
-
open:
|
|
5800
|
-
resolved:
|
|
5801
|
-
new:
|
|
5802
|
-
recurring:
|
|
5898
|
+
event: z3.literal("findings_compared"),
|
|
5899
|
+
round: z3.number().int(),
|
|
5900
|
+
open: z3.array(z3.string()),
|
|
5901
|
+
resolved: z3.array(z3.string()),
|
|
5902
|
+
new: z3.array(z3.string()),
|
|
5903
|
+
recurring: z3.array(z3.string())
|
|
5803
5904
|
}).strict(),
|
|
5804
|
-
|
|
5905
|
+
z3.object({
|
|
5805
5906
|
...loopShared,
|
|
5806
|
-
event:
|
|
5807
|
-
round:
|
|
5808
|
-
condition:
|
|
5907
|
+
event: z3.literal("stop_condition_met"),
|
|
5908
|
+
round: z3.number().int(),
|
|
5909
|
+
condition: z3.enum([
|
|
5809
5910
|
"green",
|
|
5810
5911
|
"max_rounds",
|
|
5811
5912
|
"no_progress",
|
|
5812
5913
|
"escalated",
|
|
5813
5914
|
"principal_stop",
|
|
5814
5915
|
"confidence",
|
|
5815
|
-
"reappearance"
|
|
5916
|
+
"reappearance",
|
|
5917
|
+
"repeat_finding",
|
|
5918
|
+
"repeat_failure",
|
|
5919
|
+
"time_budget"
|
|
5816
5920
|
])
|
|
5817
5921
|
}).strict(),
|
|
5818
|
-
|
|
5922
|
+
z3.object({
|
|
5923
|
+
...loopShared,
|
|
5924
|
+
event: z3.literal("paused"),
|
|
5925
|
+
round: z3.number().int(),
|
|
5926
|
+
reason: z3.enum(["escalation", "principal_item", "refreeze_needed"]),
|
|
5927
|
+
reason_code: CodeTokenSchema.optional()
|
|
5928
|
+
}).strict(),
|
|
5929
|
+
z3.object({
|
|
5930
|
+
...loopShared,
|
|
5931
|
+
event: z3.literal("resumed"),
|
|
5932
|
+
round: z3.number().int(),
|
|
5933
|
+
by: z3.enum(["principal", "driver"])
|
|
5934
|
+
}).strict(),
|
|
5935
|
+
z3.object({
|
|
5819
5936
|
...loopShared,
|
|
5820
|
-
event:
|
|
5821
|
-
round:
|
|
5822
|
-
|
|
5937
|
+
event: z3.literal("cancelled"),
|
|
5938
|
+
round: z3.number().int(),
|
|
5939
|
+
by: z3.literal("principal")
|
|
5823
5940
|
}).strict(),
|
|
5824
|
-
|
|
5941
|
+
z3.object({
|
|
5825
5942
|
...loopShared,
|
|
5826
|
-
event:
|
|
5827
|
-
round:
|
|
5828
|
-
|
|
5943
|
+
event: z3.literal("unpushed_work_resume"),
|
|
5944
|
+
round: z3.number().int(),
|
|
5945
|
+
branch: z3.string(),
|
|
5946
|
+
detail: z3.string()
|
|
5829
5947
|
}).strict(),
|
|
5830
|
-
|
|
5948
|
+
z3.object({
|
|
5831
5949
|
...loopShared,
|
|
5832
|
-
event:
|
|
5833
|
-
round:
|
|
5834
|
-
|
|
5950
|
+
event: z3.literal("round_ended"),
|
|
5951
|
+
round: z3.number().int(),
|
|
5952
|
+
base_head: z3.string(),
|
|
5953
|
+
head: z3.string(),
|
|
5954
|
+
files_changed: z3.number().int().nonnegative(),
|
|
5955
|
+
insertions: z3.number().int().nonnegative(),
|
|
5956
|
+
deletions: z3.number().int().nonnegative(),
|
|
5957
|
+
wall_ms: z3.number().nonnegative(),
|
|
5958
|
+
outcome: z3.enum(["green", "changes_requested", "escalated"])
|
|
5835
5959
|
}).strict(),
|
|
5836
|
-
|
|
5960
|
+
z3.object({
|
|
5837
5961
|
...loopShared,
|
|
5838
|
-
event:
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5962
|
+
event: z3.literal("journal_finalized"),
|
|
5963
|
+
rounds: z3.number().int().nonnegative(),
|
|
5964
|
+
total_wall_ms: z3.number().nonnegative(),
|
|
5965
|
+
time_to_green_ms: z3.number().nonnegative().nullable(),
|
|
5966
|
+
files_changed_total: z3.number().int().nonnegative(),
|
|
5967
|
+
final_head: z3.string(),
|
|
5968
|
+
result: z3.enum(["merged_ready", "stopped"])
|
|
5842
5969
|
}).strict(),
|
|
5843
|
-
|
|
5970
|
+
z3.object({
|
|
5844
5971
|
...loopShared,
|
|
5845
|
-
event:
|
|
5846
|
-
round:
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
insertions: z2.number().int().nonnegative(),
|
|
5851
|
-
deletions: z2.number().int().nonnegative(),
|
|
5852
|
-
wall_ms: z2.number().nonnegative(),
|
|
5853
|
-
outcome: z2.enum(["green", "changes_requested", "escalated"])
|
|
5972
|
+
event: z3.literal("infrastructure_retry"),
|
|
5973
|
+
round: z3.number().int(),
|
|
5974
|
+
failure_kind: z3.enum(["pause_comment_post", "developer_connection"]),
|
|
5975
|
+
attempts: z3.number().int().positive(),
|
|
5976
|
+
outcome: z3.enum(["recovered", "exhausted"])
|
|
5854
5977
|
}).strict(),
|
|
5855
|
-
|
|
5978
|
+
z3.object({
|
|
5856
5979
|
...loopShared,
|
|
5857
|
-
event:
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
final_head: z2.string(),
|
|
5863
|
-
result: z2.enum(["merged_ready", "stopped"])
|
|
5980
|
+
event: z3.literal("driver_heartbeat"),
|
|
5981
|
+
task: z3.number().int(),
|
|
5982
|
+
pr: z3.number().int().positive().optional(),
|
|
5983
|
+
round: z3.number().int(),
|
|
5984
|
+
phase: z3.string()
|
|
5864
5985
|
}).strict(),
|
|
5865
|
-
|
|
5986
|
+
z3.object({
|
|
5866
5987
|
...loopShared,
|
|
5867
|
-
event:
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5988
|
+
event: z3.literal("driver_exited"),
|
|
5989
|
+
task: z3.number().int(),
|
|
5990
|
+
reason: z3.enum(["finished", "paused", "reexec", "error", "signal"]),
|
|
5991
|
+
last_decision: z3.string(),
|
|
5992
|
+
exit_code: z3.number().int().optional(),
|
|
5993
|
+
error_class: CodeTokenSchema.optional()
|
|
5872
5994
|
}).strict()
|
|
5873
5995
|
]);
|
|
5874
|
-
var ForgeOpSchema =
|
|
5996
|
+
var ForgeOpSchema = z3.enum([
|
|
5875
5997
|
"pr.create",
|
|
5876
5998
|
"pr.comment",
|
|
5877
5999
|
"pr.body.replace",
|
|
@@ -5885,24 +6007,24 @@ var ForgeOpSchema = z2.enum([
|
|
|
5885
6007
|
"label.add",
|
|
5886
6008
|
"label.remove"
|
|
5887
6009
|
]);
|
|
5888
|
-
var ForgeWriteTargetSchema =
|
|
5889
|
-
issue:
|
|
5890
|
-
pr:
|
|
6010
|
+
var ForgeWriteTargetSchema = z3.object({
|
|
6011
|
+
issue: z3.number().int().optional(),
|
|
6012
|
+
pr: z3.number().int().optional()
|
|
5891
6013
|
}).strict();
|
|
5892
6014
|
var forgeWriteShared = {
|
|
5893
6015
|
meta: HeaderMetaSchema,
|
|
5894
6016
|
subject: SubjectSchema,
|
|
5895
|
-
kind:
|
|
6017
|
+
kind: z3.literal("forge_write"),
|
|
5896
6018
|
...envelopeTail,
|
|
5897
6019
|
op: ForgeOpSchema,
|
|
5898
6020
|
target: ForgeWriteTargetSchema
|
|
5899
6021
|
};
|
|
5900
|
-
var ForgeWriteEventSchema =
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
6022
|
+
var ForgeWriteEventSchema = z3.discriminatedUnion("event", [
|
|
6023
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("validated") }).strict(),
|
|
6024
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("refused"), reason: z3.string() }).strict(),
|
|
6025
|
+
z3.object({ ...forgeWriteShared, event: z3.literal("written"), comment_ids: z3.array(z3.string()) }).strict()
|
|
5904
6026
|
]);
|
|
5905
|
-
var GateOutcomeSchema =
|
|
6027
|
+
var GateOutcomeSchema = z3.enum([
|
|
5906
6028
|
"pass",
|
|
5907
6029
|
"fail",
|
|
5908
6030
|
"wait",
|
|
@@ -5915,61 +6037,74 @@ var GateOutcomeSchema = z2.enum([
|
|
|
5915
6037
|
var gateShared = {
|
|
5916
6038
|
meta: HeaderMetaSchema,
|
|
5917
6039
|
subject: SubjectSchema,
|
|
5918
|
-
kind:
|
|
6040
|
+
kind: z3.literal("gate"),
|
|
5919
6041
|
...envelopeTail,
|
|
5920
|
-
check:
|
|
5921
|
-
check_version:
|
|
5922
|
-
policy_version:
|
|
5923
|
-
input_fingerprint:
|
|
6042
|
+
check: z3.string(),
|
|
6043
|
+
check_version: z3.string().nullable(),
|
|
6044
|
+
policy_version: z3.string().nullable(),
|
|
6045
|
+
input_fingerprint: z3.string().nullable()
|
|
5924
6046
|
};
|
|
5925
|
-
var GateEventSchema =
|
|
5926
|
-
|
|
6047
|
+
var GateEventSchema = z3.discriminatedUnion("event", [
|
|
6048
|
+
z3.object({
|
|
5927
6049
|
...gateShared,
|
|
5928
|
-
event:
|
|
6050
|
+
event: z3.literal("checked"),
|
|
5929
6051
|
outcome: GateOutcomeSchema,
|
|
5930
|
-
reason:
|
|
6052
|
+
reason: z3.string().optional()
|
|
6053
|
+
}).strict(),
|
|
6054
|
+
z3.object({
|
|
6055
|
+
meta: HeaderMetaSchema,
|
|
6056
|
+
subject: SubjectSchema,
|
|
6057
|
+
kind: z3.literal("gate"),
|
|
6058
|
+
...envelopeTail,
|
|
6059
|
+
event: z3.literal("summary"),
|
|
6060
|
+
ran: z3.number().int().nonnegative(),
|
|
6061
|
+
passed: z3.number().int().nonnegative(),
|
|
6062
|
+
failed: z3.number().int().nonnegative(),
|
|
6063
|
+
skipped: z3.number().int().nonnegative(),
|
|
6064
|
+
failed_checks: z3.array(z3.string())
|
|
5931
6065
|
}).strict()
|
|
5932
6066
|
]);
|
|
5933
|
-
var OperationResultSchema =
|
|
6067
|
+
var OperationResultSchema = z3.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
|
|
5934
6068
|
var operationShared = {
|
|
5935
6069
|
meta: HeaderMetaSchema,
|
|
5936
6070
|
subject: SubjectSchema,
|
|
5937
|
-
kind:
|
|
6071
|
+
kind: z3.literal("operation"),
|
|
5938
6072
|
...envelopeTail,
|
|
5939
|
-
operation:
|
|
5940
|
-
target:
|
|
6073
|
+
operation: z3.string(),
|
|
6074
|
+
target: z3.string().nullable()
|
|
5941
6075
|
};
|
|
5942
|
-
var OperationEventSchema =
|
|
5943
|
-
|
|
6076
|
+
var OperationEventSchema = z3.discriminatedUnion("event", [
|
|
6077
|
+
z3.object({
|
|
5944
6078
|
...operationShared,
|
|
5945
|
-
event:
|
|
6079
|
+
event: z3.literal("completed"),
|
|
5946
6080
|
result: OperationResultSchema,
|
|
5947
|
-
error_class:
|
|
6081
|
+
error_class: z3.string().nullable(),
|
|
6082
|
+
field_names: z3.array(z3.string().max(CUSTOM_FIELD_NAME_MAX_LENGTH)).max(CUSTOM_EVENT_MAX_FIELDS).optional()
|
|
5948
6083
|
}).strict()
|
|
5949
6084
|
]);
|
|
5950
|
-
var UsageUnitsSchema =
|
|
5951
|
-
input:
|
|
5952
|
-
output:
|
|
5953
|
-
cache:
|
|
6085
|
+
var UsageUnitsSchema = z3.object({
|
|
6086
|
+
input: z3.number().nonnegative().nullable(),
|
|
6087
|
+
output: z3.number().nonnegative().nullable(),
|
|
6088
|
+
cache: z3.number().nonnegative().nullable()
|
|
5954
6089
|
}).strict();
|
|
5955
6090
|
var usageShared = {
|
|
5956
6091
|
meta: HeaderMetaSchema,
|
|
5957
6092
|
subject: SubjectSchema,
|
|
5958
|
-
kind:
|
|
6093
|
+
kind: z3.literal("usage"),
|
|
5959
6094
|
...envelopeTail,
|
|
5960
|
-
model:
|
|
5961
|
-
source:
|
|
5962
|
-
semantics:
|
|
6095
|
+
model: z3.string().nullable(),
|
|
6096
|
+
source: z3.string(),
|
|
6097
|
+
semantics: z3.enum(["cumulative", "delta"])
|
|
5963
6098
|
};
|
|
5964
|
-
var UsageEventSchema =
|
|
5965
|
-
|
|
6099
|
+
var UsageEventSchema = z3.discriminatedUnion("event", [
|
|
6100
|
+
z3.object({
|
|
5966
6101
|
...usageShared,
|
|
5967
|
-
event:
|
|
6102
|
+
event: z3.literal("observed"),
|
|
5968
6103
|
units: UsageUnitsSchema,
|
|
5969
|
-
unknown_reason:
|
|
6104
|
+
unknown_reason: z3.string().nullable()
|
|
5970
6105
|
}).strict()
|
|
5971
6106
|
]);
|
|
5972
|
-
var RoleAttemptOutcomeSchema =
|
|
6107
|
+
var RoleAttemptOutcomeSchema = z3.enum([
|
|
5973
6108
|
"completed",
|
|
5974
6109
|
"incomplete",
|
|
5975
6110
|
"infrastructure_failed",
|
|
@@ -5980,17 +6115,17 @@ var RoleAttemptOutcomeSchema = z2.enum([
|
|
|
5980
6115
|
var roleAttemptShared = {
|
|
5981
6116
|
meta: HeaderMetaSchema,
|
|
5982
6117
|
subject: SubjectSchema,
|
|
5983
|
-
kind:
|
|
6118
|
+
kind: z3.literal("role_attempt"),
|
|
5984
6119
|
...envelopeTail,
|
|
5985
|
-
actor:
|
|
5986
|
-
attempt:
|
|
5987
|
-
effect_id:
|
|
5988
|
-
model:
|
|
6120
|
+
actor: z3.string().nullable(),
|
|
6121
|
+
attempt: z3.number().int().nullable(),
|
|
6122
|
+
effect_id: z3.string(),
|
|
6123
|
+
model: z3.string().nullable()
|
|
5989
6124
|
};
|
|
5990
|
-
var RoleAttemptEventSchema =
|
|
5991
|
-
|
|
6125
|
+
var RoleAttemptEventSchema = z3.discriminatedUnion("event", [
|
|
6126
|
+
z3.object({
|
|
5992
6127
|
...roleAttemptShared,
|
|
5993
|
-
event:
|
|
6128
|
+
event: z3.literal("attempted"),
|
|
5994
6129
|
outcome: RoleAttemptOutcomeSchema,
|
|
5995
6130
|
usage: dispatchUsageField
|
|
5996
6131
|
}).strict()
|
|
@@ -5998,42 +6133,59 @@ var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
|
|
|
5998
6133
|
var handoffShared = {
|
|
5999
6134
|
meta: HeaderMetaSchema,
|
|
6000
6135
|
subject: SubjectSchema,
|
|
6001
|
-
kind:
|
|
6136
|
+
kind: z3.literal("handoff"),
|
|
6002
6137
|
...envelopeTail,
|
|
6003
|
-
class:
|
|
6004
|
-
reason:
|
|
6138
|
+
class: z3.enum(["authority", "strategy", "product"]),
|
|
6139
|
+
reason: z3.string()
|
|
6005
6140
|
};
|
|
6006
|
-
var HandoffEventSchema =
|
|
6007
|
-
|
|
6141
|
+
var HandoffEventSchema = z3.discriminatedUnion("event", [
|
|
6142
|
+
z3.object({
|
|
6008
6143
|
...handoffShared,
|
|
6009
|
-
event:
|
|
6010
|
-
requested_decision:
|
|
6144
|
+
event: z3.literal("raised"),
|
|
6145
|
+
requested_decision: z3.string().nullable()
|
|
6011
6146
|
}).strict(),
|
|
6012
|
-
|
|
6147
|
+
z3.object({
|
|
6013
6148
|
...handoffShared,
|
|
6014
|
-
event:
|
|
6015
|
-
resolution:
|
|
6016
|
-
resolved_by:
|
|
6149
|
+
event: z3.literal("resolved"),
|
|
6150
|
+
resolution: z3.string().nullable(),
|
|
6151
|
+
resolved_by: z3.string().nullable()
|
|
6017
6152
|
}).strict()
|
|
6018
6153
|
]);
|
|
6019
|
-
var EffectTargetSchema =
|
|
6020
|
-
kind:
|
|
6021
|
-
ref:
|
|
6154
|
+
var EffectTargetSchema = z3.object({
|
|
6155
|
+
kind: z3.string(),
|
|
6156
|
+
ref: z3.string()
|
|
6022
6157
|
}).strict();
|
|
6023
6158
|
var effectShared = {
|
|
6024
6159
|
meta: HeaderMetaSchema,
|
|
6025
6160
|
subject: SubjectSchema,
|
|
6026
|
-
kind:
|
|
6161
|
+
kind: z3.literal("effect"),
|
|
6027
6162
|
...envelopeTail,
|
|
6028
|
-
effect_id:
|
|
6163
|
+
effect_id: z3.string(),
|
|
6029
6164
|
target: EffectTargetSchema
|
|
6030
6165
|
};
|
|
6031
|
-
var EffectEventSchema =
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6166
|
+
var EffectEventSchema = z3.discriminatedUnion("event", [
|
|
6167
|
+
z3.object({ ...effectShared, event: z3.literal("attempted") }).strict(),
|
|
6168
|
+
z3.object({ ...effectShared, event: z3.literal("observed"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict(),
|
|
6169
|
+
z3.object({ ...effectShared, event: z3.literal("verified"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict()
|
|
6170
|
+
]);
|
|
6171
|
+
var CustomFieldValueSchema = z3.union([z3.string().max(CUSTOM_TEXT_MAX_LENGTH), z3.number().finite(), z3.boolean()]);
|
|
6172
|
+
var customShared = {
|
|
6173
|
+
meta: HeaderMetaV3Schema,
|
|
6174
|
+
subject: SubjectSchema,
|
|
6175
|
+
kind: z3.literal("custom"),
|
|
6176
|
+
...envelopeTail
|
|
6177
|
+
};
|
|
6178
|
+
var CustomEventSchema = z3.discriminatedUnion("event", [
|
|
6179
|
+
z3.object({
|
|
6180
|
+
...customShared,
|
|
6181
|
+
event: z3.literal("recorded"),
|
|
6182
|
+
name: z3.string().max(CUSTOM_EVENT_NAME_MAX_LENGTH).regex(CUSTOM_EVENT_NAME_PATTERN),
|
|
6183
|
+
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, {
|
|
6184
|
+
message: `custom: at most ${CUSTOM_EVENT_MAX_FIELDS} fields`
|
|
6185
|
+
})
|
|
6186
|
+
}).strict()
|
|
6035
6187
|
]);
|
|
6036
|
-
var LogEventSchema =
|
|
6188
|
+
var LogEventSchema = z3.union([
|
|
6037
6189
|
DispatchEventSchema,
|
|
6038
6190
|
DevReviewLoopEventSchema,
|
|
6039
6191
|
ForgeWriteEventSchema,
|
|
@@ -6042,10 +6194,11 @@ var LogEventSchema = z2.union([
|
|
|
6042
6194
|
UsageEventSchema,
|
|
6043
6195
|
RoleAttemptEventSchema,
|
|
6044
6196
|
HandoffEventSchema,
|
|
6045
|
-
EffectEventSchema
|
|
6197
|
+
EffectEventSchema,
|
|
6198
|
+
CustomEventSchema
|
|
6046
6199
|
]);
|
|
6047
|
-
|
|
6048
6200
|
// ../../packages/aeg-core/src/log/envelope.ts
|
|
6201
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
6049
6202
|
function isRole(value) {
|
|
6050
6203
|
return value !== undefined && ROLE_VALUES.includes(value);
|
|
6051
6204
|
}
|
|
@@ -6082,18 +6235,27 @@ function roundFromEnv(round) {
|
|
|
6082
6235
|
const n = Number(round);
|
|
6083
6236
|
return Number.isInteger(n) ? n : undefined;
|
|
6084
6237
|
}
|
|
6238
|
+
function prFromEnv(pr) {
|
|
6239
|
+
if (pr === undefined || pr === "")
|
|
6240
|
+
return;
|
|
6241
|
+
const n = Number(pr);
|
|
6242
|
+
return Number.isInteger(n) && n > 0 ? n : undefined;
|
|
6243
|
+
}
|
|
6085
6244
|
function buildHeader(input) {
|
|
6086
6245
|
const role = isRole(input.env.role) ? input.env.role : "unattributed";
|
|
6087
6246
|
const round = roundFromEnv(input.env.round);
|
|
6247
|
+
const pr = prFromEnv(input.env.pr);
|
|
6088
6248
|
const subject = {
|
|
6089
6249
|
issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
|
|
6090
6250
|
role,
|
|
6091
6251
|
...round !== undefined ? { round } : {},
|
|
6252
|
+
...pr !== undefined ? { pr } : {},
|
|
6092
6253
|
...input.subject ?? {}
|
|
6093
6254
|
};
|
|
6255
|
+
const issue = subject.issue;
|
|
6094
6256
|
return {
|
|
6095
6257
|
meta: {
|
|
6096
|
-
schema:
|
|
6258
|
+
schema: 3,
|
|
6097
6259
|
ts: input.now.toISOString(),
|
|
6098
6260
|
run_id: input.runId,
|
|
6099
6261
|
seq: input.seq,
|
|
@@ -6116,7 +6278,19 @@ function buildHeader(input) {
|
|
|
6116
6278
|
ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
|
|
6117
6279
|
policy_digest: input.inputVersions?.policyDigest ?? null
|
|
6118
6280
|
},
|
|
6119
|
-
provenance: provenanceFor(input)
|
|
6281
|
+
provenance: provenanceFor(input),
|
|
6282
|
+
work: {
|
|
6283
|
+
ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
|
|
6284
|
+
repo: input.repo,
|
|
6285
|
+
change: null,
|
|
6286
|
+
revision: null
|
|
6287
|
+
},
|
|
6288
|
+
flow: {
|
|
6289
|
+
id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
|
|
6290
|
+
version: lineageFieldFromEnv(input.env.flowVersion)
|
|
6291
|
+
},
|
|
6292
|
+
runtime: lineageFieldFromEnv(input.env.runtime),
|
|
6293
|
+
source: lineageFieldFromEnv(input.env.source)
|
|
6120
6294
|
},
|
|
6121
6295
|
subject
|
|
6122
6296
|
};
|
|
@@ -6159,7 +6333,7 @@ function redact(value, home) {
|
|
|
6159
6333
|
return value;
|
|
6160
6334
|
}
|
|
6161
6335
|
// ../../packages/aeg-core/src/log/store.ts
|
|
6162
|
-
var KNOWN_SCHEMA_VERSIONS = [1, 2];
|
|
6336
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
|
|
6163
6337
|
function metaOf(obj) {
|
|
6164
6338
|
if (obj === null || typeof obj !== "object")
|
|
6165
6339
|
return null;
|
|
@@ -6225,7 +6399,7 @@ function classifyStoredLine(raw, home) {
|
|
|
6225
6399
|
return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
|
|
6226
6400
|
}
|
|
6227
6401
|
const redacted = redact(event, home);
|
|
6228
|
-
const provenance = version
|
|
6402
|
+
const provenance = version >= 2 ? event.meta.provenance ?? null : null;
|
|
6229
6403
|
return {
|
|
6230
6404
|
status: "ok",
|
|
6231
6405
|
identity,
|
|
@@ -6238,134 +6412,143 @@ function classifyStoredLine(raw, home) {
|
|
|
6238
6412
|
};
|
|
6239
6413
|
}
|
|
6240
6414
|
// ../../packages/aeg-core/src/control-store/records.ts
|
|
6241
|
-
import { z as
|
|
6242
|
-
var isoTimestamp =
|
|
6243
|
-
var taskId =
|
|
6244
|
-
var epochNumber =
|
|
6245
|
-
var RunRecordSchema =
|
|
6246
|
-
version:
|
|
6247
|
-
kind:
|
|
6415
|
+
import { z as z4 } from "zod";
|
|
6416
|
+
var isoTimestamp = z4.string().min(1);
|
|
6417
|
+
var taskId = z4.number().int().positive();
|
|
6418
|
+
var epochNumber = z4.number().int().nonnegative();
|
|
6419
|
+
var RunRecordSchema = z4.object({
|
|
6420
|
+
version: z4.literal(1),
|
|
6421
|
+
kind: z4.literal("run"),
|
|
6248
6422
|
task: taskId,
|
|
6249
|
-
runId:
|
|
6250
|
-
pid:
|
|
6251
|
-
host:
|
|
6423
|
+
runId: z4.string().min(1),
|
|
6424
|
+
pid: z4.number().int().positive(),
|
|
6425
|
+
host: z4.string().min(1),
|
|
6252
6426
|
startedAt: isoTimestamp,
|
|
6253
|
-
childStartedAt:
|
|
6254
|
-
childCommand:
|
|
6427
|
+
childStartedAt: z4.string().min(1).nullable().optional(),
|
|
6428
|
+
childCommand: z4.string().min(1).nullable().optional()
|
|
6255
6429
|
}).strict();
|
|
6256
|
-
var InputRecordSchema =
|
|
6257
|
-
version:
|
|
6258
|
-
kind:
|
|
6430
|
+
var InputRecordSchema = z4.object({
|
|
6431
|
+
version: z4.literal(1),
|
|
6432
|
+
kind: z4.literal("input"),
|
|
6259
6433
|
task: taskId,
|
|
6260
|
-
runId:
|
|
6261
|
-
source:
|
|
6262
|
-
pr:
|
|
6263
|
-
round:
|
|
6434
|
+
runId: z4.string().min(1),
|
|
6435
|
+
source: z4.union([z4.literal("fresh"), z4.literal("resume")]),
|
|
6436
|
+
pr: z4.number().int().positive().nullable(),
|
|
6437
|
+
round: z4.number().int().nonnegative(),
|
|
6264
6438
|
recordedAt: isoTimestamp
|
|
6265
6439
|
}).strict();
|
|
6266
|
-
var OwnershipRecordSchema =
|
|
6267
|
-
version:
|
|
6268
|
-
kind:
|
|
6440
|
+
var OwnershipRecordSchema = z4.object({
|
|
6441
|
+
version: z4.literal(1),
|
|
6442
|
+
kind: z4.literal("ownership"),
|
|
6269
6443
|
task: taskId,
|
|
6270
6444
|
epoch: epochNumber,
|
|
6271
|
-
ownerId:
|
|
6272
|
-
pid:
|
|
6273
|
-
host:
|
|
6445
|
+
ownerId: z4.string().min(1),
|
|
6446
|
+
pid: z4.number().int().positive(),
|
|
6447
|
+
host: z4.string().min(1),
|
|
6274
6448
|
acquiredAt: isoTimestamp
|
|
6275
6449
|
}).strict();
|
|
6276
|
-
var TransitionRecordSchema =
|
|
6277
|
-
version:
|
|
6278
|
-
kind:
|
|
6450
|
+
var TransitionRecordSchema = z4.object({
|
|
6451
|
+
version: z4.literal(1),
|
|
6452
|
+
kind: z4.literal("transition"),
|
|
6279
6453
|
task: taskId,
|
|
6280
6454
|
epoch: epochNumber,
|
|
6281
|
-
seq:
|
|
6282
|
-
from:
|
|
6283
|
-
to:
|
|
6284
|
-
detail:
|
|
6455
|
+
seq: z4.number().int().nonnegative(),
|
|
6456
|
+
from: z4.string().min(1),
|
|
6457
|
+
to: z4.string().min(1),
|
|
6458
|
+
detail: z4.string().optional(),
|
|
6285
6459
|
at: isoTimestamp
|
|
6286
6460
|
}).strict();
|
|
6287
|
-
var ManifestRecordSchema =
|
|
6288
|
-
version:
|
|
6289
|
-
kind:
|
|
6461
|
+
var ManifestRecordSchema = z4.object({
|
|
6462
|
+
version: z4.literal(1),
|
|
6463
|
+
kind: z4.literal("manifest"),
|
|
6290
6464
|
task: taskId,
|
|
6291
6465
|
round: epochNumber,
|
|
6292
|
-
repository:
|
|
6293
|
-
pr:
|
|
6294
|
-
branch:
|
|
6295
|
-
baseSha:
|
|
6296
|
-
headSha:
|
|
6297
|
-
briefHash:
|
|
6298
|
-
objectivesVersion:
|
|
6466
|
+
repository: z4.string().min(1),
|
|
6467
|
+
pr: z4.number().int().positive(),
|
|
6468
|
+
branch: z4.string().min(1),
|
|
6469
|
+
baseSha: z4.string().min(1).nullable(),
|
|
6470
|
+
headSha: z4.string().min(1),
|
|
6471
|
+
briefHash: z4.string().min(1).nullable(),
|
|
6472
|
+
objectivesVersion: z4.string().min(1).nullable(),
|
|
6299
6473
|
rulingOrdinal: epochNumber,
|
|
6300
|
-
policyDigest:
|
|
6474
|
+
policyDigest: z4.string().min(1),
|
|
6301
6475
|
recordedAt: isoTimestamp
|
|
6302
6476
|
}).strict();
|
|
6303
|
-
var roundHeadIdentity =
|
|
6304
|
-
var LoopBudgetsSchema =
|
|
6305
|
-
mechanicalRetries:
|
|
6306
|
-
reviewRounds:
|
|
6307
|
-
infrastructureRetries:
|
|
6477
|
+
var roundHeadIdentity = z4.object({ round: z4.number().int().positive(), head: z4.string().min(1) }).strict();
|
|
6478
|
+
var LoopBudgetsSchema = z4.object({
|
|
6479
|
+
mechanicalRetries: z4.number().int().nonnegative(),
|
|
6480
|
+
reviewRounds: z4.number().int().nonnegative(),
|
|
6481
|
+
infrastructureRetries: z4.number().int().nonnegative()
|
|
6308
6482
|
}).strict();
|
|
6309
|
-
var LoopStateRecordSchema =
|
|
6310
|
-
version:
|
|
6311
|
-
kind:
|
|
6483
|
+
var LoopStateRecordSchema = z4.object({
|
|
6484
|
+
version: z4.literal(1),
|
|
6485
|
+
kind: z4.literal("loop_state"),
|
|
6312
6486
|
task: taskId,
|
|
6313
|
-
round:
|
|
6314
|
-
phase:
|
|
6315
|
-
pauseReason:
|
|
6487
|
+
round: z4.number().int().positive(),
|
|
6488
|
+
phase: z4.string().min(1),
|
|
6489
|
+
pauseReason: z4.string().min(1).nullable(),
|
|
6316
6490
|
budgets: LoopBudgetsSchema,
|
|
6317
6491
|
heldResult: roundHeadIdentity.nullable(),
|
|
6318
6492
|
deliveredFindings: roundHeadIdentity.nullable(),
|
|
6493
|
+
repeatMemory: z4.object({
|
|
6494
|
+
blockingFindings: z4.array(z4.string()),
|
|
6495
|
+
lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
|
|
6496
|
+
}).strict().optional(),
|
|
6497
|
+
publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
|
|
6498
|
+
taskStartedAt: isoTimestamp.optional(),
|
|
6499
|
+
phaseMs: z4.record(z4.string(), z4.number().nonnegative()).optional(),
|
|
6319
6500
|
recordedAt: isoTimestamp
|
|
6320
6501
|
}).strict();
|
|
6321
|
-
var EffectRecordSchema =
|
|
6322
|
-
version:
|
|
6323
|
-
kind:
|
|
6502
|
+
var EffectRecordSchema = z4.object({
|
|
6503
|
+
version: z4.literal(1),
|
|
6504
|
+
kind: z4.literal("effect"),
|
|
6324
6505
|
task: taskId,
|
|
6325
|
-
key:
|
|
6326
|
-
operation:
|
|
6327
|
-
target:
|
|
6328
|
-
inputVersion:
|
|
6329
|
-
payloadDigest:
|
|
6330
|
-
status:
|
|
6331
|
-
url:
|
|
6506
|
+
key: z4.string().min(1),
|
|
6507
|
+
operation: z4.string().min(1),
|
|
6508
|
+
target: z4.string().min(1),
|
|
6509
|
+
inputVersion: z4.number().int().nonnegative(),
|
|
6510
|
+
payloadDigest: z4.string().min(1),
|
|
6511
|
+
status: z4.union([z4.literal("started"), z4.literal("verified"), z4.literal("uncertain")]),
|
|
6512
|
+
url: z4.string().optional(),
|
|
6332
6513
|
recordedAt: isoTimestamp
|
|
6333
6514
|
}).strict();
|
|
6334
|
-
var EscalationRecordSchema =
|
|
6335
|
-
version:
|
|
6336
|
-
kind:
|
|
6515
|
+
var EscalationRecordSchema = z4.object({
|
|
6516
|
+
version: z4.literal(1),
|
|
6517
|
+
kind: z4.literal("escalation"),
|
|
6337
6518
|
task: taskId,
|
|
6338
|
-
escalationId:
|
|
6519
|
+
escalationId: z4.string().min(1),
|
|
6339
6520
|
round: epochNumber,
|
|
6340
|
-
head:
|
|
6341
|
-
branch:
|
|
6342
|
-
pr:
|
|
6343
|
-
runId:
|
|
6344
|
-
pid:
|
|
6345
|
-
host:
|
|
6346
|
-
agent:
|
|
6347
|
-
reason:
|
|
6348
|
-
detail:
|
|
6349
|
-
evidence:
|
|
6350
|
-
attemptedRecovery:
|
|
6351
|
-
requestedDecision:
|
|
6352
|
-
recipient:
|
|
6353
|
-
briefHash:
|
|
6354
|
-
objectivesVersion:
|
|
6521
|
+
head: z4.string().min(1),
|
|
6522
|
+
branch: z4.string().min(1),
|
|
6523
|
+
pr: z4.number().int().positive().nullable(),
|
|
6524
|
+
runId: z4.string().min(1),
|
|
6525
|
+
pid: z4.number().int().positive(),
|
|
6526
|
+
host: z4.string().min(1),
|
|
6527
|
+
agent: z4.string().min(1).optional(),
|
|
6528
|
+
reason: z4.string().min(1),
|
|
6529
|
+
detail: z4.string().optional(),
|
|
6530
|
+
evidence: z4.string().optional(),
|
|
6531
|
+
attemptedRecovery: z4.string().min(1),
|
|
6532
|
+
requestedDecision: z4.string().min(1),
|
|
6533
|
+
recipient: z4.string().min(1),
|
|
6534
|
+
briefHash: z4.string().min(1).nullable(),
|
|
6535
|
+
objectivesVersion: z4.string().min(1).nullable(),
|
|
6355
6536
|
rulingOrdinal: epochNumber,
|
|
6356
|
-
policyDigest:
|
|
6537
|
+
policyDigest: z4.string().min(1),
|
|
6357
6538
|
recordedAt: isoTimestamp
|
|
6358
6539
|
}).strict();
|
|
6359
|
-
var ResolutionRecordSchema =
|
|
6360
|
-
version:
|
|
6361
|
-
kind:
|
|
6540
|
+
var ResolutionRecordSchema = z4.object({
|
|
6541
|
+
version: z4.literal(1),
|
|
6542
|
+
kind: z4.literal("resolution"),
|
|
6362
6543
|
task: taskId,
|
|
6363
|
-
escalationId:
|
|
6364
|
-
decision:
|
|
6365
|
-
authenticatedBy:
|
|
6366
|
-
authenticatedFrom:
|
|
6544
|
+
escalationId: z4.string().min(1),
|
|
6545
|
+
decision: z4.union([z4.literal("resume"), z4.literal("cancel")]),
|
|
6546
|
+
authenticatedBy: z4.string().min(1),
|
|
6547
|
+
authenticatedFrom: z4.string().min(1),
|
|
6367
6548
|
consumedAt: isoTimestamp
|
|
6368
6549
|
}).strict();
|
|
6550
|
+
// ../../packages/aeg-core/src/control-store/local.ts
|
|
6551
|
+
var CONTROL_AREA_DIRNAME = "control";
|
|
6369
6552
|
// src/checks/contract.ts
|
|
6370
6553
|
var CHECK_SCHEMA_VERSION = 1;
|
|
6371
6554
|
function emitCheckError(error) {
|