mneme-ai 2.150.0 → 2.164.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,16 @@
1
+ /**
2
+ * `mneme membrane` (v2.164.0) — THE MEMBRANE: the capstone that fuses the three
3
+ * pillars into ONE signed packet an agent crosses at session start.
4
+ *
5
+ * CAPABILITY (STELE) + ACTIVATION (BOOT) + VALUE (AXIA), sealed with one
6
+ * Ed25519 receipt that verifies the whole thing offline.
7
+ *
8
+ * mneme membrane # build + seal the fused packet (human)
9
+ * mneme membrane --held <root> # capability delta vs what you hold
10
+ * mneme membrane --held-file held.json
11
+ * mneme membrane --price-per-1k 3 # report USD from tokens-saved
12
+ * mneme membrane --json # the signed packet as JSON
13
+ */
14
+ import type { Command } from "commander";
15
+ export declare function registerMembraneCommands(program: Command): void;
16
+ //# sourceMappingURL=membrane.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"membrane.d.ts","sourceRoot":"","sources":["../../src/commands/membrane.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8BzC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA4C/D"}
@@ -0,0 +1,89 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { membrane, agentManifest, treasury } from "@mneme-ai/core";
4
+ import { getVersion } from "../version.js";
5
+ function out(s) { process.stdout.write(s + "\n"); }
6
+ /** Gather AXIA value events: AXIA's own ledger + treasury tokens-saved (live). */
7
+ function gatherAxiaEvents(cwd) {
8
+ const events = [];
9
+ try {
10
+ const ap = join(cwd, ".mneme", "axia", "ledger.jsonl");
11
+ if (existsSync(ap)) {
12
+ for (const line of readFileSync(ap, "utf8").split("\n")) {
13
+ const t = line.trim();
14
+ if (!t)
15
+ continue;
16
+ try {
17
+ const e = JSON.parse(t);
18
+ if (e && e.kind)
19
+ events.push({ kind: e.kind, count: Number(e.count) || 0, source: String(e.source ?? "unknown"), ...(Number.isFinite(e.at) ? { at: e.at } : {}) });
20
+ }
21
+ catch { /* skip */ }
22
+ }
23
+ }
24
+ }
25
+ catch { /* */ }
26
+ try {
27
+ const tp = join(cwd, ".mneme", "treasury", "ledger.jsonl");
28
+ if (existsSync(tp)) {
29
+ const tokensSaved = treasury.aggregate(treasury.parseLedger(readFileSync(tp, "utf8"))).tokensSaved;
30
+ if (tokensSaved > 0)
31
+ events.push({ kind: "tokens-saved", count: tokensSaved, source: "treasury" });
32
+ }
33
+ }
34
+ catch { /* */ }
35
+ return events;
36
+ }
37
+ export function registerMembraneCommands(program) {
38
+ program
39
+ .command("membrane")
40
+ .description("🧬 THE MEMBRANE — the capstone that FUSES Mneme's three pillars into ONE signed packet an AI agent crosses at session start: CAPABILITY (STELE — merkle delta-sync), ACTIVATION (BOOT — when→tool table), VALUE (AXIA — hash-chained, offline-verifiable ledger). One Ed25519 receipt verifies the whole packet offline. The honest fix for the three reasons an installed tool stays idle: you don't KNOW what exists, don't know WHEN to use it, can't PROVE the value created.")
41
+ .option("--held <root>", "the STELE merkle root your agent currently holds (for a capability delta).")
42
+ .option("--held-file <p>", "JSON file: {\"root\":\"…\",\"leaves\":{\"name\":\"hash\"}}.")
43
+ .option("--task <t>", "task hint to lightly rank the activation table (never drops rows).")
44
+ .option("--price-per-1k <usd>", "your vendor's price per 1k tokens — only then is USD reported.")
45
+ .option("--json", "the signed packet as JSON.")
46
+ .action((opts) => {
47
+ const cwd = process.cwd();
48
+ let heldRoot = opts.held ?? "";
49
+ let heldLeaves;
50
+ if (opts.heldFile && existsSync(opts.heldFile)) {
51
+ try {
52
+ const j = JSON.parse(readFileSync(opts.heldFile, "utf8"));
53
+ if (typeof j.root === "string")
54
+ heldRoot = j.root;
55
+ if (j.leaves && typeof j.leaves === "object")
56
+ heldLeaves = j.leaves;
57
+ }
58
+ catch { /* */ }
59
+ }
60
+ const price = opts.pricePer1k !== undefined ? Number(opts.pricePer1k) : undefined;
61
+ const packet = membrane.buildMembrane({
62
+ version: getVersion(),
63
+ heldRoot: heldRoot || undefined,
64
+ heldLeaves,
65
+ task: opts.task,
66
+ axiaEvents: gatherAxiaEvents(cwd),
67
+ pricePer1k: Number.isFinite(price) ? price : undefined,
68
+ catalog: agentManifest.MNEME_COMMAND_CATALOG,
69
+ });
70
+ const signed = membrane.sealMembrane(cwd, packet);
71
+ if (opts.json) {
72
+ out(JSON.stringify(signed, null, 2));
73
+ return;
74
+ }
75
+ const c = packet.capability, v = packet.value;
76
+ out(`🧬 THE MEMBRANE — Mneme v${packet.version} · one signed packet, three pillars`);
77
+ out(` receipt ${signed.receipt.receiptId ? signed.receipt.receiptId.slice(0, 16) + "…" : "(signed)"} · verify offline with the NOTARY public key`);
78
+ out("");
79
+ out(` ① CAPABILITY (STELE) — ${c.count} tools · root ${c.root.slice(0, 16)}…`);
80
+ out(c.upToDate
81
+ ? ` ✓ a held root matching this pulls 0 tokens (provably current + complete).`
82
+ : ` a cold agent pulls the full surface (~${c.fullTokenEstimate} tok); pass --held <root> next time for the delta.`);
83
+ out(` ② ACTIVATION (BOOT) — ${packet.activation.decisionTable.length} when→tool signals (≤2KB instructions ready for an MCP instructions field).`);
84
+ out(` ③ VALUE (AXIA) — ${v.tokensSaved.toLocaleString()} tokens saved · ${v.totalEvents} gated/redacted/corrected events · chain ${v.chainValid ? "✓ valid" : "✗ broken"}${v.usdSaved !== null ? ` · $${v.usdSaved}` : ""}`);
85
+ out("");
86
+ out(` Honest: counts are FACTS of events Mneme did — never 'attacks prevented', never an invented $ damage; USD only from tokens-saved × your price.`);
87
+ });
88
+ }
89
+ //# sourceMappingURL=membrane.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"membrane.js","sourceRoot":"","sources":["../../src/commands/membrane.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;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A,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA2kNvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA4KA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA4kNvD"}
package/dist/index.js CHANGED
@@ -92,6 +92,7 @@ import { registerRailCommands } from "./commands/rail.js";
92
92
  import { registerBootCommands } from "./commands/boot.js";
93
93
  import { registerElleipsisCommands } from "./commands/elleipsis.js";
94
94
  import { registerSteleCommands } from "./commands/stele.js";
95
+ import { registerMembraneCommands } from "./commands/membrane.js";
95
96
  import { registerAxiaCommands } from "./commands/axia.js";
96
97
  import { registerPceCommands } from "./commands/pce.js";
97
98
  import { registerHauntCommands } from "./commands/haunt.js";
@@ -4748,6 +4749,7 @@ export async function run(argv) {
4748
4749
  registerBootCommands(program);
4749
4750
  registerElleipsisCommands(program);
4750
4751
  registerSteleCommands(program);
4752
+ registerMembraneCommands(program);
4751
4753
  registerAxiaCommands(program);
4752
4754
  registerPceCommands(program);
4753
4755
  registerHauntCommands(program);