@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,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkTEEAQX2B_cjs = require('./chunk-TEEAQX2B.cjs');
4
- var chunkWEYWYKLG_cjs = require('./chunk-WEYWYKLG.cjs');
5
- var chunk53P5ZBJE_cjs = require('./chunk-53P5ZBJE.cjs');
4
+ var chunk27PAET7X_cjs = require('./chunk-27PAET7X.cjs');
5
+ var chunkYTTBFAQJ_cjs = require('./chunk-YTTBFAQJ.cjs');
6
6
  var chunkD63P5O4Q_cjs = require('./chunk-D63P5O4Q.cjs');
7
7
  var fs = require('fs');
8
8
  var path = require('path');
@@ -123,20 +123,34 @@ var MemoryProcessor = class extends chunkD63P5O4Q_cjs.MastraBase {
123
123
  return messages;
124
124
  }
125
125
  };
126
+ var memoryDefaultOptions = {
127
+ lastMessages: 40,
128
+ semanticRecall: {
129
+ topK: 2,
130
+ messageRange: {
131
+ before: 2,
132
+ after: 2
133
+ }
134
+ },
135
+ threads: {
136
+ generateTitle: true
137
+ }
138
+ };
139
+ var newMemoryDefaultOptions = {
140
+ lastMessages: 10,
141
+ semanticRecall: false,
142
+ threads: {
143
+ generateTitle: false
144
+ }
145
+ };
126
146
  var MastraMemory = class extends chunkD63P5O4Q_cjs.MastraBase {
127
147
  MAX_CONTEXT_TOKENS;
128
148
  storage;
129
149
  vector;
130
150
  embedder;
131
151
  processors = [];
132
- threadConfig = {
133
- lastMessages: 40,
134
- semanticRecall: true,
135
- threads: {
136
- generateTitle: true
137
- // TODO: should we disable this by default to reduce latency?
138
- }
139
- };
152
+ deprecationWarnings = [];
153
+ threadConfig = { ...memoryDefaultOptions };
140
154
  constructor(config) {
141
155
  super({ component: "MEMORY", name: config.name });
142
156
  if (config.options) {
@@ -145,13 +159,13 @@ var MastraMemory = class extends chunkD63P5O4Q_cjs.MastraBase {
145
159
  if (config.storage) {
146
160
  this.storage = config.storage;
147
161
  } else {
148
- this.storage = new chunkWEYWYKLG_cjs.DefaultProxyStorage({
162
+ this.storage = new chunk27PAET7X_cjs.DefaultProxyStorage({
149
163
  config: {
150
164
  url: "file:memory.db"
151
165
  }
152
166
  });
153
167
  }
154
- this.storage = chunkWEYWYKLG_cjs.augmentWithInit(this.storage);
168
+ this.storage = chunk27PAET7X_cjs.augmentWithInit(this.storage);
155
169
  const semanticRecallIsEnabled = this.threadConfig.semanticRecall !== false;
156
170
  if (config.vector && semanticRecallIsEnabled) {
157
171
  this.vector = config.vector;
@@ -165,10 +179,33 @@ var MastraMemory = class extends chunkD63P5O4Q_cjs.MastraBase {
165
179
  const hasOldDb = fs.existsSync(path.join(process.cwd(), oldDb)) || fs.existsSync(path.join(process.cwd(), ".mastra", oldDb));
166
180
  const newDb = "memory.db";
167
181
  if (hasOldDb) {
168
- this.logger.warn(
182
+ this.deprecationWarnings.push(
169
183
  `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.`
170
184
  );
171
185
  }
186
+ this.deprecationWarnings.push(`
187
+ Default vector storage is deprecated in Mastra Memory.
188
+ You're using it as an implicit default by not setting a vector store.
189
+
190
+ Instead of this:
191
+ export const agent = new Agent({
192
+ memory: new Memory({
193
+ options: { semanticRecall: true }
194
+ })
195
+ })
196
+
197
+ Do this:
198
+ import { LibSQLVector } from '@mastra/libsql';
199
+
200
+ export const agent = new Agent({
201
+ memory: new Memory({
202
+ options: { semanticRecall: true },
203
+ vector: new LibSQLVector({
204
+ connectionUrl: 'file:../memory.db'
205
+ })
206
+ })
207
+ })
208
+ `);
172
209
  this.vector = new chunkTEEAQX2B_cjs.LibSQLVector({
173
210
  connectionUrl: hasOldDb ? `file:${oldDb}` : `file:${newDb}`
174
211
  });
@@ -186,8 +223,91 @@ var MastraMemory = class extends chunkD63P5O4Q_cjs.MastraBase {
186
223
  if (config.processors) {
187
224
  this.processors = config.processors;
188
225
  }
226
+ this.addImplicitDefaultsWarning(config);
227
+ if (this.deprecationWarnings.length > 0) {
228
+ setTimeout(() => {
229
+ this.logger?.warn(`
230
+
231
+ !MEMORY DEPRECATION WARNING!
232
+ ${this.deprecationWarnings.map((w, i) => `${this.deprecationWarnings.length > 1 ? `Warning ${i + 1}:
233
+ ` : ``}${w}`).join(`
234
+
235
+ `)}
236
+ !END MEMORY DEPRECATION WARNING!
237
+
238
+ `);
239
+ }, 1e3);
240
+ }
241
+ }
242
+ // We're changing the implicit defaults from memoryDefaultOptions to newMemoryDefaultOptions so we need to log and let people know
243
+ addImplicitDefaultsWarning(config) {
244
+ const fromToPairs = [];
245
+ const indent = (s) => s.split(`
246
+ `).join(`
247
+ `);
248
+ const format = (v) => typeof v === `object` && !Array.isArray(v) && v !== null ? indent(JSON.stringify(v, null, 2).replaceAll(`"`, ``)) : v;
249
+ const options = config.options ?? {};
250
+ if (!(`lastMessages` in options))
251
+ fromToPairs.push({
252
+ key: "lastMessages",
253
+ from: memoryDefaultOptions.lastMessages,
254
+ to: newMemoryDefaultOptions.lastMessages
255
+ });
256
+ if (!(`semanticRecall` in options))
257
+ fromToPairs.push({
258
+ key: "semanticRecall",
259
+ from: memoryDefaultOptions.semanticRecall,
260
+ to: newMemoryDefaultOptions.semanticRecall
261
+ });
262
+ if (!(`threads` in options))
263
+ fromToPairs.push({
264
+ key: "threads",
265
+ from: memoryDefaultOptions.threads,
266
+ to: newMemoryDefaultOptions.threads
267
+ });
268
+ if (fromToPairs.length > 0) {
269
+ const currentDefaults = `{
270
+ options: {
271
+ ${fromToPairs.map(({ key, from }) => `${key}: ${format(from)}`).join(`,
272
+ `)}
273
+ }
274
+ }`;
275
+ const upcomingDefaults = `{
276
+ options: {
277
+ ${fromToPairs.map(({ key, to }) => `${key}: ${format(to)}`).join(`,
278
+ `)}
279
+ }
280
+ }`;
281
+ this.deprecationWarnings.push(`
282
+ Your Mastra memory instance has the
283
+ following implicit default options:
284
+
285
+ new Memory(${currentDefaults})
286
+
287
+ In the next release these implicit defaults
288
+ will be changed to the following default settings:
289
+
290
+ new Memory(${upcomingDefaults})
291
+
292
+ To keep your defaults as they are, add
293
+ them directly into your Memory configuration,
294
+ otherwise please add the new settings to
295
+ your memory config to prepare for the change.
296
+ --> This breaking change will be released on May 20th <--
297
+ `);
298
+ }
189
299
  }
190
300
  setStorage(storage) {
301
+ if (storage instanceof chunk27PAET7X_cjs.DefaultProxyStorage) {
302
+ this.deprecationWarnings.push(`Importing "DefaultStorage" from '@mastra/core/storage/libsql' is deprecated.
303
+
304
+ Instead of:
305
+ import { DefaultStorage } from '@mastra/core/storage/libsql';
306
+
307
+ Do:
308
+ import { LibSQLStore } from '@mastra/libsql';
309
+ `);
310
+ }
191
311
  this.storage = storage;
192
312
  }
193
313
  setVector(vector) {
@@ -227,7 +347,7 @@ var MastraMemory = class extends chunkD63P5O4Q_cjs.MastraBase {
227
347
  return { indexName };
228
348
  }
229
349
  getMergedThreadConfig(config) {
230
- return chunk53P5ZBJE_cjs.deepMerge(this.threadConfig, config || {});
350
+ return chunkYTTBFAQJ_cjs.deepMerge(this.threadConfig, config || {});
231
351
  }
232
352
  /**
233
353
  * Apply all configured message processors to a list of messages.
@@ -419,3 +539,4 @@ var MastraMemory = class extends chunkD63P5O4Q_cjs.MastraBase {
419
539
 
420
540
  exports.MastraMemory = MastraMemory;
421
541
  exports.MemoryProcessor = MemoryProcessor;
542
+ exports.memoryDefaultOptions = memoryDefaultOptions;
package/dist/di/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkNZDXKMDP_cjs = require('../chunk-NZDXKMDP.cjs');
3
+ var chunkLABUWBKX_cjs = require('../chunk-LABUWBKX.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "RuntimeContext", {
8
8
  enumerable: true,
9
- get: function () { return chunkNZDXKMDP_cjs.RuntimeContext; }
9
+ get: function () { return chunkLABUWBKX_cjs.RuntimeContext; }
10
10
  });
@@ -1,52 +1 @@
1
- type RecordToTuple<T> = {
2
- [K in keyof T]: [K, T[K]];
3
- }[keyof T][];
4
- declare class RuntimeContext<Values extends Record<string, any> | unknown = unknown> {
5
- private registry;
6
- constructor(iterable?: Values extends Record<string, any> ? RecordToTuple<Partial<Values>> : Iterable<readonly [string, unknown]>);
7
- /**
8
- * set a value with strict typing if `Values` is a Record and the key exists in it.
9
- */
10
- set<K extends Values extends Record<string, any> ? keyof Values : string>(key: K, value: Values extends Record<string, any> ? (K extends keyof Values ? Values[K] : never) : unknown): void;
11
- /**
12
- * Get a value with its type
13
- */
14
- get<K extends Values extends Record<string, any> ? keyof Values : string, R = Values extends Record<string, any> ? (K extends keyof Values ? Values[K] : never) : unknown>(key: string): R;
15
- /**
16
- * Check if a key exists in the container
17
- */
18
- has<K extends Values extends Record<string, any> ? keyof Values : string>(key: K): boolean;
19
- /**
20
- * Delete a value by key
21
- */
22
- delete<K extends Values extends Record<string, any> ? keyof Values : string>(key: K): boolean;
23
- /**
24
- * Clear all values from the container
25
- */
26
- clear(): void;
27
- /**
28
- * Get all keys in the container
29
- */
30
- keys<R = Values extends Record<string, any> ? keyof Values : string>(): IterableIterator<R>;
31
- /**
32
- * Get all values in the container
33
- */
34
- values<R = Values extends Record<string, any> ? Values[keyof Values] : unknown>(): IterableIterator<R>;
35
- /**
36
- * Get all entries in the container
37
- */
38
- entries<R = Values extends Record<string, any> ? Values[keyof Values] : unknown>(): IterableIterator<[
39
- string,
40
- R
41
- ]>;
42
- /**
43
- * Get the size of the container
44
- */
45
- size(): number;
46
- /**
47
- * Execute a function for each entry in the container
48
- */
49
- forEach<T = any>(callbackfn: (value: T, key: string, map: Map<string, any>) => void): void;
50
- }
51
-
52
- export { RuntimeContext };
1
+ export { RuntimeContext } from '../runtime-context/index.cjs';
@@ -1,52 +1 @@
1
- type RecordToTuple<T> = {
2
- [K in keyof T]: [K, T[K]];
3
- }[keyof T][];
4
- declare class RuntimeContext<Values extends Record<string, any> | unknown = unknown> {
5
- private registry;
6
- constructor(iterable?: Values extends Record<string, any> ? RecordToTuple<Partial<Values>> : Iterable<readonly [string, unknown]>);
7
- /**
8
- * set a value with strict typing if `Values` is a Record and the key exists in it.
9
- */
10
- set<K extends Values extends Record<string, any> ? keyof Values : string>(key: K, value: Values extends Record<string, any> ? (K extends keyof Values ? Values[K] : never) : unknown): void;
11
- /**
12
- * Get a value with its type
13
- */
14
- get<K extends Values extends Record<string, any> ? keyof Values : string, R = Values extends Record<string, any> ? (K extends keyof Values ? Values[K] : never) : unknown>(key: string): R;
15
- /**
16
- * Check if a key exists in the container
17
- */
18
- has<K extends Values extends Record<string, any> ? keyof Values : string>(key: K): boolean;
19
- /**
20
- * Delete a value by key
21
- */
22
- delete<K extends Values extends Record<string, any> ? keyof Values : string>(key: K): boolean;
23
- /**
24
- * Clear all values from the container
25
- */
26
- clear(): void;
27
- /**
28
- * Get all keys in the container
29
- */
30
- keys<R = Values extends Record<string, any> ? keyof Values : string>(): IterableIterator<R>;
31
- /**
32
- * Get all values in the container
33
- */
34
- values<R = Values extends Record<string, any> ? Values[keyof Values] : unknown>(): IterableIterator<R>;
35
- /**
36
- * Get all entries in the container
37
- */
38
- entries<R = Values extends Record<string, any> ? Values[keyof Values] : unknown>(): IterableIterator<[
39
- string,
40
- R
41
- ]>;
42
- /**
43
- * Get the size of the container
44
- */
45
- size(): number;
46
- /**
47
- * Execute a function for each entry in the container
48
- */
49
- forEach<T = any>(callbackfn: (value: T, key: string, map: Map<string, any>) => void): void;
50
- }
51
-
52
- export { RuntimeContext };
1
+ export { RuntimeContext } from '../runtime-context/index.js';
package/dist/di/index.js CHANGED
@@ -1 +1 @@
1
- export { RuntimeContext } from '../chunk-M472GIT6.js';
1
+ export { RuntimeContext } from '../chunk-SGGPJWRQ.js';
@@ -1,6 +1,6 @@
1
1
  import { a as Metric, T as TestInfo, E as EvaluationResult } from '../types-BtMyV38I.cjs';
2
2
  export { M as MetricResult } from '../types-BtMyV38I.cjs';
3
- import { j as Agent } from '../base-oP3DoUrm.cjs';
3
+ import { F as Agent } from '../base-CZmT-p10.cjs';
4
4
  import 'ai';
5
5
  import '../base-BihKcqDY.cjs';
6
6
  import '@opentelemetry/api';
@@ -11,17 +11,19 @@ import '@opentelemetry/sdk-trace-base';
11
11
  import 'sift';
12
12
  import 'zod';
13
13
  import 'json-schema';
14
- import '../di/index.cjs';
14
+ import '../runtime-context/index.cjs';
15
15
  import 'xstate';
16
16
  import 'node:events';
17
17
  import '../vector/index.cjs';
18
18
  import '../vector/filter/index.cjs';
19
19
  import '../tts/index.cjs';
20
+ import 'events';
20
21
  import '../deployer/index.cjs';
21
22
  import '../bundler/index.cjs';
22
23
  import 'hono';
23
24
  import 'hono/cors';
24
25
  import 'hono-openapi';
26
+ import 'ai/test';
25
27
 
26
28
  declare function evaluate<T extends Agent>({ agentName, input, metric, output, runId, globalRunId, testInfo, instructions, }: {
27
29
  agentName: string;
@@ -1,6 +1,6 @@
1
1
  import { a as Metric, T as TestInfo, E as EvaluationResult } from '../types-BtMyV38I.js';
2
2
  export { M as MetricResult } from '../types-BtMyV38I.js';
3
- import { j as Agent } from '../base-Bk5V1doj.js';
3
+ import { F as Agent } from '../base-DDoWFpFc.js';
4
4
  import 'ai';
5
5
  import '../base-DT2poiVK.js';
6
6
  import '@opentelemetry/api';
@@ -11,17 +11,19 @@ import '@opentelemetry/sdk-trace-base';
11
11
  import 'sift';
12
12
  import 'zod';
13
13
  import 'json-schema';
14
- import '../di/index.js';
14
+ import '../runtime-context/index.js';
15
15
  import 'xstate';
16
16
  import 'node:events';
17
17
  import '../vector/index.js';
18
18
  import '../vector/filter/index.js';
19
19
  import '../tts/index.js';
20
+ import 'events';
20
21
  import '../deployer/index.js';
21
22
  import '../bundler/index.js';
22
23
  import 'hono';
23
24
  import 'hono/cors';
24
25
  import 'hono-openapi';
26
+ import 'ai/test';
25
27
 
26
28
  declare function evaluate<T extends Agent>({ agentName, input, metric, output, runId, globalRunId, testInfo, instructions, }: {
27
29
  agentName: string;