@mastra/memory 0.2.0-alpha.9 → 0.2.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.
@@ -1,27 +1,27 @@
1
1
 
2
- > @mastra/memory@0.2.0-alpha.9 build /home/runner/work/mastra/mastra/packages/memory
3
- > pnpm run check && tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake
2
+ > @mastra/memory@0.2.1-alpha.0 build /home/runner/work/mastra/mastra/packages/memory
3
+ > pnpm run check && tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
4
4
 
5
5
 
6
- > @mastra/memory@0.2.0-alpha.9 check /home/runner/work/mastra/mastra/packages/memory
6
+ > @mastra/memory@0.2.1-alpha.0 check /home/runner/work/mastra/mastra/packages/memory
7
7
  > tsc --noEmit
8
8
 
9
9
  CLI Building entry: src/index.ts
10
10
  CLI Using tsconfig: tsconfig.json
11
- CLI tsup v8.3.6
11
+ CLI tsup v8.4.0
12
12
  TSC Build start
13
- TSC ⚡️ Build success in 7895ms
13
+ TSC ⚡️ Build success in 8908ms
14
14
  DTS Build start
15
15
  CLI Target: es2022
16
16
  Analysis will use the bundled TypeScript version 5.7.3
17
17
  Writing package typings: /home/runner/work/mastra/mastra/packages/memory/dist/_tsup-dts-rollup.d.ts
18
18
  Analysis will use the bundled TypeScript version 5.7.3
19
19
  Writing package typings: /home/runner/work/mastra/mastra/packages/memory/dist/_tsup-dts-rollup.d.cts
20
- DTS ⚡️ Build success in 10433ms
20
+ DTS ⚡️ Build success in 9605ms
21
21
  CLI Cleaning output folder
22
22
  ESM Build start
23
23
  CJS Build start
24
- ESM dist/index.js 12.79 KB
25
- ESM ⚡️ Build success in 607ms
26
- CJS dist/index.cjs 12.83 KB
27
- CJS ⚡️ Build success in 607ms
24
+ ESM dist/index.js 12.85 KB
25
+ ESM ⚡️ Build success in 540ms
26
+ CJS dist/index.cjs 12.88 KB
27
+ CJS ⚡️ Build success in 540ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,90 @@
1
1
  # @mastra/memory
2
2
 
