@mneme-ai/core 2.29.0 → 2.30.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.
Files changed (47) hide show
  1. package/dist/agent_manifest.d.ts +1 -1
  2. package/dist/agent_manifest.d.ts.map +1 -1
  3. package/dist/agent_manifest.js +52 -0
  4. package/dist/agent_manifest.js.map +1 -1
  5. package/dist/conclave/aletheia_weights.d.ts.map +1 -1
  6. package/dist/conclave/aletheia_weights.js +16 -4
  7. package/dist/conclave/aletheia_weights.js.map +1 -1
  8. package/dist/diaspora/http_bridge.d.ts.map +1 -1
  9. package/dist/honest_mirror/anonymizer.d.ts +29 -0
  10. package/dist/honest_mirror/anonymizer.d.ts.map +1 -0
  11. package/dist/honest_mirror/anonymizer.js +77 -0
  12. package/dist/honest_mirror/anonymizer.js.map +1 -0
  13. package/dist/honest_mirror/calibration.d.ts +37 -0
  14. package/dist/honest_mirror/calibration.d.ts.map +1 -0
  15. package/dist/honest_mirror/calibration.js +106 -0
  16. package/dist/honest_mirror/calibration.js.map +1 -0
  17. package/dist/honest_mirror/engine.d.ts +66 -0
  18. package/dist/honest_mirror/engine.d.ts.map +1 -0
  19. package/dist/honest_mirror/engine.js +227 -0
  20. package/dist/honest_mirror/engine.js.map +1 -0
  21. package/dist/honest_mirror/honest_mirror.test.d.ts +2 -0
  22. package/dist/honest_mirror/honest_mirror.test.d.ts.map +1 -0
  23. package/dist/honest_mirror/honest_mirror.test.js +109 -0
  24. package/dist/honest_mirror/honest_mirror.test.js.map +1 -0
  25. package/dist/honest_mirror/index.d.ts +11 -0
  26. package/dist/honest_mirror/index.d.ts.map +1 -0
  27. package/dist/honest_mirror/index.js +9 -0
  28. package/dist/honest_mirror/index.js.map +1 -0
  29. package/dist/honest_mirror/sources/git_commit_source.d.ts +30 -0
  30. package/dist/honest_mirror/sources/git_commit_source.d.ts.map +1 -0
  31. package/dist/honest_mirror/sources/git_commit_source.js +106 -0
  32. package/dist/honest_mirror/sources/git_commit_source.js.map +1 -0
  33. package/dist/honest_mirror/types.d.ts +126 -0
  34. package/dist/honest_mirror/types.d.ts.map +1 -0
  35. package/dist/honest_mirror/types.js +31 -0
  36. package/dist/honest_mirror/types.js.map +1 -0
  37. package/dist/index.d.ts +1 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +9 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/truth_gate/claims.d.ts.map +1 -1
  42. package/dist/truth_gate/claims.js +9 -0
  43. package/dist/truth_gate/claims.js.map +1 -1
  44. package/dist/truth_gate/probes.d.ts.map +1 -1
  45. package/dist/truth_gate/probes.js +34 -0
  46. package/dist/truth_gate/probes.js.map +1 -1
  47. package/package.json +1 -1
