@mastra/memory 0.0.2-alpha.9 → 0.1.0-alpha.66

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.
@@ -0,0 +1,14 @@
1
+
2
+ > @mastra/memory@0.0.2-alpha.43 build C:\Users\Ward\projects\mastra\mastra\packages\memory
3
+ > dts build
4
+
5
+ ⠙ Creating entry file 99% 2.1s, estimated 1.5s
6
+ ⠙ Building modules 46% 2.1s, estimated 4.5s
7
+ ✓ Creating entry file 2.1 secs
8
+ ⠹ Building modules 66% 3.0s, estimated 4.5s
9
+ ⠸ Building modules 96% 4.3s, estimated 4.5s
10
+ ⠼ Building modules 99% 6.4s, estimated 4.5s
11
+ ⠴ Building modules 99% 6.5s, estimated 4.5s
12
+ ⠦ Building modules 99% 6.5s, estimated 4.5s
13
+ ⠧ Building modules 99% 6.6s, estimated 4.5s
14
+ ✓ Building modules 6.7 secs
package/CHANGELOG.md CHANGED
@@ -1,5 +1,452 @@
1
1
  # @mastra/memory
2
2
 
3
+ ## 0.1.0-alpha.66
4
+
5
+ ### Minor Changes
6
+
7
+ - cb290ee: Reworked the Memory public API to have more intuitive and simple property names
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [2f17a5f]
12
+ - Updated dependencies [cb290ee]
13
+ - Updated dependencies [b4d7416]
14
+ - Updated dependencies [38b7f66]
15
+ - @mastra/core@0.2.0-alpha.84
16
+
17
+ ## 0.1.0-alpha.65
18
+
19
+ ### Minor Changes
20
+
21
+ - 30322ce: Added new Memory API for managed agent memory via MastraStorage and MastraVector classes
22
+
23
+ ### Patch Changes
24
+
25
+ - c35aa18: bug: not all models support multiple system messages
26
+ - 9625602: Use mastra core splitted bundles in other packages
27
+ - Updated dependencies [30322ce]
28
+ - Updated dependencies [78eec7c]
29
+ - Updated dependencies [9625602]
30
+ - Updated dependencies [8769a62]
31
+ - @mastra/core@0.2.0-alpha.83
32
+
33
+ ## 0.0.2-alpha.64
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [73d112c]
38
+ - @mastra/core@0.1.27-alpha.82
39
+
40
+ ## 0.0.2-alpha.63
41
+
42
+ ### Patch Changes
43
+
44
+ - Updated dependencies [9fb3039]
45
+ - @mastra/core@0.1.27-alpha.81
46
+
47
+ ## 0.0.2-alpha.62
48
+
49
+ ### Patch Changes
50
+
51
+ - 7f5b1b2: @mastra/memory tsup bundling
52
+
53
+ ## 0.0.2-alpha.61
54
+
55
+ ### Patch Changes
56
+
57
+ - Updated dependencies [327ece7]
58
+ - @mastra/core@0.1.27-alpha.80
59
+
60
+ ## 0.0.2-alpha.60
61
+
62
+ ### Patch Changes
63
+
64
+ - Updated dependencies [21fe536]
65
+ - @mastra/core@0.1.27-alpha.79
66
+
67
+ ## 0.0.2-alpha.59
68
+
69
+ ### Patch Changes
70
+
71
+ - Updated dependencies [685108a]
72
+ - Updated dependencies [685108a]
73
+ - @mastra/core@0.1.27-alpha.78
74
+
75
+ ## 0.0.2-alpha.58
76
+
77
+ ### Patch Changes
78
+
79
+ - Updated dependencies [8105fae]
80
+ - @mastra/core@0.1.27-alpha.77
81
+
82
+ ## 0.0.2-alpha.57
83
+
84
+ ### Patch Changes
85
+
86
+ - Updated dependencies [ae7bf94]
87
+ - Updated dependencies [ae7bf94]
88
+ - @mastra/core@0.1.27-alpha.76
89
+
90
+ ## 0.0.2-alpha.56
91
+
92
+ ### Patch Changes
93
+
94
+ - Updated dependencies [23dcb23]
95
+ - @mastra/core@0.1.27-alpha.75
96
+
97
+ ## 0.0.2-alpha.55
98
+
99
+ ### Patch Changes
100
+
101
+ - Updated dependencies [7b87567]
102
+ - @mastra/core@0.1.27-alpha.74
103
+
104
+ ## 0.0.2-alpha.54
105
+
106
+ ### Patch Changes
107
+
108
+ - Updated dependencies [3427b95]
109
+ - @mastra/core@0.1.27-alpha.73
110
+
111
+ ## 0.0.2-alpha.53
112
+
113
+ ### Patch Changes
114
+
115
+ - Updated dependencies [e4d4ede]
116
+ - Updated dependencies [06b2c0a]
117
+ - @mastra/core@0.1.27-alpha.72
118
+
119
+ ## 0.0.2-alpha.52
120
+
121
+ ### Patch Changes
122
+
123
+ - Updated dependencies [d9c8dd0]
124
+ - @mastra/core@0.1.27-alpha.71
125
+
126
+ ## 0.0.2-alpha.51
127
+
128
+ ### Patch Changes
129
+
130
+ - bdaf834: publish packages
131
+
132
+ ## 0.0.2-alpha.50
133
+
134
+ ### Patch Changes
135
+
136
+ - Updated dependencies [dd6d87f]
137
+ - Updated dependencies [04434b6]
138
+ - @mastra/core@0.1.27-alpha.70
139
+
140
+ ## 0.0.2-alpha.49
141
+
142
+ ### Patch Changes
143
+
144
+ - Updated dependencies [1944807]
145
+ - Updated dependencies [9ade36e]
146
+ - @mastra/core@0.1.27-alpha.69
147
+
148
+ ## 0.0.2-alpha.48
149
+
150
+ ### Patch Changes
151
+
152
+ - Updated dependencies [0be7181]
153
+ - Updated dependencies [0be7181]
154
+ - @mastra/core@0.1.27-alpha.68
155
+
156
+ ## 0.0.2-alpha.47
157
+
158
+ ### Patch Changes
159
+
160
+ - Updated dependencies [c8ff2f5]
161
+ - @mastra/core@0.1.27-alpha.67
162
+
163
+ ## 0.0.2-alpha.46
164
+
165
+ ### Patch Changes
166
+
167
+ - Updated dependencies [14064f2]
168
+ - @mastra/core@0.1.27-alpha.66
169
+
170
+ ## 0.0.2-alpha.45
171
+
172
+ ### Patch Changes
173
+
174
+ - Updated dependencies [e66643a]
175
+ - @mastra/core@0.1.27-alpha.65
176
+
177
+ ## 0.0.2-alpha.44
178
+
179
+ ### Patch Changes
180
+
181
+ - Updated dependencies [f368477]
182
+ - Updated dependencies [d5ec619]
183
+ - @mastra/core@0.1.27-alpha.64
184
+
185
+ ## 0.0.2-alpha.43
186
+
187
+ ### Patch Changes
188
+
189
+ - Updated dependencies [e097800]
190
+ - @mastra/core@0.1.27-alpha.63
191
+
192
+ ## 0.0.2-alpha.42
193
+
194
+ ### Patch Changes
195
+
196
+ - Updated dependencies [93a3719]
197
+ - @mastra/core@0.1.27-alpha.62
198
+
199
+ ## 0.0.2-alpha.41
200
+
201
+ ### Patch Changes
202
+
203
+ - Updated dependencies [dc90663]
204
+ - @mastra/core@0.1.27-alpha.61
205
+
206
+ ## 0.0.2-alpha.40
207
+
208
+ ### Patch Changes
209
+
210
+ - Updated dependencies [3967e69]
211
+ - @mastra/core@0.1.27-alpha.60
212
+
213
+ ## 0.0.2-alpha.39
214
+
215
+ ### Patch Changes
216
+
217
+ - Updated dependencies [b524c22]
218
+ - @mastra/core@0.1.27-alpha.59
219
+
220
+ ## 0.0.2-alpha.38
221
+
222
+ ### Patch Changes
223
+
224
+ - Updated dependencies [1874f40]
225
+ - Updated dependencies [4b1ce2c]
226
+ - @mastra/core@0.1.27-alpha.58
227
+
228
+ ## 0.0.2-alpha.37
229
+
230
+ ### Patch Changes
231
+
232
+ - Updated dependencies [fd494a3]
233
+ - @mastra/core@0.1.27-alpha.57
234
+
235
+ ## 0.0.2-alpha.36
236
+
237
+ ### Patch Changes
238
+
239
+ - Updated dependencies [9f3ab05]
240
+ - @mastra/core@0.1.27-alpha.56
241
+
242
+ ## 0.0.2-alpha.35
243
+
244
+ ### Patch Changes
245
+
246
+ - 837a288: MAJOR Revamp of tools, workflows, syncs.
247
+ - 0b74006: Workflow updates
248
+ - Updated dependencies [592e3cf]
249
+ - Updated dependencies [837a288]
250
+ - Updated dependencies [0b74006]
251
+ - @mastra/core@0.1.27-alpha.55
252
+
253
+ ## 0.0.2-alpha.34
254
+
255
+ ### Patch Changes
256
+
257
+ - Updated dependencies [d2cd535]
258
+ - @mastra/core@0.1.27-alpha.54
259
+
260
+ ## 0.0.2-alpha.33
261
+
262
+ ### Patch Changes
263
+
264
+ - Updated dependencies [8e7814f]
265
+ - @mastra/core@0.1.27-alpha.53
266
+
267
+ ## 0.0.2-alpha.32
268
+
269
+ ### Patch Changes
270
+
271
+ - Updated dependencies [eedb829]
272
+ - @mastra/core@0.1.27-alpha.52
273
+
274
+ ## 0.0.2-alpha.31
275
+
276
+ ### Patch Changes
277
+
278
+ - Updated dependencies [a7b016d]
279
+ - Updated dependencies [da2e8d3]
280
+ - Updated dependencies [538a136]
281
+ - @mastra/core@0.1.27-alpha.51
282
+
283
+ ## 0.0.2-alpha.30
284
+
285
+ ### Patch Changes
286
+
287
+ - Updated dependencies [401a4d9]
288
+ - @mastra/core@0.1.27-alpha.50
289
+
290
+ ## 0.0.2-alpha.29
291
+
292
+ ### Patch Changes
293
+
294
+ - Updated dependencies [79acad0]
295
+ - Updated dependencies [f5dfa20]
296
+ - @mastra/core@0.1.27-alpha.49
297
+
298
+ ## 0.0.2-alpha.28
299
+
300
+ ### Patch Changes
301
+
302
+ - Updated dependencies [b726bf5]
303
+ - @mastra/core@0.1.27-alpha.48
304
+
305
+ ## 0.0.2-alpha.27
306
+
307
+ ### Patch Changes
308
+
309
+ - Updated dependencies [f6ba259]
310
+ - @mastra/core@0.1.27-alpha.47
311
+
312
+ ## 0.0.2-alpha.26
313
+
314
+ ### Patch Changes
315
+
316
+ - 8ae2bbc: Dane publishing
317
+ - 0bd142c: Fixes learned from docs
318
+ - ee4de15: Dane fixes
319
+ - Updated dependencies [8ae2bbc]
320
+ - Updated dependencies [0bd142c]
321
+ - Updated dependencies [ee4de15]
322
+ - @mastra/core@0.1.27-alpha.46
323
+
324
+ ## 0.0.2-alpha.25
325
+
326
+ ### Patch Changes
327
+
328
+ - 3220d26: Fix lastStep error in agent stream
329
+
330
+ ## 0.0.2-alpha.24
331
+
332
+ ### Patch Changes
333
+
334
+ - 002d6d8: add memory to playground agent
335
+ - Updated dependencies [e608d8c]
336
+ - Updated dependencies [002d6d8]
337
+ - @mastra/core@0.1.27-alpha.45
338
+
339
+ ## 0.0.2-alpha.23
340
+
341
+ ### Patch Changes
342
+
343
+ - Updated dependencies [2fa7f53]
344
+ - @mastra/core@0.1.27-alpha.44
345
+
346
+ ## 0.0.2-alpha.22
347
+
348
+ ### Patch Changes
349
+
350
+ - Updated dependencies [2e099d2]
351
+ - Updated dependencies [d6d8159]
352
+ - @mastra/core@0.1.27-alpha.43
353
+
354
+ ## 0.0.2-alpha.21
355
+
356
+ ### Patch Changes
357
+
358
+ - Updated dependencies [4a54c82]
359
+ - @mastra/core@0.1.27-alpha.42
360
+
361
+ ## 0.0.2-alpha.20
362
+
363
+ ### Patch Changes
364
+
365
+ - Updated dependencies [5cdfb88]
366
+ - @mastra/core@0.1.27-alpha.41
367
+
368
+ ## 0.0.2-alpha.19
369
+
370
+ ### Patch Changes
371
+
372
+ - Updated dependencies [9029796]
373
+ - @mastra/core@0.1.27-alpha.40
374
+
375
+ ## 0.0.2-alpha.18
376
+
377
+ ### Patch Changes
378
+
379
+ - Updated dependencies [2b01511]
380
+ - @mastra/core@0.1.27-alpha.39
381
+
382
+ ## 0.0.2-alpha.17
383
+
384
+ ### Patch Changes
385
+
386
+ - Updated dependencies [f031a1f]
387
+ - @mastra/core@0.1.27-alpha.38
388
+
389
+ ## 0.0.2-alpha.16
390
+
391
+ ### Patch Changes
392
+
393
+ - b5393f1: New example: Dane and many fixes to make it work
394
+ - Updated dependencies [c872875]
395
+ - Updated dependencies [f6da688]
396
+ - Updated dependencies [b5393f1]
397
+ - @mastra/core@0.1.27-alpha.37
398
+
399
+ ## 0.0.2-alpha.15
400
+
401
+ ### Patch Changes
402
+
403
+ - b898fad: Fix get context window in memory
404
+ - Updated dependencies [f537e33]
405
+ - Updated dependencies [bc40916]
406
+ - Updated dependencies [f7d1131]
407
+ - Updated dependencies [75bf3f0]
408
+ - Updated dependencies [3c4488b]
409
+ - Updated dependencies [d38f7a6]
410
+ - @mastra/core@0.1.27-alpha.36
411
+
412
+ ## 0.0.2-alpha.14
413
+
414
+ ### Patch Changes
415
+
416
+ - 033eda6: More fixes for refactor
417
+ - Updated dependencies [033eda6]
418
+ - @mastra/core@0.1.27-alpha.35
419
+
420
+ ## 0.0.2-alpha.13
421
+
422
+ ### Patch Changes
423
+
424
+ - 837a288: MAJOR Revamp of tools, workflows, syncs.
425
+ - Updated dependencies [837a288]
426
+ - Updated dependencies [5811de6]
427
+ - @mastra/core@0.1.27-alpha.34
428
+
429
+ ## 0.0.2-alpha.12
430
+
431
+ ### Patch Changes
432
+
433
+ - Updated dependencies [e1dd94a]
434
+ - @mastra/core@0.1.27-alpha.33
435
+
436
+ ## 0.0.2-alpha.11
437
+
438
+ ### Patch Changes
439
+
440
+ - Updated dependencies [2712098]
441
+ - @mastra/core@0.1.27-alpha.32
442
+
443
+ ## 0.0.2-alpha.10
444
+
445
+ ### Patch Changes
446
+
447
+ - Updated dependencies [c2dd6b5]
448
+ - @mastra/core@0.1.27-alpha.31
449
+
3
450
  ## 0.0.2-alpha.9
