@mastra/core 0.10.4-alpha.3 → 0.10.5

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 (103) hide show
  1. package/dist/agent/index.cjs +4 -4
  2. package/dist/agent/index.d.cts +1 -1
  3. package/dist/agent/index.d.ts +1 -1
  4. package/dist/agent/index.js +2 -2
  5. package/dist/{base-icHjkcs-.d.ts → base-CmIdgTSq.d.ts} +37 -31
  6. package/dist/{base-Bdc5hWla.d.cts → base-_mZ6e_qo.d.cts} +37 -31
  7. package/dist/chunk-2RZXEVWT.js +68 -0
  8. package/dist/{chunk-UFQERGWG.js → chunk-32XBQVNY.js} +117 -28
  9. package/dist/{chunk-TRJIWZKM.js → chunk-3SY7GRSA.js} +1 -1
  10. package/dist/{chunk-PUG7THT5.cjs → chunk-6EMFDXAQ.cjs} +4 -4
  11. package/dist/{chunk-36UICULV.js → chunk-6PQRSQZF.js} +35 -5
  12. package/dist/{chunk-VB4S54R3.cjs → chunk-7L56W43N.cjs} +118 -29
  13. package/dist/{chunk-62ZSDIUK.js → chunk-BMED2N3R.js} +1 -1
  14. package/dist/{chunk-I2KL5KMY.js → chunk-CMEK3A3W.js} +2 -2
  15. package/dist/{chunk-HGPLTKJA.cjs → chunk-D2ULEJL3.cjs} +2 -2
  16. package/dist/{chunk-AX6IHSGY.js → chunk-DPKEVI6Q.js} +1 -1
  17. package/dist/{chunk-ZKUUYDOQ.cjs → chunk-EFJIVMMM.cjs} +21 -21
  18. package/dist/{chunk-SI2ENZ3O.js → chunk-F2DBWJK3.js} +1 -1
  19. package/dist/{chunk-Z37B4W7B.js → chunk-HIQ3FPBN.js} +1 -1
  20. package/dist/{chunk-RO5VPM3P.cjs → chunk-HVI3SKIH.cjs} +278 -55
  21. package/dist/{chunk-GV6P24NY.cjs → chunk-ISRXIKDS.cjs} +4 -4
  22. package/dist/{chunk-QVROTSA5.cjs → chunk-J7MLMW6O.cjs} +2 -2
  23. package/dist/{chunk-PVGSY24V.js → chunk-LDNCERLU.js} +7 -0
  24. package/dist/{chunk-S6WRT7GI.cjs → chunk-LRMKKZ6M.cjs} +2 -2
  25. package/dist/{chunk-BBAQW23O.cjs → chunk-OLSQRA2V.cjs} +7 -0
  26. package/dist/chunk-Q65UGFQK.cjs +70 -0
  27. package/dist/{chunk-ZAXPU6F2.cjs → chunk-QQ3KHYKE.cjs} +35 -5
  28. package/dist/{chunk-ZWYZGIV3.cjs → chunk-QQT4XTOG.cjs} +279 -73
  29. package/dist/{chunk-XUODQRSL.cjs → chunk-TGK6JO2D.cjs} +3 -3
  30. package/dist/{chunk-JYLH5IY3.cjs → chunk-VRDDTY4O.cjs} +87 -16
  31. package/dist/{chunk-SWJKOFCU.js → chunk-VZDPK54I.js} +262 -56
  32. package/dist/{chunk-HFEELWJO.js → chunk-YDGX5LRI.js} +274 -51
  33. package/dist/{chunk-7UNDRBOU.js → chunk-YLCFUSJ4.js} +86 -15
  34. package/dist/{chunk-IZGRJXUQ.js → chunk-Z7SBZ7XB.js} +1 -1
  35. package/dist/error/index.cjs +5 -5
  36. package/dist/error/index.d.cts +7 -0
  37. package/dist/error/index.d.ts +7 -0
  38. package/dist/error/index.js +1 -1
  39. package/dist/eval/index.d.cts +1 -1
  40. package/dist/eval/index.d.ts +1 -1
  41. package/dist/index.cjs +48 -48
  42. package/dist/index.d.cts +2 -2
  43. package/dist/index.d.ts +2 -2
  44. package/dist/index.js +12 -12
  45. package/dist/integration/index.d.cts +1 -1
  46. package/dist/integration/index.d.ts +1 -1
  47. package/dist/llm/index.d.cts +1 -1
  48. package/dist/llm/index.d.ts +1 -1
  49. package/dist/mastra/index.cjs +2 -2
  50. package/dist/mastra/index.d.cts +1 -1
  51. package/dist/mastra/index.d.ts +1 -1
  52. package/dist/mastra/index.js +1 -1
  53. package/dist/mcp/index.d.cts +1 -1
  54. package/dist/mcp/index.d.ts +1 -1
  55. package/dist/memory/index.cjs +4 -4
  56. package/dist/memory/index.d.cts +1 -1
  57. package/dist/memory/index.d.ts +1 -1
  58. package/dist/memory/index.js +1 -1
  59. package/dist/network/index.cjs +11 -5
  60. package/dist/network/index.d.cts +1 -1
  61. package/dist/network/index.d.ts +1 -1
  62. package/dist/network/index.js +10 -4
  63. package/dist/relevance/index.cjs +4 -4
  64. package/dist/relevance/index.d.cts +1 -1
  65. package/dist/relevance/index.d.ts +1 -1
  66. package/dist/relevance/index.js +1 -1
  67. package/dist/server/index.cjs +9 -3
  68. package/dist/server/index.d.cts +2 -2
  69. package/dist/server/index.d.ts +2 -2
  70. package/dist/server/index.js +8 -2
  71. package/dist/storage/index.cjs +12 -12
  72. package/dist/storage/index.d.cts +2 -2
  73. package/dist/storage/index.d.ts +2 -2
  74. package/dist/storage/index.js +4 -4
  75. package/dist/telemetry/index.cjs +7 -7
  76. package/dist/telemetry/index.d.cts +1 -1
  77. package/dist/telemetry/index.d.ts +1 -1
  78. package/dist/telemetry/index.js +1 -1
  79. package/dist/tools/index.d.cts +2 -2
  80. package/dist/tools/index.d.ts +2 -2
  81. package/dist/tts/index.cjs +2 -2
  82. package/dist/tts/index.js +1 -1
  83. package/dist/utils.cjs +14 -14
  84. package/dist/utils.d.cts +2 -2
  85. package/dist/utils.d.ts +2 -2
  86. package/dist/utils.js +1 -1
  87. package/dist/vector/index.cjs +2 -2
  88. package/dist/vector/index.js +1 -1
  89. package/dist/voice/index.cjs +4 -4
  90. package/dist/voice/index.d.cts +1 -1
  91. package/dist/voice/index.d.ts +1 -1
  92. package/dist/voice/index.js +1 -1
  93. package/dist/workflows/index.cjs +9 -9
  94. package/dist/workflows/index.d.cts +14 -7
  95. package/dist/workflows/index.d.ts +14 -7
  96. package/dist/workflows/index.js +1 -1
  97. package/dist/workflows/legacy/index.cjs +22 -22
  98. package/dist/workflows/legacy/index.d.cts +2 -2
  99. package/dist/workflows/legacy/index.d.ts +2 -2
  100. package/dist/workflows/legacy/index.js +1 -1
  101. package/package.json +3 -3
  102. package/dist/chunk-IM7CLVLZ.js +0 -43
  103. package/dist/chunk-LEK3J7YN.cjs +0 -45