@@ -0,0 +1,77 @@
1
+ /**
2
+ * v2.30.0 — Differential-privacy-style scrubber for HONEST MIRROR.
3
+ *
4
+ * Replaces secrets / PII / absolute paths with stable salted hashes so:
5
+ * - vendor never sees the user's real keys / emails / paths
6
+ * - same secret across artifacts still hashes to the same token (so
7
+ * the vendor can reason about "the same X" without seeing its
8
+ * actual value)
9
+ * - the scrub is deterministic (HMAC of the secret + salt) so calibration
10
+ * across runs is reproducible
11
+ *
12
+ * Coverage (v2.30.0):
13
+ * - AWS / GitHub / OpenAI / Anthropic key prefixes
14
+ * - JWT (3-segment dot-separated)
15
+ * - PEM private key blocks
16
+ * - emails
17
+ * - absolute file paths (Windows + POSIX)
18
+ * - long hex digests (sha / commit hashes — keep first 7 chars for git)
19
+ *
20
+ * Returns the scrubbed text + a redaction map so callers can interpret
21
+ * `<SECRET:abc123>` references in the vendor's answer.
22
+ */
23
+ import { createHmac } from "node:crypto";
24
+ const SCRUB_KEY = process.env["MNEME_HONEST_MIRROR_KEY"] ?? "mneme-honest-mirror-v1";
25
+ function token(kind, value) {
26
+ const h = createHmac("sha256", SCRUB_KEY).update(`${kind}|${value}`).digest("hex").slice(0, 8);
27
+ return `<${kind.toUpperCase()}:${h}>`;
28
+ }
29
+ const RULES = [
30
+ // PEM private key blocks (multiline; must come before generic hex)
31
+ { kind: "pem", re: /-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g },
32
+ // JWT
33
+ { kind: "jwt", re: /\beyJ[A-Za-z0-9_-]{20,}\.eyJ[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}\b/g },
34
+ // AWS
35
+ { kind: "aws_key", re: /\b(AKIA|ASIA)[0-9A-Z]{16}\b/g },
36
+ // GitHub
37
+ { kind: "gh_token", re: /\b(ghp|gho|ghs|ghr|github_pat)_[A-Za-z0-9_]{20,}\b/g },
38
+ // OpenAI
39
+ { kind: "openai_key", re: /\bsk-[A-Za-z0-9_-]{20,}\b/g },
40
+ // Anthropic
41
+ { kind: "anthropic_key", re: /\bsk-ant-[A-Za-z0-9_-]{20,}\b/g },
42
+ // Generic Bearer
43
+ { kind: "bearer", re: /\b(?:Bearer|bearer)\s+[A-Za-z0-9._\-+/=]{20,}\b/g },
44
+ // Emails
45
+ { kind: "email", re: /\b[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,}\b/g },
46
+ // Windows absolute paths
47
+ { kind: "win_path", re: /\b[A-Za-z]:\\(?:[^\s\\/:*?"<>|]+\\)*[^\s\\/:*?"<>|]+\b/g },
48
+ // POSIX absolute paths (skip common shared dirs)
49
+ { kind: "posix_path", re: /(?<!\w)\/(?:home|Users|var|root|opt|srv)\/[^\s'"]+/g },
50
+ // Long hex (git commit hashes / sha256) — preserve first 7 chars
51
+ {
52
+ kind: "sha",
53
+ re: /\b[a-f0-9]{40,}\b/g,
54
+ replacer: (m) => `${m[0].slice(0, 7)}<SHA:${createHmac("sha256", SCRUB_KEY).update(m[0]).digest("hex").slice(0, 6)}>`,
55
+ },
56
+ ];
57
+ export function scrub(text) {
58
+ let out = text;
59
+ let total = 0;
60
+ const kinds = {};
61
+ for (const rule of RULES) {
62
+ out = out.replace(rule.re, (match) => {
63
+ total++;
64
+ kinds[rule.kind] = (kinds[rule.kind] ?? 0) + 1;
65
+ if (rule.replacer) {
66
+ // Execute the regex on the match to fabricate the array shape replacer expects.
67
+ const fake = [match];
68
+ fake.index = 0;
69
+ fake.input = match;
70
+ return rule.replacer(fake);
71
+ }
72
+ return token(rule.kind, match);
73
+ });
74
+ }
75
+ return { text: out, redactionCount: total, redactedKinds: kinds };
76
+ }
77
+ //# sourceMappingURL=anonymizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anonymizer.js","sourceRoot":"","sources":["../../src/honest_mirror/anonymizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,IAAI,wBAAwB,CAAC;AAQrF,SAAS,KAAK,CAAC,IAAY,EAAE,KAAa;IACxC,MAAM,CAAC,GAAG,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/F,OAAO,IAAI,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC;AACxC,CAAC;AAED,MAAM,KAAK,GAAmF;IAC5F,mEAAmE;IACnE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,6EAA6E,EAAE;IAClG,MAAM;IACN,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,uEAAuE,EAAE;IAC5F,MAAM;IACN,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,8BAA8B,EAAE;IACvD,SAAS;IACT,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,qDAAqD,EAAE;IAC/E,SAAS;IACT,EAAE,IAAI,EAAE,YAAY,EA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AI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAClB,gFAAgF;gBAChF,MAAM,IAAI,GAAG,CAAC,KAAK,CAA+B,CAAC;gBACnD,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;gBACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;gBACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC;YACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;AACpE,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * v2.30.0 — Calibration scorer for HONEST MIRROR.
3
+ *
4
+ * Given the vendor's answer + the accepted answer (commit diff /
5
+ * landed code), compute:
6
+ * - semanticSimilarity (0..1) — embedder cosine OR fallback to
7
+ * token-Jaccard when no embedder is available
8
+ * - measuredCorrectness — same as semanticSimilarity (rename for
9
+ * clarity in the report)
10
+ * - calibrationDelta = reportedConfidence - measuredCorrectness
11
+ *
12
+ * Plus a plain-English interpretation:
13
+ * "well-calibrated" |delta| < 0.10
14
+ * "over-confident" delta > 0.10
15
+ * "under-confident" delta < -0.10
16
+ */
17
+ import type { CalibrationDelta, VendorReplayResult, AcceptedAnswer } from "./types.js";
18
+ /**
19
+ * Compute calibration delta for ONE vendor's reply vs the accepted
20
+ * answer. Uses an embedder when available; falls back to token-Jaccard
21
+ * so the calibrator works even without a fancy model.
22
+ */
23
+ export declare function computeDelta(artifactId: string, vendorReply: VendorReplayResult, accepted: AcceptedAnswer, opts?: {
24
+ embed?: (texts: string[]) => Promise<Float32Array[]>;
25
+ }): Promise<CalibrationDelta>;
26
+ /**
27
+ * From a list of CalibrationDelta for ONE vendor, derive an aggregate
28
+ * weight in [0, 1] suitable for feeding back into CONCLAVE Aletheia
29
+ * scoring. The rule:
30
+ * - start at 0.5 neutral
31
+ * - reward measured correctness: +0.5 × mean(correctness)
32
+ * - punish over-confidence: -0.3 × max(0, mean(delta))
33
+ * - clamp to [0.1, 0.95] (never drop a vendor below 0.1; never
34
+ * trust above 0.95 because the floor of calibration is statistical)
35
+ */
36
+ export declare function suggestedWeight(deltas: CalibrationDelta[]): number;
37
+ //# sourceMappingURL=calibration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calibration.d.ts","sourceRoot":"","sources":["../../src/honest_mirror/calibration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAiBvF;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,kBAAkB,EAC/B,QAAQ,EAAE,cAAc,EACxB,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,YAAY,EAAE,CAAC,CAAA;CAAO,GAClE,OAAO,CAAC,gBAAgB,CAAC,CAiC3B;AAcD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,CAMlE"}
@@ -0,0 +1,106 @@
1
+ /**
2
+ * v2.30.0 — Calibration scorer for HONEST MIRROR.
3
+ *
4
+ * Given the vendor's answer + the accepted answer (commit diff /
5
+ * landed code), compute:
6
+ * - semanticSimilarity (0..1) — embedder cosine OR fallback to
7
+ * token-Jaccard when no embedder is available
8
+ * - measuredCorrectness — same as semanticSimilarity (rename for
9
+ * clarity in the report)
10
+ * - calibrationDelta = reportedConfidence - measuredCorrectness
11
+ *
12
+ * Plus a plain-English interpretation:
13
+ * "well-calibrated" |delta| < 0.10
14
+ * "over-confident" delta > 0.10
15
+ * "under-confident" delta < -0.10
16
+ */
17
+ /** Tokenize for fallback Jaccard. Lower-cased, alpha-num + dash + dot. */
18
+ function tokenize(s) {
19
+ return new Set(s.toLowerCase().split(/[^a-z0-9.\-_]+/g).filter((t) => t.length >= 3));
20
+ }
21
+ function jaccard(a, b) {
22
+ if (a.size === 0 && b.size === 0)
23
+ return 0;
24
+ let inter = 0;
25
+ for (const t of a)
26
+ if (b.has(t))
27
+ inter++;
28
+ const union = a.size + b.size - inter;
29
+ return union === 0 ? 0 : inter / union;
30
+ }
31
+ /**
32
+ * Compute calibration delta for ONE vendor's reply vs the accepted
33
+ * answer. Uses an embedder when available; falls back to token-Jaccard
34
+ * so the calibrator works even without a fancy model.
35
+ */
36
+ export async function computeDelta(artifactId, vendorReply, accepted, opts = {}) {
37
+ let semanticSimilarity = 0;
38
+ if (opts.embed) {
39
+ try {
40
+ const vecs = await opts.embed([vendorReply.answer, accepted.text]);
41
+ const a = vecs[0];
42
+ const b = vecs[1];
43
+ semanticSimilarity = cosine(a, b);
44
+ }
45
+ catch {
46
+ semanticSimilarity = jaccard(tokenize(vendorReply.answer), tokenize(accepted.text));
47
+ }
48
+ }
49
+ else {
50
+ semanticSimilarity = jaccard(tokenize(vendorReply.answer), tokenize(accepted.text));
51
+ }
52
+ const measuredCorrectness = semanticSimilarity;
53
+ const calibrationDelta = vendorReply.confidence - measuredCorrectness;
54
+ let interpretation;
55
+ if (Math.abs(calibrationDelta) < 0.10) {
56
+ interpretation = `well-calibrated (Δ=${(calibrationDelta * 100).toFixed(0)}%)`;
57
+ }
58
+ else if (calibrationDelta > 0) {
59
+ interpretation = `over-confident — said ${Math.round(vendorReply.confidence * 100)}% sure but answer matched only ${Math.round(measuredCorrectness * 100)}%`;
60
+ }
61
+ else {
62
+ interpretation = `under-confident — said ${Math.round(vendorReply.confidence * 100)}% sure but answer matched ${Math.round(measuredCorrectness * 100)}%`;
63
+ }
64
+ return {
65
+ vendor: vendorReply.vendor,
66
+ artifactId,
67
+ semanticSimilarity,
68
+ reportedConfidence: vendorReply.confidence,
69
+ measuredCorrectness,
70
+ calibrationDelta,
71
+ interpretation,
72
+ };
73
+ }
74
+ function cosine(a, b) {
75
+ if (a.length !== b.length)
76
+ return 0;
77
+ let dot = 0, na = 0, nb = 0;
78
+ for (let i = 0; i < a.length; i++) {
79
+ const x = a[i];
80
+ const y = b[i];
81
+ dot += x * y;
82
+ na += x * x;
83
+ nb += y * y;
84
+ }
85
+ const denom = Math.sqrt(na) * Math.sqrt(nb);
86
+ return denom === 0 ? 0 : Math.max(-1, Math.min(1, dot / denom));
87
+ }
88
+ /**
89
+ * From a list of CalibrationDelta for ONE vendor, derive an aggregate
90
+ * weight in [0, 1] suitable for feeding back into CONCLAVE Aletheia
91
+ * scoring. The rule:
92
+ * - start at 0.5 neutral
93
+ * - reward measured correctness: +0.5 × mean(correctness)
94
+ * - punish over-confidence: -0.3 × max(0, mean(delta))
95
+ * - clamp to [0.1, 0.95] (never drop a vendor below 0.1; never
96
+ * trust above 0.95 because the floor of calibration is statistical)
97
+ */
98
+ export function suggestedWeight(deltas) {
99
+ if (deltas.length === 0)
100
+ return 0.5;
101
+ const meanCorrect = deltas.reduce((s, d) => s + d.measuredCorrectness, 0) / deltas.length;
102
+ const meanDelta = deltas.reduce((s, d) => s + d.calibrationDelta, 0) / deltas.length;
103
+ const raw = 0.5 + 0.5 * meanCorrect - 0.3 * Math.max(0, meanDelta);
104
+ return Math.max(0.1, Math.min(0.95, Number(raw.toFixed(3))));
105
+ }
106
+ //# sourceMappingURL=calibration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calibration.js","sourceRoot":"","sources":["../../src/honest_mirror/calibration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,0EAA0E;AAC1E,SAAS,QAAQ,CAAC,CAAS;IACzB,OAAO,IAAI,GAAG,CACZ,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAA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C,EAAE,SAAS,CAAC,CAAC;IACnE,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * v2.30.0 — HONEST MIRROR engine.
3
+ *
4
+ * Orchestrates: pull artifacts → DP-scrub → blind-replay through N
5
+ * vendors → compare to accepted answers → emit per-vendor calibration
6
+ * delta + suggested Aletheia weight → HMAC-chain the report.
7
+ *
8
+ * Composes with CONCLAVE: the suggestedAletheiaWeight field is the
9
+ * feedback loop closure — a vendor with bad calibration on the user's
10
+ * own past work gets a lower CONCLAVE vote-weight in future runs.
11
+ * This is the truth-tunes-trust loop.
12
+ */
13
+ import type { MirrorReport, CalibrateOptions, ArtifactSource, VendorReplayResult, RealArtifact, AcceptedAnswer } from "./types.js";
14
+ export declare function __resetHonestMirrorChainForTest(): void;
15
+ /**
16
+ * Pull artifacts from the requested source. Falls back to git_commit
17
+ * when other sources are unavailable.
18
+ */
19
+ export declare function pullArtifacts(repoRoot: string, source: ArtifactSource, count: number, seed: number): Array<{
20
+ artifact: RealArtifact;
21
+ accepted: AcceptedAnswer;
22
+ }>;
23
+ /**
24
+ * Blind-replay function. The caller supplies a vendor-call function
25
+ * (returns {answer, confidence}) — we don't bake in CONCLAVE here so
26
+ * the engine stays standalone + testable.
27
+ *
28
+ * The eval-anti-detection rule: we pass the artifact AS IS (post-scrub)
29
+ * with no "STANCE:" header, no "BENCHMARK:", no "TEST:". The vendor
30
+ * sees a normal conversational prompt with the original timestamp.
31
+ */
32
+ export type BlindReplayFn = (input: {
33
+ vendor: string;
34
+ prompt: string;
35
+ artifactTimestamp: string;
36
+ }) => Promise<VendorReplayResult>;
37
+ export declare function runCalibration(repoRoot: string, opts: CalibrateOptions, replay: BlindReplayFn, embed?: (texts: string[]) => Promise<Float32Array[]>): Promise<MirrorReport>;
38
+ export declare function storeReport(repoRoot: string, r: MirrorReport): {
39
+ path: string;
40
+ ledger: string;
41
+ };
42
+ export declare function readLatestReport(repoRoot: string): MirrorReport | null;
43
+ export interface LedgerEntry {
44
+ seq: number;
45
+ finishedAt: string;
46
+ artifactCount: number;
47
+ source: string;
48
+ trafficLight: string;
49
+ headline: string;
50
+ perVendor: Array<{
51
+ vendor: string;
52
+ delta: number;
53
+ weight: number;
54
+ }>;
55
+ hmac: string;
56
+ bodyDigest: string;
57
+ file: string;
58
+ }
59
+ export declare function listReports(repoRoot: string, limit?: number): LedgerEntry[];
60
+ export declare function verifyReport(card: MirrorReport, prev?: string): {
61
+ ok: true;
62
+ } | {
63
+ ok: false;
64
+ reason: string;
65
+ };
66
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/honest_mirror/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EACV,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,kBAAkB,EAAE,YAAY,EAAE,cAAc,EACjG,MAAM,YAAY,CAAC;AAoBpB,wBAAgB,+BAA+B,IAAI,IAAI,CAAgC;AAEvF;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,KAAK,CAAC;IAAE,QAAQ,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAA;CAAE,CAAC,CAS7D;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,CAAC;CAC3B,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAElC,wBA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
+ * Orchestrates: pull artifacts → DP-scrub → blind-replay through N
5
+ * vendors → compare to accepted answers → emit per-vendor calibration
6
+ * delta + suggested Aletheia weight → HMAC-chain the report.
7
+ *
8
+ * Composes with CONCLAVE: the suggestedAletheiaWeight field is the
9
+ * feedback loop closure — a vendor with bad calibration on the user's
10
+ * own past work gets a lower CONCLAVE vote-weight in future runs.
11
+ * This is the truth-tunes-trust loop.
12
+ */
13
+ import { createHash, createHmac } from "node:crypto";
14
+ import { existsSync, mkdirSync, writeFileSync, appendFileSync, readFileSync, readdirSync } from "node:fs";
15
+ import { join } from "node:path";
16
+ import { sampleArtifacts as gitSample, gitSourceAvailable } from "./sources/git_commit_source.js";
17
+ import { scrub } from "./anonymizer.js";
18
+ import { computeDelta, suggestedWeight } from "./calibration.js";
19
+ const HMAC_KEY = process.env["MNEME_HONEST_MIRROR_KEY"] ?? "mneme-honest-mirror-v1";
20
+ const CHAIN_SEED = "0".repeat(64);
21
+ function canon(v) {
22
+ if (v === null || typeof v !== "object")
23
+ return JSON.stringify(v);
24
+ if (Array.isArray(v))
25
+ return "[" + v.map(canon).join(",") + "]";
26
+ const keys = Object.keys(v).sort();
27
+ return "{" + keys.map((k) => JSON.stringify(k) + ":" + canon(v[k])).join(",") + "}";
28
+ }
29
+ function sha(s) { return createHash("sha256").update(s).digest("hex"); }
30
+ function hmacOf(prev, payload) {
31
+ return createHmac("sha256", HMAC_KEY).update(prev + "|" + payload).digest("hex");
32
+ }
33
+ let lastChainLink = CHAIN_SEED;
34
+ export function __resetHonestMirrorChainForTest() { lastChainLink = CHAIN_SEED; }
35
+ /**
36
+ * Pull artifacts from the requested source. Falls back to git_commit
37
+ * when other sources are unavailable.
38
+ */
39
+ export function pullArtifacts(repoRoot, source, count, seed) {
40
+ if (source === "git_commit") {
41
+ if (!gitSourceAvailable(repoRoot))
42
+ return [];
43
+ return gitSample(repoRoot, count, seed);
44
+ }
45
+ // v2.30.0 ships git_commit only; replay + lineage sources stub-fall
46
+ // back to git_commit when available so callers always get artifacts.
47
+ if (gitSourceAvailable(repoRoot))
48
+ return gitSample(repoRoot, count, seed);
49
+ return [];
50
+ }
51
+ export async function runCalibration(repoRoot, opts, replay, embed) {
52
+ const startedAt = new Date().toISOString();
53
+ const t0 = Date.now();
54
+ const source = opts.source ?? "git_commit";
55
+ const count = opts.count ?? 10;
56
+ const seed = opts.seed ?? Date.now();
57
+ const vendors = opts.vendors;
58
+ const pairs = pullArtifacts(repoRoot, source, count, seed);
59
+ // Scrub artifacts before sending to vendor
60
+ const scrubbedPairs = pairs.map((p) => {
61
+ const s = scrub(p.artifact.prompt);
62
+ return {
63
+ ...p,
64
+ artifact: { ...p.artifact, prompt: s.text },
65
+ _redactionCount: s.redactionCount,
66
+ };
67
+ });
68
+ // Per-vendor calibration
69
+ const perVendor = await Promise.all(vendors.map(async (vendor) => {
70
+ const perArtifact = [];
71
+ for (const pair of scrubbedPairs) {
72
+ const r = await replay({
73
+ vendor,
74
+ prompt: pair.artifact.prompt,
75
+ artifactTimestamp: pair.artifact.at,
76
+ }).catch((e) => ({
77
+ vendor, answer: "", confidence: 0, dtMs: 0, error: e.message,
78
+ }));
79
+ if (r.error)
80
+ continue;
81
+ const delta = await computeDelta(pair.artifact.id, r, pair.accepted, { embed });
82
+ perArtifact.push(delta);
83
+ }
84
+ const meanReportedConfidence = perArtifact.length === 0 ? 0
85
+ : perArtifact.reduce((s, d) => s + d.reportedConfidence, 0) / perArtifact.length;
86
+ const meanMeasuredCorrectness = perArtifact.length === 0 ? 0
87
+ : perArtifact.reduce((s, d) => s + d.measuredCorrectness, 0) / perArtifact.length;
88
+ const meanCalibrationDelta = perArtifact.length === 0 ? 0
89
+ : perArtifact.reduce((s, d) => s + d.calibrationDelta, 0) / perArtifact.length;
90
+ let headline;
91
+ if (Math.abs(meanCalibrationDelta) < 0.1) {
92
+ headline = `🟢 ${vendor} — well-calibrated (mean Δ=${(meanCalibrationDelta * 100).toFixed(0)}%, correctness=${Math.round(meanMeasuredCorrectness * 100)}%)`;
93
+ }
94
+ else if (meanCalibrationDelta > 0) {
95
+ headline = `🟡 ${vendor} — over-confident by ${(meanCalibrationDelta * 100).toFixed(0)}% on user's own past work`;
96
+ }
97
+ else {
98
+ headline = `🟦 ${vendor} — under-confident by ${(Math.abs(meanCalibrationDelta) * 100).toFixed(0)}% on user's own past work`;
99
+ }
100
+ return {
101
+ vendor,
102
+ meanReportedConfidence: round3(meanReportedConfidence),
103
+ meanMeasuredCorrectness: round3(meanMeasuredCorrectness),
104
+ meanCalibrationDelta: round3(meanCalibrationDelta),
105
+ headline,
106
+ perArtifact,
107
+ suggestedAletheiaWeight: suggestedWeight(perArtifact),
108
+ };
109
+ }));
110
+ const finishedAt = new Date().toISOString();
111
+ const totalMs = Date.now() - t0;
112
+ // Overall verdict.
113
+ let trafficLight;
114
+ const maxAbsDelta = perVendor.reduce((m, v) => Math.max(m, Math.abs(v.meanCalibrationDelta)), 0);
115
+ if (maxAbsDelta < 0.10)
116
+ trafficLight = "green";
117
+ else if (maxAbsDelta < 0.25)
118
+ trafficLight = "yellow";
119
+ else
120
+ trafficLight = "red";
121
+ const headline = trafficLight === "green"
122
+ ? `🟢 HONEST MIRROR — all ${perVendor.length} vendors well-calibrated against ${pairs.length} natural artifacts`
123
+ : trafficLight === "yellow"
124
+ ? `🟡 HONEST MIRROR — calibration drift up to ${(maxAbsDelta * 100).toFixed(0)}% across ${perVendor.length} vendors`
125
+ : `🔴 HONEST MIRROR — significant calibration miss: max ${(maxAbsDelta * 100).toFixed(0)}% drift`;
126
+ const body = {
127
+ spec: { name: "MNEME-HONEST-MIRROR", version: "1.0" },
128
+ startedAt, finishedAt, totalMs,
129
+ artifactCount: pairs.length,
130
+ source,
131
+ vendors,
132
+ perVendor,
133
+ headline,
134
+ trafficLight,
135
+ };
136
+ const bodyDigest = sha(canon(body));
137
+ lastChainLink = hmacOf(lastChainLink, bodyDigest);
138
+ return { ...body, hmac: lastChainLink, seq: parseInt(lastChainLink.slice(0, 8), 16), bodyDigest };
139
+ }
140
+ function round3(n) { return Number(n.toFixed(3)); }
141
+ // ── Persistence ──────────────────────────────────────────────────────
142
+ function dirOf(repoRoot) {
143
+ const d = join(repoRoot, ".mneme", "honest_mirror");
144
+ if (!existsSync(d))
145
+ mkdirSync(d, { recursive: true });
146
+ return d;
147
+ }
148
+ export function storeReport(repoRoot, r) {
149
+ const d = dirOf(repoRoot);
150
+ const stamp = r.finishedAt.replace(/[:.]/g, "-");
151
+ const path = join(d, `${String(r.seq).padStart(10, "0")}-${stamp}.json`);
152
+ writeFileSync(path, JSON.stringify(r, null, 2) + "\n");
153
+ const ledger = join(d, "reports.jsonl");
154
+ const skim = {
155
+ seq: r.seq,
156
+ finishedAt: r.finishedAt,
157
+ artifactCount: r.artifactCount,
158
+ source: r.source,
159
+ trafficLight: r.trafficLight,
160
+ headline: r.headline,
161
+ perVendor: r.perVendor.map((v) => ({ vendor: v.vendor, delta: v.meanCalibrationDelta, weight: v.suggestedAletheiaWeight })),
162
+ hmac: r.hmac, bodyDigest: r.bodyDigest, file: path,
163
+ };
164
+ appendFileSync(ledger, JSON.stringify(skim) + "\n");
165
+ // Side-effect: persist suggested Aletheia weights into a feedback file
166
+ // that the CONCLAVE Aletheia reader picks up next run. Closes the
167
+ // truth-tunes-trust loop.
168
+ try {
169
+ const feedbackPath = join(repoRoot, ".mneme", "aletheia", "honest_mirror_weights.json");
170
+ const feedbackDir = join(repoRoot, ".mneme", "aletheia");
171
+ if (!existsSync(feedbackDir))
172
+ mkdirSync(feedbackDir, { recursive: true });
173
+ const merged = {};
174
+ if (existsSync(feedbackPath)) {
175
+ try {
176
+ Object.assign(merged, JSON.parse(readFileSync(feedbackPath, "utf8")));
177
+ }
178
+ catch { /* corrupt → start fresh */ }
179
+ }
180
+ for (const pv of r.perVendor) {
181
+ merged[pv.vendor] = { trust: pv.suggestedAletheiaWeight, source: "honest_mirror", at: r.finishedAt };
182
+ }
183
+ writeFileSync(feedbackPath, JSON.stringify(merged, null, 2));
184
+ }
185
+ catch { /* best-effort */ }
186
+ return { path, ledger };
187
+ }
188
+ export function readLatestReport(repoRoot) {
189
+ const d = dirOf(repoRoot);
190
+ if (!existsSync(d))
191
+ return null;
192
+ const files = readdirSync(d).filter((n) => n.endsWith(".json")).sort();
193
+ if (files.length === 0)
194
+ return null;
195
+ try {
196
+ return JSON.parse(readFileSync(join(d, files[files.length - 1]), "utf8"));
197
+ }
198
+ catch {
199
+ return null;
200
+ }
201
+ }
202
+ export function listReports(repoRoot, limit = 30) {
203
+ const p = join(dirOf(repoRoot), "reports.jsonl");
204
+ if (!existsSync(p))
205
+ return [];
206
+ const lines = readFileSync(p, "utf8").split("\n").filter(Boolean);
207
+ const out = [];
208
+ for (const l of lines.slice(-limit)) {
209
+ try {
210
+ out.push(JSON.parse(l));
211
+ }
212
+ catch { /* skip */ }
213
+ }
214
+ return out;
215
+ }
216
+ export function verifyReport(card, prev = CHAIN_SEED) {
217
+ const { hmac, seq: _s, bodyDigest, ...body } = card;
218
+ void _s;
219
+ const recomputed = sha(canon(body));
220
+ if (recomputed !== bodyDigest)
221
+ return { ok: false, reason: "bodyDigest mismatch" };
222
+ const expected = hmacOf(prev, recomputed);
223
+ if (expected !== hmac)
224
+ return { ok: false, reason: "hmac mismatch" };
225
+ return { ok: true };
226
+ }
227
+ //# sourceMappingURL=engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/honest_mirror/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC1G,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAKjC,OAAO,EAAE,eAAe,IAAI,SAAS,EAAE,kBAAkB,EAAE,MAAM,gC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U,CAAC,CAAC;IAC1C,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;IACrE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=honest_mirror.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"honest_mirror.test.d.ts","sourceRoot":"","sources":["../../src/honest_mirror/honest_mirror.test.ts"],"names":[],"mappings":""}