mneme-ai 3.116.0 → 3.118.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/hpe.d.ts +10 -0
- package/dist/commands/hpe.d.ts.map +1 -0
- package/dist/commands/hpe.js +65 -0
- package/dist/commands/hpe.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mneme protect` (v3.117.0) — the Hallucination Protection Engine. Run an AI
|
|
3
|
+
* claim/output through the nerve mesh → TRUSTED / REVIEW / BLOCK + the fired nerves.
|
|
4
|
+
*
|
|
5
|
+
* mneme protect "p > 0.05 so the drug has no effect"
|
|
6
|
+
* mneme protect bench
|
|
7
|
+
*/
|
|
8
|
+
import type { Command } from "commander";
|
|
9
|
+
export declare function registerHpeCommands(program: Command): void;
|
|
10
|
+
//# sourceMappingURL=hpe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hpe.d.ts","sourceRoot":"","sources":["../../src/commands/hpe.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkC1D"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mneme protect` (v3.117.0) — the Hallucination Protection Engine. Run an AI
|
|
3
|
+
* claim/output through the nerve mesh → TRUSTED / REVIEW / BLOCK + the fired nerves.
|
|
4
|
+
*
|
|
5
|
+
* mneme protect "p > 0.05 so the drug has no effect"
|
|
6
|
+
* mneme protect bench
|
|
7
|
+
*/
|
|
8
|
+
import { hpe, notary } from "@mneme-ai/core";
|
|
9
|
+
function out(s) { process.stdout.write(s + "\n"); }
|
|
10
|
+
export function registerHpeCommands(program) {
|
|
11
|
+
const g = program
|
|
12
|
+
.command("protect")
|
|
13
|
+
.alias("hpe")
|
|
14
|
+
.argument("[claim...]", "an AI claim/output to screen")
|
|
15
|
+
.description("🧠 HALLUCINATION PROTECTION ENGINE — screen an AI claim through a mesh of INDEPENDENT nerves (statistical fallacy · self-contradiction · overconfidence · fabrication-risk · + external truth-grounding/consensus/injection). REFLEX-blocks any hard fault, ABSTAINS (REVIEW) when unverifiable, passes only well-calibrated claims → TRUSTED/REVIEW/BLOCK. HONEST: drives confidently-wrong → ~0 (precision-when-TRUSTED 1.0 measured), NOT 0% hallucination (impossible). TRUSTED = no KNOWN fault, not a proof of truth.")
|
|
16
|
+
.option("--json", "JSON output (signed)")
|
|
17
|
+
.action((claim, opts) => {
|
|
18
|
+
const q = Array.isArray(claim) ? claim.join(" ") : String(claim ?? "");
|
|
19
|
+
if (!q.trim()) {
|
|
20
|
+
out("usage: mneme protect \"<an AI claim>\"");
|
|
21
|
+
process.exitCode = 2;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const r = hpe.protect(q);
|
|
25
|
+
let receipt = null;
|
|
26
|
+
try {
|
|
27
|
+
receipt = notary.issueReceipt(process.cwd(), { kind: "claim-verdict", subject: `hpe:${r.verdict}`, payload: { verdict: r.verdict, trust: r.trust, fired: r.fired.map((f) => f.nerve) }, includePayload: true });
|
|
28
|
+
}
|
|
29
|
+
catch { /* */ }
|
|
30
|
+
if (opts.json) {
|
|
31
|
+
out(JSON.stringify({ ...r, signed: receipt }, null, 2));
|
|
32
|
+
process.exitCode = r.verdict === "BLOCK" ? 2 : 0;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const icon = r.verdict === "TRUSTED" ? "✓" : r.verdict === "REVIEW" ? "❔" : "🛑";
|
|
36
|
+
out(`${icon} ${r.verdict} (trust ${(r.trust * 100).toFixed(0)}%)`);
|
|
37
|
+
for (const f of r.fired) {
|
|
38
|
+
out(` • [${f.severity}] ${f.nerve}: ${f.why}`);
|
|
39
|
+
out(` fix: ${f.fix}`);
|
|
40
|
+
}
|
|
41
|
+
if (!r.fired.length)
|
|
42
|
+
out(` no nerve fired — no known fault (not a proof of truth).`);
|
|
43
|
+
process.exitCode = r.verdict === "BLOCK" ? 2 : 0;
|
|
44
|
+
});
|
|
45
|
+
g.command("bench")
|
|
46
|
+
.description("the signed A/B: precision-when-TRUSTED (no hallucination passes) + per-class containment, on a labeled corpus.")
|
|
47
|
+
.option("--json", "JSON output")
|
|
48
|
+
.action((opts) => {
|
|
49
|
+
const b = hpe.hpeBench();
|
|
50
|
+
let receipt = null;
|
|
51
|
+
try {
|
|
52
|
+
receipt = notary.issueReceipt(process.cwd(), { kind: "reasoning-trace", subject: `hpe.bench:p${b.precisionWhenTrusted}`, payload: { precisionWhenTrusted: b.precisionWhenTrusted, leaks: b.leaks.length }, includePayload: true });
|
|
53
|
+
}
|
|
54
|
+
catch { /* */ }
|
|
55
|
+
if (opts.json) {
|
|
56
|
+
out(JSON.stringify({ ...b, signed: receipt }, null, 2));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
out(`🧠 HPE — ${b.total} labeled claims (${b.risky} hallucination-class + ${b.safe} well-calibrated):`);
|
|
60
|
+
out(` ★ precision-when-TRUSTED: ${(b.precisionWhenTrusted * 100).toFixed(0)}% (${b.leaks.length} hallucination leaked as TRUSTED)`);
|
|
61
|
+
out(` hallucinations contained: ${b.hallucinationsBlockedOrReviewed}/${b.risky} · safe passed: ${b.safeTrusted}/${b.safe} (coverage ${(b.safeCoverage * 100).toFixed(0)}%)`);
|
|
62
|
+
out(` ${receipt ? "✓ signed · " : ""}HONEST: confidently-wrong → ~0 via reflex+abstain; NOT 0% hallucination (a novel failure no nerve models can still pass).`);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=hpe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hpe.js","sourceRoot":"","s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,CAAC,+BAA+B,IAAI,CAAC,CAAC,KAAK,oBAAoB,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,YAAY,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAChL,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,2HAA2H,CAAC,CAAC;IACrK,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/index.js
CHANGED
|
@@ -130,6 +130,7 @@ import { registerSiegeCommands } from "./commands/siege.js";
|
|
|
130
130
|
import { registerCanonCommands } from "./commands/canon.js";
|
|
131
131
|
import { registerSdcCommands } from "./commands/sdc.js";
|
|
132
132
|
import { registerStatguardCommands } from "./commands/statguard.js";
|
|
133
|
+
import { registerHpeCommands } from "./commands/hpe.js";
|
|
133
134
|
import { registerMoatCommands } from "./commands/moat.js";
|
|
134
135
|
import { attachRegretOracle } from "./commands/regret.js";
|
|
135
136
|
import { registerTrustCommands } from "./commands/trust.js";
|
|
@@ -4817,6 +4818,7 @@ export async function run(argv) {
|
|
|
4817
4818
|
registerCanonCommands(program);
|
|
4818
4819
|
registerSdcCommands(program);
|
|
4819
4820
|
registerStatguardCommands(program);
|
|
4821
|
+
registerHpeCommands(program);
|
|
4820
4822
|
registerMoatCommands(program);
|
|
4821
4823
|
// ─── Trust calibrator (v1.31.0) -- per-subsystem precision/recall/band
|
|
4822
4824
|
registerTrustCommands(program);
|