@mysten-incubation/memwal 0.0.1-dev.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.
Files changed (44) hide show
  1. package/README.md +59 -0
  2. package/dist/account-entry.d.ts +14 -0
  3. package/dist/account-entry.d.ts.map +1 -0
  4. package/dist/account-entry.js +14 -0
  5. package/dist/account-entry.js.map +1 -0
  6. package/dist/account.d.ts +87 -0
  7. package/dist/account.d.ts.map +1 -0
  8. package/dist/account.js +273 -0
  9. package/dist/account.js.map +1 -0
  10. package/dist/ai/index.d.ts +3 -0
  11. package/dist/ai/index.d.ts.map +1 -0
  12. package/dist/ai/index.js +2 -0
  13. package/dist/ai/index.js.map +1 -0
  14. package/dist/ai/middleware.d.ts +55 -0
  15. package/dist/ai/middleware.d.ts.map +1 -0
  16. package/dist/ai/middleware.js +145 -0
  17. package/dist/ai/middleware.js.map +1 -0
  18. package/dist/core.d.ts.map +1 -0
  19. package/dist/core.js.map +1 -0
  20. package/dist/index.d.ts +16 -0
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/index.js +17 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/manual-entry.d.ts +12 -0
  25. package/dist/manual-entry.d.ts.map +1 -0
  26. package/dist/manual-entry.js +11 -0
  27. package/dist/manual-entry.js.map +1 -0
  28. package/dist/manual.d.ts +97 -0
  29. package/dist/manual.d.ts.map +1 -0
  30. package/dist/manual.js +498 -0
  31. package/dist/manual.js.map +1 -0
  32. package/dist/memwal.d.ts +174 -0
  33. package/dist/memwal.d.ts.map +1 -0
  34. package/dist/memwal.js +283 -0
  35. package/dist/memwal.js.map +1 -0
  36. package/dist/types.d.ts +237 -0
  37. package/dist/types.d.ts.map +1 -0
  38. package/dist/types.js +8 -0
  39. package/dist/types.js.map +1 -0
  40. package/dist/utils.d.ts +38 -0
  41. package/dist/utils.d.ts.map +1 -0
  42. package/dist/utils.js +84 -0
  43. package/dist/utils.js.map +1 -0
  44. package/package.json +88 -0
