@mastra/core 0.2.0-alpha.99 → 0.2.0

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 (84) hide show
  1. package/dist/agent/index.d.ts +6 -8
  2. package/dist/agent/index.js +15 -7
  3. package/dist/{telemetry-oCUM52DG.d.ts → base-BbtPAA6f.d.ts} +50 -8
  4. package/dist/{index-Cwb-5AzX.d.ts → base-Bpb7Dmwe.d.ts} +367 -320
  5. package/dist/base.d.ts +3 -43
  6. package/dist/base.js +3 -3
  7. package/dist/bundler/index.d.ts +3 -4
  8. package/dist/bundler/index.js +4 -4
  9. package/dist/{chunk-MCB4M5W4.js → chunk-22LC46YN.js} +3 -9
  10. package/dist/{chunk-A7SNFYQB.js → chunk-2JL6DQMZ.js} +20 -28
  11. package/dist/chunk-2SAHBQEF.js +3 -0
  12. package/dist/chunk-3HBFW3Q7.js +24 -0
  13. package/dist/{chunk-KNPBNSJ7.js → chunk-55GTEVHJ.js} +12 -13
  14. package/dist/chunk-65VPTVVP.js +218 -0
  15. package/dist/chunk-AWEACB2T.js +66 -0
  16. package/dist/chunk-C6A6W6XS.js +49 -0
  17. package/dist/chunk-FGZVE4CM.js +404 -0
  18. package/dist/{chunk-DHCULRJM.js → chunk-J3W3IHDO.js} +114 -88
  19. package/dist/chunk-K36NSQWH.js +10 -0
  20. package/dist/{chunk-EO3TIPGQ.js → chunk-K4DFI76V.js} +382 -370
  21. package/dist/{chunk-42DYOLDV.js → chunk-MEISIZMP.js} +13 -21
  22. package/dist/chunk-MLWGYRJR.js +87 -0
  23. package/dist/{chunk-ICMEXHKD.js → chunk-O2VP5JBC.js} +48 -55
  24. package/dist/{chunk-ZJOMHCWE.js → chunk-OJ26F3J4.js} +98 -153
  25. package/dist/chunk-RG66XEJT.js +8 -0
  26. package/dist/chunk-SB37QG7O.js +1203 -0
  27. package/dist/chunk-SDBM53G4.js +32 -0
  28. package/dist/{chunk-4LJFWC2Q.js → chunk-SIFBBGY6.js} +59 -85
  29. package/dist/chunk-U6J2FOU4.js +624 -0
  30. package/dist/chunk-VB7CO5ND.js +31 -0
  31. package/dist/{chunk-C55JWGDU.js → chunk-ZJOXJFJI.js} +43 -15
  32. package/dist/deployer/index.d.ts +2 -4
  33. package/dist/deployer/index.js +5 -5
  34. package/dist/eval/index.d.ts +8 -13
  35. package/dist/eval/index.js +3 -3
  36. package/dist/filter/index.js +2 -2
  37. package/dist/hooks/index.d.ts +13 -18
  38. package/dist/hooks/index.js +2 -2
  39. package/dist/{index-CBZ2mk2H.d.ts → index-B2JCcAQt.d.ts} +1 -1
  40. package/dist/index.d.ts +15 -15
  41. package/dist/index.js +43 -69
  42. package/dist/integration/index.d.ts +8 -10
  43. package/dist/integration/index.js +6 -3
  44. package/dist/llm/index.d.ts +6 -8
  45. package/dist/llm/index.js +1 -1
  46. package/dist/logger/index.d.ts +1 -1
  47. package/dist/logger/index.js +2 -2
  48. package/dist/mastra/index.d.ts +10 -13
  49. package/dist/mastra/index.js +20 -9
  50. package/dist/memory/index.d.ts +8 -10
  51. package/dist/memory/index.js +11 -9
  52. package/dist/relevance/index.js +16 -8
  53. package/dist/storage/index.d.ts +21 -10
  54. package/dist/storage/index.js +8 -7
  55. package/dist/telemetry/index.d.ts +35 -5
  56. package/dist/telemetry/index.js +3 -2
  57. package/dist/telemetry/otel-vendor.d.ts +7 -0
  58. package/dist/telemetry/otel-vendor.js +8 -0
  59. package/dist/tools/index.d.ts +6 -8
  60. package/dist/tools/index.js +2 -2
  61. package/dist/tts/index.d.ts +2 -4
  62. package/dist/tts/index.js +6 -5
  63. package/dist/{metric-BWeQNZt6.d.ts → types-m9RryK9a.d.ts} +6 -1
  64. package/dist/utils.js +2 -2
  65. package/dist/vector/index.d.ts +4 -6
  66. package/dist/vector/index.js +4 -4
  67. package/dist/vector/libsql/index.d.ts +2 -4
  68. package/dist/vector/libsql/index.js +6 -6
  69. package/dist/{workflow-DTtv7_Eq.d.ts → workflow-Cy8UTGCt.d.ts} +3 -6
  70. package/dist/workflows/index.d.ts +7 -9
  71. package/dist/workflows/index.js +4 -4
  72. package/package.json +14 -10
  73. package/dist/chunk-4ZUSEHLH.js +0 -285
  74. package/dist/chunk-AJJZUHB4.js +0 -14
  75. package/dist/chunk-G4MCO7XF.js +0 -70
  76. package/dist/chunk-HBTQNIAX.js +0 -90
  77. package/dist/chunk-HPXWJBQK.js +0 -222
  78. package/dist/chunk-JJ57BXQR.js +0 -16
  79. package/dist/chunk-JP37ODNX.js +0 -36
  80. package/dist/chunk-K3N7KJHH.js +0 -52
  81. package/dist/chunk-MDM2JS2U.js +0 -1288
  82. package/dist/chunk-VOUPGVRD.js +0 -27
  83. package/dist/chunk-Z7JFMQZZ.js +0 -551
  84. /package/dist/{chunk-AE3H2QEY.js → chunk-VDOJTUYY.js} +0 -0