3
+ ## 0.2.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 3729dbd: Fixed a bug where useChat with client side tool calling and Memory would not work. Added docs for using Memory with useChat()
8
+ - Updated dependencies [3729dbd]
9
+ - @mastra/core@0.5.1-alpha.0
10
+
11
+ ## 0.2.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 59df7b6: Added a new option to use tool-calls for saving working memory: new Memory({ workingMemory: { enabled: true, use: "tool-call" } }). This is to support response methods like toDataStream where masking working memory chunks would be more resource intensive and complex.
16
+ To support this `memory` is now passed into tool execute args.
17
+
18
+ ### Patch Changes
19
+
20
+ - c151ae6: Fixed an issue where models that don't support structured output would error when generating a thread title. Added an option to disable thread title llm generation `new Memory({ threads: { generateTitle: false }})`
21
+ - f2301de: Added the ability to ensure the accessed thread in memory.query() is for the right resource id. ex memory.query({ threadId, resourceId }). If the resourceId doesn't own the thread it will throw an error.
22
+ - fd4a1d7: Update cjs bundling to make sure files are split
23
+ - Updated dependencies [a910463]
24
+ - Updated dependencies [59df7b6]
25
+ - Updated dependencies [22643eb]
26
+ - Updated dependencies [6feb23f]
27
+ - Updated dependencies [f2d6727]
28
+ - Updated dependencies [7a7a547]
29
+ - Updated dependencies [29f3a82]
30
+ - Updated dependencies [3d0e290]
31
+ - Updated dependencies [e9fbac5]
32
+ - Updated dependencies [301e4ee]
33
+ - Updated dependencies [ee667a2]
34
+ - Updated dependencies [dfbe4e9]
35
+ - Updated dependencies [dab255b]
36
+ - Updated dependencies [1e8bcbc]
37
+ - Updated dependencies [f6678e4]
38
+ - Updated dependencies [9e81f35]
39
+ - Updated dependencies [c93798b]
40
+ - Updated dependencies [a85ab24]
41
+ - Updated dependencies [dbd9f2d]
42
+ - Updated dependencies [59df7b6]
43
+ - Updated dependencies [caefaa2]
44
+ - Updated dependencies [c151ae6]
45
+ - Updated dependencies [52e0418]
46
+ - Updated dependencies [d79aedf]
47
+ - Updated dependencies [03236ec]
48
+ - Updated dependencies [3764e71]
49
+ - Updated dependencies [df982db]
50
+ - Updated dependencies [a171b37]
51
+ - Updated dependencies [506f1d5]
52
+ - Updated dependencies [02ffb7b]
53
+ - Updated dependencies [0461849]
54
+ - Updated dependencies [2259379]
55
+ - Updated dependencies [aeb5e36]
56
+ - Updated dependencies [f2301de]
57
+ - Updated dependencies [358f069]
58
+ - Updated dependencies [fd4a1d7]
59
+ - Updated dependencies [c139344]
60
+ - @mastra/core@0.5.0
61
+
62
+ ## 0.2.0-alpha.12
63
+
64
+ ### Patch Changes
65
+
66
+ - Updated dependencies [a85ab24]
67
+ - @mastra/core@0.5.0-alpha.12
68
+
69
+ ## 0.2.0-alpha.11
70
+
71
+ ### Patch Changes
72
+
73
+ - fd4a1d7: Update cjs bundling to make sure files are split
74
+ - Updated dependencies [7a7a547]
75
+ - Updated dependencies [c93798b]
76
+ - Updated dependencies [dbd9f2d]
77
+ - Updated dependencies [a171b37]
78
+ - Updated dependencies [fd4a1d7]
79
+ - @mastra/core@0.5.0-alpha.11
80
+
81
+ ## 0.2.0-alpha.10
82
+
83
+ ### Patch Changes
84
+
85
+ - Updated dependencies [a910463]
86
+ - @mastra/core@0.5.0-alpha.10
87
+
3
88
  ## 0.2.0-alpha.9
4
89
 
5
90
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -77,7 +77,7 @@ var Memory = class extends memory.MastraMemory {
77
77
  topK: config?.semanticRecall?.topK ?? 2,
78
78
  messageRange: config?.semanticRecall?.messageRange ?? { before: 2, after: 2 }
79
79
  };