4
451
 
5
452
  ### Patch Changes
package/LICENSE ADDED
@@ -0,0 +1,44 @@
1
+ Elastic License 2.0 (ELv2)
2
+
3
+ **Acceptance**
4
+ By using the software, you agree to all of the terms and conditions below.
5
+
6
+ **Copyright License**
7
+ The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below
8
+
9
+ **Limitations**
10
+ You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
11
+
12
+ You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
13
+
14
+ You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
15
+
16
+ **Patents**
17
+ The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
18
+
19
+ **Notices**
20
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
21
+
22
+ If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
23
+
24
+ **No Other Rights**
25
+ These terms do not imply any licenses other than those expressly granted in these terms.
26
+
27
+ **Termination**
28
+ If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
29
+
30
+ **No Liability**
31
+ As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
32
+
33
+ **Definitions**
34
+ The _licensor_ is the entity offering these terms, and the _software_ is the software the licensor makes available under these terms, including any portion of it.
35
+
36
+ _you_ refers to the individual or entity agreeing to these terms.
37
+
38
+ _your company_ is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. _control_ means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
39
+
40
+ _your licenses_ are all the licenses granted to you for the software under these terms.
41
+
42
+ _use_ means anything you do with the software requiring one of your licenses.
43
+
44
+ _trademark_ means trademarks, service marks, and similar rights.
package/dist/index.d.ts CHANGED
@@ -1,2 +1,44 @@
1
- export * from './postgres';
2
- export * from './kv/upstash';
1
+ import { CoreMessage } from '@mastra/core';
2
+ import { MastraMemory, SharedMemoryConfig, MemoryConfig, StorageThreadType, MessageType } from '@mastra/core/memory';
3
+ import { StorageGetMessagesArg } from '@mastra/core/storage';
4
+ import { Message } from 'ai';
5
+
6
+ /**
7
+ * Concrete implementation of MastraMemory that adds support for thread configuration
8
+ * and message injection.
9
+ */
10
+ declare class Memory extends MastraMemory {
11
+ constructor(config: SharedMemoryConfig);
12
+ getMessages({ threadId, selectBy, threadConfig, }: StorageGetMessagesArg): Promise<{
13
+ messages: CoreMessage[];
14
+ uiMessages: Message[];
15
+ }>;
16
+ rememberMessages({ threadId, vectorMessageSearch, config, }: {
17
+ threadId: string;
18
+ vectorMessageSearch?: string;
19
+ config?: MemoryConfig;
20
+ }): Promise<{
21
+ messages: CoreMessage[];
22
+ uiMessages: Message[];
23
+ }>;
24
+ getThreadById({ threadId }: {
25
+ threadId: string;
26
+ }): Promise<StorageThreadType | null>;
27
+ getThreadsByResourceId({ resourceId }: {
28
+ resourceId: string;
29
+ }): Promise<StorageThreadType[]>;
30
+ saveThread({ thread }: {
31
+ thread: StorageThreadType;
32
+ }): Promise<StorageThreadType>;
33
+ updateThread({ id, title, metadata, }: {
34
+ id: string;
35
+ title: string;
36
+ metadata: Record<string, unknown>;
37
+ }): Promise<StorageThreadType>;
38
+ saveMessages({ messages }: {
39
+ messages: MessageType[];
40
+ }): Promise<MessageType[]>;
41
+ deleteThread(threadId: string): Promise<void>;
42
+ }
43
+
44
+ export { Memory };
package/dist/index.js CHANGED
@@ -1,8 +1,117 @@
1
+ import { MastraMemory } from '@mastra/core/memory';
1
2
 
