mneme-ai 3.119.0 → 3.121.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `mneme certify` (v3.120.0) — VERICERT: stamp an AI-worker deliverable with a
3
+ * signed, offline-verifiable "Verified-by-Mneme" certificate (CERTIFIED /
4
+ * CONDITIONAL / REJECTED) — the trust layer for the AI-worker economy.
5
+ *
6
+ * mneme certify "the build always works and never fails"
7
+ * cat report.md | mneme certify - # certify a file/stdin
8
+ * mneme certify verify --cert cert.json [--deliverable report.md]
9
+ */
10
+ import type { Command } from "commander";
11
+ export declare function registerVericertCommands(program: Command): void;
12
+ //# sourceMappingURL=vericert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vericert.d.ts","sourceRoot":"","sources":["../../src/commands/vericert.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+C/D"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * `mneme certify` (v3.120.0) — VERICERT: stamp an AI-worker deliverable with a
3
+ * signed, offline-verifiable "Verified-by-Mneme" certificate (CERTIFIED /
4
+ * CONDITIONAL / REJECTED) — the trust layer for the AI-worker economy.
5
+ *
6
+ * mneme certify "the build always works and never fails"
7
+ * cat report.md | mneme certify - # certify a file/stdin
8
+ * mneme certify verify --cert cert.json [--deliverable report.md]
9
+ */
10
+ import { readFileSync, writeFileSync } from "node:fs";
11
+ import { vericert, notary } from "@mneme-ai/core";
12
+ function out(s) { process.stdout.write(s + "\n"); }
13
+ export function registerVericertCommands(program) {
14
+ const c = program
15
+ .command("certify")
16
+ .alias("vericert")
17
+ .argument("[deliverable...]", "the AI-produced deliverable ('-' = stdin)")
18
+ .description("🎗️ VERICERT — stamp an AI-worker deliverable (report / code / answer) with a signed, offline-verifiable certificate: CERTIFIED / CONDITIONAL / REJECTED. Runs every claim through the HPE verification stack; CERTIFIED only if NO known fault (CERTIFIED-precision 1.0 — never certifies a hallucinated deliverable). The trust layer the AI-worker gold rush is missing.")
19
+ .option("--json", "JSON output (the full signed certificate)")
20
+ .option("--badge <file>", "also write a shareable 'Verified by Mneme' SVG badge ('-' = stdout)")
21
+ .action((deliverable, opts) => {
22
+ let d = Array.isArray(deliverable) ? deliverable.join(" ") : String(deliverable ?? "");
23
+ if (d === "-") {
24
+ try {
25
+ d = readFileSync(0, "utf8");
26
+ }
27
+ catch { /* */ }
28
+ }
29
+ if (!d.trim()) {
30
+ out("usage: mneme certify \"<deliverable>\" (or pipe a file: cat report.md | mneme certify -)");
31
+ process.exitCode = 2;
32
+ return;
33
+ }
34
+ const cert = vericert.certify(d, { ts: Date.now() });
35
+ let receipt = null;
36
+ try {
37
+ receipt = notary.issueReceipt(process.cwd(), { kind: "claim-verdict", subject: `vericert:${cert.verdict}:${cert.certId.slice(0, 12)}`, payload: { certId: cert.certId }, includePayload: true });
38
+ }
39
+ catch { /* */ }
40
+ const signed = { ...cert, signed: receipt };
41
+ if (opts.badge) {
42
+ const svg = vericert.badgeSVG(cert);
43
+ if (opts.badge === "-")
44
+ out(svg);
45
+ else {
46
+ try {
47
+ writeFileSync(opts.badge, svg);
48
+ out(` 🎗 badge → ${opts.badge}`);
49
+ }
50
+ catch { /* */ }
51
+ }
52
+ }
53
+ if (opts.json) {
54
+ out(JSON.stringify(signed, null, 2));
55
+ process.exitCode = cert.verdict === "REJECTED" ? 2 : 0;
56
+ return;
57
+ }
58
+ const icon = cert.verdict === "CERTIFIED" ? "🎗️ ✓" : cert.verdict === "CONDITIONAL" ? "🎗️ ❔" : "🎗️ 🛑";
59
+ out(`${icon} ${cert.verdict} (score ${(cert.score * 100).toFixed(0)}% · ${cert.trusted}/${cert.claimsChecked} claims clean)`);
60
+ out(` certId: ${cert.certId.slice(0, 24)}… ${receipt ? "· Ed25519-signed (verify offline)" : ""}`);
61
+ for (const f of cert.faults)
62
+ out(` ${f.verdict === "BLOCK" ? "🛑" : "❔"} ${f.nerves.join(",")}: ${f.claim.slice(0, 70)}`);
63
+ if (cert.verdict === "CERTIFIED")
64
+ out(` ✓ no known fault — safe to relay (CERTIFIED = no KNOWN fault, not a proof of truth).`);
65
+ process.exitCode = cert.verdict === "REJECTED" ? 2 : 0;
66
+ });
67
+ c.command("verify")
68
+ .description("verify a VERICERT certificate OFFLINE: tamper-evidence + (optionally) that it matches the deliverable + the Ed25519 signature.")
69
+ .requiredOption("--cert <file>", "the certificate JSON ('-' for stdin)")
70
+ .option("--deliverable <file>", "the original deliverable to re-check against")
71
+ .option("--json", "JSON output")
72
+ .action((o) => {
73
+ let cert;
74
+ try {
75
+ cert = JSON.parse(o.cert === "-" ? readFileSync(0, "utf8") : readFileSync(o.cert, "utf8"));
76
+ }
77
+ catch {
78
+ out("✗ could not read/parse cert");
79
+ process.exitCode = 2;
80
+ return;
81
+ }
82
+ let deliverable;
83
+ if (o.deliverable) {
84
+ try {
85
+ deliverable = readFileSync(o.deliverable, "utf8");
86
+ }
87
+ catch { /* */ }
88
+ }
89
+ const body = vericert.verifyCertBody(cert, deliverable);
90
+ let sigOk = null;
91
+ try {
92
+ if (cert.signed)
93
+ sigOk = notary.verifyReceipt(cert.signed).valid;
94
+ }
95
+ catch {
96
+ sigOk = false;
97
+ }
98
+ if (o.json) {
99
+ out(JSON.stringify({ ...body, signatureValid: sigOk }, null, 2));
100
+ process.exitCode = body.ok ? 0 : 2;
101
+ return;
102
+ }
103
+ out(`${body.ok ? "✓ VALID" : "🛑 INVALID"} — ${body.reason}`);
104
+ if (sigOk !== null)
105
+ out(` Ed25519 signature: ${sigOk ? "✓ valid (offline)" : "🛑 invalid"}`);
106
+ process.exitCode = body.ok ? 0 : 2;
107
+ });
108
+ }
109
+ //# sourceMappingURL=vericert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vericert.js","s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C,CAAC;YAAC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAAC,OAAO;QAAC,CAAC;QAC7H,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAC9D,IAAI,KAAK,KAAK,IAAI;YAAE,GAAG,CAAC,yBAAyB,KAAK,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC;QAC/F,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwMA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA2mNvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyMA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA4mNvD"}
package/dist/index.js CHANGED
@@ -131,6 +131,7 @@ import { registerCanonCommands } from "./commands/canon.js";
131
131
  import { registerSdcCommands } from "./commands/sdc.js";
132
132
  import { registerStatguardCommands } from "./commands/statguard.js";
133
133
  import { registerHpeCommands } from "./commands/hpe.js";
134
+ import { registerVericertCommands } from "./commands/vericert.js";
134
135
  import { registerMoatCommands } from "./commands/moat.js";
135
136
  import { attachRegretOracle } from "./commands/regret.js";
136
137
  import { registerTrustCommands } from "./commands/trust.js";
@@ -4819,6 +4820,7 @@ export async function run(argv) {
4819
4820
  registerSdcCommands(program);
4820
4821
  registerStatguardCommands(program);
4821
4822
  registerHpeCommands(program);
4823
+ registerVericertCommands(program);
4822
4824
  registerMoatCommands(program);
4823
4825
  // ─── Trust calibrator (v1.31.0) -- per-subsystem precision/recall/band
4824
4826
  registerTrustCommands(program);