audrey 1.1.3 → 1.2.1
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 +97 -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 +54 -22
- 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 +3 -37
- 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,368 +0,0 @@
|
|
|
1
|
-
import { createHash } from 'node:crypto';
|
|
2
|
-
import { cpSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { dirname, join, resolve } from 'node:path';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
|
-
|
|
6
|
-
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
7
|
-
const DEFAULT_OUT_DIR = 'docs/paper/output/arxiv';
|
|
8
|
-
const SOURCE_MARKDOWN = 'docs/paper/audrey-paper-v1.md';
|
|
9
|
-
const SOURCE_BIB = 'docs/paper/references.bib';
|
|
10
|
-
const PUBLICATION_PACK = 'docs/paper/publication-pack.json';
|
|
11
|
-
const MANIFEST_FILE = 'arxiv-manifest.json';
|
|
12
|
-
const SEEDED_SECRET = 'sk-guardbench-secret-0000000000000000000000000000';
|
|
13
|
-
|
|
14
|
-
function fromRoot(path) {
|
|
15
|
-
return resolve(ROOT, path);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function readText(path) {
|
|
19
|
-
return readFileSync(fromRoot(path), 'utf-8');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function readJson(path) {
|
|
23
|
-
return JSON.parse(readText(path));
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function sha256File(path) {
|
|
27
|
-
return createHash('sha256').update(readFileSync(path)).digest('hex');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function countBibEntries(text) {
|
|
31
|
-
return [...text.matchAll(/@\w+\s*\{/g)].length;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function sanitizePublicText(text) {
|
|
35
|
-
return text
|
|
36
|
-
.replaceAll(SEEDED_SECRET, '[REDACTED:guardbench_seeded_secret]')
|
|
37
|
-
.replace(/\b[A-Z]:\\[^\s`|)\]]+/g, '[LOCAL-PATH]');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function latexEscape(text) {
|
|
41
|
-
return text
|
|
42
|
-
.replaceAll('\\', '\\textbackslash{}')
|
|
43
|
-
.replaceAll('&', '\\&')
|
|
44
|
-
.replaceAll('%', '\\%')
|
|
45
|
-
.replaceAll('$', '\\$')
|
|
46
|
-
.replaceAll('#', '\\#')
|
|
47
|
-
.replaceAll('_', '\\_')
|
|
48
|
-
.replaceAll('{', '\\{')
|
|
49
|
-
.replaceAll('}', '\\}')
|
|
50
|
-
.replaceAll('~', '\\textasciitilde{}')
|
|
51
|
-
.replaceAll('^', '\\textasciicircum{}');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function protectInline(text) {
|
|
55
|
-
const tokens = [];
|
|
56
|
-
const protect = value => {
|
|
57
|
-
const token = `@@AUDREY_LATEX_TOKEN_${tokens.length}@@`;
|
|
58
|
-
tokens.push([token, value]);
|
|
59
|
-
return token;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
let next = text.replace(/\[([^\]]+)\]\((https?:\/\/[^)]+)\)/g, (_, label, url) =>
|
|
63
|
-
protect(`\\href{${latexEscape(url)}}{${latexEscape(label)}}`),
|
|
64
|
-
);
|
|
65
|
-
next = next.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, label, url) =>
|
|
66
|
-
protect(`\\texttt{${latexEscape(label)}} (${latexEscape(url)})`),
|
|
67
|
-
);
|
|
68
|
-
next = next.replace(/\[@([^\]]+)\]/g, (_, rawIds) => {
|
|
69
|
-
const ids = rawIds
|
|
70
|
-
.split(/;\s*@?|\s*,\s*@?/)
|
|
71
|
-
.map(id => id.replace(/^@/, '').trim())
|
|
72
|
-
.filter(Boolean);
|
|
73
|
-
return protect(`\\cite{${ids.join(',')}}`);
|
|
74
|
-
});
|
|
75
|
-
next = next.replace(/`([^`]+)`/g, (_, value) => protect(`\\texttt{${latexEscape(value)}}`));
|
|
76
|
-
next = latexEscape(next);
|
|
77
|
-
for (const [token, value] of tokens) next = next.replaceAll(latexEscape(token), value);
|
|
78
|
-
return next;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function latexCommandForHeading(level) {
|
|
82
|
-
if (level <= 2) return 'section';
|
|
83
|
-
if (level === 3) return 'subsection';
|
|
84
|
-
return 'subsubsection';
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function isTableLine(line) {
|
|
88
|
-
return /^\s*\|.*\|\s*$/.test(line);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function isTableSeparator(line) {
|
|
92
|
-
return /^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)+\|?\s*$/.test(line);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function flushParagraph(lines, output) {
|
|
96
|
-
if (!lines.length) return;
|
|
97
|
-
output.push(`${protectInline(lines.join(' ').replace(/\s+/g, ' ').trim())}\n`);
|
|
98
|
-
lines.length = 0;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function flushList(items, output, environment) {
|
|
102
|
-
if (!items.length) return;
|
|
103
|
-
output.push(`\\begin{${environment}}`);
|
|
104
|
-
for (const item of items) output.push(`\\item ${protectInline(item)}`);
|
|
105
|
-
output.push(`\\end{${environment}}\n`);
|
|
106
|
-
items.length = 0;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function markdownToLatex(markdown) {
|
|
110
|
-
const lines = markdown.replace(/\r\n/g, '\n').split('\n');
|
|
111
|
-
const output = [];
|
|
112
|
-
const paragraph = [];
|
|
113
|
-
const bullets = [];
|
|
114
|
-
const numbers = [];
|
|
115
|
-
let inCode = false;
|
|
116
|
-
let code = [];
|
|
117
|
-
let codeBlocks = 0;
|
|
118
|
-
let tableBlocks = 0;
|
|
119
|
-
let skippedTitle = false;
|
|
120
|
-
|
|
121
|
-
function flushInlineBlocks() {
|
|
122
|
-
flushParagraph(paragraph, output);
|
|
123
|
-
flushList(bullets, output, 'itemize');
|
|
124
|
-
flushList(numbers, output, 'enumerate');
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
for (let i = 0; i < lines.length; i++) {
|
|
128
|
-
const line = lines[i];
|
|
129
|
-
if (/^```/.test(line)) {
|
|
130
|
-
if (inCode) {
|
|
131
|
-
output.push('\\begin{verbatim}');
|
|
132
|
-
output.push(...code);
|
|
133
|
-
output.push('\\end{verbatim}\n');
|
|
134
|
-
code = [];
|
|
135
|
-
inCode = false;
|
|
136
|
-
codeBlocks += 1;
|
|
137
|
-
} else {
|
|
138
|
-
flushInlineBlocks();
|
|
139
|
-
inCode = true;
|
|
140
|
-
}
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
if (inCode) {
|
|
144
|
-
code.push(line);
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
if (isTableLine(line)) {
|
|
148
|
-
flushInlineBlocks();
|
|
149
|
-
const table = [];
|
|
150
|
-
while (i < lines.length && isTableLine(lines[i])) {
|
|
151
|
-
if (!isTableSeparator(lines[i])) table.push(lines[i]);
|
|
152
|
-
i += 1;
|
|
153
|
-
}
|
|
154
|
-
i -= 1;
|
|
155
|
-
output.push('\\begin{verbatim}');
|
|
156
|
-
output.push(...table);
|
|
157
|
-
output.push('\\end{verbatim}\n');
|
|
158
|
-
tableBlocks += 1;
|
|
159
|
-
continue;
|
|
160
|
-
}
|
|
161
|
-
const heading = /^(#{1,6})\s+(.+)$/.exec(line);
|
|
162
|
-
if (heading) {
|
|
163
|
-
flushInlineBlocks();
|
|
164
|
-
if (!skippedTitle && heading[1].length === 1) {
|
|
165
|
-
skippedTitle = true;
|
|
166
|
-
continue;
|
|
167
|
-
}
|
|
168
|
-
const command = latexCommandForHeading(heading[1].length);
|
|
169
|
-
output.push(`\\${command}{${protectInline(heading[2])}}\n`);
|
|
170
|
-
continue;
|
|
171
|
-
}
|
|
172
|
-
const bullet = /^\s*[-*]\s+(.+)$/.exec(line);
|
|
173
|
-
if (bullet) {
|
|
174
|
-
flushParagraph(paragraph, output);
|
|
175
|
-
flushList(numbers, output, 'enumerate');
|
|
176
|
-
bullets.push(bullet[1]);
|
|
177
|
-
continue;
|
|
178
|
-
}
|
|
179
|
-
const numbered = /^\s*\d+\.\s+(.+)$/.exec(line);
|
|
180
|
-
if (numbered) {
|
|
181
|
-
flushParagraph(paragraph, output);
|
|
182
|
-
flushList(bullets, output, 'itemize');
|
|
183
|
-
numbers.push(numbered[1]);
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
if (!line.trim()) {
|
|
187
|
-
flushInlineBlocks();
|
|
188
|
-
continue;
|
|
189
|
-
}
|
|
190
|
-
paragraph.push(line.trim());
|
|
191
|
-
}
|
|
192
|
-
flushInlineBlocks();
|
|
193
|
-
|
|
194
|
-
return {
|
|
195
|
-
body: output.join('\n'),
|
|
196
|
-
codeBlocks,
|
|
197
|
-
tableBlocks,
|
|
198
|
-
citationCount: [...output.join('\n').matchAll(/\\cite\{/g)].length,
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function publicationEntry(pack, id) {
|
|
203
|
-
const entry = pack.entries.find(row => row.id === id);
|
|
204
|
-
if (!entry) throw new Error(`Missing publication-pack entry: ${id}`);
|
|
205
|
-
return entry.text;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function buildLatex() {
|
|
209
|
-
const pack = readJson(PUBLICATION_PACK);
|
|
210
|
-
const markdown = sanitizePublicText(readText(SOURCE_MARKDOWN));
|
|
211
|
-
const converted = markdownToLatex(markdown);
|
|
212
|
-
const title = publicationEntry(pack, 'arxiv-title');
|
|
213
|
-
const abstract = sanitizePublicText(publicationEntry(pack, 'arxiv-abstract'));
|
|
214
|
-
|
|
215
|
-
const tex = `\\documentclass[11pt]{article}
|
|
216
|
-
\\usepackage[margin=1in]{geometry}
|
|
217
|
-
\\usepackage[T1]{fontenc}
|
|
218
|
-
\\usepackage[utf8]{inputenc}
|
|
219
|
-
\\usepackage{hyperref}
|
|
220
|
-
\\usepackage{url}
|
|
221
|
-
\\usepackage{verbatim}
|
|
222
|
-
|
|
223
|
-
\\title{${protectInline(title)}}
|
|
224
|
-
\\author{Tyler Eveland}
|
|
225
|
-
\\date{\\today}
|
|
226
|
-
|
|
227
|
-
\\begin{document}
|
|
228
|
-
\\maketitle
|
|
229
|
-
|
|
230
|
-
\\begin{abstract}
|
|
231
|
-
${protectInline(abstract)}
|
|
232
|
-
\\end{abstract}
|
|
233
|
-
|
|
234
|
-
${converted.body}
|
|
235
|
-
|
|
236
|
-
\\bibliographystyle{plain}
|
|
237
|
-
\\bibliography{references}
|
|
238
|
-
|
|
239
|
-
\\end{document}
|
|
240
|
-
`;
|
|
241
|
-
|
|
242
|
-
return {
|
|
243
|
-
tex,
|
|
244
|
-
citationCount: converted.citationCount,
|
|
245
|
-
codeBlocks: converted.codeBlocks,
|
|
246
|
-
tableBlocks: converted.tableBlocks,
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
function fileRecord(outDir, path, source) {
|
|
251
|
-
const absolute = join(outDir, path);
|
|
252
|
-
return {
|
|
253
|
-
path,
|
|
254
|
-
source,
|
|
255
|
-
bytes: readFileSync(absolute).byteLength,
|
|
256
|
-
sha256: sha256File(absolute),
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
function parseArgs(argv = process.argv.slice(2)) {
|
|
261
|
-
const args = {
|
|
262
|
-
outDir: DEFAULT_OUT_DIR,
|
|
263
|
-
json: false,
|
|
264
|
-
};
|
|
265
|
-
for (let i = 0; i < argv.length; i++) {
|
|
266
|
-
const token = argv[i];
|
|
267
|
-
if (token === '--out-dir' && argv[i + 1]) args.outDir = argv[++i];
|
|
268
|
-
else if (token === '--json') args.json = true;
|
|
269
|
-
else if (token === '--help' || token === '-h') args.help = true;
|
|
270
|
-
else throw new Error(`Unknown argument: ${token}`);
|
|
271
|
-
}
|
|
272
|
-
return args;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
function usage() {
|
|
276
|
-
return `Usage: node scripts/create-arxiv-source.mjs [options]
|
|
277
|
-
|
|
278
|
-
Options:
|
|
279
|
-
--out-dir <path> Output directory. Default: ${DEFAULT_OUT_DIR}.
|
|
280
|
-
--json Print the machine-readable manifest.
|
|
281
|
-
`;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
export function writeArxivSourcePackage(options = {}) {
|
|
285
|
-
const outDir = resolve(ROOT, options.outDir ?? DEFAULT_OUT_DIR);
|
|
286
|
-
const bib = readText(SOURCE_BIB);
|
|
287
|
-
const built = buildLatex();
|
|
288
|
-
rmSync(outDir, { recursive: true, force: true });
|
|
289
|
-
mkdirSync(outDir, { recursive: true });
|
|
290
|
-
|
|
291
|
-
writeFileSync(join(outDir, 'main.tex'), built.tex, 'utf-8');
|
|
292
|
-
cpSync(fromRoot(SOURCE_BIB), join(outDir, 'references.bib'));
|
|
293
|
-
writeFileSync(
|
|
294
|
-
join(outDir, 'README-arxiv.txt'),
|
|
295
|
-
[
|
|
296
|
-
'Audrey arXiv source package',
|
|
297
|
-
'',
|
|
298
|
-
'Main file: main.tex',
|
|
299
|
-
'Bibliography: references.bib',
|
|
300
|
-
'',
|
|
301
|
-
'Generated from docs/paper/audrey-paper-v1.md and docs/paper/publication-pack.json.',
|
|
302
|
-
'This host did not require a local TeX compiler to generate the source package.',
|
|
303
|
-
'Before final arXiv upload, compile with a TeX toolchain and preview the PDF in arXiv.',
|
|
304
|
-
'',
|
|
305
|
-
].join('\n'),
|
|
306
|
-
'utf-8',
|
|
307
|
-
);
|
|
308
|
-
|
|
309
|
-
const files = [
|
|
310
|
-
fileRecord(outDir, 'main.tex', SOURCE_MARKDOWN),
|
|
311
|
-
fileRecord(outDir, 'references.bib', SOURCE_BIB),
|
|
312
|
-
fileRecord(outDir, 'README-arxiv.txt', 'generated'),
|
|
313
|
-
];
|
|
314
|
-
const manifest = {
|
|
315
|
-
schemaVersion: '1.0.0',
|
|
316
|
-
suite: 'Audrey arXiv source package',
|
|
317
|
-
generatedAt: new Date().toISOString(),
|
|
318
|
-
sourceMarkdown: SOURCE_MARKDOWN,
|
|
319
|
-
publicationPack: PUBLICATION_PACK,
|
|
320
|
-
sourceHashes: {
|
|
321
|
-
sourceMarkdown: sha256File(fromRoot(SOURCE_MARKDOWN)),
|
|
322
|
-
publicationPack: sha256File(fromRoot(PUBLICATION_PACK)),
|
|
323
|
-
referencesBib: sha256File(fromRoot(SOURCE_BIB)),
|
|
324
|
-
},
|
|
325
|
-
files,
|
|
326
|
-
tex: {
|
|
327
|
-
mainFile: 'main.tex',
|
|
328
|
-
titleEntry: 'arxiv-title',
|
|
329
|
-
abstractEntry: 'arxiv-abstract',
|
|
330
|
-
citationCount: built.citationCount,
|
|
331
|
-
bibEntryCount: countBibEntries(bib),
|
|
332
|
-
codeBlocks: built.codeBlocks,
|
|
333
|
-
tableBlocks: built.tableBlocks,
|
|
334
|
-
},
|
|
335
|
-
};
|
|
336
|
-
writeFileSync(join(outDir, MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}\n`, 'utf-8');
|
|
337
|
-
|
|
338
|
-
return {
|
|
339
|
-
outDir,
|
|
340
|
-
manifestPath: join(outDir, MANIFEST_FILE),
|
|
341
|
-
manifest,
|
|
342
|
-
files: files.map(file => file.path),
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
function main() {
|
|
347
|
-
const args = parseArgs();
|
|
348
|
-
if (args.help) {
|
|
349
|
-
console.log(usage());
|
|
350
|
-
return;
|
|
351
|
-
}
|
|
352
|
-
const result = writeArxivSourcePackage(args);
|
|
353
|
-
if (args.json) console.log(JSON.stringify(result.manifest, null, 2));
|
|
354
|
-
else {
|
|
355
|
-
console.log(`arXiv source package: ${result.outDir}`);
|
|
356
|
-
console.log(`Files: ${result.files.length}`);
|
|
357
|
-
console.log(`Manifest: ${result.manifestPath}`);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
362
|
-
try {
|
|
363
|
-
main();
|
|
364
|
-
} catch (error) {
|
|
365
|
-
console.error(error.stack ?? error.message);
|
|
366
|
-
process.exit(1);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { createHash } from 'node:crypto';
|
|
2
|
-
import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import { verifyPaperClaims } from './verify-paper-claims.mjs';
|
|
6
|
-
import { verifyPublicationPack } from './verify-publication-pack.mjs';
|
|
7
|
-
|
|
8
|
-
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
9
|
-
const DEFAULT_OUT_DIR = 'docs/paper/output/submission-bundle';
|
|
10
|
-
const PAPER_FILES = [
|
|
11
|
-
'README.md',
|
|
12
|
-
'LICENSE',
|
|
13
|
-
'package.json',
|
|
14
|
-
'docs/AUDREY_PAPER_OUTLINE.md',
|
|
15
|
-
'docs/paper/00-master.md',
|
|
16
|
-
'docs/paper/01-introduction.md',
|
|
17
|
-
'docs/paper/02-related-work.md',
|
|
18
|
-
'docs/paper/03-problem-definition.md',
|
|
19
|
-
'docs/paper/04-design.md',
|
|
20
|
-
'docs/paper/05-guardbench-spec.md',
|
|
21
|
-
'docs/paper/06-implementation.md',
|
|
22
|
-
'docs/paper/07-evaluation.md',
|
|
23
|
-
'docs/paper/08-discussion-limitations.md',
|
|
24
|
-
'docs/paper/09-conclusion.md',
|
|
25
|
-
'docs/paper/appendix-a-demo-transcript.md',
|
|
26
|
-
'docs/paper/arxiv-compile-report.schema.json',
|
|
27
|
-
'docs/paper/arxiv-source.schema.json',
|
|
28
|
-
'docs/paper/audrey-paper-v1.md',
|
|
29
|
-
'docs/paper/browser-launch-plan.json',
|
|
30
|
-
'docs/paper/browser-launch-plan.schema.json',
|
|
31
|
-
'docs/paper/browser-launch-results.json',
|
|
32
|
-
'docs/paper/browser-launch-results.schema.json',
|
|
33
|
-
'docs/paper/claim-register.json',
|
|
34
|
-
'docs/paper/claim-register.schema.json',
|
|
35
|
-
'docs/paper/evidence-ledger.md',
|
|
36
|
-
'docs/paper/paper-submission-bundle.schema.json',
|
|
37
|
-
'docs/paper/publication-pack.json',
|
|
38
|
-
'docs/paper/publication-pack.schema.json',
|
|
39
|
-
'docs/paper/references.bib',
|
|
40
|
-
'docs/paper/SUBMISSION_README.md',
|
|
41
|
-
'docs/paper/output/arxiv/main.tex',
|
|
42
|
-
'docs/paper/output/arxiv/references.bib',
|
|
43
|
-
'docs/paper/output/arxiv/README-arxiv.txt',
|
|
44
|
-
'docs/paper/output/arxiv/arxiv-manifest.json',
|
|
45
|
-
'docs/paper/output/arxiv-compile-report.json',
|
|
46
|
-
];
|
|
47
|
-
const OPTIONAL_PAPER_FILES = [
|
|
48
|
-
'docs/paper/output/arxiv-compile/main.pdf',
|
|
49
|
-
'docs/paper/output/arxiv-compile/arxiv-compile.log',
|
|
50
|
-
];
|
|
51
|
-
const BENCHMARK_FILES = [
|
|
52
|
-
'benchmarks/output/summary.json',
|
|
53
|
-
'benchmarks/output/guardbench-manifest.json',
|
|
54
|
-
'benchmarks/output/guardbench-summary.json',
|
|
55
|
-
'benchmarks/output/guardbench-raw.json',
|
|
56
|
-
'benchmarks/output/guardbench-conformance-card.json',
|
|
57
|
-
'benchmarks/output/adapter-self-test/guardbench-adapter-self-test.json',
|
|
58
|
-
'benchmarks/output/external/guardbench-external-dry-run.json',
|
|
59
|
-
'benchmarks/output/external/guardbench-external-evidence.json',
|
|
60
|
-
'benchmarks/output/leaderboard/guardbench-leaderboard.json',
|
|
61
|
-
'benchmarks/output/leaderboard/guardbench-leaderboard.md',
|
|
62
|
-
'benchmarks/output/submission-bundle/submission-manifest.json',
|
|
63
|
-
'benchmarks/output/submission-bundle/validation-report.json',
|
|
64
|
-
];
|
|
65
|
-
const SCHEMA_FILES = [
|
|
66
|
-
'benchmarks/schemas/guardbench-adapter-registry.schema.json',
|
|
67
|
-
'benchmarks/schemas/guardbench-adapter-self-test.schema.json',
|
|
68
|
-
'benchmarks/schemas/guardbench-conformance-card.schema.json',
|
|
69
|
-
'benchmarks/schemas/guardbench-external-dry-run.schema.json',
|
|
70
|
-
'benchmarks/schemas/guardbench-external-evidence.schema.json',
|
|
71
|
-
'benchmarks/schemas/guardbench-external-run.schema.json',
|
|
72
|
-
'benchmarks/schemas/guardbench-leaderboard.schema.json',
|
|
73
|
-
'benchmarks/schemas/guardbench-manifest.schema.json',
|
|
74
|
-
'benchmarks/schemas/guardbench-publication-verification.schema.json',
|
|
75
|
-
'benchmarks/schemas/guardbench-raw.schema.json',
|
|
76
|
-
'benchmarks/schemas/guardbench-submission-manifest.schema.json',
|
|
77
|
-
'benchmarks/schemas/guardbench-summary.schema.json',
|
|
78
|
-
];
|
|
79
|
-
|
|
80
|
-
function fromRoot(path) {
|
|
81
|
-
return resolve(ROOT, path);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function readJson(path) {
|
|
85
|
-
return JSON.parse(readFileSync(fromRoot(path), 'utf-8'));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function sha256File(path) {
|
|
89
|
-
return createHash('sha256').update(readFileSync(path)).digest('hex');
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function bundleDisplayPath(path) {
|
|
93
|
-
const rel = relative(ROOT, path);
|
|
94
|
-
if (rel && !rel.startsWith('..') && !isAbsolute(rel)) return rel.replaceAll('\\', '/');
|
|
95
|
-
return path.replaceAll('\\', '/');
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function parseArgs(argv = process.argv.slice(2)) {
|
|
99
|
-
const args = {
|
|
100
|
-
outDir: DEFAULT_OUT_DIR,
|
|
101
|
-
json: false,
|
|
102
|
-
};
|
|
103
|
-
for (let i = 0; i < argv.length; i++) {
|
|
104
|
-
const token = argv[i];
|
|
105
|
-
if (token === '--out-dir' && argv[i + 1]) args.outDir = argv[++i];
|
|
106
|
-
else if (token === '--json') args.json = true;
|
|
107
|
-
else if (token === '--help' || token === '-h') args.help = true;
|
|
108
|
-
else throw new Error(`Unknown argument: ${token}`);
|
|
109
|
-
}
|
|
110
|
-
return args;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function usage() {
|
|
114
|
-
return `Usage: node scripts/create-paper-submission-bundle.mjs [options]
|
|
115
|
-
|
|
116
|
-
Options:
|
|
117
|
-
--out-dir <path> Output directory. Default: ${DEFAULT_OUT_DIR}.
|
|
118
|
-
--json Print the machine-readable bundle manifest.
|
|
119
|
-
`;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function copyIntoBundle(source, outDir) {
|
|
123
|
-
const sourcePath = fromRoot(source);
|
|
124
|
-
if (!existsSync(sourcePath)) throw new Error(`Missing source file for paper bundle: ${source}`);
|
|
125
|
-
const target = join(outDir, source.replaceAll('\\', '/'));
|
|
126
|
-
mkdirSync(dirname(target), { recursive: true });
|
|
127
|
-
cpSync(sourcePath, target);
|
|
128
|
-
return {
|
|
129
|
-
path: relative(outDir, target).replaceAll('\\', '/'),
|
|
130
|
-
source,
|
|
131
|
-
bytes: readFileSync(target).byteLength,
|
|
132
|
-
sha256: sha256File(target),
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export async function writePaperSubmissionBundle(options = {}) {
|
|
137
|
-
const outDir = fromRoot(options.outDir ?? DEFAULT_OUT_DIR);
|
|
138
|
-
const claimVerification = await verifyPaperClaims();
|
|
139
|
-
const publicationPackVerification = await verifyPublicationPack();
|
|
140
|
-
if (!claimVerification.ok) {
|
|
141
|
-
throw new Error(
|
|
142
|
-
`Cannot create paper submission bundle with invalid claims: ${claimVerification.failures.join('; ')}`,
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
if (!publicationPackVerification.ok) {
|
|
146
|
-
throw new Error(
|
|
147
|
-
`Cannot create paper submission bundle with invalid publication pack: ${publicationPackVerification.failures.join('; ')}`,
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
rmSync(outDir, { recursive: true, force: true });
|
|
152
|
-
mkdirSync(outDir, { recursive: true });
|
|
153
|
-
const optionalFiles = OPTIONAL_PAPER_FILES.filter(source => existsSync(fromRoot(source)));
|
|
154
|
-
const files = [...PAPER_FILES, ...optionalFiles, ...BENCHMARK_FILES, ...SCHEMA_FILES]
|
|
155
|
-
.map(source => copyIntoBundle(source, outDir))
|
|
156
|
-
.sort((a, b) => a.path.localeCompare(b.path));
|
|
157
|
-
const guardSummary = readJson('benchmarks/output/guardbench-summary.json');
|
|
158
|
-
const manifest = {
|
|
159
|
-
schemaVersion: '1.0.0',
|
|
160
|
-
suite: 'Audrey paper submission bundle',
|
|
161
|
-
generatedAt: new Date().toISOString(),
|
|
162
|
-
sourceRoot: '.',
|
|
163
|
-
outDir: bundleDisplayPath(outDir),
|
|
164
|
-
claimVerification: {
|
|
165
|
-
ok: claimVerification.ok,
|
|
166
|
-
count: claimVerification.claims.length,
|
|
167
|
-
},
|
|
168
|
-
publicationPackVerification: {
|
|
169
|
-
ok: publicationPackVerification.ok,
|
|
170
|
-
count: publicationPackVerification.entries.length,
|
|
171
|
-
},
|
|
172
|
-
guardBenchSnapshot: {
|
|
173
|
-
passed: guardSummary.passed,
|
|
174
|
-
scenarios: guardSummary.scenarios,
|
|
175
|
-
redactionLeaks: guardSummary.redactionLeaks,
|
|
176
|
-
artifactLeaks: guardSummary.artifactRedactionSweep?.leakCount ?? 0,
|
|
177
|
-
latencyP50Ms: guardSummary.latency?.p50Ms ?? 0,
|
|
178
|
-
latencyP95Ms: guardSummary.latency?.p95Ms ?? 0,
|
|
179
|
-
},
|
|
180
|
-
files,
|
|
181
|
-
};
|
|
182
|
-
const manifestPath = join(outDir, 'paper-submission-manifest.json');
|
|
183
|
-
writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`, 'utf-8');
|
|
184
|
-
|
|
185
|
-
return {
|
|
186
|
-
outDir,
|
|
187
|
-
manifestPath,
|
|
188
|
-
manifest,
|
|
189
|
-
files: files.map(file => file.path),
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
async function main() {
|
|
194
|
-
const args = parseArgs();
|
|
195
|
-
if (args.help) {
|
|
196
|
-
console.log(usage());
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const result = await writePaperSubmissionBundle(args);
|
|
201
|
-
if (args.json) console.log(JSON.stringify(result.manifest, null, 2));
|
|
202
|
-
else {
|
|
203
|
-
console.log(`Paper submission bundle: ${result.outDir}`);
|
|
204
|
-
console.log(`Files: ${result.manifest.files.length}`);
|
|
205
|
-
console.log(`Manifest: ${result.manifestPath}`);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
210
|
-
main().catch(error => {
|
|
211
|
-
console.error(error.stack ?? error.message);
|
|
212
|
-
process.exit(1);
|
|
213
|
-
});
|
|
214
|
-
}
|