@@ -0,0 +1,32 @@
1
+ import { InstrumentClass } from './chunk-FGZVE4CM.js';
2
+ import { MastraBase } from './chunk-AWEACB2T.js';
3
+ import { __decoratorStart, __decorateElement, __runInitializers } from './chunk-C6A6W6XS.js';
4
+
5
+ // src/tts/index.ts
6
+ var _MastraTTS_decorators, _init, _a;
7
+ _MastraTTS_decorators = [InstrumentClass({
8
+ prefix: "tts",
9
+ excludeMethods: ["__setTools", "__setLogger", "__setTelemetry", "#log"]
10
+ })];
11
+ var MastraTTS = class extends (_a = MastraBase) {
12
+ model;
13
+ constructor({ model }) {
14
+ super({
15
+ component: "TTS"
16
+ });
17
+ this.model = model;
18
+ }
19
+ traced(method, methodName) {
20
+ return this.telemetry?.traceMethod(method, {
21
+ spanName: `${this.model.name}-tts.${methodName}`,
22
+ attributes: {
23
+ "tts.type": `${this.model.name}`
24
+ }
25
+ }) ?? method;
26
+ }
27
+ };
28
+ _init = __decoratorStart(_a);
29
+ MastraTTS = __decorateElement(_init, 0, "MastraTTS", _MastraTTS_decorators, MastraTTS);
30
+ __runInitializers(_init, 1, MastraTTS);
31
+
32
+ export { MastraTTS };
@@ -1,31 +1,42 @@
1
- import { __name, __publicField } from './chunk-AJJZUHB4.js';
2
-
3
1
  // src/filter/base.ts