@@ -0,0 +1,70 @@
1
+ 'use strict';
2
+
3
+ var chunkOLSQRA2V_cjs = require('./chunk-OLSQRA2V.cjs');
4
+ var chunkP3Q73CAW_cjs = require('./chunk-P3Q73CAW.cjs');
5
+
6
+ // src/vector/vector.ts
7
+ var MastraVector = class extends chunkP3Q73CAW_cjs.MastraBase {
8
+ constructor() {
9
+ super({ name: "MastraVector", component: "VECTOR" });
10
+ }
11
+ get indexSeparator() {
12
+ return "_";
13
+ }
14
+ async validateExistingIndex(indexName, dimension, metric) {
15
+ let info;
16
+ try {
17
+ info = await this.describeIndex({ indexName });
18
+ } catch (infoError) {
19
+ const mastraError = new chunkOLSQRA2V_cjs.MastraError(
20
+ {
21
+ id: "VECTOR_VALIDATE_INDEX_FETCH_FAILED",
22
+ text: `Index "${indexName}" already exists, but failed to fetch index info for dimension check.`,
23
+ domain: "MASTRA_VECTOR" /* MASTRA_VECTOR */,
24
+ category: "SYSTEM" /* SYSTEM */,
25
+ details: { indexName }
26
+ },
27
+ infoError
28
+ );
29
+ this.logger?.trackException(mastraError);
30
+ this.logger?.error(mastraError.toString());
31
+ throw mastraError;
32
+ }
33
+ const existingDim = info?.dimension;
34
+ const existingMetric = info?.metric;
35
+ if (existingDim === dimension) {
36
+ this.logger?.info(
37
+ `Index "${indexName}" already exists with ${existingDim} dimensions and metric ${existingMetric}, skipping creation.`
38
+ );
39
+ if (existingMetric !== metric) {
40
+ this.logger?.warn(
41
+ `Attempted to create index with metric "${metric}", but index already exists with metric "${existingMetric}". To use a different metric, delete and recreate the index.`
42
+ );
43
+ }
44
+ } else if (info) {
45
+ const mastraError = new chunkOLSQRA2V_cjs.MastraError({
46
+ id: "VECTOR_VALIDATE_INDEX_DIMENSION_MISMATCH",
47
+ text: `Index "${indexName}" already exists with ${existingDim} dimensions, but ${dimension} dimensions were requested`,
48
+ domain: "MASTRA_VECTOR" /* MASTRA_VECTOR */,
49
+ category: "USER" /* USER */,
50
+ details: { indexName, existingDim, requestedDim: dimension }
51
+ });
52
+ this.logger?.trackException(mastraError);
53
+ this.logger?.error(mastraError.toString());
54
+ throw mastraError;
55
+ } else {
56
+ const mastraError = new chunkOLSQRA2V_cjs.MastraError({
57
+ id: "VECTOR_VALIDATE_INDEX_NO_DIMENSION",
58
+ text: `Index "${indexName}" already exists, but could not retrieve its dimensions for validation.`,
59
+ domain: "MASTRA_VECTOR" /* MASTRA_VECTOR */,
60
+ category: "SYSTEM" /* SYSTEM */,
61
+ details: { indexName }
62
+ });
63
+ this.logger?.trackException(mastraError);
64
+ this.logger?.error(mastraError.toString());
65
+ throw mastraError;
66
+ }
67
+ }
68
+ };
69
+
70
+ exports.MastraVector = MastraVector;
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ var chunkOLSQRA2V_cjs = require('./chunk-OLSQRA2V.cjs');
3
4
  var api = require('@opentelemetry/api');
