mneme-ai 2.107.0 → 2.109.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,11 @@
1
+ /**
2
+ * `mneme absorb` (v2.109.0) — pipe a command's output in; Mneme deterministically
3
+ * extracts {intent, error-class, excerpt} and files it as a SIGNED Cortex fact
4
+ * (recall by any agent). If it's an error and you pass --fix, it also teaches
5
+ * the Shell Autopilot — closing the loop: absorb (learn) → autopilot (suggest).
6
+ *
7
+ * mycmd 2>&1 | mneme absorb --cmd "mycmd" --code $?
8
+ */
9
+ import type { Command } from "commander";
10
+ export declare function registerAbsorbCommands(program: Command): void;
11
+ //# sourceMappingURL=absorb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"absorb.d.ts","sourceRoot":"","sources":["../../src/commands/absorb.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8BzC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkC7D"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * `mneme absorb` (v2.109.0) — pipe a command's output in; Mneme deterministically
3
+ * extracts {intent, error-class, excerpt} and files it as a SIGNED Cortex fact
4
+ * (recall by any agent). If it's an error and you pass --fix, it also teaches
5
+ * the Shell Autopilot — closing the loop: absorb (learn) → autopilot (suggest).
6
+ *
7
+ * mycmd 2>&1 | mneme absorb --cmd "mycmd" --code $?
8
+ */
9
+ import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
10
+ import { join } from "node:path";
11
+ function writeJson(p) { process.stdout.write(JSON.stringify(p, null, 2) + "\n"); }
12
+ function writeText(l) { process.stdout.write(l + "\n"); }
13
+ async function core() {
14
+ try {
15
+ const c = (await import("@mneme-ai/core"));
16
+ if (c.logpipe && c.cortex)
17
+ return c;
18
+ }
19
+ catch { /* */ }
20
+ return null;
21
+ }
22
+ function cortexPath(cwd) { return join(cwd, ".mneme", "cortex", "store.json"); }
23
+ function readStdin() {
24
+ return new Promise((resolve) => {
25
+ if (process.stdin.isTTY)
26
+ return resolve("");
27
+ let data = "";
28
+ let done = false;
29
+ const finish = () => { if (!done) {
30
+ done = true;
31
+ resolve(data);
32
+ } };
33
+ process.stdin.setEncoding("utf8");
34
+ process.stdin.on("data", (c) => { data += c; if (data.length > 2_000_000)
35
+ finish(); });
36
+ process.stdin.on("end", finish);
37
+ process.stdin.on("error", finish);
38
+ setTimeout(finish, 4000); // never hang
39
+ });
40
+ }
41
+ export function registerAbsorbCommands(program) {
42
+ program
43
+ .command("absorb")
44
+ .description("📥 LOGPIPE — pipe a command's output in; Mneme extracts {intent, error, fix} deterministically and files it as a SIGNED, recallable Cortex fact (cross-agent). With --fix it also teaches the Shell Autopilot (absorb→autopilot loop). Usage: `mycmd 2>&1 | mneme absorb --cmd \"mycmd\" --code $?`")
45
+ .option("--cmd <c>", "the command that produced the output", "")
46
+ .option("--code <n>", "exit code (else inferred from output)", (v) => parseInt(v, 10))
47
+ .option("--fix <f>", "the command that FIXED this error (teaches the autopilot)")
48
+ .option("--text <t>", "output text inline (else read from stdin)")
49
+ .option("--agent <a>", "agent id", "absorb")
50
+ .option("--json", "JSON output.")
51
+ .action(async (opts) => {
52
+ const m = await core();
53
+ if (!m) {
54
+ writeText("✗ core unavailable");
55
+ process.exitCode = 1;
56
+ return;
57
+ }
58
+ const cwd = process.cwd();
59
+ const output = typeof opts.text === "string" ? opts.text : await readStdin();
60
+ const entry = m.logpipe.extractLogEntry(opts.cmd ?? "", output, typeof opts.code === "number" ? opts.code : NaN);
61
+ const f = m.logpipe.formatForCortex(entry);
62
+ // store as a signed cortex fact
63
+ let store = { v: 1, entries: [] };
64
+ try {
65
+ if (existsSync(cortexPath(cwd)))
66
+ store = JSON.parse(readFileSync(cortexPath(cwd), "utf8"));
67
+ }
68
+ catch { /* */ }
69
+ const out = m.cortex.contribute(cwd, store, { agent: opts.agent ?? "absorb", key: f.key, value: f.value, kind: f.kind }, Date.now());
70
+ store = out.store;
71
+ // close the loop: an error + a known fix → teach the autopilot
72
+ let taught = false;
73
+ if (entry.hadError && opts.fix) {
74
+ const rk = m.shellAutopilot.recoveryKey(entry.signature);
75
+ const o2 = m.cortex.contribute(cwd, store, { agent: opts.agent ?? "absorb", key: rk, value: opts.fix, kind: "fact" }, Date.now(), { update: true });
76
+ store = o2.store;
77
+ taught = true;
78
+ }
79
+ try {
80
+ const dir = join(cwd, ".mneme", "cortex");
81
+ if (!existsSync(dir))
82
+ mkdirSync(dir, { recursive: true });
83
+ writeFileSync(cortexPath(cwd), JSON.stringify(store, null, 2));
84
+ }
85
+ catch { /* */ }
86
+ if (opts.json) {
87
+ writeJson({ entry, cortex: out.result.verdict, taughtAutopilot: taught });
88
+ return;
89
+ }
90
+ writeText(`📥 ${entry.intent}`);
91
+ if (entry.hadError)
92
+ writeText(` error[${entry.errorClass}]: ${entry.excerpt}`);
93
+ writeText(` → cortex (${out.result.verdict})${taught ? " · taught the autopilot a recovery" : ""}`);
94
+ });
95
+ }
96
+ //# sourceMappingURL=absorb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"absorb.js","sourceRoot":"","sources":["../../src/commands/absorb.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,SAAS,SAAS,CAAC,CAAU,IAAU,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACjG,SAAS,SAAS,CAAC,CAAS,IAAU,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAA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CAAC,CAAC;YACpJ,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC;YAAC,MAAM,GAAG,IAAI,CAAC;QAClC,CAAC;QACD,IAAI,CAAC;YAAC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;gBAAE,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC;QAC7L,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAAC,SAAS,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,CAAC;YAAC,OAAO;QAAC,CAAC;QACrG,SAAS,CAAC,MAAM,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;QAChC,IAAI,KAAK,CAAC,QAAQ;YAAE,SAAS,CAAC,YAAY,KAAK,CAAC,UAAU,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACjF,SAAS,CAAC,gBAAgB,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,CAAC,CAAC,oCAAoC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACxG,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * `mneme entropy` (v2.108.0) — audited multi-source secrets. Mixes the OS
3
+ * CSPRNG + timing jitter + any physical/beacon sample you feed it, health-
4
+ * checks them, and emits a secret with a SIGNED provenance attestation
5
+ * (which sources, their health, the secret's hash — never the secret). Total.
6
+ */
7
+ import type { Command } from "commander";
8
+ export declare function registerEntropyCommands(program: Command): void;
9
+ //# sourceMappingURL=entropy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entropy.d.ts","sourceRoot":"","sources":["../../src/commands/entropy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgCzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA4D9D"}
@@ -0,0 +1,148 @@
1
+ /**
2
+ * `mneme entropy` (v2.108.0) — audited multi-source secrets. Mixes the OS
3
+ * CSPRNG + timing jitter + any physical/beacon sample you feed it, health-
4
+ * checks them, and emits a secret with a SIGNED provenance attestation
5
+ * (which sources, their health, the secret's hash — never the secret). Total.
6
+ */
7
+ import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
8
+ import { join } from "node:path";
9
+ import { randomBytes } from "node:crypto";
10
+ function writeJson(p) { process.stdout.write(JSON.stringify(p, null, 2) + "\n"); }
11
+ function writeText(l) { process.stdout.write(l + "\n"); }
12
+ async function core() {
13
+ try {
14
+ const c = (await import("@mneme-ai/core"));
15
+ if (c.entropy)
16
+ return c;
17
+ }
18
+ catch { /* */ }
19
+ return null;
20
+ }
21
+ /** Gather a (weak, supplementary) timing-jitter sample — defense in depth. */
22
+ function jitterSample(rounds = 4096) {
23
+ const acc = [];
24
+ let prev = Number(process.hrtime.bigint() & 0xffn);
25
+ for (let i = 0; i < rounds; i++) {
26
+ const t = Number(process.hrtime.bigint() & 0xffn);
27
+ acc.push((t ^ prev) & 0xff);
28
+ prev = t;
29
+ if (acc.length >= 256)
30
+ break;
31
+ }
32
+ return Buffer.from(acc);
33
+ }
34
+ export function registerEntropyCommands(program) {
35
+ const e = program
36
+ .command("entropy")
37
+ .description("🎲 AUDITED ENTROPY — generate secrets/keys by MIXING every entropy source you have (OS CSPRNG + timing jitter + any physical/beacon sample), health-checked, with a SIGNED provenance attestation. Defense-in-depth + auditable; NOT a claim of magic unhackability.");
38
+ e.command("gen")
39
+ .description("Generate a secret from mixed, health-checked sources + a signed provenance attestation.")
40
+ .option("--bytes <n>", "secret length in bytes", (v) => parseInt(v, 10), 32)
41
+ .option("--physical <s>", "a physical/external sample to mix in (sensor reading, dice rolls, etc.)")
42
+ .option("--beacon-file <f>", "file with public randomness-beacon bytes to mix in")
43
+ .option("--hash-only", "print only the secret's hash + attestation (don't reveal the secret)")
44
+ .option("--json", "JSON output.")
45
+ .action(async (opts) => {
46
+ const m = await core();
47
+ if (!m) {
48
+ writeText("✗ core unavailable");
49
+ process.exitCode = 1;
50
+ return;
51
+ }
52
+ const cwd = process.cwd();
53
+ const sources = [
54
+ { id: "os-csprng", data: randomBytes(64) },
55
+ { id: "timing-jitter", data: jitterSample() },
56
+ ];
57
+ if (opts.physical)
58
+ sources.push({ id: "physical", data: opts.physical });
59
+ if (opts.beaconFile && existsSync(opts.beaconFile)) {
60
+ try {
61
+ sources.push({ id: "beacon", data: readFileSync(opts.beaconFile) });
62
+ }
63
+ catch { /* */ }
64
+ }
65
+ const sec = m.entropy.generateSecret(cwd, sources, opts.bytes ?? 32, Date.now());
66
+ // persist the attestation (not the secret) for later verification
67
+ try {
68
+ const dir = join(cwd, ".mneme", "entropy");
69
+ if (!existsSync(dir))
70
+ mkdirSync(dir, { recursive: true });
71
+ writeFileSync(join(dir, "last_attestation.json"), JSON.stringify(sec.attestation, null, 2));
72
+ }
73
+ catch { /* */ }
74
+ if (opts.json) {
75
+ writeJson({ secret: opts.hashOnly ? undefined : sec.secretHex, sourceIds: sec.sourceIds, sourceHealth: sec.sourceHealth, outputHealth: sec.outputHealth, attestation: sec.attestation });
76
+ return;
77
+ }
78
+ writeText(`🎲 secret (${(opts.bytes ?? 32)} bytes) — sources: ${sec.sourceIds.join(" + ")}`);
79
+ if (!opts.hashOnly)
80
+ writeText(` ${sec.secretHex}`);
81
+ writeText(` output health: ${sec.outputHealth.passed ? "✓ passed" : "✗ failed"} · est. min-entropy ${sec.outputHealth.minEntropyBitsPerByte}/8 bits/byte`);
82
+ for (const h of sec.sourceHealth)
83
+ writeText(` ${h.passed ? "✓" : "⚠"} ${h.id}: min-entropy ${h.minEntropyBitsPerByte}`);
84
+ writeText(` ✓ signed provenance attestation → .mneme/entropy/last_attestation.json (verify with: mneme entropy verify)`);
85
+ });
86
+ e.command("verify")
87
+ .description("Verify a secret's provenance attestation offline (signature + that the secret matches, without the attestation ever containing it).")
88
+ .requiredOption("--secret <hex>", "the secret (hex) to verify")
89
+ .option("--attestation-file <f>", "attestation JSON (default: .mneme/entropy/last_attestation.json)")
90
+ .option("--json", "JSON output.")
91
+ .action(async (opts) => {
92
+ const m = await core();
93
+ if (!m) {
94
+ writeText("✗ core unavailable");
95
+ process.exitCode = 1;
96
+ return;
97
+ }
98
+ const path = opts.attestationFile || join(process.cwd(), ".mneme", "entropy", "last_attestation.json");
99
+ if (!existsSync(path)) {
100
+ writeText(`✗ no attestation at ${path}`);
101
+ process.exitCode = 1;
102
+ return;
103
+ }
104
+ let att;
105
+ try {
106
+ att = JSON.parse(readFileSync(path, "utf8"));
107
+ }
108
+ catch {
109
+ writeText("✗ attestation not valid JSON");
110
+ process.exitCode = 1;
111
+ return;
112
+ }
113
+ const v = m.entropy.verifySecretAttestation(att, opts.secret);
114
+ if (opts.json) {
115
+ writeJson(v);
116
+ process.exitCode = v.bound ? 0 : 1;
117
+ return;
118
+ }
119
+ writeText(v.bound ? `✓ VERIFIED — ${v.reason}` : `✗ NOT VERIFIED — ${v.reason}`);
120
+ process.exitCode = v.bound ? 0 : 1;
121
+ });
122
+ e.command("health")
123
+ .description("Health-check a byte sample (monobit / runs / min-entropy) — catches a stuck or degraded entropy source.")
124
+ .requiredOption("--file <f>", "file to check")
125
+ .option("--json", "JSON output.")
126
+ .action(async (opts) => {
127
+ const m = await core();
128
+ if (!m) {
129
+ writeText("✗ core unavailable");
130
+ process.exitCode = 1;
131
+ return;
132
+ }
133
+ if (!existsSync(opts.file)) {
134
+ writeText("✗ file not found");
135
+ process.exitCode = 1;
136
+ return;
137
+ }
138
+ const h = m.entropy.healthCheck(readFileSync(opts.file));
139
+ if (opts.json) {
140
+ writeJson(h);
141
+ process.exitCode = h.passed ? 0 : 1;
142
+ return;
143
+ }
144
+ writeText(`${h.passed ? "✓ passed" : "✗ FAILED"} — monobit ${h.monobit.toFixed(3)} · est. min-entropy ${h.minEntropyBitsPerByte.toFixed(2)}/8`);
145
+ process.exitCode = h.passed ? 0 : 1;
146
+ });
147
+ }
148
+ //# sourceMappingURL=entropy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entropy.js","sourceRoot":"","sources":["../../src/commands/entropy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,SAAS,SAAS,CAAC,CAAU,IAAU,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACjG,SAAS,SAAS,CAAC,CAAS,IAAU,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AASvE,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QAAC,MAAM,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAA2B,CAAC;QAAC,IAAI,CAAC,CAAC,OAAO;YAAE,OAAO,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC;IACtH,OAAO,IAAI,CAAC;AACd,CAAC;AAED,8EAA8E;AAC9E,SAAS,YAAY,CAAC,MAAM,G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GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,cAAc,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAChJ,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA4IA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAs+MvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA8IA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAw+MvD"}
package/dist/index.js CHANGED
@@ -73,6 +73,8 @@ import { registerWisdomGateCommands } from "./commands/wisdom_gates.js";
73
73
  import { registerCortexCommands } from "./commands/cortex.js";
74
74
  import { registerShellCommands } from "./commands/shell.js";
75
75
  import { registerDigCommands } from "./commands/dig.js";
76
+ import { registerEntropyCommands } from "./commands/entropy.js";
77
+ import { registerAbsorbCommands } from "./commands/absorb.js";
76
78
  import { registerTrustCommands } from "./commands/trust.js";
77
79
  import { registerNuclearCommands } from "./commands/nuclear-cli.js";
78
80
  import { registerOvernightCommand } from "./commands/overnight.js";
@@ -4691,6 +4693,8 @@ export async function run(argv) {
4691
4693
  registerCortexCommands(program);
4692
4694
  registerShellCommands(program);
4693
4695
  registerDigCommands(program);
4696
+ registerEntropyCommands(program);
4697
+ registerAbsorbCommands(program);
4694
4698
  // ─── Trust calibrator (v1.31.0) -- per-subsystem precision/recall/band
4695
4699
  registerTrustCommands(program);
4696
4700
  // ─── Wisdom reactor (v1.33.0) -- five nuclear-physics formulas as Mneme metrics