@mastra/core 0.10.2 → 0.10.4-alpha.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 (137) hide show
  1. package/dist/agent/index.cjs +4 -4
  2. package/dist/agent/index.d.cts +4 -3
  3. package/dist/agent/index.d.ts +4 -3
  4. package/dist/agent/index.js +2 -2
  5. package/dist/{base-BJBoI-g2.d.cts → base-BURd0RH-.d.cts} +48 -7
  6. package/dist/{base-BY9WFI65.d.cts → base-Bi9KB0TN.d.ts} +19 -3
  7. package/dist/{base-C0yUw8BC.d.ts → base-CO-L7hF9.d.cts} +19 -3
  8. package/dist/{base-BEjkhvZ_.d.ts → base-nFL4giIu.d.ts} +48 -7
  9. package/dist/base.cjs +2 -2
  10. package/dist/base.d.cts +3 -2
  11. package/dist/base.d.ts +3 -2
  12. package/dist/base.js +1 -1
  13. package/dist/bundler/index.cjs +2 -2
  14. package/dist/bundler/index.d.cts +3 -2
  15. package/dist/bundler/index.d.ts +3 -2
  16. package/dist/bundler/index.js +1 -1
  17. package/dist/{chunk-NMDM4IZN.cjs → chunk-2D7NOO7S.cjs} +16 -11
  18. package/dist/{chunk-3JGO7S6X.cjs → chunk-33LPXZPZ.cjs} +2 -2
  19. package/dist/{chunk-JOCKZ2US.js → chunk-5IEKR756.js} +1 -1
  20. package/dist/{chunk-XXVGT7SJ.js → chunk-5YDTZN2X.js} +32 -9
  21. package/dist/{chunk-DTJ4KVHM.js → chunk-ATXBSEFT.js} +1 -1
  22. package/dist/chunk-BBAQW23O.cjs +68 -0
  23. package/dist/{chunk-OBEALYTK.js → chunk-DO5R43AJ.js} +16 -11
  24. package/dist/{chunk-7AWGDSGR.js → chunk-DU32FMDF.js} +3 -3
  25. package/dist/{chunk-CYJF6U6B.cjs → chunk-FEYYOBBG.cjs} +2 -2
  26. package/dist/{chunk-HZ7ME4LD.cjs → chunk-FFYVLKQW.cjs} +2 -2
  27. package/dist/{chunk-5G3XWKIU.cjs → chunk-FJXOUO3F.cjs} +2 -2
  28. package/dist/{chunk-FGBS7VRU.js → chunk-FNQU5CHU.js} +3 -3
  29. package/dist/{chunk-JBTXWDNO.js → chunk-GEDW7TMB.js} +9 -9
  30. package/dist/{chunk-KUJQVCEL.cjs → chunk-H5IRI46R.cjs} +6 -3
  31. package/dist/{chunk-FLPSXJWQ.js → chunk-HJML6BS7.js} +1 -1
  32. package/dist/{chunk-B2RDYK2X.js → chunk-IG7FGYSW.js} +1 -1
  33. package/dist/{chunk-PMAVDBJY.js → chunk-IM7CLVLZ.js} +1 -1
  34. package/dist/{chunk-XJCP3SLA.js → chunk-JNMQKJH4.js} +1 -1
  35. package/dist/{chunk-WE5ABCZN.js → chunk-KIKYEFSA.js} +3 -3
  36. package/dist/{chunk-VBSKHNCY.cjs → chunk-KQ2KYQLN.cjs} +9 -9
  37. package/dist/{chunk-TAHSAZUN.cjs → chunk-LEK3J7YN.cjs} +2 -2
  38. package/dist/{chunk-TO5645ZP.cjs → chunk-MHN2BI4P.cjs} +25 -25
  39. package/dist/{chunk-VHZPWE5L.cjs → chunk-P3Q73CAW.cjs} +6 -6
  40. package/dist/chunk-PVGSY24V.js +63 -0
  41. package/dist/chunk-QVROTSA5.cjs +408 -0
  42. package/dist/{chunk-SH2C4VTJ.cjs → chunk-QVTGHY2K.cjs} +21 -10
  43. package/dist/{chunk-S4TS74VT.cjs → chunk-RORSYAKV.cjs} +7 -7
  44. package/dist/{chunk-7MWWPVCE.js → chunk-RSN3NZQS.js} +1 -1
  45. package/dist/chunk-TRJIWZKM.js +390 -0
  46. package/dist/{chunk-ZPOETARN.js → chunk-V6I25JEV.js} +1 -1
  47. package/dist/{chunk-SKYO5NFQ.cjs → chunk-VAOBU5SY.cjs} +8 -8
  48. package/dist/{chunk-X6VHQCYN.cjs → chunk-W5I6MEVU.cjs} +2 -2
  49. package/dist/{chunk-JAVP6ACT.js → chunk-YCYAVLYR.js} +4 -1
  50. package/dist/{chunk-TIPFGQCO.js → chunk-YKJZX7TE.js} +18 -7
  51. package/dist/{chunk-RFAN7FAT.cjs → chunk-ZIZ3CVHN.cjs} +32 -9
  52. package/dist/{chunk-PKYG5CWB.cjs → chunk-ZZLBNB3U.cjs} +2 -2
  53. package/dist/deployer/index.cjs +2 -2
  54. package/dist/deployer/index.d.cts +3 -2
  55. package/dist/deployer/index.d.ts +3 -2
  56. package/dist/deployer/index.js +1 -1
  57. package/dist/error/index.cjs +19 -72
  58. package/dist/error/index.d.cts +25 -31
  59. package/dist/error/index.d.ts +25 -31
  60. package/dist/error/index.js +1 -70
  61. package/dist/eval/index.d.cts +4 -3
  62. package/dist/eval/index.d.ts +4 -3
  63. package/dist/index.cjs +45 -45
  64. package/dist/index.d.cts +6 -5
  65. package/dist/index.d.ts +6 -5
  66. package/dist/index.js +13 -13
  67. package/dist/integration/index.d.cts +4 -3
  68. package/dist/integration/index.d.ts +4 -3
  69. package/dist/llm/index.d.cts +4 -3
  70. package/dist/llm/index.d.ts +4 -3
  71. package/dist/logger/index.cjs +10 -10
  72. package/dist/logger/index.d.cts +60 -7
  73. package/dist/logger/index.d.ts +60 -7
  74. package/dist/logger/index.js +2 -2
  75. package/dist/logger-CpL0z5v_.d.cts +158 -0
  76. package/dist/logger-DtVDdb81.d.ts +158 -0
  77. package/dist/mastra/index.cjs +2 -2
  78. package/dist/mastra/index.d.cts +5 -4
  79. package/dist/mastra/index.d.ts +5 -4
  80. package/dist/mastra/index.js +1 -1
  81. package/dist/mcp/index.cjs +4 -4
  82. package/dist/mcp/index.d.cts +5 -4
  83. package/dist/mcp/index.d.ts +5 -4
  84. package/dist/mcp/index.js +3 -3
  85. package/dist/memory/index.cjs +4 -4
  86. package/dist/memory/index.d.cts +4 -3
  87. package/dist/memory/index.d.ts +4 -3
  88. package/dist/memory/index.js +1 -1
  89. package/dist/network/index.cjs +6 -6
  90. package/dist/network/index.d.cts +4 -3
  91. package/dist/network/index.d.ts +4 -3
  92. package/dist/network/index.js +3 -3
  93. package/dist/relevance/index.cjs +4 -4
  94. package/dist/relevance/index.d.cts +5 -4
  95. package/dist/relevance/index.d.ts +5 -4
  96. package/dist/relevance/index.js +1 -1
  97. package/dist/server/index.cjs +2 -2
  98. package/dist/server/index.d.cts +5 -4
  99. package/dist/server/index.d.ts +5 -4
  100. package/dist/server/index.js +1 -1
  101. package/dist/storage/index.cjs +5 -5
  102. package/dist/storage/index.d.cts +6 -5
  103. package/dist/storage/index.d.ts +6 -5
  104. package/dist/storage/index.js +3 -3
  105. package/dist/telemetry/index.d.cts +4 -3
  106. package/dist/telemetry/index.d.ts +4 -3
  107. package/dist/tools/index.d.cts +6 -5
  108. package/dist/tools/index.d.ts +6 -5
  109. package/dist/tts/index.cjs +2 -2
  110. package/dist/tts/index.d.cts +3 -2
  111. package/dist/tts/index.d.ts +3 -2
  112. package/dist/tts/index.js +1 -1
  113. package/dist/utils.cjs +14 -14
  114. package/dist/utils.d.cts +4 -3
  115. package/dist/utils.d.ts +4 -3
  116. package/dist/utils.js +1 -1
  117. package/dist/vector/index.cjs +2 -2
  118. package/dist/vector/index.d.cts +3 -2
  119. package/dist/vector/index.d.ts +3 -2
  120. package/dist/vector/index.js +1 -1
  121. package/dist/voice/index.cjs +4 -4
  122. package/dist/voice/index.d.cts +4 -3
  123. package/dist/voice/index.d.ts +4 -3
  124. package/dist/voice/index.js +1 -1
  125. package/dist/workflows/index.cjs +9 -9
  126. package/dist/workflows/index.d.cts +5 -4
  127. package/dist/workflows/index.d.ts +5 -4
  128. package/dist/workflows/index.js +1 -1
  129. package/dist/workflows/legacy/index.cjs +22 -22
  130. package/dist/workflows/legacy/index.d.cts +5 -4
  131. package/dist/workflows/legacy/index.d.ts +5 -4
  132. package/dist/workflows/legacy/index.js +1 -1
  133. package/package.json +9 -10
  134. package/dist/chunk-WWLMZIHW.cjs +0 -995
  135. package/dist/chunk-Y5BGCPNZ.js +0 -977
  136. package/dist/logger-BF2Sn7JX.d.cts +0 -79
  137. package/dist/logger-BF2Sn7JX.d.ts +0 -79
