mneme-ai 2.137.0 → 2.139.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,27 @@
1
+ /**
2
+ * `mneme axia` (v2.138.0) — AXIA (ἀξία, "worth"), membrane pillar 2: the Value
3
+ * Ledger. One signed, hash-chained, OFFLINE-verifiable summary of the value
4
+ * events Mneme's organs actually produced:
5
+ * - tokens-saved (pulled live from the treasury ledger)
6
+ * - destructive-gated · secret-redacted · injection-neutralized ·
7
+ * claim-corrected · omission-flagged (recorded into AXIA's own ledger)
8
+ *
9
+ * mneme axia # the signed value summary
10
+ * mneme axia --price-per-1k 0.003 # …with USD from tokens-saved × your rate
11
+ * mneme axia record --kind destructive-gated --source heph
12
+ *
13
+ * HONEST: counts are signed facts (events that HAPPENED). NOT "attacks
14
+ * prevented" and NEVER an estimated $ of damage — the only $ is
15
+ * tokens-saved × the price-per-1k YOU supply.
16
+ */
17
+ import type { Command } from "commander";
18
+ export declare const AXIA_LEDGER = ".mneme/axia/ledger.jsonl";
19
+ export declare const TREASURY_LEDGER = ".mneme/treasury/ledger.jsonl";
20
+ /** Shared appender — any organ records a value event. Total: never throws. */
21
+ export declare function appendAxiaEvent(cwd: string, e: {
22
+ kind: string;
23
+ count?: number;
24
+ source: string;
25
+ }): void;
26
+ export declare function registerAxiaCommands(program: Command): void;
27
+ //# sourceMappingURL=axia.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axia.d.ts","sourceRoot":"","sources":["../../src/commands/axia.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC,eAAO,MAAM,WAAW,6BAA6B,CAAC;AACtD,eAAO,MAAM,eAAe,iCAAiC,CAAC;AAE9D,8EAA8E;AAC9E,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAOtG;AAsCD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuC3D"}
@@ -0,0 +1,136 @@
1
+ /**
2
+ * `mneme axia` (v2.138.0) — AXIA (ἀξία, "worth"), membrane pillar 2: the Value
3
+ * Ledger. One signed, hash-chained, OFFLINE-verifiable summary of the value
4
+ * events Mneme's organs actually produced:
5
+ * - tokens-saved (pulled live from the treasury ledger)
6
+ * - destructive-gated · secret-redacted · injection-neutralized ·
7
+ * claim-corrected · omission-flagged (recorded into AXIA's own ledger)
8
+ *
9
+ * mneme axia # the signed value summary
10
+ * mneme axia --price-per-1k 0.003 # …with USD from tokens-saved × your rate
11
+ * mneme axia record --kind destructive-gated --source heph
12
+ *
13
+ * HONEST: counts are signed facts (events that HAPPENED). NOT "attacks
14
+ * prevented" and NEVER an estimated $ of damage — the only $ is
15
+ * tokens-saved × the price-per-1k YOU supply.
16
+ */
17
+ import { existsSync, readFileSync, mkdirSync, appendFileSync } from "node:fs";
18
+ import { join, dirname } from "node:path";
19
+ function writeJson(p) { process.stdout.write(JSON.stringify(p, null, 2) + "\n"); }
20
+ function writeText(l) { process.stdout.write(l + "\n"); }
21
+ export const AXIA_LEDGER = ".mneme/axia/ledger.jsonl";
22
+ export const TREASURY_LEDGER = ".mneme/treasury/ledger.jsonl";
23
+ /** Shared appender — any organ records a value event. Total: never throws. */
24
+ export function appendAxiaEvent(cwd, e) {
25
+ try {
26
+ const p = join(cwd, AXIA_LEDGER);
27
+ if (!existsSync(dirname(p)))
28
+ mkdirSync(dirname(p), { recursive: true });
29
+ const count = Number.isFinite(e.count) && e.count > 0 ? Math.floor(e.count) : 1;
30
+ appendFileSync(p, JSON.stringify({ kind: e.kind, count, source: e.source, at: Date.now() }) + "\n");
31
+ }
32
+ catch { /* best-effort — accounting never blocks work */ }
33
+ }
34
+ async function core() {
35
+ try {
36
+ const c = (await import("@mneme-ai/core"));
37
+ if (c.axia)
38
+ return c;
39
+ }
40
+ catch { /* */ }
41
+ return null;
42
+ }
43
+ /** Read AXIA's own event ledger + the treasury tokens-saved into a fused event list. */
44
+ function gatherEvents(m, cwd) {
45
+ const events = [];
46
+ // AXIA's own recorded events (gated / redacted / corrected / neutralized / flagged)
47
+ const ap = join(cwd, AXIA_LEDGER);
48
+ if (existsSync(ap)) {
49
+ for (const line of readFileSync(ap, "utf8").split("\n")) {
50
+ if (!line.trim())
51
+ continue;
52
+ try {
53
+ const j = JSON.parse(line);
54
+ if (j && typeof j.kind === "string")
55
+ events.push({ kind: j.kind, count: Number(j.count) || 1, source: String(j.source ?? "unknown"), at: Number(j.at) || undefined });
56
+ }
57
+ catch { /* skip */ }
58
+ }
59
+ }
60
+ // tokens-saved pulled LIVE from the treasury (single fused event, source=treasury)
61
+ try {
62
+ const tp = join(cwd, TREASURY_LEDGER);
63
+ if (m.treasury && existsSync(tp)) {
64
+ const tokensSaved = m.treasury.aggregate(m.treasury.parseLedger(readFileSync(tp, "utf8"))).tokensSaved;
65
+ if (tokensSaved > 0)
66
+ events.push({ kind: "tokens-saved", count: tokensSaved, source: "treasury" });
67
+ }
68
+ }
69
+ catch { /* */ }
70
+ return events;
71
+ }
72
+ export function registerAxiaCommands(program) {
73
+ const axia = program
74
+ .command("axia")
75
+ .description("💎 AXIA — the signed, hash-chained, OFFLINE-verifiable VALUE LEDGER (membrane pillar 2). Fuses what Mneme's organs actually did — tokens saved (treasury), destructive commands GATED, secrets redacted, injections neutralized, claims corrected, omissions flagged — into one number an auditor/insurer checks with a public key. HONEST: counts are facts, NOT 'attacks prevented'; the only $ is tokens-saved × YOUR price-per-1k — never an invented $ of damage.")
76
+ .option("--price-per-1k <usd>", "your vendor's INPUT price per 1k tokens → USD from tokens-saved only", (v) => parseFloat(v))
77
+ .option("--json", "JSON output (signed).")
78
+ .action(async (opts) => {
79
+ const m = await core();
80
+ if (!m) {
81
+ writeText("✗ core unavailable");
82
+ process.exitCode = 1;
83
+ return;
84
+ }
85
+ const cwd = process.cwd();
86
+ const events = gatherEvents(m, cwd);
87
+ const led = m.axia.buildAxiaLedger(events);
88
+ const s = m.axia.axiaSummary(led, opts.pricePer1k !== undefined ? { pricePer1k: opts.pricePer1k } : undefined);
89
+ let receipt = null;
90
+ try {
91
+ receipt = m.notary?.issueReceipt(cwd, { kind: "claim-verdict", subject: `axia:${s.totalEvents}ev/${s.tokensSaved}tok`, payload: { totalEvents: s.totalEvents, tokensSaved: s.tokensSaved, byKind: s.byKind }, includePayload: true });
92
+ }
93
+ catch { /* */ }
94
+ if (opts.json) {
95
+ writeJson({ ...s, signed: receipt });
96
+ return;
97
+ }
98
+ writeText(`💎 AXIA value ledger — ${s.totalEvents} value events · ${s.tokensSaved.toLocaleString()} tokens saved`);
99
+ const labels = { "destructive-gated": "destructive cmds GATED", "secret-redacted": "secrets redacted", "injection-neutralized": "injections neutralized", "claim-corrected": "claims corrected", "omission-flagged": "omissions flagged" };
100
+ for (const [k, label] of Object.entries(labels)) {
101
+ const n = s.byKind[k] ?? 0;
102
+ if (n > 0)
103
+ writeText(` ${String(n).padStart(6)} ${label}`);
104
+ }
105
+ if (s.tokensSaved > 0)
106
+ writeText(` ${s.tokensSaved.toLocaleString().padStart(6)} input tokens saved (treasury, ≈chars/4)`);
107
+ if (s.usdSaved !== null)
108
+ writeText(` ≈ $${s.usdSaved.toLocaleString(undefined, { minimumFractionDigits: 2 })} saved at $${opts.pricePer1k}/1k tokens (your supplied price)`);
109
+ writeText(` chain ${s.chainValid ? "✓ valid" : "🛑 BROKEN"}${receipt ? " · signed (verify offline with the NOTARY public key)" : ""}`);
110
+ writeText(` ${s.note}`);
111
+ if (s.totalEvents === 0 && s.tokensSaved === 0)
112
+ writeText(" (no value events yet — they accrue as Mneme's organs gate/redact/correct/save during normal use.)");
113
+ });
114
+ axia
115
+ .command("record")
116
+ .description("Record one value event into AXIA's signed ledger (organs call this; you rarely do).")
117
+ .requiredOption("--kind <k>", "tokens-saved | destructive-gated | secret-redacted | injection-neutralized | claim-corrected | omission-flagged")
118
+ .option("--count <n>", "how many (default 1)", (v) => parseInt(v, 10))
119
+ .option("--source <s>", "which organ produced it", "manual")
120
+ .action(async (opts) => {
121
+ const m = await core();
122
+ if (!m) {
123
+ writeText("✗ core unavailable");
124
+ process.exitCode = 1;
125
+ return;
126
+ }
127
+ if (!m.axia.AXIA_KINDS.includes(opts.kind)) {
128
+ writeText(`✗ unknown kind '${opts.kind}'. one of: ${m.axia.AXIA_KINDS.join(", ")}`);
129
+ process.exitCode = 2;
130
+ return;
131
+ }
132
+ appendAxiaEvent(process.cwd(), { kind: opts.kind, count: opts.count, source: opts.source });
133
+ writeText(`✓ recorded ${opts.count ?? 1}× ${opts.kind} (source: ${opts.source})`);
134
+ });
135
+ }
136
+ //# sourceMappingURL=axia.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axia.js","sourceRoot":"","sources":["../../src/commands/axia.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,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;AAEvE,MAAM,CAAC,MAAM,WAAW,GAAG,0BAA0B,CAAC;AACtD,MAAM,CAAC,MAAM,eAAe,GAAG,8BAA8B,CAAC;AAE9D,8EA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AC,CAAC;YAAC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YAAC,OAAO;QAAC,CAAC;QAClK,eAAe,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAC5F,SAAS,CAAC,cAAc,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,aAAa,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `mneme pce` (v2.139.0) — Proof-Carrying Edit (💎2). Attach a SIGNED certificate
3
+ * to an AI's diff that statically proves what it touches + introduces, so a
4
+ * reviewer/CI trusts the analysis offline without re-running it or trusting the
5
+ * author. Tampering with the diff OR the cert is caught.
6
+ *
7
+ * git diff | mneme pce --scope "src/**" --forbid network,childProcess
8
+ * mneme pce --diff change.patch --json > passport.json
9
+ * git diff | mneme pce verify --passport passport.json --scope "src/**"
10
+ *
11
+ * Exit 2 on BLOCK (out-of-scope · secret added · forbidden primitive) — CI-gate.
12
+ */
13
+ import type { Command } from "commander";
14
+ export declare function registerPceCommands(program: Command): void;
15
+ //# sourceMappingURL=pce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pce.d.ts","sourceRoot":"","sources":["../../src/commands/pce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAazC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0C1D"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * `mneme pce` (v2.139.0) — Proof-Carrying Edit (💎2). Attach a SIGNED certificate
3
+ * to an AI's diff that statically proves what it touches + introduces, so a
4
+ * reviewer/CI trusts the analysis offline without re-running it or trusting the
5
+ * author. Tampering with the diff OR the cert is caught.
6
+ *
7
+ * git diff | mneme pce --scope "src/**" --forbid network,childProcess
8
+ * mneme pce --diff change.patch --json > passport.json
9
+ * git diff | mneme pce verify --passport passport.json --scope "src/**"
10
+ *
11
+ * Exit 2 on BLOCK (out-of-scope · secret added · forbidden primitive) — CI-gate.
12
+ */
13
+ import { existsSync, readFileSync } from "node:fs";
14
+ import { pce, notary } from "@mneme-ai/core";
15
+ function out(s) { process.stdout.write(s + "\n"); }
16
+ function readDiff(file) {
17
+ try {
18
+ if (file && file !== "-" && existsSync(file))
19
+ return readFileSync(file, "utf8");
20
+ return readFileSync(0, "utf8"); // stdin
21
+ }
22
+ catch {
23
+ return "";
24
+ }
25
+ }
26
+ function splitList(v) { return typeof v === "string" && v.trim() ? v.split(",").map((s) => s.trim()).filter(Boolean) : []; }
27
+ export function registerPceCommands(program) {
28
+ const cmd = program
29
+ .command("pce")
30
+ .description("💎 PCE — Proof-Carrying Edit. Attach a SIGNED certificate to an AI's diff that statically PROVES what it does/doesn't do — which paths it touches, whether it stays inside a declared --scope, the dangerous primitives it introduces (eval/childProcess/fsDelete/network/dynamicImport), add/delete balance, and secret literals. A reviewer/CI verifies it OFFLINE (trusts the analysis, not the author); tampering with the diff OR the cert is caught. Exit 2 on BLOCK. HONEST: static lexical+structural analysis — proves declared checkable properties, NOT total runtime safety.")
31
+ .argument("[action]", "omit to certify; 'verify' to check a passport")
32
+ .option("--diff <file>", "unified diff file (default: stdin)")
33
+ .option("--scope <globs>", "comma-separated allowed path globs (e.g. \"src/**,test/**\")")
34
+ .option("--forbid <names>", "comma-separated primitives to BLOCK: eval,childProcess,fsDelete,network,dynamicImport")
35
+ .option("--passport <file>", "(verify) the passport JSON to check against the diff")
36
+ .option("--json", "JSON output")
37
+ .action((action, opts) => {
38
+ const diff = readDiff(opts.diff);
39
+ const analysisOpts = { declaredScope: splitList(opts.scope), forbidPrimitives: splitList(opts.forbid) };
40
+ if (action === "verify") {
41
+ if (!opts.passport || !existsSync(opts.passport)) {
42
+ out("✗ --passport <file> required for verify");
43
+ process.exitCode = 2;
44
+ return;
45
+ }
46
+ let passport;
47
+ try {
48
+ const j = JSON.parse(readFileSync(opts.passport, "utf8"));
49
+ passport = (j.passport ?? j);
50
+ }
51
+ catch {
52
+ out("✗ could not parse passport JSON");
53
+ process.exitCode = 2;
54
+ return;
55
+ }
56
+ const v = pce.verifyPassport(diff, passport, analysisOpts);
57
+ if (opts.json) {
58
+ out(JSON.stringify(v, null, 2));
59
+ }
60
+ else {
61
+ out(`${v.ok ? "✓ VERIFIED" : "🛑 INVALID"} — ${v.reason}`);
62
+ }
63
+ process.exitCode = v.ok ? 0 : 2;
64
+ return;
65
+ }
66
+ const passport = pce.buildPassport(diff, analysisOpts);
67
+ const cwd = process.cwd();
68
+ let receipt = null;
69
+ try {
70
+ receipt = notary.issueReceipt(cwd, { kind: "claim-verdict", subject: `pce:${passport.verdict}:${passport.diffHash.slice(0, 12)}`, payload: { diffHash: passport.diffHash, verdict: passport.verdict, propsHash: undefined }, includePayload: true });
71
+ }
72
+ catch { /* */ }
73
+ if (opts.json) {
74
+ out(JSON.stringify({ passport, signed: receipt }, null, 2));
75
+ process.exitCode = passport.verdict === "BLOCK" ? 2 : 0;
76
+ return;
77
+ }
78
+ const icon = passport.verdict === "PASS" ? "🟢" : passport.verdict === "REVIEW" ? "🟡" : "🛑";
79
+ const p = passport.properties;
80
+ out(`${icon} PCE ${passport.verdict} — ${p.touchedPaths.length} file(s), net ${p.netLines >= 0 ? "+" : ""}${p.netLines} lines`);
81
+ for (const path of p.touchedPaths.slice(0, 20))
82
+ out(` • ${path}`);
83
+ const intro = Object.entries(p.introducedPrimitives).filter(([, v]) => v).map(([k]) => k);
84
+ if (intro.length)
85
+ out(` primitives introduced: ${intro.join(", ")}`);
86
+ if (p.secretsAdded)
87
+ out(` ⚠ secret-looking literal added`);
88
+ if (!p.inScope)
89
+ out(` ⚠ out of scope: ${p.outOfScopePaths.join(", ")}`);
90
+ for (const r of passport.reasons)
91
+ out(` → ${r}`);
92
+ out(` diffHash ${passport.diffHash.slice(0, 16)}… ${receipt ? "· signed (verify offline with the NOTARY public key)" : ""}`);
93
+ process.exitCode = passport.verdict === "BLOCK" ? 2 : 0;
94
+ });
95
+ void cmd;
96
+ }
97
+ //# sourceMappingURL=pce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pce.js","sourceRoot":"","sources":["../../src/commands/pce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,SAAS,GAAG,CAAC,CAAS,IAAU,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACjE,SAAS,QAAQ,CAAC,IAAa;IAC7B,IAAI,CAAC;QACH,IAAI,IAAI,IAAI,IAAI,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAChF,OAAO,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ;IAC1C,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,EAAE,CAAC;IAAC,CAAC;AACxB,CAAC;AACD,SAAS,SAAS,CAAC,CAAU,IAAc,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/I,MAAM,UAAU,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AAY;YAAE,GAAG,CAAC,mCAAmC,CAAC,CAAC;QAC7D,IAAI,CAAC,CAAC,CAAC,OAAO;YAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC1E,KAAK,MAAM,CAAC,IAAI,QAAQ,CAAC,OAAO;YAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACnD,GAAG,CAAC,eAAe,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,sDAAsD,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC/H,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IACL,KAAK,GAAG,CAAC;AACX,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA+JA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAqhNvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiKA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuhNvD"}
package/dist/index.js CHANGED
@@ -92,6 +92,8 @@ 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 { registerAxiaCommands } from "./commands/axia.js";
96
+ import { registerPceCommands } from "./commands/pce.js";
95
97
  import { registerTrustCommands } from "./commands/trust.js";
96
98
  import { registerNuclearCommands } from "./commands/nuclear-cli.js";
97
99
  import { registerOvernightCommand } from "./commands/overnight.js";
@@ -4733,6 +4735,8 @@ export async function run(argv) {
4733
4735
  registerBootCommands(program);
4734
4736
  registerElleipsisCommands(program);
4735
4737
  registerSteleCommands(program);
4738
+ registerAxiaCommands(program);
4739
+ registerPceCommands(program);
4736
4740
  // ─── Trust calibrator (v1.31.0) -- per-subsystem precision/recall/band
4737
4741
  registerTrustCommands(program);
4738
4742
  // ─── Wisdom reactor (v1.33.0) -- five nuclear-physics formulas as Mneme metrics