4
5
  var core = require('@opentelemetry/core');
5
6
  var otlpTransformer = require('@opentelemetry/otlp-transformer');
6
7
 
7
- // src/telemetry/telemetry.decorators.ts
8
8
  function hasActiveTelemetry(tracerName = "default-tracer") {
9
9
  try {
10
10
  return !!api.trace.getTracer(tracerName);
@@ -317,7 +317,24 @@ var OTLPTraceExporter = class {
317
317
  code: core.ExportResultCode.SUCCESS
318
318
  });
319
319
  }).catch((e) => {
320
- this.logger.error("span err:" + e?.message);
320
+ const mastraError = new chunkOLSQRA2V_cjs.MastraError(
321
+ {
322
+ id: "OTLP_TRACE_EXPORT_FAILURE",
323
+ text: "Failed to export telemetry spans",
324
+ domain: "MASTRA_TELEMETRY" /* MASTRA_TELEMETRY */,
325
+ category: "SYSTEM" /* SYSTEM */,
326
+ details: {
327
+ attemptedSpanCount: allSpans.length,
328
+ targetTable: TABLE_TRACES,
329
+ firstSpanName: allSpans.length > 0 ? allSpans[0].name : "",
330
+ firstSpanKind: allSpans.length > 0 ? allSpans[0].kind : "",
331
+ firstSpanScope: allSpans.length > 0 ? allSpans[0].scope : ""
332
+ }
333
+ },
334
+ e
335
+ );
336
+ this.logger.trackException(mastraError);
337
+ this.logger.error("span err:" + mastraError.toString());
321
338
  items.resultCallback({
322
339
  code: core.ExportResultCode.FAILED,
323
340
  error: e
@@ -363,8 +380,16 @@ var Telemetry = class _Telemetry {
363
380
  }
364
381
  return global.__TELEMETRY__;
365
382
  } catch (error) {
366
- console.error("Failed to initialize telemetry:", error);
367
- throw error;
383
+ const wrappedError = new chunkOLSQRA2V_cjs.MastraError(
384
+ {
385
+ id: "TELEMETRY_INIT_FAILED",
386
+ text: "Failed to initialize telemetry",
387
+ domain: "MASTRA_TELEMETRY" /* MASTRA_TELEMETRY */,
388
+ category: "SYSTEM" /* SYSTEM */
389
+ },
390
+ error
391
+ );
392
+ throw wrappedError;
368
393
  }
369
394
  }
370
395
  static getActiveSpan() {
@@ -378,7 +403,12 @@ var Telemetry = class _Telemetry {
378
403
  */
379
404
  static get() {
380
405
  if (!global.__TELEMETRY__) {
381
- throw new Error("Telemetry not initialized");
406
+ throw new chunkOLSQRA2V_cjs.MastraError({
407
+ id: "TELEMETRY_GETTER_FAILED_GLOBAL_TELEMETRY_NOT_INITIALIZED",
408
+ text: "Telemetry not initialized",
409
+ domain: "MASTRA_TELEMETRY" /* MASTRA_TELEMETRY */,
410
+ category: "USER" /* USER */
411
+ });
382
412
  }
383
413
  return global.__TELEMETRY__;
384
414
  }