2
- 'use strict'
3
+ // src/index.ts
4
+ var Memory = class extends MastraMemory {
5
+ constructor(config) {
6
+ super({ name: "Memory", ...config });
7
+ }
8
+ async getMessages({
9
+ threadId,
10
+ selectBy,
11
+ threadConfig
12
+ }) {
13
+ let vectorResults = null;
14
+ this.logger.info(`Memory getMessages() with:`, {
15
+ threadId,
16
+ selectBy,
17
+ threadConfig
18
+ });
19
+ const config = this.getMergedThreadConfig(threadConfig || {});
20
+ const vectorConfig = typeof config?.historySearch === `boolean` ? {
21
+ topK: 2,
22
+ messageRange: { before: 2, after: 2 }
23
+ } : {
24
+ topK: config?.historySearch?.topK || 2,
25
+ messageRange: config?.historySearch?.messageRange || { before: 2, after: 2 }
26
+ };
27
+ if (selectBy?.vectorSearchString && this.vector) {
28
+ const { embeddings } = await this.vector.embed(selectBy.vectorSearchString, this.parseEmbeddingOptions());
29
+ await this.vector.createIndex("memory_messages", 1536);
30
+ vectorResults = await this.vector.query("memory_messages", embeddings[0], vectorConfig.topK, {
31
+ thread_id: threadId
32
+ });
33
+ }
34
+ const rawMessages = await this.storage.__getMessages({
35
+ threadId,
36
+ selectBy: {
37
+ ...selectBy,
38
+ ...vectorResults?.length ? {
39
+ include: vectorResults.map((r) => ({
40
+ id: r.metadata?.message_id,
41
+ withNextMessages: typeof vectorConfig.messageRange === "number" ? vectorConfig.messageRange : vectorConfig.messageRange.after,
42
+ withPreviousMessages: typeof vectorConfig.messageRange === "number" ? vectorConfig.messageRange : vectorConfig.messageRange.before
43
+ }))
44
+ } : {}
45
+ },
46
+ threadConfig: config
47
+ });
48
+ const messages = this.parseMessages(rawMessages);
49
+ const uiMessages = this.convertToUIMessages(rawMessages);
50
+ return { messages, uiMessages };
51
+ }
52
+ async rememberMessages({
53
+ threadId,
54
+ vectorMessageSearch,
55
+ config
56
+ }) {
57
+ const threadConfig = this.getMergedThreadConfig(config || {});
58
+ if (!threadConfig.lastMessages && !threadConfig.historySearch) {
59
+ return {
60
+ messages: [],
61
+ uiMessages: []
62
+ };
63
+ }
64
+ const messages = await this.getMessages({
65
+ threadId,
66
+ selectBy: {
67
+ last: threadConfig.lastMessages,
68
+ vectorSearchString: threadConfig.historySearch && vectorMessageSearch ? vectorMessageSearch : undefined
69
+ },
70
+ threadConfig: config
71
+ });
72
+ this.logger.info(`Remembered message history includes ${messages.messages.length} messages.`);
73
+ return messages;
74
+ }
75
+ async getThreadById({ threadId }) {
76
+ return this.storage.__getThreadById({ threadId });
77
+ }
78
+ async getThreadsByResourceId({ resourceId }) {
79
+ return this.storage.__getThreadsByResourceId({ resourceId });
80
+ }
81
+ async saveThread({ thread }) {
82
+ return this.storage.__saveThread({ thread });
83
+ }
84
+ async updateThread({
85
+ id,
86
+ title,
87
+ metadata
88
+ }) {
89
+ return this.storage.__updateThread({
90
+ id,
91
+ title,
92
+ metadata
93
+ });
94
+ }
95
+ async saveMessages({ messages }) {
96
+ if (this.vector) {
97
+ await this.vector.createIndex("memory_messages", 1536);
98
+ for (const message of messages) {
99
+ if (typeof message.content !== `string`) continue;
100
+ const { embeddings } = await this.vector.embed(message.content, this.parseEmbeddingOptions());
101
+ await this.vector.upsert("memory_messages", embeddings, [
102
+ {
103
+ text: message.content,
104
+ message_id: message.id,
105
+ thread_id: message.threadId
106
+ }
107
+ ]);
108
+ }
109
+ }
110
+ return this.storage.__saveMessages({ messages });
111
+ }
112
+ async deleteThread(threadId) {
113
+ await this.storage.__deleteThread({ threadId });
114
+ }
115
+ };
3
116
 
4
- if (process.env.NODE_ENV === 'production') {
5
- module.exports = require('./memory.cjs.production.min.js')
6
- } else {
7
- module.exports = require('./memory.cjs.development.js')
8
- }
117
+ export { Memory };