4
- var _a;
5
- var BaseFilterTranslator = (_a = class {
2
+ var BaseFilterTranslator = class _BaseFilterTranslator {
6
3
  /**
7
- * Operator type checks
8
- */
4
+ * Operator type checks
5
+ */
9
6
  isOperator(key) {
10
7
  return key.startsWith("$");
11
8
  }
9
+ static BASIC_OPERATORS = ["$eq", "$ne"];
10
+ static NUMERIC_OPERATORS = ["$gt", "$gte", "$lt", "$lte"];
11
+ static ARRAY_OPERATORS = ["$in", "$nin", "$all", "$elemMatch"];
12
+ static LOGICAL_OPERATORS = ["$and", "$or", "$not", "$nor"];
13
+ static ELEMENT_OPERATORS = ["$exists"];
14
+ static REGEX_OPERATORS = ["$regex", "$options"];
15
+ static DEFAULT_OPERATORS = {
16
+ logical: _BaseFilterTranslator.LOGICAL_OPERATORS,
17
+ basic: _BaseFilterTranslator.BASIC_OPERATORS,
18
+ numeric: _BaseFilterTranslator.NUMERIC_OPERATORS,
19
+ array: _BaseFilterTranslator.ARRAY_OPERATORS,
20
+ element: _BaseFilterTranslator.ELEMENT_OPERATORS,
21
+ regex: _BaseFilterTranslator.REGEX_OPERATORS
22
+ };
12
23
  isLogicalOperator(key) {
13
- return _a.DEFAULT_OPERATORS.logical.includes(key);
24
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.logical.includes(key);
14
25
  }
15
26
  isBasicOperator(key) {
16
- return _a.DEFAULT_OPERATORS.basic.includes(key);
27
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.basic.includes(key);
17
28
  }
18
29
  isNumericOperator(key) {
19
- return _a.DEFAULT_OPERATORS.numeric.includes(key);
30
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.numeric.includes(key);
20
31
  }
21
32
  isArrayOperator(key) {
22
- return _a.DEFAULT_OPERATORS.array.includes(key);
33
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.array.includes(key);
23
34
  }
24
35
  isElementOperator(key) {
25
- return _a.DEFAULT_OPERATORS.element.includes(key);
36
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.element.includes(key);
26
37
  }
27
38
  isRegexOperator(key) {
28
- return _a.DEFAULT_OPERATORS.regex.includes(key);
39
+ return _BaseFilterTranslator.DEFAULT_OPERATORS.regex.includes(key);
29
40
  }
30
41
  isFieldOperator(key) {
31
42
  return this.isOperator(key) && !this.isLogicalOperator(key);
@@ -35,7 +46,7 @@ var BaseFilterTranslator = (_a = class {
35
46
  return support.custom?.includes(key) ?? false;
36
47
  }
37
48
  getSupportedOperators() {
38
- return _a.DEFAULT_OPERATORS;
49
+ return _BaseFilterTranslator.DEFAULT_OPERATORS;
39
50
  }
40
51
  isValidOperator(key) {
41
52
  const support = this.getSupportedOperators();
@@ -43,8 +54,8 @@ var BaseFilterTranslator = (_a = class {
43
54
  return allSupported.includes(key);
44
55
  }
45
56
  /**
46
- * Value normalization for comparison operators
47
- */
57
+ * Value normalization for comparison operators
58
+ */
48
59
  normalizeComparisonValue(value) {
49
60
  if (value instanceof Date) {
50
61
  return value.toISOString();
@@ -55,23 +66,19 @@ var BaseFilterTranslator = (_a = class {
55
66
  return value;
56
67
  }
57
68
  /**
58
- * Helper method to simulate $all operator using $and + $eq when needed.
59
- * Some vector stores don't support $all natively.
60
- */
69
+ * Helper method to simulate $all operator using $and + $eq when needed.
70
+ * Some vector stores don't support $all natively.
71
+ */
61
72
  simulateAllOperator(field, values) {
62
73
  return {
63
74
  $and: values.map((value) => ({
64
- [field]: {
65
- $in: [
66
- this.normalizeComparisonValue(value)
67
- ]
68
- }
75
+ [field]: { $in: [this.normalizeComparisonValue(value)] }
69
76
  }))
70
77
  };
71
78
  }
72
79
  /**
73
- * Utility functions for type checking
74
- */
80
+ * Utility functions for type checking
81
+ */
75
82
  isPrimitive(value) {
76
83
  return value === null || value === undefined || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
77
84
  }
@@ -81,9 +88,18 @@ var BaseFilterTranslator = (_a = class {
81
88
  isEmpty(obj) {
82
89
  return obj === null || obj === undefined || typeof obj === "object" && Object.keys(obj).length === 0;
83
90
  }
91
+ static ErrorMessages = {
92
+ UNSUPPORTED_OPERATOR: (op) => `Unsupported operator: ${op}`,
93
+ INVALID_LOGICAL_OPERATOR_LOCATION: (op, path) => `Logical operator ${op} cannot be used at field level: ${path}`,
94
+ NOT_REQUIRES_OBJECT: `$not operator requires an object`,
95
+ NOT_CANNOT_BE_EMPTY: `$not operator cannot be empty`,
96
+ INVALID_LOGICAL_OPERATOR_CONTENT: (path) => `Logical operators must contain field conditions, not direct operators: ${path}`,
97
+ INVALID_TOP_LEVEL_OPERATOR: (op) => `Invalid top-level operator: ${op}`,
98
+ ELEM_MATCH_REQUIRES_OBJECT: `$elemMatch requires an object with conditions`
99
+ };
84
100
  /**
85
- * Helper to handle array value normalization consistently
86
- */
101
+ * Helper to handle array value normalization consistently
102
+ */
87
103
  normalizeArrayValues(values) {
88
104
  return values.map((value) => this.normalizeComparisonValue(value));
89
105
  }
@@ -94,16 +110,13 @@ var BaseFilterTranslator = (_a = class {
94
110
  }
95
111
  }
96
112
  /**
97
- * Validates if a filter structure is supported by the specific vector DB
98
- * and returns detailed validation information.
99
- */
113
+ * Validates if a filter structure is supported by the specific vector DB
114
+ * and returns detailed validation information.
115
+ */
100
116
  validateFilterSupport(node, path = "") {
101
117
  const messages = [];
102
118
  if (this.isPrimitive(node) || this.isEmpty(node)) {
103
- return {
104
- supported: true,
105
- messages: []
106
- };
119
+ return { supported: true, messages: [] };
107
120
  }
108
121
  if (Array.isArray(node)) {
109
122
  const arrayResults = node.map((item) => this.validateFilterSupport(item, path));
@@ -120,43 +133,45 @@ var BaseFilterTranslator = (_a = class {
120
133
  if (this.isOperator(key)) {
121
134
  if (!this.isValidOperator(key)) {
122
135
  isSupported = false;
123
- messages.push(_a.ErrorMessages.UNSUPPORTED_OPERATOR(key));
136
+ messages.push(_BaseFilterTranslator.ErrorMessages.UNSUPPORTED_OPERATOR(key));
124
137
  continue;
125
138
  }
126
139
  if (!path && !this.isLogicalOperator(key)) {
127
140
  isSupported = false;
128
- messages.push(_a.ErrorMessages.INVALID_TOP_LEVEL_OPERATOR(key));
141
+ messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_TOP_LEVEL_OPERATOR(key));
129
142
  continue;
130
143
  }
131
144
  if (key === "$elemMatch" && (typeof value !== "object" || Array.isArray(value))) {
132
145
  isSupported = false;
133
- messages.push(_a.ErrorMessages.ELEM_MATCH_REQUIRES_OBJECT);
146
+ messages.push(_BaseFilterTranslator.ErrorMessages.ELEM_MATCH_REQUIRES_OBJECT);
134
147
  continue;
135
148
  }
136
149
  if (this.isLogicalOperator(key)) {
137
150
  if (key === "$not") {
138
151
  if (Array.isArray(value) || typeof value !== "object") {
139
152
  isSupported = false;
140
- messages.push(_a.ErrorMessages.NOT_REQUIRES_OBJECT);
153
+ messages.push(_BaseFilterTranslator.ErrorMessages.NOT_REQUIRES_OBJECT);
141
154
  continue;
142
155
  }
143
156
  if (this.isEmpty(value)) {
144
157
  isSupported = false;
145
- messages.push(_a.ErrorMessages.NOT_CANNOT_BE_EMPTY);
158
+ messages.push(_BaseFilterTranslator.ErrorMessages.NOT_CANNOT_BE_EMPTY);
146
159
  continue;
147
160
  }
148
161
  continue;
149
162
  }
150
163
  if (path && !this.isLogicalOperator(path.split(".").pop())) {
151
164
  isSupported = false;
152
- messages.push(_a.ErrorMessages.INVALID_LOGICAL_OPERATOR_LOCATION(key, newPath));
165
+ messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_LOGICAL_OPERATOR_LOCATION(key, newPath));
153
166
  continue;
154
167
  }
155
168
  if (Array.isArray(value)) {
156
- const hasDirectOperators = value.some((item) => typeof item === "object" && Object.keys(item).length === 1 && this.isFieldOperator(Object.keys(item)[0]));
169
+ const hasDirectOperators = value.some(
170
+ (item) => typeof item === "object" && Object.keys(item).length === 1 && this.isFieldOperator(Object.keys(item)[0])
171
+ );
157
172
  if (hasDirectOperators) {
158
173
  isSupported = false;
159
- messages.push(_a.ErrorMessages.INVALID_LOGICAL_OPERATOR_CONTENT(newPath));
174
+ messages.push(_BaseFilterTranslator.ErrorMessages.INVALID_LOGICAL_OPERATOR_CONTENT(newPath));
160
175
  continue;
161
176
  }
162
177
  }
@@ -168,49 +183,8 @@ var BaseFilterTranslator = (_a = class {
168
183
  messages.push(...nestedValidation.messages);
169
184
  }
170
185
  }
171
- return {
172
- supported: isSupported,
173
- messages
174
- };
186
+ return { supported: isSupported, messages };
175
187
  }
176
- }, __name(_a, "BaseFilterTranslator"), __publicField(_a, "BASIC_OPERATORS", [
177
- "$eq",
178
- "$ne"
179
- ]), __publicField(_a, "NUMERIC_OPERATORS", [
180
- "$gt",
181
- "$gte",
182
- "$lt",
183
- "$lte"
184
- ]), __publicField(_a, "ARRAY_OPERATORS", [
185
- "$in",
186
- "$nin",
187
- "$all",
188
- "$elemMatch"
189
- ]), __publicField(_a, "LOGICAL_OPERATORS", [
190
- "$and",
191
- "$or",
192
- "$not",
193
- "$nor"
194
- ]), __publicField(_a, "ELEMENT_OPERATORS", [
195
- "$exists"
196
- ]), __publicField(_a, "REGEX_OPERATORS", [
197
- "$regex",
198
- "$options"
199
- ]), __publicField(_a, "DEFAULT_OPERATORS", {
200
- logical: _a.LOGICAL_OPERATORS,
201
- basic: _a.BASIC_OPERATORS,
202
- numeric: _a.NUMERIC_OPERATORS,
203
- array: _a.ARRAY_OPERATORS,
204
- element: _a.ELEMENT_OPERATORS,
205
- regex: _a.REGEX_OPERATORS
206
- }), __publicField(_a, "ErrorMessages", {
207
- UNSUPPORTED_OPERATOR: /* @__PURE__ */ __name((op) => `Unsupported operator: ${op}`, "UNSUPPORTED_OPERATOR"),
208
- INVALID_LOGICAL_OPERATOR_LOCATION: /* @__PURE__ */ __name((op, path) => `Logical operator ${op} cannot be used at field level: ${path}`, "INVALID_LOGICAL_OPERATOR_LOCATION"),
209
- NOT_REQUIRES_OBJECT: `$not operator requires an object`,
210
- NOT_CANNOT_BE_EMPTY: `$not operator cannot be empty`,
211
- INVALID_LOGICAL_OPERATOR_CONTENT: /* @__PURE__ */ __name((path) => `Logical operators must contain field conditions, not direct operators: ${path}`, "INVALID_LOGICAL_OPERATOR_CONTENT"),
212
- INVALID_TOP_LEVEL_OPERATOR: /* @__PURE__ */ __name((op) => `Invalid top-level operator: ${op}`, "INVALID_TOP_LEVEL_OPERATOR"),
213
- ELEM_MATCH_REQUIRES_OBJECT: `$elemMatch requires an object with conditions`
214
- }), _a);
188
+ };
215
189
 
216
190
  export { BaseFilterTranslator };