@@ -0,0 +1,174 @@
1
+ /**
2
+ * memwal — SDK Client
3
+ *
4
+ * Ed25519 delegate key based client that communicates with the MemWal
5
+ * Rust server (TEE). All data processing (encryption, embedding, Walrus)
6
+ * happens server-side — the SDK just signs requests and sends text.
7
+ *
8
+ * The SDK only needs a single Ed25519 private key (the "delegate key").
9
+ * The server derives the owner address from the public key via onchain
10
+ * lookup in MemWalAccount.delegate_keys.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * import { MemWal } from "@mysten-incubation/memwal"
15
+ *
16
+ * const memwal = MemWal.create({
17
+ * key: process.env.MEMWAL_PRIVATE_KEY, // Ed25519 private key (hex)
18
+ * accountId: process.env.MEMWAL_ACCOUNT_ID, // MemWalAccount object ID
19
+ * })
20
+ *
21
+ * // Remember — server: verify → embed → encrypt → Walrus → store
22
+ * await memwal.remember("I'm allergic to peanuts")
23
+ *
24
+ * // Recall — server: verify → embed query → search → download → decrypt
25
+ * const result = await memwal.recall("food allergies")
26
+ * console.log(result.results[0].text) // "I'm allergic to peanuts"
27
+ * ```
28
+ */
29
+ import type { MemWalConfig, RememberResult, RecallResult, EmbedResult, AnalyzeResult, HealthResult, RememberManualOptions, RememberManualResult, RecallManualOptions, RecallManualResult, RestoreResult } from "./types.js";
30
+ export declare class MemWal {
31
+ private privateKey;
32
+ private publicKey;
33
+ private serverUrl;
34
+ private namespace;
35
+ private accountId;
36
+ private constructor();
37
+ /**
38
+ * Create a new MemWal client instance.
39
+ *
40
+ * @param config.key - Ed25519 private key (hex string) — the delegate key
41
+ * @param config.serverUrl - Server URL (default: http://localhost:8000)
42
+ */
43
+ static create(config: MemWalConfig): MemWal;
44
+ /**
45
+ * Remember something — server handles: verify → embed → encrypt → Walrus upload → store
46
+ *
47
+ * @param text - The text to remember
48
+ * @returns RememberResult with id, blob_id, owner
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * const result = await memwal.remember("I'm allergic to peanuts")
53
+ * console.log(result.blob_id) // "TY8mW0yr..."
54
+ * ```
55
+ */
56
+ remember(text: string, namespace?: string): Promise<RememberResult>;
57
+ /**
58
+ * Recall memories similar to a query — server handles:
59
+ * verify → embed query → search → Walrus download → decrypt → return plaintext
60
+ *
61
+ * @param query - Search query
62
+ * @param limit - Max number of results (default: 10)
63
+ * @returns RecallResult with decrypted text results
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * const result = await memwal.recall("food allergies")
68
+ * for (const memory of result.results) {
69
+ * console.log(memory.text, memory.distance)
70
+ * }
71
+ * ```
72
+ */
73
+ recall(query: string, limit?: number, namespace?: string): Promise<RecallResult>;
74
+ /**
75
+ * Remember (manual mode) — user handles SEAL encrypt, embedding,
76
+ * and Walrus upload externally. Server only stores the vector ↔ blobId mapping.
77
+ *
78
+ * @param opts.blobId - Walrus blob ID (user already uploaded encrypted data)
79
+ * @param opts.vector - Embedding vector (user already generated, e.g. 1536-dim)
80
+ * @returns RememberManualResult with id, blob_id, owner
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * // 1. User encrypts + uploads + embeds on their own
85
+ * const blobId = await myWalrusUpload(sealEncryptedData)
86
+ * const vector = await myEmbeddingModel.embed(text)
87
+ *
88
+ * // 2. Register vector mapping with server
89
+ * const result = await memwal.rememberManual({ blobId, vector })
90
+ * ```
91
+ */
92
+ rememberManual(opts: RememberManualOptions): Promise<RememberManualResult>;
93
+ /**
94
+ * Recall (manual mode) — user provides a pre-computed query vector.
95
+ * Server returns matching blobIds + distances.
96
+ * User then downloads from Walrus + SEAL decrypts on their own.
97
+ *
98
+ * @param opts.vector - Pre-computed query embedding vector
99
+ * @param opts.limit - Max results (default: 10)
100
+ * @returns RecallManualResult with blob_id + distance pairs (no decrypted text)
101
+ *
102
+ * @example
103
+ * ```typescript
104
+ * // 1. User generates query embedding
105
+ * const queryVector = await myEmbeddingModel.embed("food allergies")
106
+ *
107
+ * // 2. Search for similar vectors
108
+ * const hits = await memwal.recallManual({ vector: queryVector })
109
+ *
110
+ * // 3. User downloads + decrypts each result
111
+ * for (const hit of hits.results) {
112
+ * const encrypted = await walrus.download(hit.blob_id)
113
+ * const plaintext = await seal.decrypt(encrypted)
114
+ * console.log(plaintext, hit.distance)
115
+ * }
116
+ * ```
117
+ */
118
+ recallManual(opts: RecallManualOptions): Promise<RecallManualResult>;
119
+ /**
120
+ * Generate an embedding vector for text (no storage).
121
+ *
122
+ * @param text - Text to embed
123
+ * @returns EmbedResult with vector
124
+ */
125
+ embed(text: string): Promise<EmbedResult>;
126
+ /**
127
+ * Analyze conversation text — server uses LLM to extract facts, then
128
+ * stores each one (embed → encrypt → Walrus → store).
129
+ *
130
+ * @param text - Conversation text to analyze
131
+ * @returns AnalyzeResult with extracted and stored facts
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * const result = await memwal.analyze("I love coffee and live in Tokyo")
136
+ * console.log(result.facts) // ["User loves coffee", "User lives in Tokyo"]
137
+ * ```
138
+ */
139
+ analyze(text: string, namespace?: string): Promise<AnalyzeResult>;
140
+ /**
141
+ * Restore a namespace — server downloads all blobs from Walrus,
142
+ * decrypts with delegate key, re-embeds, and re-indexes.
143
+ *
144
+ * @param namespace - Namespace to restore
145
+ * @returns RestoreResult with count of restored entries
146
+ *
147
+ * @example
148
+ * ```typescript
149
+ * const result = await memwal.restore("my-app")
150
+ * console.log(`Restored ${result.restored} memories`)
151
+ * ```
152
+ */
153
+ restore(namespace: string, limit?: number): Promise<RestoreResult>;
154
+ /**
155
+ * Check server health.
156
+ */
157
+ health(): Promise<HealthResult>;
158
+ /**
159
+ * Get the public key (hex string).
160
+ */
161
+ getPublicKeyHex(): Promise<string>;
162
+ private getPublicKey;
163
+ /**
164
+ * Make a signed request to the server.
165
+ *
166
+ * Signature format: "{timestamp}.{method}.{path}.{body_sha256}"
167
+ * Headers: x-public-key, x-signature, x-timestamp
168
+ *
169
+ * The server uses x-public-key to look up the owner via onchain
170
+ * MemWalAccount.delegate_keys — no need to send owner in the body.
171
+ */
172
+ private signedRequest;
173
+ }
174
+ //# sourceMappingUR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SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAOvE;;;;;;;;;;;;OAYG;IACG,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IAO5E;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;IAQrC;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;YAS1B,YAAY;IAQ1B;;;;;;;;OAQG;YACW,aAAa;CAyC9B"}
package/dist/memwal.js ADDED
@@ -0,0 +1,283 @@
1
+ /**
2
+ * memwal — SDK Client
3
+ *
4
+ * Ed25519 delegate key based client that communicates with the MemWal
5
+ * Rust server (TEE). All data processing (encryption, embedding, Walrus)
6
+ * happens server-side — the SDK just signs requests and sends text.
7
+ *
8
+ * The SDK only needs a single Ed25519 private key (the "delegate key").
9
+ * The server derives the owner address from the public key via onchain
10
+ * lookup in MemWalAccount.delegate_keys.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * import { MemWal } from "@mysten-incubation/memwal"
15
+ *
16
+ * const memwal = MemWal.create({
17
+ * key: process.env.MEMWAL_PRIVATE_KEY, // Ed25519 private key (hex)
18
+ * accountId: process.env.MEMWAL_ACCOUNT_ID, // MemWalAccount object ID
19
+ * })
20
+ *
21
+ * // Remember — server: verify → embed → encrypt → Walrus → store
22
+ * await memwal.remember("I'm allergic to peanuts")
23
+ *
24
+ * // Recall — server: verify → embed query → search → download → decrypt
25
+ * const result = await memwal.recall("food allergies")
26
+ * console.log(result.results[0].text) // "I'm allergic to peanuts"
27
+ * ```
28
+ */
29
+ import { sha256hex, hexToBytes, bytesToHex } from "./utils.js";
30
+ // ============================================================
31
+ // Ed25519 Signing (lazy-loaded)
32
+ // ============================================================
33
+ let _ed = null;
34
+ async function getEd() {
35
+ if (!_ed) {
36
+ _ed = await import("@noble/ed25519");
37
+ }
38
+ return _ed;
39
+ }
40
+ // ============================================================
41
+ // MemWal Client
42
+ // ============================================================
43
+ export class MemWal {
44
+ privateKey;
45
+ publicKey = null;
46
+ serverUrl;
47
+ namespace;
48
+ accountId;
49
+ constructor(config) {
50
+ this.privateKey = hexToBytes(config.key);
51
+ this.accountId = config.accountId;
52
+ this.serverUrl = (config.serverUrl ?? "http://localhost:8000").replace(/\/$/, "");
53
+ this.namespace = config.namespace ?? "default";
54
+ }
55
+ /**
56
+ * Create a new MemWal client instance.
57
+ *
58
+ * @param config.key - Ed25519 private key (hex string) — the delegate key
59
+ * @param config.serverUrl - Server URL (default: http://localhost:8000)
60
+ */
61
+ static create(config) {
62
+ return new MemWal(config);
63
+ }
64
+ // ============================================================
65
+ // Core API
66
+ // ============================================================
67
+ /**
68
+ * Remember something — server handles: verify → embed → encrypt → Walrus upload → store
69
+ *
70
+ * @param text - The text to remember
71
+ * @returns RememberResult with id, blob_id, owner
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * const result = await memwal.remember("I'm allergic to peanuts")
76
+ * console.log(result.blob_id) // "TY8mW0yr..."
77
+ * ```
78
+ */
79
+ async remember(text, namespace) {
80
+ return this.signedRequest("POST", "/api/remember", {
81
+ text,
82
+ namespace: namespace ?? this.namespace,
83
+ });
84
+ }
85
+ /**
86
+ * Recall memories similar to a query — server handles:
87
+ * verify → embed query → search → Walrus download → decrypt → return plaintext
88
+ *
89
+ * @param query - Search query
90
+ * @param limit - Max number of results (default: 10)
91
+ * @returns RecallResult with decrypted text results
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * const result = await memwal.recall("food allergies")
96
+ * for (const memory of result.results) {
97
+ * console.log(memory.text, memory.distance)
98
+ * }
99
+ * ```
100
+ */
101
+ async recall(query, limit = 10, namespace) {
102
+ return this.signedRequest("POST", "/api/recall", {
103
+ query,
104
+ limit,
105
+ namespace: namespace ?? this.namespace,
106
+ });
107
+ }
108
+ // ============================================================
109
+ // Manual API (user handles SEAL + embedding + Walrus)
110
+ // ============================================================
111
+ /**
112
+ * Remember (manual mode) — user handles SEAL encrypt, embedding,
113
+ * and Walrus upload externally. Server only stores the vector ↔ blobId mapping.
114
+ *
115
+ * @param opts.blobId - Walrus blob ID (user already uploaded encrypted data)
116
+ * @param opts.vector - Embedding vector (user already generated, e.g. 1536-dim)
117
+ * @returns RememberManualResult with id, blob_id, owner
118
+ *
119
+ * @example
120
+ * ```typescript
121
+ * // 1. User encrypts + uploads + embeds on their own
122
+ * const blobId = await myWalrusUpload(sealEncryptedData)
123
+ * const vector = await myEmbeddingModel.embed(text)
124
+ *
125
+ * // 2. Register vector mapping with server
126
+ * const result = await memwal.rememberManual({ blobId, vector })
127
+ * ```
128
+ */
129
+ async rememberManual(opts) {
130
+ return this.signedRequest("POST", "/api/remember/manual", {
131
+ blob_id: opts.blobId,
132
+ vector: opts.vector,
133
+ namespace: opts.namespace ?? this.namespace,
134
+ });
135
+ }
136
+ /**
137
+ * Recall (manual mode) — user provides a pre-computed query vector.
138
+ * Server returns matching blobIds + distances.
139
+ * User then downloads from Walrus + SEAL decrypts on their own.
140
+ *
141
+ * @param opts.vector - Pre-computed query embedding vector
142
+ * @param opts.limit - Max results (default: 10)
143
+ * @returns RecallManualResult with blob_id + distance pairs (no decrypted text)
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * // 1. User generates query embedding
148
+ * const queryVector = await myEmbeddingModel.embed("food allergies")
149
+ *
150
+ * // 2. Search for similar vectors
151
+ * const hits = await memwal.recallManual({ vector: queryVector })
152
+ *
153
+ * // 3. User downloads + decrypts each result
154
+ * for (const hit of hits.results) {
155
+ * const encrypted = await walrus.download(hit.blob_id)
156
+ * const plaintext = await seal.decrypt(encrypted)
157
+ * console.log(plaintext, hit.distance)
158
+ * }
159
+ * ```
160
+ */
161
+ async recallManual(opts) {
162
+ return this.signedRequest("POST", "/api/recall/manual", {
163
+ vector: opts.vector,
164
+ limit: opts.limit ?? 10,
165
+ namespace: opts.namespace ?? this.namespace,
166
+ });
167
+ }
168
+ /**
169
+ * Generate an embedding vector for text (no storage).
170
+ *
171
+ * @param text - Text to embed
172
+ * @returns EmbedResult with vector
173
+ */
174
+ async embed(text) {
175
+ return this.signedRequest("POST", "/api/embed", { text });
176
+ }
177
+ /**
178
+ * Analyze conversation text — server uses LLM to extract facts, then
179
+ * stores each one (embed → encrypt → Walrus → store).
180
+ *
181
+ * @param text - Conversation text to analyze
182
+ * @returns AnalyzeResult with extracted and stored facts
183
+ *
184
+ * @example
185
+ * ```typescript
186
+ * const result = await memwal.analyze("I love coffee and live in Tokyo")
187
+ * console.log(result.facts) // ["User loves coffee", "User lives in Tokyo"]
188
+ * ```
189
+ */
190
+ async analyze(text, namespace) {
191
+ return this.signedRequest("POST", "/api/analyze", {
192
+ text,
193
+ namespace: namespace ?? this.namespace,
194
+ });
195
+ }
196
+ /**
197
+ * Restore a namespace — server downloads all blobs from Walrus,
198
+ * decrypts with delegate key, re-embeds, and re-indexes.
199
+ *
200
+ * @param namespace - Namespace to restore
201
+ * @returns RestoreResult with count of restored entries
202
+ *
203
+ * @example
204
+ * ```typescript
205
+ * const result = await memwal.restore("my-app")
206
+ * console.log(`Restored ${result.restored} memories`)
207
+ * ```
208
+ */
209
+ async restore(namespace, limit = 50) {
210
+ return this.signedRequest("POST", "/api/restore", {
211
+ namespace,
212
+ limit,
213
+ });
214
+ }
215
+ /**
216
+ * Check server health.
217
+ */
218
+ async health() {
219
+ const res = await fetch(`${this.serverUrl}/health`);
220
+ if (!res.ok) {
221
+ throw new Error(`Health check failed: ${res.status}`);
222
+ }
223
+ return res.json();
224
+ }
225
+ /**
226
+ * Get the public key (hex string).
227
+ */
228
+ async getPublicKeyHex() {
229
+ const pk = await this.getPublicKey();
230
+ return bytesToHex(pk);
231
+ }
232
+ // ============================================================
233
+ // Internal: Signed HTTP Requests
234
+ // ============================================================
235
+ async getPublicKey() {
236
+ if (!this.publicKey) {
237
+ const ed = await getEd();
238
+ this.publicKey = await ed.getPublicKeyAsync(this.privateKey);
239
+ }
240
+ return this.publicKey;
241
+ }
242
+ /**
243
+ * Make a signed request to the server.
244
+ *
245
+ * Signature format: "{timestamp}.{method}.{path}.{body_sha256}"
246
+ * Headers: x-public-key, x-signature, x-timestamp
247
+ *
248
+ * The server uses x-public-key to look up the owner via onchain
249
+ * MemWalAccount.delegate_keys — no need to send owner in the body.
250
+ */
251
+ async signedRequest(method, path, body) {
252
+ const ed = await getEd();
253
+ const timestamp = Math.floor(Date.now() / 1000).toString();
254
+ const bodyStr = JSON.stringify(body);
255
+ const bodySha256 = await sha256hex(bodyStr);
256
+ // Build message to sign
257
+ const message = `${timestamp}.${method}.${path}.${bodySha256}`;
258
+ const msgBytes = new TextEncoder().encode(message);
259
+ // Sign with Ed25519
260
+ const signature = await ed.signAsync(msgBytes, this.privateKey);
261
+ const publicKey = await this.getPublicKey();
262
+ // Make HTTP request
263
+ const url = `${this.serverUrl}${path}`;
264
+ const res = await fetch(url, {
265
+ method,
266
+ headers: {
267
+ "Content-Type": "application/json",
268
+ "x-public-key": bytesToHex(publicKey),
269
+ "x-signature": bytesToHex(signature),
270
+ "x-timestamp": timestamp,
271
+ "x-delegate-key": bytesToHex(this.privateKey),
272
+ "x-account-id": this.accountId,
273
+ },
274
+ body: bodyStr,
275
+ });
276
+ if (!res.ok) {
277
+ const errText = await res.text();
278
+ throw new Error(`MemWal API error (${res.status}): ${errText}`);
279
+ }
280
+ return res.json();
281
+ }
282
+ }
283
+ //# sourceMappingURL=memwal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memwal.js","sourceRoot":"","sources":["../src/memwal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAgBH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE/D,+DAA+D;AAC/D,gCAAgC;AAChC,+DAA+D;AAE/D,IAAI,GAAG,GAA2C,IAAI,CAAC;AACvD,KAAK,UAAU,KAAK;IAChB,IAAI,CAAC,GAAG,EAAE,CAAC;QACP,GAA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