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
package/benchmarks/report.js
DELETED
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
|
|
4
|
-
const PALETTE = {
|
|
5
|
-
audrey: '#0f766e',
|
|
6
|
-
vector: '#0369a1',
|
|
7
|
-
keyword: '#6d28d9',
|
|
8
|
-
recent: '#b45309',
|
|
9
|
-
external: '#1d4ed8',
|
|
10
|
-
accent: '#111827',
|
|
11
|
-
muted: '#6b7280',
|
|
12
|
-
surface: '#f8fafc',
|
|
13
|
-
border: '#cbd5e1',
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
function escapeHtml(text) {
|
|
17
|
-
return String(text)
|
|
18
|
-
.replaceAll('&', '&')
|
|
19
|
-
.replaceAll('<', '<')
|
|
20
|
-
.replaceAll('>', '>')
|
|
21
|
-
.replaceAll('"', '"');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function chartBarColor(label) {
|
|
25
|
-
if (label === 'Audrey') return PALETTE.audrey;
|
|
26
|
-
if (label.includes('Vector')) return PALETTE.vector;
|
|
27
|
-
if (label.includes('Keyword')) return PALETTE.keyword;
|
|
28
|
-
if (label.includes('Recent')) return PALETTE.recent;
|
|
29
|
-
return PALETTE.external;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function renderBarChart({ title, rows, valueSuffix = '%', maxValue = 100 }) {
|
|
33
|
-
const width = 960;
|
|
34
|
-
const height = 420;
|
|
35
|
-
const margin = { top: 56, right: 32, bottom: 88, left: 64 };
|
|
36
|
-
const plotWidth = width - margin.left - margin.right;
|
|
37
|
-
const plotHeight = height - margin.top - margin.bottom;
|
|
38
|
-
const barWidth = Math.max(32, Math.floor(plotWidth / Math.max(rows.length, 1)) - 18);
|
|
39
|
-
const gap = rows.length > 1 ? (plotWidth - barWidth * rows.length) / (rows.length - 1) : 0;
|
|
40
|
-
|
|
41
|
-
const bars = rows
|
|
42
|
-
.map((row, index) => {
|
|
43
|
-
const value = Math.max(0, Math.min(maxValue, row.value));
|
|
44
|
-
const barHeight = (value / maxValue) * plotHeight;
|
|
45
|
-
const x = margin.left + index * (barWidth + gap);
|
|
46
|
-
const y = margin.top + plotHeight - barHeight;
|
|
47
|
-
return `
|
|
48
|
-
<rect x="${x}" y="${y}" width="${barWidth}" height="${barHeight}" rx="8" fill="${chartBarColor(row.label)}" />
|
|
49
|
-
<text x="${x + barWidth / 2}" y="${y - 10}" text-anchor="middle" font-size="15" fill="${PALETTE.accent}">${value.toFixed(1)}${valueSuffix}</text>
|
|
50
|
-
<text x="${x + barWidth / 2}" y="${height - 42}" text-anchor="middle" font-size="14" fill="${PALETTE.muted}">${escapeHtml(row.label)}</text>
|
|
51
|
-
`;
|
|
52
|
-
})
|
|
53
|
-
.join('\n');
|
|
54
|
-
|
|
55
|
-
const grid = [0, 25, 50, 75, 100]
|
|
56
|
-
.map(tick => {
|
|
57
|
-
const y = margin.top + plotHeight - (tick / maxValue) * plotHeight;
|
|
58
|
-
return `
|
|
59
|
-
<line x1="${margin.left}" y1="${y}" x2="${width - margin.right}" y2="${y}" stroke="${PALETTE.border}" stroke-dasharray="4 4" />
|
|
60
|
-
<text x="${margin.left - 10}" y="${y + 5}" text-anchor="end" font-size="13" fill="${PALETTE.muted}">${tick}${valueSuffix}</text>
|
|
61
|
-
`;
|
|
62
|
-
})
|
|
63
|
-
.join('\n');
|
|
64
|
-
|
|
65
|
-
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
66
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" role="img" aria-label="${escapeHtml(title)}">
|
|
67
|
-
<rect width="100%" height="100%" fill="white" />
|
|
68
|
-
<text x="${margin.left}" y="34" font-size="24" font-weight="700" fill="${PALETTE.accent}">${escapeHtml(title)}</text>
|
|
69
|
-
${grid}
|
|
70
|
-
${bars}
|
|
71
|
-
</svg>`;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function renderTrendList(trends) {
|
|
75
|
-
return trends
|
|
76
|
-
.map(
|
|
77
|
-
trend => `
|
|
78
|
-
<li>
|
|
79
|
-
<strong>${escapeHtml(trend.title)}</strong><br />
|
|
80
|
-
${escapeHtml(trend.summary)}<br />
|
|
81
|
-
<a href="${trend.source}">${escapeHtml(trend.source)}</a>
|
|
82
|
-
</li>
|
|
83
|
-
`,
|
|
84
|
-
)
|
|
85
|
-
.join('\n');
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function renderCaseRows(localCases) {
|
|
89
|
-
return localCases
|
|
90
|
-
.map(
|
|
91
|
-
caseResult => `
|
|
92
|
-
<tr>
|
|
93
|
-
<td>${escapeHtml(caseResult.title)}</td>
|
|
94
|
-
<td>${escapeHtml(caseResult.suite)}</td>
|
|
95
|
-
<td>${escapeHtml(caseResult.family)}</td>
|
|
96
|
-
${caseResult.results
|
|
97
|
-
.map(result => {
|
|
98
|
-
const bg = result.passed ? '#ecfdf5' : result.score >= 0.5 ? '#fff7ed' : '#fef2f2';
|
|
99
|
-
const fg = result.passed ? '#065f46' : result.score >= 0.5 ? '#9a3412' : '#991b1b';
|
|
100
|
-
return `<td style="background:${bg};color:${fg}">${result.score.toFixed(2)}<br /><span style="font-size:12px">${escapeHtml(result.summary)}</span></td>`;
|
|
101
|
-
})
|
|
102
|
-
.join('')}
|
|
103
|
-
</tr>
|
|
104
|
-
`,
|
|
105
|
-
)
|
|
106
|
-
.join('\n');
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function renderSuiteSections(suiteCharts) {
|
|
110
|
-
if (suiteCharts.length === 0) return '';
|
|
111
|
-
return suiteCharts
|
|
112
|
-
.map(
|
|
113
|
-
chart => `
|
|
114
|
-
<section class="callout">
|
|
115
|
-
<h2>${escapeHtml(chart.title)}</h2>
|
|
116
|
-
<p>${escapeHtml(chart.description)}</p>
|
|
117
|
-
<img src="./${escapeHtml(chart.fileName)}" alt="${escapeHtml(chart.title)} chart" />
|
|
118
|
-
</section>
|
|
119
|
-
`,
|
|
120
|
-
)
|
|
121
|
-
.join('\n');
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export function writeBenchmarkArtifacts({
|
|
125
|
-
outputDir,
|
|
126
|
-
summary,
|
|
127
|
-
localOverall,
|
|
128
|
-
localSuites,
|
|
129
|
-
externalOverall,
|
|
130
|
-
trends,
|
|
131
|
-
readmeAssetsDir,
|
|
132
|
-
}) {
|
|
133
|
-
mkdirSync(outputDir, { recursive: true });
|
|
134
|
-
|
|
135
|
-
const localChartTitle =
|
|
136
|
-
summary.local?.overall_scope === 'comparable_suites'
|
|
137
|
-
? 'Audrey vs Comparable Local Memory Baselines'
|
|
138
|
-
: 'Selected Audrey Regression Suite';
|
|
139
|
-
const localChart = renderBarChart({
|
|
140
|
-
title: localChartTitle,
|
|
141
|
-
rows: localOverall.map(row => ({ label: row.system, value: row.scorePercent })),
|
|
142
|
-
});
|
|
143
|
-
const externalChart = renderBarChart({
|
|
144
|
-
title: 'Published LLM Memory Standards (LoCoMo)',
|
|
145
|
-
rows: externalOverall.map(row => ({ label: row.system, value: row.score })),
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
writeFileSync(join(outputDir, 'local-overall.svg'), localChart, 'utf8');
|
|
149
|
-
writeFileSync(join(outputDir, 'published-locomo.svg'), externalChart, 'utf8');
|
|
150
|
-
writeFileSync(join(outputDir, 'summary.json'), JSON.stringify(summary, null, 2), 'utf8');
|
|
151
|
-
|
|
152
|
-
const suiteCharts = localSuites.map(suite => {
|
|
153
|
-
const fileName = `${suite.id}-overall.svg`;
|
|
154
|
-
const chart = renderBarChart({
|
|
155
|
-
title: `${suite.title} Benchmark`,
|
|
156
|
-
rows: suite.overall.map(row => ({ label: row.system, value: row.scorePercent })),
|
|
157
|
-
});
|
|
158
|
-
writeFileSync(join(outputDir, fileName), chart, 'utf8');
|
|
159
|
-
return {
|
|
160
|
-
id: suite.id,
|
|
161
|
-
title: `${suite.title} Benchmark`,
|
|
162
|
-
description: suite.description,
|
|
163
|
-
fileName,
|
|
164
|
-
path: join(outputDir, fileName),
|
|
165
|
-
};
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
let readmeAssets = null;
|
|
169
|
-
if (readmeAssetsDir) {
|
|
170
|
-
mkdirSync(readmeAssetsDir, { recursive: true });
|
|
171
|
-
const localReadmeChart = join(readmeAssetsDir, 'local-benchmark.svg');
|
|
172
|
-
const externalReadmeChart = join(readmeAssetsDir, 'published-memory-standards.svg');
|
|
173
|
-
writeFileSync(localReadmeChart, localChart, 'utf8');
|
|
174
|
-
writeFileSync(externalReadmeChart, externalChart, 'utf8');
|
|
175
|
-
|
|
176
|
-
const operationsSuite = suiteCharts.find(chart => chart.id === 'operations');
|
|
177
|
-
let operationsReadmeChart = null;
|
|
178
|
-
if (operationsSuite) {
|
|
179
|
-
operationsReadmeChart = join(readmeAssetsDir, 'operations-benchmark.svg');
|
|
180
|
-
writeFileSync(
|
|
181
|
-
operationsReadmeChart,
|
|
182
|
-
renderBarChart({
|
|
183
|
-
title: 'Audrey Memory Operations Benchmark',
|
|
184
|
-
rows: (localSuites.find(suite => suite.id === 'operations')?.overall || []).map(row => ({
|
|
185
|
-
label: row.system,
|
|
186
|
-
value: row.scorePercent,
|
|
187
|
-
})),
|
|
188
|
-
}),
|
|
189
|
-
'utf8',
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
readmeAssets = {
|
|
194
|
-
localChart: localReadmeChart,
|
|
195
|
-
operationsChart: operationsReadmeChart,
|
|
196
|
-
externalChart: externalReadmeChart,
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
const html = `<!doctype html>
|
|
201
|
-
<html lang="en">
|
|
202
|
-
<head>
|
|
203
|
-
<meta charset="utf-8" />
|
|
204
|
-
<title>Audrey Memory Benchmark</title>
|
|
205
|
-
<style>
|
|
206
|
-
body { font-family: "Segoe UI", Arial, sans-serif; margin: 32px; color: ${PALETTE.accent}; background: ${PALETTE.surface}; }
|
|
207
|
-
main { max-width: 1120px; margin: 0 auto; }
|
|
208
|
-
h1, h2 { margin-bottom: 12px; }
|
|
209
|
-
p, li { line-height: 1.5; }
|
|
210
|
-
.callout { background: white; border: 1px solid ${PALETTE.border}; border-radius: 16px; padding: 20px; margin-bottom: 24px; }
|
|
211
|
-
.grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
|
|
212
|
-
img { width: 100%; border: 1px solid ${PALETTE.border}; border-radius: 16px; background: white; }
|
|
213
|
-
table { width: 100%; border-collapse: collapse; background: white; border-radius: 16px; overflow: hidden; }
|
|
214
|
-
th, td { border: 1px solid ${PALETTE.border}; padding: 12px; vertical-align: top; text-align: left; }
|
|
215
|
-
th { background: #e2e8f0; }
|
|
216
|
-
code { background: #e2e8f0; padding: 2px 6px; border-radius: 6px; }
|
|
217
|
-
</style>
|
|
218
|
-
</head>
|
|
219
|
-
<body>
|
|
220
|
-
<main>
|
|
221
|
-
<h1>Audrey Memory Benchmark</h1>
|
|
222
|
-
<div class="callout">
|
|
223
|
-
<p><strong>Method:</strong> Audrey is scored on a local regression suite inspired by LongMemEval-style retrieval, operation-level lifecycle behavior, and agent guard-loop benchmarks. The combined local chart uses comparable retrieval/lifecycle suites when available; the guard loop is reported as its own controller regression suite. Published external LoCoMo numbers stay separate so the comparison remains honest.</p>
|
|
224
|
-
<p><strong>Scope:</strong> ${escapeHtml(summary.local?.overall_scope ?? 'unknown')} across ${escapeHtml((summary.local?.overall_suite_ids ?? []).join(', '))}; ${summary.local?.cases?.length ?? 0} total cases.</p>
|
|
225
|
-
<p><strong>Run:</strong> <code>${escapeHtml(summary.command)}</code></p>
|
|
226
|
-
<p><strong>Generated:</strong> ${escapeHtml(summary.generatedAt)}</p>
|
|
227
|
-
</div>
|
|
228
|
-
|
|
229
|
-
<div class="grid">
|
|
230
|
-
<section class="callout">
|
|
231
|
-
<h2>Combined Local Benchmark</h2>
|
|
232
|
-
<img src="./local-overall.svg" alt="Combined local benchmark bar chart" />
|
|
233
|
-
</section>
|
|
234
|
-
|
|
235
|
-
${renderSuiteSections(suiteCharts)}
|
|
236
|
-
|
|
237
|
-
<section class="callout">
|
|
238
|
-
<h2>Published Leaderboard</h2>
|
|
239
|
-
<img src="./published-locomo.svg" alt="Published LoCoMo leaderboard bar chart" />
|
|
240
|
-
</section>
|
|
241
|
-
</div>
|
|
242
|
-
|
|
243
|
-
<section class="callout">
|
|
244
|
-
<h2>Case Matrix</h2>
|
|
245
|
-
<table>
|
|
246
|
-
<thead>
|
|
247
|
-
<tr>
|
|
248
|
-
<th>Case</th>
|
|
249
|
-
<th>Suite</th>
|
|
250
|
-
<th>Family</th>
|
|
251
|
-
${summary.local.overall.map(row => `<th>${escapeHtml(row.system)}</th>`).join('')}
|
|
252
|
-
</tr>
|
|
253
|
-
</thead>
|
|
254
|
-
<tbody>
|
|
255
|
-
${renderCaseRows(summary.local.cases)}
|
|
256
|
-
</tbody>
|
|
257
|
-
</table>
|
|
258
|
-
</section>
|
|
259
|
-
|
|
260
|
-
<section class="callout">
|
|
261
|
-
<h2>March 23, 2026 Memory Trends</h2>
|
|
262
|
-
<ul>
|
|
263
|
-
${renderTrendList(trends)}
|
|
264
|
-
</ul>
|
|
265
|
-
</section>
|
|
266
|
-
</main>
|
|
267
|
-
</body>
|
|
268
|
-
</html>`;
|
|
269
|
-
|
|
270
|
-
writeFileSync(join(outputDir, 'report.html'), html, 'utf8');
|
|
271
|
-
|
|
272
|
-
return {
|
|
273
|
-
json: join(outputDir, 'summary.json'),
|
|
274
|
-
html: join(outputDir, 'report.html'),
|
|
275
|
-
localChart: join(outputDir, 'local-overall.svg'),
|
|
276
|
-
suiteCharts,
|
|
277
|
-
externalChart: join(outputDir, 'published-locomo.svg'),
|
|
278
|
-
readmeAssets,
|
|
279
|
-
};
|
|
280
|
-
}
|
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
2
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { basename, dirname, resolve } from 'node:path';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import { writeGuardBenchConformanceCard } from './create-conformance-card.mjs';
|
|
6
|
-
import {
|
|
7
|
-
computeGuardBenchArtifactHashes,
|
|
8
|
-
validateGuardBenchArtifacts,
|
|
9
|
-
} from './validate-guardbench-artifacts.mjs';
|
|
10
|
-
import { publicArtifactValue } from './public-paths.mjs';
|
|
11
|
-
|
|
12
|
-
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
13
|
-
const KNOWN_ADAPTERS = new Map([
|
|
14
|
-
[
|
|
15
|
-
'mem0',
|
|
16
|
-
{
|
|
17
|
-
name: 'mem0-platform',
|
|
18
|
-
path: 'benchmarks/adapters/mem0-platform.mjs',
|
|
19
|
-
requiredEnv: ['MEM0_API_KEY'],
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
[
|
|
23
|
-
'mem0-platform',
|
|
24
|
-
{
|
|
25
|
-
name: 'mem0-platform',
|
|
26
|
-
path: 'benchmarks/adapters/mem0-platform.mjs',
|
|
27
|
-
requiredEnv: ['MEM0_API_KEY'],
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
[
|
|
31
|
-
'zep',
|
|
32
|
-
{
|
|
33
|
-
name: 'zep-cloud',
|
|
34
|
-
path: 'benchmarks/adapters/zep-cloud.mjs',
|
|
35
|
-
requiredEnv: ['ZEP_API_KEY'],
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
[
|
|
39
|
-
'zep-cloud',
|
|
40
|
-
{
|
|
41
|
-
name: 'zep-cloud',
|
|
42
|
-
path: 'benchmarks/adapters/zep-cloud.mjs',
|
|
43
|
-
requiredEnv: ['ZEP_API_KEY'],
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
]);
|
|
47
|
-
|
|
48
|
-
export function parseExternalArgs(argv = process.argv.slice(2)) {
|
|
49
|
-
const args = {
|
|
50
|
-
adapter: 'mem0-platform',
|
|
51
|
-
outDir: null,
|
|
52
|
-
check: false,
|
|
53
|
-
dryRun: false,
|
|
54
|
-
json: false,
|
|
55
|
-
minPassRate: null,
|
|
56
|
-
allowMissingEnv: false,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
for (let i = 0; i < argv.length; i++) {
|
|
60
|
-
const token = argv[i];
|
|
61
|
-
if (token === '--adapter' && argv[i + 1]) args.adapter = argv[++i];
|
|
62
|
-
else if (token === '--out-dir' && argv[i + 1]) args.outDir = argv[++i];
|
|
63
|
-
else if (token === '--check') args.check = true;
|
|
64
|
-
else if (token === '--dry-run') args.dryRun = true;
|
|
65
|
-
else if (token === '--json') args.json = true;
|
|
66
|
-
else if (token === '--min-pass-rate' && argv[i + 1]) args.minPassRate = argv[++i];
|
|
67
|
-
else if (token === '--allow-missing-env') args.allowMissingEnv = true;
|
|
68
|
-
else if (token === '--help' || token === '-h') args.help = true;
|
|
69
|
-
else throw new Error(`Unknown argument: ${token}`);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return args;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function readJson(path) {
|
|
76
|
-
return JSON.parse(readFileSync(path, 'utf-8'));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function adapterSpec(adapter) {
|
|
80
|
-
const known = KNOWN_ADAPTERS.get(adapter);
|
|
81
|
-
if (known) return known;
|
|
82
|
-
|
|
83
|
-
const adapterPath = resolve(ROOT, adapter);
|
|
84
|
-
return {
|
|
85
|
-
name: basename(adapter).replace(/\.[cm]?js$/i, ''),
|
|
86
|
-
path: adapterPath,
|
|
87
|
-
requiredEnv: [],
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export function buildExternalGuardBenchRun(args = {}, env = process.env) {
|
|
92
|
-
const spec = adapterSpec(args.adapter ?? 'mem0-platform');
|
|
93
|
-
const adapterPath = resolve(ROOT, spec.path);
|
|
94
|
-
const outDir = resolve(ROOT, args.outDir ?? `benchmarks/output/external/${spec.name}`);
|
|
95
|
-
const missingEnv = spec.requiredEnv.filter(name => !env[name]);
|
|
96
|
-
const command = [
|
|
97
|
-
process.execPath,
|
|
98
|
-
resolve(ROOT, 'benchmarks/guardbench.js'),
|
|
99
|
-
'--adapter',
|
|
100
|
-
adapterPath,
|
|
101
|
-
'--out-dir',
|
|
102
|
-
outDir,
|
|
103
|
-
];
|
|
104
|
-
|
|
105
|
-
if (args.check) command.push('--check');
|
|
106
|
-
if (args.json) command.push('--json');
|
|
107
|
-
if (args.minPassRate != null) command.push('--min-pass-rate', String(args.minPassRate));
|
|
108
|
-
const validationCommand = [
|
|
109
|
-
process.execPath,
|
|
110
|
-
resolve(ROOT, 'benchmarks/validate-guardbench-artifacts.mjs'),
|
|
111
|
-
'--dir',
|
|
112
|
-
outDir,
|
|
113
|
-
];
|
|
114
|
-
|
|
115
|
-
return {
|
|
116
|
-
adapter: spec.name,
|
|
117
|
-
adapterPath,
|
|
118
|
-
outDir,
|
|
119
|
-
requiredEnv: spec.requiredEnv,
|
|
120
|
-
missingEnv,
|
|
121
|
-
command,
|
|
122
|
-
validationCommand,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export function evaluateAdapterConformance(summary, adapterName) {
|
|
127
|
-
const failures = [];
|
|
128
|
-
const externalSubjects = (summary.manifest?.subjects ?? []).filter(subject => subject.external);
|
|
129
|
-
const resolvedAdapterName = summary.systemSummaries?.some(row => row.system === adapterName)
|
|
130
|
-
? adapterName
|
|
131
|
-
: externalSubjects.length === 1
|
|
132
|
-
? externalSubjects[0].name
|
|
133
|
-
: adapterName;
|
|
134
|
-
const systemSummary = summary.systemSummaries?.find(row => row.system === resolvedAdapterName);
|
|
135
|
-
if (!systemSummary) {
|
|
136
|
-
failures.push(`Missing system summary for adapter ${resolvedAdapterName}`);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const expectedScenarios = summary.scenarios ?? summary.manifest?.scenarios?.length ?? 0;
|
|
140
|
-
const adapterRows = (summary.cases ?? [])
|
|
141
|
-
.flatMap(entry => entry.results ?? [])
|
|
142
|
-
.filter(row => row.system === resolvedAdapterName);
|
|
143
|
-
|
|
144
|
-
if (adapterRows.length !== expectedScenarios) {
|
|
145
|
-
failures.push(
|
|
146
|
-
`Adapter ${resolvedAdapterName} returned ${adapterRows.length}/${expectedScenarios} scenario rows`,
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
if (systemSummary && systemSummary.scenarios !== expectedScenarios) {
|
|
150
|
-
failures.push(
|
|
151
|
-
`Adapter ${resolvedAdapterName} system summary has ${systemSummary.scenarios}/${expectedScenarios} scenarios`,
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
if (systemSummary && systemSummary.redactionLeaks !== 0) {
|
|
155
|
-
failures.push(
|
|
156
|
-
`Adapter ${resolvedAdapterName} leaked ${systemSummary.redactionLeaks} seeded secret(s) in decision output`,
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
if (adapterRows.some(row => row.external !== true)) {
|
|
160
|
-
failures.push(`Adapter ${resolvedAdapterName} rows are not marked external`);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
return {
|
|
164
|
-
ok: failures.length === 0,
|
|
165
|
-
adapter: resolvedAdapterName,
|
|
166
|
-
requestedAdapter: adapterName,
|
|
167
|
-
scenarios: systemSummary?.scenarios ?? adapterRows.length,
|
|
168
|
-
expectedScenarios,
|
|
169
|
-
fullContractPassRate: systemSummary?.passRate ?? null,
|
|
170
|
-
decisionAccuracy: systemSummary?.decisionAccuracy ?? null,
|
|
171
|
-
redactionLeaks: systemSummary?.redactionLeaks ?? null,
|
|
172
|
-
failures,
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function usage() {
|
|
177
|
-
return `Usage: node benchmarks/run-external-guardbench.mjs [options]
|
|
178
|
-
|
|
179
|
-
Options:
|
|
180
|
-
--adapter <name|path> Adapter alias or ESM adapter path. Default: mem0-platform.
|
|
181
|
-
--out-dir <path> Output directory. Default: benchmarks/output/external/<adapter>.
|
|
182
|
-
--check Fail if Audrey Guard pass rate is below the threshold.
|
|
183
|
-
--min-pass-rate <percent> GuardBench pass-rate threshold for --check.
|
|
184
|
-
--json Forward JSON output from GuardBench.
|
|
185
|
-
--dry-run Print the resolved command and metadata without running.
|
|
186
|
-
--allow-missing-env Permit running even when known runtime env vars are absent.
|
|
187
|
-
`;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export function writeExternalRunMetadata(path, metadata) {
|
|
191
|
-
mkdirSync(path, { recursive: true });
|
|
192
|
-
const file = resolve(path, 'external-run-metadata.json');
|
|
193
|
-
writeFileSync(file, `${JSON.stringify(publicArtifactValue(metadata), null, 2)}\n`, 'utf-8');
|
|
194
|
-
return file;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
async function main() {
|
|
198
|
-
const args = parseExternalArgs();
|
|
199
|
-
if (args.help) {
|
|
200
|
-
console.log(usage());
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const run = buildExternalGuardBenchRun(args);
|
|
205
|
-
const startedAt = new Date().toISOString();
|
|
206
|
-
const metadata = {
|
|
207
|
-
suite: 'GuardBench external adapter run',
|
|
208
|
-
startedAt,
|
|
209
|
-
adapter: run.adapter,
|
|
210
|
-
adapterPath: run.adapterPath,
|
|
211
|
-
outDir: run.outDir,
|
|
212
|
-
requiredEnv: run.requiredEnv,
|
|
213
|
-
missingEnv: run.missingEnv,
|
|
214
|
-
command: run.command,
|
|
215
|
-
validationCommand: run.validationCommand,
|
|
216
|
-
dryRun: args.dryRun,
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
if (!existsSync(run.adapterPath)) {
|
|
220
|
-
throw new Error(`Adapter not found: ${run.adapterPath}`);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
if (run.missingEnv.length && !args.allowMissingEnv && !args.dryRun) {
|
|
224
|
-
metadata.status = 'blocked';
|
|
225
|
-
metadata.blockReason = `Missing runtime environment: ${run.missingEnv.join(', ')}`;
|
|
226
|
-
const metadataPath = writeExternalRunMetadata(run.outDir, metadata);
|
|
227
|
-
throw new Error(`${metadata.blockReason}. Metadata written to ${metadataPath}`);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
if (args.dryRun) {
|
|
231
|
-
metadata.status = run.missingEnv.length ? 'dry-run-missing-env' : 'dry-run-ready';
|
|
232
|
-
const metadataPath = writeExternalRunMetadata(run.outDir, metadata);
|
|
233
|
-
if (args.json) {
|
|
234
|
-
console.log(JSON.stringify({ ...metadata, metadataPath }, null, 2));
|
|
235
|
-
} else {
|
|
236
|
-
console.log(`External GuardBench dry run: ${run.adapter}`);
|
|
237
|
-
console.log(`Command: ${run.command.map(part => JSON.stringify(part)).join(' ')}`);
|
|
238
|
-
console.log(`Metadata: ${metadataPath}`);
|
|
239
|
-
if (run.missingEnv.length) console.log(`Missing runtime env: ${run.missingEnv.join(', ')}`);
|
|
240
|
-
}
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
writeExternalRunMetadata(run.outDir, { ...metadata, status: 'running' });
|
|
245
|
-
const child = spawnSync(run.command[0], run.command.slice(1), {
|
|
246
|
-
cwd: ROOT,
|
|
247
|
-
env: process.env,
|
|
248
|
-
stdio: 'inherit',
|
|
249
|
-
});
|
|
250
|
-
const validation = validateGuardBenchArtifacts({ dir: run.outDir });
|
|
251
|
-
let adapterConformance = {
|
|
252
|
-
ok: false,
|
|
253
|
-
adapter: run.adapter,
|
|
254
|
-
failures: ['GuardBench summary was not available for adapter conformance evaluation'],
|
|
255
|
-
};
|
|
256
|
-
if (child.status === 0) {
|
|
257
|
-
try {
|
|
258
|
-
const summary = readJson(resolve(run.outDir, 'guardbench-summary.json'));
|
|
259
|
-
adapterConformance = evaluateAdapterConformance(summary, run.adapter);
|
|
260
|
-
} catch (error) {
|
|
261
|
-
adapterConformance = {
|
|
262
|
-
ok: false,
|
|
263
|
-
adapter: run.adapter,
|
|
264
|
-
failures: [error.message],
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
if (validation.ok) {
|
|
269
|
-
console.log(`External GuardBench artifact validation passed: ${run.outDir}`);
|
|
270
|
-
} else {
|
|
271
|
-
console.error('External GuardBench artifact validation failed:');
|
|
272
|
-
for (const failure of validation.failures) console.error(`- ${failure}`);
|
|
273
|
-
}
|
|
274
|
-
if (adapterConformance.ok) {
|
|
275
|
-
console.log(`External GuardBench adapter conformance passed: ${adapterConformance.adapter}`);
|
|
276
|
-
} else {
|
|
277
|
-
console.error('External GuardBench adapter conformance failed:');
|
|
278
|
-
for (const failure of adapterConformance.failures) console.error(`- ${failure}`);
|
|
279
|
-
}
|
|
280
|
-
const completed = {
|
|
281
|
-
...metadata,
|
|
282
|
-
completedAt: new Date().toISOString(),
|
|
283
|
-
status: child.status === 0 && validation.ok && adapterConformance.ok ? 'passed' : 'failed',
|
|
284
|
-
exitCode: child.status,
|
|
285
|
-
signal: child.signal,
|
|
286
|
-
artifactHashes: child.status === 0 ? computeGuardBenchArtifactHashes(run.outDir) : undefined,
|
|
287
|
-
artifactValidation: validation,
|
|
288
|
-
adapterConformance,
|
|
289
|
-
};
|
|
290
|
-
const metadataPath = writeExternalRunMetadata(run.outDir, completed);
|
|
291
|
-
const card = child.status === 0 ? writeGuardBenchConformanceCard({ dir: run.outDir }) : null;
|
|
292
|
-
console.log(`External GuardBench metadata: ${metadataPath}`);
|
|
293
|
-
if (card) console.log(`External GuardBench conformance card: ${card.path}`);
|
|
294
|
-
process.exitCode =
|
|
295
|
-
child.status === 0 && validation.ok && adapterConformance.ok ? 0 : (child.status ?? 1);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
if (process.argv[1] && process.argv[1].endsWith('run-external-guardbench.mjs')) {
|
|
299
|
-
main().catch(err => {
|
|
300
|
-
console.error(err.message);
|
|
301
|
-
process.exit(1);
|
|
302
|
-
});
|
|
303
|
-
}
|