@mastra/core 0.9.3-alpha.0 → 0.9.3

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 (133) hide show
  1. package/dist/agent/index.cjs +2 -2
  2. package/dist/agent/index.d.cts +2 -2
  3. package/dist/agent/index.d.ts +2 -2
  4. package/dist/agent/index.js +1 -1
  5. package/dist/{base-CzHSMvOb.d.ts → base-BCnFhShR.d.ts} +27 -7
  6. package/dist/{base-DT2poiVK.d.ts → base-CeEVvwRi.d.ts} +2 -2
  7. package/dist/{base-BihKcqDY.d.cts → base-D9APQt4V.d.cts} +2 -2
  8. package/dist/{base-Cs0ddGCf.d.cts → base-VMWGZau0.d.cts} +27 -7
  9. package/dist/base.cjs +2 -2
  10. package/dist/base.d.cts +1 -1
  11. package/dist/base.d.ts +1 -1
  12. package/dist/base.js +1 -1
  13. package/dist/bundler/index.cjs +2 -2
  14. package/dist/bundler/index.d.cts +1 -1
  15. package/dist/bundler/index.d.ts +1 -1
  16. package/dist/bundler/index.js +1 -1
  17. package/dist/{chunk-WYL4MKWH.cjs → chunk-2PLTE53B.cjs} +37 -27
  18. package/dist/{chunk-QJJD56YR.cjs → chunk-37HZ77Z5.cjs} +13 -12
  19. package/dist/{chunk-JSKASUR2.cjs → chunk-5ENQX4BI.cjs} +9 -9
  20. package/dist/{chunk-RZCYBC7D.cjs → chunk-6NUAJ6AB.cjs} +2 -2
  21. package/dist/{chunk-O6EYGXZO.cjs → chunk-6YITFTRU.cjs} +2 -2
  22. package/dist/{chunk-KWYJUFY3.js → chunk-BFNYQFG2.js} +80 -55
  23. package/dist/chunk-BMSBIZKD.cjs +72 -0
  24. package/dist/{chunk-MNGIRRFY.js → chunk-CPONI4EX.js} +1 -1
  25. package/dist/{chunk-WAW7QBY4.cjs → chunk-CRHH7KRS.cjs} +2 -2
  26. package/dist/{chunk-5TFGORLG.js → chunk-DWD7X4KB.js} +1 -1
  27. package/dist/{chunk-PPNVAI5G.js → chunk-EYMLOJ2Q.js} +6 -5
  28. package/dist/{chunk-Q6Z2YS6I.js → chunk-FVYYXFPR.js} +2 -2
  29. package/dist/{chunk-OHIRECYU.cjs → chunk-FXAV2WYX.cjs} +3 -3
  30. package/dist/{chunk-ZZRFVSYZ.cjs → chunk-GUMHVPHG.cjs} +4 -4
  31. package/dist/{chunk-2ZK5VAXE.js → chunk-IKZWOULI.js} +2 -2
  32. package/dist/{chunk-T3UZONPQ.cjs → chunk-ITFMXU6H.cjs} +2 -2
  33. package/dist/{chunk-TZIOJX3N.js → chunk-JCBDQUQY.js} +1 -1
  34. package/dist/{chunk-2UAN6SRJ.js → chunk-KPOUHZFJ.js} +2 -2
  35. package/dist/{chunk-POEYDVX7.cjs → chunk-KXWR3FNX.cjs} +4 -4
  36. package/dist/{chunk-CLJQYXNM.js → chunk-NDAW47QQ.js} +6 -2
  37. package/dist/{chunk-XNBNJEES.cjs → chunk-OGNJRWRQ.cjs} +2 -2
  38. package/dist/chunk-Q6ZDDQOB.js +70 -0
  39. package/dist/{chunk-7IAP7VPO.js → chunk-QFJY3MEL.js} +2 -2
  40. package/dist/{chunk-4DEDPTLO.cjs → chunk-QQFFJTJ4.cjs} +2 -2
  41. package/dist/{chunk-47NGQPZI.js → chunk-R652KYQW.js} +1 -1
  42. package/dist/{chunk-FXUTMNQG.cjs → chunk-RE5MNHDE.cjs} +2 -2
  43. package/dist/{chunk-D63P5O4Q.cjs → chunk-RO52JMKQ.cjs} +6 -2
  44. package/dist/{chunk-6HHSM7FP.js → chunk-SONEVGEJ.js} +1 -1
  45. package/dist/{chunk-52SRR7WR.js → chunk-T5V4W7WU.js} +1 -1
  46. package/dist/{chunk-GHK3HBWN.js → chunk-TCL7XDJL.js} +1 -1
  47. package/dist/{chunk-MYHX5XVW.cjs → chunk-UVRGQEMD.cjs} +79 -53
  48. package/dist/{chunk-KSH5B376.js → chunk-XYP6MY7U.js} +22 -12
  49. package/dist/{chunk-22CFFDPA.cjs → chunk-ZMMZXEOL.cjs} +7 -7
  50. package/dist/{chunk-WD3HYQV3.js → chunk-ZQ7FXUGY.js} +1 -1
  51. package/dist/deployer/index.cjs +2 -2
  52. package/dist/deployer/index.d.cts +1 -1
  53. package/dist/deployer/index.d.ts +1 -1
  54. package/dist/deployer/index.js +1 -1
  55. package/dist/eval/index.d.cts +2 -2
  56. package/dist/eval/index.d.ts +2 -2
  57. package/dist/index.cjs +70 -66
  58. package/dist/index.d.cts +5 -5
  59. package/dist/index.d.ts +5 -5
  60. package/dist/index.js +15 -15
  61. package/dist/integration/index.cjs +3 -3
  62. package/dist/integration/index.d.cts +2 -2
  63. package/dist/integration/index.d.ts +2 -2
  64. package/dist/integration/index.js +1 -1
  65. package/dist/llm/index.d.cts +2 -2
  66. package/dist/llm/index.d.ts +2 -2
  67. package/dist/mastra/index.cjs +2 -2
  68. package/dist/mastra/index.d.cts +2 -2
  69. package/dist/mastra/index.d.ts +2 -2
  70. package/dist/mastra/index.js +1 -1
  71. package/dist/memory/index.cjs +4 -4
  72. package/dist/memory/index.d.cts +2 -2
  73. package/dist/memory/index.d.ts +2 -2
  74. package/dist/memory/index.js +1 -1
  75. package/dist/network/index.cjs +6 -6
  76. package/dist/network/index.d.cts +2 -2
  77. package/dist/network/index.d.ts +2 -2
  78. package/dist/network/index.js +3 -3
  79. package/dist/relevance/index.cjs +4 -4
  80. package/dist/relevance/index.d.cts +2 -2
  81. package/dist/relevance/index.d.ts +2 -2
  82. package/dist/relevance/index.js +1 -1
  83. package/dist/server/index.cjs +1 -0
  84. package/dist/server/index.d.cts +9 -4
  85. package/dist/server/index.d.ts +9 -4
  86. package/dist/server/index.js +1 -0
  87. package/dist/storage/index.cjs +2 -2
  88. package/dist/storage/index.d.cts +2 -2
  89. package/dist/storage/index.d.ts +2 -2
  90. package/dist/storage/index.js +1 -1
  91. package/dist/storage/libsql/index.cjs +2 -2
  92. package/dist/storage/libsql/index.d.cts +2 -2
  93. package/dist/storage/libsql/index.d.ts +2 -2
  94. package/dist/storage/libsql/index.js +1 -1
  95. package/dist/telemetry/index.cjs +10 -6
  96. package/dist/telemetry/index.d.cts +14 -4
  97. package/dist/telemetry/index.d.ts +14 -4
  98. package/dist/telemetry/index.js +1 -1
  99. package/dist/tools/index.cjs +4 -4
  100. package/dist/tools/index.d.cts +2 -2
  101. package/dist/tools/index.d.ts +2 -2
  102. package/dist/tools/index.js +1 -1
  103. package/dist/tts/index.cjs +2 -2
  104. package/dist/tts/index.d.cts +1 -1
  105. package/dist/tts/index.d.ts +1 -1
  106. package/dist/tts/index.js +1 -1
  107. package/dist/utils.cjs +12 -12
  108. package/dist/utils.d.cts +2 -2
  109. package/dist/utils.d.ts +2 -2
  110. package/dist/utils.js +1 -1
  111. package/dist/vector/index.cjs +2 -2
  112. package/dist/vector/index.d.cts +3 -1
  113. package/dist/vector/index.d.ts +3 -1
  114. package/dist/vector/index.js +1 -1
  115. package/dist/vector/libsql/index.cjs +3 -3
  116. package/dist/vector/libsql/index.d.cts +1 -1
  117. package/dist/vector/libsql/index.d.ts +1 -1
  118. package/dist/vector/libsql/index.js +1 -1
  119. package/dist/voice/index.cjs +4 -4
  120. package/dist/voice/index.d.cts +2 -2
  121. package/dist/voice/index.d.ts +2 -2
  122. package/dist/voice/index.js +1 -1
  123. package/dist/workflows/index.cjs +22 -22
  124. package/dist/workflows/index.d.cts +3 -3
  125. package/dist/workflows/index.d.ts +3 -3
  126. package/dist/workflows/index.js +1 -1
  127. package/dist/workflows/vNext/index.cjs +166 -129
  128. package/dist/workflows/vNext/index.d.cts +37 -12
  129. package/dist/workflows/vNext/index.d.ts +37 -12
  130. package/dist/workflows/vNext/index.js +162 -125
  131. package/package.json +2 -2
  132. package/dist/chunk-LXIAHZ45.js +0 -37
  133. package/dist/chunk-YAJVZMZH.cjs +0 -39
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunkT3UZONPQ_cjs = require('./chunk-T3UZONPQ.cjs');
4
- var chunkFXUTMNQG_cjs = require('./chunk-FXUTMNQG.cjs');
5
- var chunkOHIRECYU_cjs = require('./chunk-OHIRECYU.cjs');
6
- var chunkD63P5O4Q_cjs = require('./chunk-D63P5O4Q.cjs');
3
+ var chunkITFMXU6H_cjs = require('./chunk-ITFMXU6H.cjs');
4
+ var chunkRE5MNHDE_cjs = require('./chunk-RE5MNHDE.cjs');
5
+ var chunkFXAV2WYX_cjs = require('./chunk-FXAV2WYX.cjs');
6
+ var chunkRO52JMKQ_cjs = require('./chunk-RO52JMKQ.cjs');
7
7
  var fs = require('fs');
