mneme-ai 2.80.0 → 2.81.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/creditscore.d.ts +26 -0
- package/dist/commands/creditscore.d.ts.map +1 -0
- package/dist/commands/creditscore.js +81 -0
- package/dist/commands/creditscore.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2.81.0 — `mneme creditscore <action>` (alias `trustscore`) · portable AI honesty credit score.
|
|
3
|
+
*
|
|
4
|
+
* Distinct from `mneme honesty` (which mints static HMAC SVG badge certs from the
|
|
5
|
+
* pulse ledger). This is the PORTABLE, Ed25519-signed, cross-agent honesty CREDIT
|
|
6
|
+
* SCORE an agent checks before delegating to another agent (💎5, on the NOTARY spine).
|
|
7
|
+
*
|
|
8
|
+
* mneme creditscore score --agent A --true N --false M [--partial P] [--sign] [--ttl-days D]
|
|
9
|
+
* mneme creditscore verify <file|-> [--min GOLD] [--issuer FP]
|
|
10
|
+
*/
|
|
11
|
+
export interface CreditScoreOpts {
|
|
12
|
+
cwd: string;
|
|
13
|
+
action: string;
|
|
14
|
+
agent?: string;
|
|
15
|
+
trueCount?: number;
|
|
16
|
+
falseCount?: number;
|
|
17
|
+
partialCount?: number;
|
|
18
|
+
sign?: boolean;
|
|
19
|
+
ttlDays?: number;
|
|
20
|
+
file?: string;
|
|
21
|
+
min?: string;
|
|
22
|
+
issuer?: string;
|
|
23
|
+
json?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare function creditScoreCommand(o: CreditScoreOpts): Promise<number>;
|
|
26
|
+
//# sourceMappingURL=creditscore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creditscore.d.ts","sourceRoot":"","sources":["../../src/commands/creditscore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAWH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,kBAAkB,CAAC,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAsC5E"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2.81.0 — `mneme creditscore <action>` (alias `trustscore`) · portable AI honesty credit score.
|
|
3
|
+
*
|
|
4
|
+
* Distinct from `mneme honesty` (which mints static HMAC SVG badge certs from the
|
|
5
|
+
* pulse ledger). This is the PORTABLE, Ed25519-signed, cross-agent honesty CREDIT
|
|
6
|
+
* SCORE an agent checks before delegating to another agent (💎5, on the NOTARY spine).
|
|
7
|
+
*
|
|
8
|
+
* mneme creditscore score --agent A --true N --false M [--partial P] [--sign] [--ttl-days D]
|
|
9
|
+
* mneme creditscore verify <file|-> [--min GOLD] [--issuer FP]
|
|
10
|
+
*/
|
|
11
|
+
import { writeSync, readFileSync } from "node:fs";
|
|
12
|
+
import * as core from "@mneme-ai/core";
|
|
13
|
+
function out(s) {
|
|
14
|
+
try {
|
|
15
|
+
writeSync(1, s);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
process.stdout.write(s);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const BANDS = new Set(["PLATINUM", "GOLD", "SILVER", "BRONZE", "UNTRUSTED", "UNMEASURED"]);
|
|
22
|
+
export async function creditScoreCommand(o) {
|
|
23
|
+
const h = core.honestyScore;
|
|
24
|
+
if (o.action === "score") {
|
|
25
|
+
if (!o.agent) {
|
|
26
|
+
out("✗ score requires --agent\n");
|
|
27
|
+
return 2;
|
|
28
|
+
}
|
|
29
|
+
const score = h.computeHonestyScore({
|
|
30
|
+
agent: o.agent,
|
|
31
|
+
trueCount: o.trueCount ?? 0,
|
|
32
|
+
falseCount: o.falseCount ?? 0,
|
|
33
|
+
partialCount: o.partialCount ?? 0,
|
|
34
|
+
});
|
|
35
|
+
if (o.sign) {
|
|
36
|
+
out(JSON.stringify(h.issueHonestyReceipt(o.cwd, score, { ttlDays: o.ttlDays }), null, 2) + "\n");
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
39
|
+
if (o.json) {
|
|
40
|
+
out(JSON.stringify(score, null, 2) + "\n");
|
|
41
|
+
return 0;
|
|
42
|
+
}
|
|
43
|
+
out(`📊 HONESTY CREDIT SCORE — ${score.agent}\n score: ${score.score}/100 · band: ${score.band}\n verified: ${score.trueCount} true / ${score.falseCount} false${score.partialCount ? ` / ${score.partialCount} partial` : ""} (decisive ${score.decisive})\n Wilson-LB: ${(score.wilsonLB * 100).toFixed(1)}% (pessimistic — small samples score low by design)\n Add --sign to emit a portable, offline-verifiable receipt.\n`);
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
if (o.action === "verify") {
|
|
47
|
+
let raw;
|
|
48
|
+
try {
|
|
49
|
+
raw = o.file && o.file !== "-" ? readFileSync(o.file, "utf8") : readFileSync(0, "utf8");
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
out(`✗ cannot read receipt: ${e.message}\n`);
|
|
53
|
+
return 2;
|
|
54
|
+
}
|
|
55
|
+
let receipt;
|
|
56
|
+
try {
|
|
57
|
+
receipt = JSON.parse(raw);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
out("✗ receipt is not valid JSON\n");
|
|
61
|
+
return 2;
|
|
62
|
+
}
|
|
63
|
+
const minBand = o.min && BANDS.has(o.min) ? o.min : "SILVER";
|
|
64
|
+
const v = h.verifyHonestyReceipt(receipt);
|
|
65
|
+
const trust = h.shouldTrust(receipt, minBand, { expectedIssuerFingerprint: o.issuer });
|
|
66
|
+
if (o.json) {
|
|
67
|
+
out(JSON.stringify({ verify: v, trust }, null, 2) + "\n");
|
|
68
|
+
return v.valid && trust.trust ? 0 : 1;
|
|
69
|
+
}
|
|
70
|
+
if (!v.valid) {
|
|
71
|
+
out(`🔴 INVALID — ${v.reason}\n`);
|
|
72
|
+
return 1;
|
|
73
|
+
}
|
|
74
|
+
const mark = trust.trust ? "🟢" : "🟡";
|
|
75
|
+
out(`${mark} ${v.score.agent}: score ${v.score.score}/100 (${v.score.band})${v.expired ? " ⏰ EXPIRED" : ""}\n issuer: ${v.issuerFingerprint}\n trust ≥ ${minBand}? ${trust.trust ? "YES" : "NO"} — ${trust.reason}\n`);
|
|
76
|
+
return trust.trust ? 0 : 1;
|
|
77
|
+
}
|
|
78
|
+
out(`✗ Unknown creditscore action "${o.action}". Try: score | verify\n`);
|
|
79
|
+
return 2;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=creditscore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creditscore.js","sourceRoot":"","sources":["../../src/commands/creditscore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AAEvC,SAAS,GAAG,CAAC,CAAS;IACpB,IAAI,CAAC;QAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAAC,CAAC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1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuIA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuIA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAs5MvD"}
|
package/dist/index.js
CHANGED
|
@@ -4238,6 +4238,40 @@ export async function run(argv) {
|
|
|
4238
4238
|
json: !!o.json,
|
|
4239
4239
|
}));
|
|
4240
4240
|
});
|
|
4241
|
+
// v2.81.0 — HONESTY CREDIT SCORE (💎5). Portable, signed honesty score an agent
|
|
4242
|
+
// checks before delegating to another agent (the truth axis ERC-8004 misses).
|
|
4243
|
+
// Distinct from `mneme honesty` (static HMAC SVG badge certs).
|
|
4244
|
+
program
|
|
4245
|
+
.command("creditscore <action>")
|
|
4246
|
+
.aliases(["trustscore"])
|
|
4247
|
+
.description("📊 HONESTY CREDIT SCORE — portable, Ed25519-signed honesty score (Wilson-LB on verified true-rate) an agent verifies OFFLINE before delegating to another. actions: score | verify <file|->. Built on NOTARY; a vendor can't self-promote.")
|
|
4248
|
+
.option("--agent <a>", "agent id (score)")
|
|
4249
|
+
.option("--true <n>", "count of claims verified TRUE (score)", (v) => Number(v))
|
|
4250
|
+
.option("--false <n>", "count of claims verified FALSE (score)", (v) => Number(v))
|
|
4251
|
+
.option("--partial <n>", "count of partially-true claims (score)", (v) => Number(v))
|
|
4252
|
+
.option("--sign", "emit a portable signed receipt instead of plain output (score)", false)
|
|
4253
|
+
.option("--ttl-days <d>", "validity window for a signed score (default 90)", (v) => Number(v))
|
|
4254
|
+
.option("--file <path>", "receipt file to verify (use '-' for stdin)")
|
|
4255
|
+
.option("--min <band>", "min band to trust: PLATINUM|GOLD|SILVER|BRONZE (verify)", "SILVER")
|
|
4256
|
+
.option("--issuer <fp>", "assert the issuer fingerprint you trust (verify)")
|
|
4257
|
+
.option("--json", "machine-readable output", false)
|
|
4258
|
+
.action(async (action, o) => {
|
|
4259
|
+
const { creditScoreCommand } = await import("./commands/creditscore.js");
|
|
4260
|
+
process.exit(await creditScoreCommand({
|
|
4261
|
+
cwd: process.cwd(),
|
|
4262
|
+
action,
|
|
4263
|
+
agent: o.agent,
|
|
4264
|
+
trueCount: o.true,
|
|
4265
|
+
falseCount: o.false,
|
|
4266
|
+
partialCount: o.partial,
|
|
4267
|
+
sign: !!o.sign,
|
|
4268
|
+
ttlDays: o.ttlDays,
|
|
4269
|
+
file: o.file,
|
|
4270
|
+
min: o.min,
|
|
4271
|
+
issuer: o.issuer,
|
|
4272
|
+
json: !!o.json,
|
|
4273
|
+
}));
|
|
4274
|
+
});
|
|
4241
4275
|
program
|
|
4242
4276
|
.command("atlas")
|
|
4243
4277
|
.description("🗺 ATLAS HELP — six-layer discovery (TASTE · BLOOM · HOT · TAGS · INTENT · FULL). AI agents read 200 bytes here instead of 14 KB from --help.")
|