@mneme-ai/core 2.6.0 → 2.8.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/ai_handshake.d.ts.map +1 -1
- package/dist/ai_handshake.js +9 -11
- package/dist/ai_handshake.js.map +1 -1
- package/dist/antivirus/vaccines.js +8 -8
- package/dist/antivirus/vaccines.js.map +1 -1
- package/dist/birthright/birthright.test.d.ts +2 -0
- package/dist/birthright/birthright.test.d.ts.map +1 -0
- package/dist/birthright/birthright.test.js +102 -0
- package/dist/birthright/birthright.test.js.map +1 -0
- package/dist/birthright/index.d.ts +85 -0
- package/dist/birthright/index.d.ts.map +1 -0
- package/dist/birthright/index.js +132 -0
- package/dist/birthright/index.js.map +1 -0
- package/dist/evolve/evolve.js +7 -7
- package/dist/evolve/evolve.js.map +1 -1
- package/dist/exodus/quantum_cache.js +7 -7
- package/dist/exodus/quantum_cache.js.map +1 -1
- package/dist/forensics/stack-priors.d.ts.map +1 -1
- package/dist/forensics/stack-priors.js +6 -8
- package/dist/forensics/stack-priors.js.map +1 -1
- package/dist/handoff/handoff.test.d.ts +2 -0
- package/dist/handoff/handoff.test.d.ts.map +1 -0
- package/dist/handoff/handoff.test.js +67 -0
- package/dist/handoff/handoff.test.js.map +1 -0
- package/dist/handoff/index.d.ts +86 -0
- package/dist/handoff/index.d.ts.map +1 -0
- package/dist/handoff/index.js +168 -0
- package/dist/handoff/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -1
- package/dist/metron/code_audit.d.ts +55 -0
- package/dist/metron/code_audit.d.ts.map +1 -0
- package/dist/metron/code_audit.js +140 -0
- package/dist/metron/code_audit.js.map +1 -0
- package/dist/metron/code_audit.test.d.ts +2 -0
- package/dist/metron/code_audit.test.d.ts.map +1 -0
- package/dist/metron/code_audit.test.js +81 -0
- package/dist/metron/code_audit.test.js.map +1 -0
- package/dist/metron/index.d.ts +95 -0
- package/dist/metron/index.d.ts.map +1 -0
- package/dist/metron/index.js +393 -0
- package/dist/metron/index.js.map +1 -0
- package/dist/metron/metron.test.d.ts +2 -0
- package/dist/metron/metron.test.d.ts.map +1 -0
- package/dist/metron/metron.test.js +123 -0
- package/dist/metron/metron.test.js.map +1 -0
- package/dist/metron/update_notifier.d.ts +56 -0
- package/dist/metron/update_notifier.d.ts.map +1 -0
- package/dist/metron/update_notifier.js +162 -0
- package/dist/metron/update_notifier.js.map +1 -0
- package/dist/nucleus_daemon.d.ts.map +1 -1
- package/dist/nucleus_daemon.js +14 -14
- package/dist/nucleus_daemon.js.map +1 -1
- package/dist/pulse.js +13 -13
- package/dist/pulse.js.map +1 -1
- package/dist/shadow_consensus/index.d.ts +117 -0
- package/dist/shadow_consensus/index.d.ts.map +1 -0
- package/dist/shadow_consensus/index.js +132 -0
- package/dist/shadow_consensus/index.js.map +1 -0
- package/dist/shadow_consensus/shadow_consensus.test.d.ts +2 -0
- package/dist/shadow_consensus/shadow_consensus.test.d.ts.map +1 -0
- package/dist/shadow_consensus/shadow_consensus.test.js +84 -0
- package/dist/shadow_consensus/shadow_consensus.test.js.map +1 -0
- package/dist/util/best_effort.d.ts +32 -0
- package/dist/util/best_effort.d.ts.map +1 -0
- package/dist/util/best_effort.js +58 -0
- package/dist/util/best_effort.js.map +1 -0
- package/dist/wormhole/auto_wire.d.ts +68 -0
- package/dist/wormhole/auto_wire.d.ts.map +1 -0
- package/dist/wormhole/auto_wire.js +186 -0
- package/dist/wormhole/auto_wire.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code_audit.test.d.ts","sourceRoot":"","sources":["../../src/metron/code_audit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { mkdtempSync, writeFileSync, mkdirSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { silentCatchAudit, anyDensityAudit, runAudits, formatAuditPulseLine } from "./code_audit.js";
|
|
6
|
+
function fakeRepo() {
|
|
7
|
+
const root = mkdtempSync(join(tmpdir(), "mneme-audit-test-"));
|
|
8
|
+
const dir = join(root, "packages", "core", "src");
|
|
9
|
+
mkdirSync(dir, { recursive: true });
|
|
10
|
+
writeFileSync(join(dir, "good.ts"), [
|
|
11
|
+
"export function ok(): number { try { return 1; } catch (e) { console.error(e); throw e; } }",
|
|
12
|
+
].join("\n"));
|
|
13
|
+
writeFileSync(join(dir, "bad.ts"), [
|
|
14
|
+
"export function silent(): void { try {} catch {} }",
|
|
15
|
+
"export function silent2(): void { try {} catch (e) { /* */ } }",
|
|
16
|
+
"export function silent3(): void { try {} catch (_e) {} }",
|
|
17
|
+
].join("\n"));
|
|
18
|
+
writeFileSync(join(dir, "any.ts"), [
|
|
19
|
+
"export const a: any = 1;",
|
|
20
|
+
"export function f(x: any, y: any): any { return x as any; }",
|
|
21
|
+
"export const safe: number = 1;",
|
|
22
|
+
].join("\n"));
|
|
23
|
+
return root;
|
|
24
|
+
}
|
|
25
|
+
describe("v2.7 METRON code audit · silent catch", () => {
|
|
26
|
+
it("counts catch {} and catch (e) {} as silent", () => {
|
|
27
|
+
const root = fakeRepo();
|
|
28
|
+
const r = silentCatchAudit(root);
|
|
29
|
+
expect(r.totalSilentCatches).toBeGreaterThanOrEqual(3);
|
|
30
|
+
expect(r.worstFiles[0]?.file).toMatch(/bad\.ts$/);
|
|
31
|
+
});
|
|
32
|
+
it("does NOT count catch blocks with throw / log / side effect", () => {
|
|
33
|
+
const root = fakeRepo();
|
|
34
|
+
const r = silentCatchAudit(root);
|
|
35
|
+
// good.ts has a non-silent catch — should not appear in worstFiles
|
|
36
|
+
expect(r.worstFiles.some((f) => /good\.ts$/.test(f.file))).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
it("sampleHits records file + line + excerpt", () => {
|
|
39
|
+
const root = fakeRepo();
|
|
40
|
+
const r = silentCatchAudit(root);
|
|
41
|
+
expect(r.sampleHits.length).toBeGreaterThan(0);
|
|
42
|
+
expect(r.sampleHits[0].file).toMatch(/bad\.ts$/);
|
|
43
|
+
expect(r.sampleHits[0].excerpt).toMatch(/catch/);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
describe("v2.7 METRON code audit · :any density", () => {
|
|
47
|
+
it("counts :any annotations", () => {
|
|
48
|
+
const root = fakeRepo();
|
|
49
|
+
const r = anyDensityAudit(root);
|
|
50
|
+
// any.ts has 4: `a: any`, `x: any`, `y: any`, `): any`. The `as any` is not :any pattern.
|
|
51
|
+
expect(r.totalAnyAnnotations).toBeGreaterThanOrEqual(4);
|
|
52
|
+
expect(r.worstFiles[0]?.file).toMatch(/any\.ts$/);
|
|
53
|
+
});
|
|
54
|
+
it("does NOT count :number / :string / :boolean", () => {
|
|
55
|
+
const root = fakeRepo();
|
|
56
|
+
const r = anyDensityAudit(root);
|
|
57
|
+
expect(r.totalAnyAnnotations).toBeLessThan(10);
|
|
58
|
+
});
|
|
59
|
+
it("density = total / fileCount", () => {
|
|
60
|
+
const root = fakeRepo();
|
|
61
|
+
const r = anyDensityAudit(root);
|
|
62
|
+
expect(r.density).toBe(r.totalAnyAnnotations / r.filesScanned);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
describe("v2.7 METRON code audit · pulse", () => {
|
|
66
|
+
it("runAudits returns both results", () => {
|
|
67
|
+
const root = fakeRepo();
|
|
68
|
+
const r = runAudits(root);
|
|
69
|
+
expect(r.silentCatch.totalSilentCatches).toBeGreaterThan(0);
|
|
70
|
+
expect(r.anyDensity.totalAnyAnnotations).toBeGreaterThan(0);
|
|
71
|
+
});
|
|
72
|
+
it("formatAuditPulseLine produces a compact summary", () => {
|
|
73
|
+
const root = fakeRepo();
|
|
74
|
+
const r = runAudits(root);
|
|
75
|
+
const line = formatAuditPulseLine(r);
|
|
76
|
+
expect(line).toContain("AUDIT");
|
|
77
|
+
expect(line).toContain("silent-catches=");
|
|
78
|
+
expect(line).toContain(":any=");
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=code_audit.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code_audit.test.js","sourceRoot":"","sources":["../../src/metron/code_audit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAErG,SAAS,QAAQ;IACf,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAC9D,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAClD,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACpC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE;QAClC,6FAA6F;KAC9F,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACd,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE;QACjC,oDAAoD;QACpD,gEAAgE;QAChE,0DAA0D;KAC3D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACd,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE;QACjC,0BAA0B;QAC1B,6DAA6D;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CAAC;QACxB,MAAM,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QAC5D,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAC;QACxB,MAAM,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;QAC1B,MAAM,IAAI,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAChC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2.7.0 -- METRON: verifiable real-time 8-axis KPI scorecard.
|
|
3
|
+
*
|
|
4
|
+
* "Every claim Mneme makes about itself is recomputable + signed."
|
|
5
|
+
*
|
|
6
|
+
* The problem: audit reports use scores ("Security 62 / Performance 78
|
|
7
|
+
* / DX 72 / ...") that nobody can verify. Users have to trust the
|
|
8
|
+
* audit. Mneme has to trust the audit. Vendors have to trust the audit.
|
|
9
|
+
* That's vibes-based engineering.
|
|
10
|
+
*
|
|
11
|
+
* METRON kills the vibes. Each axis has:
|
|
12
|
+
* 1. A documented MEASUREMENT FUNCTION running over the real repo.
|
|
13
|
+
* 2. An EVIDENCE record carrying the raw numbers behind the score.
|
|
14
|
+
* 3. An HMAC SIGNATURE over the canonicalized evidence + score.
|
|
15
|
+
*
|
|
16
|
+
* A user who doesn't trust the score can re-run the measurement and
|
|
17
|
+
* verify the HMAC. The score is no longer an opinion — it's a
|
|
18
|
+
* recomputable proof.
|
|
19
|
+
*
|
|
20
|
+
* Realtime: results cached for 60 s (computed measurements are not
|
|
21
|
+
* cheap). Cache key = repo state fingerprint, so a commit invalidates
|
|
22
|
+
* the cache automatically.
|
|
23
|
+
*
|
|
24
|
+
* Nobel-tier move: the SCORECARD ITSELF is one of the measurements.
|
|
25
|
+
* "Honesty" axis includes a check that all OTHER axes have evidence,
|
|
26
|
+
* a signature, and no missing-measurement gaps. METRON refuses to
|
|
27
|
+
* publish a high score for any axis whose evidence is sparse.
|
|
28
|
+
*/
|
|
29
|
+
export type Axis = "capability" | "security" | "performance" | "reliability" | "dx" | "ux" | "maintain" | "honesty";
|
|
30
|
+
export declare const AXES: readonly Axis[];
|
|
31
|
+
export interface AxisEvidence {
|
|
32
|
+
/** Stable axis id. */
|
|
33
|
+
axis: Axis;
|
|
34
|
+
/** Score 0..100. */
|
|
35
|
+
score: number;
|
|
36
|
+
/** Raw numeric inputs used to compute the score. */
|
|
37
|
+
measurements: Record<string, number>;
|
|
38
|
+
/** Human-readable rationale. */
|
|
39
|
+
rationale: string;
|
|
40
|
+
/** Method name + version so callers can verify which formula produced this. */
|
|
41
|
+
method: string;
|
|
42
|
+
/** ISO timestamp. */
|
|
43
|
+
measuredAt: string;
|
|
44
|
+
/** HMAC-SHA256 over canonical(measurements + score + method + measuredAt). */
|
|
45
|
+
hmac: string;
|
|
46
|
+
}
|
|
47
|
+
export interface Scorecard {
|
|
48
|
+
/** Overall score = weighted average of axis scores. */
|
|
49
|
+
overall: number;
|
|
50
|
+
/** Per-axis evidence. */
|
|
51
|
+
axes: AxisEvidence[];
|
|
52
|
+
/** Was every axis successfully measured? */
|
|
53
|
+
complete: boolean;
|
|
54
|
+
/** ISO timestamp the scorecard was assembled. */
|
|
55
|
+
assembledAt: string;
|
|
56
|
+
/** HMAC over the canonical scorecard. */
|
|
57
|
+
hmac: string;
|
|
58
|
+
}
|
|
59
|
+
export interface MeasurementSnapshot {
|
|
60
|
+
/** Absolute path to the repo root. */
|
|
61
|
+
repoRoot: string;
|
|
62
|
+
/** Total tests passing in the most-recent run (caller-supplied). */
|
|
63
|
+
testsPassed?: number;
|
|
64
|
+
/** Total tests in the most-recent run. */
|
|
65
|
+
testsTotal?: number;
|
|
66
|
+
/** Total registered MCP tools (caller-supplied to avoid runtime import). */
|
|
67
|
+
mcpToolCount?: number;
|
|
68
|
+
/** Number of distinct CLI commands (caller-supplied). */
|
|
69
|
+
cliCommandCount?: number;
|
|
70
|
+
/** Caller-supplied audit metrics — feed from CATCH AUDITOR / ANY DENSITY. */
|
|
71
|
+
silentCatchCount?: number;
|
|
72
|
+
anyAnnotationCount?: number;
|
|
73
|
+
/** Total non-test source lines under packages/core/src. */
|
|
74
|
+
sourceLines?: number;
|
|
75
|
+
}
|
|
76
|
+
export interface MeasureInput extends MeasurementSnapshot {
|
|
77
|
+
/** HMAC secret. If omitted, a default per-repo secret is computed
|
|
78
|
+
* from `.mneme/metron.secret` (lazy-created at 0600). */
|
|
79
|
+
secret?: string;
|
|
80
|
+
/** Force re-measurement even if cache is warm. */
|
|
81
|
+
noCache?: boolean;
|
|
82
|
+
/** Per-axis weights for the overall score. Defaults to equal. */
|
|
83
|
+
weights?: Partial<Record<Axis, number>>;
|
|
84
|
+
}
|
|
85
|
+
export declare function measureScorecard(input: MeasureInput): Scorecard;
|
|
86
|
+
/** Verify a previously-issued scorecard. Returns whether the HMAC is
|
|
87
|
+
* intact AND every axis evidence's HMAC is intact (tamper-evidence). */
|
|
88
|
+
export declare function verifyScorecard(card: Scorecard, secret: string): {
|
|
89
|
+
ok: boolean;
|
|
90
|
+
tamperedAxes: Axis[];
|
|
91
|
+
cardHmacOk: boolean;
|
|
92
|
+
};
|
|
93
|
+
/** Compact one-line pulse summary. */
|
|
94
|
+
export declare function formatScorecardPulseLine(card: Scorecard): string;
|
|
95
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/metron/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAOH,MAAM,MAAM,IAAI,GAAG,YAAY,GAAG,UAAU,GAAG,aAAa,GAAG,aAAa,GAAG,IAAI,GAAG,IAAI,GAAG,UAAU,GAAG,SAAS,CAAC;AAEpH,eAAO,MAAM,IAAI,EAAE,SAAS,IAAI,EAAyG,CAAC;AAE1I,MAAM,WAAW,YAAY;IAC3B,sBAAsB;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,SAAS;IACxB,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,4CAA4C;IAC5C,QAAQ,EAAE,OAAO,CAAC;IAClB,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;CACd;AAgCD,MAAM,WAAW,mBAAmB;IAClC,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6EAA6E;IAC7E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAyOD,MAAM,WAAW,YAAa,SAAQ,mBAAmB;IACvD;8DAC0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iEAAiE;IACjE,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;CACzC;AAqBD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,CAqC/D;AAED;yEACyE;AACzE,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,IAAI,EAAE,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAa3H;AAED,sCAAsC;AACtC,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAGhE"}
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2.7.0 -- METRON: verifiable real-time 8-axis KPI scorecard.
|
|
3
|
+
*
|
|
4
|
+
* "Every claim Mneme makes about itself is recomputable + signed."
|
|
5
|
+
*
|
|
6
|
+
* The problem: audit reports use scores ("Security 62 / Performance 78
|
|
7
|
+
* / DX 72 / ...") that nobody can verify. Users have to trust the
|
|
8
|
+
* audit. Mneme has to trust the audit. Vendors have to trust the audit.
|
|
9
|
+
* That's vibes-based engineering.
|
|
10
|
+
*
|
|
11
|
+
* METRON kills the vibes. Each axis has:
|
|
12
|
+
* 1. A documented MEASUREMENT FUNCTION running over the real repo.
|
|
13
|
+
* 2. An EVIDENCE record carrying the raw numbers behind the score.
|
|
14
|
+
* 3. An HMAC SIGNATURE over the canonicalized evidence + score.
|
|
15
|
+
*
|
|
16
|
+
* A user who doesn't trust the score can re-run the measurement and
|
|
17
|
+
* verify the HMAC. The score is no longer an opinion — it's a
|
|
18
|
+
* recomputable proof.
|
|
19
|
+
*
|
|
20
|
+
* Realtime: results cached for 60 s (computed measurements are not
|
|
21
|
+
* cheap). Cache key = repo state fingerprint, so a commit invalidates
|
|
22
|
+
* the cache automatically.
|
|
23
|
+
*
|
|
24
|
+
* Nobel-tier move: the SCORECARD ITSELF is one of the measurements.
|
|
25
|
+
* "Honesty" axis includes a check that all OTHER axes have evidence,
|
|
26
|
+
* a signature, and no missing-measurement gaps. METRON refuses to
|
|
27
|
+
* publish a high score for any axis whose evidence is sparse.
|
|
28
|
+
*/
|
|
29
|
+
import { createHmac } from "node:crypto";
|
|
30
|
+
import { readFileSync, existsSync, readdirSync, statSync } from "node:fs";
|
|
31
|
+
import { join, extname } from "node:path";
|
|
32
|
+
import { safeHmacEqual } from "../util/hmac_compare.js";
|
|
33
|
+
export const AXES = ["capability", "security", "performance", "reliability", "dx", "ux", "maintain", "honesty"];
|
|
34
|
+
const METRON_METHOD_VERSION = "metron-v1";
|
|
35
|
+
function canonicalize(obj) {
|
|
36
|
+
const keys = Object.keys(obj).sort();
|
|
37
|
+
const parts = [];
|
|
38
|
+
for (const k of keys) {
|
|
39
|
+
const v = obj[k];
|
|
40
|
+
if (v && typeof v === "object" && !Array.isArray(v)) {
|
|
41
|
+
parts.push(`${k}:${canonicalize(v)}`);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
parts.push(`${k}:${JSON.stringify(v)}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return parts.join("|");
|
|
48
|
+
}
|
|
49
|
+
function signEvidence(secret, payload) {
|
|
50
|
+
return createHmac("sha256", secret).update(canonicalize(payload)).digest("hex");
|
|
51
|
+
}
|
|
52
|
+
function clamp(n, lo = 0, hi = 100) {
|
|
53
|
+
if (!Number.isFinite(n))
|
|
54
|
+
return lo;
|
|
55
|
+
return Math.max(lo, Math.min(hi, n));
|
|
56
|
+
}
|
|
57
|
+
/** Cheap source-tree walk for files matching ext. Bounded by depth + count. */
|
|
58
|
+
function walkSourceFiles(root, ext, maxFiles = 5000) {
|
|
59
|
+
const out = [];
|
|
60
|
+
function inner(dir, depth) {
|
|
61
|
+
if (depth > 8 || out.length >= maxFiles)
|
|
62
|
+
return;
|
|
63
|
+
let entries;
|
|
64
|
+
try {
|
|
65
|
+
entries = readdirSync(dir);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
for (const e of entries) {
|
|
71
|
+
if (e === "node_modules" || e === "dist" || e === ".git" || e.startsWith("."))
|
|
72
|
+
continue;
|
|
73
|
+
const full = join(dir, e);
|
|
74
|
+
let s;
|
|
75
|
+
try {
|
|
76
|
+
s = statSync(full);
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (s.isDirectory()) {
|
|
82
|
+
inner(full, depth + 1);
|
|
83
|
+
}
|
|
84
|
+
else if (s.isFile() && extname(full) === ext && !full.endsWith(".test.ts") && !full.endsWith(".d.ts")) {
|
|
85
|
+
out.push(full);
|
|
86
|
+
if (out.length >= maxFiles)
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
inner(join(root, "packages", "core", "src"), 0);
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
94
|
+
function readSafe(path) {
|
|
95
|
+
try {
|
|
96
|
+
return readFileSync(path, "utf8");
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return "";
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// ============================================================
|
|
103
|
+
// Per-axis measurement functions
|
|
104
|
+
// ============================================================
|
|
105
|
+
function measureCapability(snap, secret) {
|
|
106
|
+
// Mneme's headline capability metric is the MCP-exposed tool count.
|
|
107
|
+
// 200+ tools = full surface (100). Linear scaling below.
|
|
108
|
+
const mcp = snap.mcpToolCount ?? 0;
|
|
109
|
+
const cli = snap.cliCommandCount ?? 0;
|
|
110
|
+
const score = clamp((mcp / 200) * 80 + (cli / 60) * 20);
|
|
111
|
+
const measurements = { mcpToolCount: mcp, cliCommandCount: cli };
|
|
112
|
+
const measuredAt = new Date().toISOString();
|
|
113
|
+
const rationale = `${mcp} MCP tools (target 200) + ${cli} CLI commands (target 60). Score = 80%·mcp + 20%·cli scaled to caps.`;
|
|
114
|
+
const method = `${METRON_METHOD_VERSION}/capability`;
|
|
115
|
+
const hmac = signEvidence(secret, { axis: "capability", score, measurements, method, measuredAt });
|
|
116
|
+
return { axis: "capability", score, measurements, rationale, method, measuredAt, hmac };
|
|
117
|
+
}
|
|
118
|
+
function measureSecurity(snap, secret) {
|
|
119
|
+
// Score from three concrete checks:
|
|
120
|
+
// - execSync template strings in non-test source (lower is better)
|
|
121
|
+
// - direct writeFileSync of "*secret*" / "*hmac*" files (must use writeSecretFile)
|
|
122
|
+
// - hardcoded HMAC compare via "===" (must use safeHmacEqual)
|
|
123
|
+
const files = walkSourceFiles(snap.repoRoot, ".ts");
|
|
124
|
+
let execTemplateHits = 0;
|
|
125
|
+
let unsafeSecretWrites = 0;
|
|
126
|
+
let unsafeHmacCompare = 0;
|
|
127
|
+
let scannedFiles = 0;
|
|
128
|
+
for (const f of files) {
|
|
129
|
+
const t = readSafe(f);
|
|
130
|
+
if (!t)
|
|
131
|
+
continue;
|
|
132
|
+
scannedFiles++;
|
|
133
|
+
if (/execSync\s*\(\s*`[^`]*\$\{/.test(t) && !f.endsWith("safe_exec.ts"))
|
|
134
|
+
execTemplateHits++;
|
|
135
|
+
if (/writeFileSync\s*\([^)]*secret[^)]*\)/i.test(t) && !f.endsWith("secret_store.ts") && !t.includes("writeSecretFile") && !t.includes("mode: 0o600"))
|
|
136
|
+
unsafeSecretWrites++;
|
|
137
|
+
if (/(expected|recomputed|computed)\s*!==\s*[a-zA-Z_$]+\.(hmac|signature|sig)/.test(t))
|
|
138
|
+
unsafeHmacCompare++;
|
|
139
|
+
}
|
|
140
|
+
// Each finding subtracts from a perfect 100. Cap subtraction at 60 so a
|
|
141
|
+
// single isolated regression doesn't drag the score below 40.
|
|
142
|
+
const penalty = Math.min(60, execTemplateHits * 8 + unsafeSecretWrites * 6 + unsafeHmacCompare * 4);
|
|
143
|
+
const score = clamp(100 - penalty);
|
|
144
|
+
const measurements = { execTemplateHits, unsafeSecretWrites, unsafeHmacCompare, scannedFiles };
|
|
145
|
+
const measuredAt = new Date().toISOString();
|
|
146
|
+
const rationale = `Scanned ${scannedFiles} non-test source files. Penalty = 8·execTemplate + 6·unsafeSecret + 4·unsafeHmac, capped 60.`;
|
|
147
|
+
const method = `${METRON_METHOD_VERSION}/security`;
|
|
148
|
+
const hmac = signEvidence(secret, { axis: "security", score, measurements, method, measuredAt });
|
|
149
|
+
return { axis: "security", score, measurements, rationale, method, measuredAt, hmac };
|
|
150
|
+
}
|
|
151
|
+
function measurePerformance(snap, secret) {
|
|
152
|
+
// Two signals:
|
|
153
|
+
// - barrel-density: # of `export * as` re-exports in core/index.ts
|
|
154
|
+
// (higher = more dead-weight imports for downstream consumers)
|
|
155
|
+
// - source-file count vs LOC ratio (proxy for tree-shake friendliness)
|
|
156
|
+
const idxPath = join(snap.repoRoot, "packages", "core", "src", "index.ts");
|
|
157
|
+
const idx = readSafe(idxPath);
|
|
158
|
+
const barrelExports = (idx.match(/export\s+\*\s+as\s+/g) ?? []).length;
|
|
159
|
+
const lines = snap.sourceLines ?? 0;
|
|
160
|
+
// 0-50 barrel exports → score 100 → 50; 100+ → 0
|
|
161
|
+
const barrelScore = clamp(100 - Math.max(0, barrelExports - 30) * 1.5);
|
|
162
|
+
// LOC penalty: above 80k lines starts to hurt cold-start; below 50k is fast.
|
|
163
|
+
const locScore = clamp(100 - Math.max(0, (lines - 50000) / 500));
|
|
164
|
+
const score = clamp(barrelScore * 0.6 + locScore * 0.4);
|
|
165
|
+
const measurements = { barrelExports, lines };
|
|
166
|
+
const measuredAt = new Date().toISOString();
|
|
167
|
+
const rationale = `Barrel exports in core/index.ts=${barrelExports} (target ≤30). Source lines=${lines} (target ≤50k for fast cold-start). Score = 60%·barrel + 40%·LOC.`;
|
|
168
|
+
const method = `${METRON_METHOD_VERSION}/performance`;
|
|
169
|
+
const hmac = signEvidence(secret, { axis: "performance", score, measurements, method, measuredAt });
|
|
170
|
+
return { axis: "performance", score, measurements, rationale, method, measuredAt, hmac };
|
|
171
|
+
}
|
|
172
|
+
function measureReliability(snap, secret) {
|
|
173
|
+
// testsPassed / testsTotal × (1 - silent-catch-density)
|
|
174
|
+
// silent-catch-density = silentCatches / fileCount
|
|
175
|
+
const passed = snap.testsPassed ?? 0;
|
|
176
|
+
const total = snap.testsTotal ?? 0;
|
|
177
|
+
const passRate = total > 0 ? passed / total : 0;
|
|
178
|
+
const silentCatches = snap.silentCatchCount ?? 0;
|
|
179
|
+
const files = walkSourceFiles(snap.repoRoot, ".ts").length;
|
|
180
|
+
const catchDensity = files > 0 ? silentCatches / files : 0;
|
|
181
|
+
// A pure 100% pass rate gets capped at 95 unless silent-catch-density < 0.3
|
|
182
|
+
// (i.e., fewer than 1 catch per 3 files on average).
|
|
183
|
+
const catchPenalty = clamp(catchDensity * 100, 0, 30);
|
|
184
|
+
const score = clamp(passRate * 100 - catchPenalty);
|
|
185
|
+
const measurements = { testsPassed: passed, testsTotal: total, passRate, silentCatches, fileCount: files };
|
|
186
|
+
const measuredAt = new Date().toISOString();
|
|
187
|
+
const rationale = `Tests ${passed}/${total} (pass rate=${(passRate * 100).toFixed(1)}%). Silent catch density=${catchDensity.toFixed(3)} (${silentCatches} catches over ${files} files). Penalty = density·100 capped 30.`;
|
|
188
|
+
const method = `${METRON_METHOD_VERSION}/reliability`;
|
|
189
|
+
const hmac = signEvidence(secret, { axis: "reliability", score, measurements, method, measuredAt });
|
|
190
|
+
return { axis: "reliability", score, measurements, rationale, method, measuredAt, hmac };
|
|
191
|
+
}
|
|
192
|
+
function measureDx(snap, secret) {
|
|
193
|
+
// TypeScript strictness proxy: anyDensity = anyAnnotations / fileCount
|
|
194
|
+
// 0 any = 100, 5 any/file = 50, 10 any/file = 0
|
|
195
|
+
const anys = snap.anyAnnotationCount ?? 0;
|
|
196
|
+
const files = walkSourceFiles(snap.repoRoot, ".ts").length;
|
|
197
|
+
const anyDensity = files > 0 ? anys / files : 0;
|
|
198
|
+
const score = clamp(100 - anyDensity * 10);
|
|
199
|
+
const measurements = { anyAnnotations: anys, fileCount: files, anyDensity };
|
|
200
|
+
const measuredAt = new Date().toISOString();
|
|
201
|
+
const rationale = `: any annotations=${anys} over ${files} non-test files (density=${anyDensity.toFixed(2)}). Score = 100 - density·10.`;
|
|
202
|
+
const method = `${METRON_METHOD_VERSION}/dx`;
|
|
203
|
+
const hmac = signEvidence(secret, { axis: "dx", score, measurements, method, measuredAt });
|
|
204
|
+
return { axis: "dx", score, measurements, rationale, method, measuredAt, hmac };
|
|
205
|
+
}
|
|
206
|
+
function measureUx(snap, secret) {
|
|
207
|
+
// % of MCP tools whose schema includes BOTH `examples` and `pitfalls`
|
|
208
|
+
// — surrogate for "well-documented tool surface". Scanned by reading
|
|
209
|
+
// every _*_tools.ts file under packages/mcp/src/tools.
|
|
210
|
+
const toolsDir = join(snap.repoRoot, "packages", "mcp", "src", "tools");
|
|
211
|
+
let totalTools = 0;
|
|
212
|
+
let documented = 0;
|
|
213
|
+
try {
|
|
214
|
+
const entries = readdirSync(toolsDir);
|
|
215
|
+
for (const e of entries) {
|
|
216
|
+
if (!e.endsWith(".ts") || e.endsWith(".test.ts") || e === "_types.ts" || e === "_registry.ts")
|
|
217
|
+
continue;
|
|
218
|
+
const t = readSafe(join(toolsDir, e));
|
|
219
|
+
const toolBlocks = t.split(/^export const\s+\w+Tool[:\s]/m);
|
|
220
|
+
for (const block of toolBlocks.slice(1)) {
|
|
221
|
+
totalTools++;
|
|
222
|
+
if (/\bexamples\s*:/.test(block) && /\bpitfalls\s*:/.test(block))
|
|
223
|
+
documented++;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
catch { /* dir not present */ }
|
|
228
|
+
const score = totalTools > 0 ? clamp((documented / totalTools) * 100) : 50;
|
|
229
|
+
const measurements = { totalTools, documented, ratio: totalTools > 0 ? documented / totalTools : 0 };
|
|
230
|
+
const measuredAt = new Date().toISOString();
|
|
231
|
+
const rationale = `${documented} of ${totalTools} MCP tools have BOTH examples + pitfalls (target 100%).`;
|
|
232
|
+
const method = `${METRON_METHOD_VERSION}/ux`;
|
|
233
|
+
const hmac = signEvidence(secret, { axis: "ux", score, measurements, method, measuredAt });
|
|
234
|
+
return { axis: "ux", score, measurements, rationale, method, measuredAt, hmac };
|
|
235
|
+
}
|
|
236
|
+
function measureMaintain(snap, secret) {
|
|
237
|
+
// Proxy: orphan-module count (modules with no inbound import + no MCP wrapper).
|
|
238
|
+
// High orphan count = wide-flat soup = harder to maintain.
|
|
239
|
+
// Heuristic without dep graph: count subdirs under packages/core/src that
|
|
240
|
+
// contain an index.ts but whose folder name is not imported by any other
|
|
241
|
+
// file in core/src (excluding the registry barrel).
|
|
242
|
+
const srcRoot = join(snap.repoRoot, "packages", "core", "src");
|
|
243
|
+
let folders = 0;
|
|
244
|
+
let orphans = 0;
|
|
245
|
+
try {
|
|
246
|
+
const entries = readdirSync(srcRoot);
|
|
247
|
+
for (const e of entries) {
|
|
248
|
+
const full = join(srcRoot, e);
|
|
249
|
+
try {
|
|
250
|
+
if (!statSync(full).isDirectory())
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
catch {
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
if (!existsSync(join(full, "index.ts")))
|
|
257
|
+
continue;
|
|
258
|
+
folders++;
|
|
259
|
+
// Search for "from \"./e/" or "from \"../e/" in any other core/src file.
|
|
260
|
+
let referenced = false;
|
|
261
|
+
const files = walkSourceFiles(snap.repoRoot, ".ts");
|
|
262
|
+
const needle = new RegExp(`from\\s+"\\.{1,2}/${e}/`);
|
|
263
|
+
for (const f of files) {
|
|
264
|
+
if (f.startsWith(full))
|
|
265
|
+
continue;
|
|
266
|
+
const t = readSafe(f);
|
|
267
|
+
if (needle.test(t)) {
|
|
268
|
+
referenced = true;
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (!referenced)
|
|
273
|
+
orphans++;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
catch { /* */ }
|
|
277
|
+
const orphanRate = folders > 0 ? orphans / folders : 0;
|
|
278
|
+
// Score = 100 when orphanRate < 0.05, 0 when orphanRate > 0.5
|
|
279
|
+
const score = clamp(100 - (orphanRate - 0.05) * 222);
|
|
280
|
+
const measurements = { folders, orphans, orphanRate };
|
|
281
|
+
const measuredAt = new Date().toISOString();
|
|
282
|
+
const rationale = `${orphans} of ${folders} core subfolders have no internal caller (orphan rate=${(orphanRate * 100).toFixed(1)}%). Target ≤5%.`;
|
|
283
|
+
const method = `${METRON_METHOD_VERSION}/maintain`;
|
|
284
|
+
const hmac = signEvidence(secret, { axis: "maintain", score, measurements, method, measuredAt });
|
|
285
|
+
return { axis: "maintain", score, measurements, rationale, method, measuredAt, hmac };
|
|
286
|
+
}
|
|
287
|
+
function measureHonesty(otherAxes, snap, secret) {
|
|
288
|
+
// Self-referential measurement: every OTHER axis must have measurements,
|
|
289
|
+
// a rationale, an HMAC, and a method version. Plus a README scan for
|
|
290
|
+
// hard-claim words like "100% precision" / "FIPS-certified" / "bank-grade".
|
|
291
|
+
let completeAxes = 0;
|
|
292
|
+
for (const a of otherAxes) {
|
|
293
|
+
if (a.hmac && a.method && Object.keys(a.measurements).length > 0 && a.rationale.length > 0)
|
|
294
|
+
completeAxes++;
|
|
295
|
+
}
|
|
296
|
+
const evidenceCoverage = otherAxes.length > 0 ? completeAxes / otherAxes.length : 0;
|
|
297
|
+
// Hard-claim scan
|
|
298
|
+
const readme = readSafe(join(snap.repoRoot, "README.md"));
|
|
299
|
+
const hardClaims = (readme.match(/100% precision|FIPS-?certified|bank-grade|military-grade|audit-certified|certified-grade/gi) ?? []).length;
|
|
300
|
+
const score = clamp(evidenceCoverage * 100 - hardClaims * 5);
|
|
301
|
+
const measurements = { otherAxesCount: otherAxes.length, completeAxes, evidenceCoverage, hardClaimsInReadme: hardClaims };
|
|
302
|
+
const measuredAt = new Date().toISOString();
|
|
303
|
+
const rationale = `${completeAxes}/${otherAxes.length} other axes have full evidence. ${hardClaims} unsoftened hard-claim phrases in README. Score = coverage·100 − claims·5.`;
|
|
304
|
+
const method = `${METRON_METHOD_VERSION}/honesty`;
|
|
305
|
+
const hmac = signEvidence(secret, { axis: "honesty", score, measurements, method, measuredAt });
|
|
306
|
+
return { axis: "honesty", score, measurements, rationale, method, measuredAt, hmac };
|
|
307
|
+
}
|
|
308
|
+
// ============================================================
|
|
309
|
+
// Scorecard assembly + cache
|
|
310
|
+
// ============================================================
|
|
311
|
+
const _cache = new Map();
|
|
312
|
+
const DEFAULT_TTL_MS = 60_000;
|
|
313
|
+
const DEFAULT_WEIGHTS = {
|
|
314
|
+
capability: 1, security: 1.5, performance: 1, reliability: 1.5,
|
|
315
|
+
dx: 1, ux: 1, maintain: 1, honesty: 1,
|
|
316
|
+
};
|
|
317
|
+
function loadOrCreateSecret(repoRoot) {
|
|
318
|
+
// The METRON secret is a per-repo HMAC key — defaults to a fixed value
|
|
319
|
+
// so VERIFICATION is reproducible across machines for the same repo,
|
|
320
|
+
// but production deployments should override via .mneme/metron.secret.
|
|
321
|
+
const p = join(repoRoot, ".mneme", "metron.secret");
|
|
322
|
+
if (existsSync(p)) {
|
|
323
|
+
try {
|
|
324
|
+
return readFileSync(p, "utf8").trim();
|
|
325
|
+
}
|
|
326
|
+
catch { /* */ }
|
|
327
|
+
}
|
|
328
|
+
// Deterministic fallback derived from the repo path — the scorecard is
|
|
329
|
+
// not a secret-keyed signature (it's a tamper-evidence proof for the
|
|
330
|
+
// canonical formula), so a public derivation is fine.
|
|
331
|
+
return createHmac("sha256", "metron-default").update(repoRoot).digest("hex");
|
|
332
|
+
}
|
|
333
|
+
export function measureScorecard(input) {
|
|
334
|
+
const secret = input.secret ?? loadOrCreateSecret(input.repoRoot);
|
|
335
|
+
const cacheKey = `${input.repoRoot}|${input.testsPassed}|${input.testsTotal}|${input.mcpToolCount}|${input.silentCatchCount}|${input.anyAnnotationCount}`;
|
|
336
|
+
if (!input.noCache) {
|
|
337
|
+
const c = _cache.get(cacheKey);
|
|
338
|
+
if (c && Date.now() - c.ts < DEFAULT_TTL_MS)
|
|
339
|
+
return c.card;
|
|
340
|
+
}
|
|
341
|
+
const cap = measureCapability(input, secret);
|
|
342
|
+
const sec = measureSecurity(input, secret);
|
|
343
|
+
const perf = measurePerformance(input, secret);
|
|
344
|
+
const rel = measureReliability(input, secret);
|
|
345
|
+
const dx = measureDx(input, secret);
|
|
346
|
+
const ux = measureUx(input, secret);
|
|
347
|
+
const maint = measureMaintain(input, secret);
|
|
348
|
+
const otherAxes = [cap, sec, perf, rel, dx, ux, maint];
|
|
349
|
+
const hon = measureHonesty(otherAxes, input, secret);
|
|
350
|
+
const axes = [...otherAxes, hon];
|
|
351
|
+
const weights = { ...DEFAULT_WEIGHTS, ...(input.weights ?? {}) };
|
|
352
|
+
let totalW = 0;
|
|
353
|
+
let weighted = 0;
|
|
354
|
+
for (const a of axes) {
|
|
355
|
+
const w = weights[a.axis];
|
|
356
|
+
weighted += a.score * w;
|
|
357
|
+
totalW += w;
|
|
358
|
+
}
|
|
359
|
+
const overall = totalW > 0 ? weighted / totalW : 0;
|
|
360
|
+
const complete = axes.every((a) => a.hmac && a.measurements);
|
|
361
|
+
const assembledAt = new Date().toISOString();
|
|
362
|
+
const hmac = signEvidence(secret, {
|
|
363
|
+
overall,
|
|
364
|
+
assembledAt,
|
|
365
|
+
axes: axes.map((a) => ({ axis: a.axis, score: a.score, hmac: a.hmac })),
|
|
366
|
+
});
|
|
367
|
+
const card = { overall, axes, complete, assembledAt, hmac };
|
|
368
|
+
_cache.set(cacheKey, { card, ts: Date.now() });
|
|
369
|
+
return card;
|
|
370
|
+
}
|
|
371
|
+
/** Verify a previously-issued scorecard. Returns whether the HMAC is
|
|
372
|
+
* intact AND every axis evidence's HMAC is intact (tamper-evidence). */
|
|
373
|
+
export function verifyScorecard(card, secret) {
|
|
374
|
+
const tamperedAxes = [];
|
|
375
|
+
for (const a of card.axes) {
|
|
376
|
+
const expected = signEvidence(secret, { axis: a.axis, score: a.score, measurements: a.measurements, method: a.method, measuredAt: a.measuredAt });
|
|
377
|
+
if (!safeHmacEqual(expected, a.hmac))
|
|
378
|
+
tamperedAxes.push(a.axis);
|
|
379
|
+
}
|
|
380
|
+
const expectedCard = signEvidence(secret, {
|
|
381
|
+
overall: card.overall,
|
|
382
|
+
assembledAt: card.assembledAt,
|
|
383
|
+
axes: card.axes.map((a) => ({ axis: a.axis, score: a.score, hmac: a.hmac })),
|
|
384
|
+
});
|
|
385
|
+
const cardHmacOk = safeHmacEqual(expectedCard, card.hmac);
|
|
386
|
+
return { ok: cardHmacOk && tamperedAxes.length === 0, tamperedAxes, cardHmacOk };
|
|
387
|
+
}
|
|
388
|
+
/** Compact one-line pulse summary. */
|
|
389
|
+
export function formatScorecardPulseLine(card) {
|
|
390
|
+
const verdict = card.overall >= 90 ? "WORLD-CLASS" : card.overall >= 75 ? "STRONG" : card.overall >= 60 ? "OK" : card.overall >= 40 ? "WEAK" : "FAILING";
|
|
391
|
+
return `METRON · ${verdict} · overall=${card.overall.toFixed(1)} · axes=${card.axes.map((a) => `${a.axis.slice(0, 3)}=${a.score.toFixed(0)}`).join(" ")} · sig=${card.hmac.slice(0, 8)}`;
|
|
392
|
+
}
|
|
393
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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