@mnemopay/sdk 0.7.5 → 0.9.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/README.md +182 -211
- package/dist/cli/dashboard.d.ts +9 -0
- package/dist/cli/dashboard.d.ts.map +1 -0
- package/dist/cli/dashboard.js +78 -0
- package/dist/cli/dashboard.js.map +1 -0
- package/dist/client.d.ts +182 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +177 -0
- package/dist/client.js.map +1 -0
- package/dist/commerce.d.ts +225 -0
- package/dist/commerce.d.ts.map +1 -0
- package/dist/commerce.js +420 -0
- package/dist/commerce.js.map +1 -0
- package/dist/fraud.d.ts +75 -1
- package/dist/fraud.d.ts.map +1 -1
- package/dist/fraud.js +247 -26
- package/dist/fraud.js.map +1 -1
- package/dist/identity.d.ts +154 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +269 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +44 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +196 -37
- package/dist/index.js.map +1 -1
- package/dist/ledger.d.ts +137 -0
- package/dist/ledger.d.ts.map +1 -0
- package/dist/ledger.js +250 -0
- package/dist/ledger.js.map +1 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +298 -6
- package/dist/mcp/server.js.map +1 -1
- package/dist/network.d.ts +155 -0
- package/dist/network.d.ts.map +1 -0
- package/dist/network.js +263 -0
- package/dist/network.js.map +1 -0
- package/dist/rails/index.d.ts +2 -0
- package/dist/rails/index.d.ts.map +1 -1
- package/dist/rails/index.js +19 -4
- package/dist/rails/index.js.map +1 -1
- package/dist/rails/paystack.d.ts +157 -0
- package/dist/rails/paystack.d.ts.map +1 -0
- package/dist/rails/paystack.js +366 -0
- package/dist/rails/paystack.js.map +1 -0
- package/package.json +34 -17
package/README.md
CHANGED
|
@@ -1,230 +1,171 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MnemoPay
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Give your AI agents real superpowers.** Memory + Payments + Identity in one SDK.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## The Problem
|
|
10
|
-
|
|
11
|
-
Anthropic's built-in Session Memory and Auto Dream features are **Pro/Max subscription only**. If your team accesses Claude through:
|
|
12
|
-
|
|
13
|
-
- AWS Bedrock
|
|
14
|
-
- Google Vertex AI
|
|
15
|
-
- Anthropic API directly
|
|
16
|
-
- Foundry or any third-party host
|
|
17
|
-
|
|
18
|
-
...you get **zero native memory**. Every session starts cold. Context has to be rebuilt by hand, crammed into prompts, or managed with brittle custom code.
|
|
19
|
-
|
|
20
|
-
MnemoPay is the only MIT-licensed, self-hostable MCP server that gives those deployments persistent session memory — plus an optional micropayment wallet for agent-to-agent transactions.
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## Quickstart
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
npx @mnemopay/sdk init
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
That registers MnemoPay as an MCP server. Works with Claude Code, Cursor, Windsurf, or any MCP-compatible client. No Claude Pro required.
|
|
31
|
-
|
|
32
|
-
Or install as a package dependency:
|
|
5
|
+
Your agent remembers every interaction, handles real money, builds reputation, and trades with other agents — all with a balanced double-entry ledger that never drifts by a penny.
|
|
33
6
|
|
|
34
7
|
```bash
|
|
35
8
|
npm install @mnemopay/sdk
|
|
36
9
|
```
|
|
37
10
|
|
|
38
|
-
```
|
|
39
|
-
import
|
|
11
|
+
```ts
|
|
12
|
+
import MnemoPay from "@mnemopay/sdk";
|
|
40
13
|
|
|
41
|
-
const agent = MnemoPay.quick("agent
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const tx = await agent.charge(5.00, "Built analytics dashboard");
|
|
14
|
+
const agent = MnemoPay.quick("my-agent");
|
|
15
|
+
|
|
16
|
+
await agent.remember("User prefers monthly billing");
|
|
17
|
+
const tx = await agent.charge(25, "Monthly API access");
|
|
46
18
|
await agent.settle(tx.id);
|
|
19
|
+
// Agent now has memory, money, and reputation. Ledger balanced.
|
|
47
20
|
```
|
|
48
21
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
## Why Not the Alternatives?
|
|
52
|
-
|
|
53
|
-
| | MnemoPay | claude-mem | claude-brain | Anthropic built-in | Minolith |
|
|
54
|
-
|---|---|---|---|---|---|
|
|
55
|
-
| **License** | MIT | AGPL-3.0 | MIT | Proprietary | Paid/closed |
|
|
56
|
-
| **Enterprise-safe** | Yes | **No** (AGPL) | Yes | N/A | Vendor lock-in |
|
|
57
|
-
| **Works on Bedrock/Vertex/API** | Yes | No | No | **No (Pro/Max only)** | Unknown |
|
|
58
|
-
| **MCP — any client** | Yes | Claude Code only | Claude Code only | Claude Code only | No |
|
|
59
|
-
| **Semantic search** | Yes | No | No | Yes | Unknown |
|
|
60
|
-
| **Importance decay** | Yes | No | No | Unknown | Unknown |
|
|
61
|
-
| **Self-hostable** | Yes | Yes | Yes | No | No |
|
|
62
|
-
| **Payment rails** | Yes | No | No | No | No |
|
|
63
|
-
| **Runaway API spend risk** | No | Yes (worker daemon) | Unknown | N/A | Unknown |
|
|
64
|
-
|
|
65
|
-
**The short version:** claude-mem is AGPL, which means enterprise legal teams will reject it on sight. The Anthropic built-in solution is excellent — but it only works if your team pays for Pro or Max subscriptions. MnemoPay fills the gap for everyone else.
|
|
22
|
+
330+ tests. Production-hardened. MIT licensed.
|
|
66
23
|
|
|
67
24
|
---
|
|
68
25
|
|
|
69
|
-
##
|
|
26
|
+
## Why MnemoPay
|
|
70
27
|
|
|
71
|
-
|
|
72
|
-
|------|------------|-------------|-------------|----------|
|
|
73
|
-
| **Prototype** | `MnemoPay.quick("id")` | None | In-memory | Development, testing, demos |
|
|
74
|
-
| **Production** | `MnemoPay.create({...})` | Postgres + Redis | Durable | Deployed agents |
|
|
28
|
+
AI agents can think. They can't remember or pay. MnemoPay fixes both.
|
|
75
29
|
|
|
76
|
-
|
|
30
|
+
| Problem | Without MnemoPay | With MnemoPay |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| Memory | Every session starts cold | Agent remembers everything — decays naturally, strengthens on use |
|
|
33
|
+
| Payments | Manual API calls, no escrow | Charge → escrow → settle → refund. Real money, real rails |
|
|
34
|
+
| Identity | No agent verification | KYA (Know Your Agent) with capability tokens and permissions |
|
|
35
|
+
| Trust | No reputation system | Agent FICO score that grows with successful transactions |
|
|
36
|
+
| Accounting | Hope the numbers are right | Double-entry ledger. Every debit has a credit. Always balances to zero |
|
|
37
|
+
| Fraud | Build your own | Velocity checks, anomaly detection, geo-enhanced risk scoring |
|
|
38
|
+
| Multi-agent | Not possible | `net.transact("buyer", "seller", 25, "API access")` — both agents remember |
|
|
77
39
|
|
|
78
40
|
---
|
|
79
41
|
|
|
80
|
-
##
|
|
81
|
-
|
|
82
|
-
### Memory
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
42
|
+
## Features
|
|
43
|
+
|
|
44
|
+
### Memory (Neuroscience-backed)
|
|
45
|
+
- **Ebbinghaus forgetting curve** — memories decay over time, just like the brain
|
|
46
|
+
- **Hebbian reinforcement** — successful transactions strengthen associated memories
|
|
47
|
+
- **Consolidation** — auto-prunes weak memories, keeps what matters
|
|
48
|
+
- **Semantic recall** — find memories by relevance, not just recency
|
|
49
|
+
- **100KB per memory** — store rich context, not just strings
|
|
50
|
+
|
|
51
|
+
### Payments (Bank-grade math)
|
|
52
|
+
- **Double-entry bookkeeping** — Luca Pacioli's 1494 system, 330+ tests proving it works
|
|
53
|
+
- **Escrow flow** — charge → hold → settle → refund (same as Stripe/Square)
|
|
54
|
+
- **Platform fee** — 1.9% on settlement (configurable, volume-tiered: 1.9% → 1.5% → 1.0%)
|
|
55
|
+
- **3 payment rails** — Paystack (Africa), Stripe (global), Lightning (BTC)
|
|
56
|
+
- **Penny-precise** — stress-tested with 1,000 random transactions, fee + net = gross every time
|
|
57
|
+
|
|
58
|
+
### Identity (KYA Compliance)
|
|
59
|
+
- **Agent identity** — cryptographic keypairs, owner verification
|
|
60
|
+
- **Capability tokens** — scoped permissions (charge, settle, refund, remember)
|
|
61
|
+
- **Spend limits** — max per transaction, max total spend, counterparty whitelists
|
|
62
|
+
- **Kill switch** — revoke all tokens instantly
|
|
63
|
+
|
|
64
|
+
### Fraud Detection (Geo-enhanced)
|
|
65
|
+
- **Velocity checks** — per-minute, per-hour, per-day limits
|
|
66
|
+
- **Anomaly detection** — z-score + optional ML (Isolation Forest)
|
|
67
|
+
- **Geo-enhanced** — country tracking, rapid-hop detection, currency mismatch, timezone anomalies
|
|
68
|
+
- **Geo trust** — consistent location builds trust, dampens false positives
|
|
69
|
+
- **OFAC sanctions** — hard blocks for sanctioned countries (KP, IR, SY, CU, RU)
|
|
70
|
+
- **Behavioral fingerprinting** — detects drift from agent's normal patterns
|
|
71
|
+
|
|
72
|
+
### Multi-Agent Commerce
|
|
73
|
+
- **MnemoPayNetwork** — register agents, execute deals, shared memory context
|
|
74
|
+
- **One method** — `net.transact(buyer, seller, amount, reason)` handles everything
|
|
75
|
+
- **Both remember** — buyer and seller each store the deal in their memory
|
|
76
|
+
- **Supply chains** — 10-step agent chains, 100-agent marketplaces, all tested
|
|
108
77
|
|
|
109
78
|
---
|
|
110
79
|
|
|
111
|
-
##
|
|
80
|
+
## Payment Rails
|
|
81
|
+
|
|
82
|
+
MnemoPay supports real money movement through pluggable payment rails:
|
|
112
83
|
|
|
113
|
-
|
|
84
|
+
```ts
|
|
85
|
+
import { PaystackRail, StripeRail, LightningRail } from "@mnemopay/sdk";
|
|
114
86
|
|
|
115
|
-
|
|
87
|
+
// Africa (NGN, GHS, ZAR, KES)
|
|
88
|
+
const paystack = new PaystackRail(process.env.PAYSTACK_SECRET_KEY!);
|
|
116
89
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
import { MnemoPay } from "@mnemopay/sdk";
|
|
120
|
-
import { AnthropicMiddleware } from "@mnemopay/sdk/middleware/anthropic";
|
|
90
|
+
// Global (USD, EUR, GBP — cards)
|
|
91
|
+
const stripe = new StripeRail(process.env.STRIPE_SECRET_KEY!);
|
|
121
92
|
|
|
122
|
-
|
|
123
|
-
const
|
|
93
|
+
// Crypto (BTC via Lightning Network)
|
|
94
|
+
const lightning = new LightningRail(LND_URL, MACAROON);
|
|
124
95
|
|
|
125
|
-
//
|
|
126
|
-
const
|
|
127
|
-
model: "claude-opus-4-5",
|
|
128
|
-
max_tokens: 1024,
|
|
129
|
-
messages: [{ role: "user", content: "What do you remember?" }],
|
|
130
|
-
});
|
|
96
|
+
// Plug into any agent
|
|
97
|
+
const agent = MnemoPay.quick("my-agent", { paymentRail: paystack });
|
|
131
98
|
```
|
|
132
99
|
|
|
133
|
-
###
|
|
100
|
+
### Paystack Rail (Built for Africa)
|
|
101
|
+
- Initialize → checkout → verify flow
|
|
102
|
+
- Charge saved cards (authorization codes)
|
|
103
|
+
- Bank transfers / payouts
|
|
104
|
+
- Webhook HMAC-SHA512 verification
|
|
105
|
+
- Bank account resolution
|
|
106
|
+
- 23 Nigerian banks pre-mapped
|
|
134
107
|
|
|
135
|
-
|
|
136
|
-
import OpenAI from "openai";
|
|
137
|
-
import { MnemoPay } from "@mnemopay/sdk";
|
|
138
|
-
import { MnemoPayMiddleware } from "@mnemopay/sdk/middleware/openai";
|
|
108
|
+
### Fee Structure
|
|
139
109
|
|
|
140
|
-
|
|
141
|
-
|
|
110
|
+
| Tier | Monthly Volume | Platform Fee |
|
|
111
|
+
|---|---|---|
|
|
112
|
+
| Standard | < $10,000 | 1.9% |
|
|
113
|
+
| Growth | $10,000 - $100,000 | 1.5% |
|
|
114
|
+
| Scale | $100,000+ | 1.0% |
|
|
142
115
|
|
|
143
|
-
|
|
144
|
-
model: "gpt-4o",
|
|
145
|
-
messages: [{ role: "user", content: "What do you remember?" }],
|
|
146
|
-
});
|
|
147
|
-
```
|
|
116
|
+
Fees are automatically tiered based on cumulative settled volume per agent.
|
|
148
117
|
|
|
149
118
|
---
|
|
150
119
|
|
|
151
|
-
##
|
|
120
|
+
## MCP Server
|
|
152
121
|
|
|
153
|
-
|
|
154
|
-
import { createReactAgent } from "@langchain/langgraph/prebuilt";
|
|
155
|
-
import { MnemoPay } from "@mnemopay/sdk";
|
|
156
|
-
import { mnemoTools, agentPayTools } from "@mnemopay/sdk/langgraph";
|
|
122
|
+
MnemoPay runs as an MCP server, giving Claude and other AI assistants direct access:
|
|
157
123
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
});
|
|
124
|
+
```bash
|
|
125
|
+
npx @mnemopay/sdk init
|
|
126
|
+
# or
|
|
127
|
+
claude mcp add mnemopay -s user -- npx -y @mnemopay/sdk
|
|
163
128
|
```
|
|
164
129
|
|
|
165
|
-
|
|
130
|
+
Available tools: `charge`, `settle`, `refund`, `remember`, `recall`, `balance`, `history`, `profile`, `reputation`, `fraud_stats`, `dispute`, `reinforce`, `consolidate`, `forget`, `logs`.
|
|
166
131
|
|
|
167
132
|
---
|
|
168
133
|
|
|
169
|
-
##
|
|
134
|
+
## Middleware
|
|
170
135
|
|
|
171
|
-
|
|
136
|
+
Drop MnemoPay into your existing AI stack:
|
|
172
137
|
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
Payment settles
|
|
177
|
-
↓
|
|
178
|
-
Memories accessed in the last hour get +0.05 importance
|
|
179
|
-
↓
|
|
180
|
-
Agent makes better decisions next time
|
|
181
|
-
```
|
|
138
|
+
```ts
|
|
139
|
+
// OpenAI
|
|
140
|
+
import { mnemoPayMiddleware } from "@mnemopay/sdk/middleware/openai";
|
|
182
141
|
|
|
183
|
-
|
|
142
|
+
// Anthropic
|
|
143
|
+
import { mnemoPayMiddleware } from "@mnemopay/sdk/middleware/anthropic";
|
|
184
144
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
```typescript
|
|
188
|
-
const manager = MnemoPay.quick("manager");
|
|
189
|
-
const coder = MnemoPay.quick("coder");
|
|
190
|
-
|
|
191
|
-
await manager.remember("coder delivered fast but had 2 bugs last time");
|
|
192
|
-
const memories = await manager.recall(); // Informs hiring decision
|
|
193
|
-
|
|
194
|
-
const job = await manager.charge(5.00, "Code sorting algorithm");
|
|
195
|
-
await manager.settle(job.id);
|
|
196
|
-
await manager.remember("coder delivered clean code this time");
|
|
197
|
-
// Next round: manager's recall reflects the updated track record
|
|
145
|
+
// LangGraph
|
|
146
|
+
import { mnemoPayTools } from "@mnemopay/sdk/langgraph";
|
|
198
147
|
```
|
|
199
148
|
|
|
200
149
|
---
|
|
201
150
|
|
|
202
|
-
##
|
|
151
|
+
## Multi-Agent Example
|
|
203
152
|
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
```
|
|
153
|
+
```ts
|
|
154
|
+
import { MnemoPayNetwork } from "@mnemopay/sdk";
|
|
207
155
|
|
|
208
|
-
|
|
209
|
-
const agent = MnemoPay.create({
|
|
210
|
-
agentId: "prod-agent",
|
|
211
|
-
mnemoUrl: "http://localhost:8100",
|
|
212
|
-
agentpayUrl: "http://localhost:3100",
|
|
213
|
-
debug: true,
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
// Same API — backed by Hopfield networks, Bayesian trust, AIS fraud detection
|
|
217
|
-
await agent.remember("Production memory");
|
|
218
|
-
const tx = await agent.charge(10.00, "Premium service");
|
|
219
|
-
await agent.settle(tx.id);
|
|
220
|
-
```
|
|
156
|
+
const net = new MnemoPayNetwork({ fraud: { platformFeeRate: 0.019 } });
|
|
221
157
|
|
|
222
|
-
|
|
158
|
+
// Register agents
|
|
159
|
+
net.register("buyer-bot", "owner-1", "dev@company.com");
|
|
160
|
+
net.register("seller-bot", "owner-2", "dev@company.com");
|
|
223
161
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
162
|
+
// Execute a deal — both agents remember, seller gets paid, ledger balances
|
|
163
|
+
const deal = await net.transact("buyer-bot", "seller-bot", 25, "API access for 1 month");
|
|
164
|
+
|
|
165
|
+
console.log(deal.netAmount); // 24.52 (after 1.9% fee)
|
|
166
|
+
console.log(deal.platformFee); // 0.48
|
|
167
|
+
console.log(deal.buyerMemoryId); // buyer remembers the purchase
|
|
168
|
+
console.log(deal.sellerMemoryId);// seller remembers the sale
|
|
228
169
|
```
|
|
229
170
|
|
|
230
171
|
---
|
|
@@ -232,64 +173,94 @@ npm install @langchain/langgraph @langchain/core @langchain/openai # For LangGr
|
|
|
232
173
|
## Architecture
|
|
233
174
|
|
|
234
175
|
```
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
176
|
+
┌─────────────────────────────────────────────────┐
|
|
177
|
+
│ MnemoPay SDK │
|
|
178
|
+
├──────────┬──────────┬───────────┬───────────────┤
|
|
179
|
+
│ Memory │ Payments │ Identity │ Fraud Guard │
|
|
180
|
+
│ │ │ │ │
|
|
181
|
+
│ remember │ charge │ KYA │ velocity │
|
|
182
|
+
│ recall │ settle │ tokens │ anomaly │
|
|
183
|
+
│ reinforce│ refund │ perms │ geo-enhanced │
|
|
184
|
+
│ forget │ dispute │ killswitch│ ML (optional) │
|
|
185
|
+
├──────────┴──────────┴───────────┴───────────────┤
|
|
186
|
+
│ Double-Entry Ledger │
|
|
187
|
+
│ debit + credit = always zero │
|
|
188
|
+
├─────────────────────────────────────────────────┤
|
|
189
|
+
│ Payment Rails │
|
|
190
|
+
│ Paystack │ Stripe │ Lightning │
|
|
191
|
+
└─────────────────────────────────────────────────┘
|
|
243
192
|
```
|
|
244
193
|
|
|
245
|
-
- **Mnemosyne**: Hopfield associative recall, FSRS spaced repetition, Merkle integrity, Dream consolidation
|
|
246
|
-
- **AgentPay**: Bayesian trust (Beta distributions), AIS fraud detection, behavioral economics, escrow
|
|
247
|
-
|
|
248
194
|
---
|
|
249
195
|
|
|
250
|
-
##
|
|
196
|
+
## Persistence
|
|
251
197
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
| Cursor | Stable | Same MCP config |
|
|
256
|
-
| Windsurf | Stable | Same MCP config |
|
|
257
|
-
| AWS Bedrock | Stable | Use `AnthropicMiddleware` with Bedrock client |
|
|
258
|
-
| Google Vertex AI | Stable | Use `AnthropicMiddleware` with Vertex client |
|
|
259
|
-
| Anthropic API | Stable | Drop-in with `AnthropicMiddleware` |
|
|
260
|
-
| LangGraph | Stable | 6 native tools with Zod schemas |
|
|
261
|
-
| OpenAI-compatible | Stable | `MnemoPayMiddleware` wrapper |
|
|
262
|
-
| Mastra | In progress | Native MCP — no plugin needed |
|
|
198
|
+
```ts
|
|
199
|
+
// File-based (default)
|
|
200
|
+
const agent = MnemoPay.quick("my-agent", { persistDir: "./data" });
|
|
263
201
|
|
|
264
|
-
|
|
202
|
+
// SQLite (production)
|
|
203
|
+
import { SQLiteStorage } from "@mnemopay/sdk/storage";
|
|
204
|
+
const storage = new SQLiteStorage("./mnemopay.db");
|
|
265
205
|
|
|
266
|
-
|
|
206
|
+
// Everything persists: memories, transactions, identity, fraud state, geo profiles
|
|
207
|
+
```
|
|
267
208
|
|
|
268
|
-
|
|
209
|
+
---
|
|
269
210
|
|
|
270
|
-
|
|
211
|
+
## API Reference
|
|
271
212
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
|
275
|
-
|
|
276
|
-
|
|
|
277
|
-
|
|
|
213
|
+
### Core Methods
|
|
214
|
+
|
|
215
|
+
| Method | Description |
|
|
216
|
+
|---|---|
|
|
217
|
+
| `agent.remember(content, opts?)` | Store a memory with importance scoring |
|
|
218
|
+
| `agent.recall(limit?, query?)` | Retrieve memories by relevance |
|
|
219
|
+
| `agent.charge(amount, reason)` | Create an escrow hold |
|
|
220
|
+
| `agent.settle(txId, counterpartyId?)` | Release escrow, apply fee, complete payment |
|
|
221
|
+
| `agent.refund(txId)` | Reverse a completed or pending transaction |
|
|
222
|
+
| `agent.dispute(txId, reason)` | File a dispute against a settled transaction |
|
|
223
|
+
| `agent.balance()` | Get wallet balance and reputation |
|
|
224
|
+
| `agent.verifyLedger()` | Confirm double-entry ledger balances to zero |
|
|
225
|
+
| `agent.history(limit?)` | Get transaction history |
|
|
226
|
+
| `agent.consolidate()` | Prune stale memories |
|
|
227
|
+
|
|
228
|
+
### Network Methods
|
|
278
229
|
|
|
279
|
-
|
|
230
|
+
| Method | Description |
|
|
231
|
+
|---|---|
|
|
232
|
+
| `net.register(agentId, ownerId, email)` | Register an agent on the network |
|
|
233
|
+
| `net.transact(buyer, seller, amount, reason)` | Full deal: charge → settle → memory → identity |
|
|
234
|
+
| `net.refundDeal(dealId)` | Reverse a deal, both agents remember the refund |
|
|
235
|
+
| `net.stats()` | Network-wide statistics |
|
|
236
|
+
| `net.dealsBetween(agentA, agentB)` | Get deal history between two agents |
|
|
280
237
|
|
|
281
238
|
---
|
|
282
239
|
|
|
283
|
-
##
|
|
240
|
+
## Testing
|
|
284
241
|
|
|
285
242
|
```bash
|
|
286
|
-
npm test
|
|
243
|
+
npm test # Run all 330+ tests
|
|
244
|
+
npm run lint # Type check
|
|
287
245
|
```
|
|
288
246
|
|
|
247
|
+
Test coverage:
|
|
248
|
+
- `core.test.ts` — 67 tests (memory, payments, lifecycle)
|
|
249
|
+
- `fraud.test.ts` — 43 tests (velocity, anomaly, fees, disputes)
|
|
250
|
+
- `geo-fraud.test.ts` — 20 tests (geo signals, trust, sanctions)
|
|
251
|
+
- `identity.test.ts` — 44 tests (KYA, tokens, permissions)
|
|
252
|
+
- `ledger.test.ts` — 21 tests (double-entry, reconciliation)
|
|
253
|
+
- `network.test.ts` — 22 tests (multi-agent, deals, supply chains)
|
|
254
|
+
- `paystack.test.ts` — 46 tests (rail, webhooks, transfers)
|
|
255
|
+
- `stress.test.ts` — 32 tests (1000-cycle precision, parallel ops)
|
|
256
|
+
- `recall.test.ts` — 35 tests (semantic search, decay, reinforcement)
|
|
257
|
+
|
|
289
258
|
---
|
|
290
259
|
|
|
291
260
|
## License
|
|
292
261
|
|
|
293
|
-
|
|
262
|
+
MIT
|
|
263
|
+
|
|
264
|
+
---
|
|
294
265
|
|
|
295
|
-
Built by [
|
|
266
|
+
Built by [Jerry Omiagbo](https://github.com/mnemopay)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/cli/dashboard.ts"],"names":[],"mappings":";AACA;;;;;GAKG"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* npx @mnemopay/sdk dashboard
|
|
5
|
+
*
|
|
6
|
+
* Opens the MnemoPay dashboard in your default browser.
|
|
7
|
+
* Manage agents, view transactions, update billing, and monitor fraud.
|
|
8
|
+
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
const child_process_1 = require("child_process");
|
|
14
|
+
const os_1 = __importDefault(require("os"));
|
|
15
|
+
const DASHBOARD_URL = "https://getbizsuite.com/mnemopay/dashboard.html";
|
|
16
|
+
const PRICING_URL = "https://getbizsuite.com/mnemopay/#pricing";
|
|
17
|
+
const PRO_URL = "https://buy.stripe.com/00w9AMe27c9pgT6gxtbo409";
|
|
18
|
+
const ENTERPRISE_URL = "https://buy.stripe.com/9B63co8HNehxcCQ5SPbo40a";
|
|
19
|
+
function openBrowser(url) {
|
|
20
|
+
const platform = os_1.default.platform();
|
|
21
|
+
let cmd;
|
|
22
|
+
if (platform === "win32")
|
|
23
|
+
cmd = `start "" "${url}"`;
|
|
24
|
+
else if (platform === "darwin")
|
|
25
|
+
cmd = `open "${url}"`;
|
|
26
|
+
else
|
|
27
|
+
cmd = `xdg-open "${url}"`;
|
|
28
|
+
(0, child_process_1.exec)(cmd, (err) => {
|
|
29
|
+
if (err) {
|
|
30
|
+
console.log(`\n Open this URL in your browser:\n ${url}\n`);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function main() {
|
|
35
|
+
const arg = process.argv[2];
|
|
36
|
+
console.log("\n MnemoPay v0.8.0\n");
|
|
37
|
+
if (arg === "subscribe" || arg === "pro") {
|
|
38
|
+
console.log(" Opening Stripe Checkout for MnemoPay Pro ($49/mo)...\n");
|
|
39
|
+
openBrowser(PRO_URL);
|
|
40
|
+
console.log(" Pro includes:");
|
|
41
|
+
console.log(" - File + SQLite persistence");
|
|
42
|
+
console.log(" - Transaction analytics dashboard");
|
|
43
|
+
console.log(" - Webhook notifications");
|
|
44
|
+
console.log(" - Geo trust profiles");
|
|
45
|
+
console.log(" - Priority email support");
|
|
46
|
+
console.log(" - 1.5% platform fee (vs 1.9% on free)\n");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (arg === "enterprise") {
|
|
50
|
+
console.log(" Opening Stripe Checkout for MnemoPay Enterprise ($299/mo)...\n");
|
|
51
|
+
openBrowser(ENTERPRISE_URL);
|
|
52
|
+
console.log(" Enterprise includes:");
|
|
53
|
+
console.log(" - ML fraud detection (Isolation Forest)");
|
|
54
|
+
console.log(" - Custom payment rail integration");
|
|
55
|
+
console.log(" - SLA guarantee");
|
|
56
|
+
console.log(" - Dedicated support + SSO");
|
|
57
|
+
console.log(" - 1.0% platform fee\n");
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (arg === "pricing") {
|
|
61
|
+
console.log(" Opening pricing page...\n");
|
|
62
|
+
openBrowser(PRICING_URL);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
// Default: open dashboard
|
|
66
|
+
console.log(" Opening dashboard...\n");
|
|
67
|
+
openBrowser(DASHBOARD_URL);
|
|
68
|
+
console.log(" Commands:");
|
|
69
|
+
console.log(" npx @mnemopay/sdk dashboard Open dashboard");
|
|
70
|
+
console.log(" npx @mnemopay/sdk dashboard subscribe Subscribe to Pro ($49/mo)");
|
|
71
|
+
console.log(" npx @mnemopay/sdk dashboard enterprise Subscribe to Enterprise ($299/mo)");
|
|
72
|
+
console.log(" npx @mnemopay/sdk dashboard pricing View pricing\n");
|
|
73
|
+
console.log(" Current Plan: Starter (Free)");
|
|
74
|
+
console.log(" Platform Fee: 1.9% per settled transaction");
|
|
75
|
+
console.log(" Upgrade to Pro for 1.5% fee + persistence + analytics\n");
|
|
76
|
+
}
|
|
77
|
+
main();
|
|
78
|
+
//# sourceMappingURL=dashboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/cli/dashboard.ts"],"names":[],"mappings":";;AACA;;;;;GAKG;;;;;AAEH,iDAAqC;AACrC,4CAAoB;AAEpB,MAAM,aAAa,GAAG,iDAAiD,CAAC;AACxE,MAAM,WAAW,GAAG,2CAA2C,CAAC;AAChE,MAAM,OAAO,GAAG,gDAAgD,CAAC;AACjE,MAAM,cAAc,GAAG,gDAAgD,CAAC;AAExE,SAAS,WAAW,CAAC,GAAW;IAC9B,MAAM,QAAQ,GAAG,YAAE,CAAC,QAAQ,EAAE,CAAC;IAC/B,IAAI,GAAW,CAAC;IAEhB,IAAI,QAAQ,KAAK,OAAO;QAAE,GAAG,GAAG,aAAa,GAAG,GAAG,CAAC;SAC/C,IAAI,QAAQ,KAAK,QAAQ;QAAE,GAAG,GAAG,SAAS,GAAG,GAAG,CAAC;;Q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