@mastra/memory 0.3.2-alpha.6 → 0.3.2
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 +9 -9
- package/CHANGELOG.md +39 -0
- package/dist/index.cjs +9 -2
- package/dist/index.js +9 -2
- package/package.json +4 -4
- package/src/index.ts +17 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
|
|
2
|
-
> @mastra/memory@0.3.2-alpha.
|
|
2
|
+
> @mastra/memory@0.3.2-alpha.7 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.3.2-alpha.
|
|
6
|
+
> @mastra/memory@0.3.2-alpha.7 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 9703ms
|
|
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 10038ms
|
|
21
21
|
[34mCLI[39m Cleaning output folder
|
|
22
22
|
[34mESM[39m Build start
|
|
23
23
|
[34mCJS[39m Build start
|
|
24
|
-
[
|
|
25
|
-
[32mESM[39m [1mdist/processors/index.js [22m[32m5.38 KB[39m
|
|
26
|
-
[32mESM[39m ⚡️ Build success in 718ms
|
|
24
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m18.85 KB[39m
|
|
27
25
|
[32mCJS[39m [1mdist/processors/index.cjs [22m[32m5.59 KB[39m
|
|
28
|
-
[32mCJS[39m
|
|
29
|
-
[
|
|
26
|
+
[32mCJS[39m ⚡️ Build success in 583ms
|
|
27
|
+
[32mESM[39m [1mdist/processors/index.js [22m[32m5.38 KB[39m
|
|
28
|
+
[32mESM[39m [1mdist/index.js [22m[32m18.68 KB[39m
|
|
29
|
+
[32mESM[39m ⚡️ Build success in 584ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# @mastra/memory
|
|
2
2
|
|
|
3
|
+
## 0.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2cf3b8f: dependencies updates:
|
|
8
|
+
- Updated dependency [`zod@^3.24.3` ↗︎](https://www.npmjs.com/package/zod/v/3.24.3) (from `^3.24.2`, in `dependencies`)
|
|
9
|
+
- 67e14dd: Allow for textpart message content to be embedded into vectors
|
|
10
|
+
- 544767d: Improved token estimation in TokenLimiter from 96% accuracy back to 99%
|
|
11
|
+
- 17826a9: Added a breaking change warning about deprecated working memory "use: 'text-stream'" which is being fully replaced by "use: 'tool-call'"
|
|
12
|
+
- Updated dependencies [6052aa6]
|
|
13
|
+
- Updated dependencies [967b41c]
|
|
14
|
+
- Updated dependencies [3d2fb5c]
|
|
15
|
+
- Updated dependencies [26738f4]
|
|
16
|
+
- Updated dependencies [4155f47]
|
|
17
|
+
- Updated dependencies [7eeb2bc]
|
|
18
|
+
- Updated dependencies [b804723]
|
|
19
|
+
- Updated dependencies [8607972]
|
|
20
|
+
- Updated dependencies [ccef9f9]
|
|
21
|
+
- Updated dependencies [0097d50]
|
|
22
|
+
- Updated dependencies [7eeb2bc]
|
|
23
|
+
- Updated dependencies [17826a9]
|
|
24
|
+
- Updated dependencies [7d8b7c7]
|
|
25
|
+
- Updated dependencies [fba031f]
|
|
26
|
+
- Updated dependencies [3a5f1e1]
|
|
27
|
+
- Updated dependencies [51e6923]
|
|
28
|
+
- Updated dependencies [8398d89]
|
|
29
|
+
- @mastra/core@0.9.2
|
|
30
|
+
|
|
31
|
+
## 0.3.2-alpha.7
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- 67e14dd: Allow for textpart message content to be embedded into vectors
|
|
36
|
+
- Updated dependencies [6052aa6]
|
|
37
|
+
- Updated dependencies [7d8b7c7]
|
|
38
|
+
- Updated dependencies [3a5f1e1]
|
|
39
|
+
- Updated dependencies [8398d89]
|
|
40
|
+
- @mastra/core@0.9.2-alpha.6
|
|
41
|
+
|
|
3
42
|
## 0.3.2-alpha.6
|
|
4
43
|
|
|
5
44
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -301,8 +301,15 @@ var Memory = class extends memory.MastraMemory {
|
|
|
301
301
|
let indexName;
|
|
302
302
|
await Promise.all(
|
|
303
303
|
updatedMessages.map(async (message) => {
|
|
304
|
-
|
|
305
|
-
|
|
304
|
+
let textForEmbedding = null;
|
|
305
|
+
if (typeof message.content === "string" && message.content.trim() !== "") {
|
|
306
|
+
textForEmbedding = message.content;
|
|
307
|
+
} else if (Array.isArray(message.content)) {
|
|
308
|
+
const joined = message.content.filter((part) => part && part.type === "text" && typeof part.text === "string").map((part) => part.text).join(" ").trim();
|
|
309
|
+
if (joined) textForEmbedding = joined;
|
|
310
|
+
}
|
|
311
|
+
if (!textForEmbedding) return;
|
|
312
|
+
const { embeddings, chunks, dimension } = await this.embedMessageContent(textForEmbedding);
|
|
306
313
|
if (typeof indexName === `undefined`) {
|
|
307
314
|
indexName = this.createEmbeddingIndex(dimension).then((result2) => result2.indexName);
|
|
308
315
|
}
|
package/dist/index.js
CHANGED
|
@@ -295,8 +295,15 @@ var Memory = class extends MastraMemory {
|
|
|
295
295
|
let indexName;
|
|
296
296
|
await Promise.all(
|
|
297
297
|
updatedMessages.map(async (message) => {
|
|
298
|
-
|
|
299
|
-
|
|
298
|
+
let textForEmbedding = null;
|
|
299
|
+
if (typeof message.content === "string" && message.content.trim() !== "") {
|
|
300
|
+
textForEmbedding = message.content;
|
|
301
|
+
} else if (Array.isArray(message.content)) {
|
|
302
|
+
const joined = message.content.filter((part) => part && part.type === "text" && typeof part.text === "string").map((part) => part.text).join(" ").trim();
|
|
303
|
+
if (joined) textForEmbedding = joined;
|
|
304
|
+
}
|
|
305
|
+
if (!textForEmbedding) return;
|
|
306
|
+
const { embeddings, chunks, dimension } = await this.embedMessageContent(textForEmbedding);
|
|
300
307
|
if (typeof indexName === `undefined`) {
|
|
301
308
|
indexName = this.createEmbeddingIndex(dimension).then((result2) => result2.indexName);
|
|
302
309
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/memory",
|
|
3
|
-
"version": "0.3.2
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"postgres": "^3.4.5",
|
|
41
41
|
"redis": "^4.7.0",
|
|
42
42
|
"xxhash-wasm": "^1.1.0",
|
|
43
|
-
"zod": "^3.24.
|
|
44
|
-
"@mastra/core": "^0.9.2
|
|
43
|
+
"zod": "^3.24.3",
|
|
44
|
+
"@mastra/core": "^0.9.2"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@ai-sdk/openai": "^1.3.3",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"typescript": "^5.8.2",
|
|
54
54
|
"typescript-eslint": "^8.26.1",
|
|
55
55
|
"vitest": "^3.1.2",
|
|
56
|
-
"@internal/lint": "0.0.
|
|
56
|
+
"@internal/lint": "0.0.3"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"check": "tsc --noEmit",
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { MastraMemory } from '@mastra/core/memory';
|
|
|
4
4
|
import type { MessageType, MemoryConfig, SharedMemoryConfig, StorageThreadType } from '@mastra/core/memory';
|
|
5
5
|
import type { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
6
6
|
import { embedMany } from 'ai';
|
|
7
|
+
import type { TextPart } from 'ai';
|
|
7
8
|
|
|
8
9
|
import xxhash from 'xxhash-wasm';
|
|
9
10
|
import { updateWorkingMemoryTool } from './tools/working-memory';
|
|
@@ -337,9 +338,23 @@ export class Memory extends MastraMemory {
|
|
|
337
338
|
let indexName: Promise<string>;
|
|
338
339
|
await Promise.all(
|
|
339
340
|
updatedMessages.map(async message => {
|
|
340
|
-
|
|
341
|
+
let textForEmbedding: string | null = null;
|
|
342
|
+
|
|
343
|
+
if (typeof message.content === 'string' && message.content.trim() !== '') {
|
|
344
|
+
textForEmbedding = message.content;
|
|
345
|
+
} else if (Array.isArray(message.content)) {
|
|
346
|
+
// Extract text from all text parts, concatenate
|
|
347
|
+
const joined = message.content
|
|
348
|
+
.filter(part => part && part.type === 'text' && typeof part.text === 'string')
|
|
349
|
+
.map(part => (part as TextPart).text)
|
|
350
|
+
.join(' ')
|
|
351
|
+
.trim();
|
|
352
|
+
if (joined) textForEmbedding = joined;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (!textForEmbedding) return;
|
|
341
356
|
|
|
342
|
-
const { embeddings, chunks, dimension } = await this.embedMessageContent(
|
|
357
|
+
const { embeddings, chunks, dimension } = await this.embedMessageContent(textForEmbedding);
|
|
343
358
|
|
|
344
359
|
if (typeof indexName === `undefined`) {
|
|
345
360
|
indexName = this.createEmbeddingIndex(dimension).then(result => result.indexName);
|