@mastra/memory 0.3.1-alpha.0 → 0.3.1-alpha.1

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.1-alpha.0 build /home/runner/work/mastra/mastra/packages/memory
2
+ > @mastra/memory@0.3.1-alpha.1 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.1-alpha.0 check /home/runner/work/mastra/mastra/packages/memory
6
+ > @mastra/memory@0.3.1-alpha.1 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 10198ms
13
+ TSC ⚡️ Build success in 9763ms
14
14
  DTS Build start
15
15
  CLI Target: es2022
16
16
  Analysis will use the bundled TypeScript version 5.8.2
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.2
19
19
  Writing package typings: /home/runner/work/mastra/mastra/packages/memory/dist/_tsup-dts-rollup.d.cts
20
- DTS ⚡️ Build success in 11582ms
20
+ DTS ⚡️ Build success in 10462ms
21
21
  CLI Cleaning output folder
22
22
  ESM Build start
23
23
  CJS Build start
24
- ESM dist/index.js 17.83 KB
25
- ESM dist/processors/index.js 5.38 KB
26
- ESM ⚡️ Build success in 1027ms
27
24
  CJS dist/processors/index.cjs 5.59 KB
28
- CJS dist/index.cjs 18.02 KB
29
- CJS ⚡️ Build success in 1027ms
25
+ CJS dist/index.cjs 18.17 KB
26
+ CJS ⚡️ Build success in 654ms
27
+ ESM dist/processors/index.js 5.38 KB
28
+ ESM dist/index.js 17.99 KB
29
+ ESM ⚡️ Build success in 658ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @mastra/memory
2
2
 
3
+ ## 0.3.1-alpha.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 20275d4: Adding warnings for current implicit Memory default options as they will be changing soon in a breaking change. Also added memory to create-mastra w/ new defaults so new projects don't see these warnings
8
+ - Updated dependencies [20275d4]
9
+ - Updated dependencies [7d1892c]
10
+ - Updated dependencies [a90a082]
11
+ - Updated dependencies [35955b0]
12
+ - Updated dependencies [c1409ef]
13
+ - Updated dependencies [11d4485]
14
+ - Updated dependencies [2d4001d]
15
+ - @mastra/core@0.9.1-alpha.1
16
+
3
17
  ## 0.3.1-alpha.0
4
18
 
5
19
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -118,12 +118,14 @@ var Memory = class extends memory.MastraMemory {
118
118
  threadConfig
119
119
  });
120
120
  const config = this.getMergedThreadConfig(threadConfig || {});
121
+ const defaultRange = core.memoryDefaultOptions.semanticRecall.messageRange;
122
+ const defaultTopK = core.memoryDefaultOptions.semanticRecall.topK;
121
123
  const vectorConfig = typeof config?.semanticRecall === `boolean` ? {
122
- topK: 2,
123
- messageRange: { before: 2, after: 2 }
124
+ topK: defaultTopK,
125
+ messageRange: defaultRange
124
126
  } : {
125
- topK: config?.semanticRecall?.topK ?? 2,
126
- messageRange: config?.semanticRecall?.messageRange ?? { before: 2, after: 2 }
127
+ topK: config?.semanticRecall?.topK ?? defaultTopK,
128
+ messageRange: config?.semanticRecall?.messageRange ?? defaultRange
127
129
  };
128
130
  if (config?.semanticRecall && selectBy?.vectorSearchString && this.vector && !!selectBy.vectorSearchString) {
129
131
  const { embeddings, dimension } = await this.embedMessageContent(selectBy.vectorSearchString);
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { deepMerge } from '@mastra/core';
1
+ import { memoryDefaultOptions, deepMerge } from '@mastra/core';
2
2
  import { MastraMemory } from '@mastra/core/memory';
3
3
  import { embedMany } from 'ai';
4
4
  import xxhash from 'xxhash-wasm';
@@ -112,12 +112,14 @@ var Memory = class extends MastraMemory {
112
112
  threadConfig
113
113
  });
114
114
  const config = this.getMergedThreadConfig(threadConfig || {});
115
+ const defaultRange = memoryDefaultOptions.semanticRecall.messageRange;
116
+ const defaultTopK = memoryDefaultOptions.semanticRecall.topK;
115
117
  const vectorConfig = typeof config?.semanticRecall === `boolean` ? {
116
- topK: 2,
117
- messageRange: { before: 2, after: 2 }
118
+ topK: defaultTopK,
119
+ messageRange: defaultRange
118
120
  } : {
119
- topK: config?.semanticRecall?.topK ?? 2,
120
- messageRange: config?.semanticRecall?.messageRange ?? { before: 2, after: 2 }
121
+ topK: config?.semanticRecall?.topK ?? defaultTopK,
122
+ messageRange: config?.semanticRecall?.messageRange ?? defaultRange
121
123
  };
122
124
  if (config?.semanticRecall && selectBy?.vectorSearchString && this.vector && !!selectBy.vectorSearchString) {
123
125
  const { embeddings, dimension } = await this.embedMessageContent(selectBy.vectorSearchString);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/memory",
3
- "version": "0.3.1-alpha.0",
3
+ "version": "0.3.1-alpha.1",
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.2",
44
- "@mastra/core": "^0.9.1-alpha.0"
44
+ "@mastra/core": "^0.9.1-alpha.1"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@ai-sdk/openai": "^1.3.3",
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { deepMerge } from '@mastra/core';
1
+ import { deepMerge, memoryDefaultOptions } from '@mastra/core';
2
2
  import type { AiMessageType, CoreMessage, CoreTool } from '@mastra/core';
3
3
  import { MastraMemory } from '@mastra/core/memory';
4
4
  import type { MessageType, MemoryConfig, SharedMemoryConfig, StorageThreadType } from '@mastra/core/memory';
@@ -66,15 +66,18 @@ export class Memory extends MastraMemory {
66
66
 
67
67
  const config = this.getMergedThreadConfig(threadConfig || {});
68
68
 
69
+ const defaultRange = memoryDefaultOptions.semanticRecall.messageRange;
70
+ const defaultTopK = memoryDefaultOptions.semanticRecall.topK;
71
+
69
72
  const vectorConfig =
70
73
  typeof config?.semanticRecall === `boolean`
71
74
  ? {
72
- topK: 2,
73
- messageRange: { before: 2, after: 2 },
75
+ topK: defaultTopK,
76
+ messageRange: defaultRange,
74
77
  }
75
78
  : {
76
- topK: config?.semanticRecall?.topK ?? 2,
77
- messageRange: config?.semanticRecall?.messageRange ?? { before: 2, after: 2 },
79
+ topK: config?.semanticRecall?.topK ?? defaultTopK,
80
+ messageRange: config?.semanticRecall?.messageRange ?? defaultRange,
78
81
  };
79
82
 
80
83
  if (config?.semanticRecall && selectBy?.vectorSearchString && this.vector && !!selectBy.vectorSearchString) {