80
- if (config?.semanticRecall && selectBy?.vectorSearchString && this.vector) {
80
+ if (config?.semanticRecall && selectBy?.vectorSearchString && this.vector && !!selectBy.vectorSearchString) {
81
81
  const { embedding } = await ai.embed({
82
82
  value: selectBy.vectorSearchString,
83
83
  model: this.embedder
@@ -186,7 +186,7 @@ var Memory = class extends memory.MastraMemory {
186
186
  if (this.vector && config.semanticRecall) {
187
187
  const { indexName } = await this.createEmbeddingIndex();
188
188
  for (const message of messages) {
189
- if (typeof message.content !== `string`) continue;
189
+ if (typeof message.content !== `string` || message.content === "") continue;
190
190
  const { embedding } = await ai.embed({ value: message.content, model: this.embedder, maxRetries: 3 });
191
191
  await this.vector.upsert({
192
192
  indexName,
package/dist/index.js CHANGED
@@ -75,7 +75,7 @@ var Memory = class extends MastraMemory {
75
75
  topK: config?.semanticRecall?.topK ?? 2,
76
76
  messageRange: config?.semanticRecall?.messageRange ?? { before: 2, after: 2 }
77
77
  };
78
- if (config?.semanticRecall && selectBy?.vectorSearchString && this.vector) {
78
+ if (config?.semanticRecall && selectBy?.vectorSearchString && this.vector && !!selectBy.vectorSearchString) {
79
79
  const { embedding } = await embed({
80
80
  value: selectBy.vectorSearchString,
81
81
  model: this.embedder
@@ -184,7 +184,7 @@ var Memory = class extends MastraMemory {
184
184
  if (this.vector && config.semanticRecall) {
185
185
  const { indexName } = await this.createEmbeddingIndex();
186
186
  for (const message of messages) {
187
- if (typeof message.content !== `string`) continue;
187
+ if (typeof message.content !== `string` || message.content === "") continue;
188
188
  const { embedding } = await embed({ value: message.content, model: this.embedder, maxRetries: 3 });
189
189
  await this.vector.upsert({
190
190
  indexName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/memory",
3
- "version": "0.2.0-alpha.9",
3
+ "version": "0.2.1-alpha.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -42,29 +42,29 @@
42
42
  "author": "",
43
43
  "license": "ISC",
44
44
  "dependencies": {
45
- "@upstash/redis": "^1.34.3",
46
- "ai": "^4.0.12",
47
- "pg": "^8.13.1",
48
- "pg-pool": "^3.7.0",
45
+ "@upstash/redis": "^1.34.5",
46
+ "ai": "^4.1.54",
47
+ "pg": "^8.13.3",
48
+ "pg-pool": "^3.7.1",
49
49
  "postgres": "^3.4.5",
50
50
  "redis": "^4.7.0",
51
- "zod": "^3.24.1",
52
- "@mastra/core": "^0.5.0-alpha.9"
51
+ "zod": "^3.24.2",
52
+ "@mastra/core": "^0.5.1-alpha.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@microsoft/api-extractor": "^7.49.2",
56
- "@types/node": "^22.13.1",
57
- "@types/pg": "^8.11.10",
58
- "eslint": "^9.20.1",
59
- "tsup": "^8.0.1",
60
- "typescript": "^5.7.3",
61
- "typescript-eslint": "^8.20.0",
62
- "vitest": "^3.0.4",
63
- "@internal/lint": "0.0.0"
55
+ "@microsoft/api-extractor": "^7.52.1",
56
+ "@types/node": "^22.13.10",
57
+ "@types/pg": "^8.11.11",
58
+ "eslint": "^9.22.0",
59
+ "tsup": "^8.4.0",
60
+ "typescript": "^5.8.2",
61
+ "typescript-eslint": "^8.26.1",
62
+ "vitest": "^3.0.8",
63
+ "@internal/lint": "0.0.1"
64
64
  },
65
65
  "scripts": {
66
66
  "check": "tsc --noEmit",
67
- "build": "pnpm run check && tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake",
67
+ "build": "pnpm run check && tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
68
68
  "build:watch": "pnpm build --watch",
69
69
  "test:integration": "cd integration-tests && pnpm run test",
70
70
  "test": "pnpm test:integration",
package/src/index.ts CHANGED
@@ -71,7 +71,7 @@ export class Memory extends MastraMemory {
71
71
  messageRange: config?.semanticRecall?.messageRange ?? { before: 2, after: 2 },
72
72
  };
73
73
 
74
- if (config?.semanticRecall && selectBy?.vectorSearchString && this.vector) {
74
+ if (config?.semanticRecall && selectBy?.vectorSearchString && this.vector && !!selectBy.vectorSearchString) {
75
75
  const { embedding } = await embed({
76
76
  value: selectBy.vectorSearchString,
77
77
  model: this.embedder,
@@ -239,7 +239,7 @@ export class Memory extends MastraMemory {
239
239
  const { indexName } = await this.createEmbeddingIndex();
240
240
 
241
241
  for (const message of messages) {
242
- if (typeof message.content !== `string`) continue;
242
+ if (typeof message.content !== `string` || message.content === '') continue;
243
243
  const { embedding } = await embed({ value: message.content, model: this.embedder, maxRetries: 3 });
244
244
  await this.vector.upsert({
245
245
  indexName,