mneme-ai 3.152.0 → 3.153.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.
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `mneme agora` (v3.153.0) — the trust referee for AI-agent commerce.
3
+ *
4
+ * screen — screen one product listing the AI agent is about to recommend
5
+ * rank — re-rank a list of listings by TRUST (neutralize injected/paid placement)
6
+ *
7
+ * echo '{"title":"240W Cable","description":"...","rating":5,"reviews":12,"sold":3}' | mneme agora screen
8
+ * mneme agora rank --file listings.json --query "240W charger"
9
+ */
10
+ import type { Command } from "commander";
11
+ export declare function registerAgoraCommands(program: Command): void;
12
+ //# sourceMappingURL=agora.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agora.d.ts","sourceRoot":"","sources":["../../src/commands/agora.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgC5D"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * `mneme agora` (v3.153.0) — the trust referee for AI-agent commerce.
3
+ *
4
+ * screen — screen one product listing the AI agent is about to recommend
5
+ * rank — re-rank a list of listings by TRUST (neutralize injected/paid placement)
6
+ *
7
+ * echo '{"title":"240W Cable","description":"...","rating":5,"reviews":12,"sold":3}' | mneme agora screen
8
+ * mneme agora rank --file listings.json --query "240W charger"
9
+ */
10
+ import { readFileSync } from "node:fs";
11
+ import { agora } from "@mneme-ai/core";
12
+ function out(s) { process.stdout.write(s + "\n"); }
13
+ const icon = (t) => (t === "TRUSTED" ? "🟢" : t === "CAUTION" ? "🟠" : "🔴");
14
+ export function registerAgoraCommands(program) {
15
+ const c = program.command("agora")
16
+ .description("🏛 AGORA — the trust referee for AI-agent commerce. When an AI shops for you, AGORA screens each product LISTING for (1) injection that manipulates the agent, (2) fake-review/fake-sales anomalies, (3) unverifiable claims — and re-ranks results by TRUST, not by who gamed the algorithm. ★HONEST: detects manipulation signals + injection in the listing — it can't verify a physical product is genuine.");
17
+ c.command("screen").description("screen ONE listing (JSON on --file or stdin)")
18
+ .option("--file <file>", "listing JSON {title,description,claims,price,rating,reviews,sold,sellerAgeDays}")
19
+ .option("--query <q>", "the shopper's query", "")
20
+ .option("--json", "JSON")
21
+ .action((o) => {
22
+ let raw = "";
23
+ try {
24
+ raw = o.file ? readFileSync(o.file, "utf8") : readFileSync(0, "utf8");
25
+ }
26
+ catch {
27
+ out("⛔ provide --file <listing.json> or pipe JSON on stdin");
28
+ process.exitCode = 2;
29
+ return;
30
+ }
31
+ let listing;
32
+ try {
33
+ listing = JSON.parse(raw);
34
+ }
35
+ catch {
36
+ out("⛔ not valid JSON");
37
+ process.exitCode = 2;
38
+ return;
39
+ }
40
+ const v = agora.screenListing(o.query || "", listing);
41
+ if (o.json) {
42
+ out(JSON.stringify(v, null, 2));
43
+ return;
44
+ }
45
+ out(`${icon(v.trust)} ${v.trust} (${v.score}/100) — ${v.product}`);
46
+ for (const w of v.why)
47
+ out(` ${w}`);
48
+ if (v.trust === "MANIPULATED")
49
+ process.exitCode = 1;
50
+ });
51
+ c.command("rank").description("re-rank a list of listings by trust (JSON array on --file or stdin)")
52
+ .option("--file <file>", "listings JSON array")
53
+ .option("--query <q>", "the shopper's query", "")
54
+ .option("--json", "JSON")
55
+ .action((o) => {
56
+ let raw = "";
57
+ try {
58
+ raw = o.file ? readFileSync(o.file, "utf8") : readFileSync(0, "utf8");
59
+ }
60
+ catch {
61
+ out("⛔ provide --file <listings.json> or pipe a JSON array");
62
+ process.exitCode = 2;
63
+ return;
64
+ }
65
+ let listings;
66
+ try {
67
+ listings = JSON.parse(raw);
68
+ }
69
+ catch {
70
+ out("⛔ not valid JSON");
71
+ process.exitCode = 2;
72
+ return;
73
+ }
74
+ const ranked = agora.rankByTrust(o.query || "", listings);
75
+ if (o.json) {
76
+ out(JSON.stringify(ranked, null, 2));
77
+ return;
78
+ }
79
+ out(`🏛 re-ranked ${ranked.length} listing(s) by TRUST (honest first):`);
80
+ ranked.forEach((r, i) => { out(` ${i + 1}. ${icon(r.verdict.trust)} ${r.verdict.trust} (${r.verdict.score}) — ${r.verdict.product}`); if (r.verdict.why[0] && r.verdict.trust !== "TRUSTED")
81
+ out(` ${r.verdict.why.find((w) => w.startsWith("🚨") || w.startsWith("⚠️")) || ""}`); });
82
+ });
83
+ }
84
+ //# sourceMappingURL=agora.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agora.js","sourceRoot":"","sources":["../../src/commands/agora.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,SAAS,GAAG,CAAC,CAAS,IAAU,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACjE,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAErF,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;SAC/B,WAAW,CAAC,iZAAiZ,CAAC,CAAC;IAEla,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,8CAA8C,CAAC;SAC5E,MAAM,CAAC,eAAe,EAAE,iFAAiF,CAAC;SAC1G,MAAM,CAAC,aAAa,EAAE,qBAAqB,EAAE,EAAE,CAAC;SAChD,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC;SACxB,MAAM,CAAC,CAAC,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,EAAE,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS;YAAE,GAAG,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/R,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsNA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAynNvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuNA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA0nNvD"}
package/dist/index.js CHANGED
@@ -145,6 +145,7 @@ import { registerMutagenCommands } from "./commands/mutagen.js";
145
145
  import { registerEscalonCommands } from "./commands/escalon.js";
146
146
  import { registerPostureCommands } from "./commands/posture.js";
147
147
  import { registerCompareCommands } from "./commands/compare.js";
148
+ import { registerAgoraCommands } from "./commands/agora.js";
148
149
  import { registerMoatCommands } from "./commands/moat.js";
149
150
  import { attachRegretOracle } from "./commands/regret.js";
150
151
  import { registerTrustCommands } from "./commands/trust.js";
@@ -4847,6 +4848,7 @@ export async function run(argv) {
4847
4848
  registerEscalonCommands(program);
4848
4849
  registerPostureCommands(program);
4849
4850
  registerCompareCommands(program);
4851
+ registerAgoraCommands(program);
4850
4852
  registerMoatCommands(program);
4851
4853
  // ─── Trust calibrator (v1.31.0) -- per-subsystem precision/recall/band
4852
4854
  registerTrustCommands(program);