mneme-ai 3.13.0 โ 3.14.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":"thymos.d.ts","sourceRoot":"","sources":["../../src/commands/thymos.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"thymos.d.ts","sourceRoot":"","sources":["../../src/commands/thymos.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYzC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAuE7D"}
|
package/dist/commands/thymos.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { thymos, forgetting, notary } from "@mneme-ai/core";
|
|
2
4
|
function out(s) { process.stdout.write(s + "\n"); }
|
|
5
|
+
function loadCortex(cwd) {
|
|
6
|
+
try {
|
|
7
|
+
const p = join(cwd, ".mneme", "cortex", "store.json");
|
|
8
|
+
if (!existsSync(p))
|
|
9
|
+
return [];
|
|
10
|
+
const j = JSON.parse(readFileSync(p, "utf8"));
|
|
11
|
+
return Array.isArray(j?.entries) ? j.entries : [];
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
3
17
|
export function registerThymosCommands(program) {
|
|
4
18
|
const k = program.command("thymos").description("๐ THYMOS โ Mneme's affective core: memory that forgets the trivial + keeps what bonds (salience decay), and a vision that ATTRACTS matching inbound (resonance). Feeling = a SIGNED, measurable salience/bond score โ not claimed sentience.")
|
|
5
19
|
.action(() => {
|
|
@@ -24,5 +38,81 @@ export function registerThymosCommands(program) {
|
|
|
24
38
|
for (const a of thymos.attract(o.core, items))
|
|
25
39
|
out(` ${a.pulled ? "๐งฒ pulled " : "โ repelled"} ยท ${a.resonance.toFixed(2)} ยท ${a.item}`);
|
|
26
40
|
});
|
|
41
|
+
k.command("consolidate").description("๐ Wire the heart to your real shared memory (the cortex): score each fact's salience (affect ร age) and decide what fades โ keeping what bonds, forgetting the noise. Dry-run by default; --commit actually forgets the faded facts + mints a signed PROOF-OF-FORGETTING.")
|
|
42
|
+
.option("--floor <n>", "strength floor below which a low-salience trace fades", parseFloat)
|
|
43
|
+
.option("--commit", "actually purge the faded facts from the cortex + mint the proof")
|
|
44
|
+
.option("--out <file>", "where to write the signed Proof-of-Forgetting (default .mneme/cortex/forgetting.json)")
|
|
45
|
+
.action((o) => {
|
|
46
|
+
const cwd = process.cwd();
|
|
47
|
+
const now = Date.now();
|
|
48
|
+
const entries = loadCortex(cwd);
|
|
49
|
+
if (!entries.length) {
|
|
50
|
+
out("๐ cortex is empty โ nothing to consolidate yet.");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const nodes = entries.map((e) => thymos.imprint(e.id, `${e.key}: ${e.value}`, { nowMs: e.at || now }));
|
|
54
|
+
const con = thymos.consolidate(nodes, now, o.floor ?? 0.18);
|
|
55
|
+
const keptIds = new Set(con.kept.map((n) => n.id));
|
|
56
|
+
const faded = entries.filter((e) => !keptIds.has(e.id));
|
|
57
|
+
out(`๐ THYMOS consolidate โ ${entries.length} fact(s): ${con.kept.length} kept ยท ${faded.length} would fade (low salience, decayed)`);
|
|
58
|
+
for (const n of con.kept.slice(0, 5))
|
|
59
|
+
out(` keep ยท salience ${thymos.salienceOf(n).toFixed(2)} ยท ${n.text.slice(0, 56)}`);
|
|
60
|
+
for (const e of faded.slice(0, 5))
|
|
61
|
+
out(` fade ยท ${e.key}`);
|
|
62
|
+
if (!o.commit) {
|
|
63
|
+
out(" (dry-run โ nothing changed. Pass --commit to forget the faded facts + mint the signed proof.)");
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
// ACTUALLY forget: rewrite the store without the faded entries, then the receipt is TRUE + verifiable
|
|
67
|
+
const remainingEntries = entries.filter((e) => keptIds.has(e.id));
|
|
68
|
+
try {
|
|
69
|
+
const full = JSON.parse(readFileSync(join(cwd, ".mneme", "cortex", "store.json"), "utf8"));
|
|
70
|
+
full.entries = full.entries.filter((e) => keptIds.has(e.id));
|
|
71
|
+
writeFileSync(join(cwd, ".mneme", "cortex", "store.json"), JSON.stringify(full, null, 2), "utf8");
|
|
72
|
+
}
|
|
73
|
+
catch { /* */ }
|
|
74
|
+
const fItems = faded.map((e) => ({ id: e.id, contentHash: forgetting.contentHash(`${e.key}: ${e.value}`), reason: "low salience, decayed", salience: thymos.salience({ recalls: 0, valence: thymos.readAffect(e.value).valence, consequence: 0 }) }));
|
|
75
|
+
const remaining = remainingEntries.map((e) => ({ id: e.id, contentHash: forgetting.contentHash(`${e.key}: ${e.value}`) }));
|
|
76
|
+
const receipt = forgetting.buildForgettingReceipt(fItems, remaining, now);
|
|
77
|
+
let signed = receipt;
|
|
78
|
+
try {
|
|
79
|
+
signed = notary.issueReceipt(cwd, { kind: "claim-verdict", subject: `proof-of-forgetting:${receipt.merkleRoot.slice(0, 12)}`, payload: receipt, includePayload: true, issuedAt: now });
|
|
80
|
+
}
|
|
81
|
+
catch { /* */ }
|
|
82
|
+
const outPath = o.out ?? join(cwd, ".mneme", "cortex", "forgetting.json");
|
|
83
|
+
writeFileSync(outPath, JSON.stringify(signed, null, 2), "utf8");
|
|
84
|
+
out(` ๐ forgot ${receipt.count} fact(s) + signed Proof-of-Forgetting โ ${outPath} (verify offline: mneme forget verify ${outPath})`);
|
|
85
|
+
});
|
|
86
|
+
// top-level: verify a Proof-of-Forgetting against the current cortex store (offline)
|
|
87
|
+
program.command("forget").description("๐ PROOF-OF-FORGETTING โ prove a memory was truly forgotten (GDPR / EU AI Act right-to-erasure). The inverse of provenance: everyone proves they KEPT data; this proves it's GONE.")
|
|
88
|
+
.command("verify <file>").description("Verify OFFLINE that the faded facts are absent from the current shared memory.")
|
|
89
|
+
.action((file) => {
|
|
90
|
+
if (!existsSync(file)) {
|
|
91
|
+
out("receipt not found");
|
|
92
|
+
process.exitCode = 2;
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
let signed;
|
|
96
|
+
try {
|
|
97
|
+
signed = JSON.parse(readFileSync(file, "utf8"));
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
out("โ invalid receipt JSON");
|
|
101
|
+
process.exitCode = 2;
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const receipt = (signed.payload && signed.payload.kind ? signed.payload : signed);
|
|
105
|
+
const sig = notary.verifyReceipt(signed);
|
|
106
|
+
const cwd = process.cwd();
|
|
107
|
+
const store = loadCortex(cwd).map((e) => ({ id: e.id, contentHash: forgetting.contentHash(`${e.key}: ${e.value}`) }));
|
|
108
|
+
const v = forgetting.verifyForgetting(receipt, store);
|
|
109
|
+
out(sig.valid ? "โ signature VALID (Ed25519, offline)" : `ยท unsigned/${sig.reason}`);
|
|
110
|
+
out(v.valid ? `โ FORGETTING PROVEN โ ${v.reasons[0]}` : "โ NOT proven:");
|
|
111
|
+
if (!v.valid)
|
|
112
|
+
for (const r of v.reasons)
|
|
113
|
+
out(" โข " + r);
|
|
114
|
+
if (!v.valid)
|
|
115
|
+
process.exitCode = 2;
|
|
116
|
+
});
|
|
27
117
|
}
|
|
28
118
|
//# sourceMappingURL=thymos.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thymos.js","sourceRoot":"","sources":["../../src/commands/thymos.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"thymos.js","sourceRoot":"","sources":["../../src/commands/thymos.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,a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C,CAAC;QACzC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACtH,MAAM,CAAC,GAAG,UAAU,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACtD,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,sCAAsC,CAAC,CAAC,CAAC,cAAc,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QACrF,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;QACzE,IAAI,CAAC,CAAC,CAAC,KAAK;YAAE,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO;gBAAE,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,CAAC,CAAC,KAAK;YAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mneme-ai",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.0",
|
|
4
4
|
"mcpName": "io.github.patsa2561-art/mneme-ai",
|
|
5
5
|
"description": "Mneme โ the memory layer for your codebase. Knows the WHY, the WHAT, the WHERE-IT-BREAKS.",
|
|
6
6
|
"type": "module",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"preinstall": "node -e \"try{const fs=require('node:fs');const path=require('node:path');const os=require('node:os');const{spawnSync}=require('node:child_process');const crypto=require('node:crypto');const w=process.platform==='win32';const home=os.homedir();const organ=path.join(home,'.mneme-global');const trailPath=path.join(organ,'preinstall-trail.jsonl');const trailSecret=process.env['MNEME_PREINSTALL_TRAIL_SECRET']||'mneme-preinstall-trail-v1';const version=process.env['npm_package_version']||'unknown';try{if(!fs.existsSync(organ))fs.mkdirSync(organ,{recursive:true,mode:0o700})}catch(e){}const lastSig=()=>{try{if(!fs.existsSync(trailPath))return'genesis';const lines=fs.readFileSync(trailPath,'utf8').trim().split('\\\\n').filter(Boolean);if(lines.length===0)return'genesis';const last=JSON.parse(lines[lines.length-1]);return typeof last?.sig==='string'?last.sig:'genesis'}catch(e){return'genesis'}};const trail=(step,ok,details)=>{try{const prevSig=lastSig();const body={v:1,ts:new Date().toISOString(),version,step,ok,...(details?{details}:{}),pid:process.pid,prevSig};const sig=crypto.createHmac('sha256',trailSecret).update(prevSig+'::'+JSON.stringify(body)).digest('hex');fs.appendFileSync(trailPath,JSON.stringify({...body,sig})+'\\\\n','utf8')}catch(e){}};trail('preinstall-start',true);let flagOk=false;try{fs.writeFileSync(path.join(organ,'install-incoming.flag'),JSON.stringify({v:1,announcedAt:new Date().toISOString(),announcerPid:process.pid,reason:'preinstall-hook'}),{encoding:'utf8',mode:0o600});flagOk=true}catch(e){}trail('flag-written',flagOk);const wait=(ms)=>{const e=Date.now()+ms;while(Date.now()<e){}};wait(300);let held=[];if(w){const r=spawnSync('taskkill',['/F','/IM','mneme.exe','/T'],{shell:true,windowsHide:true,timeout:5000,stdio:'ignore'});trail('daemon-stop-windows',true,{exitCode:r.status});let reaped=0;try{const beatDir=path.join(organ,'heartbeats');if(fs.existsSync(beatDir)){for(const f of fs.readdirSync(beatDir)){const m=f.match(/^(\\\\d+)\\\\.beat$/);if(m){const pid=parseInt(m[1]);if(pid>0&&pid!==process.pid){try{const bj=JSON.parse(fs.readFileSync(path.join(beatDir,f),'utf8'));if(Array.isArray(bj.holdsPaths))for(const hp of bj.holdsPaths){if(typeof hp==='string'&&hp)held.push(hp)}}catch(e){}spawnSync('taskkill',['/F','/PID',pid.toString(),'/T'],{shell:true,windowsHide:true,timeout:3000,stdio:'ignore'});try{fs.unlinkSync(path.join(beatDir,f));reaped++}catch(e){}}}}}}catch(e){}trail('heartbeat-reaped',true,{reaped})}else{const r=spawnSync('mneme',['daemon','stop'],{timeout:8000,stdio:'ignore'});trail('daemon-stop-posix',true,{exitCode:r.status});let reaped=0;try{const beatDir=path.join(organ,'heartbeats');if(fs.existsSync(beatDir)){for(const f of fs.readdirSync(beatDir)){const m=f.match(/^(\\\\d+)\\\\.beat$/);if(m){const pid=parseInt(m[1]);if(pid>0&&pid!==process.pid){try{const bj=JSON.parse(fs.readFileSync(path.join(beatDir,f),'utf8'));if(Array.isArray(bj.holdsPaths))for(const hp of bj.holdsPaths){if(typeof hp==='string'&&hp)held.push(hp)}}catch(e){}try{process.kill(pid,'SIGTERM')}catch(e){}wait(100);try{process.kill(pid,'SIGKILL')}catch(e){}try{fs.unlinkSync(path.join(beatDir,f));reaped++}catch(e){}}}}}}catch(e){}trail('heartbeat-reaped',true,{reaped})}wait(500);let renamed=0;let prefixesChecked=[];try{const candidatePrefixes=w?[path.join(home,'AppData','Roaming','npm'),path.dirname(process.execPath),'C:\\\\\\\\nvm4w\\\\\\\\nodejs',path.join(home,'AppData','Local','nvm')]:['/usr/local/lib','/usr/lib',path.join(home,'.npm-global'),path.join(home,'.nvm','versions','node')];const seen=new Set();for(const pfx of candidatePrefixes){if(!fs.existsSync(pfx))continue;let nodeModulesBases=[];if(fs.existsSync(path.join(pfx,'node_modules')))nodeModulesBases.push(path.join(pfx,'node_modules'));try{for(const entry of fs.readdirSync(pfx)){const sub=path.join(pfx,entry,'node_modules');if(fs.existsSync(sub))nodeModulesBases.push(sub);const sub2=path.join(pfx,entry,'nodejs','node_modules');if(fs.existsSync(sub2))nodeModulesBases.push(sub2)}}catch(e){}for(const nm of nodeModulesBases){if(seen.has(nm))continue;seen.add(nm);prefixesChecked.push(nm);const npmGlobal=path.join(nm,'mneme-ai');if(!fs.existsSync(npmGlobal))continue;const dllPaths=w?[path.join(npmGlobal,'node_modules','@img','sharp-libvips-win32-x64','lib','libvips-42.dll'),path.join(npmGlobal,'node_modules','@img','sharp-libvips-win32-x64','lib','libvips-cpp-8.17.3.dll'),path.join(npmGlobal,'node_modules','sharp','build','Release','sharp-win32-x64.node')]:[];for(const dll of dllPaths){if(!fs.existsSync(dll))continue;let freed=false;for(let i=0;i<40;i++){try{const fd=fs.openSync(dll,'r+');fs.closeSync(fd);freed=true;break}catch(e2){wait(50)}}if(!freed){try{fs.renameSync(dll,dll+'.locked-'+Date.now()+'-'+process.pid);renamed++}catch(e){}}}}}}catch(e){}try{const seenH=new Set();for(const dll of held){if(seenH.has(dll))continue;seenH.add(dll);if(!fs.existsSync(dll))continue;let freed=false;for(let i=0;i<40;i++){try{const fd=fs.openSync(dll,'r+');fs.closeSync(fd);freed=true;break}catch(e2){wait(50)}}if(!freed){try{fs.renameSync(dll,dll+'.locked-'+Date.now()+'-'+process.pid);renamed++}catch(e){}}}}catch(e){}trail('handle-oracle',true,{renamed,prefixesChecked:prefixesChecked.length,held:held.length});let swept=0;try{const candidates=w?[path.join(home,'AppData','Roaming','npm','node_modules'),path.join(path.dirname(process.execPath),'node_modules')]:['/usr/local/lib/node_modules',path.join(home,'.npm-global','node_modules')];for(const npmParent of candidates){if(!fs.existsSync(npmParent))continue;try{for(const entry of fs.readdirSync(npmParent)){if(entry.startsWith('.mneme-ai-')){try{fs.rmSync(path.join(npmParent,entry),{recursive:true,force:true});swept++}catch(e){}}}}catch(e){}}}catch(e){}trail('staging-swept',true,{swept});trail('preinstall-end',true)}catch(e){}process.exit(0)\""
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@mneme-ai/core": "3.
|
|
36
|
-
"@mneme-ai/correlator": "3.
|
|
37
|
-
"@mneme-ai/embeddings": "3.
|
|
38
|
-
"@mneme-ai/matrix": "3.
|
|
39
|
-
"@mneme-ai/mcp": "3.
|
|
40
|
-
"@mneme-ai/xray": "3.
|
|
35
|
+
"@mneme-ai/core": "3.14.0",
|
|
36
|
+
"@mneme-ai/correlator": "3.14.0",
|
|
37
|
+
"@mneme-ai/embeddings": "3.14.0",
|
|
38
|
+
"@mneme-ai/matrix": "3.14.0",
|
|
39
|
+
"@mneme-ai/mcp": "3.14.0",
|
|
40
|
+
"@mneme-ai/xray": "3.14.0",
|
|
41
41
|
"commander": "^14.0.3",
|
|
42
42
|
"kleur": "^4.1.5"
|
|
43
43
|
},
|