@mneme-ai/core 1.98.0 → 1.99.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/flash/devils_advocate.d.ts +66 -0
- package/dist/flash/devils_advocate.d.ts.map +1 -0
- package/dist/flash/devils_advocate.js +154 -0
- package/dist/flash/devils_advocate.js.map +1 -0
- package/dist/flash/flash.d.ts +50 -0
- package/dist/flash/flash.d.ts.map +1 -0
- package/dist/flash/flash.js +67 -0
- package/dist/flash/flash.js.map +1 -0
- package/dist/flash/flash.test.d.ts +2 -0
- package/dist/flash/flash.test.d.ts.map +1 -0
- package/dist/flash/flash.test.js +221 -0
- package/dist/flash/flash.test.js.map +1 -0
- package/dist/flash/grounding.d.ts +55 -0
- package/dist/flash/grounding.d.ts.map +1 -0
- package/dist/flash/grounding.js +144 -0
- package/dist/flash/grounding.js.map +1 -0
- package/dist/flash/index.d.ts +18 -0
- package/dist/flash/index.d.ts.map +1 -0
- package/dist/flash/index.js +18 -0
- package/dist/flash/index.js.map +1 -0
- package/dist/flash/predictive.d.ts +44 -0
- package/dist/flash/predictive.d.ts.map +1 -0
- package/dist/flash/predictive.js +76 -0
- package/dist/flash/predictive.js.map +1 -0
- package/dist/flash/veracity.d.ts +99 -0
- package/dist/flash/veracity.d.ts.map +1 -0
- package/dist/flash/veracity.js +107 -0
- package/dist/flash/veracity.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/rainbow/passport.d.ts +28 -5
- package/dist/rainbow/passport.d.ts.map +1 -1
- package/dist/rainbow/passport.js +44 -9
- package/dist/rainbow/passport.js.map +1 -1
- package/dist/rainbow/passport_v99.test.d.ts +2 -0
- package/dist/rainbow/passport_v99.test.d.ts.map +1 -0
- package/dist/rainbow/passport_v99.test.js +53 -0
- package/dist/rainbow/passport_v99.test.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.99.0 -- FLASH · Recursive Self-Verification (Devil's Advocate)
|
|
3
|
+
*
|
|
4
|
+
* Before AI confirms ANY claim, it must spawn a second persona that
|
|
5
|
+
* tries to REFUTE the claim. The refutation candidate set is generated
|
|
6
|
+
* by a deterministic transformer (not the AI itself — the AI would
|
|
7
|
+
* just rationalize). Each refutation is scored against the same
|
|
8
|
+
* evidence pool via Veracity. If any refutation's V_eff exceeds the
|
|
9
|
+
* original claim's V_eff, the original is downgraded.
|
|
10
|
+
*
|
|
11
|
+
* The transformer takes a claim and produces refutation candidates by:
|
|
12
|
+
* 1. Negation "X is rare" → "X is common"
|
|
13
|
+
* 2. Source attack "X is rare" → "the rarity claim is from a seller"
|
|
14
|
+
* 3. Specificity flip "Super rare" → "moderately collectible"
|
|
15
|
+
* 4. Burden shift "X is the best Y" → "X is one of several Ys"
|
|
16
|
+
*
|
|
17
|
+
* Each candidate gets V_eff'd. The strongest candidate wins. The
|
|
18
|
+
* difference between candidate.V_eff and original.V_eff is the
|
|
19
|
+
* "refutation pressure" — high pressure means the AI should NOT
|
|
20
|
+
* confirm the original claim.
|
|
21
|
+
*
|
|
22
|
+
* Pure function. Deterministic candidates. No LLM in the hot path.
|
|
23
|
+
*/
|
|
24
|
+
import { type EvidenceItem, type VeracityResult } from "./veracity.js";
|
|
25
|
+
export interface RefutationCandidate {
|
|
26
|
+
text: string;
|
|
27
|
+
/** Which transformation produced it. */
|
|
28
|
+
kind: "negation" | "source-attack" | "specificity-flip" | "burden-shift" | "outlier";
|
|
29
|
+
}
|
|
30
|
+
/** Generate refutation candidates for a claim. Deterministic — same
|
|
31
|
+
* input → same candidates. */
|
|
32
|
+
export declare function generateRefutations(claim: string): RefutationCandidate[];
|
|
33
|
+
export interface DevilsAdvocateResult {
|
|
34
|
+
originalClaim: string;
|
|
35
|
+
originalVeracity: VeracityResult;
|
|
36
|
+
/** Each refutation + its V_eff against the same evidence pool. */
|
|
37
|
+
refutations: Array<{
|
|
38
|
+
candidate: RefutationCandidate;
|
|
39
|
+
veracity: VeracityResult;
|
|
40
|
+
pressure: number;
|
|
41
|
+
}>;
|
|
42
|
+
/** Strongest refutation (max V_eff). */
|
|
43
|
+
topRefutation: {
|
|
44
|
+
candidate: RefutationCandidate;
|
|
45
|
+
veracity: VeracityResult;
|
|
46
|
+
pressure: number;
|
|
47
|
+
} | null;
|
|
48
|
+
/** Adjusted final verdict considering devil's-advocate pressure. */
|
|
49
|
+
finalVerdict: VeracityResult["verdict"];
|
|
50
|
+
/** Reason for the adjustment. */
|
|
51
|
+
adjustmentReason: string;
|
|
52
|
+
}
|
|
53
|
+
export interface DevilsAdvocateInput {
|
|
54
|
+
claim: string;
|
|
55
|
+
evidence: readonly EvidenceItem[];
|
|
56
|
+
hallucinationFactor: number;
|
|
57
|
+
phi_qx?: number;
|
|
58
|
+
/** Optional: provide your own refutation generator (for tests). */
|
|
59
|
+
refutationGenerator?: (claim: string) => RefutationCandidate[];
|
|
60
|
+
}
|
|
61
|
+
/** Run Recursive Self-Verification. Returns the original verdict plus
|
|
62
|
+
* adjustment based on refutation pressure. */
|
|
63
|
+
export declare function runDevilsAdvocate(input: DevilsAdvocateInput): DevilsAdvocateResult;
|
|
64
|
+
/** One-line summary for AI agents to relay. */
|
|
65
|
+
export declare function formatDevilsAdvocatePulseLine(r: DevilsAdvocateResult): string;
|
|
66
|
+
//# sourceMappingURL=devils_advocate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devils_advocate.d.ts","sourceRoot":"","sources":["../../src/flash/devils_advocate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAmB,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAExF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,IAAI,EAAE,UAAU,GA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I confirms ANY claim, it must spawn a second persona that
|
|
5
|
+
* tries to REFUTE the claim. The refutation candidate set is generated
|
|
6
|
+
* by a deterministic transformer (not the AI itself — the AI would
|
|
7
|
+
* just rationalize). Each refutation is scored against the same
|
|
8
|
+
* evidence pool via Veracity. If any refutation's V_eff exceeds the
|
|
9
|
+
* original claim's V_eff, the original is downgraded.
|
|
10
|
+
*
|
|
11
|
+
* The transformer takes a claim and produces refutation candidates by:
|
|
12
|
+
* 1. Negation "X is rare" → "X is common"
|
|
13
|
+
* 2. Source attack "X is rare" → "the rarity claim is from a seller"
|
|
14
|
+
* 3. Specificity flip "Super rare" → "moderately collectible"
|
|
15
|
+
* 4. Burden shift "X is the best Y" → "X is one of several Ys"
|
|
16
|
+
*
|
|
17
|
+
* Each candidate gets V_eff'd. The strongest candidate wins. The
|
|
18
|
+
* difference between candidate.V_eff and original.V_eff is the
|
|
19
|
+
* "refutation pressure" — high pressure means the AI should NOT
|
|
20
|
+
* confirm the original claim.
|
|
21
|
+
*
|
|
22
|
+
* Pure function. Deterministic candidates. No LLM in the hot path.
|
|
23
|
+
*/
|
|
24
|
+
import { computeVeracity } from "./veracity.js";
|
|
25
|
+
const NEGATION_PAIRS = [
|
|
26
|
+
[/\b(super )?rare\b/i, "common / mass-produced"],
|
|
27
|
+
[/\bbest\b/i, "one of many"],
|
|
28
|
+
[/\bunique\b/i, "one of several similar items"],
|
|
29
|
+
[/\bauthentic\b/i, "unverified / possibly counterfeit"],
|
|
30
|
+
[/\bcollectible\b/i, "ordinary consumer item"],
|
|
31
|
+
[/\boriginal\b/i, "reissue / reproduction"],
|
|
32
|
+
[/\bofficial\b/i, "unauthorized / unofficial"],
|
|
33
|
+
[/\blimited edition\b/i, "standard production"],
|
|
34
|
+
[/\bguaranteed\b/i, "claimed without backing"],
|
|
35
|
+
];
|
|
36
|
+
const SOURCE_ATTACK_HINTS = [
|
|
37
|
+
"the rarity / value claim originates from the seller's own listing",
|
|
38
|
+
"the descriptor appears as printed text on commercial packaging",
|
|
39
|
+
"the assertion is marketing copy, not third-party verification",
|
|
40
|
+
];
|
|
41
|
+
const SPECIFICITY_FLIPS = [
|
|
42
|
+
[/\bsuper rare\b/i, "moderately collectible — short of \"super rare\""],
|
|
43
|
+
[/\bextremely\b/i, "moderately"],
|
|
44
|
+
[/\bvery\b/i, "somewhat"],
|
|
45
|
+
[/\bhighly\b/i, "occasionally"],
|
|
46
|
+
];
|
|
47
|
+
const BURDEN_SHIFT_HINTS = [
|
|
48
|
+
"the claim shifts the burden of proof — no public auction record was cited",
|
|
49
|
+
"no production-count is given; the descriptor is qualitative",
|
|
50
|
+
"without independent third-party verification this is a self-attestation",
|
|
51
|
+
];
|
|
52
|
+
/** Generate refutation candidates for a claim. Deterministic — same
|
|
53
|
+
* input → same candidates. */
|
|
54
|
+
export function generateRefutations(claim) {
|
|
55
|
+
const candidates = [];
|
|
56
|
+
// Negation: pattern-match on the claim and emit negated form
|
|
57
|
+
for (const [pattern, replacement] of NEGATION_PAIRS) {
|
|
58
|
+
if (pattern.test(claim)) {
|
|
59
|
+
candidates.push({
|
|
60
|
+
text: claim.replace(pattern, replacement),
|
|
61
|
+
kind: "negation",
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Source attack: emit ALL source-attack refutations (relevant whenever
|
|
66
|
+
// the original claim involved a commercial / promotional source).
|
|
67
|
+
for (const hint of SOURCE_ATTACK_HINTS) {
|
|
68
|
+
candidates.push({ text: hint, kind: "source-attack" });
|
|
69
|
+
}
|
|
70
|
+
// Specificity flip
|
|
71
|
+
for (const [pattern, replacement] of SPECIFICITY_FLIPS) {
|
|
72
|
+
if (pattern.test(claim)) {
|
|
73
|
+
candidates.push({
|
|
74
|
+
text: claim.replace(pattern, replacement),
|
|
75
|
+
kind: "specificity-flip",
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// Burden shift
|
|
80
|
+
for (const hint of BURDEN_SHIFT_HINTS) {
|
|
81
|
+
candidates.push({ text: hint, kind: "burden-shift" });
|
|
82
|
+
}
|
|
83
|
+
// Outlier (always added — null hypothesis)
|
|
84
|
+
candidates.push({
|
|
85
|
+
text: "There is no reliable evidence to evaluate this claim at all.",
|
|
86
|
+
kind: "outlier",
|
|
87
|
+
});
|
|
88
|
+
return candidates;
|
|
89
|
+
}
|
|
90
|
+
/** Run Recursive Self-Verification. Returns the original verdict plus
|
|
91
|
+
* adjustment based on refutation pressure. */
|
|
92
|
+
export function runDevilsAdvocate(input) {
|
|
93
|
+
const originalVeracity = computeVeracity({
|
|
94
|
+
claim: input.claim,
|
|
95
|
+
evidence: input.evidence,
|
|
96
|
+
hallucinationFactor: input.hallucinationFactor,
|
|
97
|
+
phi_qx: input.phi_qx,
|
|
98
|
+
});
|
|
99
|
+
// Refutation evidence: the SAME evidence pool, but each item's
|
|
100
|
+
// supportStrength is INVERTED. If E says "support for rarity = 0.8",
|
|
101
|
+
// then the refutation "support for non-rarity = 0.2". This is the
|
|
102
|
+
// simplest correct flip; callers can override by passing custom
|
|
103
|
+
// evidence into a manual VeracityResult.
|
|
104
|
+
const refutationEvidence = input.evidence.map((e) => ({
|
|
105
|
+
...e,
|
|
106
|
+
supportStrength: 1 - e.supportStrength,
|
|
107
|
+
}));
|
|
108
|
+
const gen = input.refutationGenerator ?? generateRefutations;
|
|
109
|
+
const candidates = gen(input.claim);
|
|
110
|
+
const scored = candidates.map((c) => {
|
|
111
|
+
const veracity = computeVeracity({
|
|
112
|
+
claim: c.text,
|
|
113
|
+
evidence: refutationEvidence,
|
|
114
|
+
hallucinationFactor: input.hallucinationFactor,
|
|
115
|
+
phi_qx: input.phi_qx,
|
|
116
|
+
});
|
|
117
|
+
const pressure = veracity.V_eff - originalVeracity.V_eff;
|
|
118
|
+
return { candidate: c, veracity, pressure };
|
|
119
|
+
});
|
|
120
|
+
// Find top (max V_eff) refutation
|
|
121
|
+
let topRefutation = null;
|
|
122
|
+
for (const s of scored) {
|
|
123
|
+
if (!topRefutation || s.veracity.V_eff > topRefutation.veracity.V_eff) {
|
|
124
|
+
topRefutation = s;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// Adjustment: if the top refutation's V_eff > original's V_eff +
|
|
128
|
+
// small margin, downgrade the original verdict by one tier.
|
|
129
|
+
let finalVerdict = originalVeracity.verdict;
|
|
130
|
+
let adjustmentReason = "no refutation exceeds original V_eff — verdict preserved";
|
|
131
|
+
if (topRefutation && topRefutation.pressure > 0.10) {
|
|
132
|
+
// Downgrade ladder
|
|
133
|
+
const ladder = ["AFFIRM", "CAUTIOUS", "DOUBTFUL", "REFUTE"];
|
|
134
|
+
const idx = ladder.indexOf(finalVerdict);
|
|
135
|
+
const newIdx = Math.min(ladder.length - 1, idx + 1);
|
|
136
|
+
finalVerdict = ladder[newIdx];
|
|
137
|
+
adjustmentReason = `refutation "${topRefutation.candidate.text}" had V_eff=${topRefutation.veracity.V_eff.toFixed(3)} > original ${originalVeracity.V_eff.toFixed(3)} (pressure ${topRefutation.pressure.toFixed(3)}) — downgraded`;
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
originalClaim: input.claim,
|
|
141
|
+
originalVeracity,
|
|
142
|
+
refutations: scored,
|
|
143
|
+
topRefutation,
|
|
144
|
+
finalVerdict,
|
|
145
|
+
adjustmentReason,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/** One-line summary for AI agents to relay. */
|
|
149
|
+
export function formatDevilsAdvocatePulseLine(r) {
|
|
150
|
+
const topId = r.topRefutation ? r.topRefutation.candidate.kind : "none";
|
|
151
|
+
const pressure = r.topRefutation ? r.topRefutation.pressure.toFixed(3) : "0";
|
|
152
|
+
return `DEVILS-ADVOCATE · original=${r.originalVeracity.verdict}(${r.originalVeracity.V_eff.toFixed(3)}) · top-refutation=${topId}(pressure=${pressure}) · final=${r.finalVerdict}`;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=devils_advocate.js.map
|
|
@@ -0,0 +1 @@
|
|
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KAAK,aAAa,QAAQ,aAAa,CAAC,CAAC,YAAY,EAAE,CAAC;AACtL,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.99.0 -- FLASH INTELLIGENCE · the master function
|
|
3
|
+
*
|
|
4
|
+
* The ONE function AI agents call before stating a factual claim:
|
|
5
|
+
*
|
|
6
|
+
* const r = runFlash({ claim, context: rawImageText, hallucinationFactor })
|
|
7
|
+
*
|
|
8
|
+
* Stacks:
|
|
9
|
+
* 1. GROUNDING — classify source context (seller listing vs auction record)
|
|
10
|
+
* 2. VERACITY — compute V_eff = Σ(E·W)/ln(H+e) × Φ_qx
|
|
11
|
+
* 3. DEVIL'S ADVOCATE — Recursive Self-Verification; downgrade if refutation pressure > 0.10
|
|
12
|
+
*
|
|
13
|
+
* AI agent then uses `r.template` as the START of its reply (so the user
|
|
14
|
+
* gets the FLASH-grade answer, not the surface-text hallucination).
|
|
15
|
+
*
|
|
16
|
+
* The whole stack is HMAC-loggable so users can audit which claims
|
|
17
|
+
* passed the V_eff filter and which were downgraded.
|
|
18
|
+
*
|
|
19
|
+
* "Not trained to be skeptical. Engineered to be."
|
|
20
|
+
*/
|
|
21
|
+
import { type EvidenceItem, type VeracityResult, type ClaimVerdict } from "./veracity.js";
|
|
22
|
+
import { type DevilsAdvocateResult } from "./devils_advocate.js";
|
|
23
|
+
import { type GroundingResult } from "./grounding.js";
|
|
24
|
+
export interface FlashInput {
|
|
25
|
+
/** The factual claim under evaluation. */
|
|
26
|
+
claim: string;
|
|
27
|
+
/** Raw text in the user's input (image OCR result, paste, caption, ...). */
|
|
28
|
+
contextText: string;
|
|
29
|
+
/** Optional additional evidence items the AI has gathered. */
|
|
30
|
+
additionalEvidence?: readonly EvidenceItem[];
|
|
31
|
+
/** Base hallucination factor (0 if you're confident; 1 if you're guessing). */
|
|
32
|
+
baseHallucinationFactor?: number;
|
|
33
|
+
/** User's Φ_qx paranoia multiplier. Default 1.0; recommend 2.0 for commerce. */
|
|
34
|
+
phi_qx?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface FlashResult {
|
|
37
|
+
claim: string;
|
|
38
|
+
grounding: GroundingResult;
|
|
39
|
+
veracity: VeracityResult;
|
|
40
|
+
devilsAdvocate: DevilsAdvocateResult;
|
|
41
|
+
/** Final verdict considering grounding + veracity + devil's advocate. */
|
|
42
|
+
verdict: ClaimVerdict;
|
|
43
|
+
/** Suggested first line of the AI's reply. */
|
|
44
|
+
template: string;
|
|
45
|
+
/** Full one-line pulse summary. */
|
|
46
|
+
pulseLine: string;
|
|
47
|
+
}
|
|
48
|
+
/** The master FLASH call. Pure function. Same input → same verdict. */
|
|
49
|
+
export declare function runFlash(input: FlashInput): FlashResult;
|
|
50
|
+
//# sourceMappingURL=flash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flash.d.ts","sourceRoot":"","sources":["../../src/flash/flash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAuC,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAC/H,OAAO,EAAqB,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEnE,MAAM,WAAW,UAAU;IACzB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,WAAW,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,kBAAkB,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IAC7C,+EAA+E;IAC/E,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,eAAe,CAAC;IAC3B,QAAQ,EAAE,cAAc,CAAC;IACzB,cAAc,EAAE,oBAAoB,CAAC;IACrC,yEAAyE;IACzE,OAAO,EAAE,YAAY,CAAC;IACtB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,uEAAuE;AACvE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CA+CvD"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.99.0 -- FLASH INTELLIGENCE · the master function
|
|
3
|
+
*
|
|
4
|
+
* The ONE function AI agents call before stating a factual claim:
|
|
5
|
+
*
|
|
6
|
+
* const r = runFlash({ claim, context: rawImageText, hallucinationFactor })
|
|
7
|
+
*
|
|
8
|
+
* Stacks:
|
|
9
|
+
* 1. GROUNDING — classify source context (seller listing vs auction record)
|
|
10
|
+
* 2. VERACITY — compute V_eff = Σ(E·W)/ln(H+e) × Φ_qx
|
|
11
|
+
* 3. DEVIL'S ADVOCATE — Recursive Self-Verification; downgrade if refutation pressure > 0.10
|
|
12
|
+
*
|
|
13
|
+
* AI agent then uses `r.template` as the START of its reply (so the user
|
|
14
|
+
* gets the FLASH-grade answer, not the surface-text hallucination).
|
|
15
|
+
*
|
|
16
|
+
* The whole stack is HMAC-loggable so users can audit which claims
|
|
17
|
+
* passed the V_eff filter and which were downgraded.
|
|
18
|
+
*
|
|
19
|
+
* "Not trained to be skeptical. Engineered to be."
|
|
20
|
+
*/
|
|
21
|
+
import { computeVeracity, templateForVerdict } from "./veracity.js";
|
|
22
|
+
import { runDevilsAdvocate } from "./devils_advocate.js";
|
|
23
|
+
import { groundClaim } from "./grounding.js";
|
|
24
|
+
/** The master FLASH call. Pure function. Same input → same verdict. */
|
|
25
|
+
export function runFlash(input) {
|
|
26
|
+
// 1) Ground the source context
|
|
27
|
+
const grounding = groundClaim(input.contextText);
|
|
28
|
+
// 2) Compose evidence: start with the grounding inference + any additional
|
|
29
|
+
// evidence the caller provided.
|
|
30
|
+
const groundingEvidence = {
|
|
31
|
+
fact: input.contextText.slice(0, 240),
|
|
32
|
+
supportStrength: grounding.rarityClaims.length > 0 ? 0.8 : 0.3,
|
|
33
|
+
sourceWeight: grounding.suggestedSourceWeight,
|
|
34
|
+
sourceKind: grounding.sourceKind,
|
|
35
|
+
};
|
|
36
|
+
const evidence = [groundingEvidence, ...(input.additionalEvidence ?? [])];
|
|
37
|
+
// 3) Compute hallucination factor: base + grounding-suggested add-on
|
|
38
|
+
const H = (input.baseHallucinationFactor ?? 0) + grounding.suggestedHallucinationAddOn;
|
|
39
|
+
// 4) Compute V_eff
|
|
40
|
+
const veracity = computeVeracity({
|
|
41
|
+
claim: input.claim,
|
|
42
|
+
evidence,
|
|
43
|
+
hallucinationFactor: H,
|
|
44
|
+
phi_qx: input.phi_qx,
|
|
45
|
+
});
|
|
46
|
+
// 5) Recursive Self-Verification
|
|
47
|
+
const devilsAdvocate = runDevilsAdvocate({
|
|
48
|
+
claim: input.claim,
|
|
49
|
+
evidence,
|
|
50
|
+
hallucinationFactor: H,
|
|
51
|
+
phi_qx: input.phi_qx,
|
|
52
|
+
});
|
|
53
|
+
// Final verdict = max(downgrade) over the two layers
|
|
54
|
+
const verdict = devilsAdvocate.finalVerdict;
|
|
55
|
+
const template = templateForVerdict(verdict, input.claim);
|
|
56
|
+
const pulseLine = `FLASH · ${verdict} · V_eff=${veracity.V_eff.toFixed(3)} · context=${grounding.context} · refutation-pressure=${devilsAdvocate.topRefutation?.pressure.toFixed(3) ?? "0"}`;
|
|
57
|
+
return {
|
|
58
|
+
claim: input.claim,
|
|
59
|
+
grounding,
|
|
60
|
+
veracity,
|
|
61
|
+
devilsAdvocate,
|
|
62
|
+
verdict,
|
|
63
|
+
template,
|
|
64
|
+
pulseLine,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=flash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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K;QAClB,QAAQ;QACR,mBAAmB,EAAE,CAAC;QACtB,MAAM,EAAE,KAAK,CAAC,MAAM;KACrB,CAAC,CAAC;IAEH,qDAAqD;IACrD,MAAM,OAAO,GAAG,cAAc,CAAC,YAAY,CAAC;IAC5C,MAAM,QAAQ,GAAG,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1D,MAAM,SAAS,GAAG,WAAW,OAAO,YAAY,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,SAAS,CAAC,OAAO,0BAA0B,cAAc,CAAC,aAAa,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;IAE7L,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,SAAS;QACT,QAAQ;QACR,cAAc;QACd,OAAO;QACP,QAAQ;QACR,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flash.test.d.ts","sourceRoot":"","sources":["../../src/flash/flash.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { computeVeracity, templateForVerdict, formatVeracityPulseLine, generateRefutations, runDevilsAdvocate, formatDevilsAdvocatePulseLine, groundClaim, formatGroundingPulseLine, predictNextQuery, formatPredictionPulseLine, runFlash, DEFAULT_SOURCE_WEIGHT, } from "./index.js";
|
|
3
|
+
// ============================================================
|
|
4
|
+
// VERACITY
|
|
5
|
+
// ============================================================
|
|
6
|
+
describe("v1.99 FLASH · Veracity-Velocity Singularity", () => {
|
|
7
|
+
it("computes V_eff with strong evidence + low H → AFFIRM", () => {
|
|
8
|
+
const r = computeVeracity({
|
|
9
|
+
claim: "this PSA-10 Pikachu Illustrator card is genuinely rare",
|
|
10
|
+
evidence: [
|
|
11
|
+
{ fact: "PSA pop report shows only 41 known copies", supportStrength: 0.95, sourceWeight: 0.95, sourceKind: "expert-database" },
|
|
12
|
+
{ fact: "Goldin auction sold one for $5.3M (2024)", supportStrength: 0.95, sourceWeight: 0.95, sourceKind: "verified-third-party" },
|
|
13
|
+
],
|
|
14
|
+
hallucinationFactor: 0,
|
|
15
|
+
});
|
|
16
|
+
expect(r.V_eff).toBeGreaterThanOrEqual(0.75);
|
|
17
|
+
expect(r.verdict).toBe("AFFIRM");
|
|
18
|
+
});
|
|
19
|
+
it("'Super rare' from seller listing alone → REFUTE", () => {
|
|
20
|
+
const r = computeVeracity({
|
|
21
|
+
claim: "this Capcom Trump card deck is super rare",
|
|
22
|
+
evidence: [
|
|
23
|
+
// Single piece of evidence: the seller's own listing
|
|
24
|
+
{ fact: '"Super rare" printed in listing title', supportStrength: 0.8, sourceWeight: 0.20, sourceKind: "seller-listing" },
|
|
25
|
+
],
|
|
26
|
+
hallucinationFactor: 2.0,
|
|
27
|
+
phi_qx: 2.0, // commerce-source paranoia
|
|
28
|
+
});
|
|
29
|
+
expect(r.V_eff).toBeLessThan(0.30);
|
|
30
|
+
expect(["DOUBTFUL", "REFUTE"]).toContain(r.verdict);
|
|
31
|
+
});
|
|
32
|
+
it("DEFAULT_SOURCE_WEIGHT: seller-listing < image-OCR < user-statement < expert-database < verified-third-party", () => {
|
|
33
|
+
expect(DEFAULT_SOURCE_WEIGHT["seller-listing"]).toBeLessThan(DEFAULT_SOURCE_WEIGHT["image-OCR"]);
|
|
34
|
+
expect(DEFAULT_SOURCE_WEIGHT["image-OCR"]).toBeLessThan(DEFAULT_SOURCE_WEIGHT["user-statement"]);
|
|
35
|
+
expect(DEFAULT_SOURCE_WEIGHT["user-statement"]).toBeLessThan(DEFAULT_SOURCE_WEIGHT["expert-database"]);
|
|
36
|
+
expect(DEFAULT_SOURCE_WEIGHT["expert-database"]).toBeLessThan(DEFAULT_SOURCE_WEIGHT["verified-third-party"]);
|
|
37
|
+
});
|
|
38
|
+
it("ln(H+e) is always >= 1 (no division by zero)", () => {
|
|
39
|
+
const r = computeVeracity({
|
|
40
|
+
claim: "x",
|
|
41
|
+
evidence: [{ fact: "y", supportStrength: 1, sourceWeight: 1, sourceKind: "verified-third-party" }],
|
|
42
|
+
hallucinationFactor: 0,
|
|
43
|
+
});
|
|
44
|
+
expect(r.hallucinationPenalty).toBeGreaterThanOrEqual(1);
|
|
45
|
+
});
|
|
46
|
+
it("Φ_qx multiplier scales V_eff", () => {
|
|
47
|
+
const base = computeVeracity({ claim: "x", evidence: [{ fact: "y", supportStrength: 0.5, sourceWeight: 0.5, sourceKind: "unknown" }], hallucinationFactor: 0 });
|
|
48
|
+
const skeptical = computeVeracity({ claim: "x", evidence: [{ fact: "y", supportStrength: 0.5, sourceWeight: 0.5, sourceKind: "unknown" }], hallucinationFactor: 0, phi_qx: 0.5 });
|
|
49
|
+
expect(skeptical.V_eff).toBeCloseTo(base.V_eff * 0.5, 5);
|
|
50
|
+
});
|
|
51
|
+
it("templateForVerdict produces vendor-appropriate response stems", () => {
|
|
52
|
+
expect(templateForVerdict("AFFIRM", "the card is rare")).toContain("Verified");
|
|
53
|
+
expect(templateForVerdict("CAUTIOUS", "the card is rare")).toContain("Partially supported");
|
|
54
|
+
expect(templateForVerdict("DOUBTFUL", "the card is rare")).toContain("Cannot confirm");
|
|
55
|
+
expect(templateForVerdict("REFUTE", "the card is rare")).toContain("Refuse to confirm");
|
|
56
|
+
});
|
|
57
|
+
it("formatVeracityPulseLine produces compact summary", () => {
|
|
58
|
+
const r = computeVeracity({ claim: "x", evidence: [{ fact: "y", supportStrength: 0.5, sourceWeight: 0.5, sourceKind: "unknown" }], hallucinationFactor: 0 });
|
|
59
|
+
const line = formatVeracityPulseLine(r);
|
|
60
|
+
expect(line).toContain("V_eff=");
|
|
61
|
+
expect(line).toContain("verdict=");
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
// ============================================================
|
|
65
|
+
// DEVIL'S ADVOCATE
|
|
66
|
+
// ============================================================
|
|
67
|
+
describe("v1.99 FLASH · Recursive Self-Verification (Devil's Advocate)", () => {
|
|
68
|
+
it("generateRefutations emits negation, source-attack, specificity-flip, burden-shift, outlier", () => {
|
|
69
|
+
const r = generateRefutations("this item is super rare");
|
|
70
|
+
const kinds = new Set(r.map((c) => c.kind));
|
|
71
|
+
expect(kinds).toContain("negation");
|
|
72
|
+
expect(kinds).toContain("source-attack");
|
|
73
|
+
expect(kinds).toContain("specificity-flip");
|
|
74
|
+
expect(kinds).toContain("burden-shift");
|
|
75
|
+
expect(kinds).toContain("outlier");
|
|
76
|
+
});
|
|
77
|
+
it("downgrades AFFIRM → CAUTIOUS when refutation pressure > 0.10", () => {
|
|
78
|
+
const r = runDevilsAdvocate({
|
|
79
|
+
claim: "this trump card is super rare",
|
|
80
|
+
evidence: [
|
|
81
|
+
{ fact: "listing says super rare", supportStrength: 0.7, sourceWeight: 0.20, sourceKind: "seller-listing" },
|
|
82
|
+
],
|
|
83
|
+
hallucinationFactor: 1.5,
|
|
84
|
+
phi_qx: 1.0,
|
|
85
|
+
});
|
|
86
|
+
expect(r.refutations.length).toBeGreaterThan(0);
|
|
87
|
+
expect(r.topRefutation).not.toBeNull();
|
|
88
|
+
// Original was DOUBTFUL → after downgrade still in DOUBTFUL or REFUTE
|
|
89
|
+
expect(["DOUBTFUL", "REFUTE"]).toContain(r.finalVerdict);
|
|
90
|
+
});
|
|
91
|
+
it("preserves verdict when refutation pressure is < 0.10", () => {
|
|
92
|
+
const r = runDevilsAdvocate({
|
|
93
|
+
claim: "this PSA-10 card has 41 known copies",
|
|
94
|
+
evidence: [
|
|
95
|
+
{ fact: "PSA pop report shows 41", supportStrength: 0.95, sourceWeight: 0.95, sourceKind: "expert-database" },
|
|
96
|
+
{ fact: "Goldin auction sold one $5.3M", supportStrength: 0.9, sourceWeight: 0.95, sourceKind: "verified-third-party" },
|
|
97
|
+
],
|
|
98
|
+
hallucinationFactor: 0,
|
|
99
|
+
});
|
|
100
|
+
expect(r.finalVerdict).toBe("AFFIRM");
|
|
101
|
+
expect(r.adjustmentReason).toMatch(/preserved|no refutation/i);
|
|
102
|
+
});
|
|
103
|
+
it("custom refutation generator can be injected (for tests)", () => {
|
|
104
|
+
const r = runDevilsAdvocate({
|
|
105
|
+
claim: "x",
|
|
106
|
+
evidence: [{ fact: "y", supportStrength: 0.5, sourceWeight: 0.5, sourceKind: "unknown" }],
|
|
107
|
+
hallucinationFactor: 0,
|
|
108
|
+
refutationGenerator: () => [{ text: "fake refutation", kind: "outlier" }],
|
|
109
|
+
});
|
|
110
|
+
expect(r.refutations.length).toBe(1);
|
|
111
|
+
expect(r.refutations[0].candidate.text).toBe("fake refutation");
|
|
112
|
+
});
|
|
113
|
+
it("formatDevilsAdvocatePulseLine produces compact summary", () => {
|
|
114
|
+
const r = runDevilsAdvocate({ claim: "x", evidence: [{ fact: "y", supportStrength: 0.5, sourceWeight: 0.5, sourceKind: "unknown" }], hallucinationFactor: 0 });
|
|
115
|
+
const line = formatDevilsAdvocatePulseLine(r);
|
|
116
|
+
expect(line).toContain("DEVILS-ADVOCATE");
|
|
117
|
+
expect(line).toContain("final=");
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
// ============================================================
|
|
121
|
+
// GROUNDING
|
|
122
|
+
// ============================================================
|
|
123
|
+
describe("v1.99 FLASH · Hyper-Contextual Grounding", () => {
|
|
124
|
+
it("classifies seller-listing context from commerce signals", () => {
|
|
125
|
+
const r = groundClaim("[Super rare] CAPCOM Capcom Character Trump Street Fighter Mega Man ฿1,086.49 (tax included) Shipping included Buy Now on Buyee");
|
|
126
|
+
expect(r.context).toBe("seller-listing");
|
|
127
|
+
expect(r.commerceSignals.length).toBeGreaterThanOrEqual(2);
|
|
128
|
+
expect(r.rarityClaims.length).toBeGreaterThanOrEqual(1);
|
|
129
|
+
expect(r.suggestedSourceWeight).toBeLessThan(0.30);
|
|
130
|
+
expect(r.suggestedHallucinationAddOn).toBeGreaterThanOrEqual(1.0);
|
|
131
|
+
});
|
|
132
|
+
it("classifies expert-review context with PSA / population-report signals", () => {
|
|
133
|
+
const r = groundClaim("PSA grading confirms this card. Population report: 41 copies. Auction record: Goldin 2024.");
|
|
134
|
+
expect(r.context).toBe("expert-review");
|
|
135
|
+
expect(r.thirdPartyProofs.length).toBeGreaterThanOrEqual(2);
|
|
136
|
+
expect(r.suggestedSourceWeight).toBeGreaterThanOrEqual(0.80);
|
|
137
|
+
});
|
|
138
|
+
it("classifies user-statement when rarity present but no commerce + no proof", () => {
|
|
139
|
+
const r = groundClaim("I think this thing is rare");
|
|
140
|
+
expect(r.context).toBe("user-statement");
|
|
141
|
+
});
|
|
142
|
+
it("classifies neutral-text when nothing matches", () => {
|
|
143
|
+
const r = groundClaim("This is some random product description with no specific claims.");
|
|
144
|
+
expect(r.context).toBe("neutral-text");
|
|
145
|
+
});
|
|
146
|
+
it("formatGroundingPulseLine produces compact summary", () => {
|
|
147
|
+
const r = groundClaim("[Super rare] ฿1,086.49 Buy Now on Buyee");
|
|
148
|
+
const line = formatGroundingPulseLine(r);
|
|
149
|
+
expect(line).toContain("GROUNDING");
|
|
150
|
+
expect(line).toContain("rarity=");
|
|
151
|
+
expect(line).toContain("commerce=");
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
// ============================================================
|
|
155
|
+
// PROMPT-Q LATENCY
|
|
156
|
+
// ============================================================
|
|
157
|
+
describe("v1.99 FLASH · Prompt-Q-Latency Engine", () => {
|
|
158
|
+
it("predicts 'rarity-followup' when reply mentions rare/collectible", () => {
|
|
159
|
+
const r = predictNextQuery("Cannot confirm this is rare without auction history.");
|
|
160
|
+
expect(r.predictions[0]?.feature.id).toBe("rarity-followup");
|
|
161
|
+
});
|
|
162
|
+
it("predicts 'value-followup' when reply mentions price/worth", () => {
|
|
163
|
+
const r = predictNextQuery("The listed price is 1,086.49 baht.");
|
|
164
|
+
expect(r.predictions.some((p) => p.feature.id === "value-followup")).toBe(true);
|
|
165
|
+
});
|
|
166
|
+
it("returns empty predictions when reply has no triggers", () => {
|
|
167
|
+
const r = predictNextQuery("Hello!");
|
|
168
|
+
expect(r.predictions.length).toBe(0);
|
|
169
|
+
});
|
|
170
|
+
it("formatPredictionPulseLine produces compact summary", () => {
|
|
171
|
+
const r = predictNextQuery("The rare card is collectible.");
|
|
172
|
+
const line = formatPredictionPulseLine(r);
|
|
173
|
+
expect(line).toContain("PROMPT-Q");
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
// ============================================================
|
|
177
|
+
// FLASH MASTER — the user's exact "Super rare CAPCOM" case
|
|
178
|
+
// ============================================================
|
|
179
|
+
describe("v1.99 FLASH · the user's exact 'Super rare CAPCOM' hallucination case", () => {
|
|
180
|
+
it("refuses to confirm 'super rare' when the only evidence is the seller listing", () => {
|
|
181
|
+
const r = runFlash({
|
|
182
|
+
claim: "this Capcom Trump card deck is super rare",
|
|
183
|
+
contextText: "[Super rare] CAPCOM Capcom Character Trump Street Fighter Mega Man ฿1,086.49 (tax included) Shipping included Buy Now on Buyee. Product Description: 90年代に販売されたカプコンの人気キャラクター...",
|
|
184
|
+
baseHallucinationFactor: 0,
|
|
185
|
+
phi_qx: 2.0, // commerce paranoia
|
|
186
|
+
});
|
|
187
|
+
// CORE assertion: vanilla AIs would AFFIRM ("yes it's super rare!").
|
|
188
|
+
// FLASH must NOT AFFIRM.
|
|
189
|
+
expect(r.verdict).not.toBe("AFFIRM");
|
|
190
|
+
expect(["DOUBTFUL", "REFUTE"]).toContain(r.verdict);
|
|
191
|
+
expect(r.grounding.context).toBe("seller-listing");
|
|
192
|
+
expect(r.grounding.rarityClaims.length).toBeGreaterThan(0);
|
|
193
|
+
expect(r.veracity.V_eff).toBeLessThan(0.30);
|
|
194
|
+
expect(r.template).toMatch(/Cannot confirm|Refuse to confirm/);
|
|
195
|
+
});
|
|
196
|
+
it("AFFIRMs the same claim WHEN third-party evidence is also present", () => {
|
|
197
|
+
const r = runFlash({
|
|
198
|
+
claim: "this Capcom Trump card deck is super rare",
|
|
199
|
+
contextText: "[Super rare] CAPCOM Capcom Character Trump ฿1,086.49 Buy Now on Buyee",
|
|
200
|
+
additionalEvidence: [
|
|
201
|
+
{ fact: "Mandarake catalog shows only 800 copies were printed (1994)", supportStrength: 0.9, sourceWeight: 0.85, sourceKind: "expert-database" },
|
|
202
|
+
{ fact: "Yahoo Auctions Japan 5-year history shows 7 completed sales, avg ¥4800", supportStrength: 0.85, sourceWeight: 0.90, sourceKind: "verified-third-party" },
|
|
203
|
+
],
|
|
204
|
+
baseHallucinationFactor: 0,
|
|
205
|
+
phi_qx: 1.0,
|
|
206
|
+
});
|
|
207
|
+
expect(["AFFIRM", "CAUTIOUS"]).toContain(r.verdict);
|
|
208
|
+
expect(r.veracity.V_eff).toBeGreaterThan(0.35);
|
|
209
|
+
});
|
|
210
|
+
it("produces a pulseLine that an AI agent can surface to the user", () => {
|
|
211
|
+
const r = runFlash({
|
|
212
|
+
claim: "this is super rare",
|
|
213
|
+
contextText: "[Super rare] ฿1,086.49 Buy Now on Buyee",
|
|
214
|
+
baseHallucinationFactor: 0,
|
|
215
|
+
});
|
|
216
|
+
expect(r.pulseLine).toContain("FLASH");
|
|
217
|
+
expect(r.pulseLine).toMatch(/AFFIRM|CAUTIOUS|DOUBTFUL|REFUTE/);
|
|
218
|
+
expect(r.pulseLine).toContain("V_eff=");
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
//# sourceMappingURL=flash.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flash.test.js","sourceRoot":"","sources":["../../src/flash/flash.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,6BAA6B,EAC7B,WAAW,EACX,wBAAwB,EACxB,gBAAgB,EAChB,yBAAyB,EACzB,QAAQ,EACR,qBAAqB,GAE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