@@ -0,0 +1,63 @@
1
+ // src/error/index.ts
2
+ var ErrorDomain = /* @__PURE__ */ ((ErrorDomain2) => {
3
+ ErrorDomain2["TOOL"] = "TOOL";
4
+ ErrorDomain2["AGENT"] = "AGENT";
5
+ ErrorDomain2["MCP"] = "MCP";
6
+ ErrorDomain2["UNKNOWN"] = "UNKNOWN";
7
+ return ErrorDomain2;
8
+ })(ErrorDomain || {});
9
+ var ErrorCategory = /* @__PURE__ */ ((ErrorCategory2) => {
10
+ ErrorCategory2["UNKNOWN"] = "UNKNOWN";
11
+ ErrorCategory2["USER"] = "USER";
12
+ ErrorCategory2["SYSTEM"] = "SYSTEM";
13
+ ErrorCategory2["THIRD_PARTY"] = "THIRD_PARTY";
14
+ return ErrorCategory2;
15
+ })(ErrorCategory || {});
16
+ var MastraBaseError = class extends Error {
17
+ id;
18
+ domain;
19
+ category;
20
+ details = {};
21
+ message;
22
+ constructor(errorDefinition, originalError) {
23
+ let error;
24
+ if (originalError instanceof Error) {
25
+ error = originalError;
26
+ } else if (originalError) {
27
+ error = new Error(String(originalError));
28
+ }
29
+ const message = errorDefinition.text ?? error?.message ?? "Unknown error";
30
+ super(message, { cause: error });
31
+ this.id = errorDefinition.id;
32
+ this.domain = errorDefinition.domain;
33
+ this.category = errorDefinition.category;
34
+ this.details = errorDefinition.details ?? {};
35
+ this.message = message;
36
+ Object.setPrototypeOf(this, new.target.prototype);
37
+ }
38
+ /**
39
+ * Returns a structured representation of the error, useful for logging or API responses.
40
+ */
41
+ toJSONDetails() {
42
+ return {
43
+ message: this.message,
44
+ domain: this.domain,
45
+ category: this.category,
46
+ details: this.details
47
+ };
48
+ }
49
+ toJSON() {
50
+ return {
51
+ message: this.message,
52
+ details: this.toJSONDetails(),
53
+ code: this.id
54
+ };
55
+ }
56
+ toString() {
57
+ return JSON.stringify(this.toJSON());
58
+ }
59
+ };
60
+ var MastraError = class extends MastraBaseError {
61
+ };
62
+
63
+ export { ErrorCategory, ErrorDomain, MastraBaseError, MastraError };
@@ -0,0 +1,408 @@
1
+ 'use strict';
2
+
3
+ var chunkBBAQW23O_cjs = require('./chunk-BBAQW23O.cjs');
4
+ var chunk4Z3OU5RY_cjs = require('./chunk-4Z3OU5RY.cjs');
5
+ var chunkP3Q73CAW_cjs = require('./chunk-P3Q73CAW.cjs');
6
+ var chunkLABUWBKX_cjs = require('./chunk-LABUWBKX.cjs');
7
+ var crypto = require('crypto');
8
+ var jsonSchemaToZod = require('json-schema-to-zod');
9
+ var zod = require('zod');
10
+ var schemaCompat = require('@mastra/schema-compat');
11
+
12
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
+
14
+ var jsonSchemaToZod__default = /*#__PURE__*/_interopDefault(jsonSchemaToZod);
15
+
16
+ var CoreToolBuilder = class extends chunkP3Q73CAW_cjs.MastraBase {
17
+ originalTool;
18
+ options;
19
+ logType;
20
+ constructor(input) {
21
+ super({ name: "CoreToolBuilder" });
22
+ this.originalTool = input.originalTool;
23
+ this.options = input.options;
24
+ this.logType = input.logType;
25
+ }
26
+ // Helper to get parameters based on tool type
27
+ getParameters = () => {
28
+ if (chunk4Z3OU5RY_cjs.isVercelTool(this.originalTool)) {
29
+ return this.originalTool.parameters ?? zod.z.object({});
30
+ }
31
+ return this.originalTool.inputSchema ?? zod.z.object({});
32
+ };
33
+ // For provider-defined tools, we need to include all required properties
34
+ buildProviderTool(tool) {
35
+ if ("type" in tool && tool.type === "provider-defined" && "id" in tool && typeof tool.id === "string" && tool.id.includes(".")) {
36
+ return {
37
+ type: "provider-defined",
38
+ id: tool.id,
39
+ args: "args" in this.originalTool ? this.originalTool.args : {},
40
+ description: tool.description,
41
+ parameters: schemaCompat.convertZodSchemaToAISDKSchema(this.getParameters()),
42
+ execute: this.originalTool.execute ? this.createExecute(
43
+ this.originalTool,
44
+ { ...this.options, description: this.originalTool.description },
45
+ this.logType
46
+ ) : void 0
47
+ };
48
+ }
49
+ return void 0;
50
+ }
51
+ createLogMessageOptions({ agentName, toolName, type }) {
52
+ if (!agentName) {
53
+ return {
54
+ start: `Executing tool ${toolName}`,
55
+ error: `Failed tool execution`
56
+ };
57
+ }
58
+ const prefix = `[Agent:${agentName}]`;
59
+ const toolType = type === "toolset" ? "toolset" : "tool";
60
+ return {
61
+ start: `${prefix} - Executing ${toolType} ${toolName}`,
62
+ error: `${prefix} - Failed ${toolType} execution`
63
+ };
64
+ }
65
+ createExecute(tool, options, logType) {
66
+ const { logger, mastra: _mastra, memory: _memory, runtimeContext, ...rest } = options;
67
+ const { start, error } = this.createLogMessageOptions({
68
+ agentName: options.agentName,
69
+ toolName: options.name,
70
+ type: logType
71
+ });
72
+ const execFunction = async (args, execOptions) => {
73
+ if (chunk4Z3OU5RY_cjs.isVercelTool(tool)) {
74
+ return tool?.execute?.(args, execOptions) ?? void 0;
75
+ }
76
+ return tool?.execute?.(
77
+ {
78
+ context: args,
79
+ threadId: options.threadId,
80
+ resourceId: options.resourceId,
81
+ mastra: options.mastra,
82
+ memory: options.memory,
83
+ runId: options.runId,
84
+ runtimeContext: options.runtimeContext ?? new chunkLABUWBKX_cjs.RuntimeContext()
85
+ },
86
+ execOptions
87
+ ) ?? void 0;
88
+ };
89
+ return async (args, execOptions) => {
90
+ let logger2 = options.logger || this.logger;
91
+ try {
92
+ logger2.debug(start, { ...rest, args });
93
+ return await execFunction(args, execOptions);
94
+ } catch (err) {
95
+ const mastraError = new chunkBBAQW23O_cjs.MastraError(
96
+ {
97
+ id: "TOOL_EXECUTION_FAILED",
98
+ domain: "TOOL" /* TOOL */,
99
+ category: "USER" /* USER */,
100
+ details: {
101
+ error,
102
+ args,
103
+ model: rest.model?.modelId ?? ""
104
+ }
105
+ },
106
+ err
107
+ );
108
+ logger2.trackException(mastraError);
109
+ logger2.error(error, { ...rest, error: mastraError, args });
110
+ throw mastraError;
111
+ }
112
+ };
113
+ }
114
+ build() {
115
+ const providerTool = this.buildProviderTool(this.originalTool);
116
+ if (providerTool) {
117
+ return providerTool;
118
+ }
119
+ const definition = {
120
+ type: "function",
121
+ description: this.originalTool.description,
122
+ parameters: this.getParameters(),
123
+ execute: this.originalTool.execute ? this.createExecute(
124
+ this.originalTool,
125
+ { ...this.options, description: this.originalTool.description },
126
+ this.logType
127
+ ) : void 0
128
+ };
129
+ const model = this.options.model;
130
+ const schemaCompatLayers = [];
131
+ if (model) {
132
+ schemaCompatLayers.push(
133
+ new schemaCompat.OpenAIReasoningSchemaCompatLayer(model),
134
+ new schemaCompat.OpenAISchemaCompatLayer(model),
135
+ new schemaCompat.GoogleSchemaCompatLayer(model),
136
+ new schemaCompat.AnthropicSchemaCompatLayer(model),
137
+ new schemaCompat.DeepSeekSchemaCompatLayer(model),
138
+ new schemaCompat.MetaSchemaCompatLayer(model)
139
+ );
140
+ }
141
+ const processedSchema = schemaCompat.applyCompatLayer({
142
+ schema: this.getParameters(),
143
+ compatLayers: schemaCompatLayers,
144
+ mode: "aiSdkSchema"
145
+ });
146
+ return {
147
+ ...definition,
148
+ parameters: processedSchema
149
+ };
150
+ }
151
+ };
152
+
153
+ // src/utils.ts
154
+ var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
155
+ function deepMerge(target, source) {
156
+ const output = { ...target };
157
+ if (!source) return output;
158
+ Object.keys(source).forEach((key) => {
159
+ const targetValue = output[key];
160
+ const sourceValue = source[key];
161
+ if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {
162
+ output[key] = sourceValue;
163
+ } else if (sourceValue instanceof Object && targetValue instanceof Object && !Array.isArray(sourceValue) && !Array.isArray(targetValue)) {
164
+ output[key] = deepMerge(targetValue, sourceValue);
165
+ } else if (sourceValue !== void 0) {
166
+ output[key] = sourceValue;
167
+ }
168
+ });
169
+ return output;
170
+ }
171
+ async function* maskStreamTags(stream, tag, options = {}) {
172
+ const { onStart, onEnd, onMask } = options;
173
+ const openTag = `<${tag}>`;
174
+ const closeTag = `</${tag}>`;
175
+ let buffer = "";
176
+ let fullContent = "";
177
+ let isMasking = false;
178
+ let isBuffering = false;
179
+ const trimOutsideDelimiter = (text, delimiter, trim) => {
180
+ if (!text.includes(delimiter)) {
181
+ return text;
182
+ }
183
+ const parts = text.split(delimiter);
184
+ if (trim === `before-start`) {
185
+ return `${delimiter}${parts[1]}`;
186
+ }
187
+ return `${parts[0]}${delimiter}`;
188
+ };
189
+ const startsWith = (text, pattern) => {
190
+ if (pattern.includes(openTag.substring(0, 3))) {
191
+ pattern = trimOutsideDelimiter(pattern, `<`, `before-start`);
192
+ }
193
+ return text.trim().startsWith(pattern.trim());
194
+ };
195
+ for await (const chunk of stream) {
196
+ fullContent += chunk;
197
+ if (isBuffering) buffer += chunk;
198
+ const chunkHasTag = startsWith(chunk, openTag);
199
+ const bufferHasTag = !chunkHasTag && isBuffering && startsWith(openTag, buffer);
200
+ let toYieldBeforeMaskedStartTag = ``;
201
+ if (!isMasking && (chunkHasTag || bufferHasTag)) {
202
+ isMasking = true;
203
+ isBuffering = false;
204
+ const taggedTextToMask = trimOutsideDelimiter(buffer, `<`, `before-start`);
205
+ if (taggedTextToMask !== buffer.trim()) {
206
+ toYieldBeforeMaskedStartTag = buffer.replace(taggedTextToMask, ``);
207
+ }
208
+ buffer = "";
209
+ onStart?.();
210
+ }
211
+ if (!isMasking && !isBuffering && startsWith(openTag, chunk) && chunk.trim() !== "") {
212
+ isBuffering = true;
213
+ buffer += chunk;
214
+ continue;
215
+ }
216
+ if (isBuffering && buffer && !startsWith(openTag, buffer)) {
217
+ yield buffer;
218
+ buffer = "";
219
+ isBuffering = false;
220
+ continue;
221
+ }
222
+ if (isMasking && fullContent.includes(closeTag)) {
223
+ onMask?.(chunk);
224
+ onEnd?.();
225
+ isMasking = false;
226
+ const lastFullContent = fullContent;
227
+ fullContent = ``;
228
+ const textUntilEndTag = trimOutsideDelimiter(lastFullContent, closeTag, "after-end");
229
+ if (textUntilEndTag !== lastFullContent) {
230
+ yield lastFullContent.replace(textUntilEndTag, ``);
231
+ }
232
+ continue;
233
+ }
234
+ if (isMasking) {
235
+ onMask?.(chunk);
236
+ if (toYieldBeforeMaskedStartTag) {
237
+ yield toYieldBeforeMaskedStartTag;
238
+ }
239
+ continue;
240
+ }
241
+ yield chunk;
242
+ }
243
+ }
244
+ function resolveSerializedZodOutput(schema) {
245
+ return Function("z", `"use strict";return (${schema});`)(zod.z);
246
+ }
247
+ function isZodType(value) {
248
+ return typeof value === "object" && value !== null && "_def" in value && "parse" in value && typeof value.parse === "function" && "safeParse" in value && typeof value.safeParse === "function";
249
+ }
250
+ function createDeterministicId(input) {
251
+ return crypto.createHash("sha256").update(input).digest("hex").slice(0, 8);
252
+ }
253
+ function setVercelToolProperties(tool) {
254
+ const inputSchema = convertVercelToolParameters(tool);
255
+ const toolId = !("id" in tool) ? tool.description ? `tool-${createDeterministicId(tool.description)}` : `tool-${Math.random().toString(36).substring(2, 9)}` : tool.id;
256
+ return {
257
+ ...tool,
258
+ id: toolId,
259
+ inputSchema
260
+ };
261
+ }
262
+ function ensureToolProperties(tools) {
263
+ const toolsWithProperties = Object.keys(tools).reduce((acc, key) => {
264
+ const tool = tools?.[key];
265
+ if (tool) {
266
+ if (chunk4Z3OU5RY_cjs.isVercelTool(tool)) {
267
+ acc[key] = setVercelToolProperties(tool);
268
+ } else {
269
+ acc[key] = tool;
270
+ }
271
+ }
272
+ return acc;
273
+ }, {});
274
+ return toolsWithProperties;
275
+ }
276
+ function convertVercelToolParameters(tool) {
277
+ const schema = tool.parameters ?? zod.z.object({});
278
+ return isZodType(schema) ? schema : resolveSerializedZodOutput(jsonSchemaToZod__default.default(schema));
279
+ }
280
+ function makeCoreTool(originalTool, options, logType) {
281
+ return new CoreToolBuilder({ originalTool, options, logType }).build();
282
+ }
283
+ function createMastraProxy({ mastra, logger }) {
284
+ return new Proxy(mastra, {
285
+ get(target, prop) {
286
+ const hasProp = Reflect.has(target, prop);
287
+ if (hasProp) {
288
+ const value = Reflect.get(target, prop);
289
+ const isFunction = typeof value === "function";
290
+ if (isFunction) {
291
+ return value.bind(target);
292
+ }
293
+ return value;
294
+ }
295
+ if (prop === "logger") {
296
+ logger.warn(`Please use 'getLogger' instead, logger is deprecated`);
297
+ return Reflect.apply(target.getLogger, target, []);
298
+ }
299
+ if (prop === "telemetry") {
300
+ logger.warn(`Please use 'getTelemetry' instead, telemetry is deprecated`);
301
+ return Reflect.apply(target.getTelemetry, target, []);
302
+ }
303
+ if (prop === "storage") {
304
+ logger.warn(`Please use 'getStorage' instead, storage is deprecated`);
305
+ return Reflect.get(target, "storage");
306
+ }
307
+ if (prop === "agents") {
308
+ logger.warn(`Please use 'getAgents' instead, agents is deprecated`);
309
+ return Reflect.apply(target.getAgents, target, []);
310
+ }
311
+ if (prop === "tts") {
312
+ logger.warn(`Please use 'getTTS' instead, tts is deprecated`);
313
+ return Reflect.apply(target.getTTS, target, []);
314
+ }
315
+ if (prop === "vectors") {
316
+ logger.warn(`Please use 'getVectors' instead, vectors is deprecated`);
317
+ return Reflect.apply(target.getVectors, target, []);
318
+ }
319
+ if (prop === "memory") {
320
+ logger.warn(`Please use 'getMemory' instead, memory is deprecated`);
321
+ return Reflect.get(target, "memory");
322
+ }
323
+ return Reflect.get(target, prop);
324
+ }
325
+ });
326
+ }
327
+ function checkEvalStorageFields(traceObject, logger) {
328
+ const missingFields = [];
329
+ if (!traceObject.input) missingFields.push("input");
330
+ if (!traceObject.output) missingFields.push("output");
331
+ if (!traceObject.agentName) missingFields.push("agent_name");
332
+ if (!traceObject.metricName) missingFields.push("metric_name");
333
+ if (!traceObject.instructions) missingFields.push("instructions");
334
+ if (!traceObject.globalRunId) missingFields.push("global_run_id");
335
+ if (!traceObject.runId) missingFields.push("run_id");
336
+ if (missingFields.length > 0) {
337
+ if (logger) {
338
+ logger.warn("Skipping evaluation storage due to missing required fields", {
339
+ missingFields,
340
+ runId: traceObject.runId,
341
+ agentName: traceObject.agentName
342
+ });
343
+ } else {
344
+ console.warn("Skipping evaluation storage due to missing required fields", {
345
+ missingFields,
346
+ runId: traceObject.runId,
347
+ agentName: traceObject.agentName
348
+ });
349
+ }
350
+ return false;
351
+ }
352
+ return true;
353
+ }
354
+ function detectSingleMessageCharacteristics(message) {
355
+ if (typeof message === "object" && message !== null && (message.role === "function" || // UI-only role
356
+ message.role === "data" || // UI-only role
357
+ "toolInvocations" in message || // UI-specific field
358
+ "parts" in message || // UI-specific field
359
+ "experimental_attachments" in message)) {
360
+ return "has-ui-specific-parts";
361
+ } else if (typeof message === "object" && message !== null && "content" in message && (Array.isArray(message.content) || // Core messages can have array content
362
+ "experimental_providerMetadata" in message || "providerOptions" in message)) {
363
+ return "has-core-specific-parts";
364
+ } else if (typeof message === "object" && message !== null && "role" in message && "content" in message && typeof message.content === "string" && ["system", "user", "assistant", "tool"].includes(message.role)) {
365
+ return "message";
366
+ } else {
367
+ return "other";
368
+ }
369
+ }
370
+ function isUiMessage(message) {
371
+ return detectSingleMessageCharacteristics(message) === `has-ui-specific-parts`;
372
+ }
373
+ function isCoreMessage(message) {
374
+ return [`has-core-specific-parts`, `message`].includes(detectSingleMessageCharacteristics(message));
375
+ }
376
+ var SQL_IDENTIFIER_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
377
+ function parseSqlIdentifier(name, kind = "identifier") {
378
+ if (!SQL_IDENTIFIER_PATTERN.test(name) || name.length > 63) {
379
+ throw new Error(
380
+ `Invalid ${kind}: ${name}. Must start with a letter or underscore, contain only letters, numbers, or underscores, and be at most 63 characters long.`
381
+ );
382
+ }
383
+ return name;
384
+ }
385
+ function parseFieldKey(key) {
386
+ if (!key) throw new Error("Field key cannot be empty");
387
+ const segments = key.split(".");
388
+ for (const segment of segments) {
389
+ if (!SQL_IDENTIFIER_PATTERN.test(segment) || segment.length > 63) {
390
+ throw new Error(`Invalid field key segment: ${segment} in ${key}`);
391
+ }
392
+ }
393
+ return key;
394
+ }
395
+
396
+ exports.checkEvalStorageFields = checkEvalStorageFields;
397
+ exports.createMastraProxy = createMastraProxy;
398
+ exports.deepMerge = deepMerge;
399
+ exports.delay = delay;
400
+ exports.ensureToolProperties = ensureToolProperties;
401
+ exports.isCoreMessage = isCoreMessage;
402
+ exports.isUiMessage = isUiMessage;
403
+ exports.isZodType = isZodType;
404
+ exports.makeCoreTool = makeCoreTool;
405
+ exports.maskStreamTags = maskStreamTags;
406
+ exports.parseFieldKey = parseFieldKey;
407
+ exports.parseSqlIdentifier = parseSqlIdentifier;
408
+ exports.resolveSerializedZodOutput = resolveSerializedZodOutput;
@@ -2,8 +2,8 @@
2
2
 
