@attalabs/vinaya 0.20.1 → 0.22.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 +76 -1
- package/aeg-root/enforcement.md +15 -7
- package/aeg-root/milestone-model.md +3 -1
- package/aeg-root/roles/architect.md +2 -2
- package/aeg-root/roles/archivist.md +2 -2
- package/aeg-root/roles/developer.md +3 -2
- package/aeg-root/roles/planner.md +2 -2
- package/aeg-root/roles/principal.md +1 -0
- package/aeg-root/roles/tranche-archivist.md +2 -2
- package/aeg-root/templates/issue-rationale-template.md +4 -4
- package/aeg-root/templates/pr-report-template.md +2 -0
- package/aeg-root/tranche-model.md +4 -4
- package/dist/checks/bin/check-body-bare-digits.js +392 -10
- package/dist/checks/bin/check-branch-topology.js +382 -2
- package/dist/checks/bin/check-brief-shape.js +357 -2
- package/dist/checks/bin/check-changeset-coverage.js +4262 -0
- package/dist/checks/bin/check-closes-n.js +382 -2
- package/dist/checks/bin/check-coherence.js +416 -8
- package/dist/checks/bin/check-dead-branch-push.js +357 -2
- package/dist/checks/bin/check-dispatch-readiness.js +492 -25
- package/dist/checks/bin/check-doc-coverage-push.js +392 -9
- package/dist/checks/bin/check-doc-coverage.js +392 -9
- package/dist/checks/bin/check-doctrine-portability.js +391 -8
- package/dist/checks/bin/check-evidence-fresh.js +357 -2
- package/dist/checks/bin/check-first-push-dispatch.js +481 -17
- package/dist/checks/bin/check-issue-assignment.js +382 -2
- package/dist/checks/bin/check-main-branch-refusal.js +357 -2
- package/dist/checks/bin/check-no-disk-state.js +357 -2
- package/dist/checks/bin/check-quoted-command.js +4514 -0
- package/dist/checks/bin/check-reader-resolvable-prose.js +430 -21
- package/dist/checks/bin/check-registry-gates.js +410 -7
- package/dist/checks/bin/check-retired-vocabulary.js +422 -13
- package/dist/checks/bin/check-review-gate.js +389 -6
- package/dist/checks/bin/check-single-plan-pr.js +357 -2
- package/dist/checks/bin/check-test-plan.js +357 -2
- package/dist/checks/bin/check-token-collection-wired.js +4081 -0
- package/dist/checks/bin/check-token-report.js +4096 -0
- package/dist/checks/bin/check-workspace-escape.js +359 -4
- package/dist/index.js +1607 -641
- package/package.json +1 -1
- 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.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 +2 -2
- 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/api/coherence/route.js.nft.json +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 +2 -2
- 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 +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +2 -2
- 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/[root-of-the-server]__02a-3g8._.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]__0053k9k._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0112h-k._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__02c71kv._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__040smoa._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__16cuydh._.js → [root-of-the-server]__069-_41._.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0cxtq46._.js +25 -18
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0o771t1._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0puovz5._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0ykun-j._.js → [root-of-the-server]__0z6dav-._.js} +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__18kqy4q._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__19jyp3m._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1hs0dcu._.js +1 -1
- 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/[root-of-the-server]__1widio3._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1yoa8tx._.js +3 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_03x_w6q._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0gvm3og._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0lwxg63._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0o54suy._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0wxycau._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0x999pb._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-6rzip._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1fqw88f._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_0zys35s._.js → _1mqrlbl._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_1c9b9j-._.js → _1mrtj0f._.js} +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1n0cnq-._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{apps_vinaya-studio_web_src_app_studio_18kqbvs._.js → apps_vinaya-studio_web_src_app_studio_06it6s-._.js} +2 -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 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_1vo08dj._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_animate_components_index_ts_186fje1._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_brutal_components_index_ts_0n_lcc4._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_0wvpm_z._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_1_cfi48._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/00pi8vhg8w6gi.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/03q0q9n6-xah8.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vc2u252q5q6o.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/13g16cu00g570.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1lk7h-0buf4ab.js → 1hufpuody6vjv.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1sfxfunirkcr6.js +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{29-foak16tjfu.js → 206ajg8f1a-_h.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{0ea8-8nopz29h.js → 267o-tsrnuwnv.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{0msr2a1i-x-br.js → 279qq4twinc97.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{112g08xpx3kro.js → 2ka8dg687auhj.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{0up5x3jg-cwov.js → 2rn89uwtf2lwc.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2twnwe77d4n-m.js → 37hnluhzj9bei.js} +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3qc67qhcvbg0o.css +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{30ojnsx3p4lp4.js → 3zugx9esh2x51.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1rku4gz._.js +0 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0_jnwbarv-cqk.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0la0hhmjprdxm.css +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/25j-y57ng11hl.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/30lyvn0yzwdiz.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/35u8inxa732is.js +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3r5efmleneaco.js +0 -1
- /package/studio-standalone/_node_modules/@attalabs/{aeg-core → vinaya/studio-standalone/_node_modules/@attalabs/aeg-core}/bin/verify-coherence.ts +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{b2VfZK2AItZwlghK_pUN0 → Fmyc42qzLwFcWWHLLNy-G}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{b2VfZK2AItZwlghK_pUN0 → Fmyc42qzLwFcWWHLLNy-G}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{b2VfZK2AItZwlghK_pUN0 → Fmyc42qzLwFcWWHLLNy-G}/_ssgManifest.js +0 -0
|
@@ -218,6 +218,12 @@ var NEXT_HEADER = /\*\*[A-Z][^*]*\*\*/;
|
|
|
218
218
|
var FIELD_LABEL = /^(Depends-on|Conflicts-with)\s*:\s*(.*)$/i;
|
|
219
219
|
var ID_TOKEN = /^(?:[\w.-]+\s+)?#?\d+[a-z]?$/i;
|
|
220
220
|
var SLUG_QUALIFIED_ID = /^([\w.-]+)\s+(#?\d+[a-z]?)$/i;
|
|
221
|
+
function splitSlugQualifiedEdge(edge) {
|
|
222
|
+
const m = edge.trim().match(SLUG_QUALIFIED_ID);
|
|
223
|
+
if (!m)
|
|
224
|
+
return null;
|
|
225
|
+
return { slug: m[1], bareId: m[2] };
|
|
226
|
+
}
|
|
221
227
|
function isEmptyMarker(s) {
|
|
222
228
|
const t = s.trim();
|
|
223
229
|
return t === "" || t === "—" || t === "-" || t === "–";
|
|
@@ -1814,6 +1820,257 @@ var DERIVED_STATUSES = [
|
|
|
1814
1820
|
"incoherent"
|
|
1815
1821
|
];
|
|
1816
1822
|
var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
|
|
1823
|
+
// ../../packages/aeg-core/src/parse-ledger.ts
|
|
1824
|
+
function rowFromCells(cells) {
|
|
1825
|
+
if (cells.length < 7)
|
|
1826
|
+
return null;
|
|
1827
|
+
const phase = (cells[0] ?? "").trim();
|
|
1828
|
+
if (!phase)
|
|
1829
|
+
return null;
|
|
1830
|
+
return {
|
|
1831
|
+
phase,
|
|
1832
|
+
role: (cells[1] ?? "").trim(),
|
|
1833
|
+
agentModel: (cells[2] ?? "").trim(),
|
|
1834
|
+
tokensIn: parseIntCell(cells[3] ?? ""),
|
|
1835
|
+
tokensOut: parseIntCell(cells[4] ?? ""),
|
|
1836
|
+
cost: parseCostCell(cells[5] ?? ""),
|
|
1837
|
+
date: (cells[6] ?? "").trim()
|
|
1838
|
+
};
|
|
1839
|
+
}
|
|
1840
|
+
function parseIntCell(cell) {
|
|
1841
|
+
const trimmed = cell.replace(/`/g, "").trim();
|
|
1842
|
+
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1843
|
+
return null;
|
|
1844
|
+
const normalized = trimmed.replace(/[,_\s]/g, "");
|
|
1845
|
+
if (!/^-?\d+$/.test(normalized))
|
|
1846
|
+
return null;
|
|
1847
|
+
return Number(normalized);
|
|
1848
|
+
}
|
|
1849
|
+
function parseCostCell(cell) {
|
|
1850
|
+
const trimmed = cell.replace(/`/g, "").trim();
|
|
1851
|
+
if (!trimmed || isEmDashOrDash(trimmed))
|
|
1852
|
+
return null;
|
|
1853
|
+
const normalized = trimmed.replace(/^\$/, "").replace(/[,_\s]/g, "");
|
|
1854
|
+
if (!/^-?\d+(\.\d+)?$/.test(normalized))
|
|
1855
|
+
return null;
|
|
1856
|
+
return Number(normalized);
|
|
1857
|
+
}
|
|
1858
|
+
function isEmDashOrDash(s) {
|
|
1859
|
+
const t = s.trim();
|
|
1860
|
+
return t === "—" || t === "-" || t === "–";
|
|
1861
|
+
}
|
|
1862
|
+
// ../../packages/aeg-core/src/parse-token-report.ts
|
|
1863
|
+
var TOKEN_REPORT_HEADING = /^\s*(?:#{1,6}\s*Token report\s*|\*\*Token report\*\*)\s*$/i;
|
|
1864
|
+
var INLINE_FIELD_LIST = /Phase:\s*([^|]+?)\s*\|\s*Role:\s*([^|]+?)\s*\|\s*Agent\/Model:\s*([^|]+?)\s*\|\s*Tokens in:\s*([^|]+?)\s*\|\s*Tokens out:\s*([^|]+?)\s*\|\s*Cost:\s*([^|]+?)\s*\|\s*Date:\s*(.+?)\s*$/im;
|
|
1865
|
+
function parseTokenReportEntries(body) {
|
|
1866
|
+
const lines = body.split(/\r?\n/);
|
|
1867
|
+
const headingIdxs = [];
|
|
1868
|
+
lines.forEach((line, i) => {
|
|
1869
|
+
if (TOKEN_REPORT_HEADING.test(line))
|
|
1870
|
+
headingIdxs.push(i);
|
|
1871
|
+
});
|
|
1872
|
+
const out = [];
|
|
1873
|
+
for (let h = 0;h < headingIdxs.length; h++) {
|
|
1874
|
+
const start = headingIdxs[h] + 1;
|
|
1875
|
+
const end = h + 1 < headingIdxs.length ? headingIdxs[h + 1] : lines.length;
|
|
1876
|
+
const section = lines.slice(start, end).join(`
|
|
1877
|
+
`);
|
|
1878
|
+
const tableRows = parseTableSection(section);
|
|
1879
|
+
if (tableRows.length > 0) {
|
|
1880
|
+
out.push(...tableRows);
|
|
1881
|
+
continue;
|
|
1882
|
+
}
|
|
1883
|
+
const inlineRow = parseInlineFieldList(section);
|
|
1884
|
+
if (inlineRow)
|
|
1885
|
+
out.push(inlineRow);
|
|
1886
|
+
}
|
|
1887
|
+
return out;
|
|
1888
|
+
}
|
|
1889
|
+
function parseTableSection(section) {
|
|
1890
|
+
const lines = section.split(/\r?\n/);
|
|
1891
|
+
let i = 0;
|
|
1892
|
+
for (;i < lines.length; i++) {
|
|
1893
|
+
if ((lines[i] ?? "").trim().startsWith("|"))
|
|
1894
|
+
break;
|
|
1895
|
+
}
|
|
1896
|
+
if (i + 1 >= lines.length)
|
|
1897
|
+
return [];
|
|
1898
|
+
i += 2;
|
|
1899
|
+
const out = [];
|
|
1900
|
+
for (;i < lines.length; i++) {
|
|
1901
|
+
const trimmed = (lines[i] ?? "").trim();
|
|
1902
|
+
if (!trimmed.startsWith("|"))
|
|
1903
|
+
break;
|
|
1904
|
+
const row = rowFromCells(splitTableRow(trimmed));
|
|
1905
|
+
if (row)
|
|
1906
|
+
out.push(row);
|
|
1907
|
+
}
|
|
1908
|
+
return out;
|
|
1909
|
+
}
|
|
1910
|
+
function parseInlineFieldList(section) {
|
|
1911
|
+
const m = section.match(INLINE_FIELD_LIST);
|
|
1912
|
+
if (!m)
|
|
1913
|
+
return null;
|
|
1914
|
+
return rowFromCells([m[1], m[2], m[3], m[4], m[5], m[6], m[7]]);
|
|
1915
|
+
}
|
|
1916
|
+
// ../../packages/aeg-core/src/report-tokens.ts
|
|
1917
|
+
var DASH_LOOKALIKES = {
|
|
1918
|
+
"-": "‑",
|
|
1919
|
+
"–": "‒",
|
|
1920
|
+
"—": "―"
|
|
1921
|
+
};
|
|
1922
|
+
var DASH_CHARS = new Set(Object.keys(DASH_LOOKALIKES));
|
|
1923
|
+
// ../../packages/aeg-core/src/claude-code-transcript.ts
|
|
1924
|
+
import { createHash } from "node:crypto";
|
|
1925
|
+
function summarizeTranscript(jsonl) {
|
|
1926
|
+
const seen = new Set;
|
|
1927
|
+
const components = {
|
|
1928
|
+
inputTokens: 0,
|
|
1929
|
+
outputTokens: 0,
|
|
1930
|
+
cacheCreationInputTokens: 0,
|
|
1931
|
+
cacheReadInputTokens: 0
|
|
1932
|
+
};
|
|
1933
|
+
let model = null;
|
|
1934
|
+
let messageCount = 0;
|
|
1935
|
+
for (const rawLine of jsonl.split(/\r?\n/)) {
|
|
1936
|
+
const line = rawLine.trim();
|
|
1937
|
+
if (!line)
|
|
1938
|
+
continue;
|
|
1939
|
+
let entry2;
|
|
1940
|
+
try {
|
|
1941
|
+
entry2 = JSON.parse(line);
|
|
1942
|
+
} catch {
|
|
1943
|
+
continue;
|
|
1944
|
+
}
|
|
1945
|
+
if (!entry2 || typeof entry2 !== "object")
|
|
1946
|
+
continue;
|
|
1947
|
+
const obj = entry2;
|
|
1948
|
+
if (obj.type !== "assistant")
|
|
1949
|
+
continue;
|
|
1950
|
+
const message = obj.message;
|
|
1951
|
+
const id = message?.id;
|
|
1952
|
+
const usage = message?.usage;
|
|
1953
|
+
if (typeof id !== "string" || !id || !usage || seen.has(id))
|
|
1954
|
+
continue;
|
|
1955
|
+
seen.add(id);
|
|
1956
|
+
messageCount++;
|
|
1957
|
+
components.inputTokens += numberOr(usage.input_tokens, 0);
|
|
1958
|
+
components.outputTokens += numberOr(usage.output_tokens, 0);
|
|
1959
|
+
components.cacheCreationInputTokens += numberOr(usage.cache_creation_input_tokens, 0);
|
|
1960
|
+
components.cacheReadInputTokens += numberOr(usage.cache_read_input_tokens, 0);
|
|
1961
|
+
const messageModel = message?.model;
|
|
1962
|
+
if (typeof messageModel === "string" && messageModel)
|
|
1963
|
+
model = messageModel;
|
|
1964
|
+
}
|
|
1965
|
+
return { components, model, messageCount };
|
|
1966
|
+
}
|
|
1967
|
+
function numberOr(value, fallback) {
|
|
1968
|
+
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
1969
|
+
}
|
|
1970
|
+
function sanitizeKey(value) {
|
|
1971
|
+
return value.replace(/[^A-Za-z0-9]+/g, "-");
|
|
1972
|
+
}
|
|
1973
|
+
function collisionResistantKey(value) {
|
|
1974
|
+
const digest = createHash("sha256").update(value).digest("hex");
|
|
1975
|
+
return `${sanitizeKey(value)}-${digest}`;
|
|
1976
|
+
}
|
|
1977
|
+
function transcriptPointerPath(projectDir, tmpDir) {
|
|
1978
|
+
return `${tmpDir}/claude-transcript-${collisionResistantKey(projectDir)}.txt`;
|
|
1979
|
+
}
|
|
1980
|
+
function legacyTranscriptPointerPath(projectDir, tmpDir) {
|
|
1981
|
+
return `${tmpDir}/claude-transcript-${sanitizeKey(projectDir)}.txt`;
|
|
1982
|
+
}
|
|
1983
|
+
function resolvePointer(explicitTranscriptPath, deps) {
|
|
1984
|
+
if (explicitTranscriptPath)
|
|
1985
|
+
return { path: explicitTranscriptPath, corroborated: true };
|
|
1986
|
+
const projectDir = deps.env.CLAUDE_PROJECT_DIR ?? deps.cwd;
|
|
1987
|
+
const tmpDir = deps.env.TMPDIR ?? "/tmp";
|
|
1988
|
+
const primaryPointerPath = transcriptPointerPath(projectDir, tmpDir);
|
|
1989
|
+
const legacyPointerPath = legacyTranscriptPointerPath(projectDir, tmpDir);
|
|
1990
|
+
const currentSessionId = deps.env.CLAUDE_CODE_SESSION_ID;
|
|
1991
|
+
const pointerPath = deps.exists(primaryPointerPath) ? primaryPointerPath : deps.exists(legacyPointerPath) ? legacyPointerPath : undefined;
|
|
1992
|
+
if (!pointerPath) {
|
|
1993
|
+
return {
|
|
1994
|
+
pointerExisted: false,
|
|
1995
|
+
corroborated: false,
|
|
1996
|
+
error: `No transcript pointer at ${primaryPointerPath} (nor its pre-migration name ${legacyPointerPath}) ` + "and no --transcript given. Either this repo installs no track-transcript.sh Stop hook (lacking one " + "is not a defect — name the transcript directly instead), or no session has completed a turn yet."
|
|
1997
|
+
};
|
|
1998
|
+
}
|
|
1999
|
+
let contents;
|
|
2000
|
+
try {
|
|
2001
|
+
contents = deps.readFile(pointerPath).replace(/\r?\n+$/, "");
|
|
2002
|
+
} catch (err) {
|
|
2003
|
+
return {
|
|
2004
|
+
pointerExisted: true,
|
|
2005
|
+
oursByLocation: true,
|
|
2006
|
+
error: `Transcript pointer at ${pointerPath} could not be read: ${err.message}. ` + "Remove that file to clear this — the Stop hook rewrites it on the next turn."
|
|
2007
|
+
};
|
|
2008
|
+
}
|
|
2009
|
+
const [pointerSessionId, transcriptPath] = contents.split("\t");
|
|
2010
|
+
if (!transcriptPath) {
|
|
2011
|
+
return {
|
|
2012
|
+
pointerExisted: true,
|
|
2013
|
+
oursByLocation: true,
|
|
2014
|
+
error: `Transcript pointer file ${pointerPath} is malformed: "${contents.slice(0, 120)}${contents.length > 120 ? "…" : ""}". ` + "Remove that file to clear this — the Stop hook rewrites it on the next turn."
|
|
2015
|
+
};
|
|
2016
|
+
}
|
|
2017
|
+
if (currentSessionId && pointerSessionId && currentSessionId !== pointerSessionId) {
|
|
2018
|
+
return {
|
|
2019
|
+
pointerExisted: true,
|
|
2020
|
+
corroborated: false,
|
|
2021
|
+
error: `Transcript pointer at ${pointerPath} is stale: written for session ${pointerSessionId}, ` + `but this session is ${currentSessionId}. Name your own transcript with --transcript instead of ` + "reporting another session's figures as yours."
|
|
2022
|
+
};
|
|
2023
|
+
}
|
|
2024
|
+
return { path: transcriptPath, corroborated: Boolean(currentSessionId && pointerSessionId) };
|
|
2025
|
+
}
|
|
2026
|
+
function resolveMeteringCapability(deps, explicitTranscriptPath) {
|
|
2027
|
+
const resolved = resolvePointer(explicitTranscriptPath, deps);
|
|
2028
|
+
if ("error" in resolved) {
|
|
2029
|
+
const ours = resolved.pointerExisted && (resolved.corroborated || resolved.oursByLocation);
|
|
2030
|
+
if (ours)
|
|
2031
|
+
return { capable: false, reason: "pointer-unusable", detail: resolved.error };
|
|
2032
|
+
return {
|
|
2033
|
+
capable: false,
|
|
2034
|
+
reason: "no-transcript-resolved",
|
|
2035
|
+
detail: resolved.pointerExisted ? `A transcript pointer exists but belongs to another session, so this session has no wiring of its own to use. (Underlying condition, for diagnosis only: ${resolved.error})` : resolved.error
|
|
2036
|
+
};
|
|
2037
|
+
}
|
|
2038
|
+
const downstream = (r, detail) => resolved.corroborated ? { reason: r, detail } : {
|
|
2039
|
+
reason: "no-transcript-resolved",
|
|
2040
|
+
detail: `A transcript pointer was found but could not be shown to belong to this session, so it is not treated as this session's wiring. (Underlying condition, for diagnosis only: ${detail})`
|
|
2041
|
+
};
|
|
2042
|
+
if (!deps.exists(resolved.path)) {
|
|
2043
|
+
return {
|
|
2044
|
+
capable: false,
|
|
2045
|
+
...downstream("transcript-unreadable", `Resolved transcript path ${resolved.path} is not readable as a regular file owned by this user.`)
|
|
2046
|
+
};
|
|
2047
|
+
}
|
|
2048
|
+
let jsonl;
|
|
2049
|
+
try {
|
|
2050
|
+
jsonl = deps.readFile(resolved.path);
|
|
2051
|
+
} catch (err) {
|
|
2052
|
+
return {
|
|
2053
|
+
capable: false,
|
|
2054
|
+
...downstream("transcript-unreadable", `Transcript at ${resolved.path} could not be read: ${err.message}`)
|
|
2055
|
+
};
|
|
2056
|
+
}
|
|
2057
|
+
const summary = summarizeTranscript(jsonl);
|
|
2058
|
+
if (summary.messageCount === 0) {
|
|
2059
|
+
return {
|
|
2060
|
+
capable: false,
|
|
2061
|
+
...downstream("transcript-empty", `Transcript at ${resolved.path} yielded zero assistant messages with usage data — ` + "it's empty, unparseable, or not yet flushed to disk.")
|
|
2062
|
+
};
|
|
2063
|
+
}
|
|
2064
|
+
return { capable: true, transcriptPath: resolved.path, summary };
|
|
2065
|
+
}
|
|
2066
|
+
function isTokenCollectionWiringBroken(capability) {
|
|
2067
|
+
if (capability.capable)
|
|
2068
|
+
return false;
|
|
2069
|
+
return capability.reason !== "no-transcript-resolved";
|
|
2070
|
+
}
|
|
2071
|
+
// ../../packages/aeg-core/src/metering-io-guard.ts
|
|
2072
|
+
import { closeSync, constants as fsConstants, fstatSync, openSync, readFileSync } from "node:fs";
|
|
2073
|
+
var GUARD_OPEN_FLAGS = fsConstants.O_RDONLY | fsConstants.O_NONBLOCK | fsConstants.O_NOFOLLOW;
|
|
1817
2074
|
// ../../packages/aeg-core/src/file-classify.ts
|
|
1818
2075
|
function isCodeFile(p) {
|
|
1819
2076
|
if (p.endsWith(".md"))
|
|
@@ -2020,7 +2277,7 @@ function overrideActive(opts) {
|
|
|
2020
2277
|
return false;
|
|
2021
2278
|
}
|
|
2022
2279
|
// ../../packages/aeg-core/src/premise-check.ts
|
|
2023
|
-
import { createHash } from "node:crypto";
|
|
2280
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
2024
2281
|
var ASSERTION_KINDS = new Set(["contains", "absent", "sha256"]);
|
|
2025
2282
|
function isPremiseHeader(line) {
|
|
2026
2283
|
const stripped = line.replace(/[*#]/g, "").trim();
|
|
@@ -2065,7 +2322,7 @@ function checkPremises(assertions, fileReader) {
|
|
|
2065
2322
|
} else if (a.kind === "absent" && content.includes(a.value)) {
|
|
2066
2323
|
failures.push(`premise-check: ${a.path} now contains "${a.value}", but the brief pinned it absent — the premise has moved; re-dig before proceeding.`);
|
|
2067
2324
|
} else if (a.kind === "sha256") {
|
|
2068
|
-
const actual =
|
|
2325
|
+
const actual = createHash2("sha256").update(content).digest("hex");
|
|
2069
2326
|
if (actual !== a.value.toLowerCase()) {
|
|
2070
2327
|
failures.push(`premise-check: ${a.path} sha256 mismatch (brief pinned ${a.value}, file is now ${actual}) — the file changed since this brief was authored; re-dig before proceeding.`);
|
|
2071
2328
|
}
|
|
@@ -3245,6 +3502,100 @@ function parseGlossaryTerms(glossaryContent) {
|
|
|
3245
3502
|
}
|
|
3246
3503
|
return terms;
|
|
3247
3504
|
}
|
|
3505
|
+
// ../../packages/aeg-core/src/quoted-command.ts
|
|
3506
|
+
var QUOTED_COMMAND_SHIPS_PREFIX = "aeg-root/";
|
|
3507
|
+
var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
3508
|
+
var START_PATTERN = /<!--\s*AEG:QUOTES-FILE:START:(\S+?)\s*-->/g;
|
|
3509
|
+
var END_PATTERN = /<!--\s*AEG:QUOTES-FILE:END\s*-->/;
|
|
3510
|
+
function isValidCitedFilePath(path) {
|
|
3511
|
+
if (path.length === 0)
|
|
3512
|
+
return false;
|
|
3513
|
+
if (path.startsWith("/") || path.startsWith("\\"))
|
|
3514
|
+
return false;
|
|
3515
|
+
if (/^[A-Za-z]:[\\/]/.test(path))
|
|
3516
|
+
return false;
|
|
3517
|
+
return !path.split(/[\\/]+/).includes("..");
|
|
3518
|
+
}
|
|
3519
|
+
function quotedCommandLineAt(content, index) {
|
|
3520
|
+
let line = 1;
|
|
3521
|
+
for (let i = 0;i < index; i++) {
|
|
3522
|
+
if (content.charCodeAt(i) === 10)
|
|
3523
|
+
line++;
|
|
3524
|
+
}
|
|
3525
|
+
return line;
|
|
3526
|
+
}
|
|
3527
|
+
function extractQuotedText(raw) {
|
|
3528
|
+
const trimmed = raw.trim();
|
|
3529
|
+
const fenced = /^(?:`{3,}|~{3,})[^\n]*\n([\s\S]*?)\n?(?:`{3,}|~{3,})$/.exec(trimmed);
|
|
3530
|
+
if (fenced)
|
|
3531
|
+
return (fenced[1] ?? "").trim();
|
|
3532
|
+
const inline = /^`([^`]+)`$/.exec(trimmed);
|
|
3533
|
+
if (inline)
|
|
3534
|
+
return (inline[1] ?? "").trim();
|
|
3535
|
+
return trimmed;
|
|
3536
|
+
}
|
|
3537
|
+
function findQuotesInFile(path, content) {
|
|
3538
|
+
const masked = maskCode(content);
|
|
3539
|
+
const quotes = [];
|
|
3540
|
+
START_PATTERN.lastIndex = 0;
|
|
3541
|
+
let start = START_PATTERN.exec(masked);
|
|
3542
|
+
while (start !== null) {
|
|
3543
|
+
const citedFile = start[1];
|
|
3544
|
+
const innerStart = start.index + start[0].length;
|
|
3545
|
+
const end = END_PATTERN.exec(masked.slice(innerStart));
|
|
3546
|
+
if (end === null) {
|
|
3547
|
+
START_PATTERN.lastIndex = innerStart;
|
|
3548
|
+
start = START_PATTERN.exec(masked);
|
|
3549
|
+
continue;
|
|
3550
|
+
}
|
|
3551
|
+
const innerEnd = innerStart + end.index;
|
|
3552
|
+
if (isValidCitedFilePath(citedFile)) {
|
|
3553
|
+
const quotedText = extractQuotedText(content.slice(innerStart, innerEnd));
|
|
3554
|
+
if (quotedText.length > 0) {
|
|
3555
|
+
quotes.push({ file: path, line: quotedCommandLineAt(content, innerStart), quotedText, citedFile });
|
|
3556
|
+
}
|
|
3557
|
+
}
|
|
3558
|
+
START_PATTERN.lastIndex = innerEnd + end[0].length;
|
|
3559
|
+
start = START_PATTERN.exec(masked);
|
|
3560
|
+
}
|
|
3561
|
+
return quotes;
|
|
3562
|
+
}
|
|
3563
|
+
function findCitedQuotes(files, readerFacingPrefix, readerFacingSuffix, shipsPrefix = QUOTED_COMMAND_SHIPS_PREFIX) {
|
|
3564
|
+
const quotes = [];
|
|
3565
|
+
for (const file of files) {
|
|
3566
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
3567
|
+
if (!cls || !QUOTED_COMMAND_SWEPT_CLASSES.has(cls))
|
|
3568
|
+
continue;
|
|
3569
|
+
quotes.push(...findQuotesInFile(file.path, file.content));
|
|
3570
|
+
}
|
|
3571
|
+
return quotes;
|
|
3572
|
+
}
|
|
3573
|
+
function evaluateCitedQuotes(citedQuotes, citedFileContents) {
|
|
3574
|
+
const findings = [];
|
|
3575
|
+
for (const quote of citedQuotes) {
|
|
3576
|
+
const content = citedFileContents.get(quote.citedFile);
|
|
3577
|
+
if (content === undefined) {
|
|
3578
|
+
findings.push({
|
|
3579
|
+
file: quote.file,
|
|
3580
|
+
line: quote.line,
|
|
3581
|
+
citedFile: quote.citedFile,
|
|
3582
|
+
quotedText: quote.quotedText,
|
|
3583
|
+
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but that file could not be read`
|
|
3584
|
+
});
|
|
3585
|
+
continue;
|
|
3586
|
+
}
|
|
3587
|
+
if (!content.includes(quote.quotedText)) {
|
|
3588
|
+
findings.push({
|
|
3589
|
+
file: quote.file,
|
|
3590
|
+
line: quote.line,
|
|
3591
|
+
citedFile: quote.citedFile,
|
|
3592
|
+
quotedText: quote.quotedText,
|
|
3593
|
+
message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but \`${quote.citedFile}\` no longer contains that text verbatim`
|
|
3594
|
+
});
|
|
3595
|
+
}
|
|
3596
|
+
}
|
|
3597
|
+
return findings;
|
|
3598
|
+
}
|
|
3248
3599
|
// ../../packages/aeg-core/src/retired-vocabulary.ts
|
|
3249
3600
|
var RETIRED_PATTERNS = [
|
|
3250
3601
|
String.raw`\bD-[0-9]{3}\b`,
|
|
@@ -3358,6 +3709,10 @@ function checkDispatchReadiness(input) {
|
|
|
3358
3709
|
blockers.push(`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.`);
|
|
3359
3710
|
}
|
|
3360
3711
|
for (const dep of input.dependsOn) {
|
|
3712
|
+
if (dep.resolved === false) {
|
|
3713
|
+
blockers.push(`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.`);
|
|
3714
|
+
continue;
|
|
3715
|
+
}
|
|
3361
3716
|
if (!dep.merged && !isHandClosedByRecognizedPrincipal(dep, principalAllowlist)) {
|
|
3362
3717
|
const issueStr = dep.issue !== null ? ` (#${dep.issue})` : "";
|
|
3363
3718
|
blockers.push(`dispatch-gate depends-on: ${taskLabel} depends on ${dep.id}${issueStr}, whose PR is not merged yet — not dispatchable, it serializes behind it.`);
|