@mnemopay/sdk 0.5.0 → 0.7.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.
- package/dist/index.d.ts +27 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +165 -26
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +7 -5
- package/dist/mcp/server.js.map +1 -1
- package/dist/rails/index.d.ts +74 -0
- package/dist/rails/index.d.ts.map +1 -0
- package/dist/rails/index.js +167 -0
- package/dist/rails/index.js.map +1 -0
- package/dist/storage/sqlite.d.ts +81 -0
- package/dist/storage/sqlite.d.ts.map +1 -0
- package/dist/storage/sqlite.js +291 -0
- package/dist/storage/sqlite.js.map +1 -0
- package/package.json +20 -4
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* SQLite Persistence Layer for MnemoPay
|
|
4
|
+
*
|
|
5
|
+
* Replaces toy JSON file persistence with production-grade SQLite.
|
|
6
|
+
* Zero-config, ACID-compliant, single-file database.
|
|
7
|
+
*
|
|
8
|
+
* Requires: npm install better-sqlite3
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* import { SQLiteStorage } from "@mnemopay/sdk/storage";
|
|
12
|
+
* const agent = MnemoPay.quick("id", { storage: new SQLiteStorage("./agent.db") });
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.JSONFileStorage = exports.SQLiteStorage = void 0;
|
|
16
|
+
// ─── SQLite Storage ─────────────────────────────────────────────────────────
|
|
17
|
+
class SQLiteStorage {
|
|
18
|
+
db;
|
|
19
|
+
/**
|
|
20
|
+
* @param dbPath — Path to SQLite database file (e.g. "./mnemopay.db" or ":memory:")
|
|
21
|
+
*/
|
|
22
|
+
constructor(dbPath) {
|
|
23
|
+
try {
|
|
24
|
+
const Database = require("better-sqlite3");
|
|
25
|
+
this.db = new Database(dbPath);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
throw new Error("better-sqlite3 not installed. Run: npm install better-sqlite3");
|
|
29
|
+
}
|
|
30
|
+
// Enable WAL mode for better concurrent read performance
|
|
31
|
+
this.db.pragma("journal_mode = WAL");
|
|
32
|
+
this.db.pragma("synchronous = NORMAL");
|
|
33
|
+
this._createTables();
|
|
34
|
+
}
|
|
35
|
+
_createTables() {
|
|
36
|
+
this.db.exec(`
|
|
37
|
+
CREATE TABLE IF NOT EXISTS agent_state (
|
|
38
|
+
agent_id TEXT PRIMARY KEY,
|
|
39
|
+
wallet REAL NOT NULL DEFAULT 0,
|
|
40
|
+
reputation REAL NOT NULL DEFAULT 0.5,
|
|
41
|
+
created_at TEXT NOT NULL,
|
|
42
|
+
fraud_guard TEXT,
|
|
43
|
+
updated_at TEXT NOT NULL
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
CREATE TABLE IF NOT EXISTS memories (
|
|
47
|
+
id TEXT PRIMARY KEY,
|
|
48
|
+
agent_id TEXT NOT NULL,
|
|
49
|
+
content TEXT NOT NULL,
|
|
50
|
+
importance REAL NOT NULL,
|
|
51
|
+
score REAL NOT NULL DEFAULT 0,
|
|
52
|
+
created_at TEXT NOT NULL,
|
|
53
|
+
last_accessed TEXT NOT NULL,
|
|
54
|
+
access_count INTEGER NOT NULL DEFAULT 0,
|
|
55
|
+
tags TEXT NOT NULL DEFAULT '[]',
|
|
56
|
+
FOREIGN KEY (agent_id) REFERENCES agent_state(agent_id)
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
CREATE TABLE IF NOT EXISTS transactions (
|
|
60
|
+
id TEXT PRIMARY KEY,
|
|
61
|
+
agent_id TEXT NOT NULL,
|
|
62
|
+
amount REAL NOT NULL,
|
|
63
|
+
reason TEXT NOT NULL,
|
|
64
|
+
status TEXT NOT NULL,
|
|
65
|
+
created_at TEXT NOT NULL,
|
|
66
|
+
completed_at TEXT,
|
|
67
|
+
platform_fee REAL,
|
|
68
|
+
net_amount REAL,
|
|
69
|
+
risk_score REAL,
|
|
70
|
+
external_id TEXT,
|
|
71
|
+
external_status TEXT,
|
|
72
|
+
counterparty_id TEXT,
|
|
73
|
+
FOREIGN KEY (agent_id) REFERENCES agent_state(agent_id)
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
CREATE TABLE IF NOT EXISTS audit_log (
|
|
77
|
+
id TEXT PRIMARY KEY,
|
|
78
|
+
agent_id TEXT NOT NULL,
|
|
79
|
+
action TEXT NOT NULL,
|
|
80
|
+
details TEXT NOT NULL DEFAULT '{}',
|
|
81
|
+
created_at TEXT NOT NULL,
|
|
82
|
+
FOREIGN KEY (agent_id) REFERENCES agent_state(agent_id)
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
CREATE INDEX IF NOT EXISTS idx_memories_agent ON memories(agent_id);
|
|
86
|
+
CREATE INDEX IF NOT EXISTS idx_transactions_agent ON transactions(agent_id);
|
|
87
|
+
CREATE INDEX IF NOT EXISTS idx_transactions_status ON transactions(status);
|
|
88
|
+
CREATE INDEX IF NOT EXISTS idx_audit_agent ON audit_log(agent_id);
|
|
89
|
+
CREATE INDEX IF NOT EXISTS idx_audit_created ON audit_log(created_at);
|
|
90
|
+
`);
|
|
91
|
+
}
|
|
92
|
+
load(agentId) {
|
|
93
|
+
const state = this.db.prepare("SELECT * FROM agent_state WHERE agent_id = ?").get(agentId);
|
|
94
|
+
if (!state)
|
|
95
|
+
return null;
|
|
96
|
+
const memories = this.db.prepare("SELECT * FROM memories WHERE agent_id = ? ORDER BY score DESC").all(agentId);
|
|
97
|
+
const transactions = this.db.prepare("SELECT * FROM transactions WHERE agent_id = ? ORDER BY created_at DESC").all(agentId);
|
|
98
|
+
const auditLog = this.db.prepare("SELECT * FROM audit_log WHERE agent_id = ? ORDER BY created_at DESC LIMIT 500").all(agentId);
|
|
99
|
+
return {
|
|
100
|
+
agentId: state.agent_id,
|
|
101
|
+
wallet: state.wallet,
|
|
102
|
+
reputation: state.reputation,
|
|
103
|
+
createdAt: state.created_at,
|
|
104
|
+
memories: memories.map((m) => ({
|
|
105
|
+
id: m.id,
|
|
106
|
+
agentId: m.agent_id,
|
|
107
|
+
content: m.content,
|
|
108
|
+
importance: m.importance,
|
|
109
|
+
score: m.score,
|
|
110
|
+
createdAt: m.created_at,
|
|
111
|
+
lastAccessed: m.last_accessed,
|
|
112
|
+
accessCount: m.access_count,
|
|
113
|
+
tags: m.tags,
|
|
114
|
+
})),
|
|
115
|
+
transactions: transactions.map((t) => ({
|
|
116
|
+
id: t.id,
|
|
117
|
+
agentId: t.agent_id,
|
|
118
|
+
amount: t.amount,
|
|
119
|
+
reason: t.reason,
|
|
120
|
+
status: t.status,
|
|
121
|
+
createdAt: t.created_at,
|
|
122
|
+
completedAt: t.completed_at,
|
|
123
|
+
platformFee: t.platform_fee,
|
|
124
|
+
netAmount: t.net_amount,
|
|
125
|
+
riskScore: t.risk_score,
|
|
126
|
+
externalId: t.external_id,
|
|
127
|
+
externalStatus: t.external_status,
|
|
128
|
+
counterpartyId: t.counterparty_id,
|
|
129
|
+
})),
|
|
130
|
+
auditLog: auditLog.map((a) => ({
|
|
131
|
+
id: a.id,
|
|
132
|
+
agentId: a.agent_id,
|
|
133
|
+
action: a.action,
|
|
134
|
+
details: a.details,
|
|
135
|
+
createdAt: a.created_at,
|
|
136
|
+
})),
|
|
137
|
+
fraudGuard: state.fraud_guard ? JSON.parse(state.fraud_guard) : undefined,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
save(state) {
|
|
141
|
+
const saveAll = this.db.transaction(() => {
|
|
142
|
+
const now = new Date().toISOString();
|
|
143
|
+
// Upsert agent state
|
|
144
|
+
this.db.prepare(`
|
|
145
|
+
INSERT INTO agent_state (agent_id, wallet, reputation, created_at, fraud_guard, updated_at)
|
|
146
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
147
|
+
ON CONFLICT(agent_id) DO UPDATE SET
|
|
148
|
+
wallet = excluded.wallet,
|
|
149
|
+
reputation = excluded.reputation,
|
|
150
|
+
fraud_guard = excluded.fraud_guard,
|
|
151
|
+
updated_at = excluded.updated_at
|
|
152
|
+
`).run(state.agentId, state.wallet, state.reputation, state.createdAt, state.fraudGuard ? JSON.stringify(state.fraudGuard) : null, now);
|
|
153
|
+
// Upsert memories
|
|
154
|
+
const upsertMem = this.db.prepare(`
|
|
155
|
+
INSERT INTO memories (id, agent_id, content, importance, score, created_at, last_accessed, access_count, tags)
|
|
156
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
157
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
158
|
+
importance = excluded.importance,
|
|
159
|
+
score = excluded.score,
|
|
160
|
+
last_accessed = excluded.last_accessed,
|
|
161
|
+
access_count = excluded.access_count
|
|
162
|
+
`);
|
|
163
|
+
for (const m of state.memories) {
|
|
164
|
+
upsertMem.run(m.id, m.agentId, m.content, m.importance, m.score, m.createdAt, m.lastAccessed, m.accessCount, m.tags);
|
|
165
|
+
}
|
|
166
|
+
// Clean deleted memories
|
|
167
|
+
if (state.memories.length > 0) {
|
|
168
|
+
const memIds = state.memories.map(m => m.id);
|
|
169
|
+
const placeholders = memIds.map(() => "?").join(",");
|
|
170
|
+
this.db.prepare(`DELETE FROM memories WHERE agent_id = ? AND id NOT IN (${placeholders})`).run(state.agentId, ...memIds);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
this.db.prepare("DELETE FROM memories WHERE agent_id = ?").run(state.agentId);
|
|
174
|
+
}
|
|
175
|
+
// Upsert transactions
|
|
176
|
+
const upsertTx = this.db.prepare(`
|
|
177
|
+
INSERT INTO transactions (id, agent_id, amount, reason, status, created_at, completed_at, platform_fee, net_amount, risk_score, external_id, external_status, counterparty_id)
|
|
178
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
179
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
180
|
+
status = excluded.status,
|
|
181
|
+
completed_at = excluded.completed_at,
|
|
182
|
+
platform_fee = excluded.platform_fee,
|
|
183
|
+
net_amount = excluded.net_amount,
|
|
184
|
+
external_status = excluded.external_status,
|
|
185
|
+
counterparty_id = excluded.counterparty_id
|
|
186
|
+
`);
|
|
187
|
+
for (const t of state.transactions) {
|
|
188
|
+
upsertTx.run(t.id, t.agentId, t.amount, t.reason, t.status, t.createdAt, t.completedAt || null, t.platformFee || null, t.netAmount || null, t.riskScore || null, t.externalId || null, t.externalStatus || null, t.counterpartyId || null);
|
|
189
|
+
}
|
|
190
|
+
// Insert new audit entries (append-only, never update)
|
|
191
|
+
const insertAudit = this.db.prepare(`
|
|
192
|
+
INSERT OR IGNORE INTO audit_log (id, agent_id, action, details, created_at)
|
|
193
|
+
VALUES (?, ?, ?, ?, ?)
|
|
194
|
+
`);
|
|
195
|
+
for (const a of state.auditLog) {
|
|
196
|
+
insertAudit.run(a.id, a.agentId, a.action, a.details, a.createdAt);
|
|
197
|
+
}
|
|
198
|
+
// Trim old audit entries (keep last 500)
|
|
199
|
+
this.db.prepare(`
|
|
200
|
+
DELETE FROM audit_log WHERE agent_id = ? AND id NOT IN (
|
|
201
|
+
SELECT id FROM audit_log WHERE agent_id = ? ORDER BY created_at DESC LIMIT 500
|
|
202
|
+
)
|
|
203
|
+
`).run(state.agentId, state.agentId);
|
|
204
|
+
});
|
|
205
|
+
saveAll();
|
|
206
|
+
}
|
|
207
|
+
close() {
|
|
208
|
+
if (this.db) {
|
|
209
|
+
this.db.close();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
exports.SQLiteStorage = SQLiteStorage;
|
|
214
|
+
// ─── JSON File Storage (existing behavior, now as a proper adapter) ─────────
|
|
215
|
+
class JSONFileStorage {
|
|
216
|
+
filePath;
|
|
217
|
+
constructor(filePath) {
|
|
218
|
+
this.filePath = filePath;
|
|
219
|
+
const path = require("path");
|
|
220
|
+
const dir = path.dirname(filePath);
|
|
221
|
+
const fs = require("fs");
|
|
222
|
+
if (!fs.existsSync(dir))
|
|
223
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
224
|
+
}
|
|
225
|
+
load(agentId) {
|
|
226
|
+
try {
|
|
227
|
+
const fs = require("fs");
|
|
228
|
+
if (!fs.existsSync(this.filePath))
|
|
229
|
+
return null;
|
|
230
|
+
const raw = JSON.parse(fs.readFileSync(this.filePath, "utf-8"));
|
|
231
|
+
return {
|
|
232
|
+
agentId: raw.agentId,
|
|
233
|
+
wallet: raw.wallet ?? 0,
|
|
234
|
+
reputation: raw.reputation ?? 0.5,
|
|
235
|
+
createdAt: raw.createdAt ?? new Date().toISOString(),
|
|
236
|
+
memories: (raw.memories ?? []).map((m) => ({
|
|
237
|
+
...m,
|
|
238
|
+
tags: typeof m.tags === "string" ? m.tags : JSON.stringify(m.tags ?? []),
|
|
239
|
+
})),
|
|
240
|
+
transactions: raw.transactions ?? [],
|
|
241
|
+
auditLog: (raw.auditLog ?? []).map((a) => ({
|
|
242
|
+
...a,
|
|
243
|
+
details: typeof a.details === "string" ? a.details : JSON.stringify(a.details ?? {}),
|
|
244
|
+
})),
|
|
245
|
+
fraudGuard: raw.fraudGuard,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
catch {
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
save(state) {
|
|
253
|
+
try {
|
|
254
|
+
const fs = require("fs");
|
|
255
|
+
const data = JSON.stringify({
|
|
256
|
+
agentId: state.agentId,
|
|
257
|
+
wallet: state.wallet,
|
|
258
|
+
reputation: state.reputation,
|
|
259
|
+
createdAt: state.createdAt,
|
|
260
|
+
memories: state.memories.map(m => ({
|
|
261
|
+
...m,
|
|
262
|
+
tags: typeof m.tags === "string" ? JSON.parse(m.tags) : m.tags,
|
|
263
|
+
})),
|
|
264
|
+
transactions: state.transactions,
|
|
265
|
+
auditLog: state.auditLog.slice(-500).map(a => ({
|
|
266
|
+
...a,
|
|
267
|
+
details: typeof a.details === "string" ? JSON.parse(a.details) : a.details,
|
|
268
|
+
})),
|
|
269
|
+
fraudGuard: state.fraudGuard,
|
|
270
|
+
savedAt: new Date().toISOString(),
|
|
271
|
+
});
|
|
272
|
+
// Atomic write: temp file then rename
|
|
273
|
+
const tmpPath = this.filePath + ".tmp";
|
|
274
|
+
fs.writeFileSync(tmpPath, data, "utf-8");
|
|
275
|
+
fs.renameSync(tmpPath, this.filePath);
|
|
276
|
+
}
|
|
277
|
+
catch {
|
|
278
|
+
// Fallback: direct write
|
|
279
|
+
try {
|
|
280
|
+
const fs = require("fs");
|
|
281
|
+
fs.writeFileSync(this.filePath, JSON.stringify(state), "utf-8");
|
|
282
|
+
}
|
|
283
|
+
catch { /* swallow in browser */ }
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
close() {
|
|
287
|
+
// No-op for file storage
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
exports.JSONFileStorage = JSONFileStorage;
|
|
291
|
+
//# sourceMappingURL=sqlite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite.js","sourceRoot":"","sources":["../../src/storage/sqlite.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAwDH,+EAA+E;AAE/E,MAAa,aAAa;IAChB,EAAE,CAAM;IAEhB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;YAC3C,IAAI,CAAC,EAAE,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;QACjC,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CACb,+DAA+D,CAChE,CAAC;QACJ,CAAC;QAED,yDAAyD;QACzD,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;QACrC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;QAE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|
{
|
|
2
2
|
"name": "@mnemopay/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Give any AI agent memory and a wallet in 5 lines. Unified SDK for Mnemosyne (cognitive memory) + AgentPay (escrow economics).",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,6 +28,14 @@
|
|
|
28
28
|
"./recall": {
|
|
29
29
|
"import": "./dist/recall/engine.js",
|
|
30
30
|
"types": "./dist/recall/engine.d.ts"
|
|
31
|
+
},
|
|
32
|
+
"./rails": {
|
|
33
|
+
"import": "./dist/rails/index.js",
|
|
34
|
+
"types": "./dist/rails/index.d.ts"
|
|
35
|
+
},
|
|
36
|
+
"./storage": {
|
|
37
|
+
"import": "./dist/storage/sqlite.js",
|
|
38
|
+
"types": "./dist/storage/sqlite.d.ts"
|
|
31
39
|
}
|
|
32
40
|
},
|
|
33
41
|
"bin": {
|
|
@@ -74,7 +82,9 @@
|
|
|
74
82
|
"@langchain/langgraph": ">=0.1.0",
|
|
75
83
|
"@langchain/openai": ">=0.1.0",
|
|
76
84
|
"openai": ">=4.0.0",
|
|
77
|
-
"zod": ">=3.22.0"
|
|
85
|
+
"zod": ">=3.22.0",
|
|
86
|
+
"stripe": ">=14.0.0",
|
|
87
|
+
"better-sqlite3": ">=11.0.0"
|
|
78
88
|
},
|
|
79
89
|
"peerDependenciesMeta": {
|
|
80
90
|
"openai": {
|
|
@@ -94,6 +104,12 @@
|
|
|
94
104
|
},
|
|
95
105
|
"zod": {
|
|
96
106
|
"optional": true
|
|
107
|
+
},
|
|
108
|
+
"stripe": {
|
|
109
|
+
"optional": true
|
|
110
|
+
},
|
|
111
|
+
"better-sqlite3": {
|
|
112
|
+
"optional": true
|
|
97
113
|
}
|
|
98
114
|
},
|
|
99
115
|
"devDependencies": {
|
|
@@ -105,7 +121,7 @@
|
|
|
105
121
|
},
|
|
106
122
|
"dependencies": {
|
|
107
123
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
108
|
-
"@types/express": "^
|
|
109
|
-
"express": "^
|
|
124
|
+
"@types/express": "^4.17.21",
|
|
125
|
+
"express": "^4.21.0"
|
|
110
126
|
}
|
|
111
127
|
}
|