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