@attalabs/vinaya 0.27.0 → 0.29.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 +5 -4
- package/aeg-root/contracts/planner-developer.md +4 -1
- package/aeg-root/contracts/planner-operator.md +86 -0
- package/aeg-root/contracts/principal-operator.md +88 -0
- package/aeg-root/enforcement.md +4 -4
- package/aeg-root/roles/developer.md +25 -18
- package/aeg-root/roles/operator.md +133 -0
- package/aeg-root/roles/planner.md +6 -0
- package/aeg-root/roles/principal.md +4 -0
- package/aeg-root/roles/reviewer.md +3 -3
- package/aeg-root/roles/security.md +3 -3
- package/aeg-root/skills/aeg-context-packets/SKILL.md +123 -0
- package/aeg-root/skills/aeg-context-packets/examples/operator-start.md +30 -0
- package/aeg-root/templates/brief-template.md +6 -2
- package/dist/checks/bin/check-body-bare-digits.js +1275 -240
- package/dist/checks/bin/check-branch-topology.js +1207 -180
- package/dist/checks/bin/check-brief-shape.js +1279 -243
- package/dist/checks/bin/check-changeset-coverage.js +2176 -264
- package/dist/checks/bin/check-closes-n.js +1211 -184
- package/dist/checks/bin/check-coherence.js +1378 -265
- package/dist/checks/bin/check-dead-branch-push.js +1158 -176
- package/dist/checks/bin/check-dispatch-readiness.js +1440 -276
- package/dist/checks/bin/check-doc-coverage-push.js +2171 -259
- package/dist/checks/bin/check-doc-coverage.js +2173 -261
- package/dist/checks/bin/check-doctrine-no-procedures.js +1275 -240
- package/dist/checks/bin/check-doctrine-portability.js +2171 -259
- package/dist/checks/bin/check-evidence-fresh.js +2613 -347
- package/dist/checks/bin/check-exec-bits.js +2169 -257
- package/dist/checks/bin/check-first-push-dispatch.js +1326 -246
- package/dist/checks/bin/check-issue-assignment.js +1209 -182
- package/dist/checks/bin/check-issue-milestone-attach.js +6087 -0
- package/dist/checks/bin/check-issue-objectives-numbering.js +6089 -0
- package/dist/checks/bin/check-issue-parts-coverage.js +6089 -0
- package/dist/checks/bin/check-issue-surface-globs.js +7304 -0
- package/dist/checks/bin/check-issue-title-grammar.js +6089 -0
- package/dist/checks/bin/check-issue-tranche-label.js +6089 -0
- package/dist/checks/bin/check-main-branch-refusal.js +1158 -176
- package/dist/checks/bin/check-no-disk-state.js +1158 -176
- package/dist/checks/bin/check-pr-premise-reassert.js +1275 -240
- package/dist/checks/bin/check-pr-report-density.js +1158 -176
- package/dist/checks/bin/check-quoted-command.js +2150 -257
- package/dist/checks/bin/check-reader-resolvable-prose.js +2153 -260
- package/dist/checks/bin/check-registry-gates.js +1245 -176
- package/dist/checks/bin/check-retired-vocabulary.js +2148 -255
- package/dist/checks/bin/check-review-gate.js +1375 -245
- package/dist/checks/bin/check-single-plan-pr.js +1158 -176
- package/dist/checks/bin/check-surface-scope.js +1217 -182
- package/dist/checks/bin/check-test-plan.js +1187 -189
- package/dist/checks/bin/check-token-collection-wired.js +1158 -176
- package/dist/checks/bin/check-token-report.js +1171 -179
- package/dist/checks/bin/check-workspace-escape.js +2167 -255
- package/dist/index.js +17322 -8709
- package/dist/lib/pre-push-changed-files.js +57 -0
- package/dist/lib/pre-push-select-tests.js +1616 -0
- package/package.json +4 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -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/server/app/_global-error/page.js +2 -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 +8 -7
- 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 +8 -7
- 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 +9 -8
- 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 +9 -8
- 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 +8 -7
- 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 +16 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +10 -8
- 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 +8 -7
- 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 +8 -7
- 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 +9 -8
- 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/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]__08f5pba._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1o_0tjy._.js → [root-of-the-server]__0h9yhwx._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0053k9k._.js → [root-of-the-server]__0ls23oh._.js} +3 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0puovz5._.js → [root-of-the-server]__0nye8tb._.js} +3 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__18kqy4q._.js → [root-of-the-server]__0tfykr-._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0o771t1._.js → [root-of-the-server]__0th3gyp._.js} +3 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1-zcufa._.js +51 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0p8q38b._.js → [root-of-the-server]__11svemm._.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__02c71kv._.js → [root-of-the-server]__140m1i_._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1bh2awk._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0112h-k._.js → [root-of-the-server]__1gjqmhq._.js} +3 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1qmxez3._.js +4 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1r47dr7._.js +28 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_01fv4fj._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_0gvm3og._.js → _096f46i._.js} +3 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_0lwxg63._.js → _0af2one._.js} +3 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_1n0cnq-._.js → _0zf4d27._.js} +45 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_03x_w6q._.js → _1-wo68i._.js} +3 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_05ufo8i._.js +1 -12
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_1wdusod._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{node_modules_1vo08dj._.js → node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js} +3 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_next_1khj-jh._.js +3 -0
- 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 +17 -5
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3_9xytdmiv1xi.js → 25f3-jtiv8p5n.js} +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{0bn8c8v5q429o.js → 27-6ym7lp2v8o.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3-6a3tinbdb-7.js → 3daxns3o--9me.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/tsconfig.json +12 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0z6dav-._.js +0 -51
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__13rrmhr._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__17h4sy8._.js +0 -45
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1hs0dcu._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_next_17sz44y._.js +0 -3
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{DMofV2-9FrHE7100GfrpI → -UC6GS6zDHeiawEYgYbTN}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{DMofV2-9FrHE7100GfrpI → -UC6GS6zDHeiawEYgYbTN}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{DMofV2-9FrHE7100GfrpI → -UC6GS6zDHeiawEYgYbTN}/_ssgManifest.js +0 -0
|
@@ -3,8 +3,8 @@ import { createRequire } from "node:module";
|
|
|
3
3
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
4
4
|
|
|
5
5
|
// src/checks/bin/check-workspace-escape.ts
|
|
6
|
-
import { readdirSync, readFileSync as
|
|
7
|
-
import { join as
|
|
6
|
+
import { readdirSync, readFileSync as readFileSync4, statSync } from "node:fs";
|
|
7
|
+
import { join as join6 } from "node:path";
|
|
8
8
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
9
9
|
var GATE_AUDIENCE = {
|
|
10
10
|
"check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
|
|
@@ -1645,6 +1645,52 @@ var systemEnv3 = {
|
|
|
1645
1645
|
...process.env,
|
|
1646
1646
|
PATH: [process.env.PATH, "/opt/homebrew/bin", "/usr/local/bin", "/usr/bin", "/bin"].filter(Boolean).join(":")
|
|
1647
1647
|
};
|
|
1648
|
+
var defaultExec = () => execFileAsync3("git", ["remote", "get-url", "origin"], { env: systemEnv3, timeout: 5000 });
|
|
1649
|
+
var cached;
|
|
1650
|
+
var inflight;
|
|
1651
|
+
async function resolveRepo(exec = defaultExec) {
|
|
1652
|
+
if (cached !== undefined)
|
|
1653
|
+
return cached;
|
|
1654
|
+
const fromEnv = process.env.AEG_REPO;
|
|
1655
|
+
if (fromEnv) {
|
|
1656
|
+
const parsed = parseOwnerRepo(fromEnv);
|
|
1657
|
+
if (parsed) {
|
|
1658
|
+
cached = parsed;
|
|
1659
|
+
return cached;
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
if (inflight)
|
|
1663
|
+
return inflight;
|
|
1664
|
+
inflight = (async () => {
|
|
1665
|
+
try {
|
|
1666
|
+
const { stdout } = await exec();
|
|
1667
|
+
cached = parseGitRemoteUrl(stdout.trim());
|
|
1668
|
+
return cached;
|
|
1669
|
+
} catch (err) {
|
|
1670
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
1671
|
+
console.warn(`[aeg-forge-state] resolveRepo: git remote lookup failed (will retry): ${message}`);
|
|
1672
|
+
return null;
|
|
1673
|
+
} finally {
|
|
1674
|
+
inflight = undefined;
|
|
1675
|
+
}
|
|
1676
|
+
})();
|
|
1677
|
+
return inflight;
|
|
1678
|
+
}
|
|
1679
|
+
function parseGitRemoteUrl(url) {
|
|
1680
|
+
const ssh = url.match(/^git@github\.com:([^/]+)\/(.+?)(?:\.git)?$/);
|
|
1681
|
+
if (ssh?.[1] && ssh[2])
|
|
1682
|
+
return { owner: ssh[1], repo: ssh[2] };
|
|
1683
|
+
const https = url.match(/^https?:\/\/(?:[^@]+@)?github\.com\/([^/]+)\/(.+?)(?:\.git)?\/?$/);
|
|
1684
|
+
if (https?.[1] && https[2])
|
|
1685
|
+
return { owner: https[1], repo: https[2] };
|
|
1686
|
+
return null;
|
|
1687
|
+
}
|
|
1688
|
+
function parseOwnerRepo(value) {
|
|
1689
|
+
const match = value.match(/^([^/]+)\/(.+)$/);
|
|
1690
|
+
if (!match?.[1] || !match[2])
|
|
1691
|
+
return null;
|
|
1692
|
+
return { owner: match[1], repo: match[2] };
|
|
1693
|
+
}
|
|
1648
1694
|
// ../../packages/aeg-core/src/anchored-region.ts
|
|
1649
1695
|
function anchoredRegionBounds(body, field) {
|
|
1650
1696
|
const masked = maskCode(body);
|
|
@@ -1955,6 +2001,9 @@ function parseInlineFieldList(section) {
|
|
|
1955
2001
|
var HEAD_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged head:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
1956
2002
|
var OBJECTIVES_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Objectives version:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
1957
2003
|
var RULING_ORDINAL_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Ruling ordinal:\s*(\d+)(?!\d)/im;
|
|
2004
|
+
var BRIEF_HASH_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Brief hash:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
2005
|
+
var POLICY_DIGEST_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Policy digest:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
2006
|
+
var BASE_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged base:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
1958
2007
|
function firstFiveLines(comment) {
|
|
1959
2008
|
return comment.split(`
|
|
1960
2009
|
`).slice(0, 5).join(`
|
|
@@ -1977,6 +2026,35 @@ function extractRulingOrdinal(comment) {
|
|
|
1977
2026
|
const m = firstSevenLines(comment).match(RULING_ORDINAL_PATTERN);
|
|
1978
2027
|
return m ? Number.parseInt(m[1], 10) : null;
|
|
1979
2028
|
}
|
|
2029
|
+
function firstElevenLines(comment) {
|
|
2030
|
+
return comment.split(`
|
|
2031
|
+
`).slice(0, 11).join(`
|
|
2032
|
+
`);
|
|
2033
|
+
}
|
|
2034
|
+
function extractBriefHash(comment) {
|
|
2035
|
+
const m = firstElevenLines(comment).match(BRIEF_HASH_PATTERN);
|
|
2036
|
+
return m ? m[1].toLowerCase() : null;
|
|
2037
|
+
}
|
|
2038
|
+
function extractPolicyDigest(comment) {
|
|
2039
|
+
const m = firstElevenLines(comment).match(POLICY_DIGEST_PATTERN);
|
|
2040
|
+
return m ? m[1].toLowerCase() : null;
|
|
2041
|
+
}
|
|
2042
|
+
function firstThirteenLines(comment) {
|
|
2043
|
+
return comment.split(`
|
|
2044
|
+
`).slice(0, 13).join(`
|
|
2045
|
+
`);
|
|
2046
|
+
}
|
|
2047
|
+
function extractBaseSha(comment) {
|
|
2048
|
+
const m = firstThirteenLines(comment).match(BASE_SHA_PATTERN);
|
|
2049
|
+
return m ? m[1].toLowerCase() : null;
|
|
2050
|
+
}
|
|
2051
|
+
var FINDING_SEVERITY_LINE = /^\d+\.\s+\[([A-Z][A-Z]*)\]\s+(.+?)\s+—/gm;
|
|
2052
|
+
function extractFindingSeverities(comment) {
|
|
2053
|
+
return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) => ({
|
|
2054
|
+
severity: m[1],
|
|
2055
|
+
location: m[2]
|
|
2056
|
+
}));
|
|
2057
|
+
}
|
|
1980
2058
|
function extractVerdict(comments, valuePattern, missingLabel) {
|
|
1981
2059
|
const candidates = comments.filter((c) => valuePattern.test(c));
|
|
1982
2060
|
if (candidates.length === 0) {
|
|
@@ -1985,6 +2063,10 @@ function extractVerdict(comments, valuePattern, missingLabel) {
|
|
|
1985
2063
|
headSha: null,
|
|
1986
2064
|
objectivesVersion: null,
|
|
1987
2065
|
rulingOrdinal: null,
|
|
2066
|
+
briefHash: null,
|
|
2067
|
+
policyDigest: null,
|
|
2068
|
+
baseSha: null,
|
|
2069
|
+
findingSeverities: [],
|
|
1988
2070
|
danglingNote: `no ${missingLabel} verdict comment found on this PR`
|
|
1989
2071
|
};
|
|
1990
2072
|
}
|
|
@@ -1996,6 +2078,10 @@ function extractVerdict(comments, valuePattern, missingLabel) {
|
|
|
1996
2078
|
headSha: null,
|
|
1997
2079
|
objectivesVersion: null,
|
|
1998
2080
|
rulingOrdinal: null,
|
|
2081
|
+
briefHash: null,
|
|
2082
|
+
policyDigest: null,
|
|
2083
|
+
baseSha: null,
|
|
2084
|
+
findingSeverities: [],
|
|
1999
2085
|
danglingNote: `the most recent ${missingLabel} verdict comment carries a VERDICT-shaped line outside the first-five-line read window`
|
|
2000
2086
|
};
|
|
2001
2087
|
}
|
|
@@ -2004,6 +2090,10 @@ function extractVerdict(comments, valuePattern, missingLabel) {
|
|
|
2004
2090
|
headSha: extractHeadSha(latest),
|
|
2005
2091
|
objectivesVersion: extractObjectivesVersion(latest),
|
|
2006
2092
|
rulingOrdinal: extractRulingOrdinal(latest),
|
|
2093
|
+
briefHash: extractBriefHash(latest),
|
|
2094
|
+
policyDigest: extractPolicyDigest(latest),
|
|
2095
|
+
baseSha: extractBaseSha(latest),
|
|
2096
|
+
findingSeverities: extractFindingSeverities(latest),
|
|
2007
2097
|
danglingNote: null
|
|
2008
2098
|
};
|
|
2009
2099
|
}
|
|
@@ -2339,6 +2429,53 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive,
|
|
|
2339
2429
|
}
|
|
2340
2430
|
return out;
|
|
2341
2431
|
}
|
|
2432
|
+
// ../../packages/aeg-core/src/review-policy.ts
|
|
2433
|
+
var CODE_REVIEW_SEVERITY_ORDER = ["BLOCKER", "MAJOR", "MINOR"];
|
|
2434
|
+
var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
|
|
2435
|
+
var DEFAULT_MAX_ROUNDS = 3;
|
|
2436
|
+
var DEFAULT_REVIEW_POLICY = {
|
|
2437
|
+
codeReviewThreshold: "BLOCKER",
|
|
2438
|
+
securityThreshold: "HIGH",
|
|
2439
|
+
maxRounds: DEFAULT_MAX_ROUNDS
|
|
2440
|
+
};
|
|
2441
|
+
var FILE_SHAPED_LOCATION = /\.[a-zA-Z0-9]{1,10}(:\d+)?\s*$/;
|
|
2442
|
+
var PROSE_LOCATION_PATTERNS = [/\bpr\s*body\b/i, /\bcomment\b/i];
|
|
2443
|
+
var ROLE_FILE_LOCATION = /(^|\/)aeg-root\/roles\//i;
|
|
2444
|
+
function isProseLocation(location) {
|
|
2445
|
+
if (ROLE_FILE_LOCATION.test(location))
|
|
2446
|
+
return true;
|
|
2447
|
+
if (FILE_SHAPED_LOCATION.test(location))
|
|
2448
|
+
return false;
|
|
2449
|
+
return PROSE_LOCATION_PATTERNS.some((pattern) => pattern.test(location));
|
|
2450
|
+
}
|
|
2451
|
+
var PROSE_CAP_SEVERITY = "MINOR";
|
|
2452
|
+
function blockingSeverities(scale, threshold) {
|
|
2453
|
+
const idx = scale.indexOf(threshold);
|
|
2454
|
+
if (idx === -1) {
|
|
2455
|
+
throw new Error(`blockingSeverities: threshold "${threshold}" is not one of ${scale.join(" > ")}`);
|
|
2456
|
+
}
|
|
2457
|
+
return scale.slice(0, idx + 1);
|
|
2458
|
+
}
|
|
2459
|
+
function evaluateReviewFindings(findings, scale, threshold) {
|
|
2460
|
+
const blocking = new Set(blockingSeverities(scale, threshold));
|
|
2461
|
+
const blockingFindings = findings.filter((f) => {
|
|
2462
|
+
if (!scale.includes(f.severity)) {
|
|
2463
|
+
throw new Error(`evaluateReviewFindings: severity "${f.severity}" is not one of ${scale.join(" > ")}`);
|
|
2464
|
+
}
|
|
2465
|
+
const effectiveSeverity = f.location !== undefined && isProseLocation(f.location) ? PROSE_CAP_SEVERITY : f.severity;
|
|
2466
|
+
return blocking.has(effectiveSeverity);
|
|
2467
|
+
});
|
|
2468
|
+
return { outcome: blockingFindings.length > 0 ? "blocked" : "clean", blockingFindings };
|
|
2469
|
+
}
|
|
2470
|
+
function evaluateCodeReview(findings, policy) {
|
|
2471
|
+
return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold);
|
|
2472
|
+
}
|
|
2473
|
+
function evaluateSecurityReview(findings, policy) {
|
|
2474
|
+
return evaluateReviewFindings(findings, SECURITY_SEVERITY_ORDER, policy.securityThreshold);
|
|
2475
|
+
}
|
|
2476
|
+
function isKnownSeverity(scale, value) {
|
|
2477
|
+
return scale.includes(value);
|
|
2478
|
+
}
|
|
2342
2479
|
// ../../packages/aeg-core/src/pr-tier.ts
|
|
2343
2480
|
var TIER_FIELD = /(\*\*)?\s*Tier\s*(\*\*)?\s*:\s*(\*\*)?\s*([013])\b/i;
|
|
2344
2481
|
function readTierFromPrBody(prBody) {
|
|
@@ -2709,7 +2846,7 @@ function checkForField(prBody) {
|
|
|
2709
2846
|
]
|
|
2710
2847
|
};
|
|
2711
2848
|
}
|
|
2712
|
-
function
|
|
2849
|
+
function checkClosesNPresence(prBody) {
|
|
2713
2850
|
const closesPattern = /(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s{0,8}:?\s{0,8}#\d+/i;
|
|
2714
2851
|
if (closesPattern.test(stripCode(prBody))) {
|
|
2715
2852
|
return { status: "pass", errors: [] };
|
|
@@ -2741,10 +2878,22 @@ var COMMIT_TYPES = [
|
|
|
2741
2878
|
"Test"
|
|
2742
2879
|
];
|
|
2743
2880
|
var COMMIT_TYPE_STYLE = new RegExp(`^(${COMMIT_TYPES.join("|")})(\\([a-z0-9-]+\\))?: \\S`);
|
|
2881
|
+
function checkForgeTitle(title) {
|
|
2882
|
+
const taskStyle = /^\[[a-z0-9._-]+\] \S+ — \S/;
|
|
2883
|
+
if (COMMIT_TYPE_STYLE.test(title) || taskStyle.test(title))
|
|
2884
|
+
return { status: "pass", errors: [] };
|
|
2885
|
+
return {
|
|
2886
|
+
status: "fail",
|
|
2887
|
+
errors: [
|
|
2888
|
+
`brief-validation title: "${title}" matches neither title grammar — expected \`Type: description\` / \`Type(scope): description\` (commitlint types + Plan) or \`[tranche] id — description\` (task form).`
|
|
2889
|
+
]
|
|
2890
|
+
};
|
|
2891
|
+
}
|
|
2744
2892
|
var BRIEF_SHAPE_MARKERS = [checkSurfaceMap, checkDocUpdateList, checkStopConditions, checkAutonomyClause];
|
|
2745
2893
|
var TASK_BRANCH_PATTERN = /^task\/[^/]+\/[^/]+$/;
|
|
2894
|
+
var TASK_ISSUE_BRANCH_PATTERN = /^task\/issue-\d+$/;
|
|
2746
2895
|
function isTaskBranch(branch) {
|
|
2747
|
-
return TASK_BRANCH_PATTERN.test(branch);
|
|
2896
|
+
return TASK_BRANCH_PATTERN.test(branch) || TASK_ISSUE_BRANCH_PATTERN.test(branch);
|
|
2748
2897
|
}
|
|
2749
2898
|
function isBriefShaped(prBody) {
|
|
2750
2899
|
const stripped = stripCode(prBody);
|
|
@@ -2866,8 +3015,9 @@ function packagesNamedIn(text) {
|
|
|
2866
3015
|
}
|
|
2867
3016
|
function hasTestPathForConsumer(text, consumerDir) {
|
|
2868
3017
|
const escaped = consumerDir.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2869
|
-
const
|
|
2870
|
-
|
|
3018
|
+
const filePathRe = new RegExp(`${escaped}\\/[\\w./-]*\\.test\\.[A-Za-z0-9]+`);
|
|
3019
|
+
const testDirRe = new RegExp(`${escaped}\\/(?:[\\w-]+\\/)*(?:tests|specs)(?:\\/|\\b)`);
|
|
3020
|
+
return filePathRe.test(text) || testDirRe.test(text);
|
|
2871
3021
|
}
|
|
2872
3022
|
function checkConsumerTests(prBody, consumersOf) {
|
|
2873
3023
|
const section4 = extractNumberedSection(prBody, 4);
|
|
@@ -2971,7 +3121,7 @@ function checkBriefSections(prBody, readTier, options = {}) {
|
|
|
2971
3121
|
checkConsumerTests(prBody, consumersOf),
|
|
2972
3122
|
checkDefeatCases(prBody),
|
|
2973
3123
|
...issueObjectives !== undefined ? [checkObjectivesCopy(prBody, issueObjectives), checkObjectivesCoverage(prBody)] : [],
|
|
2974
|
-
...requireClosesN ? [
|
|
3124
|
+
...requireClosesN ? [checkClosesNPresence(prBody)] : []
|
|
2975
3125
|
];
|
|
2976
3126
|
return { errors: results.flatMap((r) => r.errors) };
|
|
2977
3127
|
}
|
|
@@ -3261,6 +3411,28 @@ function topLevelSectionText(body, headingName) {
|
|
|
3261
3411
|
const next = /^##[ \t]/m.exec(afterHeading);
|
|
3262
3412
|
return next ? afterHeading.slice(0, next.index) : afterHeading;
|
|
3263
3413
|
}
|
|
3414
|
+
function partHasBacktickedPath(text) {
|
|
3415
|
+
let i = 0;
|
|
3416
|
+
while (i < text.length) {
|
|
3417
|
+
const start = text.indexOf("`", i);
|
|
3418
|
+
if (start === -1)
|
|
3419
|
+
return false;
|
|
3420
|
+
const end = text.indexOf("`", start + 1);
|
|
3421
|
+
if (end === -1)
|
|
3422
|
+
return false;
|
|
3423
|
+
if (text.slice(start + 1, end).includes("/"))
|
|
3424
|
+
return true;
|
|
3425
|
+
i = end + 1;
|
|
3426
|
+
}
|
|
3427
|
+
return false;
|
|
3428
|
+
}
|
|
3429
|
+
var PART_MIN_WORDS_OUTSIDE_BACKTICKS = 3;
|
|
3430
|
+
function stripPartBackticks(text) {
|
|
3431
|
+
return text.replace(/`[^`\n]*`/g, " ");
|
|
3432
|
+
}
|
|
3433
|
+
function partWordCount(text) {
|
|
3434
|
+
return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
|
|
3435
|
+
}
|
|
3264
3436
|
function looksLikeFilePath(entry2) {
|
|
3265
3437
|
const stripped = entry2.replace(/\/\*\*?$/, "");
|
|
3266
3438
|
const lastSegment = stripped.split("/").pop() ?? stripped;
|
|
@@ -3301,6 +3473,18 @@ function globCoversPath(glob, path) {
|
|
|
3301
3473
|
const p = path.replace(/\/+$/, "");
|
|
3302
3474
|
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
3303
3475
|
}
|
|
3476
|
+
function checkSurfaceGlobsResolve(body, resolvesToFile) {
|
|
3477
|
+
const surface = parseIssueSurface(body);
|
|
3478
|
+
if (!surface.ok)
|
|
3479
|
+
return { status: "pass", errors: [] };
|
|
3480
|
+
const errors = [];
|
|
3481
|
+
for (const glob of surface.value.in) {
|
|
3482
|
+
if (!resolvesToFile(glob)) {
|
|
3483
|
+
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.`);
|
|
3484
|
+
}
|
|
3485
|
+
}
|
|
3486
|
+
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3487
|
+
}
|
|
3304
3488
|
function checkSurfaceScope(changedFiles, outGlobs) {
|
|
3305
3489
|
if (outGlobs.length === 0)
|
|
3306
3490
|
return { ok: true };
|
|
@@ -3312,9 +3496,77 @@ function checkSurfaceScope(changedFiles, outGlobs) {
|
|
|
3312
3496
|
}
|
|
3313
3497
|
return violations.length > 0 ? { ok: false, violations } : { ok: true };
|
|
3314
3498
|
}
|
|
3499
|
+
var ISSUE_PART_LINE_RE = /^Part\s+(\d+)\s*\(([^)]*)\)\s*[-—–]\s*(.*)$/i;
|
|
3500
|
+
function parseIssueParts(body) {
|
|
3501
|
+
const section = topLevelSectionText(body, "Parts");
|
|
3502
|
+
if (section === null)
|
|
3503
|
+
return { ok: false, errors: ["no `## Parts` heading found in the body."] };
|
|
3504
|
+
const lines = section.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0);
|
|
3505
|
+
const parts = [];
|
|
3506
|
+
const errors = [];
|
|
3507
|
+
for (const line of lines) {
|
|
3508
|
+
const m = ISSUE_PART_LINE_RE.exec(line);
|
|
3509
|
+
if (!m) {
|
|
3510
|
+
errors.push(`"${line}" is not a well-formed Parts line — expected \`Part <n> (<refs>) — <outcome>\`.`);
|
|
3511
|
+
continue;
|
|
3512
|
+
}
|
|
3513
|
+
const n = Number.parseInt(m[1], 10);
|
|
3514
|
+
const refs = m[2];
|
|
3515
|
+
const text = m[3].trim();
|
|
3516
|
+
if (text.length === 0) {
|
|
3517
|
+
errors.push(`Part ${n} has no outcome text after the dash — every Part states one observable outcome.`);
|
|
3518
|
+
continue;
|
|
3519
|
+
}
|
|
3520
|
+
if (partHasBacktickedPath(text) && partWordCount(stripPartBackticks(text)) < PART_MIN_WORDS_OUTSIDE_BACKTICKS) {
|
|
3521
|
+
errors.push(`Part ${n} is little more than a file path — a Part names an outcome and symbols, never a bare path.`);
|
|
3522
|
+
continue;
|
|
3523
|
+
}
|
|
3524
|
+
const objectiveIds = [...refs.matchAll(/O(\d+)/g)].map((r) => Number.parseInt(r[1], 10));
|
|
3525
|
+
parts.push({ n, objectiveIds, text });
|
|
3526
|
+
}
|
|
3527
|
+
if (parts.length === 0) {
|
|
3528
|
+
errors.push("the `## Parts` section has no well-formed `Part <n> (<refs>) — <outcome>` lines.");
|
|
3529
|
+
}
|
|
3530
|
+
if (errors.length > 0)
|
|
3531
|
+
return { ok: false, errors };
|
|
3532
|
+
return { ok: true, value: parts };
|
|
3533
|
+
}
|
|
3534
|
+
function checkPartsCiteDefinedObjectives(body) {
|
|
3535
|
+
const parts = parseIssueParts(body);
|
|
3536
|
+
const objectives = objectivesOf(body);
|
|
3537
|
+
if (!parts.ok || !objectives.ok)
|
|
3538
|
+
return { status: "pass", errors: [] };
|
|
3539
|
+
const definedIds = new Set(objectives.objectives.map((o) => Number.parseInt(o.id.slice(1), 10)));
|
|
3540
|
+
const errors = [];
|
|
3541
|
+
for (const part of parts.value) {
|
|
3542
|
+
for (const objectiveId of part.objectiveIds) {
|
|
3543
|
+
if (!definedIds.has(objectiveId)) {
|
|
3544
|
+
errors.push(`issue-validation Parts: Part ${part.n} cites O${objectiveId}, which the Issue's own \`## Objectives\` section does not define.`);
|
|
3545
|
+
}
|
|
3546
|
+
}
|
|
3547
|
+
}
|
|
3548
|
+
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3549
|
+
}
|
|
3315
3550
|
function isTaskIssueLabelSet(labels) {
|
|
3316
3551
|
return hasLabel("tranche", labels);
|
|
3317
3552
|
}
|
|
3553
|
+
function checkTrancheLabelPresence(_body, _labels) {
|
|
3554
|
+
return { status: "pass", errors: [] };
|
|
3555
|
+
}
|
|
3556
|
+
function checkMilestoneAttach(labels, currentMilestoneTitle, resolvedMilestoneTitle) {
|
|
3557
|
+
if (!isTaskIssueLabelSet(labels))
|
|
3558
|
+
return { status: "pass", errors: [] };
|
|
3559
|
+
if (resolvedMilestoneTitle === null)
|
|
3560
|
+
return { status: "pass", errors: [] };
|
|
3561
|
+
if (currentMilestoneTitle === resolvedMilestoneTitle)
|
|
3562
|
+
return { status: "pass", errors: [] };
|
|
3563
|
+
return {
|
|
3564
|
+
status: "fail",
|
|
3565
|
+
errors: [
|
|
3566
|
+
`issue-validation milestone attach: this task Issue's tranche label resolves to Milestone "${resolvedMilestoneTitle}", but its live Milestone is ${currentMilestoneTitle === null ? "unset" : `"${currentMilestoneTitle}"`} — attach it to "${resolvedMilestoneTitle}".`
|
|
3567
|
+
]
|
|
3568
|
+
};
|
|
3569
|
+
}
|
|
3318
3570
|
var TYPE_LABEL_IDS = LABELS.filter((l) => l.category === "type").map((l) => l.id);
|
|
3319
3571
|
function isControlCodePoint(codePoint) {
|
|
3320
3572
|
return codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
|
|
@@ -3379,6 +3631,19 @@ function checkProjectsRegistered(body, _labels, registeredNames) {
|
|
|
3379
3631
|
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;
|
|
3380
3632
|
var DOC_PATH_RE_GLOBAL = new RegExp(DOC_PATH_RE.source, "gi");
|
|
3381
3633
|
|
|
3634
|
+
// ../../packages/aeg-core/src/task-branch-identity.ts
|
|
3635
|
+
var ISSUE_BRANCH_PATTERN = /^task\/issue-(\d+)$/;
|
|
3636
|
+
var TRANCHE_BRANCH_PATTERN = /^task\/([^/]+)\/([^/]+)$/;
|
|
3637
|
+
function parseTaskBranchIdentity(branch) {
|
|
3638
|
+
const issueMatch = ISSUE_BRANCH_PATTERN.exec(branch);
|
|
3639
|
+
if (issueMatch)
|
|
3640
|
+
return { kind: "issue", issueNumber: Number(issueMatch[1]) };
|
|
3641
|
+
const trancheMatch = TRANCHE_BRANCH_PATTERN.exec(branch);
|
|
3642
|
+
if (trancheMatch)
|
|
3643
|
+
return { kind: "tranche", tranche: trancheMatch[1], taskId: trancheMatch[2] };
|
|
3644
|
+
return null;
|
|
3645
|
+
}
|
|
3646
|
+
|
|
3382
3647
|
// ../../packages/aeg-core/src/coherence-checks.ts
|
|
3383
3648
|
var COHERENCE_ENFORCED_FROM = "2026-07-01";
|
|
3384
3649
|
function isGrandfathered(isoDate) {
|
|
@@ -3399,6 +3664,7 @@ function checkA1(entries, principalAllowlist = PRINCIPAL_ALLOWLIST) {
|
|
|
3399
3664
|
if (handClosed)
|
|
3400
3665
|
continue;
|
|
3401
3666
|
failures.push({
|
|
3667
|
+
code: "closed-without-merge",
|
|
3402
3668
|
issue: e.task.issue,
|
|
3403
3669
|
tranche: e.trancheSlug,
|
|
3404
3670
|
task: e.task.id,
|
|
@@ -3423,6 +3689,7 @@ function checkA3(entries) {
|
|
|
3423
3689
|
continue;
|
|
3424
3690
|
if (e.facts.prState === "merged" && e.facts.issueState !== "closed") {
|
|
3425
3691
|
failures.push({
|
|
3692
|
+
code: "auto-close-misfire",
|
|
3426
3693
|
issue: e.task.issue,
|
|
3427
3694
|
tranche: e.trancheSlug,
|
|
3428
3695
|
task: e.task.id,
|
|
@@ -3447,6 +3714,7 @@ function checkT1(entries) {
|
|
|
3447
3714
|
continue;
|
|
3448
3715
|
if (e.facts === undefined) {
|
|
3449
3716
|
failures.push({
|
|
3717
|
+
code: "phantom-issue-ref",
|
|
3450
3718
|
issue: e.task.issue,
|
|
3451
3719
|
tranche: e.trancheSlug,
|
|
3452
3720
|
task: e.task.id,
|
|
@@ -3465,6 +3733,7 @@ function checkT2(openIssuesBySlug, topologyIssuesBySlug, ciTrancheSlug) {
|
|
|
3465
3733
|
for (const num of openNums) {
|
|
3466
3734
|
if (!topologySet.has(num)) {
|
|
3467
3735
|
failures.push({
|
|
3736
|
+
code: "orphan-task",
|
|
3468
3737
|
issue: num,
|
|
3469
3738
|
tranche: slug,
|
|
3470
3739
|
reason: `Issue #${num} is open and labeled ${trancheLabel(slug)} but does not appear in the topology file`
|
|
@@ -3499,6 +3768,7 @@ function checkT3(entries, ciTrancheSlug, enrichedEntries, forgeUnavailableSlugs)
|
|
|
3499
3768
|
continue;
|
|
3500
3769
|
if (forgeUnavailableSlugs?.has(e.trancheSlug)) {
|
|
3501
3770
|
failures.push({
|
|
3771
|
+
code: "tbd-in-active-tranche",
|
|
3502
3772
|
issue: null,
|
|
3503
3773
|
tranche: e.trancheSlug,
|
|
3504
3774
|
task: e.task.id,
|
|
@@ -3508,6 +3778,7 @@ function checkT3(entries, ciTrancheSlug, enrichedEntries, forgeUnavailableSlugs)
|
|
|
3508
3778
|
continue;
|
|
3509
3779
|
}
|
|
3510
3780
|
failures.push({
|
|
3781
|
+
code: "tbd-in-active-tranche",
|
|
3511
3782
|
issue: null,
|
|
3512
3783
|
tranche: e.trancheSlug,
|
|
3513
3784
|
task: e.task.id,
|
|
@@ -3540,6 +3811,7 @@ function checkD1(entries, issueToEntry, taskToEntry) {
|
|
|
3540
3811
|
const sameIssue = depEntry.task.issue !== null && e.task.issue !== null && depEntry.task.issue === e.task.issue;
|
|
3541
3812
|
if (sameTask || sameIssue) {
|
|
3542
3813
|
failures.push({
|
|
3814
|
+
code: "d1-self-dependency",
|
|
3543
3815
|
issue: e.task.issue,
|
|
3544
3816
|
tranche: e.trancheSlug,
|
|
3545
3817
|
task: e.task.id,
|
|
@@ -3551,6 +3823,7 @@ function checkD1(entries, issueToEntry, taskToEntry) {
|
|
|
3551
3823
|
const depClosed = depFacts?.issueState === "closed";
|
|
3552
3824
|
if (!depClosed) {
|
|
3553
3825
|
failures.push({
|
|
3826
|
+
code: "dispatched-on-unmet-deps",
|
|
3554
3827
|
issue: e.task.issue,
|
|
3555
3828
|
tranche: e.trancheSlug,
|
|
3556
3829
|
task: e.task.id,
|
|
@@ -3576,11 +3849,13 @@ function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
|
|
|
3576
3849
|
const errors = [
|
|
3577
3850
|
...checkIssueRationale(issue.body).errors,
|
|
3578
3851
|
...checkProjectsRegistered(issue.body, issue.labels, registeredNames).errors,
|
|
3579
|
-
...checkIssueObjectives(issue.body, issue.number).errors
|
|
3852
|
+
...checkIssueObjectives(issue.body, issue.number).errors,
|
|
3853
|
+
...checkPartsCiteDefinedObjectives(issue.body).errors
|
|
3580
3854
|
];
|
|
3581
3855
|
if (errors.length === 0)
|
|
3582
3856
|
continue;
|
|
3583
3857
|
failures.push({
|
|
3858
|
+
code: "missing-rationale-field",
|
|
3584
3859
|
issue: issue.number,
|
|
3585
3860
|
tranche: slug,
|
|
3586
3861
|
reason: `Issue #${issue.number} fails the rationale gate: ${errors.join(" | ")}`,
|
|
@@ -3609,6 +3884,7 @@ function checkL1(files, entriesBySlug) {
|
|
|
3609
3884
|
const allClosed = withFacts.every((e) => e.facts?.issueState === "closed");
|
|
3610
3885
|
if (allClosed) {
|
|
3611
3886
|
failures.push({
|
|
3887
|
+
code: "archive-recommended",
|
|
3612
3888
|
tranche: f.slug,
|
|
3613
3889
|
reason: "Active tranche has no open task-Issues — consider archiving to completed/"
|
|
3614
3890
|
});
|
|
@@ -3640,27 +3916,38 @@ function extractClosesReferences(prBody) {
|
|
|
3640
3916
|
}
|
|
3641
3917
|
return referenced;
|
|
3642
3918
|
}
|
|
3643
|
-
function
|
|
3919
|
+
function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
|
|
3644
3920
|
const referenced = extractClosesReferences(prBody);
|
|
3645
3921
|
if (taskIssueRefs) {
|
|
3646
3922
|
for (const n of referenced) {
|
|
3647
|
-
const
|
|
3648
|
-
if (!
|
|
3923
|
+
const ref2 = taskIssueRefs.get(n);
|
|
3924
|
+
if (!ref2)
|
|
3649
3925
|
continue;
|
|
3650
|
-
const expectedBranch = `task/${
|
|
3926
|
+
const expectedBranch = `task/${ref2.trancheSlug}/${ref2.taskId}`;
|
|
3651
3927
|
if (branch !== expectedBranch) {
|
|
3652
3928
|
return {
|
|
3653
3929
|
ok: false,
|
|
3654
|
-
message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${
|
|
3930
|
+
message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${ref2.taskId} of tranche "${ref2.trancheSlug}") but is not named "${expectedBranch}" — rename the branch and re-push, or if this work is intentionally outside AEG's dispatch flow, remove the Closes reference.`
|
|
3655
3931
|
};
|
|
3656
3932
|
}
|
|
3657
3933
|
}
|
|
3658
3934
|
}
|
|
3659
|
-
const
|
|
3660
|
-
if (!
|
|
3935
|
+
const ref = parseTaskBranchIdentity(branch);
|
|
3936
|
+
if (!ref)
|
|
3661
3937
|
return { ok: true };
|
|
3662
|
-
|
|
3663
|
-
|
|
3938
|
+
if (ref.kind === "issue") {
|
|
3939
|
+
const expectedIssue2 = ref.issueNumber;
|
|
3940
|
+
if (!referenced.has(expectedIssue2)) {
|
|
3941
|
+
return {
|
|
3942
|
+
ok: false,
|
|
3943
|
+
expectedIssue: expectedIssue2,
|
|
3944
|
+
message: `closes-n: PR body does not contain \`Closes #${expectedIssue2}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
|
|
3945
|
+
};
|
|
3946
|
+
}
|
|
3947
|
+
return { ok: true, expectedIssue: expectedIssue2 };
|
|
3948
|
+
}
|
|
3949
|
+
const trancheSlug = ref.tranche;
|
|
3950
|
+
const taskId = ref.taskId;
|
|
3664
3951
|
const trancheFile = trancheFiles.find((f) => f.slug === trancheSlug);
|
|
3665
3952
|
if (!trancheFile) {
|
|
3666
3953
|
return {
|
|
@@ -3712,34 +3999,79 @@ function extractIssue(body) {
|
|
|
3712
3999
|
const issue = headerNums.length > 0 ? headerNums[0] : bodyNums[0];
|
|
3713
4000
|
return { issue, extraIssues: bodyNums.filter((n) => n !== issue), outsideHeader: headerNums.length === 0 };
|
|
3714
4001
|
}
|
|
3715
|
-
// ../../packages/aeg-core/src/review-
|
|
3716
|
-
|
|
3717
|
-
|
|
4002
|
+
// ../../packages/aeg-core/src/review-input-manifest.ts
|
|
4003
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
4004
|
+
function briefHash(brief) {
|
|
4005
|
+
return createHash4("sha256").update(`${brief}
|
|
4006
|
+
`).digest("hex");
|
|
4007
|
+
}
|
|
4008
|
+
function policyDigest(policy) {
|
|
4009
|
+
return createHash4("sha256").update(JSON.stringify({
|
|
4010
|
+
codeReviewThreshold: policy.codeReviewThreshold,
|
|
4011
|
+
securityThreshold: policy.securityThreshold,
|
|
4012
|
+
maxRounds: policy.maxRounds
|
|
4013
|
+
})).digest("hex");
|
|
4014
|
+
}
|
|
4015
|
+
function isBoundToHead(echoed, headSha) {
|
|
4016
|
+
if (!echoed.headSha)
|
|
3718
4017
|
return false;
|
|
3719
|
-
return headSha.toLowerCase().startsWith(
|
|
4018
|
+
return headSha.toLowerCase().startsWith(echoed.headSha.toLowerCase());
|
|
3720
4019
|
}
|
|
3721
|
-
function isBoundByPatchIdentity(
|
|
3722
|
-
if (patchIdOf === undefined || !
|
|
4020
|
+
function isBoundByPatchIdentity(echoed, headSha, patchIdOf) {
|
|
4021
|
+
if (patchIdOf === undefined || !echoed.headSha)
|
|
3723
4022
|
return false;
|
|
3724
|
-
const judged = patchIdOf(
|
|
4023
|
+
const judged = patchIdOf(echoed.headSha);
|
|
3725
4024
|
const current = patchIdOf(headSha);
|
|
3726
4025
|
if (judged === null || current === null)
|
|
3727
4026
|
return false;
|
|
3728
4027
|
return judged === current;
|
|
3729
4028
|
}
|
|
3730
|
-
function
|
|
3731
|
-
|
|
4029
|
+
function isBoundToBase(echoed, currentBase) {
|
|
4030
|
+
if (currentBase === null)
|
|
4031
|
+
return true;
|
|
4032
|
+
if (!echoed.baseSha)
|
|
4033
|
+
return false;
|
|
4034
|
+
return currentBase.toLowerCase().startsWith(echoed.baseSha.toLowerCase());
|
|
3732
4035
|
}
|
|
3733
|
-
function isBoundToObjectives(
|
|
4036
|
+
function isBoundToObjectives(echoed, currentVersion) {
|
|
3734
4037
|
if (currentVersion === null)
|
|
3735
4038
|
return true;
|
|
3736
|
-
return
|
|
4039
|
+
return echoed.objectivesVersion === currentVersion;
|
|
3737
4040
|
}
|
|
3738
|
-
function isBoundToRulings(
|
|
3739
|
-
if (
|
|
4041
|
+
function isBoundToRulings(echoed, currentOrdinal) {
|
|
4042
|
+
if (echoed.rulingOrdinal === null)
|
|
3740
4043
|
return currentOrdinal === 0;
|
|
3741
|
-
return
|
|
4044
|
+
return echoed.rulingOrdinal === currentOrdinal;
|
|
4045
|
+
}
|
|
4046
|
+
function isBoundToBriefHash(echoed, currentHash) {
|
|
4047
|
+
if (currentHash === null)
|
|
4048
|
+
return true;
|
|
4049
|
+
return echoed.briefHash === currentHash;
|
|
4050
|
+
}
|
|
4051
|
+
function isBoundToPolicy(echoed, currentDigest) {
|
|
4052
|
+
return echoed.policyDigest === currentDigest;
|
|
4053
|
+
}
|
|
4054
|
+
function compareManifest(echoed, current, patchIdOf) {
|
|
4055
|
+
const exactHead = isBoundToHead(echoed, current.headSha);
|
|
4056
|
+
const patchHead = exactHead ? false : isBoundByPatchIdentity(echoed, current.headSha, patchIdOf);
|
|
4057
|
+
const head = exactHead || patchHead;
|
|
4058
|
+
const base = patchHead ? true : isBoundToBase(echoed, current.baseSha);
|
|
4059
|
+
const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
|
|
4060
|
+
const objectivesVersion2 = isBoundToObjectives(echoed, current.objectivesVersion);
|
|
4061
|
+
const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
|
|
4062
|
+
const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
|
|
4063
|
+
return {
|
|
4064
|
+
bound: head && base && briefHashBound && objectivesVersion2 && rulingOrdinal && policyDigestBound,
|
|
4065
|
+
head,
|
|
4066
|
+
base,
|
|
4067
|
+
briefHash: briefHashBound,
|
|
4068
|
+
objectivesVersion: objectivesVersion2,
|
|
4069
|
+
rulingOrdinal,
|
|
4070
|
+
policyDigest: policyDigestBound
|
|
4071
|
+
};
|
|
3742
4072
|
}
|
|
4073
|
+
|
|
4074
|
+
// ../../packages/aeg-core/src/review-gate.ts
|
|
3743
4075
|
function checkReviewGate(input) {
|
|
3744
4076
|
const principalAllowlist = input.principalAllowlist ?? PRINCIPAL_ALLOWLIST;
|
|
3745
4077
|
const waived = isWaiverLabelActorVerified({
|
|
@@ -3762,15 +4094,58 @@ function checkReviewGate(input) {
|
|
|
3762
4094
|
const verifiedBodies = verified.map((c) => c.body);
|
|
3763
4095
|
const codeReview = extractCodeReviewVerdict(verifiedBodies);
|
|
3764
4096
|
const security = extractSecurityReviewVerdict(verifiedBodies);
|
|
3765
|
-
const
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
4097
|
+
const policy = input.policy ?? DEFAULT_REVIEW_POLICY;
|
|
4098
|
+
let codeReviewPolicyEvaluation;
|
|
4099
|
+
let securityPolicyEvaluation;
|
|
4100
|
+
try {
|
|
4101
|
+
codeReviewPolicyEvaluation = evaluateCodeReview(codeReview.findingSeverities, policy);
|
|
4102
|
+
securityPolicyEvaluation = evaluateSecurityReview(security.findingSeverities, policy);
|
|
4103
|
+
} catch (err) {
|
|
4104
|
+
return {
|
|
4105
|
+
verdict: "fail",
|
|
4106
|
+
reason: `a verdict comment carries a finding severity this repository's policy does not recognize: ${err instanceof Error ? err.message : String(err)}`,
|
|
4107
|
+
waived: false
|
|
4108
|
+
};
|
|
4109
|
+
}
|
|
4110
|
+
const codeReviewTextClean = codeReview.value === "APPROVE";
|
|
4111
|
+
const securityTextClean = security.value === "PASS";
|
|
4112
|
+
const codeReviewPolicyClean = codeReviewPolicyEvaluation.outcome === "clean";
|
|
4113
|
+
const securityPolicyClean = securityPolicyEvaluation.outcome === "clean";
|
|
4114
|
+
const codeReviewClean = codeReviewTextClean && codeReviewPolicyClean;
|
|
4115
|
+
const securityClean = securityTextClean && securityPolicyClean;
|
|
4116
|
+
const currentManifest = {
|
|
4117
|
+
headSha: input.headSha,
|
|
4118
|
+
baseSha: input.baseSha ?? null,
|
|
4119
|
+
briefHash: input.briefHash ?? null,
|
|
4120
|
+
objectivesVersion: input.objectivesVersion,
|
|
4121
|
+
rulingOrdinal: input.rulingOrdinal,
|
|
4122
|
+
policyDigest: policyDigest(policy)
|
|
4123
|
+
};
|
|
4124
|
+
const codeReviewEchoed = {
|
|
4125
|
+
headSha: codeReview.headSha,
|
|
4126
|
+
baseSha: codeReview.baseSha,
|
|
4127
|
+
briefHash: codeReview.briefHash,
|
|
4128
|
+
objectivesVersion: codeReview.objectivesVersion,
|
|
4129
|
+
rulingOrdinal: codeReview.rulingOrdinal,
|
|
4130
|
+
policyDigest: codeReview.policyDigest
|
|
4131
|
+
};
|
|
4132
|
+
const securityEchoed = {
|
|
4133
|
+
headSha: security.headSha,
|
|
4134
|
+
baseSha: security.baseSha,
|
|
4135
|
+
briefHash: security.briefHash,
|
|
4136
|
+
objectivesVersion: security.objectivesVersion,
|
|
4137
|
+
rulingOrdinal: security.rulingOrdinal,
|
|
4138
|
+
policyDigest: security.policyDigest
|
|
4139
|
+
};
|
|
4140
|
+
const codeReviewBinding = compareManifest(codeReviewEchoed, currentManifest, input.patchIdOf);
|
|
4141
|
+
const securityBinding = compareManifest(securityEchoed, currentManifest, input.patchIdOf);
|
|
4142
|
+
const codeReviewBound = codeReviewBinding.head;
|
|
4143
|
+
const securityBound = securityBinding.head;
|
|
4144
|
+
const codeReviewObjectivesBound = codeReviewBinding.objectivesVersion;
|
|
4145
|
+
const securityObjectivesBound = securityBinding.objectivesVersion;
|
|
4146
|
+
const codeReviewRulingsBound = codeReviewBinding.rulingOrdinal;
|
|
4147
|
+
const securityRulingsBound = securityBinding.rulingOrdinal;
|
|
4148
|
+
if (codeReviewClean && codeReviewBinding.bound && securityClean && securityBinding.bound && mechanicalChecksClean) {
|
|
3774
4149
|
return {
|
|
3775
4150
|
verdict: "pass",
|
|
3776
4151
|
reason: `code-reviewer verdict is a clean APPROVE and security-review verdict is a clean PASS, both covering head ${input.headSha}, and every reported mechanical check is green.`,
|
|
@@ -3778,23 +4153,39 @@ function checkReviewGate(input) {
|
|
|
3778
4153
|
};
|
|
3779
4154
|
}
|
|
3780
4155
|
const problems = [];
|
|
3781
|
-
if (!
|
|
4156
|
+
if (!codeReviewTextClean) {
|
|
3782
4157
|
problems.push(`code-reviewer verdict is not a clean APPROVE (found: ${codeReview.value})`);
|
|
4158
|
+
} else if (!codeReviewPolicyClean) {
|
|
4159
|
+
problems.push(`code-reviewer verdict says APPROVE but carries a finding (${codeReviewPolicyEvaluation.blockingFindings.map((f) => f.severity).join(", ")}) at or above this repository's code-review policy threshold (${policy.codeReviewThreshold}) — a reviewer's own APPROVE never overrides policy`);
|
|
3783
4160
|
} else if (!codeReviewBound) {
|
|
3784
4161
|
problems.push(`the newest code-review verdict covers ${codeReview.headSha ?? "no recorded commit"}, head is ${input.headSha}`);
|
|
4162
|
+
} else if (!codeReviewBinding.base) {
|
|
4163
|
+
problems.push(`the newest code-review verdict was cast against base ${codeReview.baseSha ?? "no recorded base"}, the PR's base is now ${currentManifest.baseSha ?? "unresolved"} (a base-only change under an unchanged candidate — same patch text on a new base is not automatically equivalent)`);
|
|
3785
4164
|
} else if (!codeReviewObjectivesBound) {
|
|
3786
4165
|
problems.push(`the newest code-review verdict was cast against objectives version ${codeReview.objectivesVersion ?? "none"}, the Issue's list is now ${input.objectivesVersion}`);
|
|
3787
4166
|
} else if (!codeReviewRulingsBound) {
|
|
3788
4167
|
problems.push(`the newest code-review verdict was cast against ruling ordinal ${codeReview.rulingOrdinal ?? "none"}, a newer ruling (ruling ${input.rulingOrdinal}) is now posted on this PR`);
|
|
4168
|
+
} else if (!codeReviewBinding.briefHash) {
|
|
4169
|
+
problems.push(`the newest code-review verdict was cast against brief hash ${codeReview.briefHash ?? "none"}, the frozen brief's current hash is ${currentManifest.briefHash ?? "none"}`);
|
|
4170
|
+
} else if (!codeReviewBinding.policyDigest) {
|
|
4171
|
+
problems.push(`the newest code-review verdict was cast against review policy digest ${codeReview.policyDigest ?? "none"}, this repository's current policy digest is ${currentManifest.policyDigest}`);
|
|
3789
4172
|
}
|
|
3790
|
-
if (!
|
|
4173
|
+
if (!securityTextClean) {
|
|
3791
4174
|
problems.push(`security-review verdict is not a clean PASS (found: ${security.value})`);
|
|
4175
|
+
} else if (!securityPolicyClean) {
|
|
4176
|
+
problems.push(`security-review verdict says PASS but carries a finding (${securityPolicyEvaluation.blockingFindings.map((f) => f.severity).join(", ")}) at or above this repository's security policy threshold (${policy.securityThreshold}) — a reviewer's own PASS never overrides policy`);
|
|
3792
4177
|
} else if (!securityBound) {
|
|
3793
4178
|
problems.push(`the newest security-review verdict covers ${security.headSha ?? "no recorded commit"}, head is ${input.headSha}`);
|
|
4179
|
+
} else if (!securityBinding.base) {
|
|
4180
|
+
problems.push(`the newest security-review verdict was cast against base ${security.baseSha ?? "no recorded base"}, the PR's base is now ${currentManifest.baseSha ?? "unresolved"} (a base-only change under an unchanged candidate — same patch text on a new base is not automatically equivalent)`);
|
|
3794
4181
|
} else if (!securityObjectivesBound) {
|
|
3795
4182
|
problems.push(`the newest security-review verdict was cast against objectives version ${security.objectivesVersion ?? "none"}, the Issue's list is now ${input.objectivesVersion}`);
|
|
3796
4183
|
} else if (!securityRulingsBound) {
|
|
3797
4184
|
problems.push(`the newest security-review verdict was cast against ruling ordinal ${security.rulingOrdinal ?? "none"}, a newer ruling (ruling ${input.rulingOrdinal}) is now posted on this PR`);
|
|
4185
|
+
} else if (!securityBinding.briefHash) {
|
|
4186
|
+
problems.push(`the newest security-review verdict was cast against brief hash ${security.briefHash ?? "none"}, the frozen brief's current hash is ${currentManifest.briefHash ?? "none"}`);
|
|
4187
|
+
} else if (!securityBinding.policyDigest) {
|
|
4188
|
+
problems.push(`the newest security-review verdict was cast against review policy digest ${security.policyDigest ?? "none"}, this repository's current policy digest is ${currentManifest.policyDigest}`);
|
|
3798
4189
|
}
|
|
3799
4190
|
if (!mechanicalChecksClean) {
|
|
3800
4191
|
problems.push(reportedMechanicalChecks.length === 0 ? "no mechanical checks have reported for this head yet" : `mechanical check(s) not green: ${reportedMechanicalChecks.filter((c) => c.bucket !== "pass").map((c) => `${c.name} (${c.bucket})`).join(", ")}`);
|
|
@@ -4486,42 +4877,45 @@ function checkDispatchReadiness(input) {
|
|
|
4486
4877
|
const { trancheSlug, task } = input;
|
|
4487
4878
|
const taskLabel = `task ${task.id} (tranche ${trancheSlug})`;
|
|
4488
4879
|
const principalAllowlist = input.principalAllowlist ?? PRINCIPAL_ALLOWLIST;
|
|
4489
|
-
const
|
|
4880
|
+
const blockerDetails = [];
|
|
4881
|
+
const push = (blockerClass, message) => {
|
|
4882
|
+
blockerDetails.push({ class: blockerClass, message });
|
|
4883
|
+
};
|
|
4490
4884
|
if (task.issue === null) {
|
|
4491
|
-
|
|
4885
|
+
push("issue-existence", `dispatch-gate issue-existence: ${taskLabel} has no Issue (#TBD or blank) in the topology — not dispatchable until the Planner cuts the Issue.`);
|
|
4492
4886
|
} else if (input.issue === null) {
|
|
4493
|
-
|
|
4887
|
+
push("issue-existence", `dispatch-gate issue-existence: ${taskLabel} names Issue #${task.issue}, but it does not resolve to a real GitHub Issue (phantom reference).`);
|
|
4494
4888
|
}
|
|
4495
4889
|
if (input.issue !== null && !input.issueRationalePass) {
|
|
4496
|
-
|
|
4890
|
+
push("rationale", `dispatch-gate rationale: Issue #${input.issue.number} for ${taskLabel} fails the rationale gate (checkIssueRationale) — the Planner must complete the eight-field rationale before this task is dispatchable.`);
|
|
4497
4891
|
}
|
|
4498
4892
|
for (const dep of input.dependsOn) {
|
|
4499
4893
|
if (isSelfDependency(dep, task, input.issue)) {
|
|
4500
4894
|
const issueStr = input.issue !== null ? `#${input.issue.number}` : "?";
|
|
4501
|
-
|
|
4895
|
+
push("internal-self-dependency", `dispatch-gate INTERNAL: parsed a self-dependency for task ${task.id} (${issueStr}) — this is a parser bug in parseRationaleDeps, not a real dependency. Please report it upstream. Re-run once the rationale is corrected or the fix ships.`);
|
|
4502
4896
|
continue;
|
|
4503
4897
|
}
|
|
4504
4898
|
if (dep.resolved === false) {
|
|
4505
|
-
|
|
4899
|
+
push("depends-on-unresolvable", `dispatch-gate depends-on: ${taskLabel} depends on "${dep.id}", which is UNRESOLVABLE — the resolver could not find a matching tranche/task/Issue for this edge (not a claim about merge status). Not dispatchable until the edge is corrected.`);
|
|
4506
4900
|
continue;
|
|
4507
4901
|
}
|
|
4508
4902
|
if (!dep.merged && !isHandClosedByRecognizedPrincipal(dep, principalAllowlist)) {
|
|
4509
4903
|
const issueStr = dep.issue !== null ? ` (#${dep.issue})` : "";
|
|
4510
|
-
|
|
4904
|
+
push("depends-on-not-merged", `dispatch-gate depends-on: ${taskLabel} depends on ${dep.id}${issueStr}, whose PR is not merged yet — not dispatchable, it serializes behind it.`);
|
|
4511
4905
|
}
|
|
4512
4906
|
}
|
|
4513
4907
|
for (const c of input.conflictsWith) {
|
|
4514
4908
|
if (c.openOrInFlight) {
|
|
4515
4909
|
const issueStr = c.issue !== null ? ` (#${c.issue})` : "";
|
|
4516
|
-
|
|
4910
|
+
push("conflicts-with", `dispatch-gate conflicts-with: ${taskLabel} conflicts with ${c.id}${issueStr}, whose PR is open or in-flight — not dispatchable until it merges.`);
|
|
4517
4911
|
}
|
|
4518
4912
|
}
|
|
4519
4913
|
for (const proj of input.priorTrancheArchival) {
|
|
4520
4914
|
if (proj.priorTrancheSlug !== null && !proj.archived) {
|
|
4521
|
-
|
|
4915
|
+
push("prior-tranche-archival", `dispatch-gate prior-tranche-archival: project \`${proj.project}\`'s previous tranche \`${proj.priorTrancheSlug}\` is not archived — the Tranche Archivist must run before new work on this product.`);
|
|
4522
4916
|
}
|
|
4523
4917
|
}
|
|
4524
|
-
return { ready:
|
|
4918
|
+
return { ready: blockerDetails.length === 0, blockers: blockerDetails.map((b) => b.message), blockerDetails };
|
|
4525
4919
|
}
|
|
4526
4920
|
// ../../packages/aeg-core/src/single-plan-pr.ts
|
|
4527
4921
|
function trancheSlugFromTopologyPath(path) {
|
|
@@ -4623,6 +5017,137 @@ function checkBranchTopology(input) {
|
|
|
4623
5017
|
reason: `Branch \`${branch}\` matches topology row \`${taskId}\` in ${topoPath}.`
|
|
4624
5018
|
};
|
|
4625
5019
|
}
|
|
5020
|
+
// ../../packages/aeg-core/src/task-tools.ts
|
|
5021
|
+
import { z } from "zod";
|
|
5022
|
+
var TASK_TOOL_ERROR_KINDS = [
|
|
5023
|
+
"validation",
|
|
5024
|
+
"authority",
|
|
5025
|
+
"precondition",
|
|
5026
|
+
"capability",
|
|
5027
|
+
"infrastructure",
|
|
5028
|
+
"cancellation",
|
|
5029
|
+
"timeout",
|
|
5030
|
+
"uncertain_effect"
|
|
5031
|
+
];
|
|
5032
|
+
var TaskToolErrorSchema = z.object({
|
|
5033
|
+
kind: z.enum(TASK_TOOL_ERROR_KINDS),
|
|
5034
|
+
message: z.string().min(1),
|
|
5035
|
+
detail: z.string().optional()
|
|
5036
|
+
});
|
|
5037
|
+
var TaskToolRefSchema = z.union([
|
|
5038
|
+
z.object({ tranche: z.string().min(1), id: z.string().min(1) }).strict(),
|
|
5039
|
+
z.object({ issue: z.number().int().positive() }).strict()
|
|
5040
|
+
]);
|
|
5041
|
+
var MAX_PAGE_LIMIT = 100;
|
|
5042
|
+
var PageRequestSchema = z.object({
|
|
5043
|
+
cursor: z.string().optional(),
|
|
5044
|
+
limit: z.number().int().positive().max(MAX_PAGE_LIMIT).optional()
|
|
5045
|
+
});
|
|
5046
|
+
var FreshnessSchema = z.enum(["fresh", "stale", "unknown"]);
|
|
5047
|
+
var ObservedSchema = z.object({
|
|
5048
|
+
observedAt: z.string(),
|
|
5049
|
+
freshness: FreshnessSchema
|
|
5050
|
+
});
|
|
5051
|
+
var TaskStatusInputSchema = z.object({
|
|
5052
|
+
task: TaskToolRefSchema.optional()
|
|
5053
|
+
}).merge(PageRequestSchema).strict();
|
|
5054
|
+
var TaskStatusItemSchema = z.object({
|
|
5055
|
+
task: TaskToolRefSchema,
|
|
5056
|
+
issue: z.number().int().positive(),
|
|
5057
|
+
pr: z.number().int().positive().nullable(),
|
|
5058
|
+
state: z.string()
|
|
5059
|
+
}).merge(ObservedSchema);
|
|
5060
|
+
var TaskStatusResultSchema = z.object({
|
|
5061
|
+
items: z.array(TaskStatusItemSchema),
|
|
5062
|
+
nextCursor: z.string().nullable()
|
|
5063
|
+
});
|
|
5064
|
+
var RequestedAuthoritySchema = z.enum(["planner", "principal", "operator", "self"]);
|
|
5065
|
+
var EscalationInputsSchema = z.object({
|
|
5066
|
+
task: z.number().int().positive(),
|
|
5067
|
+
round: z.number().int().nonnegative(),
|
|
5068
|
+
head: z.string(),
|
|
5069
|
+
branch: z.string(),
|
|
5070
|
+
prNumber: z.number().int().positive()
|
|
5071
|
+
});
|
|
5072
|
+
var EscalationEvidenceSchema = z.object({
|
|
5073
|
+
round: z.number().int().nonnegative(),
|
|
5074
|
+
reviewer: z.string().nullable(),
|
|
5075
|
+
security: z.string().nullable()
|
|
5076
|
+
});
|
|
5077
|
+
var EscalationRunIdentitySchema = z.object({
|
|
5078
|
+
runId: z.string(),
|
|
5079
|
+
pid: z.number().int().positive(),
|
|
5080
|
+
host: z.string()
|
|
5081
|
+
});
|
|
5082
|
+
var EscalationInputVersionsSchema = z.object({
|
|
5083
|
+
briefHash: z.string().nullable(),
|
|
5084
|
+
objectivesVersion: z.string().nullable(),
|
|
5085
|
+
rulingOrdinal: z.number().int().nonnegative(),
|
|
5086
|
+
policyDigest: z.string()
|
|
5087
|
+
});
|
|
5088
|
+
var TaskEscalationReadInputSchema = z.object({
|
|
5089
|
+
task: TaskToolRefSchema
|
|
5090
|
+
}).merge(PageRequestSchema).strict();
|
|
5091
|
+
var TaskEscalationPacketSchema = z.object({
|
|
5092
|
+
reason: z.string(),
|
|
5093
|
+
detail: z.string().nullable(),
|
|
5094
|
+
inputs: EscalationInputsSchema.nullable(),
|
|
5095
|
+
evidence: EscalationEvidenceSchema.nullable(),
|
|
5096
|
+
attemptedRecovery: z.string(),
|
|
5097
|
+
requestedAuthority: RequestedAuthoritySchema,
|
|
5098
|
+
permittedNextActions: z.array(z.string()),
|
|
5099
|
+
runIdentity: EscalationRunIdentitySchema.nullable(),
|
|
5100
|
+
inputVersions: EscalationInputVersionsSchema.nullable()
|
|
5101
|
+
}).merge(ObservedSchema);
|
|
5102
|
+
var TaskEscalationReadResultSchema = z.object({
|
|
5103
|
+
items: z.array(TaskEscalationPacketSchema),
|
|
5104
|
+
nextCursor: z.string().nullable()
|
|
5105
|
+
}).merge(ObservedSchema);
|
|
5106
|
+
var TaskStartInputSchema = z.object({
|
|
5107
|
+
tranche: z.string().min(1),
|
|
5108
|
+
id: z.string().min(1)
|
|
5109
|
+
}).strict();
|
|
5110
|
+
var TaskStartResultSchema = z.object({
|
|
5111
|
+
requestId: z.string().min(1),
|
|
5112
|
+
run: z.object({ tranche: z.string().min(1), id: z.string().min(1) }),
|
|
5113
|
+
started: z.boolean(),
|
|
5114
|
+
startedAt: z.string(),
|
|
5115
|
+
mode: z.literal("attended")
|
|
5116
|
+
});
|
|
5117
|
+
var TaskResumeInputSchema = z.object({
|
|
5118
|
+
task: TaskToolRefSchema
|
|
5119
|
+
}).strict();
|
|
5120
|
+
var TaskCancelInputSchema = z.object({
|
|
5121
|
+
task: TaskToolRefSchema,
|
|
5122
|
+
reason: z.string().min(1)
|
|
5123
|
+
}).strict();
|
|
5124
|
+
var TaskResumeResultSchema = z.object({
|
|
5125
|
+
task: z.number().int().positive(),
|
|
5126
|
+
pr: z.number().int().positive(),
|
|
5127
|
+
escalationId: z.string().min(1),
|
|
5128
|
+
outcome: z.enum(["started", "already_resumed"]),
|
|
5129
|
+
authenticatedBy: z.string().min(1),
|
|
5130
|
+
authenticatedFrom: z.string().min(1)
|
|
5131
|
+
});
|
|
5132
|
+
var TaskCancelOutcomeSchema = z.enum(["confirmed", "pending", "uncertain"]);
|
|
5133
|
+
var TaskCancelResultSchema = z.object({
|
|
5134
|
+
task: z.number().int().positive(),
|
|
5135
|
+
pr: z.number().int().positive(),
|
|
5136
|
+
escalationId: z.string().min(1),
|
|
5137
|
+
outcome: TaskCancelOutcomeSchema,
|
|
5138
|
+
authenticatedBy: z.string().min(1),
|
|
5139
|
+
authenticatedFrom: z.string().min(1),
|
|
5140
|
+
fencedEffectKeys: z.array(z.string())
|
|
5141
|
+
});
|
|
5142
|
+
var TASK_TOOL_NAMES = [
|
|
5143
|
+
"task_start",
|
|
5144
|
+
"task_status",
|
|
5145
|
+
"task_escalation_read",
|
|
5146
|
+
"task_resume",
|
|
5147
|
+
"task_cancel"
|
|
5148
|
+
];
|
|
5149
|
+
var OPERATOR_STATUS_FOLLOW = "task_status_follow";
|
|
5150
|
+
var OPERATOR_TOOL_GRANT = [...TASK_TOOL_NAMES, OPERATOR_STATUS_FOLLOW];
|
|
4626
5151
|
// ../../packages/aeg-core/src/first-push-dispatch-gate.ts
|
|
4627
5152
|
function parseTaskBranch(branch) {
|
|
4628
5153
|
const m = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
|
|
@@ -4706,7 +5231,6 @@ function decideIssueAssignment(input) {
|
|
|
4706
5231
|
};
|
|
4707
5232
|
}
|
|
4708
5233
|
// ../../packages/aeg-core/src/test-plan-gate.ts
|
|
4709
|
-
var TASK_BRANCH_PATTERN2 = /^task\/[^/]+\/[^/]+$/;
|
|
4710
5234
|
function evaluateTestPlanGate(body, branch) {
|
|
4711
5235
|
if (!body) {
|
|
4712
5236
|
return {
|
|
@@ -4719,7 +5243,7 @@ function evaluateTestPlanGate(body, branch) {
|
|
|
4719
5243
|
}
|
|
4720
5244
|
const located = locateTestPlanSection(body);
|
|
4721
5245
|
if (!located.found) {
|
|
4722
|
-
if (
|
|
5246
|
+
if (parseTaskBranchIdentity(branch) !== null) {
|
|
4723
5247
|
return {
|
|
4724
5248
|
verdict: "fail",
|
|
4725
5249
|
messages: [
|
|
@@ -4846,8 +5370,11 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
4846
5370
|
}
|
|
4847
5371
|
return findings;
|
|
4848
5372
|
}
|
|
5373
|
+
// ../../packages/aeg-core/src/log/envelope.ts
|
|
5374
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
5375
|
+
|
|
4849
5376
|
// ../../packages/aeg-core/src/log/schema.ts
|
|
4850
|
-
import { z } from "zod";
|
|
5377
|
+
import { z as z2 } from "zod";
|
|
4851
5378
|
var ROLE_VALUES = [
|
|
4852
5379
|
"planner",
|
|
4853
5380
|
"developer",
|
|
@@ -4857,136 +5384,174 @@ var ROLE_VALUES = [
|
|
|
4857
5384
|
"archivist",
|
|
4858
5385
|
"architect"
|
|
4859
5386
|
];
|
|
4860
|
-
var RoleSchema =
|
|
5387
|
+
var RoleSchema = z2.enum(ROLE_VALUES);
|
|
4861
5388
|
var HOST_VALUES = ["hook", "ci", "cli", "loop"];
|
|
4862
|
-
var HostSchema =
|
|
5389
|
+
var HostSchema = z2.enum(HOST_VALUES);
|
|
4863
5390
|
var RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
|
|
4864
|
-
var
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
doctrine: z.string(),
|
|
5391
|
+
var headerMetaCore = {
|
|
5392
|
+
ts: z2.string(),
|
|
5393
|
+
run_id: z2.string().regex(RUN_ID_PATTERN),
|
|
5394
|
+
seq: z2.number().int().nonnegative(),
|
|
5395
|
+
repo: z2.string().nullable(),
|
|
5396
|
+
vinaya: z2.string(),
|
|
5397
|
+
doctrine: z2.string(),
|
|
4872
5398
|
host: HostSchema,
|
|
4873
|
-
machine:
|
|
5399
|
+
machine: z2.string()
|
|
5400
|
+
};
|
|
5401
|
+
var HeaderMetaV1Schema = z2.object({
|
|
5402
|
+
schema: z2.literal(1),
|
|
5403
|
+
...headerMetaCore
|
|
5404
|
+
}).strict();
|
|
5405
|
+
var LineageSchema = z2.object({
|
|
5406
|
+
run: z2.string().nullable(),
|
|
5407
|
+
attempt: z2.number().int().nullable(),
|
|
5408
|
+
parent: z2.string().nullable()
|
|
5409
|
+
}).strict();
|
|
5410
|
+
var InputVersionsSchema = z2.object({
|
|
5411
|
+
objectives_version: z2.string().nullable(),
|
|
5412
|
+
brief_hash: z2.string().nullable(),
|
|
5413
|
+
ruling_ordinal: z2.number().int().nullable(),
|
|
5414
|
+
policy_digest: z2.string().nullable()
|
|
5415
|
+
}).strict();
|
|
5416
|
+
var ProvenanceSchema = z2.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
|
|
5417
|
+
var HeaderMetaV2Schema = z2.object({
|
|
5418
|
+
schema: z2.literal(2),
|
|
5419
|
+
...headerMetaCore,
|
|
5420
|
+
event_id: z2.string().min(1),
|
|
5421
|
+
process_id: z2.string().min(1),
|
|
5422
|
+
actor_id: z2.string().nullable(),
|
|
5423
|
+
lineage: LineageSchema,
|
|
5424
|
+
input_versions: InputVersionsSchema,
|
|
5425
|
+
provenance: ProvenanceSchema
|
|
4874
5426
|
}).strict();
|
|
4875
|
-
var
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
5427
|
+
var HeaderMetaSchema = z2.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema]);
|
|
5428
|
+
var SubjectSchema = z2.object({
|
|
5429
|
+
issue: z2.number().int().nullable(),
|
|
5430
|
+
pr: z2.number().int().optional(),
|
|
5431
|
+
sha: z2.string().optional(),
|
|
5432
|
+
role: z2.union([RoleSchema, z2.literal("unattributed")]),
|
|
5433
|
+
round: z2.number().int().optional(),
|
|
5434
|
+
objectives_version: z2.string().optional()
|
|
4882
5435
|
}).strict();
|
|
4883
|
-
var HeaderSchema =
|
|
5436
|
+
var HeaderSchema = z2.object({
|
|
4884
5437
|
meta: HeaderMetaSchema,
|
|
4885
5438
|
subject: SubjectSchema
|
|
4886
5439
|
}).strict();
|
|
4887
5440
|
var envelopeTail = {
|
|
4888
|
-
duration_ms:
|
|
4889
|
-
payload:
|
|
5441
|
+
duration_ms: z2.number().nonnegative().optional(),
|
|
5442
|
+
payload: z2.object({}).strict()
|
|
4890
5443
|
};
|
|
4891
|
-
var
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
5444
|
+
var ReviewFindingSchema = z2.object({
|
|
5445
|
+
id: z2.string(),
|
|
5446
|
+
severity: z2.string(),
|
|
5447
|
+
state: z2.string().optional(),
|
|
5448
|
+
severity_scale: z2.string().optional(),
|
|
5449
|
+
policy_treatment: z2.enum(["blocking", "non_blocking", "unavailable"]).optional(),
|
|
5450
|
+
confidence: z2.number().min(0).max(1).optional(),
|
|
5451
|
+
confidence_scale: z2.string().optional(),
|
|
5452
|
+
confidence_source: z2.string().optional()
|
|
5453
|
+
}).strict();
|
|
5454
|
+
var DispatchOutcomeSchema = z2.discriminatedUnion("type", [
|
|
5455
|
+
z2.object({ type: z2.literal("pr_opened"), pr: z2.number().int(), head: z2.string() }).strict(),
|
|
5456
|
+
z2.object({
|
|
5457
|
+
type: z2.literal("round_pushed"),
|
|
5458
|
+
pr: z2.number().int(),
|
|
5459
|
+
head: z2.string(),
|
|
5460
|
+
comment_id: z2.number().int()
|
|
4898
5461
|
}).strict(),
|
|
4899
|
-
|
|
4900
|
-
type:
|
|
4901
|
-
verdict:
|
|
4902
|
-
head:
|
|
4903
|
-
comment_id:
|
|
4904
|
-
objectives:
|
|
4905
|
-
findings:
|
|
5462
|
+
z2.object({
|
|
5463
|
+
type: z2.literal("verdict"),
|
|
5464
|
+
verdict: z2.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
|
|
5465
|
+
head: z2.string(),
|
|
5466
|
+
comment_id: z2.number().int(),
|
|
5467
|
+
objectives: z2.array(z2.object({ id: z2.string(), met: z2.boolean() }).strict()),
|
|
5468
|
+
findings: z2.array(ReviewFindingSchema)
|
|
4906
5469
|
}).strict(),
|
|
4907
|
-
|
|
4908
|
-
type:
|
|
4909
|
-
class:
|
|
4910
|
-
comment_id:
|
|
5470
|
+
z2.object({
|
|
5471
|
+
type: z2.literal("escalation"),
|
|
5472
|
+
class: z2.enum(["authority", "strategy", "product"]),
|
|
5473
|
+
comment_id: z2.number().int()
|
|
4911
5474
|
}).strict(),
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
5475
|
+
z2.object({ type: z2.literal("brief"), comment_id: z2.number().int(), hash: z2.string() }).strict(),
|
|
5476
|
+
z2.object({ type: z2.literal("plan"), issues: z2.array(z2.number().int()) }).strict(),
|
|
5477
|
+
z2.object({ type: z2.literal("archive"), provenance_comment_id: z2.number().int() }).strict(),
|
|
5478
|
+
z2.object({ type: z2.literal("completed") }).strict()
|
|
4915
5479
|
]);
|
|
4916
5480
|
var dispatchShared = {
|
|
4917
5481
|
meta: HeaderMetaSchema,
|
|
4918
5482
|
subject: SubjectSchema,
|
|
4919
|
-
kind:
|
|
5483
|
+
kind: z2.literal("dispatch"),
|
|
4920
5484
|
...envelopeTail,
|
|
4921
5485
|
target_role: RoleSchema,
|
|
4922
|
-
model:
|
|
4923
|
-
round:
|
|
4924
|
-
effect_id:
|
|
5486
|
+
model: z2.string(),
|
|
5487
|
+
round: z2.number().int().optional(),
|
|
5488
|
+
effect_id: z2.string()
|
|
4925
5489
|
};
|
|
4926
|
-
var dispatchUsageField =
|
|
4927
|
-
var DispatchEventSchema =
|
|
4928
|
-
|
|
4929
|
-
|
|
5490
|
+
var dispatchUsageField = z2.object({ input: z2.number().nonnegative(), output: z2.number().nonnegative() }).strict().nullable();
|
|
5491
|
+
var DispatchEventSchema = z2.discriminatedUnion("event", [
|
|
5492
|
+
z2.object({ ...dispatchShared, event: z2.literal("dispatched"), prompt_hash: z2.string() }).strict(),
|
|
5493
|
+
z2.object({
|
|
4930
5494
|
...dispatchShared,
|
|
4931
|
-
event:
|
|
5495
|
+
event: z2.literal("outcome_received"),
|
|
4932
5496
|
outcome: DispatchOutcomeSchema,
|
|
4933
5497
|
usage: dispatchUsageField
|
|
4934
5498
|
}).strict(),
|
|
4935
|
-
|
|
5499
|
+
z2.object({
|
|
4936
5500
|
...dispatchShared,
|
|
4937
|
-
event:
|
|
4938
|
-
reason:
|
|
5501
|
+
event: z2.literal("dispatch_failed"),
|
|
5502
|
+
reason: z2.enum(["timeout", "crash", "refused", "unattributed_write"]),
|
|
4939
5503
|
usage: dispatchUsageField
|
|
4940
5504
|
}).strict()
|
|
4941
5505
|
]);
|
|
4942
5506
|
var loopShared = {
|
|
4943
5507
|
meta: HeaderMetaSchema,
|
|
4944
5508
|
subject: SubjectSchema,
|
|
4945
|
-
kind:
|
|
5509
|
+
kind: z2.literal("dev_review_loop"),
|
|
4946
5510
|
...envelopeTail,
|
|
4947
|
-
loop_id:
|
|
5511
|
+
loop_id: z2.string()
|
|
4948
5512
|
};
|
|
4949
|
-
var DevReviewLoopEventSchema =
|
|
4950
|
-
|
|
5513
|
+
var DevReviewLoopEventSchema = z2.discriminatedUnion("event", [
|
|
5514
|
+
z2.object({
|
|
4951
5515
|
...loopShared,
|
|
4952
|
-
event:
|
|
4953
|
-
task:
|
|
4954
|
-
policy:
|
|
4955
|
-
max_rounds:
|
|
4956
|
-
reviewers:
|
|
4957
|
-
models:
|
|
5516
|
+
event: z2.literal("loop_started"),
|
|
5517
|
+
task: z2.number().int(),
|
|
5518
|
+
policy: z2.object({
|
|
5519
|
+
max_rounds: z2.number().int().nonnegative(),
|
|
5520
|
+
reviewers: z2.array(RoleSchema),
|
|
5521
|
+
models: z2.record(RoleSchema, z2.string())
|
|
4958
5522
|
}).strict()
|
|
4959
5523
|
}).strict(),
|
|
4960
|
-
|
|
4961
|
-
|
|
5524
|
+
z2.object({ ...loopShared, event: z2.literal("round_started"), round: z2.number().int(), base_head: z2.string() }).strict(),
|
|
5525
|
+
z2.object({
|
|
4962
5526
|
...loopShared,
|
|
4963
|
-
event:
|
|
4964
|
-
round:
|
|
4965
|
-
head:
|
|
4966
|
-
green:
|
|
5527
|
+
event: z2.literal("gate_result_read"),
|
|
5528
|
+
round: z2.number().int(),
|
|
5529
|
+
head: z2.string(),
|
|
5530
|
+
green: z2.boolean()
|
|
4967
5531
|
}).strict(),
|
|
4968
|
-
|
|
5532
|
+
z2.object({
|
|
4969
5533
|
...loopShared,
|
|
4970
|
-
event:
|
|
4971
|
-
round:
|
|
4972
|
-
head:
|
|
4973
|
-
all_approve:
|
|
4974
|
-
blockers:
|
|
5534
|
+
event: z2.literal("verdicts_read"),
|
|
5535
|
+
round: z2.number().int(),
|
|
5536
|
+
head: z2.string(),
|
|
5537
|
+
all_approve: z2.boolean(),
|
|
5538
|
+
blockers: z2.number().int().nonnegative(),
|
|
5539
|
+
findings: z2.array(ReviewFindingSchema).optional()
|
|
4975
5540
|
}).strict(),
|
|
4976
|
-
|
|
5541
|
+
z2.object({
|
|
4977
5542
|
...loopShared,
|
|
4978
|
-
event:
|
|
4979
|
-
round:
|
|
4980
|
-
open:
|
|
4981
|
-
resolved:
|
|
4982
|
-
new:
|
|
4983
|
-
recurring:
|
|
5543
|
+
event: z2.literal("findings_compared"),
|
|
5544
|
+
round: z2.number().int(),
|
|
5545
|
+
open: z2.array(z2.string()),
|
|
5546
|
+
resolved: z2.array(z2.string()),
|
|
5547
|
+
new: z2.array(z2.string()),
|
|
5548
|
+
recurring: z2.array(z2.string())
|
|
4984
5549
|
}).strict(),
|
|
4985
|
-
|
|
5550
|
+
z2.object({
|
|
4986
5551
|
...loopShared,
|
|
4987
|
-
event:
|
|
4988
|
-
round:
|
|
4989
|
-
condition:
|
|
5552
|
+
event: z2.literal("stop_condition_met"),
|
|
5553
|
+
round: z2.number().int(),
|
|
5554
|
+
condition: z2.enum([
|
|
4990
5555
|
"green",
|
|
4991
5556
|
"max_rounds",
|
|
4992
5557
|
"no_progress",
|
|
@@ -4996,42 +5561,49 @@ var DevReviewLoopEventSchema = z.discriminatedUnion("event", [
|
|
|
4996
5561
|
"reappearance"
|
|
4997
5562
|
])
|
|
4998
5563
|
}).strict(),
|
|
4999
|
-
|
|
5564
|
+
z2.object({
|
|
5565
|
+
...loopShared,
|
|
5566
|
+
event: z2.literal("paused"),
|
|
5567
|
+
round: z2.number().int(),
|
|
5568
|
+
reason: z2.enum(["escalation", "principal_item", "refreeze_needed"])
|
|
5569
|
+
}).strict(),
|
|
5570
|
+
z2.object({
|
|
5000
5571
|
...loopShared,
|
|
5001
|
-
event:
|
|
5002
|
-
round:
|
|
5003
|
-
|
|
5572
|
+
event: z2.literal("resumed"),
|
|
5573
|
+
round: z2.number().int(),
|
|
5574
|
+
by: z2.literal("principal")
|
|
5004
5575
|
}).strict(),
|
|
5005
|
-
|
|
5576
|
+
z2.object({
|
|
5006
5577
|
...loopShared,
|
|
5007
|
-
event:
|
|
5008
|
-
round:
|
|
5009
|
-
|
|
5578
|
+
event: z2.literal("unpushed_work_resume"),
|
|
5579
|
+
round: z2.number().int(),
|
|
5580
|
+
branch: z2.string(),
|
|
5581
|
+
detail: z2.string()
|
|
5010
5582
|
}).strict(),
|
|
5011
|
-
|
|
5583
|
+
z2.object({
|
|
5012
5584
|
...loopShared,
|
|
5013
|
-
event:
|
|
5014
|
-
round:
|
|
5015
|
-
base_head:
|
|
5016
|
-
head:
|
|
5017
|
-
files_changed:
|
|
5018
|
-
insertions:
|
|
5019
|
-
deletions:
|
|
5020
|
-
wall_ms:
|
|
5021
|
-
outcome:
|
|
5585
|
+
event: z2.literal("round_ended"),
|
|
5586
|
+
round: z2.number().int(),
|
|
5587
|
+
base_head: z2.string(),
|
|
5588
|
+
head: z2.string(),
|
|
5589
|
+
files_changed: z2.number().int().nonnegative(),
|
|
5590
|
+
insertions: z2.number().int().nonnegative(),
|
|
5591
|
+
deletions: z2.number().int().nonnegative(),
|
|
5592
|
+
wall_ms: z2.number().nonnegative(),
|
|
5593
|
+
outcome: z2.enum(["green", "changes_requested", "escalated"])
|
|
5022
5594
|
}).strict(),
|
|
5023
|
-
|
|
5595
|
+
z2.object({
|
|
5024
5596
|
...loopShared,
|
|
5025
|
-
event:
|
|
5026
|
-
rounds:
|
|
5027
|
-
total_wall_ms:
|
|
5028
|
-
time_to_green_ms:
|
|
5029
|
-
files_changed_total:
|
|
5030
|
-
final_head:
|
|
5031
|
-
result:
|
|
5597
|
+
event: z2.literal("journal_finalized"),
|
|
5598
|
+
rounds: z2.number().int().nonnegative(),
|
|
5599
|
+
total_wall_ms: z2.number().nonnegative(),
|
|
5600
|
+
time_to_green_ms: z2.number().nonnegative().nullable(),
|
|
5601
|
+
files_changed_total: z2.number().int().nonnegative(),
|
|
5602
|
+
final_head: z2.string(),
|
|
5603
|
+
result: z2.enum(["merged_ready", "stopped"])
|
|
5032
5604
|
}).strict()
|
|
5033
5605
|
]);
|
|
5034
|
-
var ForgeOpSchema =
|
|
5606
|
+
var ForgeOpSchema = z2.enum([
|
|
5035
5607
|
"pr.create",
|
|
5036
5608
|
"pr.comment",
|
|
5037
5609
|
"pr.body.replace",
|
|
@@ -5045,54 +5617,466 @@ var ForgeOpSchema = z.enum([
|
|
|
5045
5617
|
"label.add",
|
|
5046
5618
|
"label.remove"
|
|
5047
5619
|
]);
|
|
5048
|
-
var ForgeWriteTargetSchema =
|
|
5049
|
-
issue:
|
|
5050
|
-
pr:
|
|
5620
|
+
var ForgeWriteTargetSchema = z2.object({
|
|
5621
|
+
issue: z2.number().int().optional(),
|
|
5622
|
+
pr: z2.number().int().optional()
|
|
5051
5623
|
}).strict();
|
|
5052
5624
|
var forgeWriteShared = {
|
|
5053
5625
|
meta: HeaderMetaSchema,
|
|
5054
5626
|
subject: SubjectSchema,
|
|
5055
|
-
kind:
|
|
5627
|
+
kind: z2.literal("forge_write"),
|
|
5056
5628
|
...envelopeTail,
|
|
5057
5629
|
op: ForgeOpSchema,
|
|
5058
5630
|
target: ForgeWriteTargetSchema
|
|
5059
5631
|
};
|
|
5060
|
-
var ForgeWriteEventSchema =
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5632
|
+
var ForgeWriteEventSchema = z2.discriminatedUnion("event", [
|
|
5633
|
+
z2.object({ ...forgeWriteShared, event: z2.literal("validated") }).strict(),
|
|
5634
|
+
z2.object({ ...forgeWriteShared, event: z2.literal("refused"), reason: z2.string() }).strict(),
|
|
5635
|
+
z2.object({ ...forgeWriteShared, event: z2.literal("written"), comment_ids: z2.array(z2.string()) }).strict()
|
|
5064
5636
|
]);
|
|
5065
|
-
var
|
|
5637
|
+
var GateOutcomeSchema = z2.enum([
|
|
5638
|
+
"pass",
|
|
5639
|
+
"fail",
|
|
5640
|
+
"wait",
|
|
5641
|
+
"skip",
|
|
5642
|
+
"invalid_input",
|
|
5643
|
+
"unavailable_dependency",
|
|
5644
|
+
"timeout",
|
|
5645
|
+
"cancelled"
|
|
5646
|
+
]);
|
|
5647
|
+
var gateShared = {
|
|
5648
|
+
meta: HeaderMetaSchema,
|
|
5649
|
+
subject: SubjectSchema,
|
|
5650
|
+
kind: z2.literal("gate"),
|
|
5651
|
+
...envelopeTail,
|
|
5652
|
+
check: z2.string(),
|
|
5653
|
+
check_version: z2.string().nullable(),
|
|
5654
|
+
policy_version: z2.string().nullable(),
|
|
5655
|
+
input_fingerprint: z2.string().nullable()
|
|
5656
|
+
};
|
|
5657
|
+
var GateEventSchema = z2.discriminatedUnion("event", [
|
|
5658
|
+
z2.object({
|
|
5659
|
+
...gateShared,
|
|
5660
|
+
event: z2.literal("checked"),
|
|
5661
|
+
outcome: GateOutcomeSchema,
|
|
5662
|
+
reason: z2.string().optional()
|
|
5663
|
+
}).strict()
|
|
5664
|
+
]);
|
|
5665
|
+
var OperationResultSchema = z2.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
|
|
5666
|
+
var operationShared = {
|
|
5667
|
+
meta: HeaderMetaSchema,
|
|
5668
|
+
subject: SubjectSchema,
|
|
5669
|
+
kind: z2.literal("operation"),
|
|
5670
|
+
...envelopeTail,
|
|
5671
|
+
operation: z2.string(),
|
|
5672
|
+
target: z2.string().nullable()
|
|
5673
|
+
};
|
|
5674
|
+
var OperationEventSchema = z2.discriminatedUnion("event", [
|
|
5675
|
+
z2.object({
|
|
5676
|
+
...operationShared,
|
|
5677
|
+
event: z2.literal("completed"),
|
|
5678
|
+
result: OperationResultSchema,
|
|
5679
|
+
error_class: z2.string().nullable()
|
|
5680
|
+
}).strict()
|
|
5681
|
+
]);
|
|
5682
|
+
var UsageUnitsSchema = z2.object({
|
|
5683
|
+
input: z2.number().nonnegative().nullable(),
|
|
5684
|
+
output: z2.number().nonnegative().nullable(),
|
|
5685
|
+
cache: z2.number().nonnegative().nullable()
|
|
5686
|
+
}).strict();
|
|
5687
|
+
var usageShared = {
|
|
5688
|
+
meta: HeaderMetaSchema,
|
|
5689
|
+
subject: SubjectSchema,
|
|
5690
|
+
kind: z2.literal("usage"),
|
|
5691
|
+
...envelopeTail,
|
|
5692
|
+
model: z2.string().nullable(),
|
|
5693
|
+
source: z2.string(),
|
|
5694
|
+
semantics: z2.enum(["cumulative", "delta"])
|
|
5695
|
+
};
|
|
5696
|
+
var UsageEventSchema = z2.discriminatedUnion("event", [
|
|
5697
|
+
z2.object({
|
|
5698
|
+
...usageShared,
|
|
5699
|
+
event: z2.literal("observed"),
|
|
5700
|
+
units: UsageUnitsSchema,
|
|
5701
|
+
unknown_reason: z2.string().nullable()
|
|
5702
|
+
}).strict()
|
|
5703
|
+
]);
|
|
5704
|
+
var RoleAttemptOutcomeSchema = z2.enum([
|
|
5705
|
+
"completed",
|
|
5706
|
+
"incomplete",
|
|
5707
|
+
"infrastructure_failed",
|
|
5708
|
+
"cancelled",
|
|
5709
|
+
"timed_out",
|
|
5710
|
+
"capability_refused"
|
|
5711
|
+
]);
|
|
5712
|
+
var roleAttemptShared = {
|
|
5713
|
+
meta: HeaderMetaSchema,
|
|
5714
|
+
subject: SubjectSchema,
|
|
5715
|
+
kind: z2.literal("role_attempt"),
|
|
5716
|
+
...envelopeTail,
|
|
5717
|
+
actor: z2.string().nullable(),
|
|
5718
|
+
attempt: z2.number().int().nullable(),
|
|
5719
|
+
effect_id: z2.string(),
|
|
5720
|
+
model: z2.string().nullable()
|
|
5721
|
+
};
|
|
5722
|
+
var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
|
|
5723
|
+
z2.object({
|
|
5724
|
+
...roleAttemptShared,
|
|
5725
|
+
event: z2.literal("attempted"),
|
|
5726
|
+
outcome: RoleAttemptOutcomeSchema,
|
|
5727
|
+
usage: dispatchUsageField
|
|
5728
|
+
}).strict()
|
|
5729
|
+
]);
|
|
5730
|
+
var handoffShared = {
|
|
5731
|
+
meta: HeaderMetaSchema,
|
|
5732
|
+
subject: SubjectSchema,
|
|
5733
|
+
kind: z2.literal("handoff"),
|
|
5734
|
+
...envelopeTail,
|
|
5735
|
+
class: z2.enum(["authority", "strategy", "product"]),
|
|
5736
|
+
reason: z2.string()
|
|
5737
|
+
};
|
|
5738
|
+
var HandoffEventSchema = z2.discriminatedUnion("event", [
|
|
5739
|
+
z2.object({
|
|
5740
|
+
...handoffShared,
|
|
5741
|
+
event: z2.literal("raised"),
|
|
5742
|
+
requested_decision: z2.string().nullable()
|
|
5743
|
+
}).strict(),
|
|
5744
|
+
z2.object({
|
|
5745
|
+
...handoffShared,
|
|
5746
|
+
event: z2.literal("resolved"),
|
|
5747
|
+
resolution: z2.string().nullable(),
|
|
5748
|
+
resolved_by: z2.string().nullable()
|
|
5749
|
+
}).strict()
|
|
5750
|
+
]);
|
|
5751
|
+
var EffectTargetSchema = z2.object({
|
|
5752
|
+
kind: z2.string(),
|
|
5753
|
+
ref: z2.string()
|
|
5754
|
+
}).strict();
|
|
5755
|
+
var effectShared = {
|
|
5756
|
+
meta: HeaderMetaSchema,
|
|
5757
|
+
subject: SubjectSchema,
|
|
5758
|
+
kind: z2.literal("effect"),
|
|
5759
|
+
...envelopeTail,
|
|
5760
|
+
effect_id: z2.string(),
|
|
5761
|
+
target: EffectTargetSchema
|
|
5762
|
+
};
|
|
5763
|
+
var EffectEventSchema = z2.discriminatedUnion("event", [
|
|
5764
|
+
z2.object({ ...effectShared, event: z2.literal("attempted") }).strict(),
|
|
5765
|
+
z2.object({ ...effectShared, event: z2.literal("observed"), outcome: z2.enum(["success", "failure", "uncertain"]) }).strict(),
|
|
5766
|
+
z2.object({ ...effectShared, event: z2.literal("verified"), outcome: z2.enum(["success", "failure", "uncertain"]) }).strict()
|
|
5767
|
+
]);
|
|
5768
|
+
var LogEventSchema = z2.union([
|
|
5769
|
+
DispatchEventSchema,
|
|
5770
|
+
DevReviewLoopEventSchema,
|
|
5771
|
+
ForgeWriteEventSchema,
|
|
5772
|
+
GateEventSchema,
|
|
5773
|
+
OperationEventSchema,
|
|
5774
|
+
UsageEventSchema,
|
|
5775
|
+
RoleAttemptEventSchema,
|
|
5776
|
+
HandoffEventSchema,
|
|
5777
|
+
EffectEventSchema
|
|
5778
|
+
]);
|
|
5779
|
+
|
|
5780
|
+
// ../../packages/aeg-core/src/log/envelope.ts
|
|
5781
|
+
function isRole(value) {
|
|
5782
|
+
return value !== undefined && ROLE_VALUES.includes(value);
|
|
5783
|
+
}
|
|
5784
|
+
function actorIdFromEnv(role) {
|
|
5785
|
+
return role === undefined || role === "" ? null : role;
|
|
5786
|
+
}
|
|
5787
|
+
function lineageFieldFromEnv(value) {
|
|
5788
|
+
return value === undefined || value === "" ? null : value;
|
|
5789
|
+
}
|
|
5790
|
+
function attemptFromEnv(value) {
|
|
5791
|
+
if (value === undefined || value === "")
|
|
5792
|
+
return null;
|
|
5793
|
+
const n = Number(value);
|
|
5794
|
+
return Number.isInteger(n) ? n : null;
|
|
5795
|
+
}
|
|
5796
|
+
function provenanceFor(input) {
|
|
5797
|
+
if (input.provenance)
|
|
5798
|
+
return input.provenance;
|
|
5799
|
+
if (input.env.role || input.env.task)
|
|
5800
|
+
return "env_correlated";
|
|
5801
|
+
return "unavailable";
|
|
5802
|
+
}
|
|
5803
|
+
function issueFromTask(task) {
|
|
5804
|
+
if (task === undefined || task === "")
|
|
5805
|
+
return null;
|
|
5806
|
+
const n = Number(task);
|
|
5807
|
+
return Number.isInteger(n) ? n : null;
|
|
5808
|
+
}
|
|
5809
|
+
function roundFromEnv(round) {
|
|
5810
|
+
if (round === undefined || round === "")
|
|
5811
|
+
return;
|
|
5812
|
+
const n = Number(round);
|
|
5813
|
+
return Number.isInteger(n) ? n : undefined;
|
|
5814
|
+
}
|
|
5815
|
+
function buildHeader(input) {
|
|
5816
|
+
const role = isRole(input.env.role) ? input.env.role : "unattributed";
|
|
5817
|
+
const round = roundFromEnv(input.env.round);
|
|
5818
|
+
const subject = {
|
|
5819
|
+
issue: issueFromTask(input.env.task),
|
|
5820
|
+
role,
|
|
5821
|
+
...round !== undefined ? { round } : {},
|
|
5822
|
+
...input.subject ?? {}
|
|
5823
|
+
};
|
|
5824
|
+
return {
|
|
5825
|
+
meta: {
|
|
5826
|
+
schema: 2,
|
|
5827
|
+
ts: input.now.toISOString(),
|
|
5828
|
+
run_id: input.runId,
|
|
5829
|
+
seq: input.seq,
|
|
5830
|
+
repo: input.repo,
|
|
5831
|
+
vinaya: input.vinaya,
|
|
5832
|
+
doctrine: input.doctrine,
|
|
5833
|
+
host: input.host,
|
|
5834
|
+
machine: createHash5("sha256").update(input.hostname).digest("hex"),
|
|
5835
|
+
event_id: input.eventId,
|
|
5836
|
+
process_id: input.processId,
|
|
5837
|
+
actor_id: actorIdFromEnv(input.env.role),
|
|
5838
|
+
lineage: {
|
|
5839
|
+
run: lineageFieldFromEnv(input.env.run),
|
|
5840
|
+
attempt: attemptFromEnv(input.env.attempt),
|
|
5841
|
+
parent: lineageFieldFromEnv(input.env.parent)
|
|
5842
|
+
},
|
|
5843
|
+
input_versions: {
|
|
5844
|
+
objectives_version: input.inputVersions?.objectivesVersion ?? null,
|
|
5845
|
+
brief_hash: input.inputVersions?.briefHash ?? null,
|
|
5846
|
+
ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
|
|
5847
|
+
policy_digest: input.inputVersions?.policyDigest ?? null
|
|
5848
|
+
},
|
|
5849
|
+
provenance: provenanceFor(input)
|
|
5850
|
+
},
|
|
5851
|
+
subject
|
|
5852
|
+
};
|
|
5853
|
+
}
|
|
5854
|
+
// ../../packages/aeg-core/src/log/redact.ts
|
|
5855
|
+
var GITHUB_TOKEN_PATTERN = /\b(?:gho_|ghp_|ghs_|ghu_|ghr_|github_pat_)[A-Za-z0-9_]+\b/g;
|
|
5856
|
+
var CLASSIC_GITHUB_PAT_PATTERN = /\b((?:token|GITHUB_TOKEN|PAT|api[_-]?key|api[_-]?token)\s*[:=]\s*)[a-f0-9]{40}\b/gi;
|
|
5857
|
+
var BEARER_TOKEN_PATTERN = /\bBearer\s+\S+/g;
|
|
5858
|
+
var AWS_ACCESS_KEY_PATTERN = /\bAKIA[0-9A-Z]{16}\b/g;
|
|
5859
|
+
var SLACK_TOKEN_PATTERN = /\bxox[baprs]-[0-9A-Za-z-]+\b/g;
|
|
5860
|
+
var STRIPE_KEY_PATTERN = /\b(?:sk|pk|rk)_(?:live|test)_[0-9A-Za-z]{10,}\b/g;
|
|
5861
|
+
var ANTHROPIC_KEY_PATTERN = /\bsk-ant-[A-Za-z0-9_-]{20,}\b/g;
|
|
5862
|
+
var OPENAI_KEY_PATTERN = /\bsk-(?!ant-)[A-Za-z0-9]{20,}\b/g;
|
|
5863
|
+
var NPM_TOKEN_PATTERN = /\bnpm_[A-Za-z0-9]{36}\b/g;
|
|
5864
|
+
var JWT_PATTERN = /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g;
|
|
5865
|
+
var PEM_BLOCK_PATTERN = /-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g;
|
|
5866
|
+
var BASIC_AUTH_URL_PATTERN = /(https?:\/\/)[^/\s:@]+:[^/\s@]+@/g;
|
|
5867
|
+
var GENERIC_SECRET_ASSIGNMENT_PATTERN = /\b((?:secret|password|passwd|api[_-]?key|access[_-]?key|client[_-]?secret|private[_-]?key)\s*[:=]\s*)[A-Za-z0-9+/_=-]{16,}\b/gi;
|
|
5868
|
+
function redactString(value, home) {
|
|
5869
|
+
let out = value.replace(GITHUB_TOKEN_PATTERN, "<redacted>").replace(CLASSIC_GITHUB_PAT_PATTERN, "$1<redacted>").replace(BEARER_TOKEN_PATTERN, "<redacted>").replace(AWS_ACCESS_KEY_PATTERN, "<redacted>").replace(SLACK_TOKEN_PATTERN, "<redacted>").replace(STRIPE_KEY_PATTERN, "<redacted>").replace(ANTHROPIC_KEY_PATTERN, "<redacted>").replace(OPENAI_KEY_PATTERN, "<redacted>").replace(NPM_TOKEN_PATTERN, "<redacted>").replace(JWT_PATTERN, "<redacted>").replace(PEM_BLOCK_PATTERN, "<redacted>").replace(BASIC_AUTH_URL_PATTERN, "$1<redacted>@").replace(GENERIC_SECRET_ASSIGNMENT_PATTERN, "$1<redacted>");
|
|
5870
|
+
if (home.length > 0 && out.startsWith(home)) {
|
|
5871
|
+
const rest = out.slice(home.length);
|
|
5872
|
+
if (rest === "" || rest.startsWith("/"))
|
|
5873
|
+
out = `~${rest}`;
|
|
5874
|
+
}
|
|
5875
|
+
return out;
|
|
5876
|
+
}
|
|
5877
|
+
function redact(value, home) {
|
|
5878
|
+
if (typeof value === "string")
|
|
5879
|
+
return redactString(value, home);
|
|
5880
|
+
if (Array.isArray(value))
|
|
5881
|
+
return value.map((v) => redact(v, home));
|
|
5882
|
+
if (value !== null && typeof value === "object") {
|
|
5883
|
+
const out = {};
|
|
5884
|
+
for (const [k, v] of Object.entries(value)) {
|
|
5885
|
+
out[k] = redact(v, home);
|
|
5886
|
+
}
|
|
5887
|
+
return out;
|
|
5888
|
+
}
|
|
5889
|
+
return value;
|
|
5890
|
+
}
|
|
5891
|
+
// ../../packages/aeg-core/src/log/store.ts
|
|
5892
|
+
function metaOf(obj) {
|
|
5893
|
+
if (obj === null || typeof obj !== "object")
|
|
5894
|
+
return null;
|
|
5895
|
+
const meta = obj.meta;
|
|
5896
|
+
if (meta === null || typeof meta !== "object")
|
|
5897
|
+
return null;
|
|
5898
|
+
return meta;
|
|
5899
|
+
}
|
|
5900
|
+
function recordIdentity(obj) {
|
|
5901
|
+
const meta = metaOf(obj);
|
|
5902
|
+
if (meta === null)
|
|
5903
|
+
return null;
|
|
5904
|
+
const eventId = meta.event_id;
|
|
5905
|
+
if (typeof eventId === "string" && eventId.length > 0)
|
|
5906
|
+
return eventId;
|
|
5907
|
+
const runId = meta.run_id;
|
|
5908
|
+
const seq = meta.seq;
|
|
5909
|
+
if (typeof runId === "string" && runId.length > 0 && typeof seq === "number" && Number.isInteger(seq)) {
|
|
5910
|
+
return `${runId}:${seq}`;
|
|
5911
|
+
}
|
|
5912
|
+
return null;
|
|
5913
|
+
}
|
|
5914
|
+
|
|
5915
|
+
// ../../packages/aeg-core/src/log/artifact.ts
|
|
5916
|
+
var TASK_LOG_ARTIFACT_MAX_BYTES = 8 * 1024 * 1024;
|
|
5917
|
+
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
5918
|
+
var STOPPED_CONDITIONS = new Set(["confidence", "reappearance", "no_progress", "max_rounds"]);
|
|
5919
|
+
// ../../packages/aeg-core/src/control-store/records.ts
|
|
5920
|
+
import { z as z3 } from "zod";
|
|
5921
|
+
var isoTimestamp = z3.string().min(1);
|
|
5922
|
+
var taskId = z3.number().int().positive();
|
|
5923
|
+
var epochNumber = z3.number().int().nonnegative();
|
|
5924
|
+
var RunRecordSchema = z3.object({
|
|
5925
|
+
version: z3.literal(1),
|
|
5926
|
+
kind: z3.literal("run"),
|
|
5927
|
+
task: taskId,
|
|
5928
|
+
runId: z3.string().min(1),
|
|
5929
|
+
pid: z3.number().int().positive(),
|
|
5930
|
+
host: z3.string().min(1),
|
|
5931
|
+
startedAt: isoTimestamp,
|
|
5932
|
+
childStartedAt: z3.string().min(1).nullable().optional(),
|
|
5933
|
+
childCommand: z3.string().min(1).nullable().optional()
|
|
5934
|
+
}).strict();
|
|
5935
|
+
var InputRecordSchema = z3.object({
|
|
5936
|
+
version: z3.literal(1),
|
|
5937
|
+
kind: z3.literal("input"),
|
|
5938
|
+
task: taskId,
|
|
5939
|
+
runId: z3.string().min(1),
|
|
5940
|
+
source: z3.union([z3.literal("fresh"), z3.literal("resume")]),
|
|
5941
|
+
pr: z3.number().int().positive().nullable(),
|
|
5942
|
+
round: z3.number().int().nonnegative(),
|
|
5943
|
+
recordedAt: isoTimestamp
|
|
5944
|
+
}).strict();
|
|
5945
|
+
var OwnershipRecordSchema = z3.object({
|
|
5946
|
+
version: z3.literal(1),
|
|
5947
|
+
kind: z3.literal("ownership"),
|
|
5948
|
+
task: taskId,
|
|
5949
|
+
epoch: epochNumber,
|
|
5950
|
+
ownerId: z3.string().min(1),
|
|
5951
|
+
pid: z3.number().int().positive(),
|
|
5952
|
+
host: z3.string().min(1),
|
|
5953
|
+
acquiredAt: isoTimestamp
|
|
5954
|
+
}).strict();
|
|
5955
|
+
var TransitionRecordSchema = z3.object({
|
|
5956
|
+
version: z3.literal(1),
|
|
5957
|
+
kind: z3.literal("transition"),
|
|
5958
|
+
task: taskId,
|
|
5959
|
+
epoch: epochNumber,
|
|
5960
|
+
seq: z3.number().int().nonnegative(),
|
|
5961
|
+
from: z3.string().min(1),
|
|
5962
|
+
to: z3.string().min(1),
|
|
5963
|
+
detail: z3.string().optional(),
|
|
5964
|
+
at: isoTimestamp
|
|
5965
|
+
}).strict();
|
|
5966
|
+
var ManifestRecordSchema = z3.object({
|
|
5967
|
+
version: z3.literal(1),
|
|
5968
|
+
kind: z3.literal("manifest"),
|
|
5969
|
+
task: taskId,
|
|
5970
|
+
round: epochNumber,
|
|
5971
|
+
repository: z3.string().min(1),
|
|
5972
|
+
pr: z3.number().int().positive(),
|
|
5973
|
+
branch: z3.string().min(1),
|
|
5974
|
+
baseSha: z3.string().min(1).nullable(),
|
|
5975
|
+
headSha: z3.string().min(1),
|
|
5976
|
+
briefHash: z3.string().min(1).nullable(),
|
|
5977
|
+
objectivesVersion: z3.string().min(1).nullable(),
|
|
5978
|
+
rulingOrdinal: epochNumber,
|
|
5979
|
+
policyDigest: z3.string().min(1),
|
|
5980
|
+
recordedAt: isoTimestamp
|
|
5981
|
+
}).strict();
|
|
5982
|
+
var roundHeadIdentity = z3.object({ round: z3.number().int().positive(), head: z3.string().min(1) }).strict();
|
|
5983
|
+
var LoopBudgetsSchema = z3.object({
|
|
5984
|
+
mechanicalRetries: z3.number().int().nonnegative(),
|
|
5985
|
+
reviewRounds: z3.number().int().nonnegative(),
|
|
5986
|
+
infrastructureRetries: z3.number().int().nonnegative()
|
|
5987
|
+
}).strict();
|
|
5988
|
+
var LoopStateRecordSchema = z3.object({
|
|
5989
|
+
version: z3.literal(1),
|
|
5990
|
+
kind: z3.literal("loop_state"),
|
|
5991
|
+
task: taskId,
|
|
5992
|
+
round: z3.number().int().positive(),
|
|
5993
|
+
phase: z3.string().min(1),
|
|
5994
|
+
pauseReason: z3.string().min(1).nullable(),
|
|
5995
|
+
budgets: LoopBudgetsSchema,
|
|
5996
|
+
heldResult: roundHeadIdentity.nullable(),
|
|
5997
|
+
deliveredFindings: roundHeadIdentity.nullable(),
|
|
5998
|
+
recordedAt: isoTimestamp
|
|
5999
|
+
}).strict();
|
|
6000
|
+
var EffectRecordSchema = z3.object({
|
|
6001
|
+
version: z3.literal(1),
|
|
6002
|
+
kind: z3.literal("effect"),
|
|
6003
|
+
task: taskId,
|
|
6004
|
+
key: z3.string().min(1),
|
|
6005
|
+
operation: z3.string().min(1),
|
|
6006
|
+
target: z3.string().min(1),
|
|
6007
|
+
inputVersion: z3.number().int().nonnegative(),
|
|
6008
|
+
payloadDigest: z3.string().min(1),
|
|
6009
|
+
status: z3.union([z3.literal("started"), z3.literal("verified"), z3.literal("uncertain")]),
|
|
6010
|
+
url: z3.string().optional(),
|
|
6011
|
+
recordedAt: isoTimestamp
|
|
6012
|
+
}).strict();
|
|
6013
|
+
var EscalationRecordSchema = z3.object({
|
|
6014
|
+
version: z3.literal(1),
|
|
6015
|
+
kind: z3.literal("escalation"),
|
|
6016
|
+
task: taskId,
|
|
6017
|
+
escalationId: z3.string().min(1),
|
|
6018
|
+
round: epochNumber,
|
|
6019
|
+
head: z3.string().min(1),
|
|
6020
|
+
branch: z3.string().min(1),
|
|
6021
|
+
pr: z3.number().int().positive().nullable(),
|
|
6022
|
+
runId: z3.string().min(1),
|
|
6023
|
+
pid: z3.number().int().positive(),
|
|
6024
|
+
host: z3.string().min(1),
|
|
6025
|
+
agent: z3.string().min(1).optional(),
|
|
6026
|
+
reason: z3.string().min(1),
|
|
6027
|
+
detail: z3.string().optional(),
|
|
6028
|
+
evidence: z3.string().optional(),
|
|
6029
|
+
attemptedRecovery: z3.string().min(1),
|
|
6030
|
+
requestedDecision: z3.string().min(1),
|
|
6031
|
+
recipient: z3.string().min(1),
|
|
6032
|
+
briefHash: z3.string().min(1).nullable(),
|
|
6033
|
+
objectivesVersion: z3.string().min(1).nullable(),
|
|
6034
|
+
rulingOrdinal: epochNumber,
|
|
6035
|
+
policyDigest: z3.string().min(1),
|
|
6036
|
+
recordedAt: isoTimestamp
|
|
6037
|
+
}).strict();
|
|
6038
|
+
var ResolutionRecordSchema = z3.object({
|
|
6039
|
+
version: z3.literal(1),
|
|
6040
|
+
kind: z3.literal("resolution"),
|
|
6041
|
+
task: taskId,
|
|
6042
|
+
escalationId: z3.string().min(1),
|
|
6043
|
+
decision: z3.union([z3.literal("resume"), z3.literal("cancel")]),
|
|
6044
|
+
authenticatedBy: z3.string().min(1),
|
|
6045
|
+
authenticatedFrom: z3.string().min(1),
|
|
6046
|
+
consumedAt: isoTimestamp
|
|
6047
|
+
}).strict();
|
|
5066
6048
|
// src/lib/diff-evidence.ts
|
|
5067
|
-
import { execFileSync as
|
|
5068
|
-
import { join as
|
|
6049
|
+
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
6050
|
+
import { join as join5, relative, resolve as resolve2 } from "node:path";
|
|
5069
6051
|
|
|
5070
6052
|
// src/lib/config.ts
|
|
5071
6053
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
5072
6054
|
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
|
|
5073
6055
|
import { homedir } from "node:os";
|
|
5074
6056
|
import { dirname, join, resolve } from "node:path";
|
|
5075
|
-
import { z as
|
|
6057
|
+
import { z as z4 } from "zod";
|
|
5076
6058
|
|
|
5077
6059
|
// src/lib/agent-vendors.ts
|
|
5078
6060
|
var AGENT_VENDORS = ["skills", "claude", "gemini"];
|
|
5079
6061
|
|
|
5080
6062
|
// src/lib/config.ts
|
|
5081
|
-
var EnvEntrySchema =
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
6063
|
+
var EnvEntrySchema = z4.union([
|
|
6064
|
+
z4.literal(true),
|
|
6065
|
+
z4.object({ optional: z4.literal(true) }),
|
|
6066
|
+
z4.object({ anyOf: z4.array(z4.string()).min(2) }),
|
|
6067
|
+
z4.string()
|
|
5086
6068
|
]);
|
|
5087
|
-
var CheckEntrySchema =
|
|
5088
|
-
run:
|
|
5089
|
-
scope:
|
|
5090
|
-
include:
|
|
5091
|
-
args:
|
|
5092
|
-
timeoutMs:
|
|
5093
|
-
env:
|
|
5094
|
-
requiresOpenPr:
|
|
5095
|
-
ownWorkflow:
|
|
6069
|
+
var CheckEntrySchema = z4.object({
|
|
6070
|
+
run: z4.string(),
|
|
6071
|
+
scope: z4.enum(["diff", "full"]),
|
|
6072
|
+
include: z4.array(z4.string()).optional(),
|
|
6073
|
+
args: z4.array(z4.string()).optional(),
|
|
6074
|
+
timeoutMs: z4.number().optional(),
|
|
6075
|
+
env: z4.record(z4.string(), EnvEntrySchema).optional(),
|
|
6076
|
+
requiresOpenPr: z4.boolean().optional(),
|
|
6077
|
+
ownWorkflow: z4.boolean().optional(),
|
|
6078
|
+
principalOwed: z4.literal(true).optional(),
|
|
6079
|
+
validates: z4.enum(["body", "issue"]).optional()
|
|
5096
6080
|
}).superRefine((entry2, ctx) => {
|
|
5097
6081
|
if (!entry2.env)
|
|
5098
6082
|
return;
|
|
@@ -5102,25 +6086,26 @@ var CheckEntrySchema = z2.object({
|
|
|
5102
6086
|
const members = value.anyOf;
|
|
5103
6087
|
if (new Set(members).size !== members.length) {
|
|
5104
6088
|
ctx.addIssue({
|
|
5105
|
-
code:
|
|
6089
|
+
code: z4.ZodIssueCode.custom,
|
|
5106
6090
|
message: `env.${key}.anyOf has duplicate members`,
|
|
5107
6091
|
path: ["env", key, "anyOf"]
|
|
5108
6092
|
});
|
|
5109
6093
|
}
|
|
5110
6094
|
if (!members.includes(key)) {
|
|
5111
6095
|
ctx.addIssue({
|
|
5112
|
-
code:
|
|
6096
|
+
code: z4.ZodIssueCode.custom,
|
|
5113
6097
|
message: `env.${key}.anyOf must include "${key}" itself as a member`,
|
|
5114
6098
|
path: ["env", key, "anyOf"]
|
|
5115
6099
|
});
|
|
5116
6100
|
}
|
|
5117
6101
|
}
|
|
5118
6102
|
});
|
|
5119
|
-
var RoleEntrySchema =
|
|
5120
|
-
contract:
|
|
6103
|
+
var RoleEntrySchema = z4.object({
|
|
6104
|
+
contract: z4.string().refine((p) => p.includes("/"), {
|
|
5121
6105
|
message: 'must be a path (contain at least one "/"), not a bare filename'
|
|
5122
6106
|
})
|
|
5123
6107
|
});
|
|
6108
|
+
var MAX_REPORT_COMMAND_TIMEOUT_MS = 3600000;
|
|
5124
6109
|
var BRIEF_BUILTINS = [
|
|
5125
6110
|
"tier",
|
|
5126
6111
|
"testPlan",
|
|
@@ -5140,17 +6125,17 @@ var BRIEF_BUILTINS = [
|
|
|
5140
6125
|
"briefSections",
|
|
5141
6126
|
"milestoneShape"
|
|
5142
6127
|
];
|
|
5143
|
-
var BriefSectionSchema =
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
6128
|
+
var BriefSectionSchema = z4.union([
|
|
6129
|
+
z4.object({ builtin: z4.enum(BRIEF_BUILTINS) }),
|
|
6130
|
+
z4.object({ heading: z4.string().min(1), name: z4.string().optional() }),
|
|
6131
|
+
z4.object({ field: z4.string().min(1), name: z4.string().optional() }),
|
|
6132
|
+
z4.object({ phrase: z4.string().min(1), name: z4.string().optional() })
|
|
5148
6133
|
]);
|
|
5149
|
-
var BriefSchemaSchema =
|
|
5150
|
-
pr:
|
|
5151
|
-
issue:
|
|
5152
|
-
milestone:
|
|
5153
|
-
ack:
|
|
6134
|
+
var BriefSchemaSchema = z4.object({
|
|
6135
|
+
pr: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
|
|
6136
|
+
issue: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
|
|
6137
|
+
milestone: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
|
|
6138
|
+
ack: z4.array(z4.enum(BRIEF_BUILTINS)).optional()
|
|
5154
6139
|
});
|
|
5155
6140
|
function isSafeRepoRelPath(p) {
|
|
5156
6141
|
if (p.length === 0)
|
|
@@ -5159,7 +6144,7 @@ function isSafeRepoRelPath(p) {
|
|
|
5159
6144
|
return false;
|
|
5160
6145
|
return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
|
|
5161
6146
|
}
|
|
5162
|
-
var SafeRepoRelPath =
|
|
6147
|
+
var SafeRepoRelPath = z4.string().refine(isSafeRepoRelPath, {
|
|
5163
6148
|
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
5164
6149
|
});
|
|
5165
6150
|
var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
@@ -5169,22 +6154,22 @@ function isCanonicalHookBlockPath(p) {
|
|
|
5169
6154
|
var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
|
|
5170
6155
|
message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
|
|
5171
6156
|
});
|
|
5172
|
-
var ManagedBlockRecordSchema =
|
|
6157
|
+
var ManagedBlockRecordSchema = z4.object({
|
|
5173
6158
|
path: ManagedHookBlockPath,
|
|
5174
|
-
marker:
|
|
5175
|
-
comment:
|
|
6159
|
+
marker: z4.string(),
|
|
6160
|
+
comment: z4.enum(["hash", "html"])
|
|
5176
6161
|
});
|
|
5177
|
-
var ManagedManifestSchema =
|
|
5178
|
-
version:
|
|
5179
|
-
files:
|
|
5180
|
-
blocks:
|
|
5181
|
-
labels:
|
|
5182
|
-
agents:
|
|
6162
|
+
var ManagedManifestSchema = z4.object({
|
|
6163
|
+
version: z4.number().int().positive(),
|
|
6164
|
+
files: z4.array(SafeRepoRelPath),
|
|
6165
|
+
blocks: z4.array(ManagedBlockRecordSchema),
|
|
6166
|
+
labels: z4.array(z4.string()),
|
|
6167
|
+
agents: z4.array(z4.enum(AGENT_VENDORS)).optional()
|
|
5183
6168
|
});
|
|
5184
|
-
var ProjectEntrySchema =
|
|
5185
|
-
name:
|
|
5186
|
-
description:
|
|
5187
|
-
path:
|
|
6169
|
+
var ProjectEntrySchema = z4.object({
|
|
6170
|
+
name: z4.string().min(1),
|
|
6171
|
+
description: z4.string().min(1).optional(),
|
|
6172
|
+
path: z4.string().min(1).optional()
|
|
5188
6173
|
});
|
|
5189
6174
|
function parseTokensCollectDeclaration(value) {
|
|
5190
6175
|
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
@@ -5195,34 +6180,62 @@ function parseTokensCollectDeclaration(value) {
|
|
|
5195
6180
|
return null;
|
|
5196
6181
|
return { interpreter, script };
|
|
5197
6182
|
}
|
|
5198
|
-
var VinayaConfigSchema =
|
|
5199
|
-
rings:
|
|
5200
|
-
ring1_forgeWriteInterception:
|
|
5201
|
-
ring2_asyncAudits:
|
|
6183
|
+
var VinayaConfigSchema = z4.object({
|
|
6184
|
+
rings: z4.object({
|
|
6185
|
+
ring1_forgeWriteInterception: z4.boolean(),
|
|
6186
|
+
ring2_asyncAudits: z4.boolean()
|
|
5202
6187
|
}).optional(),
|
|
5203
|
-
checks:
|
|
5204
|
-
roles:
|
|
6188
|
+
checks: z4.record(z4.string(), CheckEntrySchema).optional(),
|
|
6189
|
+
roles: z4.record(z4.string(), RoleEntrySchema).optional(),
|
|
5205
6190
|
briefSchema: BriefSchemaSchema.optional(),
|
|
5206
6191
|
managed: ManagedManifestSchema.optional(),
|
|
5207
|
-
principals:
|
|
5208
|
-
releaseActor:
|
|
5209
|
-
ci:
|
|
5210
|
-
tokens:
|
|
5211
|
-
collect:
|
|
6192
|
+
principals: z4.array(z4.string()).min(1).optional(),
|
|
6193
|
+
releaseActor: z4.string().min(1).optional(),
|
|
6194
|
+
ci: z4.object({ setup: z4.string().min(1) }).optional(),
|
|
6195
|
+
tokens: z4.object({
|
|
6196
|
+
collect: z4.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
5212
6197
|
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
5213
6198
|
})
|
|
5214
6199
|
}).optional(),
|
|
5215
|
-
blastRadius:
|
|
5216
|
-
proseGates:
|
|
5217
|
-
doctrineRoot:
|
|
5218
|
-
readerFacingPrefix:
|
|
5219
|
-
readerFacingSuffix:
|
|
5220
|
-
legacySlugDir:
|
|
6200
|
+
blastRadius: z4.object({ extraDomains: z4.array(z4.string()).optional() }).optional(),
|
|
6201
|
+
proseGates: z4.object({
|
|
6202
|
+
doctrineRoot: z4.string().min(1).optional(),
|
|
6203
|
+
readerFacingPrefix: z4.string().min(1).optional(),
|
|
6204
|
+
readerFacingSuffix: z4.string().min(1).optional(),
|
|
6205
|
+
legacySlugDir: z4.string().min(1).optional()
|
|
6206
|
+
}).optional(),
|
|
6207
|
+
projects: z4.array(ProjectEntrySchema).optional(),
|
|
6208
|
+
dispatch: z4.object({
|
|
6209
|
+
timeoutMs: z4.number().int().positive().optional(),
|
|
6210
|
+
killGraceMs: z4.number().int().positive().optional(),
|
|
6211
|
+
agent: z4.enum(["claude", "codex", "gemini"]).optional()
|
|
5221
6212
|
}).optional(),
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
6213
|
+
reviewPolicy: z4.object({
|
|
6214
|
+
codeReviewThreshold: z4.string().min(1).optional(),
|
|
6215
|
+
securityThreshold: z4.string().min(1).optional(),
|
|
6216
|
+
maxRounds: z4.number().optional()
|
|
6217
|
+
}).optional(),
|
|
6218
|
+
prePush: z4.object({
|
|
6219
|
+
alwaysRun: z4.array(z4.string()).optional()
|
|
6220
|
+
}).optional(),
|
|
6221
|
+
report: z4.object({
|
|
6222
|
+
commandTimeoutMs: z4.number().int().positive().optional()
|
|
6223
|
+
}).superRefine((report, ctx) => {
|
|
6224
|
+
const commandTimeoutMs = report.commandTimeoutMs;
|
|
6225
|
+
if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
|
|
6226
|
+
ctx.addIssue({
|
|
6227
|
+
code: z4.ZodIssueCode.custom,
|
|
6228
|
+
path: ["commandTimeoutMs"],
|
|
6229
|
+
message: "must be at most 3600000 (1 hour)"
|
|
6230
|
+
});
|
|
6231
|
+
}
|
|
6232
|
+
}).optional(),
|
|
6233
|
+
logPublish: z4.object({
|
|
6234
|
+
issue: z4.number().int().positive().optional(),
|
|
6235
|
+
pr: z4.number().int().positive().optional(),
|
|
6236
|
+
maxChunksPerFlush: z4.number().int().positive().optional()
|
|
6237
|
+
}).refine((v) => !(v.issue !== undefined && v.pr !== undefined), {
|
|
6238
|
+
message: "logPublish: set at most one of issue/pr, not both"
|
|
5226
6239
|
}).optional()
|
|
5227
6240
|
});
|
|
5228
6241
|
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
@@ -5297,6 +6310,28 @@ function resolvePrincipalAllowlist(config) {
|
|
|
5297
6310
|
function resolveReleaseActor(config) {
|
|
5298
6311
|
return config?.releaseActor ?? DEFAULT_RELEASE_ACTOR;
|
|
5299
6312
|
}
|
|
6313
|
+
function resolveReviewPolicy(config) {
|
|
6314
|
+
const raw = config?.reviewPolicy;
|
|
6315
|
+
if (!raw)
|
|
6316
|
+
return DEFAULT_REVIEW_POLICY;
|
|
6317
|
+
const codeReviewThreshold = raw.codeReviewThreshold ?? DEFAULT_REVIEW_POLICY.codeReviewThreshold;
|
|
6318
|
+
if (!isKnownSeverity(CODE_REVIEW_SEVERITY_ORDER, codeReviewThreshold)) {
|
|
6319
|
+
throw new Error(`vinaya.config.json: reviewPolicy.codeReviewThreshold "${codeReviewThreshold}" is not one of ${CODE_REVIEW_SEVERITY_ORDER.join(" > ")} — fix the config, this never falls back to a default.`);
|
|
6320
|
+
}
|
|
6321
|
+
const securityThreshold = raw.securityThreshold ?? DEFAULT_REVIEW_POLICY.securityThreshold;
|
|
6322
|
+
if (!isKnownSeverity(SECURITY_SEVERITY_ORDER, securityThreshold)) {
|
|
6323
|
+
throw new Error(`vinaya.config.json: reviewPolicy.securityThreshold "${securityThreshold}" is not one of ${SECURITY_SEVERITY_ORDER.join(" > ")} — fix the config, this never falls back to a default.`);
|
|
6324
|
+
}
|
|
6325
|
+
const maxRounds = raw.maxRounds ?? DEFAULT_REVIEW_POLICY.maxRounds;
|
|
6326
|
+
if (!Number.isInteger(maxRounds) || maxRounds < 1) {
|
|
6327
|
+
throw new Error(`vinaya.config.json: reviewPolicy.maxRounds "${maxRounds}" is not a positive integer — fix the config, this never falls back to a default.`);
|
|
6328
|
+
}
|
|
6329
|
+
return {
|
|
6330
|
+
codeReviewThreshold,
|
|
6331
|
+
securityThreshold,
|
|
6332
|
+
maxRounds
|
|
6333
|
+
};
|
|
6334
|
+
}
|
|
5300
6335
|
function trustAnchorRepo() {
|
|
5301
6336
|
const wellFormed = (slug) => /^[^/\s]+\/[^/\s]+$/.test(slug) ? slug : null;
|
|
5302
6337
|
const fromRunner = process.env.GITHUB_REPOSITORY?.trim();
|
|
@@ -5376,6 +6411,9 @@ function loadConfig() {
|
|
|
5376
6411
|
}
|
|
5377
6412
|
var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
5378
6413
|
|
|
6414
|
+
// src/lib/brief-assembly.ts
|
|
6415
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
6416
|
+
|
|
5379
6417
|
// ../../packages/sources/src/commands.ts
|
|
5380
6418
|
var COMMANDS = [
|
|
5381
6419
|
{
|
|
@@ -5534,6 +6572,27 @@ var COMMANDS = [
|
|
|
5534
6572
|
],
|
|
5535
6573
|
status: "shipped"
|
|
5536
6574
|
},
|
|
6575
|
+
{
|
|
6576
|
+
name: "task status",
|
|
6577
|
+
description: "Every open task with a frozen brief, its pull request, and whether its loop is running, paused, or published",
|
|
6578
|
+
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
|
|
6579
|
+
details: [
|
|
6580
|
+
"Read-only: one `gh issue list` for every open task Issue across every tranche (title/label resolved through the same `resolveTaskIssueRef` `list-tasks.ts` already uses), the open pull request per branch, and the driver pid record / pause record / publish effect markers under `<outboxRoot>/dev-review-loop/<task>/` — never a `ps` scan, never a re-parse of posted verdict comments to decide `published`.",
|
|
6581
|
+
"`running` names the driver's pid (`review-validity-v1` task 7's pid record); `paused` names the reason from the pause record; `published` means the newest round's reviewer and security verdict effect markers both read `posted`; `no driver` is the fallback when none of the above holds.",
|
|
6582
|
+
"`vinaya task status <tranche> <n>` narrows to one task and adds the last round's held or published verdict lines (`round-<n>-reviewer.md`/`round-<n>-security.md`, whichever their outbox carries) plus the exact `vinaya dev-review-loop --resume <pr>` command when paused."
|
|
6583
|
+
],
|
|
6584
|
+
status: "shipped"
|
|
6585
|
+
},
|
|
6586
|
+
{
|
|
6587
|
+
name: "task-tools serve",
|
|
6588
|
+
description: "Run the task-operator MCP tool server over stdio — the command both runtime adapters register",
|
|
6589
|
+
details: [
|
|
6590
|
+
"Exposes the task-operator tool catalog (`packages/aeg-core/src/task-tools.ts`) to an agent runtime as one MCP server speaking newline-delimited JSON-RPC 2.0 (`initialize`/`tools/list`/`tools/call`). Claude registers it through the generated `.mcp.json`; Codex through its documented `~/.codex/config.toml` `[mcp_servers]` table — both point at this same command.",
|
|
6591
|
+
"stdout carries JSON-RPC and nothing else: any stray write from the CLI (a forge-read warning) is redirected to stderr, so the protocol stream is never corrupted.",
|
|
6592
|
+
"`task_status`/`task_escalation_read` read; `task_start` starts a run in attended mode only, requiring an authenticated caller from the invocation context (`VINAYA_MCP_CALLER`) and refusing without one — MCP is a transport, not authorization. `task_resume`/`task_cancel` require the same authenticated caller, plus a current Principal ruling read fresh from the run's own PR — never a caller-supplied approval; `task_resume` triggers the existing `dev-review-loop --resume` continuation exactly once per escalation, and `task_cancel` reports a truthful `confirmed`/`pending`/`uncertain` outcome, idempotently, across repeated calls. No unattended start until the worker-isolation boundary and a capability flag land."
|
|
6593
|
+
],
|
|
6594
|
+
status: "shipped"
|
|
6595
|
+
},
|
|
5537
6596
|
{
|
|
5538
6597
|
name: "pr create",
|
|
5539
6598
|
description: "Open a pull request after full brief-schema validation",
|
|
@@ -5678,6 +6737,30 @@ var COMMANDS = [
|
|
|
5678
6737
|
],
|
|
5679
6738
|
status: "shipped"
|
|
5680
6739
|
},
|
|
6740
|
+
{
|
|
6741
|
+
name: "log export-artifact",
|
|
6742
|
+
description: "Copy this run's own local outbox into a file, for the generated task-path workflow's own upload step",
|
|
6743
|
+
flags: [],
|
|
6744
|
+
details: [
|
|
6745
|
+
"Concatenates every `*.ndjson` file under `~/.vinaya/outbox/` into `<dest>`, verbatim — no filtering, no second redaction pass (lines are already redacted at `log()`'s own write boundary). Writes nothing when the outbox is empty, and exits 0 either way: no gate events this run is a legitimate outcome, never a failure.",
|
|
6746
|
+
"Runs inside the generated `vinaya-checks.yml` job, which holds no forge-write credential — this command never calls the forge. Both this step and the `actions/upload-artifact` step after it run `if: always()`, so a cancelled or failed job still exports whatever partial outbox it has."
|
|
6747
|
+
],
|
|
6748
|
+
status: "shipped"
|
|
6749
|
+
},
|
|
6750
|
+
{
|
|
6751
|
+
name: "log collect-artifact",
|
|
6752
|
+
description: "Validate a downloaded task-log artifact and publish the valid records through the existing flush path",
|
|
6753
|
+
flags: [
|
|
6754
|
+
{ flag: "--pr", description: "The pull request this artifact belongs to" },
|
|
6755
|
+
{ flag: "--repo", description: "Expected `owner/repo` — a provenance cross-check against each record" }
|
|
6756
|
+
],
|
|
6757
|
+
details: [
|
|
6758
|
+
"Runs inside the generated `vinaya-task-log-collector.yml` workflow — a `workflow_run`-triggered job on the default branch, holding the write credential the task-path job that produced the artifact never gets. `<path>` is already downloaded by that workflow, scoped to a specific, API-verified run id — a provenance guarantee this command never re-derives from the artifact bytes.",
|
|
6759
|
+
"Never executes, imports, or evaluates the artifact's content: every line is read as text and validated (schema, an 8 MiB whole-artifact size cap, redaction, and a repo cross-check) before anything is trusted. A rejected line becomes a named gap — printed, never a silent drop — and the artifact is never partially trusted past that check into executing anything.",
|
|
6760
|
+
"The valid, re-redacted survivors are appended into the same local outbox `vinaya log flush` would read for that PR's Issue, then published through the existing `flushOutbox` unmodified — reusing its chunking, its `<!-- aeg:log:… -->` marker, and its idempotent-retry read, rather than a second publisher. A retried collector run (a fresh runner, the same forge state) therefore dedupes for free: the marker already on the forge is acknowledged, never re-posted."
|
|
6761
|
+
],
|
|
6762
|
+
status: "shipped"
|
|
6763
|
+
},
|
|
5681
6764
|
{
|
|
5682
6765
|
name: "milestone create",
|
|
5683
6766
|
description: "Create a GitHub Milestone from a validated body",
|
|
@@ -6043,10 +7126,10 @@ function createForgeSource(config) {
|
|
|
6043
7126
|
};
|
|
6044
7127
|
}
|
|
6045
7128
|
// ../../packages/sources/src/select-source.ts
|
|
6046
|
-
import { z as
|
|
6047
|
-
var StateSourceConfigSchema =
|
|
6048
|
-
|
|
6049
|
-
|
|
7129
|
+
import { z as z5 } from "zod";
|
|
7130
|
+
var StateSourceConfigSchema = z5.discriminatedUnion("kind", [
|
|
7131
|
+
z5.object({ kind: z5.literal("forge"), owner: z5.string(), repo: z5.string() }),
|
|
7132
|
+
z5.object({ kind: z5.literal("file"), root: z5.string().optional() })
|
|
6050
7133
|
]);
|
|
6051
7134
|
// src/checks/edge-resolve.ts
|
|
6052
7135
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
@@ -6166,6 +7249,826 @@ async function resolveEdge(id, taskById, factsByTaskId, repo, resolveSibling = d
|
|
|
6166
7249
|
};
|
|
6167
7250
|
}
|
|
6168
7251
|
|
|
7252
|
+
// src/lib/brief-assembly.ts
|
|
7253
|
+
function git(args) {
|
|
7254
|
+
try {
|
|
7255
|
+
return execFileSync4("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
7256
|
+
} catch {
|
|
7257
|
+
return "";
|
|
7258
|
+
}
|
|
7259
|
+
}
|
|
7260
|
+
function expandGlob(glob) {
|
|
7261
|
+
const out = git(["ls-files", "--", glob]);
|
|
7262
|
+
return out.split(`
|
|
7263
|
+
`).map((s) => s.trim()).filter(Boolean);
|
|
7264
|
+
}
|
|
7265
|
+
var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
7266
|
+
|
|
7267
|
+
// src/checks/registry.ts
|
|
7268
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
7269
|
+
import { join as join3 } from "node:path";
|
|
7270
|
+
|
|
7271
|
+
// src/lib/package-root.ts
|
|
7272
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
7273
|
+
import { dirname as dirname2, join as join2 } from "node:path";
|
|
7274
|
+
import { fileURLToPath } from "node:url";
|
|
7275
|
+
function packageRoot(moduleUrl) {
|
|
7276
|
+
let dir = dirname2(fileURLToPath(moduleUrl));
|
|
7277
|
+
while (!existsSync2(join2(dir, "package.json"))) {
|
|
7278
|
+
if (existsSync2(join2(dir, ".git")))
|
|
7279
|
+
break;
|
|
7280
|
+
const parent = dirname2(dir);
|
|
7281
|
+
if (parent === dir)
|
|
7282
|
+
break;
|
|
7283
|
+
dir = parent;
|
|
7284
|
+
}
|
|
7285
|
+
return dir;
|
|
7286
|
+
}
|
|
7287
|
+
|
|
7288
|
+
// src/checks/registry.ts
|
|
7289
|
+
var DIST_BIN_DIR = join3(packageRoot(import.meta.url), "dist", "checks", "bin");
|
|
7290
|
+
var SRC_BIN_DIR = join3(packageRoot(import.meta.url), "src", "checks", "bin");
|
|
7291
|
+
var BIN_DIR = existsSync3(DIST_BIN_DIR) ? DIST_BIN_DIR : SRC_BIN_DIR;
|
|
7292
|
+
var BIN_EXT = BIN_DIR === DIST_BIN_DIR ? ".js" : ".ts";
|
|
7293
|
+
function bin(name) {
|
|
7294
|
+
return join3(BIN_DIR, `${name}${BIN_EXT}`);
|
|
7295
|
+
}
|
|
7296
|
+
var REGISTRY = [
|
|
7297
|
+
[
|
|
7298
|
+
{
|
|
7299
|
+
name: "brief-shape",
|
|
7300
|
+
validates: "body",
|
|
7301
|
+
run: bin("check-brief-shape"),
|
|
7302
|
+
scope: "diff",
|
|
7303
|
+
timeoutMs: 15000,
|
|
7304
|
+
env: {
|
|
7305
|
+
PR_BODY: { optional: true },
|
|
7306
|
+
BRANCH: { optional: true },
|
|
7307
|
+
PR_NUMBER: { optional: true },
|
|
7308
|
+
GITHUB_TOKEN: { optional: true },
|
|
7309
|
+
GH_TOKEN: { optional: true }
|
|
7310
|
+
}
|
|
7311
|
+
},
|
|
7312
|
+
0
|
|
7313
|
+
],
|
|
7314
|
+
[
|
|
7315
|
+
{
|
|
7316
|
+
name: "pr-report-density",
|
|
7317
|
+
validates: "body",
|
|
7318
|
+
run: bin("check-pr-report-density"),
|
|
7319
|
+
scope: "diff",
|
|
7320
|
+
timeoutMs: 15000,
|
|
7321
|
+
env: {
|
|
7322
|
+
PR_BODY: { optional: true }
|
|
7323
|
+
}
|
|
7324
|
+
},
|
|
7325
|
+
0
|
|
7326
|
+
],
|
|
7327
|
+
[
|
|
7328
|
+
{
|
|
7329
|
+
name: "doc-coverage",
|
|
7330
|
+
validates: "body",
|
|
7331
|
+
run: bin("check-doc-coverage"),
|
|
7332
|
+
scope: "diff",
|
|
7333
|
+
timeoutMs: 15000,
|
|
7334
|
+
env: {
|
|
7335
|
+
BASE_SHA: { optional: true },
|
|
7336
|
+
PR_BODY: { optional: true },
|
|
7337
|
+
PR_BODY_FILE: { optional: true },
|
|
7338
|
+
PR_NUMBER: { optional: true },
|
|
7339
|
+
GITHUB_REPOSITORY: { optional: true },
|
|
7340
|
+
GITHUB_TOKEN: { optional: true },
|
|
7341
|
+
GH_TOKEN: { optional: true }
|
|
7342
|
+
}
|
|
7343
|
+
},
|
|
7344
|
+
0
|
|
7345
|
+
],
|
|
7346
|
+
[
|
|
7347
|
+
{
|
|
7348
|
+
name: "coherence",
|
|
7349
|
+
run: bin("check-coherence"),
|
|
7350
|
+
scope: "full",
|
|
7351
|
+
timeoutMs: 30000,
|
|
7352
|
+
env: {
|
|
7353
|
+
AEG_REPO: { optional: true },
|
|
7354
|
+
BRANCH: { optional: true },
|
|
7355
|
+
GITHUB_TOKEN: { optional: true },
|
|
7356
|
+
GH_TOKEN: { optional: true }
|
|
7357
|
+
}
|
|
7358
|
+
},
|
|
7359
|
+
0
|
|
7360
|
+
],
|
|
7361
|
+
[
|
|
7362
|
+
{
|
|
7363
|
+
name: "pr-premise-reassert",
|
|
7364
|
+
validates: "body",
|
|
7365
|
+
run: bin("check-pr-premise-reassert"),
|
|
7366
|
+
scope: "diff",
|
|
7367
|
+
timeoutMs: 15000,
|
|
7368
|
+
env: {
|
|
7369
|
+
PR_BODY: { optional: true }
|
|
7370
|
+
}
|
|
7371
|
+
},
|
|
7372
|
+
0
|
|
7373
|
+
],
|
|
7374
|
+
[
|
|
7375
|
+
{
|
|
7376
|
+
name: "dispatch-readiness",
|
|
7377
|
+
run: bin("check-dispatch-readiness"),
|
|
7378
|
+
scope: "full",
|
|
7379
|
+
timeoutMs: 30000,
|
|
7380
|
+
env: {
|
|
7381
|
+
AEG_REPO: { optional: true },
|
|
7382
|
+
BRANCH: { optional: true },
|
|
7383
|
+
GITHUB_TOKEN: { optional: true },
|
|
7384
|
+
GH_TOKEN: { optional: true },
|
|
7385
|
+
PREMISE_FILE: { optional: true }
|
|
7386
|
+
}
|
|
7387
|
+
},
|
|
7388
|
+
0
|
|
7389
|
+
],
|
|
7390
|
+
[
|
|
7391
|
+
{
|
|
7392
|
+
name: "closes-n",
|
|
7393
|
+
validates: "body",
|
|
7394
|
+
run: bin("check-closes-n"),
|
|
7395
|
+
scope: "diff",
|
|
7396
|
+
timeoutMs: 15000,
|
|
7397
|
+
requiresOpenPr: true,
|
|
7398
|
+
env: {
|
|
7399
|
+
BRANCH: { optional: true },
|
|
7400
|
+
PR_BODY: { optional: true },
|
|
7401
|
+
AEG_REPO: { optional: true },
|
|
7402
|
+
GITHUB_TOKEN: { optional: true },
|
|
7403
|
+
GH_TOKEN: { optional: true }
|
|
7404
|
+
}
|
|
7405
|
+
},
|
|
7406
|
+
1
|
|
7407
|
+
],
|
|
7408
|
+
[
|
|
7409
|
+
{
|
|
7410
|
+
name: "single-plan-pr",
|
|
7411
|
+
run: bin("check-single-plan-pr"),
|
|
7412
|
+
scope: "diff",
|
|
7413
|
+
timeoutMs: 15000,
|
|
7414
|
+
env: {
|
|
7415
|
+
BASE_SHA: { optional: true },
|
|
7416
|
+
PR_NUMBER: { optional: true },
|
|
7417
|
+
GITHUB_TOKEN: { optional: true },
|
|
7418
|
+
GH_TOKEN: { optional: true }
|
|
7419
|
+
}
|
|
7420
|
+
},
|
|
7421
|
+
0
|
|
7422
|
+
],
|
|
7423
|
+
[
|
|
7424
|
+
{
|
|
7425
|
+
name: "surface-scope",
|
|
7426
|
+
run: bin("check-surface-scope"),
|
|
7427
|
+
scope: "diff",
|
|
7428
|
+
timeoutMs: 15000,
|
|
7429
|
+
env: {
|
|
7430
|
+
AEG_REPO: { optional: true },
|
|
7431
|
+
BASE_SHA: { optional: true },
|
|
7432
|
+
BRANCH: { optional: true },
|
|
7433
|
+
GITHUB_TOKEN: { optional: true },
|
|
7434
|
+
GH_TOKEN: { optional: true }
|
|
7435
|
+
}
|
|
7436
|
+
},
|
|
7437
|
+
0
|
|
7438
|
+
],
|
|
7439
|
+
[
|
|
7440
|
+
{
|
|
7441
|
+
name: "test-plan",
|
|
7442
|
+
validates: "body",
|
|
7443
|
+
run: bin("check-test-plan"),
|
|
7444
|
+
scope: "diff",
|
|
7445
|
+
timeoutMs: 15000,
|
|
7446
|
+
requiresOpenPr: true,
|
|
7447
|
+
principalOwed: true,
|
|
7448
|
+
env: {
|
|
7449
|
+
PR_BODY: { optional: true },
|
|
7450
|
+
BRANCH: { optional: true }
|
|
7451
|
+
}
|
|
7452
|
+
},
|
|
7453
|
+
1
|
|
7454
|
+
],
|
|
7455
|
+
[
|
|
7456
|
+
{
|
|
7457
|
+
name: "body-bare-digits",
|
|
7458
|
+
validates: "body",
|
|
7459
|
+
run: bin("check-body-bare-digits"),
|
|
7460
|
+
scope: "diff",
|
|
7461
|
+
timeoutMs: 15000,
|
|
7462
|
+
requiresOpenPr: true,
|
|
7463
|
+
ownWorkflow: true,
|
|
7464
|
+
env: {
|
|
7465
|
+
PR_BODY: { optional: true },
|
|
7466
|
+
PR_NUMBER: { optional: true },
|
|
7467
|
+
GITHUB_REPOSITORY: { optional: true },
|
|
7468
|
+
GITHUB_TOKEN: { optional: true },
|
|
7469
|
+
GH_TOKEN: { optional: true }
|
|
7470
|
+
}
|
|
7471
|
+
},
|
|
7472
|
+
1
|
|
7473
|
+
],
|
|
7474
|
+
[
|
|
7475
|
+
{
|
|
7476
|
+
name: "token-report",
|
|
7477
|
+
validates: "body",
|
|
7478
|
+
run: bin("check-token-report"),
|
|
7479
|
+
scope: "diff",
|
|
7480
|
+
timeoutMs: 15000,
|
|
7481
|
+
requiresOpenPr: true,
|
|
7482
|
+
env: {
|
|
7483
|
+
PR_BODY: { optional: true },
|
|
7484
|
+
BRANCH: { optional: true },
|
|
7485
|
+
CLAUDE_PROJECT_DIR: { optional: true },
|
|
7486
|
+
CLAUDE_CODE_SESSION_ID: { optional: true }
|
|
7487
|
+
}
|
|
7488
|
+
},
|
|
7489
|
+
1
|
|
7490
|
+
],
|
|
7491
|
+
[
|
|
7492
|
+
{
|
|
7493
|
+
name: "no-disk-state",
|
|
7494
|
+
run: bin("check-no-disk-state"),
|
|
7495
|
+
scope: "diff",
|
|
7496
|
+
timeoutMs: 15000,
|
|
7497
|
+
env: { BASE_SHA: { optional: true } }
|
|
7498
|
+
},
|
|
7499
|
+
0
|
|
7500
|
+
],
|
|
7501
|
+
[
|
|
7502
|
+
{
|
|
7503
|
+
name: "registry-gates",
|
|
7504
|
+
run: bin("check-registry-gates"),
|
|
7505
|
+
scope: "full",
|
|
7506
|
+
timeoutMs: 30000,
|
|
7507
|
+
env: {
|
|
7508
|
+
AEG_REPO: { optional: true },
|
|
7509
|
+
GITHUB_TOKEN: { optional: true },
|
|
7510
|
+
GH_TOKEN: { optional: true }
|
|
7511
|
+
}
|
|
7512
|
+
},
|
|
7513
|
+
0
|
|
7514
|
+
],
|
|
7515
|
+
[
|
|
7516
|
+
{
|
|
7517
|
+
name: "review-gate",
|
|
7518
|
+
run: bin("check-review-gate"),
|
|
7519
|
+
scope: "full",
|
|
7520
|
+
timeoutMs: 30000,
|
|
7521
|
+
ownWorkflow: true,
|
|
7522
|
+
env: {
|
|
7523
|
+
PR_NUMBER: { optional: true },
|
|
7524
|
+
GITHUB_REPOSITORY: { optional: true },
|
|
7525
|
+
GITHUB_TOKEN: { optional: true },
|
|
7526
|
+
GH_TOKEN: { optional: true }
|
|
7527
|
+
}
|
|
7528
|
+
},
|
|
7529
|
+
1
|
|
7530
|
+
],
|
|
7531
|
+
[
|
|
7532
|
+
{
|
|
7533
|
+
name: "branch-topology",
|
|
7534
|
+
run: bin("check-branch-topology"),
|
|
7535
|
+
scope: "full",
|
|
7536
|
+
timeoutMs: 30000,
|
|
7537
|
+
env: {
|
|
7538
|
+
BRANCH: { optional: true },
|
|
7539
|
+
AEG_REPO: { optional: true },
|
|
7540
|
+
GITHUB_TOKEN: { optional: true },
|
|
7541
|
+
GH_TOKEN: { optional: true }
|
|
7542
|
+
}
|
|
7543
|
+
},
|
|
7544
|
+
0
|
|
7545
|
+
],
|
|
7546
|
+
[
|
|
7547
|
+
{
|
|
7548
|
+
name: "dead-branch-push",
|
|
7549
|
+
run: bin("check-dead-branch-push"),
|
|
7550
|
+
scope: "full",
|
|
7551
|
+
timeoutMs: 30000,
|
|
7552
|
+
env: {
|
|
7553
|
+
BRANCH: { optional: true },
|
|
7554
|
+
GITHUB_TOKEN: { optional: true },
|
|
7555
|
+
GH_TOKEN: { optional: true }
|
|
7556
|
+
}
|
|
7557
|
+
},
|
|
7558
|
+
0
|
|
7559
|
+
],
|
|
7560
|
+
[
|
|
7561
|
+
{
|
|
7562
|
+
name: "first-push-dispatch",
|
|
7563
|
+
run: bin("check-first-push-dispatch"),
|
|
7564
|
+
scope: "full",
|
|
7565
|
+
timeoutMs: 30000,
|
|
7566
|
+
env: {
|
|
7567
|
+
BRANCH: { optional: true },
|
|
7568
|
+
AEG_REPO: { optional: true },
|
|
7569
|
+
GITHUB_TOKEN: { optional: true },
|
|
7570
|
+
GH_TOKEN: { optional: true }
|
|
7571
|
+
}
|
|
7572
|
+
},
|
|
7573
|
+
0
|
|
7574
|
+
],
|
|
7575
|
+
[
|
|
7576
|
+
{
|
|
7577
|
+
name: "doc-coverage-push",
|
|
7578
|
+
validates: "body",
|
|
7579
|
+
run: bin("check-doc-coverage-push"),
|
|
7580
|
+
scope: "diff",
|
|
7581
|
+
timeoutMs: 15000,
|
|
7582
|
+
env: {
|
|
7583
|
+
OVERRIDE_DOCS: { optional: true },
|
|
7584
|
+
BASE_SHA: { optional: true },
|
|
7585
|
+
PR_BODY: { optional: true },
|
|
7586
|
+
PR_BODY_FILE: { optional: true },
|
|
7587
|
+
PR_LABELS: { optional: true },
|
|
7588
|
+
WAIVER_LABEL_ACTOR: { optional: true },
|
|
7589
|
+
GITHUB_REPOSITORY: { optional: true },
|
|
7590
|
+
GITHUB_TOKEN: { optional: true },
|
|
7591
|
+
GH_TOKEN: { optional: true }
|
|
7592
|
+
}
|
|
7593
|
+
},
|
|
7594
|
+
0
|
|
7595
|
+
],
|
|
7596
|
+
[
|
|
7597
|
+
{
|
|
7598
|
+
name: "issue-assignment",
|
|
7599
|
+
run: bin("check-issue-assignment"),
|
|
7600
|
+
scope: "full",
|
|
7601
|
+
timeoutMs: 30000,
|
|
7602
|
+
env: {
|
|
7603
|
+
AEG_REPO: { optional: true },
|
|
7604
|
+
BRANCH: { optional: true },
|
|
7605
|
+
GITHUB_TOKEN: { optional: true },
|
|
7606
|
+
GH_TOKEN: { optional: true }
|
|
7607
|
+
}
|
|
7608
|
+
},
|
|
7609
|
+
0
|
|
7610
|
+
],
|
|
7611
|
+
[
|
|
7612
|
+
{
|
|
7613
|
+
name: "evidence-fresh",
|
|
7614
|
+
validates: "body",
|
|
7615
|
+
run: bin("check-evidence-fresh"),
|
|
7616
|
+
scope: "diff",
|
|
7617
|
+
timeoutMs: 15000,
|
|
7618
|
+
requiresOpenPr: true,
|
|
7619
|
+
env: {
|
|
7620
|
+
PR_NUMBER: { optional: true },
|
|
7621
|
+
PR_BODY: { optional: true },
|
|
7622
|
+
BASE_SHA: { optional: true },
|
|
7623
|
+
GITHUB_TOKEN: { optional: true },
|
|
7624
|
+
GH_TOKEN: { optional: true }
|
|
7625
|
+
}
|
|
7626
|
+
},
|
|
7627
|
+
1
|
|
7628
|
+
],
|
|
7629
|
+
[
|
|
7630
|
+
{
|
|
7631
|
+
name: "reader-resolvable-prose",
|
|
7632
|
+
run: bin("check-reader-resolvable-prose"),
|
|
7633
|
+
scope: "full",
|
|
7634
|
+
timeoutMs: 30000,
|
|
7635
|
+
env: {},
|
|
7636
|
+
include: [
|
|
7637
|
+
"aeg-root/**/*.md",
|
|
7638
|
+
"apps/cli/src/**",
|
|
7639
|
+
".github/workflows/**",
|
|
7640
|
+
".vinaya/**",
|
|
7641
|
+
"apps/cli/README.md",
|
|
7642
|
+
"packages/sources/README.md"
|
|
7643
|
+
]
|
|
7644
|
+
},
|
|
7645
|
+
0
|
|
7646
|
+
],
|
|
7647
|
+
[
|
|
7648
|
+
{
|
|
7649
|
+
name: "retired-vocabulary",
|
|
7650
|
+
run: bin("check-retired-vocabulary"),
|
|
7651
|
+
scope: "full",
|
|
7652
|
+
timeoutMs: 30000,
|
|
7653
|
+
env: {},
|
|
7654
|
+
include: ["aeg-root/**/*.md"]
|
|
7655
|
+
},
|
|
7656
|
+
0
|
|
7657
|
+
],
|
|
7658
|
+
[
|
|
7659
|
+
{
|
|
7660
|
+
name: "doctrine-portability",
|
|
7661
|
+
run: bin("check-doctrine-portability"),
|
|
7662
|
+
scope: "full",
|
|
7663
|
+
timeoutMs: 30000,
|
|
7664
|
+
env: { BASE_SHA: { optional: true } },
|
|
7665
|
+
include: ["aeg-root/**/*.md"]
|
|
7666
|
+
},
|
|
7667
|
+
0
|
|
7668
|
+
],
|
|
7669
|
+
[
|
|
7670
|
+
{
|
|
7671
|
+
name: "doctrine-no-procedures",
|
|
7672
|
+
run: bin("check-doctrine-no-procedures"),
|
|
7673
|
+
scope: "full",
|
|
7674
|
+
timeoutMs: 30000,
|
|
7675
|
+
env: {},
|
|
7676
|
+
include: ["aeg-root/**/*.md"]
|
|
7677
|
+
},
|
|
7678
|
+
0
|
|
7679
|
+
],
|
|
7680
|
+
[
|
|
7681
|
+
{
|
|
7682
|
+
name: "exec-bits",
|
|
7683
|
+
run: bin("check-exec-bits"),
|
|
7684
|
+
scope: "diff",
|
|
7685
|
+
timeoutMs: 30000,
|
|
7686
|
+
env: {}
|
|
7687
|
+
},
|
|
7688
|
+
0
|
|
7689
|
+
],
|
|
7690
|
+
[
|
|
7691
|
+
{
|
|
7692
|
+
name: "workspace-escape",
|
|
7693
|
+
run: bin("check-workspace-escape"),
|
|
7694
|
+
scope: "full",
|
|
7695
|
+
timeoutMs: 30000,
|
|
7696
|
+
env: {},
|
|
7697
|
+
include: ["aeg-root/**/*.md"]
|
|
7698
|
+
},
|
|
7699
|
+
0
|
|
7700
|
+
],
|
|
7701
|
+
[
|
|
7702
|
+
{
|
|
7703
|
+
name: "changeset-coverage",
|
|
7704
|
+
run: bin("check-changeset-coverage"),
|
|
7705
|
+
scope: "diff",
|
|
7706
|
+
timeoutMs: 15000,
|
|
7707
|
+
env: {}
|
|
7708
|
+
},
|
|
7709
|
+
0
|
|
7710
|
+
],
|
|
7711
|
+
[
|
|
7712
|
+
{
|
|
7713
|
+
name: "quoted-command",
|
|
7714
|
+
run: bin("check-quoted-command"),
|
|
7715
|
+
scope: "diff",
|
|
7716
|
+
timeoutMs: 15000,
|
|
7717
|
+
env: {}
|
|
7718
|
+
},
|
|
7719
|
+
0
|
|
7720
|
+
],
|
|
7721
|
+
[
|
|
7722
|
+
{
|
|
7723
|
+
name: "main-branch-refusal",
|
|
7724
|
+
run: bin("check-main-branch-refusal"),
|
|
7725
|
+
scope: "full",
|
|
7726
|
+
timeoutMs: 15000,
|
|
7727
|
+
env: { VINAYA_PUSH_REFS: { optional: true } }
|
|
7728
|
+
},
|
|
7729
|
+
0
|
|
7730
|
+
],
|
|
7731
|
+
[
|
|
7732
|
+
{
|
|
7733
|
+
name: "token-collection-wired",
|
|
7734
|
+
run: bin("check-token-collection-wired"),
|
|
7735
|
+
scope: "full",
|
|
7736
|
+
timeoutMs: 15000,
|
|
7737
|
+
env: {
|
|
7738
|
+
CLAUDE_PROJECT_DIR: { optional: true },
|
|
7739
|
+
CLAUDE_CODE_SESSION_ID: { optional: true }
|
|
7740
|
+
}
|
|
7741
|
+
},
|
|
7742
|
+
0
|
|
7743
|
+
],
|
|
7744
|
+
[
|
|
7745
|
+
{
|
|
7746
|
+
name: "issue-title-grammar",
|
|
7747
|
+
run: bin("check-issue-title-grammar"),
|
|
7748
|
+
validates: "issue",
|
|
7749
|
+
scope: "full",
|
|
7750
|
+
ownWorkflow: true,
|
|
7751
|
+
timeoutMs: 15000,
|
|
7752
|
+
env: { ISSUE_TITLE: { optional: true } }
|
|
7753
|
+
},
|
|
7754
|
+
1
|
|
7755
|
+
],
|
|
7756
|
+
[
|
|
7757
|
+
{
|
|
7758
|
+
name: "issue-objectives-numbering",
|
|
7759
|
+
run: bin("check-issue-objectives-numbering"),
|
|
7760
|
+
validates: "issue",
|
|
7761
|
+
scope: "full",
|
|
7762
|
+
ownWorkflow: true,
|
|
7763
|
+
timeoutMs: 15000,
|
|
7764
|
+
env: { ISSUE_BODY: { optional: true }, ISSUE_NUMBER: { optional: true } }
|
|
7765
|
+
},
|
|
7766
|
+
1
|
|
7767
|
+
],
|
|
7768
|
+
[
|
|
7769
|
+
{
|
|
7770
|
+
name: "issue-parts-coverage",
|
|
7771
|
+
run: bin("check-issue-parts-coverage"),
|
|
7772
|
+
validates: "issue",
|
|
7773
|
+
scope: "full",
|
|
7774
|
+
ownWorkflow: true,
|
|
7775
|
+
timeoutMs: 15000,
|
|
7776
|
+
env: { ISSUE_BODY: { optional: true } }
|
|
7777
|
+
},
|
|
7778
|
+
1
|
|
7779
|
+
],
|
|
7780
|
+
[
|
|
7781
|
+
{
|
|
7782
|
+
name: "issue-surface-globs",
|
|
7783
|
+
run: bin("check-issue-surface-globs"),
|
|
7784
|
+
validates: "issue",
|
|
7785
|
+
scope: "full",
|
|
7786
|
+
ownWorkflow: true,
|
|
7787
|
+
timeoutMs: 15000,
|
|
7788
|
+
env: { ISSUE_BODY: { optional: true } }
|
|
7789
|
+
},
|
|
7790
|
+
1
|
|
7791
|
+
],
|
|
7792
|
+
[
|
|
7793
|
+
{
|
|
7794
|
+
name: "issue-tranche-label",
|
|
7795
|
+
run: bin("check-issue-tranche-label"),
|
|
7796
|
+
validates: "issue",
|
|
7797
|
+
scope: "full",
|
|
7798
|
+
ownWorkflow: true,
|
|
7799
|
+
timeoutMs: 15000,
|
|
7800
|
+
env: { ISSUE_BODY: { optional: true }, ISSUE_LABELS: { optional: true } }
|
|
7801
|
+
},
|
|
7802
|
+
1
|
|
7803
|
+
],
|
|
7804
|
+
[
|
|
7805
|
+
{
|
|
7806
|
+
name: "issue-milestone-attach",
|
|
7807
|
+
run: bin("check-issue-milestone-attach"),
|
|
7808
|
+
validates: "issue",
|
|
7809
|
+
scope: "full",
|
|
7810
|
+
ownWorkflow: true,
|
|
7811
|
+
timeoutMs: 15000,
|
|
7812
|
+
env: {
|
|
7813
|
+
ISSUE_LABELS: { optional: true },
|
|
7814
|
+
CURRENT_MILESTONE_TITLE: { optional: true },
|
|
7815
|
+
RESOLVED_MILESTONE_TITLE: { optional: true }
|
|
7816
|
+
}
|
|
7817
|
+
},
|
|
7818
|
+
1
|
|
7819
|
+
]
|
|
7820
|
+
];
|
|
7821
|
+
function coreCheckRegistry() {
|
|
7822
|
+
return REGISTRY.map(([spec]) => spec);
|
|
7823
|
+
}
|
|
7824
|
+
var CORE_CHECK_RING = Object.fromEntries(REGISTRY.map(([spec, ring]) => [spec.name, ring]));
|
|
7825
|
+
|
|
7826
|
+
// src/lib/log-sink.ts
|
|
7827
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
7828
|
+
import { randomUUID } from "node:crypto";
|
|
7829
|
+
import {
|
|
7830
|
+
closeSync as closeSync2,
|
|
7831
|
+
constants as fsConstants2,
|
|
7832
|
+
existsSync as existsSync4,
|
|
7833
|
+
fstatSync as fstatSync2,
|
|
7834
|
+
mkdirSync as mkdirSync2,
|
|
7835
|
+
openSync as openSync2,
|
|
7836
|
+
readFileSync as readFileSync3,
|
|
7837
|
+
renameSync,
|
|
7838
|
+
writeSync
|
|
7839
|
+
} from "node:fs";
|
|
7840
|
+
import { hostname as osHostname, homedir as homedir2 } from "node:os";
|
|
7841
|
+
import { dirname as dirname3, join as join4 } from "node:path";
|
|
7842
|
+
var OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
|
|
7843
|
+
function isEnoent(err) {
|
|
7844
|
+
return typeof err === "object" && err !== null && err.code === "ENOENT";
|
|
7845
|
+
}
|
|
7846
|
+
function resolveDoctrine(cwd, vinayaVersion) {
|
|
7847
|
+
let toplevel;
|
|
7848
|
+
try {
|
|
7849
|
+
toplevel = execFileSync5("git", ["-C", cwd, "rev-parse", "--show-toplevel"], {
|
|
7850
|
+
encoding: "utf8",
|
|
7851
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
7852
|
+
}).trim();
|
|
7853
|
+
} catch (err) {
|
|
7854
|
+
return isEnoent(err) ? "unknown" : vinayaVersion;
|
|
7855
|
+
}
|
|
7856
|
+
if (!existsSync4(join4(toplevel, "aeg-root", "roles")))
|
|
7857
|
+
return vinayaVersion;
|
|
7858
|
+
try {
|
|
7859
|
+
const sha = execFileSync5("git", ["-C", toplevel, "rev-parse", "HEAD:aeg-root"], {
|
|
7860
|
+
encoding: "utf8",
|
|
7861
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
7862
|
+
}).trim();
|
|
7863
|
+
return `aeg-root@${sha}`;
|
|
7864
|
+
} catch {
|
|
7865
|
+
return vinayaVersion;
|
|
7866
|
+
}
|
|
7867
|
+
}
|
|
7868
|
+
function readVinayaVersion() {
|
|
7869
|
+
try {
|
|
7870
|
+
const pkg = JSON.parse(readFileSync3(join4(packageRoot(import.meta.url), "package.json"), "utf8"));
|
|
7871
|
+
return pkg.version ?? "unknown";
|
|
7872
|
+
} catch {
|
|
7873
|
+
return "unknown";
|
|
7874
|
+
}
|
|
7875
|
+
}
|
|
7876
|
+
var SAFE_PATH_SEGMENT = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
|
|
7877
|
+
function isSafeRepoSegment(segment) {
|
|
7878
|
+
return SAFE_PATH_SEGMENT.test(segment) && !segment.includes("..");
|
|
7879
|
+
}
|
|
7880
|
+
function outboxPathFor(deps, repo, issue) {
|
|
7881
|
+
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
7882
|
+
const fileName = `${issue ?? "none"}.ndjson`;
|
|
7883
|
+
return join4(deps.outboxRoot(), dirName, fileName);
|
|
7884
|
+
}
|
|
7885
|
+
function hostFromEnv(env) {
|
|
7886
|
+
if (env.GITHUB_ACTIONS)
|
|
7887
|
+
return "ci";
|
|
7888
|
+
if (env.VINAYA_HOST === "hook")
|
|
7889
|
+
return "hook";
|
|
7890
|
+
if (env.VINAYA_HOST === "loop")
|
|
7891
|
+
return "loop";
|
|
7892
|
+
return "cli";
|
|
7893
|
+
}
|
|
7894
|
+
function defaultDeps() {
|
|
7895
|
+
return {
|
|
7896
|
+
outboxRoot: () => join4(GLOBAL_VINAYA_HOME, "outbox"),
|
|
7897
|
+
home: () => homedir2(),
|
|
7898
|
+
hostname: () => osHostname(),
|
|
7899
|
+
cwd: () => process.cwd(),
|
|
7900
|
+
now: () => new Date,
|
|
7901
|
+
env: () => process.env,
|
|
7902
|
+
resolveRepo: () => resolveRepo(),
|
|
7903
|
+
vinayaVersion: () => readVinayaVersion(),
|
|
7904
|
+
stderr: (message) => {
|
|
7905
|
+
process.stderr.write(message);
|
|
7906
|
+
},
|
|
7907
|
+
inputVersions: () => {
|
|
7908
|
+
return;
|
|
7909
|
+
}
|
|
7910
|
+
};
|
|
7911
|
+
}
|
|
7912
|
+
var APPEND_OPEN_FLAGS = fsConstants2.O_WRONLY | fsConstants2.O_APPEND | fsConstants2.O_CREAT | fsConstants2.O_NOFOLLOW | fsConstants2.O_NONBLOCK;
|
|
7913
|
+
function guardedAppendOpen(path) {
|
|
7914
|
+
try {
|
|
7915
|
+
return openSync2(path, APPEND_OPEN_FLAGS, 384);
|
|
7916
|
+
} catch {
|
|
7917
|
+
return;
|
|
7918
|
+
}
|
|
7919
|
+
}
|
|
7920
|
+
function reportRotationOverflow(backupPath, warn) {
|
|
7921
|
+
let raw;
|
|
7922
|
+
try {
|
|
7923
|
+
raw = readFileSync3(backupPath, "utf8");
|
|
7924
|
+
} catch {
|
|
7925
|
+
return;
|
|
7926
|
+
}
|
|
7927
|
+
const lines = raw.split(`
|
|
7928
|
+
`).filter((l) => l.length > 0);
|
|
7929
|
+
if (lines.length === 0)
|
|
7930
|
+
return;
|
|
7931
|
+
const droppedIdentities = lines.map((line, i) => {
|
|
7932
|
+
try {
|
|
7933
|
+
return recordIdentity(JSON.parse(line)) ?? `unreadable:${i}`;
|
|
7934
|
+
} catch {
|
|
7935
|
+
return `unreadable:${i}`;
|
|
7936
|
+
}
|
|
7937
|
+
});
|
|
7938
|
+
const diagnostic = { reason: "capacity", dropped: droppedIdentities.length, droppedIdentities };
|
|
7939
|
+
const shown = diagnostic.droppedIdentities.slice(0, 20);
|
|
7940
|
+
const more = diagnostic.dropped > shown.length ? `, +${diagnostic.dropped - shown.length} more` : "";
|
|
7941
|
+
warn(`vinaya: log outbox rotation is overwriting ${backupPath} — ${diagnostic.dropped} record(s) permanently lost: ${shown.join(", ")}${more}
|
|
7942
|
+
`);
|
|
7943
|
+
}
|
|
7944
|
+
function appendLine(path, line, warn) {
|
|
7945
|
+
try {
|
|
7946
|
+
mkdirSync2(dirname3(path), { recursive: true, mode: 448 });
|
|
7947
|
+
let fd = guardedAppendOpen(path);
|
|
7948
|
+
if (fd === undefined) {
|
|
7949
|
+
warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
|
|
7950
|
+
`);
|
|
7951
|
+
return;
|
|
7952
|
+
}
|
|
7953
|
+
let closed = false;
|
|
7954
|
+
try {
|
|
7955
|
+
const stat = fstatSync2(fd);
|
|
7956
|
+
if (!stat.isFile()) {
|
|
7957
|
+
warn(`vinaya: log outbox target is not a regular file — refusing to write: ${path}
|
|
7958
|
+
`);
|
|
7959
|
+
return;
|
|
7960
|
+
}
|
|
7961
|
+
if (stat.size > OUTBOX_MAX_BYTES) {
|
|
7962
|
+
closeSync2(fd);
|
|
7963
|
+
closed = true;
|
|
7964
|
+
const backupPath = path.replace(/\.ndjson$/, ".1.ndjson");
|
|
7965
|
+
reportRotationOverflow(backupPath, warn);
|
|
7966
|
+
renameSync(path, backupPath);
|
|
7967
|
+
const rotated = guardedAppendOpen(path);
|
|
7968
|
+
if (rotated === undefined) {
|
|
7969
|
+
warn(`vinaya: log outbox target could not be reopened after rotation — refusing: ${path}
|
|
7970
|
+
`);
|
|
7971
|
+
return;
|
|
7972
|
+
}
|
|
7973
|
+
fd = rotated;
|
|
7974
|
+
closed = false;
|
|
7975
|
+
}
|
|
7976
|
+
writeSync(fd, line);
|
|
7977
|
+
} finally {
|
|
7978
|
+
if (!closed)
|
|
7979
|
+
closeSync2(fd);
|
|
7980
|
+
}
|
|
7981
|
+
} catch (err) {
|
|
7982
|
+
warn(`vinaya: log outbox write failed — ${err instanceof Error ? err.message : String(err)}
|
|
7983
|
+
`);
|
|
7984
|
+
}
|
|
7985
|
+
}
|
|
7986
|
+
function createLogSink(overrides = {}) {
|
|
7987
|
+
const deps = { ...defaultDeps(), ...overrides };
|
|
7988
|
+
const runId = deps.env().VINAYA_RUN_ID || randomUUID();
|
|
7989
|
+
const processId = randomUUID();
|
|
7990
|
+
let seq = 0;
|
|
7991
|
+
let warned = false;
|
|
7992
|
+
const warnOnce = (message) => {
|
|
7993
|
+
if (warned)
|
|
7994
|
+
return;
|
|
7995
|
+
warned = true;
|
|
7996
|
+
try {
|
|
7997
|
+
deps.stderr(message);
|
|
7998
|
+
} catch {}
|
|
7999
|
+
};
|
|
8000
|
+
let doctrineCache;
|
|
8001
|
+
const doctrine = () => {
|
|
8002
|
+
if (doctrineCache === undefined)
|
|
8003
|
+
doctrineCache = resolveDoctrine(deps.cwd(), deps.vinayaVersion());
|
|
8004
|
+
return doctrineCache;
|
|
8005
|
+
};
|
|
8006
|
+
let resolveRepoCache;
|
|
8007
|
+
const resolveRepoOnce = () => {
|
|
8008
|
+
if (resolveRepoCache === undefined)
|
|
8009
|
+
resolveRepoCache = deps.resolveRepo();
|
|
8010
|
+
return resolveRepoCache;
|
|
8011
|
+
};
|
|
8012
|
+
function log(e) {
|
|
8013
|
+
try {
|
|
8014
|
+
const env = deps.env();
|
|
8015
|
+
const host = hostFromEnv(env);
|
|
8016
|
+
const now = deps.now();
|
|
8017
|
+
const mySeq = seq++;
|
|
8018
|
+
resolveRepoOnce().then((resolved) => {
|
|
8019
|
+
const repo = resolved && isSafeRepoSegment(resolved.owner) && isSafeRepoSegment(resolved.repo) ? resolved : null;
|
|
8020
|
+
const header = buildHeader({
|
|
8021
|
+
now,
|
|
8022
|
+
runId,
|
|
8023
|
+
seq: mySeq,
|
|
8024
|
+
repo: repo ? `${repo.owner}/${repo.repo}` : null,
|
|
8025
|
+
vinaya: deps.vinayaVersion(),
|
|
8026
|
+
doctrine: doctrine(),
|
|
8027
|
+
host,
|
|
8028
|
+
hostname: deps.hostname(),
|
|
8029
|
+
env: {
|
|
8030
|
+
role: env.VINAYA_ROLE,
|
|
8031
|
+
task: env.VINAYA_TASK,
|
|
8032
|
+
round: env.VINAYA_ROUND,
|
|
8033
|
+
run: env.VINAYA_RUN,
|
|
8034
|
+
attempt: env.VINAYA_ATTEMPT,
|
|
8035
|
+
parent: env.VINAYA_PARENT_EVENT
|
|
8036
|
+
},
|
|
8037
|
+
eventId: randomUUID(),
|
|
8038
|
+
processId,
|
|
8039
|
+
inputVersions: deps.inputVersions()
|
|
8040
|
+
});
|
|
8041
|
+
const full = { ...e, ...header };
|
|
8042
|
+
const parsed = LogEventSchema.safeParse(full);
|
|
8043
|
+
if (!parsed.success) {
|
|
8044
|
+
warnOnce(`vinaya: log() refused an invalid payload — ${parsed.error.issues[0]?.message ?? "schema violation"}
|
|
8045
|
+
`);
|
|
8046
|
+
return;
|
|
8047
|
+
}
|
|
8048
|
+
const line = `${JSON.stringify(redact(parsed.data, deps.home()))}
|
|
8049
|
+
`;
|
|
8050
|
+
appendLine(outboxPathFor(deps, repo, header.subject.issue), line, warnOnce);
|
|
8051
|
+
}).catch((err) => {
|
|
8052
|
+
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
8053
|
+
`);
|
|
8054
|
+
});
|
|
8055
|
+
} catch (err) {
|
|
8056
|
+
warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
|
|
8057
|
+
`);
|
|
8058
|
+
}
|
|
8059
|
+
}
|
|
8060
|
+
const warmup = () => {
|
|
8061
|
+
doctrine();
|
|
8062
|
+
const originalWarn = console.warn;
|
|
8063
|
+
console.warn = () => {};
|
|
8064
|
+
resolveRepoOnce().finally(() => {
|
|
8065
|
+
console.warn = originalWarn;
|
|
8066
|
+
});
|
|
8067
|
+
};
|
|
8068
|
+
return { log, runId, warmup };
|
|
8069
|
+
}
|
|
8070
|
+
var defaultSink = createLogSink();
|
|
8071
|
+
|
|
6169
8072
|
// src/checks/contract.ts
|
|
6170
8073
|
var CHECK_SCHEMA_VERSION = 1;
|
|
6171
8074
|
function emitCheckError(error) {
|
|
@@ -6173,6 +8076,15 @@ function emitCheckError(error) {
|
|
|
6173
8076
|
`);
|
|
6174
8077
|
}
|
|
6175
8078
|
|
|
8079
|
+
// src/checks/runner.ts
|
|
8080
|
+
var activeChecks = new Map;
|
|
8081
|
+
|
|
8082
|
+
// src/lib/forge-write.ts
|
|
8083
|
+
var INFORMATIONAL_DISPATCH_BLOCKER_CLASSES = new Set([
|
|
8084
|
+
"depends-on-not-merged",
|
|
8085
|
+
"conflicts-with"
|
|
8086
|
+
]);
|
|
8087
|
+
|
|
6176
8088
|
// src/commands/review-post.ts
|
|
6177
8089
|
function parseChangedLineRanges(diffOutput) {
|
|
6178
8090
|
const result = {};
|
|
@@ -6204,7 +8116,7 @@ function parseChangedLineRanges(diffOutput) {
|
|
|
6204
8116
|
function fileDiffAgainst(ref, path) {
|
|
6205
8117
|
let out;
|
|
6206
8118
|
try {
|
|
6207
|
-
out =
|
|
8119
|
+
out = execFileSync6("git", ["diff", `${ref}...HEAD`, "--", path], {
|
|
6208
8120
|
encoding: "utf8",
|
|
6209
8121
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6210
8122
|
}).trim();
|
|
@@ -6215,7 +8127,7 @@ function fileDiffAgainst(ref, path) {
|
|
|
6215
8127
|
}
|
|
6216
8128
|
function revParse(ref) {
|
|
6217
8129
|
try {
|
|
6218
|
-
return
|
|
8130
|
+
return execFileSync6("git", ["rev-parse", "--verify", ref], {
|
|
6219
8131
|
encoding: "utf8",
|
|
6220
8132
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6221
8133
|
}).trim();
|
|
@@ -6225,7 +8137,7 @@ function revParse(ref) {
|
|
|
6225
8137
|
}
|
|
6226
8138
|
function repoRoot() {
|
|
6227
8139
|
try {
|
|
6228
|
-
return
|
|
8140
|
+
return execFileSync6("git", ["rev-parse", "--show-toplevel"], {
|
|
6229
8141
|
encoding: "utf8",
|
|
6230
8142
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6231
8143
|
}).trim();
|
|
@@ -6236,7 +8148,7 @@ function repoRoot() {
|
|
|
6236
8148
|
function changedFiles(base) {
|
|
6237
8149
|
let out;
|
|
6238
8150
|
try {
|
|
6239
|
-
out =
|
|
8151
|
+
out = execFileSync6("git", ["diff", "--name-only", `${base}...HEAD`], {
|
|
6240
8152
|
encoding: "utf8",
|
|
6241
8153
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6242
8154
|
}).trim();
|
|
@@ -6261,7 +8173,7 @@ function resolveDiff(base = process.env.BASE_SHA || "origin/main") {
|
|
|
6261
8173
|
const relPaths = changedFiles(ref);
|
|
6262
8174
|
if (relPaths === null)
|
|
6263
8175
|
continue;
|
|
6264
|
-
return { base: ref, root, files: relPaths.map((p) =>
|
|
8176
|
+
return { base: ref, root, files: relPaths.map((p) => join5(root, p)) };
|
|
6265
8177
|
}
|
|
6266
8178
|
return null;
|
|
6267
8179
|
}
|
|
@@ -6310,7 +8222,7 @@ function collectAllPaths(dir, out = []) {
|
|
|
6310
8222
|
for (const name of entries) {
|
|
6311
8223
|
if (EXCLUDED_DIRS.has(name))
|
|
6312
8224
|
continue;
|
|
6313
|
-
const full =
|
|
8225
|
+
const full = join6(dir, name);
|
|
6314
8226
|
let isDir;
|
|
6315
8227
|
try {
|
|
6316
8228
|
isDir = statSync(full).isDirectory();
|
|
@@ -6326,7 +8238,7 @@ function collectAllPaths(dir, out = []) {
|
|
|
6326
8238
|
function main() {
|
|
6327
8239
|
const allPaths = WORKSPACE_DIRS.flatMap((d) => collectAllPaths(d)).map((p) => p.split("\\").join("/"));
|
|
6328
8240
|
const knownPaths = new Set(allPaths);
|
|
6329
|
-
const sourceFiles = allPaths.filter((p) => SOURCE_EXTENSIONS.some((ext) => p.endsWith(ext))).filter((p) => !isTestFile(p)).map((p) => ({ path: p, content:
|
|
8241
|
+
const sourceFiles = allPaths.filter((p) => SOURCE_EXTENSIONS.some((ext) => p.endsWith(ext))).filter((p) => !isTestFile(p)).map((p) => ({ path: p, content: readFileSync4(p, "utf8") }));
|
|
6330
8242
|
const findings = findWorkspaceEscapes(sourceFiles, knownPaths, WORKSPACE_DIRS);
|
|
6331
8243
|
const reportable = findingsInThisDiff(findings);
|
|
6332
8244
|
console.log(`${CHECK_NAME}: ${sourceFiles.length} source file(s) scanned under ${WORKSPACE_DIRS.join("/")}; ${findings.length} finding(s), ${reportable.length} in this diff`);
|