@mnemosyne_os/sdk 1.0.0 → 1.2.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 +189 -98
- package/dist/index.cjs +586 -22
- package/dist/index.d.cts +741 -36
- package/dist/index.d.ts +741 -36
- package/dist/index.js +586 -25
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
Mnemosyne OS is a sovereign, local-first AI memory runtime built on Electron.
|
|
15
15
|
It runs on your machine, stores everything locally (SQLite + vector embeddings),
|
|
16
|
-
and exposes
|
|
16
|
+
and exposes a WebSocket API for Layer 2 apps to tap into its cognitive engine.
|
|
17
17
|
|
|
18
18
|
**No cloud. No telemetry. Your data stays on your machine.**
|
|
19
19
|
|
|
@@ -25,15 +25,14 @@ and exposes an IPC/WebSocket API for Layer 2 apps to tap into its cognitive engi
|
|
|
25
25
|
|---------|---------|------|
|
|
26
26
|
| [`@mnemosyne_os/forge`](https://www.npmjs.com/package/@mnemosyne_os/forge) | `1.4.7` | CLI — scaffold, chronicles, MCP server |
|
|
27
27
|
| [`@mnemosyne_os/sync`](https://www.npmjs.com/package/@mnemosyne_os/sync) | `0.0.1` | P2P — multi-agent synchronization |
|
|
28
|
-
| **`@mnemosyne_os/sdk`** |
|
|
28
|
+
| **`@mnemosyne_os/sdk`** | **`1.1.0`** | **SDK — build Layer 2 apps** |
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
32
32
|
## Requirements
|
|
33
33
|
|
|
34
|
-
- **Mnemosyne OS Dev Edition**
|
|
35
|
-
-
|
|
36
|
-
- Node.js ≥ 18
|
|
34
|
+
- **Mnemosyne OS Dev Edition** running on your machine (SDK WS Server on port 7799)
|
|
35
|
+
- Node.js ≥ 18 (for `MnemoClient`) OR any modern browser / Electron renderer (for `MnemoClientBrowser`)
|
|
37
36
|
|
|
38
37
|
---
|
|
39
38
|
|
|
@@ -45,7 +44,18 @@ npm install @mnemosyne_os/sdk
|
|
|
45
44
|
|
|
46
45
|
---
|
|
47
46
|
|
|
48
|
-
##
|
|
47
|
+
## Two Clients — Pick the Right One
|
|
48
|
+
|
|
49
|
+
| Client | Environment | Transport |
|
|
50
|
+
|--------|------------|-----------|
|
|
51
|
+
| `MnemoClientBrowser` | React, Vite, Next.js, Electron renderer | Native `WebSocket` API |
|
|
52
|
+
| `MnemoClient` | Node.js, Electron main process | `ws` package + IPC |
|
|
53
|
+
|
|
54
|
+
> **In most Layer 2 apps (Vite/React/Electron renderer), use `MnemoClientBrowser`.**
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Quick Start — Browser / React / Vite
|
|
49
59
|
|
|
50
60
|
### 1. Create your `app.manifest.json`
|
|
51
61
|
|
|
@@ -54,14 +64,51 @@ npm install @mnemosyne_os/sdk
|
|
|
54
64
|
"id": "my-layer2-app",
|
|
55
65
|
"name": "My Layer 2 App",
|
|
56
66
|
"version": "1.0.0",
|
|
57
|
-
"mnemosyne_sdk": "^1.
|
|
67
|
+
"mnemosyne_sdk": "^1.1.0",
|
|
58
68
|
"scopes": ["vault:read:DEV", "vault:write:DEV"],
|
|
59
69
|
"vaults": ["DEV"],
|
|
60
70
|
"intents": ["INGEST", "QUERY"]
|
|
61
71
|
}
|
|
62
72
|
```
|
|
63
73
|
|
|
64
|
-
### 2. Connect
|
|
74
|
+
### 2. Connect in your React app
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { MnemoClientBrowser } from '@mnemosyne_os/sdk';
|
|
78
|
+
import type { AppManifest, Chronicle } from '@mnemosyne_os/sdk';
|
|
79
|
+
|
|
80
|
+
const MANIFEST: AppManifest = {
|
|
81
|
+
id: 'my-layer2-app', name: 'My Layer 2 App', version: '1.0.0',
|
|
82
|
+
mnemosyne_sdk: '^1.1.0',
|
|
83
|
+
scopes: ['vault:read:DEV', 'vault:write:DEV'],
|
|
84
|
+
vaults: ['DEV'],
|
|
85
|
+
intents: ['INGEST', 'QUERY'],
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// Connect and register
|
|
89
|
+
const client = await MnemoClientBrowser.connect();
|
|
90
|
+
await client.register(MANIFEST);
|
|
91
|
+
|
|
92
|
+
// Ingest content
|
|
93
|
+
await client.ingest('My note to remember', 'NOTE', 'DEV');
|
|
94
|
+
|
|
95
|
+
// Semantic query
|
|
96
|
+
const chronicles: Chronicle[] = await client.query('my search', 'DEV', 10);
|
|
97
|
+
|
|
98
|
+
// Real-time push events from the OS
|
|
99
|
+
client.onPush((event) => {
|
|
100
|
+
if (event.type === 'chronicle:new') {
|
|
101
|
+
console.log('New chronicle from:', event.sourceApp);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Graceful close
|
|
106
|
+
client.close();
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Quick Start — Node.js External App
|
|
65
112
|
|
|
66
113
|
```typescript
|
|
67
114
|
import { MnemoClient } from '@mnemosyne_os/sdk';
|
|
@@ -72,44 +119,75 @@ const client = await MnemoClient.connect({
|
|
|
72
119
|
// transport: 'auto' → WebSocket if external, IPC if embedded in Mnemosyne OS
|
|
73
120
|
});
|
|
74
121
|
|
|
75
|
-
|
|
76
|
-
await client.
|
|
77
|
-
content: 'My content to remember',
|
|
78
|
-
spineType: 'NOTE',
|
|
79
|
-
vault: 'DEV',
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// Semantic query
|
|
83
|
-
const result = await client.query('my search query', { limit: 5 });
|
|
122
|
+
await client.ingest({ content: 'My content', spineType: 'NOTE', vault: 'DEV' });
|
|
123
|
+
const result = await client.query('my search', { limit: 5 });
|
|
84
124
|
console.log(result.chronicles);
|
|
85
125
|
|
|
86
|
-
// Cross-app share (triggers a consent popup in Mnemosyne OS)
|
|
87
|
-
const share = await client.requestShare({
|
|
88
|
-
fromAppId: 'other-app-id',
|
|
89
|
-
reason: 'I need access to correlate data',
|
|
90
|
-
});
|
|
91
|
-
|
|
92
126
|
await client.disconnect();
|
|
93
127
|
```
|
|
94
128
|
|
|
95
129
|
---
|
|
96
130
|
|
|
97
|
-
##
|
|
131
|
+
## Full API — `MnemoClientBrowser`
|
|
98
132
|
|
|
99
|
-
|
|
133
|
+
### Connection
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
const client = await MnemoClientBrowser.connect(
|
|
137
|
+
'127.0.0.1', // host (default)
|
|
138
|
+
7799, // port (default)
|
|
139
|
+
15_000, // timeout ms (default)
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
await client.register(manifest); // → RegisterResult (token stored internally)
|
|
143
|
+
client.close();
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Vault
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
// Ingest
|
|
150
|
+
await client.ingest(content, spineType, vault?, metadata?);
|
|
151
|
+
|
|
152
|
+
// Query
|
|
153
|
+
const chronicles = await client.query(text, vault?, limit?);
|
|
154
|
+
```
|
|
100
155
|
|
|
101
|
-
|
|
102
|
-
|------|------|-----|
|
|
103
|
-
| `ws` | External Node.js app | JSON-RPC over `ws://127.0.0.1:7799` |
|
|
104
|
-
| `ipc` | Embedded in Mnemosyne OS renderer | `window.mnemosyne` Electron IPC bridge |
|
|
105
|
-
| `auto` | Default | Detects `window.mnemosyne` → IPC, otherwise WS |
|
|
156
|
+
### Resonances (cognitive workspaces)
|
|
106
157
|
|
|
107
158
|
```typescript
|
|
108
|
-
//
|
|
109
|
-
const
|
|
159
|
+
// List active resonances from the vault
|
|
160
|
+
const resonances = await client.resonancesList();
|
|
110
161
|
|
|
111
|
-
//
|
|
112
|
-
|
|
162
|
+
// Update current position (persisted as DECISION chronicle)
|
|
163
|
+
await client.updatePosition('resonance-id', 'Phase 52 — polish complete', 'Phase 52');
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Monorepo
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
// Git log (requires scope: 'monorepo:read', intent: 'GIT_LOG')
|
|
170
|
+
const commits = await client.gitLog(20, '30 days ago');
|
|
171
|
+
|
|
172
|
+
// Read a .md file from the OS repo
|
|
173
|
+
const content = await client.readFile('docs/ARCHITECTURE.md');
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Agents
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
// List connected Layer 2 apps (requires scope: 'agents:read', intent: 'LIST_AGENTS')
|
|
180
|
+
const agents = await client.agentsList();
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Events
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
// OS push events (chronicle:new, etc.)
|
|
187
|
+
client.onPush((event) => { /* ... */ });
|
|
188
|
+
|
|
189
|
+
// Disconnection
|
|
190
|
+
client.onDisconnect(() => { /* reconnect logic */ });
|
|
113
191
|
```
|
|
114
192
|
|
|
115
193
|
---
|
|
@@ -120,17 +198,18 @@ Every app declares its permissions in `app.manifest.json`.
|
|
|
120
198
|
**The OS refuses any operation not declared in the manifest** — Zero-Trust by design.
|
|
121
199
|
|
|
122
200
|
```typescript
|
|
123
|
-
// Available scopes
|
|
124
201
|
type MnemoScope =
|
|
125
|
-
| 'vault:read:DEV'
|
|
126
|
-
| 'vault:read:SOCIAL'
|
|
127
|
-
| 'vault:read:PERSONAL'| 'vault:write:PERSONAL'
|
|
128
|
-
| 'vault:read:FINANCE'
|
|
129
|
-
| 'vault:read:COOK'
|
|
130
|
-
| 'share:request'
|
|
131
|
-
| '
|
|
132
|
-
| '
|
|
133
|
-
| '
|
|
202
|
+
| 'vault:read:DEV' | 'vault:write:DEV'
|
|
203
|
+
| 'vault:read:SOCIAL' | 'vault:write:SOCIAL'
|
|
204
|
+
| 'vault:read:PERSONAL' | 'vault:write:PERSONAL'
|
|
205
|
+
| 'vault:read:FINANCE' | 'vault:write:FINANCE'
|
|
206
|
+
| 'vault:read:COOK' | 'vault:write:COOK'
|
|
207
|
+
| 'share:request' | 'share:grant'
|
|
208
|
+
| 'monorepo:read' // git log + readFile
|
|
209
|
+
| 'agents:read' // list connected agents
|
|
210
|
+
| 'nft:validate' // MnemoStore NFT licence validation
|
|
211
|
+
| 'neural:graph:read' // NeuralGraph access
|
|
212
|
+
| 'llm:query'; // Direct LLM queries (premium)
|
|
134
213
|
```
|
|
135
214
|
|
|
136
215
|
---
|
|
@@ -140,82 +219,94 @@ type MnemoScope =
|
|
|
140
219
|
```typescript
|
|
141
220
|
import { MNEMOSYNE_METHODS } from '@mnemosyne_os/sdk';
|
|
142
221
|
|
|
143
|
-
//
|
|
144
|
-
MNEMOSYNE_METHODS.
|
|
145
|
-
MNEMOSYNE_METHODS.
|
|
146
|
-
MNEMOSYNE_METHODS.
|
|
147
|
-
MNEMOSYNE_METHODS.
|
|
148
|
-
MNEMOSYNE_METHODS.
|
|
149
|
-
MNEMOSYNE_METHODS.
|
|
150
|
-
MNEMOSYNE_METHODS.
|
|
151
|
-
MNEMOSYNE_METHODS.
|
|
222
|
+
MNEMOSYNE_METHODS.REGISTER // 'sdk.register'
|
|
223
|
+
MNEMOSYNE_METHODS.INGEST // 'sdk.ingest'
|
|
224
|
+
MNEMOSYNE_METHODS.QUERY // 'sdk.query'
|
|
225
|
+
MNEMOSYNE_METHODS.RESONANCES_LIST // 'sdk.resonances.list'
|
|
226
|
+
MNEMOSYNE_METHODS.UPDATE_POSITION // 'sdk.resonance.updatePosition'
|
|
227
|
+
MNEMOSYNE_METHODS.GIT_LOG // 'sdk.git.log'
|
|
228
|
+
MNEMOSYNE_METHODS.READ_FILE // 'sdk.readFile'
|
|
229
|
+
MNEMOSYNE_METHODS.LIST_AGENTS // 'sdk.agents.list'
|
|
230
|
+
MNEMOSYNE_METHODS.SHARE // 'sdk.share'
|
|
231
|
+
MNEMOSYNE_METHODS.NFT_VALIDATE // 'sdk.nft.validate'
|
|
232
|
+
MNEMOSYNE_METHODS.GRAPH_QUERY // 'sdk.graph.query'
|
|
233
|
+
MNEMOSYNE_METHODS.CORRELATE // 'sdk.correlate'
|
|
234
|
+
MNEMOSYNE_METHODS.FORGET // 'sdk.forget'
|
|
152
235
|
```
|
|
153
236
|
|
|
154
237
|
---
|
|
155
238
|
|
|
156
|
-
##
|
|
239
|
+
## SpineTypes
|
|
157
240
|
|
|
158
241
|
```typescript
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
//
|
|
166
|
-
|
|
242
|
+
type SpineType =
|
|
243
|
+
| 'GIT' | 'ARCHITECTURE' | 'DECISION' | 'DEBUG' | 'FEATURE'
|
|
244
|
+
| 'REDDIT_POST' | 'LINKEDIN_POST' | 'SOCIAL_NODE'
|
|
245
|
+
| 'DOCUMENT' | 'NOTE' | 'CUSTOM'
|
|
246
|
+
| 'RESONANCE' // cognitive workspace node
|
|
247
|
+
| 'SESSION' // session context / resume snapshot
|
|
248
|
+
| 'POSITION_UPDATE' // current phase/position marker
|
|
249
|
+
| 'API' | 'DOC' | 'ERROR';
|
|
167
250
|
```
|
|
168
251
|
|
|
169
252
|
---
|
|
170
253
|
|
|
171
|
-
##
|
|
254
|
+
## Events (Push)
|
|
172
255
|
|
|
173
|
-
|
|
256
|
+
The OS pushes real-time events to all connected clients. Handle them with `onPush`:
|
|
174
257
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
258
|
+
| Event `type` | Payload | Trigger |
|
|
259
|
+
|---|---|---|
|
|
260
|
+
| `chronicle:new` | `{ vault, spineType, sourceApp, ts }` | Any client calls `ingest()` |
|
|
178
261
|
|
|
179
|
-
|
|
180
|
-
const validation = await client.validateNFTLicense('0xYourWalletAddress');
|
|
181
|
-
if (!validation.valid) {
|
|
182
|
-
alert('Please purchase a licence on MnemoStore to use this app.');
|
|
183
|
-
process.exit(1);
|
|
184
|
-
}
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
> Validation is done on-chain by Mnemosyne OS (not the SDK itself).
|
|
188
|
-
> Results are cached for 5 minutes to avoid blockchain spam.
|
|
262
|
+
More event types coming in future releases (agent:connected, tamper-alert, nft-revoked…).
|
|
189
263
|
|
|
190
264
|
---
|
|
191
265
|
|
|
192
|
-
##
|
|
193
|
-
|
|
194
|
-
### `MnemoClient.connect(options)`
|
|
195
|
-
|
|
196
|
-
| Option | Type | Default | Description |
|
|
197
|
-
|--------|------|---------|-------------|
|
|
198
|
-
| `appId` | `string` | required | Must match `manifest.id` |
|
|
199
|
-
| `manifest` | `string \| AppManifest` | required | Path to `app.manifest.json` or inline object |
|
|
200
|
-
| `transport` | `'ws' \| 'ipc' \| 'auto'` | `'auto'` | Transport mode |
|
|
201
|
-
| `wsPort` | `number` | `7799` | WebSocket port |
|
|
202
|
-
| `timeoutMs` | `number` | `30000` | RPC timeout |
|
|
203
|
-
|
|
204
|
-
### `client.ingest(payload)`
|
|
205
|
-
|
|
206
|
-
Ingests content into the vault. Content is vectorized by the Mnemosyne OS runtime.
|
|
266
|
+
## NFT Licence (MnemoStore)
|
|
207
267
|
|
|
208
|
-
|
|
268
|
+
Apps distributed on MnemoStore can gate access with NFT licences:
|
|
209
269
|
|
|
210
|
-
|
|
270
|
+
```json
|
|
271
|
+
// app.manifest.json
|
|
272
|
+
{ "scopes": ["nft:validate"] }
|
|
273
|
+
```
|
|
211
274
|
|
|
212
|
-
|
|
275
|
+
```typescript
|
|
276
|
+
// Via MnemoClient (Node.js)
|
|
277
|
+
const validation = await client.validateNFTLicense('0xYourWalletAddress');
|
|
278
|
+
if (!validation.valid) process.exit(1);
|
|
279
|
+
```
|
|
213
280
|
|
|
214
|
-
|
|
281
|
+
> Validation is done on-chain by Mnemosyne OS — cached 5 min to avoid blockchain spam.
|
|
215
282
|
|
|
216
|
-
|
|
283
|
+
---
|
|
217
284
|
|
|
218
|
-
|
|
285
|
+
## Changelog
|
|
286
|
+
|
|
287
|
+
### v2.0.0 — 2026-05-01 — Phase 59 Active Cognitive Filter
|
|
288
|
+
|
|
289
|
+
- **NEW** `bridge:read` scope — unlocks `computeResonance`, `getBridgeHistory`, `getBridgeSessions`
|
|
290
|
+
- **UPGRADE** `computeResonance` now uses **true vector embedding** (Phase 59):
|
|
291
|
+
embed input text → cosine vs. stored bridge spine vectors → real similarity scores.
|
|
292
|
+
Falls back to keyword heuristic (Phase 58) when embedding model is offline.
|
|
293
|
+
- **NEW** `docs/BRIDGE_API.md` — full Bridge API reference
|
|
294
|
+
- **NEW** `docs/MANIFEST.md` — `mnemoapp.json` manifest specification
|
|
295
|
+
- **NEW** `mnemoapp.json` replaces `app.manifest.json` (old format still accepted, deprecated)
|
|
296
|
+
- **NEW** `api_version: "2.0"` field in manifest (replaces `mnemosyne_sdk`)
|
|
297
|
+
|
|
298
|
+
### v1.1.0 — 2026-04-27
|
|
299
|
+
- **NEW** `MnemoClientBrowser` — zero-dependency browser client (native WebSocket API)
|
|
300
|
+
- **NEW** `sdk.resonances.list` — fetch real Resonance objects from the vault
|
|
301
|
+
- **NEW** `sdk.resonance.updatePosition` — persist session position as DECISION chronicle
|
|
302
|
+
- **NEW** `sdk.readFile` — read `.md` files from the OS repo (monorepo:read scope)
|
|
303
|
+
- **NEW** Push events — `onPush()` handler for real-time OS→client notifications
|
|
304
|
+
- **TYPES** Added `GitCommit`, `AgentInfo`, `RESONANCE`/`SESSION`/`POSITION_UPDATE` SpineTypes
|
|
305
|
+
- **TYPES** Added `monorepo:read`, `agents:read` scopes; `GIT_LOG`, `LIST_AGENTS` intents
|
|
306
|
+
- **FIX** `Chronicle.content` is now optional (some vault records only store vectors)
|
|
307
|
+
|
|
308
|
+
### v1.0.0 — 2026-04-24
|
|
309
|
+
- Initial release: `MnemoClient`, `sdk.ingest`, `sdk.query`, `sdk.git.log`, `sdk.agents.list`, JWT Zero-Trust
|
|
219
310
|
|
|
220
311
|
---
|
|
221
312
|
|