audrey 1.1.2 → 1.2.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/CHANGELOG.md +101 -0
- package/README.md +39 -12
- package/dist/mcp-server/codex-hooks-probe.d.ts +22 -0
- package/dist/mcp-server/codex-hooks-probe.d.ts.map +1 -0
- package/dist/mcp-server/codex-hooks-probe.js +160 -0
- package/dist/mcp-server/codex-hooks-probe.js.map +1 -0
- package/dist/mcp-server/config.d.ts +26 -2
- package/dist/mcp-server/config.d.ts.map +1 -1
- package/dist/mcp-server/config.js +52 -20
- package/dist/mcp-server/config.js.map +1 -1
- package/dist/mcp-server/hooks.d.ts +28 -0
- package/dist/mcp-server/hooks.d.ts.map +1 -1
- package/dist/mcp-server/hooks.js +91 -2
- package/dist/mcp-server/hooks.js.map +1 -1
- package/dist/mcp-server/index.d.ts +242 -2
- package/dist/mcp-server/index.d.ts.map +1 -1
- package/dist/mcp-server/index.js +806 -240
- package/dist/mcp-server/index.js.map +1 -1
- package/dist/mcp-server/tool-schemas.d.ts +32 -2
- package/dist/mcp-server/tool-schemas.d.ts.map +1 -1
- package/dist/mcp-server/tool-schemas.js +55 -0
- package/dist/mcp-server/tool-schemas.js.map +1 -1
- package/dist/src/audrey.d.ts +14 -2
- package/dist/src/audrey.d.ts.map +1 -1
- package/dist/src/audrey.js +152 -28
- package/dist/src/audrey.js.map +1 -1
- package/dist/src/autopilot.d.ts +22 -0
- package/dist/src/autopilot.d.ts.map +1 -1
- package/dist/src/autopilot.js +271 -50
- package/dist/src/autopilot.js.map +1 -1
- package/dist/src/capsule.d.ts +23 -0
- package/dist/src/capsule.d.ts.map +1 -1
- package/dist/src/capsule.js +56 -11
- package/dist/src/capsule.js.map +1 -1
- package/dist/src/confidence.d.ts +9 -1
- package/dist/src/confidence.d.ts.map +1 -1
- package/dist/src/confidence.js +16 -2
- package/dist/src/confidence.js.map +1 -1
- package/dist/src/consolidate.d.ts +4 -0
- package/dist/src/consolidate.d.ts.map +1 -1
- package/dist/src/consolidate.js +206 -34
- package/dist/src/consolidate.js.map +1 -1
- package/dist/src/controller.d.ts +17 -1
- package/dist/src/controller.d.ts.map +1 -1
- package/dist/src/controller.js +244 -128
- package/dist/src/controller.js.map +1 -1
- package/dist/src/db.d.ts.map +1 -1
- package/dist/src/db.js +233 -56
- package/dist/src/db.js.map +1 -1
- package/dist/src/encode.d.ts +2 -1
- package/dist/src/encode.d.ts.map +1 -1
- package/dist/src/encode.js +41 -4
- package/dist/src/encode.js.map +1 -1
- package/dist/src/events.d.ts +48 -1
- package/dist/src/events.d.ts.map +1 -1
- package/dist/src/events.js +160 -62
- package/dist/src/events.js.map +1 -1
- package/dist/src/export.d.ts.map +1 -1
- package/dist/src/export.js +4 -4
- package/dist/src/export.js.map +1 -1
- package/dist/src/grounding.d.ts +111 -0
- package/dist/src/grounding.d.ts.map +1 -0
- package/dist/src/grounding.js +259 -0
- package/dist/src/grounding.js.map +1 -0
- package/dist/src/hybrid-recall.d.ts +16 -7
- package/dist/src/hybrid-recall.d.ts.map +1 -1
- package/dist/src/hybrid-recall.js +22 -11
- package/dist/src/hybrid-recall.js.map +1 -1
- package/dist/src/import.d.ts +10 -0
- package/dist/src/import.d.ts.map +1 -1
- package/dist/src/import.js +122 -22
- package/dist/src/import.js.map +1 -1
- package/dist/src/llm.d.ts.map +1 -1
- package/dist/src/llm.js +16 -0
- package/dist/src/llm.js.map +1 -1
- package/dist/src/preflight.d.ts.map +1 -1
- package/dist/src/preflight.js +89 -47
- package/dist/src/preflight.js.map +1 -1
- package/dist/src/project.d.ts +4 -1
- package/dist/src/project.d.ts.map +1 -1
- package/dist/src/project.js +65 -5
- package/dist/src/project.js.map +1 -1
- package/dist/src/recall.d.ts.map +1 -1
- package/dist/src/recall.js +138 -13
- package/dist/src/recall.js.map +1 -1
- package/dist/src/redact.d.ts +1 -1
- package/dist/src/redact.d.ts.map +1 -1
- package/dist/src/redact.js +185 -5
- package/dist/src/redact.js.map +1 -1
- package/dist/src/routes.d.ts.map +1 -1
- package/dist/src/routes.js +91 -18
- package/dist/src/routes.js.map +1 -1
- package/dist/src/trust.d.ts +35 -0
- package/dist/src/trust.d.ts.map +1 -0
- package/dist/src/trust.js +77 -0
- package/dist/src/trust.js.map +1 -0
- package/dist/src/types.d.ts +24 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +4 -38
- package/benchmarks/adapter-kit.mjs +0 -20
- package/benchmarks/adapter-self-test.mjs +0 -170
- package/benchmarks/adapters/example-allow.mjs +0 -31
- package/benchmarks/adapters/mem0-platform.mjs +0 -274
- package/benchmarks/adapters/registry.json +0 -51
- package/benchmarks/adapters/zep-cloud.mjs +0 -304
- package/benchmarks/baselines.js +0 -174
- package/benchmarks/build-leaderboard.mjs +0 -183
- package/benchmarks/cases.js +0 -549
- package/benchmarks/create-conformance-card.mjs +0 -148
- package/benchmarks/create-submission-bundle.mjs +0 -190
- package/benchmarks/dry-run-external-adapters.mjs +0 -177
- package/benchmarks/guardbench.js +0 -1265
- package/benchmarks/output/adapter-self-test/guardbench-adapter-self-test.json +0 -50
- package/benchmarks/output/external/guardbench-external-dry-run.json +0 -69
- package/benchmarks/output/external/guardbench-external-evidence.json +0 -56
- package/benchmarks/output/guardbench-conformance-card.json +0 -63
- package/benchmarks/output/guardbench-manifest.json +0 -414
- package/benchmarks/output/guardbench-raw.json +0 -1279
- package/benchmarks/output/guardbench-summary.json +0 -2123
- package/benchmarks/output/leaderboard/guardbench-leaderboard.json +0 -93
- package/benchmarks/output/leaderboard/guardbench-leaderboard.md +0 -7
- package/benchmarks/output/submission-bundle/guardbench-conformance-card.json +0 -63
- package/benchmarks/output/submission-bundle/guardbench-manifest.json +0 -414
- package/benchmarks/output/submission-bundle/guardbench-raw.json +0 -1279
- package/benchmarks/output/submission-bundle/guardbench-summary.json +0 -2123
- package/benchmarks/output/submission-bundle/schemas/guardbench-adapter-registry.schema.json +0 -69
- package/benchmarks/output/submission-bundle/schemas/guardbench-adapter-self-test.schema.json +0 -156
- package/benchmarks/output/submission-bundle/schemas/guardbench-conformance-card.schema.json +0 -184
- package/benchmarks/output/submission-bundle/schemas/guardbench-external-dry-run.schema.json +0 -74
- package/benchmarks/output/submission-bundle/schemas/guardbench-external-evidence.schema.json +0 -108
- package/benchmarks/output/submission-bundle/schemas/guardbench-external-run.schema.json +0 -160
- package/benchmarks/output/submission-bundle/schemas/guardbench-leaderboard.schema.json +0 -179
- package/benchmarks/output/submission-bundle/schemas/guardbench-manifest.schema.json +0 -213
- package/benchmarks/output/submission-bundle/schemas/guardbench-publication-verification.schema.json +0 -47
- package/benchmarks/output/submission-bundle/schemas/guardbench-raw.schema.json +0 -184
- package/benchmarks/output/submission-bundle/schemas/guardbench-submission-manifest.schema.json +0 -151
- package/benchmarks/output/submission-bundle/schemas/guardbench-summary.schema.json +0 -249
- package/benchmarks/output/submission-bundle/submission-manifest.json +0 -131
- package/benchmarks/output/submission-bundle/validation-report.json +0 -31
- package/benchmarks/output/summary.json +0 -2354
- package/benchmarks/perf-snapshot.js +0 -307
- package/benchmarks/perf.bench.js +0 -169
- package/benchmarks/public-paths.mjs +0 -97
- package/benchmarks/reference-results.js +0 -75
- package/benchmarks/report.js +0 -280
- package/benchmarks/run-external-guardbench.mjs +0 -303
- package/benchmarks/run.js +0 -735
- package/benchmarks/schemas/guardbench-adapter-registry.schema.json +0 -69
- package/benchmarks/schemas/guardbench-adapter-self-test.schema.json +0 -156
- package/benchmarks/schemas/guardbench-conformance-card.schema.json +0 -184
- package/benchmarks/schemas/guardbench-external-dry-run.schema.json +0 -74
- package/benchmarks/schemas/guardbench-external-evidence.schema.json +0 -108
- package/benchmarks/schemas/guardbench-external-run.schema.json +0 -160
- package/benchmarks/schemas/guardbench-leaderboard.schema.json +0 -179
- package/benchmarks/schemas/guardbench-manifest.schema.json +0 -213
- package/benchmarks/schemas/guardbench-publication-verification.schema.json +0 -47
- package/benchmarks/schemas/guardbench-raw.schema.json +0 -184
- package/benchmarks/schemas/guardbench-submission-manifest.schema.json +0 -151
- package/benchmarks/schemas/guardbench-summary.schema.json +0 -249
- package/benchmarks/snapshots/perf-0.22.2.json +0 -123
- package/benchmarks/snapshots/perf-0.23.0.json +0 -123
- package/benchmarks/validate-adapter-module.mjs +0 -107
- package/benchmarks/validate-adapter-registry.mjs +0 -145
- package/benchmarks/validate-adapter-self-test.mjs +0 -96
- package/benchmarks/validate-guardbench-artifacts.mjs +0 -400
- package/benchmarks/verify-external-evidence.mjs +0 -351
- package/benchmarks/verify-publication-artifacts.mjs +0 -309
- package/benchmarks/verify-submission-bundle.mjs +0 -172
- package/docs/AUDREY_PAPER_OUTLINE.md +0 -178
- package/docs/MEMORY_BENCHMARKING.md +0 -59
- package/docs/PRODUCTION_BACKLOG.md +0 -321
- package/docs/assets/audrey-feature-grid.jpg +0 -0
- package/docs/assets/audrey-logo.svg +0 -45
- package/docs/assets/audrey-wordmark.png +0 -0
- package/docs/paper/00-master.md +0 -48
- package/docs/paper/01-introduction.md +0 -27
- package/docs/paper/02-related-work.md +0 -47
- package/docs/paper/03-problem-definition.md +0 -108
- package/docs/paper/04-design.md +0 -164
- package/docs/paper/05-guardbench-spec.md +0 -412
- package/docs/paper/06-implementation.md +0 -115
- package/docs/paper/07-evaluation.md +0 -168
- package/docs/paper/08-discussion-limitations.md +0 -61
- package/docs/paper/09-conclusion.md +0 -11
- package/docs/paper/SUBMISSION_README.md +0 -162
- package/docs/paper/appendix-a-demo-transcript.md +0 -114
- package/docs/paper/arxiv-compile-report.schema.json +0 -116
- package/docs/paper/arxiv-source.schema.json +0 -61
- package/docs/paper/audrey-paper-v1.md +0 -1108
- package/docs/paper/browser-launch-plan.json +0 -209
- package/docs/paper/browser-launch-plan.schema.json +0 -100
- package/docs/paper/browser-launch-results.json +0 -86
- package/docs/paper/browser-launch-results.schema.json +0 -66
- package/docs/paper/claim-register.json +0 -138
- package/docs/paper/claim-register.schema.json +0 -81
- package/docs/paper/evidence-ledger.md +0 -103
- package/docs/paper/output/arxiv/README-arxiv.txt +0 -8
- package/docs/paper/output/arxiv/arxiv-manifest.json +0 -41
- package/docs/paper/output/arxiv/main.tex +0 -951
- package/docs/paper/output/arxiv/references.bib +0 -222
- package/docs/paper/output/arxiv-compile-report.json +0 -24
- package/docs/paper/output/submission-bundle/LICENSE +0 -21
- package/docs/paper/output/submission-bundle/README.md +0 -440
- package/docs/paper/output/submission-bundle/benchmarks/output/adapter-self-test/guardbench-adapter-self-test.json +0 -50
- package/docs/paper/output/submission-bundle/benchmarks/output/external/guardbench-external-dry-run.json +0 -69
- package/docs/paper/output/submission-bundle/benchmarks/output/external/guardbench-external-evidence.json +0 -56
- package/docs/paper/output/submission-bundle/benchmarks/output/guardbench-conformance-card.json +0 -63
- package/docs/paper/output/submission-bundle/benchmarks/output/guardbench-manifest.json +0 -414
- package/docs/paper/output/submission-bundle/benchmarks/output/guardbench-raw.json +0 -1279
- package/docs/paper/output/submission-bundle/benchmarks/output/guardbench-summary.json +0 -2123
- package/docs/paper/output/submission-bundle/benchmarks/output/leaderboard/guardbench-leaderboard.json +0 -93
- package/docs/paper/output/submission-bundle/benchmarks/output/leaderboard/guardbench-leaderboard.md +0 -7
- package/docs/paper/output/submission-bundle/benchmarks/output/submission-bundle/submission-manifest.json +0 -131
- package/docs/paper/output/submission-bundle/benchmarks/output/submission-bundle/validation-report.json +0 -31
- package/docs/paper/output/submission-bundle/benchmarks/output/summary.json +0 -2354
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-adapter-registry.schema.json +0 -69
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-adapter-self-test.schema.json +0 -156
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-conformance-card.schema.json +0 -184
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-external-dry-run.schema.json +0 -74
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-external-evidence.schema.json +0 -108
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-external-run.schema.json +0 -160
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-leaderboard.schema.json +0 -179
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-manifest.schema.json +0 -213
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-publication-verification.schema.json +0 -47
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-raw.schema.json +0 -184
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-submission-manifest.schema.json +0 -151
- package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-summary.schema.json +0 -249
- package/docs/paper/output/submission-bundle/docs/AUDREY_PAPER_OUTLINE.md +0 -178
- package/docs/paper/output/submission-bundle/docs/paper/00-master.md +0 -48
- package/docs/paper/output/submission-bundle/docs/paper/01-introduction.md +0 -27
- package/docs/paper/output/submission-bundle/docs/paper/02-related-work.md +0 -47
- package/docs/paper/output/submission-bundle/docs/paper/03-problem-definition.md +0 -108
- package/docs/paper/output/submission-bundle/docs/paper/04-design.md +0 -164
- package/docs/paper/output/submission-bundle/docs/paper/05-guardbench-spec.md +0 -412
- package/docs/paper/output/submission-bundle/docs/paper/06-implementation.md +0 -115
- package/docs/paper/output/submission-bundle/docs/paper/07-evaluation.md +0 -168
- package/docs/paper/output/submission-bundle/docs/paper/08-discussion-limitations.md +0 -61
- package/docs/paper/output/submission-bundle/docs/paper/09-conclusion.md +0 -11
- package/docs/paper/output/submission-bundle/docs/paper/SUBMISSION_README.md +0 -162
- package/docs/paper/output/submission-bundle/docs/paper/appendix-a-demo-transcript.md +0 -114
- package/docs/paper/output/submission-bundle/docs/paper/arxiv-compile-report.schema.json +0 -116
- package/docs/paper/output/submission-bundle/docs/paper/arxiv-source.schema.json +0 -61
- package/docs/paper/output/submission-bundle/docs/paper/audrey-paper-v1.md +0 -1108
- package/docs/paper/output/submission-bundle/docs/paper/browser-launch-plan.json +0 -209
- package/docs/paper/output/submission-bundle/docs/paper/browser-launch-plan.schema.json +0 -100
- package/docs/paper/output/submission-bundle/docs/paper/browser-launch-results.json +0 -86
- package/docs/paper/output/submission-bundle/docs/paper/browser-launch-results.schema.json +0 -66
- package/docs/paper/output/submission-bundle/docs/paper/claim-register.json +0 -138
- package/docs/paper/output/submission-bundle/docs/paper/claim-register.schema.json +0 -81
- package/docs/paper/output/submission-bundle/docs/paper/evidence-ledger.md +0 -103
- package/docs/paper/output/submission-bundle/docs/paper/output/arxiv/README-arxiv.txt +0 -8
- package/docs/paper/output/submission-bundle/docs/paper/output/arxiv/arxiv-manifest.json +0 -41
- package/docs/paper/output/submission-bundle/docs/paper/output/arxiv/main.tex +0 -951
- package/docs/paper/output/submission-bundle/docs/paper/output/arxiv/references.bib +0 -222
- package/docs/paper/output/submission-bundle/docs/paper/output/arxiv-compile-report.json +0 -24
- package/docs/paper/output/submission-bundle/docs/paper/paper-submission-bundle.schema.json +0 -70
- package/docs/paper/output/submission-bundle/docs/paper/publication-pack.json +0 -81
- package/docs/paper/output/submission-bundle/docs/paper/publication-pack.schema.json +0 -60
- package/docs/paper/output/submission-bundle/docs/paper/references.bib +0 -222
- package/docs/paper/output/submission-bundle/package.json +0 -235
- package/docs/paper/output/submission-bundle/paper-submission-manifest.json +0 -379
- package/docs/paper/paper-submission-bundle.schema.json +0 -70
- package/docs/paper/publication-pack.json +0 -81
- package/docs/paper/publication-pack.schema.json +0 -60
- package/docs/paper/references.bib +0 -222
- package/scripts/audit-release-completion.mjs +0 -440
- package/scripts/create-arxiv-source.mjs +0 -368
- package/scripts/create-paper-submission-bundle.mjs +0 -214
- package/scripts/finalize-release.mjs +0 -601
- package/scripts/prepare-release-cut.mjs +0 -277
- package/scripts/publish-release-bundle.mjs +0 -252
- package/scripts/publish-release-github-api.mjs +0 -494
- package/scripts/run-vitest.mjs +0 -34
- package/scripts/smoke-cli.js +0 -92
- package/scripts/sync-paper-artifacts.mjs +0 -112
- package/scripts/verify-arxiv-compile.mjs +0 -476
- package/scripts/verify-arxiv-source.mjs +0 -224
- package/scripts/verify-browser-launch-plan.mjs +0 -254
- package/scripts/verify-browser-launch-results.mjs +0 -303
- package/scripts/verify-paper-artifacts.mjs +0 -798
- package/scripts/verify-paper-claims.mjs +0 -254
- package/scripts/verify-paper-submission-bundle.mjs +0 -218
- package/scripts/verify-publication-pack.mjs +0 -210
- package/scripts/verify-python-package.py +0 -201
- package/scripts/verify-release-readiness.mjs +0 -920
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { resolve } from 'node:path';
|
|
3
|
-
|
|
4
|
-
const ROOT = process.cwd();
|
|
5
|
-
|
|
6
|
-
function readText(path) {
|
|
7
|
-
const absolute = resolve(ROOT, path);
|
|
8
|
-
if (!existsSync(absolute)) throw new Error(`Missing required file: ${path}`);
|
|
9
|
-
return readFileSync(absolute, 'utf-8');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function writeText(path, content) {
|
|
13
|
-
writeFileSync(resolve(ROOT, path), content, 'utf-8');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function readJson(path) {
|
|
17
|
-
return JSON.parse(readText(path));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function metric(value) {
|
|
21
|
-
return String(value);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function replaceOrFail(text, pattern, replacement, label) {
|
|
25
|
-
if (!pattern.test(text)) throw new Error(`Could not update ${label}`);
|
|
26
|
-
return text.replace(pattern, replacement);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function localRows(summary) {
|
|
30
|
-
return Object.fromEntries(summary.local.overall.map(row => [row.system, row]));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function benchmarkTable(summary) {
|
|
34
|
-
const rows = localRows(summary);
|
|
35
|
-
return [
|
|
36
|
-
`| Audrey | ${rows.Audrey.scorePercent} | ${rows.Audrey.passRate} | ${metric(rows.Audrey.avgDurationMs)} |`,
|
|
37
|
-
`| Vector Only | ${rows['Vector Only'].scorePercent} | ${rows['Vector Only'].passRate} | ${metric(rows['Vector Only'].avgDurationMs)} |`,
|
|
38
|
-
`| Keyword + Recency | ${rows['Keyword + Recency'].scorePercent} | ${rows['Keyword + Recency'].passRate} | ${metric(rows['Keyword + Recency'].avgDurationMs)} |`,
|
|
39
|
-
`| Recent Window | ${rows['Recent Window'].scorePercent} | ${rows['Recent Window'].passRate} | ${metric(rows['Recent Window'].avgDurationMs)} |`,
|
|
40
|
-
].join('\n');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function syncEvaluationText(text, summary, guardSummary) {
|
|
44
|
-
let next = text;
|
|
45
|
-
next = replaceOrFail(
|
|
46
|
-
next,
|
|
47
|
-
/The current `benchmarks\/output\/summary\.json` was generated on [^ ]+ with command `node benchmarks\/run\.js --provider mock --dimensions 64` \(Ledger: E24\)\. It reports:/,
|
|
48
|
-
`The current \`benchmarks/output/summary.json\` was generated on ${summary.generatedAt} with command \`node benchmarks/run.js --provider mock --dimensions 64\` (Ledger: E24). It reports:`,
|
|
49
|
-
'benchmark generatedAt',
|
|
50
|
-
);
|
|
51
|
-
next = replaceOrFail(
|
|
52
|
-
next,
|
|
53
|
-
/\| Audrey \| .* \|\n\| Vector Only \| .* \|\n\| Keyword \+ Recency \| .* \|\n\| Recent Window \| .* \|/,
|
|
54
|
-
benchmarkTable(summary),
|
|
55
|
-
'benchmark table',
|
|
56
|
-
);
|
|
57
|
-
next = replaceOrFail(
|
|
58
|
-
next,
|
|
59
|
-
/\| Guard latency p50 \/ p95 \| [^|]+ \|/,
|
|
60
|
-
`| Guard latency p50 / p95 | ${metric(guardSummary.latency.p50Ms)} ms / ${metric(guardSummary.latency.p95Ms)} ms |`,
|
|
61
|
-
'GuardBench latency row',
|
|
62
|
-
);
|
|
63
|
-
return next;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function syncReadme(text, guardSummary) {
|
|
67
|
-
return replaceOrFail(
|
|
68
|
-
text,
|
|
69
|
-
/<!-- guardbench-summary:start -->[\s\S]*?<!-- guardbench-summary:end -->/,
|
|
70
|
-
[
|
|
71
|
-
'<!-- guardbench-summary:start -->',
|
|
72
|
-
`Latest local result in this checkout: 10/10 scenarios passed, 100% prevention rate, 0% false-block rate, 0 raw secret leaks, 0 published artifact leaks, and ${metric(guardSummary.latency.p50Ms)}ms / ${metric(guardSummary.latency.p95Ms)}ms p50/p95 Guard latency under the mock-provider methodology.`,
|
|
73
|
-
'<!-- guardbench-summary:end -->',
|
|
74
|
-
].join('\n'),
|
|
75
|
-
'README GuardBench summary',
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function syncLedger(text, guardSummary) {
|
|
80
|
-
return replaceOrFail(
|
|
81
|
-
text,
|
|
82
|
-
/and [0-9.]+ms\/[0-9.]+ms p50\/p95 guard latency under the mock-provider methodology\. Baseline decision accuracy was no-memory 10%, recent-window 60%, vector-only 40%, and FTS-only 10%, with 0% full-contract pass rate for each baseline\. \| GuardBench local comparative results/,
|
|
83
|
-
`and ${metric(guardSummary.latency.p50Ms)}ms/${metric(guardSummary.latency.p95Ms)}ms p50/p95 guard latency under the mock-provider methodology. Baseline decision accuracy was no-memory 10%, recent-window 60%, vector-only 40%, and FTS-only 10%, with 0% full-contract pass rate for each baseline. | GuardBench local comparative results`,
|
|
84
|
-
'E46 GuardBench latency',
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const summary = readJson('benchmarks/output/summary.json');
|
|
89
|
-
const guardSummary = readJson('benchmarks/output/guardbench-summary.json');
|
|
90
|
-
|
|
91
|
-
const updates = [
|
|
92
|
-
['README.md', text => syncReadme(text, guardSummary)],
|
|
93
|
-
['docs/paper/07-evaluation.md', text => syncEvaluationText(text, summary, guardSummary)],
|
|
94
|
-
['docs/paper/audrey-paper-v1.md', text => syncEvaluationText(text, summary, guardSummary)],
|
|
95
|
-
['docs/paper/evidence-ledger.md', text => syncLedger(text, guardSummary)],
|
|
96
|
-
];
|
|
97
|
-
|
|
98
|
-
const changed = [];
|
|
99
|
-
for (const [path, updater] of updates) {
|
|
100
|
-
const before = readText(path);
|
|
101
|
-
const after = updater(before);
|
|
102
|
-
if (after !== before) {
|
|
103
|
-
writeText(path, after);
|
|
104
|
-
changed.push(path);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
console.log(
|
|
109
|
-
changed.length
|
|
110
|
-
? `Synced paper artifacts: ${changed.join(', ')}`
|
|
111
|
-
: 'Paper artifacts already in sync.',
|
|
112
|
-
);
|
|
@@ -1,476 +0,0 @@
|
|
|
1
|
-
import { createHash } from 'node:crypto';
|
|
2
|
-
import { spawn, spawnSync } from 'node:child_process';
|
|
3
|
-
import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
4
|
-
import { createServer } from 'node:http';
|
|
5
|
-
import { dirname, join, relative, resolve } from 'node:path';
|
|
6
|
-
import { Readable } from 'node:stream';
|
|
7
|
-
import { fileURLToPath } from 'node:url';
|
|
8
|
-
import { validateSchema } from '../benchmarks/validate-guardbench-artifacts.mjs';
|
|
9
|
-
import { publicPath } from '../benchmarks/public-paths.mjs';
|
|
10
|
-
import { verifyArxivSourcePackage } from './verify-arxiv-source.mjs';
|
|
11
|
-
|
|
12
|
-
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
13
|
-
const DEFAULT_SOURCE_DIR = 'docs/paper/output/arxiv';
|
|
14
|
-
const DEFAULT_OUT_DIR = 'docs/paper/output/arxiv-compile';
|
|
15
|
-
const DEFAULT_REPORT = 'docs/paper/output/arxiv-compile-report.json';
|
|
16
|
-
const DEFAULT_SCHEMA = 'docs/paper/arxiv-compile-report.schema.json';
|
|
17
|
-
const MAIN_TEX = 'main.tex';
|
|
18
|
-
const REFERENCES_BIB = 'references.bib';
|
|
19
|
-
const TECTONIC_BUNDLE_URL = 'https://data1.fullyjustified.net/tlextras-2022.0r0.tar';
|
|
20
|
-
|
|
21
|
-
function fromRoot(path) {
|
|
22
|
-
return resolve(ROOT, path);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function readJson(path) {
|
|
26
|
-
return JSON.parse(readFileSync(fromRoot(path), 'utf-8'));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function sha256File(path) {
|
|
30
|
-
return createHash('sha256').update(readFileSync(path)).digest('hex');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function pathForReport(path) {
|
|
34
|
-
const rel = relative(ROOT, path);
|
|
35
|
-
if (rel && !rel.startsWith('..')) return rel.replaceAll('\\', '/');
|
|
36
|
-
return publicPath(path);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function commandExists(command) {
|
|
40
|
-
const result =
|
|
41
|
-
process.platform === 'win32'
|
|
42
|
-
? spawnSync(process.env.ComSpec ?? 'cmd.exe', ['/d', '/c', 'where', command], {
|
|
43
|
-
encoding: 'utf-8',
|
|
44
|
-
})
|
|
45
|
-
: spawnSync('sh', ['-lc', `command -v ${command}`], { encoding: 'utf-8' });
|
|
46
|
-
return result.status === 0;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function compilerPlan(exists = commandExists) {
|
|
50
|
-
if (exists('tectonic')) {
|
|
51
|
-
return {
|
|
52
|
-
name: 'tectonic',
|
|
53
|
-
stages: [{ command: 'tectonic', args: ['--keep-logs', '--keep-intermediates', MAIN_TEX] }],
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
if (exists('latexmk')) {
|
|
57
|
-
return {
|
|
58
|
-
name: 'latexmk',
|
|
59
|
-
stages: [
|
|
60
|
-
{
|
|
61
|
-
command: 'latexmk',
|
|
62
|
-
args: ['-pdf', '-interaction=nonstopmode', '-halt-on-error', MAIN_TEX],
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
if (exists('pdflatex') && exists('bibtex')) {
|
|
68
|
-
return {
|
|
69
|
-
name: 'pdflatex+bibtex',
|
|
70
|
-
stages: [
|
|
71
|
-
{ command: 'pdflatex', args: ['-interaction=nonstopmode', '-halt-on-error', MAIN_TEX] },
|
|
72
|
-
{ command: 'bibtex', args: ['main'] },
|
|
73
|
-
{ command: 'pdflatex', args: ['-interaction=nonstopmode', '-halt-on-error', MAIN_TEX] },
|
|
74
|
-
{ command: 'pdflatex', args: ['-interaction=nonstopmode', '-halt-on-error', MAIN_TEX] },
|
|
75
|
-
],
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
if (exists('uvx')) {
|
|
79
|
-
return {
|
|
80
|
-
name: 'uvx-tecto',
|
|
81
|
-
bundleProxy: true,
|
|
82
|
-
stages: [
|
|
83
|
-
{
|
|
84
|
-
command: 'uvx',
|
|
85
|
-
args: [
|
|
86
|
-
'tecto',
|
|
87
|
-
'-X',
|
|
88
|
-
'compile',
|
|
89
|
-
'--bundle',
|
|
90
|
-
'__TECTONIC_BUNDLE_URL__',
|
|
91
|
-
'--keep-logs',
|
|
92
|
-
'--keep-intermediates',
|
|
93
|
-
'--reruns',
|
|
94
|
-
'2',
|
|
95
|
-
MAIN_TEX,
|
|
96
|
-
],
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function parseArgs(argv = process.argv.slice(2)) {
|
|
105
|
-
const args = {
|
|
106
|
-
dir: DEFAULT_SOURCE_DIR,
|
|
107
|
-
outDir: DEFAULT_OUT_DIR,
|
|
108
|
-
report: DEFAULT_REPORT,
|
|
109
|
-
schema: DEFAULT_SCHEMA,
|
|
110
|
-
allowMissing: false,
|
|
111
|
-
json: false,
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
for (let i = 0; i < argv.length; i++) {
|
|
115
|
-
const token = argv[i];
|
|
116
|
-
if ((token === '--dir' || token === '--source-dir') && argv[i + 1]) args.dir = argv[++i];
|
|
117
|
-
else if (token === '--out-dir' && argv[i + 1]) args.outDir = argv[++i];
|
|
118
|
-
else if (token === '--report' && argv[i + 1]) args.report = argv[++i];
|
|
119
|
-
else if (token === '--schema' && argv[i + 1]) args.schema = argv[++i];
|
|
120
|
-
else if (token === '--allow-missing') args.allowMissing = true;
|
|
121
|
-
else if (token === '--json') args.json = true;
|
|
122
|
-
else if (token === '--help' || token === '-h') args.help = true;
|
|
123
|
-
else throw new Error(`Unknown argument: ${token}`);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return args;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function usage() {
|
|
130
|
-
return `Usage: node scripts/verify-arxiv-compile.mjs [options]
|
|
131
|
-
|
|
132
|
-
Options:
|
|
133
|
-
--dir <path> arXiv source directory. Default: ${DEFAULT_SOURCE_DIR}.
|
|
134
|
-
--out-dir <path> Compile output directory. Default: ${DEFAULT_OUT_DIR}.
|
|
135
|
-
--report <path> Compile report JSON. Default: ${DEFAULT_REPORT}.
|
|
136
|
-
--schema <path> Compile report schema. Default: ${DEFAULT_SCHEMA}.
|
|
137
|
-
--allow-missing Exit 0 when no supported TeX toolchain is installed.
|
|
138
|
-
--json Print the machine-readable compile report.
|
|
139
|
-
`;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function sourceSnapshot(sourceDir) {
|
|
143
|
-
const manifestPath = join(sourceDir, 'arxiv-manifest.json');
|
|
144
|
-
const mainPath = join(sourceDir, MAIN_TEX);
|
|
145
|
-
const bibPath = join(sourceDir, REFERENCES_BIB);
|
|
146
|
-
return {
|
|
147
|
-
sourceDir: pathForReport(sourceDir),
|
|
148
|
-
manifest: pathForReport(manifestPath),
|
|
149
|
-
manifestSha256: sha256File(manifestPath),
|
|
150
|
-
mainTex: pathForReport(mainPath),
|
|
151
|
-
mainTexSha256: sha256File(mainPath),
|
|
152
|
-
referencesBib: pathForReport(bibPath),
|
|
153
|
-
referencesBibSha256: sha256File(bibPath),
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function writeReport(path, report) {
|
|
158
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
159
|
-
writeFileSync(path, `${JSON.stringify(report, null, 2)}\n`, 'utf-8');
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
async function startTectonicBundleProxy(bundleUrl = TECTONIC_BUNDLE_URL) {
|
|
163
|
-
const bundle = new URL(bundleUrl);
|
|
164
|
-
const tarPath = bundle.pathname;
|
|
165
|
-
const indexPath = `${tarPath}.index.gz`;
|
|
166
|
-
const server = createServer(async (request, response) => {
|
|
167
|
-
try {
|
|
168
|
-
const requestUrl = new URL(request.url ?? '/', 'http://127.0.0.1');
|
|
169
|
-
let remoteUrl = null;
|
|
170
|
-
if (requestUrl.pathname === tarPath) remoteUrl = bundleUrl;
|
|
171
|
-
else if (requestUrl.pathname === indexPath) remoteUrl = `${bundleUrl}.index.gz`;
|
|
172
|
-
if (!remoteUrl) {
|
|
173
|
-
response.writeHead(404);
|
|
174
|
-
response.end('not found');
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
const headers = {};
|
|
179
|
-
if (request.headers.range) headers.range = request.headers.range;
|
|
180
|
-
const upstream = await fetch(remoteUrl, { headers });
|
|
181
|
-
response.statusCode = upstream.status;
|
|
182
|
-
for (const header of [
|
|
183
|
-
'accept-ranges',
|
|
184
|
-
'content-length',
|
|
185
|
-
'content-range',
|
|
186
|
-
'content-type',
|
|
187
|
-
'etag',
|
|
188
|
-
'last-modified',
|
|
189
|
-
]) {
|
|
190
|
-
const value = upstream.headers.get(header);
|
|
191
|
-
if (value) response.setHeader(header, value);
|
|
192
|
-
}
|
|
193
|
-
if (!upstream.body) {
|
|
194
|
-
response.end();
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
Readable.fromWeb(upstream.body).pipe(response);
|
|
198
|
-
} catch (error) {
|
|
199
|
-
response.writeHead(502, { 'content-type': 'text/plain; charset=utf-8' });
|
|
200
|
-
response.end(error?.message ?? 'bundle proxy error');
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
await new Promise((resolveListen, rejectListen) => {
|
|
205
|
-
server.once('error', rejectListen);
|
|
206
|
-
server.listen(0, '127.0.0.1', () => {
|
|
207
|
-
server.off('error', rejectListen);
|
|
208
|
-
resolveListen();
|
|
209
|
-
});
|
|
210
|
-
});
|
|
211
|
-
const address = server.address();
|
|
212
|
-
return {
|
|
213
|
-
url: `http://127.0.0.1:${address.port}${tarPath}`,
|
|
214
|
-
close: () => new Promise(resolveClose => server.close(resolveClose)),
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function stageWithBundle(stage, bundleUrl) {
|
|
219
|
-
return {
|
|
220
|
-
command: stage.command,
|
|
221
|
-
args: stage.args.map(arg => (arg === '__TECTONIC_BUNDLE_URL__' ? bundleUrl : arg)),
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
function runStage(stage, cwd) {
|
|
226
|
-
return new Promise(resolveRun => {
|
|
227
|
-
const child = spawn(stage.command, stage.args, { cwd, windowsHide: true });
|
|
228
|
-
let stdout = '';
|
|
229
|
-
let stderr = '';
|
|
230
|
-
let settled = false;
|
|
231
|
-
const timer = setTimeout(() => {
|
|
232
|
-
child.kill();
|
|
233
|
-
if (!settled) {
|
|
234
|
-
settled = true;
|
|
235
|
-
resolveRun({
|
|
236
|
-
status: 1,
|
|
237
|
-
signal: 'TIMEOUT',
|
|
238
|
-
stdout,
|
|
239
|
-
stderr: `${stderr}\nTimed out after 120000ms`.trim(),
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
}, 120000);
|
|
243
|
-
|
|
244
|
-
child.stdout?.on('data', chunk => {
|
|
245
|
-
stdout += chunk.toString();
|
|
246
|
-
});
|
|
247
|
-
child.stderr?.on('data', chunk => {
|
|
248
|
-
stderr += chunk.toString();
|
|
249
|
-
});
|
|
250
|
-
child.once('error', error => {
|
|
251
|
-
clearTimeout(timer);
|
|
252
|
-
if (!settled) {
|
|
253
|
-
settled = true;
|
|
254
|
-
resolveRun({ status: 1, error, stdout, stderr: `${stderr}\n${error.message}`.trim() });
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
child.once('close', (status, signal) => {
|
|
258
|
-
clearTimeout(timer);
|
|
259
|
-
if (!settled) {
|
|
260
|
-
settled = true;
|
|
261
|
-
resolveRun({ status, signal, stdout, stderr });
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export async function verifyArxivCompile(options = {}) {
|
|
268
|
-
const sourceDir = fromRoot(options.dir ?? DEFAULT_SOURCE_DIR);
|
|
269
|
-
const outDir = fromRoot(options.outDir ?? DEFAULT_OUT_DIR);
|
|
270
|
-
const reportPath = fromRoot(options.report ?? DEFAULT_REPORT);
|
|
271
|
-
const now = options.now ?? new Date().toISOString();
|
|
272
|
-
const failures = [];
|
|
273
|
-
const blockers = [];
|
|
274
|
-
const sourceReport = verifyArxivSourcePackage({ dir: pathForReport(sourceDir) });
|
|
275
|
-
const source = sourceReport.ok ? sourceSnapshot(sourceDir) : null;
|
|
276
|
-
|
|
277
|
-
if (!sourceReport.ok) {
|
|
278
|
-
failures.push(...sourceReport.failures.map(failure => `arXiv source: ${failure}`));
|
|
279
|
-
const report = {
|
|
280
|
-
schemaVersion: '1.0.0',
|
|
281
|
-
suite: 'Audrey arXiv compile check',
|
|
282
|
-
generatedAt: now,
|
|
283
|
-
source,
|
|
284
|
-
outputDir: pathForReport(outDir),
|
|
285
|
-
status: 'failed',
|
|
286
|
-
compiler: null,
|
|
287
|
-
outputPdf: null,
|
|
288
|
-
outputPdfSha256: null,
|
|
289
|
-
logFile: null,
|
|
290
|
-
blockers,
|
|
291
|
-
failures,
|
|
292
|
-
};
|
|
293
|
-
writeReport(reportPath, report);
|
|
294
|
-
return report;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
const plan = compilerPlan(options.commandExists ?? commandExists);
|
|
298
|
-
if (!plan) {
|
|
299
|
-
blockers.push('Install tectonic, latexmk, or pdflatex+bibtex before final arXiv compile proof');
|
|
300
|
-
const report = {
|
|
301
|
-
schemaVersion: '1.0.0',
|
|
302
|
-
suite: 'Audrey arXiv compile check',
|
|
303
|
-
generatedAt: now,
|
|
304
|
-
source,
|
|
305
|
-
outputDir: pathForReport(outDir),
|
|
306
|
-
status: 'toolchain-missing',
|
|
307
|
-
compiler: null,
|
|
308
|
-
outputPdf: null,
|
|
309
|
-
outputPdfSha256: null,
|
|
310
|
-
logFile: null,
|
|
311
|
-
blockers,
|
|
312
|
-
failures,
|
|
313
|
-
};
|
|
314
|
-
writeReport(reportPath, report);
|
|
315
|
-
return report;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
rmSync(outDir, { recursive: true, force: true });
|
|
319
|
-
mkdirSync(outDir, { recursive: true });
|
|
320
|
-
cpSync(join(sourceDir, MAIN_TEX), join(outDir, MAIN_TEX));
|
|
321
|
-
cpSync(join(sourceDir, REFERENCES_BIB), join(outDir, REFERENCES_BIB));
|
|
322
|
-
|
|
323
|
-
let proxy = null;
|
|
324
|
-
const logLines = [];
|
|
325
|
-
try {
|
|
326
|
-
proxy = plan.bundleProxy ? await startTectonicBundleProxy() : null;
|
|
327
|
-
const stages = proxy
|
|
328
|
-
? plan.stages.map(stage => stageWithBundle(stage, proxy.url))
|
|
329
|
-
: plan.stages;
|
|
330
|
-
for (const stage of stages) {
|
|
331
|
-
logLines.push(`$ ${stage.command} ${stage.args.join(' ')}`);
|
|
332
|
-
const result = await runStage(stage, outDir);
|
|
333
|
-
if (result.stdout) logLines.push(result.stdout.trim());
|
|
334
|
-
if (result.stderr) logLines.push(result.stderr.trim());
|
|
335
|
-
if (result.status !== 0) {
|
|
336
|
-
failures.push(`${stage.command} exited ${result.status ?? result.signal ?? 'unknown'}`);
|
|
337
|
-
break;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
} finally {
|
|
341
|
-
await proxy?.close();
|
|
342
|
-
}
|
|
343
|
-
const logPath = join(outDir, 'arxiv-compile.log');
|
|
344
|
-
writeFileSync(logPath, `${logLines.filter(Boolean).join('\n\n')}\n`, 'utf-8');
|
|
345
|
-
|
|
346
|
-
const pdfPath = join(outDir, 'main.pdf');
|
|
347
|
-
if (!existsSync(pdfPath)) failures.push('main.pdf was not produced by the TeX compiler');
|
|
348
|
-
const status = failures.length ? 'failed' : 'passed';
|
|
349
|
-
const report = {
|
|
350
|
-
schemaVersion: '1.0.0',
|
|
351
|
-
suite: 'Audrey arXiv compile check',
|
|
352
|
-
generatedAt: now,
|
|
353
|
-
source,
|
|
354
|
-
outputDir: pathForReport(outDir),
|
|
355
|
-
status,
|
|
356
|
-
compiler: {
|
|
357
|
-
name: plan.name,
|
|
358
|
-
stages: plan.stages.map(stage => ({ command: stage.command, args: stage.args })),
|
|
359
|
-
},
|
|
360
|
-
outputPdf: existsSync(pdfPath) ? pathForReport(pdfPath) : null,
|
|
361
|
-
outputPdfSha256: existsSync(pdfPath) ? sha256File(pdfPath) : null,
|
|
362
|
-
logFile: pathForReport(logPath),
|
|
363
|
-
blockers,
|
|
364
|
-
failures,
|
|
365
|
-
};
|
|
366
|
-
writeReport(reportPath, report);
|
|
367
|
-
return report;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
export function verifyArxivCompileReport(options = {}) {
|
|
371
|
-
const reportPath = fromRoot(options.report ?? DEFAULT_REPORT);
|
|
372
|
-
const schemaPath = fromRoot(options.schema ?? DEFAULT_SCHEMA);
|
|
373
|
-
const allowPending = options.allowPending !== false;
|
|
374
|
-
const failures = [];
|
|
375
|
-
const blockers = [];
|
|
376
|
-
let report;
|
|
377
|
-
|
|
378
|
-
try {
|
|
379
|
-
report = JSON.parse(readFileSync(reportPath, 'utf-8'));
|
|
380
|
-
} catch (error) {
|
|
381
|
-
return {
|
|
382
|
-
ok: false,
|
|
383
|
-
report: pathForReport(reportPath),
|
|
384
|
-
status: 'missing',
|
|
385
|
-
blockers: [],
|
|
386
|
-
failures: [`arxiv-compile-report.json: ${error.message}`],
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
try {
|
|
391
|
-
failures.push(
|
|
392
|
-
...validateSchema(report, readJson(pathForReport(schemaPath)), 'audrey-arxiv-compile-report'),
|
|
393
|
-
);
|
|
394
|
-
} catch (error) {
|
|
395
|
-
failures.push(`schema: ${error.message}`);
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
const source = report.source;
|
|
399
|
-
if (source) {
|
|
400
|
-
const sourceChecks = [
|
|
401
|
-
['manifestSha256', source.manifest],
|
|
402
|
-
['mainTexSha256', source.mainTex],
|
|
403
|
-
['referencesBibSha256', source.referencesBib],
|
|
404
|
-
];
|
|
405
|
-
for (const [hashKey, file] of sourceChecks) {
|
|
406
|
-
const absolute = fromRoot(file);
|
|
407
|
-
if (!existsSync(absolute)) {
|
|
408
|
-
failures.push(`arxiv-compile-report.json: source file missing: ${file}`);
|
|
409
|
-
} else if (report.source?.[hashKey] !== sha256File(absolute)) {
|
|
410
|
-
failures.push(`arxiv-compile-report.json: ${file} changed since compile report`);
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
if (report.status === 'toolchain-missing') {
|
|
416
|
-
blockers.push(...(report.blockers?.length ? report.blockers : ['TeX toolchain is missing']));
|
|
417
|
-
} else if (report.status === 'failed') {
|
|
418
|
-
failures.push(...(report.failures?.length ? report.failures : ['arXiv compile failed']));
|
|
419
|
-
} else if (report.status === 'passed') {
|
|
420
|
-
if (!report.outputPdf || !existsSync(fromRoot(report.outputPdf)))
|
|
421
|
-
failures.push('arxiv-compile-report.json: outputPdf is missing');
|
|
422
|
-
if (
|
|
423
|
-
report.outputPdf &&
|
|
424
|
-
report.outputPdfSha256 &&
|
|
425
|
-
sha256File(fromRoot(report.outputPdf)) !== report.outputPdfSha256
|
|
426
|
-
) {
|
|
427
|
-
failures.push('arxiv-compile-report.json: outputPdfSha256 is stale');
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
return {
|
|
432
|
-
ok: failures.length === 0 && (allowPending || blockers.length === 0),
|
|
433
|
-
report: pathForReport(reportPath),
|
|
434
|
-
status: report.status,
|
|
435
|
-
compiler: report.compiler?.name ?? null,
|
|
436
|
-
blockers,
|
|
437
|
-
failures,
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
function exitCode(report, allowMissing) {
|
|
442
|
-
if (report.status === 'passed') return 0;
|
|
443
|
-
if (report.status === 'toolchain-missing' && allowMissing) return 0;
|
|
444
|
-
return 1;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
async function main() {
|
|
448
|
-
const args = parseArgs();
|
|
449
|
-
if (args.help) {
|
|
450
|
-
console.log(usage());
|
|
451
|
-
return;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
const report = await verifyArxivCompile(args);
|
|
455
|
-
if (args.json) {
|
|
456
|
-
console.log(JSON.stringify(report, null, 2));
|
|
457
|
-
} else if (report.status === 'passed') {
|
|
458
|
-
console.log(`arXiv compile check passed: ${report.outputPdf}`);
|
|
459
|
-
} else if (report.status === 'toolchain-missing') {
|
|
460
|
-
console.log(`arXiv compile check pending: ${report.blockers.join('; ')}`);
|
|
461
|
-
} else {
|
|
462
|
-
console.error('arXiv compile check failed:');
|
|
463
|
-
for (const failure of report.failures) console.error(`- ${failure}`);
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
process.exit(exitCode(report, args.allowMissing));
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
470
|
-
try {
|
|
471
|
-
await main();
|
|
472
|
-
} catch (error) {
|
|
473
|
-
console.error(error.stack ?? error.message);
|
|
474
|
-
process.exit(1);
|
|
475
|
-
}
|
|
476
|
-
}
|