mneme-ai 2.62.0 → 2.64.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuIA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsxLvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuIA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAq7LvD"}
package/dist/index.js CHANGED
@@ -4682,6 +4682,180 @@ export async function run(argv) {
4682
4682
  process.exitCode = 1;
4683
4683
  }
4684
4684
  });
4685
+ // v2.64.0 — DIFFERENTIAL ARENA: multi-vendor consensus by default.
4686
+ const diffArenaParent = program
4687
+ .command("diff_arena")
4688
+ .description("v2.64 — multi-vendor consensus. Default action = audit ledger.")
4689
+ .action(async () => {
4690
+ try {
4691
+ const core = await import("@mneme-ai/core");
4692
+ const led = core.diffArena.verifyLedgerChain(process.cwd());
4693
+ const rows = core.diffArena.readLedger(process.cwd());
4694
+ process.stdout.write(JSON.stringify({ ok: led.ok, rows: led.rows, brokenAt: led.brokenAt, recent: rows.slice(-10) }, null, 2) + "\n");
4695
+ }
4696
+ catch (e) {
4697
+ process.stdout.write(JSON.stringify({ ok: false, error: e.message }) + "\n");
4698
+ process.exitCode = 1;
4699
+ }
4700
+ });
4701
+ diffArenaParent.command("ask")
4702
+ .description("Ask the same prompt to multiple vendors in parallel; return consensus + suggested answer. Default: 2 mock vendors (offline demo).")
4703
+ .requiredOption("--prompt <text>", "Prompt to send")
4704
+ .option("--vendors <list>", "Comma-separated vendor specs. Format: 'name:kind' where kind=mock. Real http/cli wiring needs JS config.", (v) => v.split(",").map((s) => s.trim()).filter(Boolean), ["claude:mock", "gpt:mock", "gemini:mock"])
4705
+ .option("--banner", "Render ASCII banner instead of JSON")
4706
+ .action(async (opts) => {
4707
+ try {
4708
+ const core = await import("@mneme-ai/core");
4709
+ const vendors = (opts.vendors ?? ["claude:mock", "gpt:mock", "gemini:mock"]).map((spec) => {
4710
+ const [name, kind] = spec.split(":");
4711
+ if (kind === "mock")
4712
+ return core.diffArena.mockAdapter({ name: name ?? "unknown" });
4713
+ throw new Error(`CLI only supports mock vendors; got '${kind}'. For http/cli adapters use the SDK programmatically.`);
4714
+ });
4715
+ const r = await core.diffArena.diffArenaAsk({
4716
+ prompt: opts.prompt,
4717
+ vendors,
4718
+ cwd: process.cwd(),
4719
+ });
4720
+ if (opts.banner)
4721
+ process.stdout.write(core.diffArena.renderArenaBanner(r) + "\n");
4722
+ else
4723
+ process.stdout.write(JSON.stringify(r, null, 2) + "\n");
4724
+ }
4725
+ catch (e) {
4726
+ process.stdout.write(JSON.stringify({ ok: false, error: e.message }) + "\n");
4727
+ process.exitCode = 1;
4728
+ }
4729
+ });
4730
+ diffArenaParent.command("audit")
4731
+ .description("Verify HMAC-chained rounds ledger + last N entries.")
4732
+ .option("--limit <n>", "Max rows", (v) => Number(v), 20)
4733
+ .action(async (opts) => {
4734
+ try {
4735
+ const core = await import("@mneme-ai/core");
4736
+ const led = core.diffArena.verifyLedgerChain(process.cwd());
4737
+ const rows = core.diffArena.readLedger(process.cwd());
4738
+ process.stdout.write(JSON.stringify({ ok: led.ok, totalRows: led.rows, brokenAt: led.brokenAt, recent: rows.slice(-(opts.limit ?? 20)) }, null, 2) + "\n");
4739
+ if (!led.ok)
4740
+ process.exitCode = 1;
4741
+ }
4742
+ catch (e) {
4743
+ process.stdout.write(JSON.stringify({ ok: false, error: e.message }) + "\n");
4744
+ process.exitCode = 1;
4745
+ }
4746
+ });
4747
+ // v2.63.0 — TIME-CRYSTAL: federated agent wisdom.
4748
+ // When agent A hits problem P → "342 agents saw same in 7 days; 89%
4749
+ // used X; 11% tried Y but broke on pnpm".
4750
+ const timeCrystalParent = program
4751
+ .command("time_crystal")
4752
+ .description("v2.63 — federated agent wisdom. Default action = stats summary.")
4753
+ .action(async () => {
4754
+ try {
4755
+ const core = await import("@mneme-ai/core");
4756
+ const stats = core.timeCrystal.contributorStats(process.cwd());
4757
+ const led = core.timeCrystal.verifyLedgerChain(process.cwd());
4758
+ process.stdout.write(JSON.stringify({ ok: led.ok, ledger: led, ...stats }, null, 2) + "\n");
4759
+ }
4760
+ catch (e) {
4761
+ process.stdout.write(JSON.stringify({ ok: false, error: e.message }) + "\n");
4762
+ process.exitCode = 1;
4763
+ }
4764
+ });
4765
+ timeCrystalParent.command("lookup")
4766
+ .description("Look up wisdom for a problem (returns ranked approaches + gotchas + related buckets).")
4767
+ .requiredOption("--problem <text>", "Problem description")
4768
+ .option("--env <kv...>", "Env hints (e.g. node=22 pm=npm)", (val, prev = []) => prev.concat([val]), [])
4769
+ .option("--top <n>", "Max approaches", (v) => Number(v), 5)
4770
+ .option("--banner", "Render ASCII banner instead of JSON")
4771
+ .action(async (opts) => {
4772
+ try {
4773
+ const core = await import("@mneme-ai/core");
4774
+ const envMap = {};
4775
+ for (const e of opts.env ?? []) {
4776
+ const [k, v] = e.split("=");
4777
+ if (k && v)
4778
+ envMap[k] = v;
4779
+ }
4780
+ const r = core.timeCrystal.lookupWisdom({
4781
+ problem: opts.problem,
4782
+ env: Object.keys(envMap).length > 0 ? envMap : undefined,
4783
+ topN: opts.top ?? 5,
4784
+ cwd: process.cwd(),
4785
+ });
4786
+ if (opts.banner)
4787
+ process.stdout.write(core.timeCrystal.renderLookupBanner(r) + "\n");
4788
+ else
4789
+ process.stdout.write(JSON.stringify(r, null, 2) + "\n");
4790
+ }
4791
+ catch (e) {
4792
+ process.stdout.write(JSON.stringify({ ok: false, error: e.message }) + "\n");
4793
+ process.exitCode = 1;
4794
+ }
4795
+ });
4796
+ timeCrystalParent.command("contribute")
4797
+ .description("Contribute a (problem, approach, outcome) record. Anyone using Mneme MCP contributes back.")
4798
+ .requiredOption("--problem <text>", "Problem description")
4799
+ .requiredOption("--approach <text>", "What you tried")
4800
+ .requiredOption("--outcome <s>", "success / failure / partial")
4801
+ .requiredOption("--agent <id>", "Reporting agent identifier")
4802
+ .option("--env <kv...>", "Env hints (node=22 pm=npm)", (val, prev = []) => prev.concat([val]), [])
4803
+ .option("--note <text>", "Free-text gotcha hint")
4804
+ .action(async (opts) => {
4805
+ try {
4806
+ const core = await import("@mneme-ai/core");
4807
+ const envMap = {};
4808
+ for (const e of opts.env ?? []) {
4809
+ const [k, v] = e.split("=");
4810
+ if (k && v)
4811
+ envMap[k] = v;
4812
+ }
4813
+ const r = core.timeCrystal.contribute({
4814
+ problem: opts.problem,
4815
+ approach: opts.approach,
4816
+ outcome: opts.outcome,
4817
+ agent: opts.agent,
4818
+ env: Object.keys(envMap).length > 0 ? envMap : undefined,
4819
+ note: opts.note,
4820
+ cwd: process.cwd(),
4821
+ });
4822
+ process.stdout.write(JSON.stringify(r, null, 2) + "\n");
4823
+ }
4824
+ catch (e) {
4825
+ process.stdout.write(JSON.stringify({ ok: false, error: e.message }) + "\n");
4826
+ process.exitCode = 1;
4827
+ }
4828
+ });
4829
+ timeCrystalParent.command("stats")
4830
+ .description("Show contributor stats: total contributions, distinct agents, top problems.")
4831
+ .action(async () => {
4832
+ try {
4833
+ const core = await import("@mneme-ai/core");
4834
+ const stats = core.timeCrystal.contributorStats(process.cwd());
4835
+ process.stdout.write(JSON.stringify(stats, null, 2) + "\n");
4836
+ }
4837
+ catch (e) {
4838
+ process.stdout.write(JSON.stringify({ ok: false, error: e.message }) + "\n");
4839
+ process.exitCode = 1;
4840
+ }
4841
+ });
4842
+ timeCrystalParent.command("audit")
4843
+ .description("Verify HMAC-chained wisdom ledger + show last N entries.")
4844
+ .option("--limit <n>", "Max rows", (v) => Number(v), 20)
4845
+ .action(async (opts) => {
4846
+ try {
4847
+ const core = await import("@mneme-ai/core");
4848
+ const led = core.timeCrystal.verifyLedgerChain(process.cwd());
4849
+ const rows = core.timeCrystal.readLedger(process.cwd());
4850
+ process.stdout.write(JSON.stringify({ ok: led.ok, totalRows: led.rows, brokenAt: led.brokenAt, recent: rows.slice(-(opts.limit ?? 20)) }, null, 2) + "\n");
4851
+ if (!led.ok)
4852
+ process.exitCode = 1;
4853
+ }
4854
+ catch (e) {
4855
+ process.stdout.write(JSON.stringify({ ok: false, error: e.message }) + "\n");
4856
+ process.exitCode = 1;
4857
+ }
4858
+ });
4685
4859
  // v2.62.0 — MIRRAGE: live conscience for AI agents via MCP reverse-channel.
4686
4860
  // Agent calls `mneme.mirrage.scan {draft}` BEFORE shipping; per-sentence
4687
4861
  // nudges (5-level conscience ladder) + suggested edit + ship-block on