@mastra/core 0.9.0 → 0.9.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.
Files changed (94) hide show
  1. package/dist/agent/index.cjs +2 -2
  2. package/dist/agent/index.d.cts +4 -2
  3. package/dist/agent/index.d.ts +4 -2
  4. package/dist/agent/index.js +1 -1
  5. package/dist/{base-oP3DoUrm.d.cts → base-CZmT-p10.d.cts} +524 -53
  6. package/dist/{base-Bk5V1doj.d.ts → base-DDoWFpFc.d.ts} +524 -53
  7. package/dist/{chunk-NTHHPNOW.js → chunk-34622N67.js} +1 -1
  8. package/dist/{chunk-ATXF6TIO.cjs → chunk-422BXQRT.cjs} +24 -677
  9. package/dist/{chunk-HARYMLZH.js → chunk-4K4DHXRF.js} +6 -658
  10. package/dist/{chunk-N2ONCUUS.js → chunk-6AHC67YY.js} +132 -12
  11. package/dist/chunk-7AGAXO6B.cjs +588 -0
  12. package/dist/{chunk-GEIPVIW4.js → chunk-BFF2O6RO.js} +1 -1
  13. package/dist/{chunk-RASVJ3TR.js → chunk-BU45BMXY.js} +55 -1
  14. package/dist/{chunk-DIZZQ3E5.cjs → chunk-CEXM6WP5.cjs} +2 -2
  15. package/dist/chunk-HNEE7IF4.js +60 -0
  16. package/dist/{chunk-NZDXKMDP.cjs → chunk-LABUWBKX.cjs} +1 -1
  17. package/dist/chunk-MUNFCOMB.cjs +62 -0
  18. package/dist/{chunk-GJWCFDFN.js → chunk-PS2ZF6MA.js} +1 -1
  19. package/dist/{chunk-M472GIT6.js → chunk-SGGPJWRQ.js} +1 -1
  20. package/dist/{chunk-7CSNWYGJ.cjs → chunk-U5DGGGS2.cjs} +2 -2
  21. package/dist/{chunk-W5IA5OGL.cjs → chunk-V7IE36YV.cjs} +58 -4
  22. package/dist/chunk-VMVXIPGW.js +586 -0
  23. package/dist/{chunk-53P5ZBJE.cjs → chunk-YTTBFAQJ.cjs} +2 -2
  24. package/dist/{chunk-KZWBYRXW.cjs → chunk-YZFNMXY4.cjs} +135 -14
  25. package/dist/di/index.cjs +2 -2
  26. package/dist/di/index.d.cts +1 -52
  27. package/dist/di/index.d.ts +1 -52
  28. package/dist/di/index.js +1 -1
  29. package/dist/eval/index.d.cts +4 -2
  30. package/dist/eval/index.d.ts +4 -2
  31. package/dist/index.cjs +60 -55
  32. package/dist/index.d.cts +5 -3
  33. package/dist/index.d.ts +5 -3
  34. package/dist/index.js +10 -9
  35. package/dist/integration/index.cjs +3 -3
  36. package/dist/integration/index.d.cts +4 -2
  37. package/dist/integration/index.d.ts +4 -2
  38. package/dist/integration/index.js +1 -1
  39. package/dist/llm/index.cjs +8 -0
  40. package/dist/llm/index.d.cts +4 -2
  41. package/dist/llm/index.d.ts +4 -2
  42. package/dist/llm/index.js +1 -1
  43. package/dist/mastra/index.cjs +2 -2
  44. package/dist/mastra/index.d.cts +4 -2
  45. package/dist/mastra/index.d.ts +4 -2
  46. package/dist/mastra/index.js +1 -1
  47. package/dist/memory/index.cjs +7 -3
  48. package/dist/memory/index.d.cts +4 -2
  49. package/dist/memory/index.d.ts +4 -2
  50. package/dist/memory/index.js +1 -1
  51. package/dist/network/index.cjs +4 -4
  52. package/dist/network/index.d.cts +4 -2
  53. package/dist/network/index.d.ts +4 -2
  54. package/dist/network/index.js +2 -2
  55. package/dist/relevance/index.cjs +4 -4
  56. package/dist/relevance/index.d.cts +4 -2
  57. package/dist/relevance/index.d.ts +4 -2
  58. package/dist/relevance/index.js +1 -1
  59. package/dist/runtime-context/index.cjs +7 -68
  60. package/dist/runtime-context/index.js +1 -69
  61. package/dist/server/index.d.cts +4 -2
  62. package/dist/server/index.d.ts +4 -2
  63. package/dist/storage/index.d.cts +4 -2
  64. package/dist/storage/index.d.ts +4 -2
  65. package/dist/storage/libsql/index.cjs +19 -0
  66. package/dist/storage/libsql/index.d.cts +7 -8
  67. package/dist/storage/libsql/index.d.ts +7 -8
  68. package/dist/storage/libsql/index.js +19 -0
  69. package/dist/telemetry/index.d.cts +4 -2
  70. package/dist/telemetry/index.d.ts +4 -2
  71. package/dist/tools/index.cjs +4 -4
  72. package/dist/tools/index.d.cts +4 -2
  73. package/dist/tools/index.d.ts +4 -2
  74. package/dist/tools/index.js +1 -1
  75. package/dist/utils.cjs +14 -14
  76. package/dist/utils.d.cts +6 -4
  77. package/dist/utils.d.ts +6 -4
  78. package/dist/utils.js +1 -1
  79. package/dist/voice/index.d.cts +5 -3
  80. package/dist/voice/index.d.ts +5 -3
  81. package/dist/workflows/index.cjs +22 -26
  82. package/dist/workflows/index.d.cts +5 -3
  83. package/dist/workflows/index.d.ts +5 -3
  84. package/dist/workflows/index.js +1 -1
  85. package/dist/workflows/vNext/index.cjs +1058 -0
  86. package/dist/workflows/vNext/index.d.cts +180 -0
  87. package/dist/workflows/vNext/index.d.ts +180 -0
  88. package/dist/workflows/vNext/index.js +1046 -0
  89. package/package.json +11 -1
  90. package/workflows/vNext.d.ts +1 -0
  91. /package/dist/{chunk-WEYWYKLG.cjs → chunk-27PAET7X.cjs} +0 -0
  92. /package/dist/{chunk-FRQFWZDN.cjs → chunk-HSVOEWAM.cjs} +0 -0
  93. /package/dist/{chunk-ZDWFBE5L.js → chunk-NH5WJNNS.js} +0 -0
  94. /package/dist/{chunk-LANFNMEE.js → chunk-SGTFVHOZ.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { LibSQLVector } from './chunk-DGL5RCEO.js';
2
- import { DefaultProxyStorage, augmentWithInit } from './chunk-LANFNMEE.js';
3
- import { deepMerge } from './chunk-NTHHPNOW.js';
2
+ import { DefaultProxyStorage, augmentWithInit } from './chunk-SGTFVHOZ.js';
3
+ import { deepMerge } from './chunk-34622N67.js';
4
4
  import { MastraBase } from './chunk-CLJQYXNM.js';
5
5
  import { existsSync } from 'fs';
6
6
  import { join } from 'path';
@@ -116,20 +116,34 @@ var MemoryProcessor = class extends MastraBase {
116
116
  return messages;
117
117
  }
118
118
  };