8
8
  var path = require('path');
9
9
  var fsp = require('fs/promises');
@@ -113,7 +113,7 @@ var fastEmbedProvider = ai.experimental_customProvider({
113
113
  var defaultEmbedder = fastEmbedProvider.textEmbeddingModel;
114
114
 
115
115
  // src/memory/memory.ts
116
- var MemoryProcessor = class extends chunkD63P5O4Q_cjs.MastraBase {
116
+ var MemoryProcessor = class extends chunkRO52JMKQ_cjs.MastraBase {
117
117
  /**
118
118
  * Process a list of messages and return a filtered or transformed list.
119
119
  * @param messages The messages to process
@@ -163,7 +163,7 @@ var newMemoryDefaultOptions = {
163
163
  // new
164
164
  use: "tool-call"}
165
165
  };
166
- var MastraMemory = class extends chunkD63P5O4Q_cjs.MastraBase {
166
+ var MastraMemory = class extends chunkRO52JMKQ_cjs.MastraBase {
167
167
  MAX_CONTEXT_TOKENS;
168
168
  storage;
169
169
  vector;
@@ -182,7 +182,7 @@ var MastraMemory = class extends chunkD63P5O4Q_cjs.MastraBase {
182
182
  if (config.storage) {
183
183
  this.storage = config.storage;
184
184
  } else {
185
- this.storage = new chunkFXUTMNQG_cjs.DefaultProxyStorage({
185
+ this.storage = new chunkRE5MNHDE_cjs.DefaultProxyStorage({
186
186
  config: {
187
187
  url: "file:memory.db"
188
188
  }
@@ -236,7 +236,7 @@ export const yourAgent = new Agent({
236
236
  })
237
237
  `);
238
238
  }
239
- this.storage = chunkFXUTMNQG_cjs.augmentWithInit(this.storage);
239
+ this.storage = chunkRE5MNHDE_cjs.augmentWithInit(this.storage);
240
240
  const semanticRecallIsEnabled = this.threadConfig.semanticRecall !== false;
241
241
  if (config.vector && semanticRecallIsEnabled) {
242
242
  this.vector = config.vector;
@@ -279,7 +279,7 @@ export const agent = new Agent({
279
279
  })
280
280
  })
281
281
  `);
282
- this.vector = new chunkT3UZONPQ_cjs.LibSQLVector({
282
+ this.vector = new chunkITFMXU6H_cjs.LibSQLVector({
283
283
  // TODO: MAY 20th BREAKING CHANGE: remove this default and throw an error if semantic recall is enabled but there's no vector db
284
284
  connectionUrl: hasOldDb ? `file:${oldDb}` : `file:${newDb}`
285
285
  });
@@ -422,7 +422,7 @@ ${messages.length ? messages.map((ft) => ft.message).join(`
422
422
  }
423
423
  }
424
424
  setStorage(storage) {
425
- if (storage instanceof chunkFXUTMNQG_cjs.DefaultProxyStorage) {
425
+ if (storage instanceof chunkRE5MNHDE_cjs.DefaultProxyStorage) {
426
426
  this.deprecationWarnings.push(`Importing "DefaultStorage" from '@mastra/core/storage/libsql' is deprecated.
427
427
 
428
428
  Instead of:
@@ -460,7 +460,8 @@ Do:
460
460
  const defaultDimensions = 1536;
461
461
  const isDefault = dimensions === defaultDimensions;
462
462
  const usedDimensions = dimensions ?? defaultDimensions;
463
- const indexName = isDefault ? "memory_messages" : `memory_messages_${usedDimensions}`;
463
+ const separator = this.vector?.indexSeparator ?? "_";
464
+ const indexName = isDefault ? `memory${separator}messages` : `memory${separator}messages${separator}${usedDimensions}`;
464
465
  if (typeof this.vector === `undefined`) {
465
466
  throw new Error(`Tried to create embedding index but no vector db is attached to this Memory instance.`);
466
467
  }
@@ -471,7 +472,7 @@ Do:
471
472
  return { indexName };
472
473
  }
473
474
  getMergedThreadConfig(config) {
474
- return chunkOHIRECYU_cjs.deepMerge(this.threadConfig, config || {});
475
+ return chunkFXAV2WYX_cjs.deepMerge(this.threadConfig, config || {});
475
476
  }
476
477
  /**
477
478
  * Apply all configured message processors to a list of messages.
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkFXUTMNQG_cjs = require('./chunk-FXUTMNQG.cjs');
4
- var chunkMYHX5XVW_cjs = require('./chunk-MYHX5XVW.cjs');
3
+ var chunkRE5MNHDE_cjs = require('./chunk-RE5MNHDE.cjs');
4
+ var chunkUVRGQEMD_cjs = require('./chunk-UVRGQEMD.cjs');
5
5
  var chunkO7IW545H_cjs = require('./chunk-O7IW545H.cjs');
6
6
  var chunkRWTSGWWL_cjs = require('./chunk-RWTSGWWL.cjs');
7
7
 
8
8
  // src/mastra/index.ts
9
9
  var _Mastra_decorators, _init;
10
- _Mastra_decorators = [chunkMYHX5XVW_cjs.InstrumentClass({
10
+ _Mastra_decorators = [chunkUVRGQEMD_cjs.InstrumentClass({
11
11
  prefix: "mastra",
12
12
  excludeMethods: ["getLogger", "getTelemetry"]
13
13
  })];
@@ -67,14 +67,14 @@ exports.Mastra = class Mastra {
67
67
  this.#logger = logger;
68
68
  let storage = config?.storage;
69
69
  if (!storage) {
70
- storage = new chunkFXUTMNQG_cjs.DefaultProxyStorage({
70
+ storage = new chunkRE5MNHDE_cjs.DefaultProxyStorage({
71
71
  config: {
72
72
  url: process.env.MASTRA_DEFAULT_STORAGE_URL || `:memory:`
73
73
  }
74
74
  });
75
75
  }
76
- storage = chunkFXUTMNQG_cjs.augmentWithInit(storage);
77
- this.#telemetry = chunkMYHX5XVW_cjs.Telemetry.init(config?.telemetry);
76
+ storage = chunkRE5MNHDE_cjs.augmentWithInit(storage);
77
+ this.#telemetry = chunkUVRGQEMD_cjs.Telemetry.init(config?.telemetry);
78
78
  if (this.#telemetry) {
79
79
  this.#storage = this.#telemetry.traceClass(storage, {
80
80
  excludeMethods: ["__setTelemetry", "__getTelemetry", "batchTraceInsert"]
@@ -285,7 +285,7 @@ This is a warning for now, but will throw an error in the future
285
285
  return this.#vnext_workflows;
286
286
  }
287
287
  setStorage(storage) {
288
- if (storage instanceof chunkFXUTMNQG_cjs.DefaultProxyStorage) {
288
+ if (storage instanceof chunkRE5MNHDE_cjs.DefaultProxyStorage) {
289
289
  this.#logger.warn(`Importing "DefaultStorage" from '@mastra/core/storage/libsql' is deprecated.
290
290
 
291
291
  Instead of:
@@ -295,7 +295,7 @@ Do:
295
295
  import { LibSQLStore } from '@mastra/libsql';
296
296
  `);
297
297
  }
298
- this.#storage = chunkFXUTMNQG_cjs.augmentWithInit(storage);
298
+ this.#storage = chunkRE5MNHDE_cjs.augmentWithInit(storage);
299
299
  }
300
300
  setLogger({
301
301
  logger
@@ -327,7 +327,7 @@ Do:
327
327
  }
328
328
  }
329
329
  setTelemetry(telemetry) {
330
- this.#telemetry = chunkMYHX5XVW_cjs.Telemetry.init(telemetry);
330
+ this.#telemetry = chunkUVRGQEMD_cjs.Telemetry.init(telemetry);
331
331
  if (this.#agents) {
332
332
  Object.keys(this.#agents).forEach(key => {
333
333
  if (this.#telemetry) {
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunkWAW7QBY4_cjs = require('./chunk-WAW7QBY4.cjs');
3
+ var chunkCRHH7KRS_cjs = require('./chunk-CRHH7KRS.cjs');
4
4
 
5
5
  // src/deployer/index.ts
6
- var MastraDeployer = class extends chunkWAW7QBY4_cjs.MastraBundler {
6
+ var MastraDeployer = class extends chunkCRHH7KRS_cjs.MastraBundler {
7
7
  constructor({ name }) {
8
8
  super({ component: "DEPLOYER", name });
9
9
  }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkOHIRECYU_cjs = require('./chunk-OHIRECYU.cjs');
3
+ var chunkFXAV2WYX_cjs = require('./chunk-FXAV2WYX.cjs');
4
4
  var zod = require('zod');
5
5
 
6
6
  // src/integration/integration.ts
@@ -68,7 +68,7 @@ var OpenAPIToolset = class {
68
68
  const tools = Object.keys(clientMethods).reduce((acc, key) => {
69
69
  const comment = documentations[key]?.comment;
70
70
  const fallbackComment = `Execute ${key}`;
71
- const tool = chunkOHIRECYU_cjs.createTool({
71
+ const tool = chunkFXAV2WYX_cjs.createTool({
72
72
  id: key,
73
73
  inputSchema: schemas[key] || zod.z.object({}),
74
74
  description: comment || fallbackComment,
@@ -1,5 +1,5 @@
1
1
  import { TABLE_TRACES } from './chunk-SEOWDGC2.js';
2
- import { trace, context, propagation, SpanStatusCode, SpanKind } from '@opentelemetry/api';
2
+ import { trace, propagation, context, SpanStatusCode, SpanKind } from '@opentelemetry/api';
3
3
  import { ExportResultCode } from '@opentelemetry/core';
4
4
  import { JsonTraceSerializer } from '@opentelemetry/otlp-transformer';
5
5
 
@@ -10,6 +10,17 @@ function hasActiveTelemetry(tracerName = "default-tracer") {
10
10
  return false;
11
11
  }
12
12
  }
13
+ function getBaggageValues(ctx) {
14
+ const currentBaggage = propagation.getBaggage(ctx);
15
+ const requestId = currentBaggage?.getEntry("http.request_id")?.value;
16
+ const componentName = currentBaggage?.getEntry("componentName")?.value;
17
+ const runId = currentBaggage?.getEntry("runId")?.value;
18
+ return {
19
+ requestId,
20
+ componentName,
21
+ runId
22
+ };
23
+ }
13
24
 
14
25
  // src/telemetry/telemetry.decorators.ts
15
26
  function withSpan(options) {
@@ -41,24 +52,27 @@ function withSpan(options) {
41
52
  span.setAttribute(`${spanName}.argument.${index}`, "[Not Serializable]");
42
53
  }
43
54
  });
44
- const currentBaggage = propagation.getBaggage(ctx);
45
- if (currentBaggage?.["http.request_id"]) {
46
- span.setAttribute("http.request_id", currentBaggage?.["http.request_id"]);
55
+ const { requestId, componentName, runId } = getBaggageValues(ctx);
56
+ if (requestId) {
57
+ span.setAttribute("http.request_id", requestId);
47
58
  }
48
- if (currentBaggage?.componentName) {
49
- span.setAttribute("componentName", currentBaggage?.componentName);
50
- span.setAttribute("runId", currentBaggage?.runId);
59
+ if (componentName) {
60
+ span.setAttribute("componentName", componentName);
61
+ span.setAttribute("runId", runId);
51
62
  } else if (this && this.name) {
52
63
  span.setAttribute("componentName", this.name);
53
64
  span.setAttribute("runId", this.runId);
54
- ctx = propagation.setBaggage(ctx, {
55
- // @ts-ignore
56
- componentName: this.name,
57
- // @ts-ignore
58
- runId: this.runId,
59
- // @ts-ignore
60
- "http.request_id": currentBaggage?.["http.request_id"]
61
- });
65
+ ctx = propagation.setBaggage(
66
+ ctx,
67
+ propagation.createBaggage({
68
+ // @ts-ignore
69
+ componentName: { value: this.name },
70
+ // @ts-ignore
71
+ runId: { value: this.runId },
72
+ // @ts-ignore
73
+ "http.request_id": { value: requestId }
74
+ })
75
+ );
62
76
  }
63
77
  let result;
64
78
  try {
@@ -297,8 +311,14 @@ var Telemetry = class _Telemetry {
297
311
  });
298
312
  }
299
313
  static setBaggage(baggage, ctx = context.active()) {
300
- const currentBaggage = propagation.getBaggage(ctx);
301
- const newCtx = propagation.setBaggage(ctx, { ...currentBaggage, ...baggage });
314
+ const currentBaggage = Object.fromEntries(propagation.getBaggage(ctx)?.getAllEntries() ?? []);
315
+ const newCtx = propagation.setBaggage(
316
+ ctx,
317
+ propagation.createBaggage({
318
+ ...currentBaggage,
319
+ ...baggage
320
+ })
321
+ );
302
322
  return newCtx;
303
323
  }
304
324
  static withContext(ctx, fn) {
@@ -337,36 +357,41 @@ var Telemetry = class _Telemetry {
337
357
  span.end();
338
358
  return res;
339
359
  };
340
- const currentBaggage = propagation.getBaggage(ctx);
360
+ const { requestId, componentName, runId } = getBaggageValues(ctx);
341
361
  if (context3.attributes) {
342
362
  span.setAttributes(context3.attributes);
343
363
  }
344
- if (currentBaggage?.["http.request_id"]) {
345
- span.setAttribute("http.request_id", currentBaggage?.["http.request_id"]);
364
+ if (requestId) {
365
+ span.setAttribute("http.request_id", requestId);
346
366
  }
347
367
  if (context3.attributes?.componentName) {
348
- ctx = propagation.setBaggage(ctx, {
349
- // @ts-ignore
350
- componentName: context3.attributes.componentName,
351
- runId: context3.attributes.runId,
352
- // @ts-ignore
353
- "http.request_id": currentBaggage?.["http.request_id"]
354
- });
368
+ ctx = propagation.setBaggage(
369
+ ctx,
370
+ propagation.createBaggage({
371
+ componentName: { value: context3.attributes.componentName },
372
+ // @ts-ignore
373
+ runId: { value: context3.attributes.runId },
374
+ // @ts-ignore
375
+ "http.request_id": { value: requestId }
376
+ })
377
+ );
355
378
  } else {
356
- if (currentBaggage?.componentName) {
357
- span.setAttribute("componentName", currentBaggage?.componentName);
358
- span.setAttribute("runId", currentBaggage?.runId);
379
+ if (componentName) {
380
+ span.setAttribute("componentName", componentName);
381
+ span.setAttribute("runId", runId);
359
382
  } else if (this && this.name) {
360
383
  span.setAttribute("componentName", this.name);
361
384
  span.setAttribute("runId", this.runId);
362
- ctx = propagation.setBaggage(ctx, {
363
- // @ts-ignore
364
- componentName: this.name,
365
- // @ts-ignore
366
- runId: this.runId,
367
- // @ts-ignore
368
- "http.request_id": currentBaggage?.["http.request_id"]
369
- });
385
+ ctx = propagation.setBaggage(
386
+ ctx,
387
+ propagation.createBaggage({
388
+ componentName: { value: this.name },
389
+ // @ts-ignore
390
+ runId: { value: this.runId },
391
+ // @ts-ignore
392
+ "http.request_id": { value: requestId }
393
+ })
394
+ );
370
395
  }
371
396
  }
372
397
  args.forEach((arg, index) => {
@@ -402,42 +427,42 @@ var BaggageTracer = class {
402
427
  startSpan(name, options = {}, ctx) {
403
428
  ctx = ctx ?? context.active();
404
429
  const span = this._tracer.startSpan(name, options, ctx);
405
- const currentBaggage = propagation.getBaggage(ctx);
406
- span.setAttribute("componentName", currentBaggage?.componentName);
407
- span.setAttribute("runId", currentBaggage?.runId);
408
- span.setAttribute("http.request_id", currentBaggage?.["http.request_id"]);
430
+ const { componentName, runId, requestId } = getBaggageValues(ctx);
431
+ span.setAttribute("componentName", componentName);
432
+ span.setAttribute("runId", runId);
433
+ span.setAttribute("http.request_id", requestId);
409
434
  return span;
410
435
  }
411
436
  startActiveSpan(name, optionsOrFn, ctxOrFn, fn) {
412
437
  if (typeof optionsOrFn === "function") {
413
438
  const wrappedFn2 = (span) => {
414
- const currentBaggage = propagation.getBaggage(context.active());
415
- span.setAttribute("componentName", currentBaggage?.componentName);
416
- span.setAttribute("runId", currentBaggage?.runId);
417
- span.setAttribute("http.request_id", currentBaggage?.["http.request_id"]);
439
+ const { componentName, runId, requestId } = getBaggageValues(context.active());
440
+ span.setAttribute("componentName", componentName);
441
+ span.setAttribute("runId", runId);
442
+ span.setAttribute("http.request_id", requestId);
418
443
  return optionsOrFn(span);
419
444
  };
420
445
  return this._tracer.startActiveSpan(name, {}, context.active(), wrappedFn2);
421
446
  }
422
447
  if (typeof ctxOrFn === "function") {
423
448
  const wrappedFn2 = (span) => {
424
- const currentBaggage = propagation.getBaggage(context.active());
425
- span.setAttribute("componentName", currentBaggage?.componentName);
426
- span.setAttribute("runId", currentBaggage?.runId);
427
- span.setAttribute("http.request_id", currentBaggage?.["http.request_id"]);
449
+ const { componentName, runId, requestId } = getBaggageValues(context.active());
450
+ span.setAttribute("componentName", componentName);
451
+ span.setAttribute("runId", runId);
452
+ span.setAttribute("http.request_id", requestId);
428
453
  return ctxOrFn(span);
429
454
  };
430
455
  return this._tracer.startActiveSpan(name, optionsOrFn, context.active(), wrappedFn2);
431
456
  }
432
457
  const wrappedFn = (span) => {
433
- const currentBaggage = propagation.getBaggage(ctxOrFn ?? context.active());
434
- span.setAttribute("componentName", currentBaggage?.componentName);
435
- span.setAttribute("runId", currentBaggage?.runId);
436
- span.setAttribute("http.request_id", currentBaggage?.["http.request_id"]);
458
+ const { componentName, runId, requestId } = getBaggageValues(ctxOrFn ?? context.active());
459
+ span.setAttribute("componentName", componentName);
460
+ span.setAttribute("runId", runId);
461
+ span.setAttribute("http.request_id", requestId);
437
462
  return fn(span);
438
463
  };
439
464
  return this._tracer.startActiveSpan(name, optionsOrFn, ctxOrFn, wrappedFn);
440
465
  }
441
466
  };
442
467
 
443
- export { InstrumentClass, OTLPTraceExporter, Telemetry, hasActiveTelemetry, withSpan };
468
+ export { InstrumentClass, OTLPTraceExporter, Telemetry, getBaggageValues, hasActiveTelemetry, withSpan };
@@ -0,0 +1,72 @@
1
+ 'use strict';
2
+
3
+ var chunkRO52JMKQ_cjs = require('./chunk-RO52JMKQ.cjs');
4
+
5
+ // src/vector/vector.ts
6
+ var MastraVector = class extends chunkRO52JMKQ_cjs.MastraBase {
7
+ constructor() {
8
+ super({ name: "MastraVector", component: "VECTOR" });
9
+ }
10
+ get indexSeparator() {
11
+ return "_";
12
+ }
13
+ baseKeys = {
14
+ query: ["queryVector", "topK", "filter", "includeVector"],
15
+ upsert: ["vectors", "metadata", "ids"],
16
+ createIndex: ["dimension", "metric"]
17
+ };
18
+ normalizeArgs(method, [first, ...rest], extendedKeys = []) {
19
+ if (typeof first === "object") {
20
+ return first;
21
+ }
22
+ this.logger.warn(
23
+ `Deprecation Warning: Passing individual arguments to ${method}() is deprecated.
24
+ Please use an object parameter instead.
25
+ Individual arguments will be removed on May 20th.`
26
+ );
27
+ const baseKeys = this.baseKeys[method] || [];
28
+ const paramKeys = [...baseKeys, ...extendedKeys].slice(0, rest.length);
29
+ return {
30
+ indexName: first,
31
+ ...Object.fromEntries(paramKeys.map((key, i) => [key, rest[i]]))
32
+ };
33
+ }
34
+ async updateIndexById(_indexName, _id, _update) {
35
+ throw new Error("updateIndexById is not implemented yet");
36
+ }
37
+ async deleteIndexById(_indexName, _id) {
38
+ throw new Error("deleteById is not implemented yet");
39
+ }
40
+ async validateExistingIndex(indexName, dimension, metric) {
41
+ let info;
42
+ try {
43
+ info = await this.describeIndex(indexName);
44
+ } catch (infoError) {
45
+ const message = `Index "${indexName}" already exists, but failed to fetch index info for dimension check: ${infoError}`;
46
+ this.logger?.error(message);
47
+ throw new Error(message);
48
+ }
49
+ const existingDim = info?.dimension;
50
+ const existingMetric = info?.metric;
51
+ if (existingDim === dimension) {
52
+ this.logger?.info(
53
+ `Index "${indexName}" already exists with ${existingDim} dimensions and metric ${existingMetric}, skipping creation.`
54
+ );
55
+ if (existingMetric !== metric) {
56
+ this.logger?.warn(
57
+ `Attempted to create index with metric "${metric}", but index already exists with metric "${existingMetric}". To use a different metric, delete and recreate the index.`
58
+ );
59
+ }
60
+ } else if (info) {
61
+ const message = `Index "${indexName}" already exists with ${existingDim} dimensions, but ${dimension} dimensions were requested`;
62
+ this.logger?.error(message);
63
+ throw new Error(message);
64
+ } else {
65
+ const message = `Index "${indexName}" already exists, but could not retrieve its dimensions for validation.`;
66
+ this.logger?.error(message);
67
+ throw new Error(message);
68
+ }
69
+ }
70
+ };
71
+
72
+ exports.MastraVector = MastraVector;
@@ -1,4 +1,4 @@
1
- import { MastraStorage } from './chunk-52SRR7WR.js';
1
+ import { MastraStorage } from './chunk-T5V4W7WU.js';
2
2
 
3
3
  // src/storage/default-proxy-storage.ts
4
4
  var DefaultProxyStorage = class extends MastraStorage {
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkD63P5O4Q_cjs = require('./chunk-D63P5O4Q.cjs');
3
+ var chunkRO52JMKQ_cjs = require('./chunk-RO52JMKQ.cjs');
4
4
  var promises = require('fs/promises');
5
5
  var dotenv = require('dotenv');
6
6
 
7
- var MastraBundler = class extends chunkD63P5O4Q_cjs.MastraBase {
7
+ var MastraBundler = class extends chunkRO52JMKQ_cjs.MastraBase {
8
8
  constructor({ name, component = "BUNDLER" }) {
9
9
  super({ component, name });
10
10
  }
@@ -1,4 +1,4 @@
1
- import { MastraBundler } from './chunk-GHK3HBWN.js';
1
+ import { MastraBundler } from './chunk-TCL7XDJL.js';
2
2
 
3
3
  // src/deployer/index.ts
4
4
  var MastraDeployer = class extends MastraBundler {
@@ -1,7 +1,7 @@
1
- import { LibSQLVector } from './chunk-47NGQPZI.js';
2
- import { DefaultProxyStorage, augmentWithInit } from './chunk-MNGIRRFY.js';
3
- import { deepMerge } from './chunk-WD3HYQV3.js';
4
- import { MastraBase } from './chunk-CLJQYXNM.js';
1
+ import { LibSQLVector } from './chunk-R652KYQW.js';
2
+ import { DefaultProxyStorage, augmentWithInit } from './chunk-CPONI4EX.js';
3
+ import { deepMerge } from './chunk-ZQ7FXUGY.js';
4
+ import { MastraBase } from './chunk-NDAW47QQ.js';
5
5
  import { existsSync } from 'fs';
6
6
  import { join } from 'path';
7
7
  import fsp from 'node:fs/promises';
@@ -453,7 +453,8 @@ Do:
453
453
  const defaultDimensions = 1536;
454
454
  const isDefault = dimensions === defaultDimensions;
455
455
  const usedDimensions = dimensions ?? defaultDimensions;
456
- const indexName = isDefault ? "memory_messages" : `memory_messages_${usedDimensions}`;
456
+ const separator = this.vector?.indexSeparator ?? "_";
457
+ const indexName = isDefault ? `memory${separator}messages` : `memory${separator}messages${separator}${usedDimensions}`;
457
458
  if (typeof this.vector === `undefined`) {
458
459
  throw new Error(`Tried to create embedding index but no vector db is attached to this Memory instance.`);
459
460
  }
@@ -1,5 +1,5 @@
1
- import { InstrumentClass } from './chunk-KWYJUFY3.js';
2
- import { MastraBase } from './chunk-CLJQYXNM.js';
1
+ import { InstrumentClass } from './chunk-BFNYQFG2.js';
2
+ import { MastraBase } from './chunk-NDAW47QQ.js';
3
3
  import { __decoratorStart, __decorateElement, __runInitializers } from './chunk-C6A6W6XS.js';
4
4
 
5
5
  // src/voice/voice.ts
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkD63P5O4Q_cjs = require('./chunk-D63P5O4Q.cjs');
3
+ var chunkRO52JMKQ_cjs = require('./chunk-RO52JMKQ.cjs');
4
4
  var chunkLABUWBKX_cjs = require('./chunk-LABUWBKX.cjs');
5
5
  var crypto = require('crypto');
6
6
  var ai = require('ai');
@@ -43,7 +43,7 @@ var ALL_NUMBER_CHECKS = [
43
43
  ];
44
44
  var ALL_ARRAY_CHECKS = ["min", "max", "length"];
45
45
  var UNSUPPORTED_ZOD_TYPES = ["ZodIntersection", "ZodNever", "ZodNull", "ZodTuple", "ZodUndefined"];
46
- var ToolCompatibility = class extends chunkD63P5O4Q_cjs.MastraBase {
46
+ var ToolCompatibility = class extends chunkRO52JMKQ_cjs.MastraBase {
47
47
  model;
48
48
  constructor(model) {
49
49
  super({ name: "SchemaCompatibility" });
@@ -554,7 +554,7 @@ function convertInputSchema(tool) {
554
554
  const schema = tool.inputSchema ?? zod.z.object({});
555
555
  return isZodType(schema) ? schema : resolveSerializedZodOutput(jsonSchemaToZod__default.default(schema));
556
556
  }
557
- var CoreToolBuilder = class extends chunkD63P5O4Q_cjs.MastraBase {
557
+ var CoreToolBuilder = class extends chunkRO52JMKQ_cjs.MastraBase {
558
558
  originalTool;
559
559
  options;
560
560
  logType;
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var chunkMYHX5XVW_cjs = require('./chunk-MYHX5XVW.cjs');
4
- var chunkD63P5O4Q_cjs = require('./chunk-D63P5O4Q.cjs');
3
+ var chunkUVRGQEMD_cjs = require('./chunk-UVRGQEMD.cjs');
4
+ var chunkRO52JMKQ_cjs = require('./chunk-RO52JMKQ.cjs');
5
5
  var chunkRWTSGWWL_cjs = require('./chunk-RWTSGWWL.cjs');
6
6
 
7
7
  // src/tts/index.ts
8
8
  var _MastraTTS_decorators, _init, _a;
9
- _MastraTTS_decorators = [chunkMYHX5XVW_cjs.InstrumentClass({
9
+ _MastraTTS_decorators = [chunkUVRGQEMD_cjs.InstrumentClass({
10
10
  prefix: "tts",
11
11
  excludeMethods: ["__setTools", "__setLogger", "__setTelemetry", "#log"]
12
12
  })];
13
- exports.MastraTTS = class MastraTTS extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
13
+ exports.MastraTTS = class MastraTTS extends (_a = chunkRO52JMKQ_cjs.MastraBase) {
14
14
  model;
15
15
  constructor({
16
16
  model
@@ -1,5 +1,5 @@
1
- import { DefaultProxyStorage, augmentWithInit } from './chunk-MNGIRRFY.js';
2
- import { InstrumentClass, Telemetry } from './chunk-KWYJUFY3.js';
1
+ import { DefaultProxyStorage, augmentWithInit } from './chunk-CPONI4EX.js';
2
+ import { InstrumentClass, Telemetry } from './chunk-BFNYQFG2.js';
3
3
  import { createLogger, LogLevel, noopLogger } from './chunk-2BVZNKLX.js';
4
4
  import { __decoratorStart, __decorateElement, __runInitializers } from './chunk-C6A6W6XS.js';
5
5
 
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkYK3XJ52U_cjs = require('./chunk-YK3XJ52U.cjs');
4
- var chunkYAJVZMZH_cjs = require('./chunk-YAJVZMZH.cjs');
4
+ var chunkBMSBIZKD_cjs = require('./chunk-BMSBIZKD.cjs');
5
5
  var path = require('path');
6
6
  var client = require('@libsql/client');
7
7
 
@@ -451,7 +451,7 @@ var processOperator = (key, operator, operatorValue) => {
451
451
  };
452
452
 
453
453
  // src/vector/libsql/index.ts
454
- var LibSQLVector = class extends chunkYAJVZMZH_cjs.MastraVector {
454
+ var LibSQLVector = class extends chunkBMSBIZKD_cjs.MastraVector {
455
455
  turso;
456
456
  constructor({
457
457
  connectionUrl,
@@ -1,4 +1,4 @@
1
- import { createTool } from './chunk-WD3HYQV3.js';
1
+ import { createTool } from './chunk-ZQ7FXUGY.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  // src/integration/integration.ts
@@ -1,5 +1,5 @@
1
- import { delay } from './chunk-WD3HYQV3.js';
2
- import { MastraBase } from './chunk-CLJQYXNM.js';
1
+ import { delay } from './chunk-ZQ7FXUGY.js';
2
+ import { MastraBase } from './chunk-NDAW47QQ.js';
3
3
  import { RegisteredLogger } from './chunk-2BVZNKLX.js';
4
4
  import { jsonSchema, generateText, Output, generateObject, streamText, streamObject } from 'ai';
5
5
  import { z } from 'zod';
@@ -1,16 +1,16 @@
1
1
  'use strict';
2
2
 
3
- var chunkMYHX5XVW_cjs = require('./chunk-MYHX5XVW.cjs');
4
- var chunkD63P5O4Q_cjs = require('./chunk-D63P5O4Q.cjs');
3
+ var chunkUVRGQEMD_cjs = require('./chunk-UVRGQEMD.cjs');
4
+ var chunkRO52JMKQ_cjs = require('./chunk-RO52JMKQ.cjs');
5
5
  var chunkRWTSGWWL_cjs = require('./chunk-RWTSGWWL.cjs');
6
6
 
7
7
  // src/voice/voice.ts
8
8
  var _MastraVoice_decorators, _init, _a;
9
- _MastraVoice_decorators = [chunkMYHX5XVW_cjs.InstrumentClass({
9
+ _MastraVoice_decorators = [chunkUVRGQEMD_cjs.InstrumentClass({
10
10
  prefix: "voice",
11
11
  excludeMethods: ["__setTools", "__setLogger", "__setTelemetry", "#log"]
12
12
  })];
13
- exports.MastraVoice = class MastraVoice extends (_a = chunkD63P5O4Q_cjs.MastraBase) {
13
+ exports.MastraVoice = class MastraVoice extends (_a = chunkRO52JMKQ_cjs.MastraBase) {
14
14
  listeningModel;
15
15
  speechModel;
16
16
  speaker;
@@ -17,7 +17,9 @@ var MastraBase = class {
17
17
  */
18
18
  __setLogger(logger) {
19
19
  this.logger = logger;
20
- this.logger.debug(`Logger updated [component=${this.component}] [name=${this.name}]`);
20
+ if (this.component !== RegisteredLogger.LLM) {
21
+ this.logger.debug(`Logger updated [component=${this.component}] [name=${this.name}]`);
22
+ }
21
23
  }
22
24
  /**
23
25
  * Set the telemetry for the
@@ -25,7 +27,9 @@ var MastraBase = class {
25
27
  */
26
28
  __setTelemetry(telemetry) {
27
29
  this.telemetry = telemetry;
28
- this.logger.debug(`Telemetry updated [component=${this.component}] [tracer=${this.telemetry.tracer}]`);
30
+ if (this.component !== RegisteredLogger.LLM) {
31
+ this.logger.debug(`Telemetry updated [component=${this.component}] [name=${this.telemetry.name}]`);
32
+ }
29
33
  }
30
34
  /**
31
35
  * Get the telemetry on the vector