agentcert 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/cli.js +41 -4
- package/dist/corpus-governance.js +126 -0
- package/dist/corpus-store.js +4 -6
- package/dist/credentials.js +1 -1
- package/dist/runner.js +2 -1
- package/dist/schema-validator.js +30 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@ AgentCert checks what an agent may do, whether it passed pre-release evidence,
|
|
|
6
6
|
whether a high-risk runtime action may proceed, and who can verify the observed
|
|
7
7
|
outcome. It writes portable reports and accumulates a local failure corpus.
|
|
8
8
|
|
|
9
|
-
[Public
|
|
10
|
-
[Private workspace](https://agentcert
|
|
9
|
+
[Public evidence](https://agentcert.app/evidence) |
|
|
10
|
+
[Private workspace](https://agentcert.app/app) |
|
|
11
11
|
[GitHub source](https://github.com/Kakarottoooo/agentcert)
|
|
12
12
|
|
|
13
13
|
## 5-minute local path
|
|
@@ -53,7 +53,7 @@ Default outputs:
|
|
|
53
53
|
Push the validated evidence bundle into a hosted AgentCert project:
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
|
-
npx agentcert connect --server https://agentcert
|
|
56
|
+
npx agentcert connect --server https://agentcert.app --project your-project-id
|
|
57
57
|
npx agentcert push --evidence .agentcert/latest/agentcert-evidence.json
|
|
58
58
|
```
|
|
59
59
|
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { appendFile, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { basename, dirname, join, resolve } from "node:path";
|
|
4
4
|
import { createInterface } from "node:readline/promises";
|
|
5
5
|
import { validateEvidenceArtifacts } from "./artifact-validation.js";
|
|
@@ -8,6 +8,7 @@ import { buildEvidenceBundle } from "./bundle.js";
|
|
|
8
8
|
import { collectCompanionArtifacts, MAX_REPORTED_COMPANION_ARTIFACT_SKIPS } from "./companion-artifacts.js";
|
|
9
9
|
import { recordsFromAgentCertResult, evaluateFailureClassifier, renderCorpusSummary, summarizeCorpus, writeReviewedFailureDataset, } from "./corpus.js";
|
|
10
10
|
import { openCorpusStore, parseCorpusStoreKind } from "./corpus-store.js";
|
|
11
|
+
import { deleteCorpusRecords, exportGovernedCorpus, governCorpusRecords, parseCorpusConsent } from "./corpus-governance.js";
|
|
11
12
|
import { pushEvidenceToControlPlane, verifyControlPlaneConnection } from "./control-plane.js";
|
|
12
13
|
import { runEvidenceConformance } from "./conformance.js";
|
|
13
14
|
import { DEFAULT_AGENTCERT_SERVER, resolveConnection, saveConnection } from "./credentials.js";
|
|
@@ -62,7 +63,7 @@ else if (command === "init") {
|
|
|
62
63
|
else if (command === "connect") {
|
|
63
64
|
if (readBoolFlag("--help")) {
|
|
64
65
|
process.stdout.write(`Usage:
|
|
65
|
-
agentcert connect --server https://agentcert
|
|
66
|
+
agentcert connect --server https://agentcert.app --project <project-id>
|
|
66
67
|
agentcert connect --name staging --server https://staging.example.com --project <project-id>
|
|
67
68
|
|
|
68
69
|
The API key is read from AGENTCERT_API_KEY or requested with hidden input.
|
|
@@ -124,7 +125,7 @@ else if (command === "corpus") {
|
|
|
124
125
|
throw new Error("No input artifacts were provided. Use --mcpbench, --tripwire, --onegent, or --config.");
|
|
125
126
|
}
|
|
126
127
|
const reviews = await readFailureReviews(readReviewsPath());
|
|
127
|
-
const records = applyFailureReviews(loaded.flatMap(({ result, path, raw }) => recordsFromAgentCertResult(result, path, subject, raw)), reviews);
|
|
128
|
+
const records = governCorpusRecords(applyFailureReviews(loaded.flatMap(({ result, path, raw }) => recordsFromAgentCertResult(result, path, subject, raw)), reviews), { consent: parseCorpusConsent(readFlag("--consent")), consentSource: readFlag("--consent-source") ?? "local-default" });
|
|
128
129
|
const store = await openCorpusStore(storeOptions);
|
|
129
130
|
try {
|
|
130
131
|
await store.append(records, { replace });
|
|
@@ -169,6 +170,38 @@ else if (command === "corpus") {
|
|
|
169
170
|
await store.close();
|
|
170
171
|
}
|
|
171
172
|
}
|
|
173
|
+
else if (action === "export") {
|
|
174
|
+
const outPath = readFlag("--out") ?? ".agentcert/latest/governed-corpus.jsonl";
|
|
175
|
+
const allowed = (readFlag("--consent") ?? "public,anonymous").split(",").map((item) => parseCorpusConsent(item.trim()));
|
|
176
|
+
const store = await openCorpusStore(readCorpusStoreOptions(".agentcert/corpus/corpus.jsonl"));
|
|
177
|
+
try {
|
|
178
|
+
const records = exportGovernedCorpus(await store.readAll(), allowed);
|
|
179
|
+
await mkdir(dirname(resolve(outPath)), { recursive: true });
|
|
180
|
+
await writeFile(outPath, records.map((record) => JSON.stringify(record)).join("\n") + (records.length ? "\n" : ""));
|
|
181
|
+
process.stdout.write(`Exported ${records.length} consented corpus records to ${resolve(outPath)}\n`);
|
|
182
|
+
}
|
|
183
|
+
finally {
|
|
184
|
+
await store.close();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
else if (action === "delete") {
|
|
188
|
+
const ids = requiredFlag("--record-id").split(",").map((item) => item.trim()).filter(Boolean);
|
|
189
|
+
const reason = requiredFlag("--reason");
|
|
190
|
+
const journalPath = readFlag("--journal") ?? ".agentcert/corpus/deletion-journal.jsonl";
|
|
191
|
+
const store = await openCorpusStore(readCorpusStoreOptions(".agentcert/corpus/corpus.jsonl"));
|
|
192
|
+
try {
|
|
193
|
+
const result = deleteCorpusRecords(await store.readAll(), ids, reason);
|
|
194
|
+
if (!result.tombstones.length)
|
|
195
|
+
throw new Error("No corpus records matched --record-id; nothing was deleted.");
|
|
196
|
+
await store.append(result.retained, { replace: true });
|
|
197
|
+
await mkdir(dirname(resolve(journalPath)), { recursive: true });
|
|
198
|
+
await appendFile(journalPath, result.tombstones.map((item) => JSON.stringify(item)).join("\n") + "\n");
|
|
199
|
+
process.stdout.write(`Deleted ${result.tombstones.length} corpus records and wrote non-identifying tombstones to ${resolve(journalPath)}\n`);
|
|
200
|
+
}
|
|
201
|
+
finally {
|
|
202
|
+
await store.close();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
172
205
|
else if (action === "classifier-eval") {
|
|
173
206
|
const outPath = readFlag("--out");
|
|
174
207
|
const store = await openCorpusStore(readCorpusStoreOptions(".agentcert/corpus/corpus.jsonl"));
|
|
@@ -231,9 +264,12 @@ else if (command === "corpus") {
|
|
|
231
264
|
process.stdout.write(`Usage:
|
|
232
265
|
agentcert corpus ingest --tripwire .tripwire/latest/tripwire-result.json --out .agentcert/corpus/corpus.jsonl --subject my-agent
|
|
233
266
|
agentcert corpus ingest --store sqlite --sqlite .agentcert/corpus/agentcert.sqlite --tripwire .tripwire/latest/tripwire-result.json --subject my-agent
|
|
267
|
+
agentcert corpus ingest --tripwire result.json --consent anonymous --consent-source "pilot agreement 2026-07"
|
|
234
268
|
agentcert corpus review --corpus .agentcert/corpus/corpus.jsonl --reviews .agentcert/corpus/failure-reviews.jsonl --pattern-key tripwire:ui_drift:modal-overlay:url_contains --type ui_drift --status confirmed --reviewer you@example.com --confidence 0.8 --why "Visible evidence supports the ui_drift label."
|
|
235
269
|
agentcert corpus metrics --corpus .agentcert/corpus/corpus.jsonl
|
|
236
270
|
agentcert corpus export-reviewed --corpus .agentcert/corpus/corpus.jsonl --out .agentcert/latest/reviewed-failure-dataset.jsonl
|
|
271
|
+
agentcert corpus export --corpus .agentcert/corpus/corpus.jsonl --consent public,anonymous --out .agentcert/latest/governed-corpus.jsonl
|
|
272
|
+
agentcert corpus delete --corpus .agentcert/corpus/corpus.jsonl --record-id <id> --reason "participant withdrawal"
|
|
237
273
|
agentcert corpus classifier-eval --corpus .agentcert/corpus/corpus.jsonl --out .agentcert/latest/failure-classifier-evaluation.json
|
|
238
274
|
agentcert corpus summary --corpus .agentcert/corpus/corpus.jsonl
|
|
239
275
|
agentcert corpus summary --store postgres --database-url "$DATABASE_URL"
|
|
@@ -452,6 +488,7 @@ else if (command === "schema") {
|
|
|
452
488
|
agentcert schema validate --schema corpus-record --file examples/agentcert/corpus-record.example.json
|
|
453
489
|
agentcert schema validate --schema classifier-eval --file examples/agentcert/classifier-eval.example.json
|
|
454
490
|
agentcert schema validate --schema release-gate --file .agentcert/latest/agentcert-release-gate.json
|
|
491
|
+
agentcert schema validate --schema assurance-report --file assurance-report.json
|
|
455
492
|
agentcert schema validate --schema evidence-signature --file .agentcert/latest/agentcert-evidence.json.sig.json
|
|
456
493
|
`);
|
|
457
494
|
}
|
|
@@ -515,7 +552,7 @@ else if (command === "conformance") {
|
|
|
515
552
|
else {
|
|
516
553
|
process.stdout.write(`Usage:
|
|
517
554
|
agentcert init --subject my-browser-agent
|
|
518
|
-
agentcert connect --server https://agentcert
|
|
555
|
+
agentcert connect --server https://agentcert.app --project <project-id>
|
|
519
556
|
agentcert sandbox init
|
|
520
557
|
agentcert sandbox certify --adapter ./agentcert.sandbox.mjs
|
|
521
558
|
agentcert sandbox push --adapter ./agentcert.sandbox.mjs
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { basename } from "node:path";
|
|
3
|
+
const SECRET_PATTERNS = [
|
|
4
|
+
/\bsk-(?:proj-|live_|test_)?[A-Za-z0-9_-]{16,}\b/g,
|
|
5
|
+
/\brk_(?:live|test)_[A-Za-z0-9]{12,}\b/g,
|
|
6
|
+
/\bnpm_[A-Za-z0-9]{16,}\b/g,
|
|
7
|
+
/\bac_(?:live|test)_[A-Za-z0-9_-]{12,}\b/g,
|
|
8
|
+
/\bBearer\s+[A-Za-z0-9._~+/=-]{12,}\b/gi,
|
|
9
|
+
];
|
|
10
|
+
const EMAIL_PATTERN = /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi;
|
|
11
|
+
export function governCorpusRecords(records, input) {
|
|
12
|
+
if (input.consent === "denied")
|
|
13
|
+
throw new Error("Corpus consent is denied; no record was retained.");
|
|
14
|
+
if (!input.consentSource.trim())
|
|
15
|
+
throw new Error("Corpus consent source is required.");
|
|
16
|
+
const recordedAt = input.recordedAt ?? new Date().toISOString();
|
|
17
|
+
return records.map((record) => {
|
|
18
|
+
const [redacted, replacements] = redactValue(structuredClone(record), input.consent === "anonymous");
|
|
19
|
+
const governed = redacted;
|
|
20
|
+
if (input.consent === "anonymous") {
|
|
21
|
+
const identity = pseudonym(record.subject);
|
|
22
|
+
governed.subject = `anonymous-${identity}`;
|
|
23
|
+
governed.agentName = `anonymous-agent-${identity}`;
|
|
24
|
+
governed.sourcePath = basename(record.sourcePath.replaceAll("\\", "/"));
|
|
25
|
+
governed.artifacts = Object.fromEntries(Object.entries(governed.artifacts).map(([key, value]) => [key, basename(value.replaceAll("\\", "/"))]));
|
|
26
|
+
}
|
|
27
|
+
governed.governance = {
|
|
28
|
+
schemaVersion: "agentcert.corpus_governance.v0.1",
|
|
29
|
+
consent: input.consent,
|
|
30
|
+
consentSource: redactText(input.consentSource, input.consent === "anonymous")[0],
|
|
31
|
+
consentRecordedAt: recordedAt,
|
|
32
|
+
provenance: {
|
|
33
|
+
sourcePath: input.consent === "anonymous" ? basename(record.sourcePath.replaceAll("\\", "/")) : record.sourcePath,
|
|
34
|
+
sourceRecordSha256: createHash("sha256").update(JSON.stringify(record)).digest("hex"),
|
|
35
|
+
collectedAt: record.ingestedAt,
|
|
36
|
+
},
|
|
37
|
+
redaction: { policyVersion: "agentcert.redaction.v0.1", replacements, secretScanPassed: !containsSecret(JSON.stringify(governed)) },
|
|
38
|
+
};
|
|
39
|
+
if (!governed.governance.redaction.secretScanPassed)
|
|
40
|
+
throw new Error(`Corpus record ${record.id} still contains a recognized secret after redaction.`);
|
|
41
|
+
return governed;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export function exportGovernedCorpus(records, allowed = ["public", "anonymous"]) {
|
|
45
|
+
const allow = new Set(allowed);
|
|
46
|
+
return records
|
|
47
|
+
.filter((record) => record.governance && allow.has(record.governance.consent))
|
|
48
|
+
.map((record) => {
|
|
49
|
+
const [redacted, replacements] = redactValue(structuredClone(record), record.governance.consent === "anonymous");
|
|
50
|
+
const exported = redacted;
|
|
51
|
+
if (record.governance.consent === "anonymous") {
|
|
52
|
+
const identity = record.subject.startsWith("anonymous-") ? record.subject.slice("anonymous-".length) : pseudonym(record.subject);
|
|
53
|
+
exported.subject = `anonymous-${identity}`;
|
|
54
|
+
exported.agentName = `anonymous-agent-${identity}`;
|
|
55
|
+
exported.sourcePath = basename(record.sourcePath.replaceAll("\\", "/"));
|
|
56
|
+
exported.artifacts = Object.fromEntries(Object.entries(exported.artifacts).map(([key, value]) => [key, basename(value.replaceAll("\\", "/"))]));
|
|
57
|
+
}
|
|
58
|
+
exported.governance = {
|
|
59
|
+
...record.governance,
|
|
60
|
+
redaction: {
|
|
61
|
+
...record.governance.redaction,
|
|
62
|
+
replacements: record.governance.redaction.replacements + replacements,
|
|
63
|
+
secretScanPassed: !containsSecret(JSON.stringify(exported)),
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
if (!exported.governance.redaction.secretScanPassed)
|
|
67
|
+
throw new Error(`Corpus record ${record.id} failed the export secret scan.`);
|
|
68
|
+
return exported;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
export function deleteCorpusRecords(records, ids, reason, deletedAt = new Date().toISOString()) {
|
|
72
|
+
if (!reason.trim())
|
|
73
|
+
throw new Error("Corpus deletion requires a reason.");
|
|
74
|
+
const requested = new Set(ids);
|
|
75
|
+
const deleted = records.filter((record) => requested.has(record.id));
|
|
76
|
+
return {
|
|
77
|
+
retained: records.filter((record) => !requested.has(record.id)),
|
|
78
|
+
tombstones: deleted.map((record) => ({
|
|
79
|
+
schemaVersion: "agentcert.corpus_deletion.v0.1",
|
|
80
|
+
recordIdSha256: createHash("sha256").update(record.id).digest("hex"),
|
|
81
|
+
reason: redactText(reason, true)[0],
|
|
82
|
+
deletedAt,
|
|
83
|
+
})),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export function parseCorpusConsent(value) {
|
|
87
|
+
const consent = value ?? "private";
|
|
88
|
+
if (consent === "private" || consent === "anonymous" || consent === "public" || consent === "denied")
|
|
89
|
+
return consent;
|
|
90
|
+
throw new Error(`Unsupported corpus consent "${consent}". Use private, anonymous, public, or denied.`);
|
|
91
|
+
}
|
|
92
|
+
function redactValue(value, anonymous) {
|
|
93
|
+
if (typeof value === "string")
|
|
94
|
+
return redactText(value, anonymous);
|
|
95
|
+
if (Array.isArray(value)) {
|
|
96
|
+
let replacements = 0;
|
|
97
|
+
const output = value.map((item) => { const [next, count] = redactValue(item, anonymous); replacements += count; return next; });
|
|
98
|
+
return [output, replacements];
|
|
99
|
+
}
|
|
100
|
+
if (value && typeof value === "object") {
|
|
101
|
+
let replacements = 0;
|
|
102
|
+
const output = {};
|
|
103
|
+
for (const [key, item] of Object.entries(value)) {
|
|
104
|
+
const [next, count] = redactValue(item, anonymous);
|
|
105
|
+
output[key] = next;
|
|
106
|
+
replacements += count;
|
|
107
|
+
}
|
|
108
|
+
return [output, replacements];
|
|
109
|
+
}
|
|
110
|
+
return [value, 0];
|
|
111
|
+
}
|
|
112
|
+
function redactText(value, anonymous) {
|
|
113
|
+
let output = value;
|
|
114
|
+
let replacements = 0;
|
|
115
|
+
for (const pattern of SECRET_PATTERNS)
|
|
116
|
+
output = output.replace(pattern, () => { replacements += 1; return "[REDACTED_SECRET]"; });
|
|
117
|
+
if (anonymous)
|
|
118
|
+
output = output.replace(EMAIL_PATTERN, () => { replacements += 1; return "[REDACTED_EMAIL]"; });
|
|
119
|
+
return [output, replacements];
|
|
120
|
+
}
|
|
121
|
+
function containsSecret(value) {
|
|
122
|
+
return SECRET_PATTERNS.some((pattern) => { pattern.lastIndex = 0; return pattern.test(value); });
|
|
123
|
+
}
|
|
124
|
+
function pseudonym(value) {
|
|
125
|
+
return createHash("sha256").update(value).digest("hex").slice(0, 12);
|
|
126
|
+
}
|
package/dist/corpus-store.js
CHANGED
|
@@ -62,11 +62,10 @@ async function createSqliteCorpusStore(path, tableNameInput) {
|
|
|
62
62
|
kind: "sqlite",
|
|
63
63
|
description: `SQLite corpus at ${outPath}`,
|
|
64
64
|
append: async (records, options) => {
|
|
65
|
-
if (options?.replace) {
|
|
66
|
-
db.exec(`DELETE FROM ${table}`);
|
|
67
|
-
}
|
|
68
65
|
db.exec("BEGIN");
|
|
69
66
|
try {
|
|
67
|
+
if (options?.replace)
|
|
68
|
+
db.exec(`DELETE FROM ${table}`);
|
|
70
69
|
for (const record of records) {
|
|
71
70
|
insert.run(...recordSqlValues(record, "sqlite"), JSON.stringify(record));
|
|
72
71
|
}
|
|
@@ -97,11 +96,10 @@ async function createPostgresCorpusStore(databaseUrl, tableNameInput) {
|
|
|
97
96
|
kind: "postgres",
|
|
98
97
|
description: `Postgres corpus table ${tableName}`,
|
|
99
98
|
append: async (records, options) => {
|
|
100
|
-
if (options?.replace) {
|
|
101
|
-
await client.query(`DELETE FROM ${table}`);
|
|
102
|
-
}
|
|
103
99
|
await client.query("BEGIN");
|
|
104
100
|
try {
|
|
101
|
+
if (options?.replace)
|
|
102
|
+
await client.query(`DELETE FROM ${table}`);
|
|
105
103
|
for (const record of records) {
|
|
106
104
|
await client.query(insertSql(table, "$"), [...recordSqlValues(record, "postgres"), JSON.stringify(record)]);
|
|
107
105
|
}
|
package/dist/credentials.js
CHANGED
|
@@ -2,7 +2,7 @@ import { chmod, mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
|
-
export const DEFAULT_AGENTCERT_SERVER = "https://agentcert
|
|
5
|
+
export const DEFAULT_AGENTCERT_SERVER = "https://agentcert.app";
|
|
6
6
|
export async function saveConnection(name, input, options = {}) {
|
|
7
7
|
const connectionName = validateConnectionName(name);
|
|
8
8
|
const connection = validateConnection(input);
|
package/dist/runner.js
CHANGED
|
@@ -7,6 +7,7 @@ import { buildEvidenceBundle } from "./bundle.js";
|
|
|
7
7
|
import { recordsFromAgentCertResult, renderCorpusSummary, summarizeCorpus, writeReviewedFailureDataset, } from "./corpus.js";
|
|
8
8
|
import { openCorpusStore, parseCorpusStoreKind } from "./corpus-store.js";
|
|
9
9
|
import { applyFailureReviews, readFailureReviews } from "./failure-review.js";
|
|
10
|
+
import { governCorpusRecords } from "./corpus-governance.js";
|
|
10
11
|
import { buildMonitorSnapshot, writeMonitorSnapshot } from "./monitor.js";
|
|
11
12
|
import { normalizeMcpBenchResult, normalizeOnegentAuditPacket, normalizeTripwireResult } from "./normalizers.js";
|
|
12
13
|
import { renderHtmlReport, renderMarkdownReport } from "./report.js";
|
|
@@ -168,7 +169,7 @@ export async function runAgentCertProfile(profileInput, options = {}) {
|
|
|
168
169
|
const bundle = buildEvidenceBundle(loaded.map((artifact) => artifact.result), profile.subject.name, profile.subject.type);
|
|
169
170
|
const reviewsPath = profile.run?.corpus?.reviewsPath;
|
|
170
171
|
const reviews = await readFailureReviews(reviewsPath ? resolve(cwd, reviewsPath) : undefined);
|
|
171
|
-
const records = applyFailureReviews(loaded.flatMap(({ result, path, raw }) => recordsFromAgentCertResult(result, path, profile.subject.name, raw)), reviews);
|
|
172
|
+
const records = governCorpusRecords(applyFailureReviews(loaded.flatMap(({ result, path, raw }) => recordsFromAgentCertResult(result, path, profile.subject.name, raw)), reviews), { consent: "private", consentSource: "agentcert-runner-default" });
|
|
172
173
|
const outputs = { monitor: [], reviewedDataset: [] };
|
|
173
174
|
const reportEnabled = profile.run?.report?.enabled ?? true;
|
|
174
175
|
const reportDir = profile.run?.report?.outDir ?? profile.outputDir;
|
package/dist/schema-validator.js
CHANGED
|
@@ -11,10 +11,11 @@ export function parseSchemaId(input) {
|
|
|
11
11
|
value === "monitor-snapshot" ||
|
|
12
12
|
value === "robustness-lab" ||
|
|
13
13
|
value === "release-gate" ||
|
|
14
|
+
value === "assurance-report" ||
|
|
14
15
|
value === "evidence-signature") {
|
|
15
16
|
return value;
|
|
16
17
|
}
|
|
17
|
-
throw new Error(`Unsupported schema "${value}". Use evidence-bundle, result, corpus-record, failure-review, classifier-eval, monitor-snapshot, robustness-lab, release-gate, or evidence-signature.`);
|
|
18
|
+
throw new Error(`Unsupported schema "${value}". Use evidence-bundle, result, corpus-record, failure-review, classifier-eval, monitor-snapshot, robustness-lab, release-gate, assurance-report, or evidence-signature.`);
|
|
18
19
|
}
|
|
19
20
|
export function validateAgentCertSchema(schema, input) {
|
|
20
21
|
const errors = [];
|
|
@@ -42,6 +43,8 @@ export function validateAgentCertSchema(schema, input) {
|
|
|
42
43
|
validateMonitorSnapshot(value, errors);
|
|
43
44
|
if (schema === "robustness-lab")
|
|
44
45
|
validateRobustnessLab(value, errors);
|
|
46
|
+
if (schema === "assurance-report")
|
|
47
|
+
validateAssuranceReport(value, errors);
|
|
45
48
|
}
|
|
46
49
|
return { schema, valid: errors.length === 0, errors };
|
|
47
50
|
}
|
|
@@ -160,6 +163,32 @@ function validateCorpusRecord(value, errors) {
|
|
|
160
163
|
requiredString(value, "runId", errors);
|
|
161
164
|
requiredBoolean(value, "passed", errors);
|
|
162
165
|
requiredArray(value, "failurePatterns", errors);
|
|
166
|
+
if (value.governance !== undefined) {
|
|
167
|
+
const governance = recordValue(value.governance);
|
|
168
|
+
if (!governance)
|
|
169
|
+
errors.push("governance must be an object.");
|
|
170
|
+
else {
|
|
171
|
+
requiredConst(governance, "schemaVersion", "agentcert.corpus_governance.v0.1", errors);
|
|
172
|
+
requiredEnum(governance, "consent", ["private", "anonymous", "public", "denied"], errors);
|
|
173
|
+
requiredString(governance, "consentSource", errors);
|
|
174
|
+
requiredString(governance, "consentRecordedAt", errors);
|
|
175
|
+
requiredObject(governance, "provenance", errors);
|
|
176
|
+
requiredObject(governance, "redaction", errors);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function validateAssuranceReport(value, errors) {
|
|
181
|
+
requiredConst(value, "schemaVersion", "agentcert.assurance_report.v0.1", errors);
|
|
182
|
+
for (const key of ["assuranceCaseId", "projectId", "policyPackVersion", "evaluationPlanSha256", "reviewerId", "issuedAt", "expiresAt", "statement"])
|
|
183
|
+
requiredString(value, key, errors);
|
|
184
|
+
requiredObject(value, "subject", errors);
|
|
185
|
+
requiredArray(value, "evidence", errors);
|
|
186
|
+
requiredConst(value, "decision", "issued", errors);
|
|
187
|
+
requiredArray(value, "limitations", errors);
|
|
188
|
+
if (!/^[0-9a-f]{64}$/.test(String(value.evaluationPlanSha256 ?? "")))
|
|
189
|
+
errors.push("evaluationPlanSha256 must be a lowercase SHA-256 digest.");
|
|
190
|
+
validateTimestamp(value.issuedAt, "issuedAt", errors);
|
|
191
|
+
validateTimestamp(value.expiresAt, "expiresAt", errors);
|
|
163
192
|
}
|
|
164
193
|
function validateFailureReview(value, errors) {
|
|
165
194
|
requiredConst(value, "schemaVersion", "1", errors);
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentcert",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Assurance release gates, runtime evidence, and regression CI for AI agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
|
-
"homepage": "https://agentcert
|
|
7
|
+
"homepage": "https://agentcert.app/",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/Kakarottoooo/agentcert.git",
|