119
+ var memoryDefaultOptions = {
120
+ lastMessages: 40,
121
+ semanticRecall: {
122
+ topK: 2,
123
+ messageRange: {
124
+ before: 2,
125
+ after: 2
126
+ }
127
+ },
128
+ threads: {
129
+ generateTitle: true
130
+ }
131
+ };
132
+ var newMemoryDefaultOptions = {
133
+ lastMessages: 10,
134
+ semanticRecall: false,
135
+ threads: {
136
+ generateTitle: false
137
+ }
138
+ };
119
139
  var MastraMemory = class extends MastraBase {
120
140
  MAX_CONTEXT_TOKENS;
121
141
  storage;
122
142
  vector;
123
143
  embedder;
124
144
  processors = [];
125
- threadConfig = {
126
- lastMessages: 40,
127
- semanticRecall: true,
128
- threads: {
129
- generateTitle: true
130
- // TODO: should we disable this by default to reduce latency?
131
- }
132
- };
145
+ deprecationWarnings = [];
146
+ threadConfig = { ...memoryDefaultOptions };
133
147
  constructor(config) {
134
148
  super({ component: "MEMORY", name: config.name });
135
149
  if (config.options) {
@@ -158,10 +172,33 @@ var MastraMemory = class extends MastraBase {
158
172
  const hasOldDb = existsSync(join(process.cwd(), oldDb)) || existsSync(join(process.cwd(), ".mastra", oldDb));
159
173
  const newDb = "memory.db";
160
174
  if (hasOldDb) {
161
- this.logger.warn(
175
+ this.deprecationWarnings.push(
162
176
  `Found deprecated Memory vector db file ${oldDb} this db is now merged with the default ${newDb} file. Delete the old one to use the new one. You will need to migrate any data if that's important to you. For now the deprecated path will be used but in a future breaking change we will only use the new db file path.`
163
177
  );
164
178
  }
179
+ this.deprecationWarnings.push(`
180
+ Default vector storage is deprecated in Mastra Memory.
181
+ You're using it as an implicit default by not setting a vector store.
182
+
183
+ Instead of this:
184
+ export const agent = new Agent({
185
+ memory: new Memory({
186
+ options: { semanticRecall: true }
187
+ })
188
+ })
189
+
190
+ Do this:
191
+ import { LibSQLVector } from '@mastra/libsql';
192
+
193
+ export const agent = new Agent({
194
+ memory: new Memory({
195
+ options: { semanticRecall: true },
196
+ vector: new LibSQLVector({
197
+ connectionUrl: 'file:../memory.db'
198
+ })
199
+ })
200
+ })
201
+ `);
165
202
  this.vector = new LibSQLVector({
166
203
  connectionUrl: hasOldDb ? `file:${oldDb}` : `file:${newDb}`
167
204
  });
@@ -179,8 +216,91 @@ var MastraMemory = class extends MastraBase {
179
216
  if (config.processors) {
180
217
  this.processors = config.processors;
181
218
  }
219
+ this.addImplicitDefaultsWarning(config);
220
+ if (this.deprecationWarnings.length > 0) {
221
+ setTimeout(() => {
222
+ this.logger?.warn(`
223
+
224
+ !MEMORY DEPRECATION WARNING!
225
+ ${this.deprecationWarnings.map((w, i) => `${this.deprecationWarnings.length > 1 ? `Warning ${i + 1}:
226
+ ` : ``}${w}`).join(`
227
+
228
+ `)}
229
+ !END MEMORY DEPRECATION WARNING!
230
+
231
+ `);
232
+ }, 1e3);
233
+ }
234
+ }
235
+ // We're changing the implicit defaults from memoryDefaultOptions to newMemoryDefaultOptions so we need to log and let people know
236
+ addImplicitDefaultsWarning(config) {
237
+ const fromToPairs = [];
238
+ const indent = (s) => s.split(`
239
+ `).join(`
240
+ `);
241
+ const format = (v) => typeof v === `object` && !Array.isArray(v) && v !== null ? indent(JSON.stringify(v, null, 2).replaceAll(`"`, ``)) : v;
242
+ const options = config.options ?? {};
243
+ if (!(`lastMessages` in options))
244
+ fromToPairs.push({
245
+ key: "lastMessages",
246
+ from: memoryDefaultOptions.lastMessages,
247
+ to: newMemoryDefaultOptions.lastMessages
248
+ });
249
+ if (!(`semanticRecall` in options))
250
+ fromToPairs.push({
251
+ key: "semanticRecall",
252
+ from: memoryDefaultOptions.semanticRecall,
253
+ to: newMemoryDefaultOptions.semanticRecall
254
+ });
255
+ if (!(`threads` in options))
256
+ fromToPairs.push({
257
+ key: "threads",
258
+ from: memoryDefaultOptions.threads,
259
+ to: newMemoryDefaultOptions.threads
260
+ });
261
+ if (fromToPairs.length > 0) {
262
+ const currentDefaults = `{
263
+ options: {
264
+ ${fromToPairs.map(({ key, from }) => `${key}: ${format(from)}`).join(`,
265
+ `)}
266
+ }
267
+ }`;
268
+ const upcomingDefaults = `{
269
+ options: {
270
+ ${fromToPairs.map(({ key, to }) => `${key}: ${format(to)}`).join(`,
271
+ `)}
272
+ }
273
+ }`;
274
+ this.deprecationWarnings.push(`
275
+ Your Mastra memory instance has the
276
+ following implicit default options:
277
+
278
+ new Memory(${currentDefaults})
279
+
280
+ In the next release these implicit defaults
281
+ will be changed to the following default settings:
282
+
283
+ new Memory(${upcomingDefaults})
284
+
285
+ To keep your defaults as they are, add
286
+ them directly into your Memory configuration,
287
+ otherwise please add the new settings to
288
+ your memory config to prepare for the change.
289
+ --> This breaking change will be released on May 20th <--
290
+ `);
291
+ }
182
292
  }
183
293
  setStorage(storage) {
294
+ if (storage instanceof DefaultProxyStorage) {
295
+ this.deprecationWarnings.push(`Importing "DefaultStorage" from '@mastra/core/storage/libsql' is deprecated.
296
+
297
+ Instead of:
298
+ import { DefaultStorage } from '@mastra/core/storage/libsql';
299
+
300
+ Do:
301
+ import { LibSQLStore } from '@mastra/libsql';
302
+ `);
303
+ }
184
304
  this.storage = storage;
185
305
  }
186
306
  setVector(vector) {
@@ -410,4 +530,4 @@ var MastraMemory = class extends MastraBase {
410
530
  }
411
531
  };
412
532
 
413
- export { MastraMemory, MemoryProcessor };
533
+ export { MastraMemory, MemoryProcessor, memoryDefaultOptions };