3
3
  var chunkLXFZUKP3_cjs = require('./chunk-LXFZUKP3.cjs');
4
4
  var chunkTICDQWVJ_cjs = require('./chunk-TICDQWVJ.cjs');
5
- var chunkNMDM4IZN_cjs = require('./chunk-NMDM4IZN.cjs');
6
- var chunkRFAN7FAT_cjs = require('./chunk-RFAN7FAT.cjs');
5
+ var chunk2D7NOO7S_cjs = require('./chunk-2D7NOO7S.cjs');
6
+ var chunkZIZ3CVHN_cjs = require('./chunk-ZIZ3CVHN.cjs');
7
7
  var chunkRWTSGWWL_cjs = require('./chunk-RWTSGWWL.cjs');
8
8
 
9
9
  // src/mastra/index.ts
@@ -55,13 +55,13 @@ exports.Mastra = class Mastra {
55
55
  }
56
56
  let logger;
57
57
  if (config?.logger === false) {
58
- logger = chunkNMDM4IZN_cjs.noopLogger;
58
+ logger = chunk2D7NOO7S_cjs.noopLogger;
59
59
  } else {
60
60
  if (config?.logger) {
61
61
  logger = config.logger;
62
62
  } else {
63
- const levelOnEnv = process.env.NODE_ENV === "production" && process.env.MASTRA_DEV !== "true" ? chunkRFAN7FAT_cjs.LogLevel.WARN : chunkRFAN7FAT_cjs.LogLevel.INFO;
64
- logger = new chunkRFAN7FAT_cjs.ConsoleLogger({
63
+ const levelOnEnv = process.env.NODE_ENV === "production" && process.env.MASTRA_DEV !== "true" ? chunkZIZ3CVHN_cjs.LogLevel.WARN : chunkZIZ3CVHN_cjs.LogLevel.INFO;
64
+ logger = new chunkZIZ3CVHN_cjs.ConsoleLogger({
65
65
  name: "Mastra",
66
66
  level: levelOnEnv
67
67
  });
@@ -438,7 +438,13 @@ do:
438
438
  }
439
439
  async getLogsByRunId({
440
440
  runId,
441
- transportId
441
+ transportId,
442
+ fromDate,
443
+ toDate,
444
+ logLevel,
445
+ filters,
446
+ page,
447
+ perPage
442
448
  }) {
443
449
  if (!transportId) {
444
450
  throw new Error("Transport ID is required");
@@ -448,18 +454,23 @@ do:
448
454
  }
449
455
  return await this.#logger.getLogsByRunId({
450
456
  runId,
451
- transportId
457
+ transportId,
458
+ fromDate,
459
+ toDate,
460
+ logLevel,
461
+ filters,
462
+ page,
463
+ perPage
452
464
  });
453
465
  }
454
- async getLogs(transportId) {
466
+ async getLogs(transportId, params) {
455
467
  if (!transportId) {
456
468
  throw new Error("Transport ID is required");
457
469
  }
458
470
  if (!this.#logger?.getLogs) {
459
471
  throw new Error("Logger is not set");
460
472
  }
461
- console.log(this.#logger);
462
- return await this.#logger.getLogs(transportId);
473
+ return await this.#logger.getLogs(transportId, params);
463
474
  }
464
475
  /**
465
476
  * Get all registered MCP server instances.
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkLXFZUKP3_cjs = require('./chunk-LXFZUKP3.cjs');
4
- var chunkKUJQVCEL_cjs = require('./chunk-KUJQVCEL.cjs');
5
- var chunkWWLMZIHW_cjs = require('./chunk-WWLMZIHW.cjs');
6
- var chunkVHZPWE5L_cjs = require('./chunk-VHZPWE5L.cjs');
4
+ var chunkH5IRI46R_cjs = require('./chunk-H5IRI46R.cjs');
5
+ var chunkQVROTSA5_cjs = require('./chunk-QVROTSA5.cjs');
6
+ var chunkP3Q73CAW_cjs = require('./chunk-P3Q73CAW.cjs');
7
7
 
8
8
  // src/memory/memory.ts
9
- var MemoryProcessor = class extends chunkVHZPWE5L_cjs.MastraBase {
9
+ var MemoryProcessor = class extends chunkP3Q73CAW_cjs.MastraBase {
10
10
  /**
11
11
  * Process a list of messages and return a filtered or transformed list.
12
12
  * @param messages The messages to process
@@ -38,7 +38,7 @@ var memoryDefaultOptions = {
38
38
  `
39
39
  }
40
40
  };
41
- var MastraMemory = class extends chunkVHZPWE5L_cjs.MastraBase {
41
+ var MastraMemory = class extends chunkP3Q73CAW_cjs.MastraBase {
42
42
  MAX_CONTEXT_TOKENS;
43
43
  _storage;
44
44
  vector;
@@ -130,7 +130,7 @@ https://mastra.ai/en/docs/memory/overview`
130
130
  if (config?.workingMemory && "use" in config.workingMemory) {
131
131
  throw new Error("The workingMemory.use option has been removed. Working memory always uses tool-call mode.");
132
132
  }
133
- return chunkWWLMZIHW_cjs.deepMerge(this.threadConfig, config || {});
133
+ return chunkQVROTSA5_cjs.deepMerge(this.threadConfig, config || {});
134
134
  }
135
135
  /**
136
136
  * Apply all configured message processors to a list of messages.
@@ -221,7 +221,7 @@ https://mastra.ai/en/docs/memory/overview`
221
221
  toolCallIds
222
222
  };
223
223
  const savedMessages = await this.saveMessages({ messages: [message], memoryConfig: config });
224
- const list = new chunkKUJQVCEL_cjs.MessageList({ threadId, resourceId }).add(savedMessages[0], "memory");
224
+ const list = new chunkH5IRI46R_cjs.MessageList({ threadId, resourceId }).add(savedMessages[0], "memory");
225
225
  return list.get.all.v1()[0];
226
226
  }
227
227
  /**
@@ -1,5 +1,5 @@
1
1
  import { TABLE_WORKFLOW_SNAPSHOT, TABLE_EVALS, TABLE_MESSAGES, TABLE_THREADS, TABLE_TRACES, TABLE_SCHEMAS } from './chunk-EWDGXKOQ.js';
2
- import { MastraBase } from './chunk-JOCKZ2US.js';
2
+ import { MastraBase } from './chunk-5IEKR756.js';
3
3
 
4
4
  // src/storage/base.ts
5
5
  var MastraStorage = class extends MastraBase {