mneme-ai 2.167.0 → 2.168.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 adamas` (v2.168.0) — ADAMAS (ἀδάμας, "unbreakable / diamond"):
|
|
3
|
+
* QEC-inspired self-healing memory. A fact is encoded with a real MDS erasure
|
|
4
|
+
* code (Cauchy/GF(256), the Reed-Solomon family) into K data + M parity shards;
|
|
5
|
+
* a per-shard SHA-256 syndrome locates corruption; the code recovers the
|
|
6
|
+
* original BYTE-IDENTICAL while >= K of K+M shards survive (tolerates up to M
|
|
7
|
+
* bad shards), and returns UNRECOVERABLE past that — it never guesses.
|
|
8
|
+
*
|
|
9
|
+
* mneme adamas # live self-test (gauntlet 100/100)
|
|
10
|
+
* mneme adamas encode "x=42" [--k 6 --m 3] > block.json # signed block
|
|
11
|
+
* mneme adamas check --block block.json # syndrome
|
|
12
|
+
* mneme adamas heal --block block.json # decode + auto-correct
|
|
13
|
+
*/
|
|
14
|
+
import type { Command } from "commander";
|
|
15
|
+
export declare function registerAdamasCommands(program: Command): void;
|
|
16
|
+
//# sourceMappingURL=adamas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adamas.d.ts","sourceRoot":"","sources":["../../src/commands/adamas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAazC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgD7D"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { adamas, notary } from "@mneme-ai/core";
|
|
3
|
+
function out(s) { process.stdout.write(s + "\n"); }
|
|
4
|
+
function sign(block) {
|
|
5
|
+
try {
|
|
6
|
+
const receipt = notary.issueReceipt(process.cwd(), { kind: "memory-capsule", subject: `adamas:${block.root.slice(0, 12)}`, payload: { root: block.root, k: block.k, m: block.m }, includePayload: true });
|
|
7
|
+
return { ...block, _proof: receipt };
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return block;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export function registerAdamasCommands(program) {
|
|
14
|
+
const a = program
|
|
15
|
+
.command("adamas")
|
|
16
|
+
.description("💎 ADAMAS — QEC-inspired SELF-HEALING MEMORY. Encode a fact into K data + M parity shards (real MDS erasure code, Cauchy/GF(256)); a per-shard syndrome locates corruption/tamper/loss and the code recovers it BYTE-IDENTICAL while ≥K shards survive (tolerates up to M bad), else UNRECOVERABLE — never a guess (prove-or-unknown). The classical algorithm behind quantum error correction (stabilizer codes), runnable today; composes with NOTARY + HYDRA. NOT a qubit — a textbook code that makes long-term AI memory provably survive corruption.")
|
|
17
|
+
.action(() => {
|
|
18
|
+
const g = adamas.adamasGauntlet();
|
|
19
|
+
out(`💎 ADAMAS — self-healing memory self-test (gauntlet ${g.score}/100)`);
|
|
20
|
+
for (const c of g.checks)
|
|
21
|
+
out(` ${c.pass ? "✓" : "✗"} ${c.name.padEnd(13)} ${c.detail}`);
|
|
22
|
+
process.exitCode = g.score === 100 ? 0 : 2;
|
|
23
|
+
});
|
|
24
|
+
a.command("encode")
|
|
25
|
+
.description("encode a fact into a signed, self-healing ADAMAS block.")
|
|
26
|
+
.argument("<text>", "the fact to protect")
|
|
27
|
+
.option("--k <n>", "data shards (default 6)", (v) => parseInt(v, 10))
|
|
28
|
+
.option("--m <n>", "parity shards = max bad shards tolerated (default 3)", (v) => parseInt(v, 10))
|
|
29
|
+
.action((text, opts) => {
|
|
30
|
+
const block = adamas.encodeFact(text, { k: opts.k, m: opts.m });
|
|
31
|
+
out(JSON.stringify(sign(block), null, 2));
|
|
32
|
+
});
|
|
33
|
+
a.command("check")
|
|
34
|
+
.description("measure the syndrome: which shards are corrupt/missing + recoverable? (exit 2 if not healthy)")
|
|
35
|
+
.requiredOption("--block <file>", "ADAMAS block JSON ('-' for stdin)")
|
|
36
|
+
.option("--json", "JSON output")
|
|
37
|
+
.action((opts) => {
|
|
38
|
+
let blk;
|
|
39
|
+
try {
|
|
40
|
+
blk = JSON.parse(opts.block === "-" ? readFileSync(0, "utf8") : readFileSync(opts.block, "utf8"));
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
out("✗ could not read/parse block");
|
|
44
|
+
process.exitCode = 2;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const syn = adamas.checkSyndrome(blk);
|
|
48
|
+
if (opts.json) {
|
|
49
|
+
out(JSON.stringify(syn, null, 2));
|
|
50
|
+
process.exitCode = syn.healthy ? 0 : 2;
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
out(`${syn.healthy ? "✓ HEALTHY" : syn.recoverable ? "⚠ DEGRADED (recoverable)" : "🛑 UNRECOVERABLE"}`);
|
|
54
|
+
out(` bad shards: [${syn.badShards.join(", ")}] · tolerates M=${syn.m} · root-seal ${syn.rootOk ? "ok" : "BROKEN"}`);
|
|
55
|
+
process.exitCode = syn.healthy ? 0 : 2;
|
|
56
|
+
});
|
|
57
|
+
a.command("heal")
|
|
58
|
+
.description("decode + auto-correct: recover the fact byte-identical if ≤M shards bad, else UNRECOVERABLE (exit 2).")
|
|
59
|
+
.requiredOption("--block <file>", "ADAMAS block JSON ('-' for stdin)")
|
|
60
|
+
.option("--json", "JSON output")
|
|
61
|
+
.action((opts) => {
|
|
62
|
+
let blk;
|
|
63
|
+
try {
|
|
64
|
+
blk = JSON.parse(opts.block === "-" ? readFileSync(0, "utf8") : readFileSync(opts.block, "utf8"));
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
out("✗ could not read/parse block");
|
|
68
|
+
process.exitCode = 2;
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const d = adamas.decodeFact(blk);
|
|
72
|
+
if (opts.json) {
|
|
73
|
+
out(JSON.stringify(d, null, 2));
|
|
74
|
+
process.exitCode = d.ok ? 0 : 2;
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (!d.ok) {
|
|
78
|
+
out(`🛑 ${d.reason}`);
|
|
79
|
+
process.exitCode = 2;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
out(`${d.recovered ? `✓ HEALED (corrected shards [${d.corrected.join(", ")}])` : "✓ HEALTHY"}`);
|
|
83
|
+
out(d.value ?? "");
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=adamas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adamas.js","sourceRoot":"","sources":["../../src/commands/adamas.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAEhD,SAAS,GAAG,CAAC,CAAS,IAAU,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAEjE,SAAS,IAAI,CAAC,KAAyB;IACrC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,UAAU,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1M,OAAO,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QAAC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C,CAAC,CAAC;YAAC,OAAO;QAAC,CAAC;QAC5F,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;YAAC,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;YAAC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YAAC,OAAO;QAAC,CAAC;QACnE,GAAG,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;QAChG,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA+KA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA+kNvD"}
|
package/dist/index.js
CHANGED
|
@@ -95,6 +95,7 @@ import { registerSteleCommands } from "./commands/stele.js";
|
|
|
95
95
|
import { registerMembraneCommands } from "./commands/membrane.js";
|
|
96
96
|
import { registerTrustlessCommands } from "./commands/trustless.js";
|
|
97
97
|
import { registerMatrixCommands } from "./commands/matrix.js";
|
|
98
|
+
import { registerAdamasCommands } from "./commands/adamas.js";
|
|
98
99
|
import { registerAxiaCommands } from "./commands/axia.js";
|
|
99
100
|
import { registerPceCommands } from "./commands/pce.js";
|
|
100
101
|
import { registerHauntCommands } from "./commands/haunt.js";
|
|
@@ -4754,6 +4755,7 @@ export async function run(argv) {
|
|
|
4754
4755
|
registerMembraneCommands(program);
|
|
4755
4756
|
registerTrustlessCommands(program);
|
|
4756
4757
|
registerMatrixCommands(program);
|
|
4758
|
+
registerAdamasCommands(program);
|
|
4757
4759
|
registerAxiaCommands(program);
|
|
4758
4760
|
registerPceCommands(program);
|
|
4759
4761
|
registerHauntCommands(program);
|