@mneme-ai/core 2.19.1 → 2.19.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/dist/agent_manifest.d.ts +1 -1
- package/dist/agent_manifest.d.ts.map +1 -1
- package/dist/agent_manifest.js +12 -1
- package/dist/agent_manifest.js.map +1 -1
- package/dist/cosmic/aurelian_v192.test.d.ts +2 -0
- package/dist/cosmic/aurelian_v192.test.d.ts.map +1 -0
- package/dist/cosmic/aurelian_v192.test.js +68 -0
- package/dist/cosmic/aurelian_v192.test.js.map +1 -0
- package/dist/cosmic/aurelian_v193.test.d.ts +2 -0
- package/dist/cosmic/aurelian_v193.test.d.ts.map +1 -0
- package/dist/cosmic/aurelian_v193.test.js +34 -0
- package/dist/cosmic/aurelian_v193.test.js.map +1 -0
- package/dist/embedder_auto_promote/embedder_auto_promote.test.d.ts +2 -0
- package/dist/embedder_auto_promote/embedder_auto_promote.test.d.ts.map +1 -0
- package/dist/embedder_auto_promote/embedder_auto_promote.test.js +61 -0
- package/dist/embedder_auto_promote/embedder_auto_promote.test.js.map +1 -0
- package/dist/embedder_auto_promote/index.d.ts +50 -0
- package/dist/embedder_auto_promote/index.d.ts.map +1 -0
- package/dist/embedder_auto_promote/index.js +85 -0
- package/dist/embedder_auto_promote/index.js.map +1 -0
- package/dist/evolution/evolution.test.d.ts +2 -0
- package/dist/evolution/evolution.test.d.ts.map +1 -0
- package/dist/evolution/evolution.test.js +90 -0
- package/dist/evolution/evolution.test.js.map +1 -0
- package/dist/evolution/index.d.ts +74 -0
- package/dist/evolution/index.d.ts.map +1 -0
- package/dist/evolution/index.js +161 -0
- package/dist/evolution/index.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/inverse_forensics/index.d.ts +141 -0
- package/dist/inverse_forensics/index.d.ts.map +1 -0
- package/dist/inverse_forensics/index.js +294 -0
- package/dist/inverse_forensics/index.js.map +1 -0
- package/dist/inverse_forensics/inverse_forensics.test.d.ts +2 -0
- package/dist/inverse_forensics/inverse_forensics.test.d.ts.map +1 -0
- package/dist/inverse_forensics/inverse_forensics.test.js +289 -0
- package/dist/inverse_forensics/inverse_forensics.test.js.map +1 -0
- package/dist/mcp_drift/index.d.ts +42 -0
- package/dist/mcp_drift/index.d.ts.map +1 -0
- package/dist/mcp_drift/index.js +103 -0
- package/dist/mcp_drift/index.js.map +1 -0
- package/dist/mcp_drift/mcp_drift.test.d.ts +2 -0
- package/dist/mcp_drift/mcp_drift.test.d.ts.map +1 -0
- package/dist/mcp_drift/mcp_drift.test.js +61 -0
- package/dist/mcp_drift/mcp_drift.test.js.map +1 -0
- package/dist/soul_journal/index.d.ts +76 -0
- package/dist/soul_journal/index.d.ts.map +1 -0
- package/dist/soul_journal/index.js +160 -0
- package/dist/soul_journal/index.js.map +1 -0
- package/dist/soul_journal/soul_journal.test.d.ts +2 -0
- package/dist/soul_journal/soul_journal.test.d.ts.map +1 -0
- package/dist/soul_journal/soul_journal.test.js +83 -0
- package/dist/soul_journal/soul_journal.test.js.map +1 -0
- package/dist/whats_new.d.ts.map +1 -1
- package/dist/whats_new.js +16 -0
- package/dist/whats_new.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2.19.3 — MNEME INVERSE-LLM PROMPT FORENSICS (the rarest direction in AI)
|
|
3
|
+
*
|
|
4
|
+
* "Every AI vendor runs INPUT → OUTPUT. Nobody runs OUTPUT → INPUT
|
|
5
|
+
* — because there's no business reason to. That's exactly the gap
|
|
6
|
+
* Mneme exploits. Given an AI output and a CLAIMED question that
|
|
7
|
+
* produced it, ask any inverse-oracle 'what K questions would a
|
|
8
|
+
* calibrated AI most likely answer with this exact output?'. If the
|
|
9
|
+
* claimed question is not among the top-K (by similarity), the
|
|
10
|
+
* output is either (a) hallucinated by the producing AI, or
|
|
11
|
+
* (b) prompt-injected — secretly answering a DIFFERENT question
|
|
12
|
+
* that an attacker smuggled in. Either way: reject it."
|
|
13
|
+
*
|
|
14
|
+
* Why this is novel:
|
|
15
|
+
* - First HMAC-signed inverse-direction audit primitive
|
|
16
|
+
* - Vendor-agnostic — caller supplies the inverse oracle (any vendor)
|
|
17
|
+
* - Pure mathematical verdict over similarity ranking — no LLM call
|
|
18
|
+
* inside this module (we orchestrate the math; caller calls the AI)
|
|
19
|
+
* - Closes the prompt-injection class for ANY text Mneme ingests
|
|
20
|
+
* (soul prompts, inbox messages, commit messages, parasite bridges)
|
|
21
|
+
*
|
|
22
|
+
* Honest scope:
|
|
23
|
+
* - This catches CONSISTENCY between claimed question and output.
|
|
24
|
+
* A perfectly camouflaged injection where the malicious output
|
|
25
|
+
* also plausibly answers the benign claimed question will still
|
|
26
|
+
* pass — but the COST of building such an output is high.
|
|
27
|
+
* - This does NOT prove TRUTH. An output can be consistent with its
|
|
28
|
+
* question and still be wrong about the world.
|
|
29
|
+
* - Similarity is method-dependent. We support 3 methods (Jaccard /
|
|
30
|
+
* trigram / caller-supplied-embeddings) and signal the choice in
|
|
31
|
+
* the receipt so audits are reproducible.
|
|
32
|
+
*
|
|
33
|
+
* Composes onto v2.6 TRUTH KERNEL (this becomes a new sensor) +
|
|
34
|
+
* v2.18 NEXUS PROACTIVE (rejection can be pushed to the AI agent).
|
|
35
|
+
* Pure additive layer; no breaking change.
|
|
36
|
+
*/
|
|
37
|
+
declare const PROTOCOL_VERSION: 1;
|
|
38
|
+
export type SimilarityMethod = "jaccard" | "trigram" | "embedded";
|
|
39
|
+
export type Verdict = "trusted" | "suspicious" | "rejected";
|
|
40
|
+
export interface InverseAuditInput {
|
|
41
|
+
/** The AI-generated output we're auditing. */
|
|
42
|
+
output: string;
|
|
43
|
+
/** The question the user/AI claims produced this output. */
|
|
44
|
+
claimedQuestion: string;
|
|
45
|
+
/** K candidate questions returned by the inverse oracle (any AI vendor),
|
|
46
|
+
* ordered by inverse-oracle's likelihood (most likely first). */
|
|
47
|
+
oracleQuestions: string[];
|
|
48
|
+
/** Similarity threshold to count as a match. Default 0.45 for Jaccard,
|
|
49
|
+
* 0.55 for trigram, 0.6 for embedded (caller can override). */
|
|
50
|
+
threshold?: number;
|
|
51
|
+
/** If best match rank ≤ this, verdict = trusted. Default 3. */
|
|
52
|
+
topKForTrust?: number;
|
|
53
|
+
/** Default "jaccard" (no deps + fast + portable). */
|
|
54
|
+
similarityMethod?: SimilarityMethod;
|
|
55
|
+
/** When using embedded mode, caller must supply vectors. */
|
|
56
|
+
precomputedEmbeddings?: {
|
|
57
|
+
claimed: number[];
|
|
58
|
+
oracle: number[][];
|
|
59
|
+
};
|
|
60
|
+
ts?: string;
|
|
61
|
+
secret?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface InverseAuditVerdict {
|
|
64
|
+
v: typeof PROTOCOL_VERSION;
|
|
65
|
+
auditId: string;
|
|
66
|
+
verdict: Verdict;
|
|
67
|
+
/** 1..K (best match rank) or K+1 (no match found). */
|
|
68
|
+
bestRank: number;
|
|
69
|
+
/** Highest similarity any oracle question reached vs claimed. */
|
|
70
|
+
bestSimilarity: number;
|
|
71
|
+
/** Similarity of each oracle question vs claimed (same order as input). */
|
|
72
|
+
perOracleSimilarity: number[];
|
|
73
|
+
/** Threshold used. */
|
|
74
|
+
threshold: number;
|
|
75
|
+
topKForTrust: number;
|
|
76
|
+
similarityMethod: SimilarityMethod;
|
|
77
|
+
/** K, derived from oracleQuestions.length. */
|
|
78
|
+
k: number;
|
|
79
|
+
reasons: string[];
|
|
80
|
+
/** Plain-English message for the AI agent / user. */
|
|
81
|
+
message: string;
|
|
82
|
+
/** Output digest (first 16 hex of sha256) — for audit cross-reference without leaking content. */
|
|
83
|
+
outputDigest: string;
|
|
84
|
+
ts: string;
|
|
85
|
+
sig: string;
|
|
86
|
+
}
|
|
87
|
+
export declare function jaccardSimilarity(a: string, b: string): number;
|
|
88
|
+
export declare function trigramSimilarity(a: string, b: string): number;
|
|
89
|
+
export declare function cosineSimilarity(a: number[], b: number[]): number;
|
|
90
|
+
export declare function auditOutput(input: InverseAuditInput): InverseAuditVerdict;
|
|
91
|
+
export declare function verifyAuditVerdict(v: InverseAuditVerdict, secret?: string): boolean;
|
|
92
|
+
export declare function formatInverseLine(v: InverseAuditVerdict): string;
|
|
93
|
+
/**
|
|
94
|
+
* Build the meta-prompt the caller should send to ANY inverse-oracle AI.
|
|
95
|
+
* Returned as plain text — caller wires this into chatgpt / claude / gemini /
|
|
96
|
+
* grok / etc., parses the K-question response, and passes it back to
|
|
97
|
+
* auditOutput().
|
|
98
|
+
*/
|
|
99
|
+
export declare function buildInverseOraclePrompt(input: {
|
|
100
|
+
output: string;
|
|
101
|
+
k?: number;
|
|
102
|
+
}): string;
|
|
103
|
+
/**
|
|
104
|
+
* Parse the inverse-oracle's free-text response into a question array.
|
|
105
|
+
* Tolerant of numbering prefixes, leading dashes, blank lines.
|
|
106
|
+
*/
|
|
107
|
+
export declare function parseInverseOracleResponse(text: string, maxK?: number): string[];
|
|
108
|
+
export interface BenchmarkSample {
|
|
109
|
+
output: string;
|
|
110
|
+
claimedQuestion: string;
|
|
111
|
+
oracleQuestions: string[];
|
|
112
|
+
/** Ground truth: was this output really an answer to claimedQuestion? */
|
|
113
|
+
trueLabel: "legitimate" | "injection_or_hallucination";
|
|
114
|
+
}
|
|
115
|
+
export interface BenchmarkResult {
|
|
116
|
+
v: typeof PROTOCOL_VERSION;
|
|
117
|
+
samples: number;
|
|
118
|
+
truePositive: number;
|
|
119
|
+
falsePositive: number;
|
|
120
|
+
trueNegative: number;
|
|
121
|
+
falseNegative: number;
|
|
122
|
+
precision: number;
|
|
123
|
+
recall: number;
|
|
124
|
+
f1: number;
|
|
125
|
+
similarityMethod: SimilarityMethod;
|
|
126
|
+
threshold: number;
|
|
127
|
+
topKForTrust: number;
|
|
128
|
+
ranByVendor?: string;
|
|
129
|
+
ts: string;
|
|
130
|
+
sig: string;
|
|
131
|
+
}
|
|
132
|
+
export declare function benchmark(input: {
|
|
133
|
+
samples: BenchmarkSample[];
|
|
134
|
+
similarityMethod?: SimilarityMethod;
|
|
135
|
+
threshold?: number;
|
|
136
|
+
topKForTrust?: number;
|
|
137
|
+
ranByVendor?: string;
|
|
138
|
+
secret?: string;
|
|
139
|
+
}): BenchmarkResult;
|
|
140
|
+
export {};
|
|
141
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/inverse_forensics/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAIH,QAAA,MAAM,gBAAgB,EAAG,CAAU,CAAC;AAEpC,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;AAClE,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,YAAY,GAAG,UAAU,CAAC;AAE5D,MAAM,WAAW,iBAAiB;IAChC,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,eAAe,EAAE,MAAM,CAAC;IACxB;sEACkE;IAClE,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B;oEACgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,4DAA4D;IAC5D,qBAAqB,CAAC,EAAE;QACtB,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;KACpB,CAAC;IACF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,CAAC,EAAE,OAAO,gBAAgB,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB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MAAM,EAAE,IAAI,GAAE,MAAW,GAAG,MAAM,EAAE,CAQpF;AAGD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,yEAAyE;IACzE,SAAS,EAAE,YAAY,GAAG,4BAA4B,CAAC;CACxD;AAED,MAAM,WAAW,eAAe;IAC9B,CAAC,EAAE,OAAO,gBAAgB,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAC/B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,eAAe,CAwClB"}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2.19.3 — MNEME INVERSE-LLM PROMPT FORENSICS (the rarest direction in AI)
|
|
3
|
+
*
|
|
4
|
+
* "Every AI vendor runs INPUT → OUTPUT. Nobody runs OUTPUT → INPUT
|
|
5
|
+
* — because there's no business reason to. That's exactly the gap
|
|
6
|
+
* Mneme exploits. Given an AI output and a CLAIMED question that
|
|
7
|
+
* produced it, ask any inverse-oracle 'what K questions would a
|
|
8
|
+
* calibrated AI most likely answer with this exact output?'. If the
|
|
9
|
+
* claimed question is not among the top-K (by similarity), the
|
|
10
|
+
* output is either (a) hallucinated by the producing AI, or
|
|
11
|
+
* (b) prompt-injected — secretly answering a DIFFERENT question
|
|
12
|
+
* that an attacker smuggled in. Either way: reject it."
|
|
13
|
+
*
|
|
14
|
+
* Why this is novel:
|
|
15
|
+
* - First HMAC-signed inverse-direction audit primitive
|
|
16
|
+
* - Vendor-agnostic — caller supplies the inverse oracle (any vendor)
|
|
17
|
+
* - Pure mathematical verdict over similarity ranking — no LLM call
|
|
18
|
+
* inside this module (we orchestrate the math; caller calls the AI)
|
|
19
|
+
* - Closes the prompt-injection class for ANY text Mneme ingests
|
|
20
|
+
* (soul prompts, inbox messages, commit messages, parasite bridges)
|
|
21
|
+
*
|
|
22
|
+
* Honest scope:
|
|
23
|
+
* - This catches CONSISTENCY between claimed question and output.
|
|
24
|
+
* A perfectly camouflaged injection where the malicious output
|
|
25
|
+
* also plausibly answers the benign claimed question will still
|
|
26
|
+
* pass — but the COST of building such an output is high.
|
|
27
|
+
* - This does NOT prove TRUTH. An output can be consistent with its
|
|
28
|
+
* question and still be wrong about the world.
|
|
29
|
+
* - Similarity is method-dependent. We support 3 methods (Jaccard /
|
|
30
|
+
* trigram / caller-supplied-embeddings) and signal the choice in
|
|
31
|
+
* the receipt so audits are reproducible.
|
|
32
|
+
*
|
|
33
|
+
* Composes onto v2.6 TRUTH KERNEL (this becomes a new sensor) +
|
|
34
|
+
* v2.18 NEXUS PROACTIVE (rejection can be pushed to the AI agent).
|
|
35
|
+
* Pure additive layer; no breaking change.
|
|
36
|
+
*/
|
|
37
|
+
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
38
|
+
const PROTOCOL_VERSION = 1;
|
|
39
|
+
const DEFAULT_THRESHOLDS = {
|
|
40
|
+
jaccard: 0.45,
|
|
41
|
+
trigram: 0.55,
|
|
42
|
+
embedded: 0.60,
|
|
43
|
+
};
|
|
44
|
+
function canon(v) {
|
|
45
|
+
if (v === null || typeof v !== "object")
|
|
46
|
+
return JSON.stringify(v);
|
|
47
|
+
if (Array.isArray(v))
|
|
48
|
+
return "[" + v.map(canon).join(",") + "]";
|
|
49
|
+
const keys = Object.keys(v).sort();
|
|
50
|
+
return "{" + keys.map((k) => JSON.stringify(k) + ":" + canon(v[k])).join(",") + "}";
|
|
51
|
+
}
|
|
52
|
+
function defaultSecret() {
|
|
53
|
+
return process.env["MNEME_INVERSE_SECRET"] || `mneme-inverse-forensics-v${PROTOCOL_VERSION}`;
|
|
54
|
+
}
|
|
55
|
+
function hmac(body, secret) {
|
|
56
|
+
return createHmac("sha256", secret).update(canon(body)).digest("hex");
|
|
57
|
+
}
|
|
58
|
+
// ─── Similarity functions ────────────────────────────────────────────
|
|
59
|
+
const STOP = new Set([
|
|
60
|
+
"the", "a", "an", "and", "or", "but", "is", "it", "to", "of", "in", "on",
|
|
61
|
+
"for", "with", "as", "at", "by", "this", "that", "be", "you", "i", "we",
|
|
62
|
+
"they", "are", "was", "were", "have", "has", "had", "do", "does", "did",
|
|
63
|
+
"not", "so", "if", "then", "than", "from", "out", "up", "your", "my",
|
|
64
|
+
"our", "their", "its", "what", "when", "where", "how", "why", "would",
|
|
65
|
+
"could", "should", "may", "might", "will", "shall",
|
|
66
|
+
]);
|
|
67
|
+
function tokenize(s) {
|
|
68
|
+
return (s.toLowerCase().match(/[a-z][a-z0-9_]+/g) ?? []).filter((t) => !STOP.has(t) && t.length >= 2);
|
|
69
|
+
}
|
|
70
|
+
export function jaccardSimilarity(a, b) {
|
|
71
|
+
const ta = new Set(tokenize(a));
|
|
72
|
+
const tb = new Set(tokenize(b));
|
|
73
|
+
if (ta.size === 0 && tb.size === 0)
|
|
74
|
+
return 1;
|
|
75
|
+
let inter = 0;
|
|
76
|
+
for (const t of ta)
|
|
77
|
+
if (tb.has(t))
|
|
78
|
+
inter++;
|
|
79
|
+
const union = ta.size + tb.size - inter;
|
|
80
|
+
return union === 0 ? 0 : inter / union;
|
|
81
|
+
}
|
|
82
|
+
export function trigramSimilarity(a, b) {
|
|
83
|
+
const norm = (s) => ` ${s.toLowerCase().replace(/[^a-z0-9 ]+/g, " ").replace(/\s+/g, " ").trim()} `;
|
|
84
|
+
const grams = (s) => {
|
|
85
|
+
const out = new Set();
|
|
86
|
+
const n = norm(s);
|
|
87
|
+
for (let i = 0; i < n.length - 2; i++)
|
|
88
|
+
out.add(n.slice(i, i + 3));
|
|
89
|
+
return out;
|
|
90
|
+
};
|
|
91
|
+
const ga = grams(a);
|
|
92
|
+
const gb = grams(b);
|
|
93
|
+
if (ga.size === 0 && gb.size === 0)
|
|
94
|
+
return 1;
|
|
95
|
+
let inter = 0;
|
|
96
|
+
for (const g of ga)
|
|
97
|
+
if (gb.has(g))
|
|
98
|
+
inter++;
|
|
99
|
+
const union = ga.size + gb.size - inter;
|
|
100
|
+
return union === 0 ? 0 : inter / union;
|
|
101
|
+
}
|
|
102
|
+
export function cosineSimilarity(a, b) {
|
|
103
|
+
if (a.length !== b.length)
|
|
104
|
+
throw new Error(`cosine: dim mismatch ${a.length} vs ${b.length}`);
|
|
105
|
+
let dot = 0, na = 0, nb = 0;
|
|
106
|
+
for (let i = 0; i < a.length; i++) {
|
|
107
|
+
dot += a[i] * b[i];
|
|
108
|
+
na += a[i] * a[i];
|
|
109
|
+
nb += b[i] * b[i];
|
|
110
|
+
}
|
|
111
|
+
const denom = Math.sqrt(na) * Math.sqrt(nb);
|
|
112
|
+
return denom === 0 ? 0 : dot / denom;
|
|
113
|
+
}
|
|
114
|
+
function pickSim(method, claimed, oracle, embeds, i) {
|
|
115
|
+
if (method === "jaccard")
|
|
116
|
+
return jaccardSimilarity(claimed, oracle);
|
|
117
|
+
if (method === "trigram")
|
|
118
|
+
return trigramSimilarity(claimed, oracle);
|
|
119
|
+
// embedded
|
|
120
|
+
if (!embeds)
|
|
121
|
+
throw new Error("INVERSE: similarityMethod=embedded requires precomputedEmbeddings");
|
|
122
|
+
if (i === undefined)
|
|
123
|
+
throw new Error("INVERSE: index required for embedded mode");
|
|
124
|
+
if (!embeds.oracle[i])
|
|
125
|
+
throw new Error(`INVERSE: missing embedding for oracle[${i}]`);
|
|
126
|
+
return cosineSimilarity(embeds.claimed, embeds.oracle[i]);
|
|
127
|
+
}
|
|
128
|
+
// ─── Core: auditOutput ──────────────────────────────────────────────────
|
|
129
|
+
export function auditOutput(input) {
|
|
130
|
+
if (input.oracleQuestions.length === 0) {
|
|
131
|
+
throw new Error("INVERSE: oracleQuestions must contain at least 1 candidate from the inverse oracle");
|
|
132
|
+
}
|
|
133
|
+
const ts = input.ts ?? new Date().toISOString();
|
|
134
|
+
const method = input.similarityMethod ?? "jaccard";
|
|
135
|
+
const threshold = input.threshold ?? DEFAULT_THRESHOLDS[method];
|
|
136
|
+
const topKForTrust = input.topKForTrust ?? 3;
|
|
137
|
+
const k = input.oracleQuestions.length;
|
|
138
|
+
// Compute similarity per oracle question.
|
|
139
|
+
const sims = new Array(k);
|
|
140
|
+
for (let i = 0; i < k; i++) {
|
|
141
|
+
sims[i] = pickSim(method, input.claimedQuestion, input.oracleQuestions[i], input.precomputedEmbeddings, i);
|
|
142
|
+
}
|
|
143
|
+
// Best rank: index of first question whose similarity ≥ threshold, +1 (1-indexed).
|
|
144
|
+
let bestRank = k + 1;
|
|
145
|
+
let bestSim = 0;
|
|
146
|
+
for (let i = 0; i < k; i++) {
|
|
147
|
+
if (sims[i] > bestSim)
|
|
148
|
+
bestSim = sims[i];
|
|
149
|
+
if (sims[i] >= threshold && bestRank > i + 1)
|
|
150
|
+
bestRank = i + 1;
|
|
151
|
+
}
|
|
152
|
+
// round sim numbers
|
|
153
|
+
const round3 = (n) => Math.round(n * 1000) / 1000;
|
|
154
|
+
const perOracleSimilarity = sims.map(round3);
|
|
155
|
+
bestSim = round3(bestSim);
|
|
156
|
+
const reasons = [];
|
|
157
|
+
reasons.push(`similarity method: ${method} · threshold: ${threshold}`);
|
|
158
|
+
reasons.push(`best similarity ${bestSim} at rank ${bestRank === k + 1 ? "(none)" : bestRank}`);
|
|
159
|
+
let verdict;
|
|
160
|
+
let message;
|
|
161
|
+
// No oracle question passed threshold → REJECTED (regardless of K size).
|
|
162
|
+
// This branch must come FIRST: when k < topKForTrust and no match exists,
|
|
163
|
+
// bestRank = k+1 would otherwise be ≤ topKForTrust and falsely trust.
|
|
164
|
+
if (bestRank > k) {
|
|
165
|
+
verdict = "rejected";
|
|
166
|
+
message = `🔁 INVERSE REJECTED · claimed question NOT found in oracle's top-${k} reconstructions (best sim ${bestSim} < threshold ${threshold}) · likely prompt-injection or hallucination`;
|
|
167
|
+
}
|
|
168
|
+
else if (bestRank <= topKForTrust) {
|
|
169
|
+
verdict = "trusted";
|
|
170
|
+
message = `🔁 INVERSE TRUSTED · claimed question matches oracle's top-${bestRank} reconstruction · sim ${bestSim}`;
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
verdict = "suspicious";
|
|
174
|
+
message = `🔁 INVERSE SUSPICIOUS · claimed question matches but only at rank ${bestRank}/${k} · sim ${bestSim} · review before trusting`;
|
|
175
|
+
}
|
|
176
|
+
const outputDigest = createHmac("sha256", "mneme-inverse-digest").update(input.output).digest("hex").slice(0, 16);
|
|
177
|
+
const auditId = "inv-" + createHmac("sha256", "mneme-inverse-id").update(`${ts}|${outputDigest}|${input.claimedQuestion.slice(0, 40)}`).digest("hex").slice(0, 14);
|
|
178
|
+
const body = {
|
|
179
|
+
v: PROTOCOL_VERSION,
|
|
180
|
+
auditId,
|
|
181
|
+
verdict,
|
|
182
|
+
bestRank,
|
|
183
|
+
bestSimilarity: bestSim,
|
|
184
|
+
perOracleSimilarity,
|
|
185
|
+
threshold,
|
|
186
|
+
topKForTrust,
|
|
187
|
+
similarityMethod: method,
|
|
188
|
+
k,
|
|
189
|
+
reasons,
|
|
190
|
+
message,
|
|
191
|
+
outputDigest,
|
|
192
|
+
ts,
|
|
193
|
+
};
|
|
194
|
+
const sig = hmac(body, input.secret ?? defaultSecret());
|
|
195
|
+
return { ...body, sig };
|
|
196
|
+
}
|
|
197
|
+
export function verifyAuditVerdict(v, secret) {
|
|
198
|
+
const { sig: claimed, ...body } = v;
|
|
199
|
+
const expected = hmac(body, secret ?? defaultSecret());
|
|
200
|
+
try {
|
|
201
|
+
return timingSafeEqual(Buffer.from(expected, "hex"), Buffer.from(claimed, "hex"));
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
export function formatInverseLine(v) {
|
|
208
|
+
const icon = v.verdict === "trusted" ? "✅" : v.verdict === "suspicious" ? "🟧" : "🟥";
|
|
209
|
+
return `${icon} INVERSE · ${v.verdict.toUpperCase()} · rank=${v.bestRank}/${v.k} · sim=${v.bestSimilarity}`;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Build the meta-prompt the caller should send to ANY inverse-oracle AI.
|
|
213
|
+
* Returned as plain text — caller wires this into chatgpt / claude / gemini /
|
|
214
|
+
* grok / etc., parses the K-question response, and passes it back to
|
|
215
|
+
* auditOutput().
|
|
216
|
+
*/
|
|
217
|
+
export function buildInverseOraclePrompt(input) {
|
|
218
|
+
const k = input.k ?? 10;
|
|
219
|
+
return [
|
|
220
|
+
`You are an INVERSE-ORACLE for AI prompt forensics.`,
|
|
221
|
+
`Given the AI-generated OUTPUT below, list the ${k} most likely QUESTIONS that a calibrated AI would answer with exactly this output.`,
|
|
222
|
+
`Rules:`,
|
|
223
|
+
` 1. Rank by likelihood; most likely first.`,
|
|
224
|
+
` 2. Each question on its own line, no numbering, no extra commentary.`,
|
|
225
|
+
` 3. Use natural human phrasing; no template boilerplate.`,
|
|
226
|
+
` 4. Do NOT explain — just the ${k} questions.`,
|
|
227
|
+
``,
|
|
228
|
+
`OUTPUT:`,
|
|
229
|
+
`"""`,
|
|
230
|
+
input.output,
|
|
231
|
+
`"""`,
|
|
232
|
+
``,
|
|
233
|
+
`Now list the ${k} most likely questions, one per line:`,
|
|
234
|
+
].join("\n");
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Parse the inverse-oracle's free-text response into a question array.
|
|
238
|
+
* Tolerant of numbering prefixes, leading dashes, blank lines.
|
|
239
|
+
*/
|
|
240
|
+
export function parseInverseOracleResponse(text, maxK = 20) {
|
|
241
|
+
return text
|
|
242
|
+
.split("\n")
|
|
243
|
+
.map((l) => l.trim())
|
|
244
|
+
.filter(Boolean)
|
|
245
|
+
.map((l) => l.replace(/^(?:\d+[.)\s]+|[-*•]\s+)/, "").trim())
|
|
246
|
+
.filter((l) => l.length >= 4)
|
|
247
|
+
.slice(0, maxK);
|
|
248
|
+
}
|
|
249
|
+
export function benchmark(input) {
|
|
250
|
+
const method = input.similarityMethod ?? "jaccard";
|
|
251
|
+
const threshold = input.threshold ?? DEFAULT_THRESHOLDS[method];
|
|
252
|
+
const topKForTrust = input.topKForTrust ?? 3;
|
|
253
|
+
let TP = 0, FP = 0, TN = 0, FN = 0;
|
|
254
|
+
for (const s of input.samples) {
|
|
255
|
+
const v = auditOutput({
|
|
256
|
+
output: s.output,
|
|
257
|
+
claimedQuestion: s.claimedQuestion,
|
|
258
|
+
oracleQuestions: s.oracleQuestions,
|
|
259
|
+
similarityMethod: method,
|
|
260
|
+
threshold,
|
|
261
|
+
topKForTrust,
|
|
262
|
+
});
|
|
263
|
+
const flagged = v.verdict === "rejected" || v.verdict === "suspicious";
|
|
264
|
+
const isBad = s.trueLabel === "injection_or_hallucination";
|
|
265
|
+
if (isBad && flagged)
|
|
266
|
+
TP++;
|
|
267
|
+
else if (!isBad && flagged)
|
|
268
|
+
FP++;
|
|
269
|
+
else if (!isBad && !flagged)
|
|
270
|
+
TN++;
|
|
271
|
+
else
|
|
272
|
+
FN++;
|
|
273
|
+
}
|
|
274
|
+
const precision = TP + FP === 0 ? 0 : TP / (TP + FP);
|
|
275
|
+
const recall = TP + FN === 0 ? 0 : TP / (TP + FN);
|
|
276
|
+
const f1 = precision + recall === 0 ? 0 : (2 * precision * recall) / (precision + recall);
|
|
277
|
+
const ts = new Date().toISOString();
|
|
278
|
+
const body = {
|
|
279
|
+
v: PROTOCOL_VERSION,
|
|
280
|
+
samples: input.samples.length,
|
|
281
|
+
truePositive: TP, falsePositive: FP, trueNegative: TN, falseNegative: FN,
|
|
282
|
+
precision: Math.round(precision * 10000) / 10000,
|
|
283
|
+
recall: Math.round(recall * 10000) / 10000,
|
|
284
|
+
f1: Math.round(f1 * 10000) / 10000,
|
|
285
|
+
similarityMethod: method,
|
|
286
|
+
threshold,
|
|
287
|
+
topKForTrust,
|
|
288
|
+
...(input.ranByVendor ? { ranByVendor: input.ranByVendor } : {}),
|
|
289
|
+
ts,
|
|
290
|
+
};
|
|
291
|
+
const sig = hmac(body, input.secret ?? defaultSecret());
|
|
292
|
+
return { ...body, sig };
|
|
293
|
+
}
|
|
294
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/inverse_forensics/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,gBAAgB,GAAG,CAAU,CAAC;AAsDpC,MAAM,kBAAkB,GAAqC;IAC3D,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,IAAI;CACf,CAAC;AAEF,SAAS,KAAK,CAAC,CAAU;IACvB,IAAI,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAClE,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAAE,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