@mastra/memory 0.4.0-alpha.1 → 0.10.1-alpha.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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +37 -0
- package/dist/index.cjs +0 -10
- package/dist/index.js +0 -10
- package/package.json +4 -4
- package/src/index.ts +0 -10
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/memory@0.
|
|
2
|
+
> @mastra/memory@0.10.1-alpha.0 build /home/runner/work/mastra/mastra/packages/memory
|
|
3
3
|
> pnpm run check && tsup src/index.ts src/processors/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @mastra/memory@0.
|
|
6
|
+
> @mastra/memory@0.10.1-alpha.0 check /home/runner/work/mastra/mastra/packages/memory
|
|
7
7
|
> tsc --noEmit
|
|
8
8
|
|
|
9
9
|
[34mCLI[39m Building entry: src/index.ts, src/processors/index.ts
|
|
10
10
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
11
11
|
[34mCLI[39m tsup v8.4.0
|
|
12
12
|
[34mTSC[39m Build start
|
|
13
|
-
[32mTSC[39m ⚡️ Build success in
|
|
13
|
+
[32mTSC[39m ⚡️ Build success in 9122ms
|
|
14
14
|
[34mDTS[39m Build start
|
|
15
15
|
[34mCLI[39m Target: es2022
|
|
16
16
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
17
17
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/memory/dist/_tsup-dts-rollup.d.ts[39m
|
|
18
18
|
Analysis will use the bundled TypeScript version 5.8.3
|
|
19
19
|
[36mWriting package typings: /home/runner/work/mastra/mastra/packages/memory/dist/_tsup-dts-rollup.d.cts[39m
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 11021ms
|
|
21
21
|
[34mCLI[39m Cleaning output folder
|
|
22
22
|
[34mESM[39m Build start
|
|
23
23
|
[34mCJS[39m Build start
|
|
24
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m19.00 KB[39m
|
|
25
24
|
[32mCJS[39m [1mdist/processors/index.cjs [22m[32m5.59 KB[39m
|
|
26
|
-
[32mCJS[39m
|
|
27
|
-
[
|
|
25
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m18.70 KB[39m
|
|
26
|
+
[32mCJS[39m ⚡️ Build success in 529ms
|
|
28
27
|
[32mESM[39m [1mdist/processors/index.js [22m[32m5.38 KB[39m
|
|
29
|
-
[32mESM[39m
|
|
28
|
+
[32mESM[39m [1mdist/index.js [22m[32m18.51 KB[39m
|
|
29
|
+
[32mESM[39m ⚡️ Build success in 529ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @mastra/memory
|
|
2
2
|
|
|
3
|
+
## 0.10.1-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d70b807: Improve storage.init
|
|
8
|
+
- Updated dependencies [d70b807]
|
|
9
|
+
- @mastra/core@0.10.1-alpha.3
|
|
10
|
+
|
|
11
|
+
## 0.10.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 83da932: Move @mastra/core to peerdeps
|
|
16
|
+
- 0dcb9f0: Memory breaking changes: storage, vector, and embedder are now required. Working memory text streaming has been removed, only tool calling is supported for working memory updates now. Default settings have changed (lastMessages: 40->10, semanticRecall: true->false, threads.generateTitle: true->false)
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- 3cd7aee: [MASTRA-3439] Working Memory tool call fix: Updated saveMessages to filter out workingmemory content from messages, rather than skip message completely
|
|
21
|
+
- Updated dependencies [b3a3d63]
|
|
22
|
+
- Updated dependencies [344f453]
|
|
23
|
+
- Updated dependencies [0a3ae6d]
|
|
24
|
+
- Updated dependencies [95911be]
|
|
25
|
+
- Updated dependencies [f53a6ac]
|
|
26
|
+
- Updated dependencies [5eb5a99]
|
|
27
|
+
- Updated dependencies [7e632c5]
|
|
28
|
+
- Updated dependencies [1e9fbfa]
|
|
29
|
+
- Updated dependencies [eabdcd9]
|
|
30
|
+
- Updated dependencies [90be034]
|
|
31
|
+
- Updated dependencies [99f050a]
|
|
32
|
+
- Updated dependencies [d0ee3c6]
|
|
33
|
+
- Updated dependencies [b2ae5aa]
|
|
34
|
+
- Updated dependencies [23f258c]
|
|
35
|
+
- Updated dependencies [a7292b0]
|
|
36
|
+
- Updated dependencies [0dcb9f0]
|
|
37
|
+
- Updated dependencies [2672a05]
|
|
38
|
+
- @mastra/core@0.10.0
|
|
39
|
+
|
|
3
40
|
## 0.4.0-alpha.1
|
|
4
41
|
|
|
5
42
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -99,7 +99,6 @@ var Memory = class extends memory.MastraMemory {
|
|
|
99
99
|
this.threadConfig = mergedConfig;
|
|
100
100
|
}
|
|
101
101
|
async validateThreadIsOwnedByResource(threadId, resourceId) {
|
|
102
|
-
await this.storage.init();
|
|
103
102
|
const thread = await this.storage.getThreadById({ threadId });
|
|
104
103
|
if (!thread) {
|
|
105
104
|
throw new Error(`No thread found with id ${threadId}`);
|
|
@@ -156,7 +155,6 @@ var Memory = class extends memory.MastraMemory {
|
|
|
156
155
|
})
|
|
157
156
|
);
|
|
158
157
|
}
|
|
159
|
-
await this.storage.init();
|
|
160
158
|
const rawMessages = await this.storage.getMessages({
|
|
161
159
|
threadId,
|
|
162
160
|
selectBy: {
|
|
@@ -208,18 +206,15 @@ var Memory = class extends memory.MastraMemory {
|
|
|
208
206
|
};
|
|
209
207
|
}
|
|
210
208
|
async getThreadById({ threadId }) {
|
|
211
|
-
await this.storage.init();
|
|
212
209
|
return this.storage.getThreadById({ threadId });
|
|
213
210
|
}
|
|
214
211
|
async getThreadsByResourceId({ resourceId }) {
|
|
215
|
-
await this.storage.init();
|
|
216
212
|
return this.storage.getThreadsByResourceId({ resourceId });
|
|
217
213
|
}
|
|
218
214
|
async saveThread({
|
|
219
215
|
thread,
|
|
220
216
|
memoryConfig
|
|
221
217
|
}) {
|
|
222
|
-
await this.storage.init();
|
|
223
218
|
const config = this.getMergedThreadConfig(memoryConfig || {});
|
|
224
219
|
if (config.workingMemory?.enabled && !thread?.metadata?.workingMemory) {
|
|
225
220
|
return this.storage.saveThread({
|
|
@@ -237,7 +232,6 @@ var Memory = class extends memory.MastraMemory {
|
|
|
237
232
|
title,
|
|
238
233
|
metadata
|
|
239
234
|
}) {
|
|
240
|
-
await this.storage.init();
|
|
241
235
|
return this.storage.updateThread({
|
|
242
236
|
id,
|
|
243
237
|
title,
|
|
@@ -245,7 +239,6 @@ var Memory = class extends memory.MastraMemory {
|
|
|
245
239
|
});
|
|
246
240
|
}
|
|
247
241
|
async deleteThread(threadId) {
|
|
248
|
-
await this.storage.init();
|
|
249
242
|
await this.storage.deleteThread({ threadId });
|
|
250
243
|
}
|
|
251
244
|
chunkText(text, tokenSize = 4096) {
|
|
@@ -302,7 +295,6 @@ var Memory = class extends memory.MastraMemory {
|
|
|
302
295
|
messages,
|
|
303
296
|
memoryConfig
|
|
304
297
|
}) {
|
|
305
|
-
await this.storage.init();
|
|
306
298
|
await this.saveWorkingMemory(messages);
|
|
307
299
|
const updatedMessages = this.updateMessagesToHideWorkingMemory(messages);
|
|
308
300
|
const config = this.getMergedThreadConfig(memoryConfig);
|
|
@@ -386,7 +378,6 @@ var Memory = class extends memory.MastraMemory {
|
|
|
386
378
|
}
|
|
387
379
|
async getWorkingMemory({ threadId }) {
|
|
388
380
|
if (!this.threadConfig.workingMemory?.enabled) return null;
|
|
389
|
-
await this.storage.init();
|
|
390
381
|
const thread = await this.storage.getThreadById({ threadId });
|
|
391
382
|
if (!thread) return this.threadConfig?.workingMemory?.template || this.defaultWorkingMemoryTemplate;
|
|
392
383
|
const memory = thread.metadata?.workingMemory || this.threadConfig.workingMemory.template || this.defaultWorkingMemoryTemplate;
|
|
@@ -406,7 +397,6 @@ var Memory = class extends memory.MastraMemory {
|
|
|
406
397
|
if (!newMemory) {
|
|
407
398
|
return;
|
|
408
399
|
}
|
|
409
|
-
await this.storage.init();
|
|
410
400
|
const thread = await this.storage.getThreadById({ threadId });
|
|
411
401
|
if (!thread) return;
|
|
412
402
|
await this.storage.updateThread({
|
package/dist/index.js
CHANGED
|
@@ -93,7 +93,6 @@ var Memory = class extends MastraMemory {
|
|
|
93
93
|
this.threadConfig = mergedConfig;
|
|
94
94
|
}
|
|
95
95
|
async validateThreadIsOwnedByResource(threadId, resourceId) {
|
|
96
|
-
await this.storage.init();
|
|
97
96
|
const thread = await this.storage.getThreadById({ threadId });
|
|
98
97
|
if (!thread) {
|
|
99
98
|
throw new Error(`No thread found with id ${threadId}`);
|
|
@@ -150,7 +149,6 @@ var Memory = class extends MastraMemory {
|
|
|
150
149
|
})
|
|
151
150
|
);
|
|
152
151
|
}
|
|
153
|
-
await this.storage.init();
|
|
154
152
|
const rawMessages = await this.storage.getMessages({
|
|
155
153
|
threadId,
|
|
156
154
|
selectBy: {
|
|
@@ -202,18 +200,15 @@ var Memory = class extends MastraMemory {
|
|
|
202
200
|
};
|
|
203
201
|
}
|
|
204
202
|
async getThreadById({ threadId }) {
|
|
205
|
-
await this.storage.init();
|
|
206
203
|
return this.storage.getThreadById({ threadId });
|
|
207
204
|
}
|
|
208
205
|
async getThreadsByResourceId({ resourceId }) {
|
|
209
|
-
await this.storage.init();
|
|
210
206
|
return this.storage.getThreadsByResourceId({ resourceId });
|
|
211
207
|
}
|
|
212
208
|
async saveThread({
|
|
213
209
|
thread,
|
|
214
210
|
memoryConfig
|
|
215
211
|
}) {
|
|
216
|
-
await this.storage.init();
|
|
217
212
|
const config = this.getMergedThreadConfig(memoryConfig || {});
|
|
218
213
|
if (config.workingMemory?.enabled && !thread?.metadata?.workingMemory) {
|
|
219
214
|
return this.storage.saveThread({
|
|
@@ -231,7 +226,6 @@ var Memory = class extends MastraMemory {
|
|
|
231
226
|
title,
|
|
232
227
|
metadata
|
|
233
228
|
}) {
|
|
234
|
-
await this.storage.init();
|
|
235
229
|
return this.storage.updateThread({
|
|
236
230
|
id,
|
|
237
231
|
title,
|
|
@@ -239,7 +233,6 @@ var Memory = class extends MastraMemory {
|
|
|
239
233
|
});
|
|
240
234
|
}
|
|
241
235
|
async deleteThread(threadId) {
|
|
242
|
-
await this.storage.init();
|
|
243
236
|
await this.storage.deleteThread({ threadId });
|
|
244
237
|
}
|
|
245
238
|
chunkText(text, tokenSize = 4096) {
|
|
@@ -296,7 +289,6 @@ var Memory = class extends MastraMemory {
|
|
|
296
289
|
messages,
|
|
297
290
|
memoryConfig
|
|
298
291
|
}) {
|
|
299
|
-
await this.storage.init();
|
|
300
292
|
await this.saveWorkingMemory(messages);
|
|
301
293
|
const updatedMessages = this.updateMessagesToHideWorkingMemory(messages);
|
|
302
294
|
const config = this.getMergedThreadConfig(memoryConfig);
|
|
@@ -380,7 +372,6 @@ var Memory = class extends MastraMemory {
|
|
|
380
372
|
}
|
|
381
373
|
async getWorkingMemory({ threadId }) {
|
|
382
374
|
if (!this.threadConfig.workingMemory?.enabled) return null;
|
|
383
|
-
await this.storage.init();
|
|
384
375
|
const thread = await this.storage.getThreadById({ threadId });
|
|
385
376
|
if (!thread) return this.threadConfig?.workingMemory?.template || this.defaultWorkingMemoryTemplate;
|
|
386
377
|
const memory = thread.metadata?.workingMemory || this.threadConfig.workingMemory.template || this.defaultWorkingMemoryTemplate;
|
|
@@ -400,7 +391,6 @@ var Memory = class extends MastraMemory {
|
|
|
400
391
|
if (!newMemory) {
|
|
401
392
|
return;
|
|
402
393
|
}
|
|
403
|
-
await this.storage.init();
|
|
404
394
|
const thread = await this.storage.getThreadById({ threadId });
|
|
405
395
|
if (!thread) return;
|
|
406
396
|
await this.storage.updateThread({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/memory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"typescript": "^5.8.2",
|
|
53
53
|
"typescript-eslint": "^8.26.1",
|
|
54
54
|
"vitest": "^3.1.2",
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
55
|
+
"@internal/lint": "0.0.6",
|
|
56
|
+
"@mastra/core": "0.10.1-alpha.3"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@mastra/core": "^0.
|
|
59
|
+
"@mastra/core": "^0.10.0"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"check": "tsc --noEmit",
|
package/src/index.ts
CHANGED
|
@@ -37,7 +37,6 @@ export class Memory extends MastraMemory {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
private async validateThreadIsOwnedByResource(threadId: string, resourceId: string) {
|
|
40
|
-
await this.storage.init();
|
|
41
40
|
const thread = await this.storage.getThreadById({ threadId });
|
|
42
41
|
if (!thread) {
|
|
43
42
|
throw new Error(`No thread found with id ${threadId}`);
|
|
@@ -114,7 +113,6 @@ export class Memory extends MastraMemory {
|
|
|
114
113
|
);
|
|
115
114
|
}
|
|
116
115
|
|
|
117
|
-
await this.storage.init();
|
|
118
116
|
// Get raw messages from storage
|
|
119
117
|
const rawMessages = await this.storage.getMessages({
|
|
120
118
|
threadId,
|
|
@@ -195,12 +193,10 @@ export class Memory extends MastraMemory {
|
|
|
195
193
|
}
|
|
196
194
|
|
|
197
195
|
async getThreadById({ threadId }: { threadId: string }): Promise<StorageThreadType | null> {
|
|
198
|
-
await this.storage.init();
|
|
199
196
|
return this.storage.getThreadById({ threadId });
|
|
200
197
|
}
|
|
201
198
|
|
|
202
199
|
async getThreadsByResourceId({ resourceId }: { resourceId: string }): Promise<StorageThreadType[]> {
|
|
203
|
-
await this.storage.init();
|
|
204
200
|
return this.storage.getThreadsByResourceId({ resourceId });
|
|
205
201
|
}
|
|
206
202
|
|
|
@@ -211,7 +207,6 @@ export class Memory extends MastraMemory {
|
|
|
211
207
|
thread: StorageThreadType;
|
|
212
208
|
memoryConfig?: MemoryConfig;
|
|
213
209
|
}): Promise<StorageThreadType> {
|
|
214
|
-
await this.storage.init();
|
|
215
210
|
const config = this.getMergedThreadConfig(memoryConfig || {});
|
|
216
211
|
|
|
217
212
|
if (config.workingMemory?.enabled && !thread?.metadata?.workingMemory) {
|
|
@@ -237,7 +232,6 @@ export class Memory extends MastraMemory {
|
|
|
237
232
|
title: string;
|
|
238
233
|
metadata: Record<string, unknown>;
|
|
239
234
|
}): Promise<StorageThreadType> {
|
|
240
|
-
await this.storage.init();
|
|
241
235
|
return this.storage.updateThread({
|
|
242
236
|
id,
|
|
243
237
|
title,
|
|
@@ -246,7 +240,6 @@ export class Memory extends MastraMemory {
|
|
|
246
240
|
}
|
|
247
241
|
|
|
248
242
|
async deleteThread(threadId: string): Promise<void> {
|
|
249
|
-
await this.storage.init();
|
|
250
243
|
await this.storage.deleteThread({ threadId });
|
|
251
244
|
}
|
|
252
245
|
|
|
@@ -334,7 +327,6 @@ export class Memory extends MastraMemory {
|
|
|
334
327
|
messages: MessageType[];
|
|
335
328
|
memoryConfig?: MemoryConfig;
|
|
336
329
|
}): Promise<MessageType[]> {
|
|
337
|
-
await this.storage.init();
|
|
338
330
|
// First save working memory from any messages
|
|
339
331
|
await this.saveWorkingMemory(messages);
|
|
340
332
|
|
|
@@ -452,7 +444,6 @@ export class Memory extends MastraMemory {
|
|
|
452
444
|
public async getWorkingMemory({ threadId }: { threadId: string }): Promise<string | null> {
|
|
453
445
|
if (!this.threadConfig.workingMemory?.enabled) return null;
|
|
454
446
|
|
|
455
|
-
await this.storage.init();
|
|
456
447
|
// Get thread from storage
|
|
457
448
|
const thread = await this.storage.getThreadById({ threadId });
|
|
458
449
|
if (!thread) return this.threadConfig?.workingMemory?.template || this.defaultWorkingMemoryTemplate;
|
|
@@ -492,7 +483,6 @@ export class Memory extends MastraMemory {
|
|
|
492
483
|
return;
|
|
493
484
|
}
|
|
494
485
|
|
|
495
|
-
await this.storage.init();
|
|
496
486
|
const thread = await this.storage.getThreadById({ threadId });
|
|
497
487
|
if (!thread) return;
|
|
498
488
|
|