@mastra/memory 0.3.4 → 0.3.5-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,29 +1,29 @@
1
1
 
2
- > @mastra/memory@0.3.4-alpha.4 build /home/runner/work/mastra/mastra/packages/memory
2
+ > @mastra/memory@0.3.5-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.3.4-alpha.4 check /home/runner/work/mastra/mastra/packages/memory
6
+ > @mastra/memory@0.3.5-alpha.0 check /home/runner/work/mastra/mastra/packages/memory
7
7
  > tsc --noEmit
8
8
 
9
9
  CLI Building entry: src/index.ts, src/processors/index.ts
10
10
  CLI Using tsconfig: tsconfig.json
11
11
  CLI tsup v8.4.0
12
12
  TSC Build start
13
- TSC ⚡️ Build success in 9370ms
13
+ TSC ⚡️ Build success in 9856ms
14
14
  DTS Build start
15
15
  CLI Target: es2022
16
16
  Analysis will use the bundled TypeScript version 5.8.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.8.3
19
19
  Writing package typings: /home/runner/work/mastra/mastra/packages/memory/dist/_tsup-dts-rollup.d.cts
20
- DTS ⚡️ Build success in 12100ms
20
+ DTS ⚡️ Build success in 11835ms
21
21
  CLI Cleaning output folder
22
22
  ESM Build start
23
23
  CJS Build start
24
- ESM dist/index.js 18.68 KB
25
- ESM dist/processors/index.js 5.38 KB
26
- ESM ⚡️ Build success in 1009ms
27
24
  CJS dist/index.cjs 18.85 KB
28
25
  CJS dist/processors/index.cjs 5.59 KB
29
- CJS ⚡️ Build success in 1012ms
26
+ CJS ⚡️ Build success in 740ms
27
+ ESM dist/index.js 18.68 KB
28
+ ESM dist/processors/index.js 5.38 KB
29
+ ESM ⚡️ Build success in 740ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @mastra/memory
2
2
 
3
+ ## 0.3.5-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 3cd7aee: [MASTRA-3439] Working Memory tool call fix: Updated saveMessages to filter out workingmemory content from messages, rather than skip message completely
8
+ - Updated dependencies [f53a6ac]
9
+ - Updated dependencies [eabdcd9]
10
+ - Updated dependencies [90be034]
11
+ - Updated dependencies [99f050a]
12
+ - Updated dependencies [d0ee3c6]
13
+ - Updated dependencies [23f258c]
14
+ - Updated dependencies [2672a05]
15
+ - @mastra/core@0.9.5-alpha.0
16
+
3
17
  ## 0.3.4
4
18
 
5
19
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -342,13 +342,13 @@ var Memory = class extends memory.MastraMemory {
342
342
  content: message.content.replace(workingMemoryRegex, ``).trim()
343
343
  });
344
344
  } else if (Array.isArray(message?.content)) {
345
- const contentIsWorkingMemory = message.content.some(
346
- (content) => (content.type === `tool-call` || content.type === `tool-result`) && content.toolName === `updateWorkingMemory`
345
+ const filteredContent = message.content.filter(
346
+ (content) => !((content.type === "tool-call" || content.type === "tool-result") && content.toolName === "updateWorkingMemory")
347
347
  );
348
- if (contentIsWorkingMemory) {
348
+ if (filteredContent.length === 0) {
349
349
  continue;
350
350
  }
351
- const newContent = message.content.map((content) => {
351
+ const newContent = filteredContent.map((content) => {
352
352
  if (content.type === "text") {
353
353
  return {
354
354
  ...content,
package/dist/index.js CHANGED
@@ -336,13 +336,13 @@ var Memory = class extends MastraMemory {
336
336
  content: message.content.replace(workingMemoryRegex, ``).trim()
337
337
  });
338
338
  } else if (Array.isArray(message?.content)) {
339
- const contentIsWorkingMemory = message.content.some(
340
- (content) => (content.type === `tool-call` || content.type === `tool-result`) && content.toolName === `updateWorkingMemory`
339
+ const filteredContent = message.content.filter(
340
+ (content) => !((content.type === "tool-call" || content.type === "tool-result") && content.toolName === "updateWorkingMemory")
341
341
  );
342
- if (contentIsWorkingMemory) {
342
+ if (filteredContent.length === 0) {
343
343
  continue;
344
344
  }
345
- const newContent = message.content.map((content) => {
345
+ const newContent = filteredContent.map((content) => {
346
346
  if (content.type === "text") {
347
347
  return {
348
348
  ...content,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/memory",
3
- "version": "0.3.4",
3
+ "version": "0.3.5-alpha.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -41,7 +41,7 @@
41
41
  "redis": "^4.7.0",
42
42
  "xxhash-wasm": "^1.1.0",
43
43
  "zod": "^3.24.3",
44
- "@mastra/core": "^0.9.4"
44
+ "@mastra/core": "^0.9.5-alpha.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@ai-sdk/openai": "^1.3.3",
package/src/index.ts CHANGED
@@ -394,15 +394,19 @@ export class Memory extends MastraMemory {
394
394
  content: message.content.replace(workingMemoryRegex, ``).trim(),
395
395
  });
396
396
  } else if (Array.isArray(message?.content)) {
397
- const contentIsWorkingMemory = message.content.some(
397
+ // Filter out updateWorkingMemory tool-call/result content items
398
+ const filteredContent = message.content.filter(
398
399
  content =>
399
- (content.type === `tool-call` || content.type === `tool-result`) &&
400
- content.toolName === `updateWorkingMemory`,
400
+ !(
401
+ (content.type === 'tool-call' || content.type === 'tool-result') &&
402
+ content.toolName === 'updateWorkingMemory'
403
+ ),
401
404
  );
402
- if (contentIsWorkingMemory) {
405
+ if (filteredContent.length === 0) {
406
+ // If nothing left, skip this message
403
407
  continue;
404
408
  }
405
- const newContent = message.content.map(content => {
409
+ const newContent = filteredContent.map(content => {
406
410
  if (content.type === 'text') {
407
411
  return {
408
412
  ...content,