@mastra/core 0.10.3 → 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-Dmg7H-Iz.d.cts → base-BURd0RH-.d.cts} +46 -6
  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-Bdo-CPMn.d.ts → base-nFL4giIu.d.ts} +46 -6
  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-5EB62G6T.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-ERUGEZPR.cjs → chunk-FJXOUO3F.cjs} +2 -2
  28. package/dist/{chunk-FGBS7VRU.js → chunk-FNQU5CHU.js} +3 -3
  29. package/dist/{chunk-B4TMM6NT.js → chunk-GEDW7TMB.js} +7 -7
  30. package/dist/{chunk-FHLDRRKJ.cjs → chunk-H5IRI46R.cjs} +3 -3
  31. package/dist/{chunk-FLPSXJWQ.js → chunk-HJML6BS7.js} +1 -1
  32. package/dist/{chunk-4TEWSQS5.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-K7BZ4VXX.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-MVXVUMLA.cjs → chunk-MHN2BI4P.cjs} +23 -23
  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-LMTSGD2E.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-IBIGJYTD.cjs → chunk-VAOBU5SY.cjs} +8 -8
  48. package/dist/{chunk-X6VHQCYN.cjs → chunk-W5I6MEVU.cjs} +2 -2
  49. package/dist/{chunk-677GIYFF.js → chunk-YCYAVLYR.js} +1 -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 +51 -51
  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 +8 -9
  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,390 @@
1
+ import { MastraError } from './chunk-PVGSY24V.js';
2
+ import { isVercelTool } from './chunk-C4LMN2IR.js';
3
+ import { MastraBase } from './chunk-5IEKR756.js';
4
+ import { RuntimeContext } from './chunk-SGGPJWRQ.js';
5
+ import { createHash } from 'crypto';
6
+ import jsonSchemaToZod from 'json-schema-to-zod';
7
+ import { z } from 'zod';
8
+ import { convertZodSchemaToAISDKSchema, OpenAIReasoningSchemaCompatLayer, OpenAISchemaCompatLayer, GoogleSchemaCompatLayer, AnthropicSchemaCompatLayer, DeepSeekSchemaCompatLayer, MetaSchemaCompatLayer, applyCompatLayer } from '@mastra/schema-compat';
9
+
10
+ var CoreToolBuilder = class extends MastraBase {
11
+ originalTool;
12
+ options;
13
+ logType;
14
+ constructor(input) {
15
+ super({ name: "CoreToolBuilder" });
16
+ this.originalTool = input.originalTool;
17
+ this.options = input.options;
18
+ this.logType = input.logType;
19
+ }
20
+ // Helper to get parameters based on tool type
21
+ getParameters = () => {
22
+ if (isVercelTool(this.originalTool)) {
23
+ return this.originalTool.parameters ?? z.object({});
24
+ }
25
+ return this.originalTool.inputSchema ?? z.object({});
26
+ };
27
+ // For provider-defined tools, we need to include all required properties
28
+ buildProviderTool(tool) {
29
+ if ("type" in tool && tool.type === "provider-defined" && "id" in tool && typeof tool.id === "string" && tool.id.includes(".")) {
30
+ return {
31
+ type: "provider-defined",
32
+ id: tool.id,
33
+ args: "args" in this.originalTool ? this.originalTool.args : {},
34
+ description: tool.description,
35
+ parameters: convertZodSchemaToAISDKSchema(this.getParameters()),
36
+ execute: this.originalTool.execute ? this.createExecute(
37
+ this.originalTool,
38
+ { ...this.options, description: this.originalTool.description },
39
+ this.logType
40
+ ) : void 0
41
+ };
42
+ }
43
+ return void 0;
44
+ }
45
+ createLogMessageOptions({ agentName, toolName, type }) {
46
+ if (!agentName) {
47
+ return {
48
+ start: `Executing tool ${toolName}`,
49
+ error: `Failed tool execution`
50
+ };
51
+ }
52
+ const prefix = `[Agent:${agentName}]`;
53
+ const toolType = type === "toolset" ? "toolset" : "tool";
54
+ return {
55
+ start: `${prefix} - Executing ${toolType} ${toolName}`,
56
+ error: `${prefix} - Failed ${toolType} execution`
57
+ };
58
+ }
59
+ createExecute(tool, options, logType) {
60
+ const { logger, mastra: _mastra, memory: _memory, runtimeContext, ...rest } = options;
61
+ const { start, error } = this.createLogMessageOptions({
62
+ agentName: options.agentName,
63
+ toolName: options.name,
64
+ type: logType
65
+ });
66
+ const execFunction = async (args, execOptions) => {
67
+ if (isVercelTool(tool)) {
68
+ return tool?.execute?.(args, execOptions) ?? void 0;
69
+ }
70
+ return tool?.execute?.(
71
+ {
72
+ context: args,
73
+ threadId: options.threadId,
74
+ resourceId: options.resourceId,
75
+ mastra: options.mastra,
76
+ memory: options.memory,
77
+ runId: options.runId,
78
+ runtimeContext: options.runtimeContext ?? new RuntimeContext()
79
+ },
80
+ execOptions
81
+ ) ?? void 0;
82
+ };
83
+ return async (args, execOptions) => {
84
+ let logger2 = options.logger || this.logger;
85
+ try {
86
+ logger2.debug(start, { ...rest, args });
87
+ return await execFunction(args, execOptions);
88
+ } catch (err) {
89
+ const mastraError = new MastraError(
90
+ {
91
+ id: "TOOL_EXECUTION_FAILED",
92
+ domain: "TOOL" /* TOOL */,
93
+ category: "USER" /* USER */,
94
+ details: {
95
+ error,
96
+ args,
97
+ model: rest.model?.modelId ?? ""
98
+ }
99
+ },
100
+ err
101
+ );
102
+ logger2.trackException(mastraError);
103
+ logger2.error(error, { ...rest, error: mastraError, args });
104
+ throw mastraError;
105
+ }
106
+ };
107
+ }
108
+ build() {
109
+ const providerTool = this.buildProviderTool(this.originalTool);
110
+ if (providerTool) {
111
+ return providerTool;
112
+ }
113
+ const definition = {
114
+ type: "function",
115
+ description: this.originalTool.description,
116
+ parameters: this.getParameters(),
117
+ execute: this.originalTool.execute ? this.createExecute(
118
+ this.originalTool,
119
+ { ...this.options, description: this.originalTool.description },
120
+ this.logType
121
+ ) : void 0
122
+ };
123
+ const model = this.options.model;
124
+ const schemaCompatLayers = [];
125
+ if (model) {
126
+ schemaCompatLayers.push(
127
+ new OpenAIReasoningSchemaCompatLayer(model),
128
+ new OpenAISchemaCompatLayer(model),
129
+ new GoogleSchemaCompatLayer(model),
130
+ new AnthropicSchemaCompatLayer(model),
131
+ new DeepSeekSchemaCompatLayer(model),
132
+ new MetaSchemaCompatLayer(model)
133
+ );
134
+ }
135
+ const processedSchema = applyCompatLayer({
136
+ schema: this.getParameters(),
137
+ compatLayers: schemaCompatLayers,
138
+ mode: "aiSdkSchema"
139
+ });
140
+ return {
141
+ ...definition,
142
+ parameters: processedSchema
143
+ };
144
+ }
145
+ };
146
+
147
+ // src/utils.ts
148
+ var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
149
+ function deepMerge(target, source) {
150
+ const output = { ...target };
151
+ if (!source) return output;
152
+ Object.keys(source).forEach((key) => {
153
+ const targetValue = output[key];
154
+ const sourceValue = source[key];
155
+ if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {
156
+ output[key] = sourceValue;
157
+ } else if (sourceValue instanceof Object && targetValue instanceof Object && !Array.isArray(sourceValue) && !Array.isArray(targetValue)) {
158
+ output[key] = deepMerge(targetValue, sourceValue);
159
+ } else if (sourceValue !== void 0) {
160
+ output[key] = sourceValue;
161
+ }
162
+ });
163
+ return output;
164
+ }
165
+ async function* maskStreamTags(stream, tag, options = {}) {
166
+ const { onStart, onEnd, onMask } = options;
167
+ const openTag = `<${tag}>`;
168
+ const closeTag = `</${tag}>`;
169
+ let buffer = "";
170
+ let fullContent = "";
171
+ let isMasking = false;
172
+ let isBuffering = false;
173
+ const trimOutsideDelimiter = (text, delimiter, trim) => {
174
+ if (!text.includes(delimiter)) {
175
+ return text;
176
+ }
177
+ const parts = text.split(delimiter);
178
+ if (trim === `before-start`) {
179
+ return `${delimiter}${parts[1]}`;
180
+ }
181
+ return `${parts[0]}${delimiter}`;
182
+ };
183
+ const startsWith = (text, pattern) => {
184
+ if (pattern.includes(openTag.substring(0, 3))) {
185
+ pattern = trimOutsideDelimiter(pattern, `<`, `before-start`);
186
+ }
187
+ return text.trim().startsWith(pattern.trim());
188
+ };
189
+ for await (const chunk of stream) {
190
+ fullContent += chunk;
191
+ if (isBuffering) buffer += chunk;
192
+ const chunkHasTag = startsWith(chunk, openTag);
193
+ const bufferHasTag = !chunkHasTag && isBuffering && startsWith(openTag, buffer);
194
+ let toYieldBeforeMaskedStartTag = ``;
195
+ if (!isMasking && (chunkHasTag || bufferHasTag)) {
196
+ isMasking = true;
197
+ isBuffering = false;
198
+ const taggedTextToMask = trimOutsideDelimiter(buffer, `<`, `before-start`);
199
+ if (taggedTextToMask !== buffer.trim()) {
200
+ toYieldBeforeMaskedStartTag = buffer.replace(taggedTextToMask, ``);
201
+ }
202
+ buffer = "";
203
+ onStart?.();
204
+ }
205
+ if (!isMasking && !isBuffering && startsWith(openTag, chunk) && chunk.trim() !== "") {
206
+ isBuffering = true;
207
+ buffer += chunk;
208
+ continue;
209
+ }
210
+ if (isBuffering && buffer && !startsWith(openTag, buffer)) {
211
+ yield buffer;
212
+ buffer = "";
213
+ isBuffering = false;
214
+ continue;
215
+ }
216
+ if (isMasking && fullContent.includes(closeTag)) {
217
+ onMask?.(chunk);
218
+ onEnd?.();
219
+ isMasking = false;
220
+ const lastFullContent = fullContent;
221
+ fullContent = ``;
222
+ const textUntilEndTag = trimOutsideDelimiter(lastFullContent, closeTag, "after-end");
223
+ if (textUntilEndTag !== lastFullContent) {
224
+ yield lastFullContent.replace(textUntilEndTag, ``);
225
+ }
226
+ continue;
227
+ }
228
+ if (isMasking) {
229
+ onMask?.(chunk);
230
+ if (toYieldBeforeMaskedStartTag) {
231
+ yield toYieldBeforeMaskedStartTag;
232
+ }
233
+ continue;
234
+ }
235
+ yield chunk;
236
+ }
237
+ }
238
+ function resolveSerializedZodOutput(schema) {
239
+ return Function("z", `"use strict";return (${schema});`)(z);
240
+ }
241
+ function isZodType(value) {
242
+ return typeof value === "object" && value !== null && "_def" in value && "parse" in value && typeof value.parse === "function" && "safeParse" in value && typeof value.safeParse === "function";
243
+ }
244
+ function createDeterministicId(input) {
245
+ return createHash("sha256").update(input).digest("hex").slice(0, 8);
246
+ }
247
+ function setVercelToolProperties(tool) {
248
+ const inputSchema = convertVercelToolParameters(tool);
249
+ const toolId = !("id" in tool) ? tool.description ? `tool-${createDeterministicId(tool.description)}` : `tool-${Math.random().toString(36).substring(2, 9)}` : tool.id;
250
+ return {
251
+ ...tool,
252
+ id: toolId,
253
+ inputSchema
254
+ };
255
+ }
256
+ function ensureToolProperties(tools) {
257
+ const toolsWithProperties = Object.keys(tools).reduce((acc, key) => {
258
+ const tool = tools?.[key];
259
+ if (tool) {
260
+ if (isVercelTool(tool)) {
261
+ acc[key] = setVercelToolProperties(tool);
262
+ } else {
263
+ acc[key] = tool;
264
+ }
265
+ }
266
+ return acc;
267
+ }, {});
268
+ return toolsWithProperties;
269
+ }
270
+ function convertVercelToolParameters(tool) {
271
+ const schema = tool.parameters ?? z.object({});
272
+ return isZodType(schema) ? schema : resolveSerializedZodOutput(jsonSchemaToZod(schema));
273
+ }
274
+ function makeCoreTool(originalTool, options, logType) {
275
+ return new CoreToolBuilder({ originalTool, options, logType }).build();
276
+ }
277
+ function createMastraProxy({ mastra, logger }) {
278
+ return new Proxy(mastra, {
279
+ get(target, prop) {
280
+ const hasProp = Reflect.has(target, prop);
281
+ if (hasProp) {
282
+ const value = Reflect.get(target, prop);
283
+ const isFunction = typeof value === "function";
284
+ if (isFunction) {
285
+ return value.bind(target);
286
+ }
287
+ return value;
288
+ }
289
+ if (prop === "logger") {
290
+ logger.warn(`Please use 'getLogger' instead, logger is deprecated`);
291
+ return Reflect.apply(target.getLogger, target, []);
292
+ }
293
+ if (prop === "telemetry") {
294
+ logger.warn(`Please use 'getTelemetry' instead, telemetry is deprecated`);
295
+ return Reflect.apply(target.getTelemetry, target, []);
296
+ }
297
+ if (prop === "storage") {
298
+ logger.warn(`Please use 'getStorage' instead, storage is deprecated`);
299
+ return Reflect.get(target, "storage");
300
+ }
301
+ if (prop === "agents") {
302
+ logger.warn(`Please use 'getAgents' instead, agents is deprecated`);
303
+ return Reflect.apply(target.getAgents, target, []);
304
+ }
305
+ if (prop === "tts") {
306
+ logger.warn(`Please use 'getTTS' instead, tts is deprecated`);
307
+ return Reflect.apply(target.getTTS, target, []);
308
+ }
309
+ if (prop === "vectors") {
310
+ logger.warn(`Please use 'getVectors' instead, vectors is deprecated`);
311
+ return Reflect.apply(target.getVectors, target, []);
312
+ }
313
+ if (prop === "memory") {
314
+ logger.warn(`Please use 'getMemory' instead, memory is deprecated`);
315
+ return Reflect.get(target, "memory");
316
+ }
317
+ return Reflect.get(target, prop);
318
+ }
319
+ });
320
+ }
321
+ function checkEvalStorageFields(traceObject, logger) {
322
+ const missingFields = [];
323
+ if (!traceObject.input) missingFields.push("input");
324
+ if (!traceObject.output) missingFields.push("output");
325
+ if (!traceObject.agentName) missingFields.push("agent_name");
326
+ if (!traceObject.metricName) missingFields.push("metric_name");
327
+ if (!traceObject.instructions) missingFields.push("instructions");
328
+ if (!traceObject.globalRunId) missingFields.push("global_run_id");
329
+ if (!traceObject.runId) missingFields.push("run_id");
330
+ if (missingFields.length > 0) {
331
+ if (logger) {
332
+ logger.warn("Skipping evaluation storage due to missing required fields", {
333
+ missingFields,
334
+ runId: traceObject.runId,
335
+ agentName: traceObject.agentName
336
+ });
337
+ } else {
338
+ console.warn("Skipping evaluation storage due to missing required fields", {
339
+ missingFields,
340
+ runId: traceObject.runId,
341
+ agentName: traceObject.agentName
342
+ });
343
+ }
344
+ return false;
345
+ }
346
+ return true;
347
+ }
348
+ function detectSingleMessageCharacteristics(message) {
349
+ if (typeof message === "object" && message !== null && (message.role === "function" || // UI-only role
350
+ message.role === "data" || // UI-only role
351
+ "toolInvocations" in message || // UI-specific field
352
+ "parts" in message || // UI-specific field
353
+ "experimental_attachments" in message)) {
354
+ return "has-ui-specific-parts";
355
+ } else if (typeof message === "object" && message !== null && "content" in message && (Array.isArray(message.content) || // Core messages can have array content
356
+ "experimental_providerMetadata" in message || "providerOptions" in message)) {
357
+ return "has-core-specific-parts";
358
+ } else if (typeof message === "object" && message !== null && "role" in message && "content" in message && typeof message.content === "string" && ["system", "user", "assistant", "tool"].includes(message.role)) {
359
+ return "message";
360
+ } else {
361
+ return "other";
362
+ }
363
+ }
364
+ function isUiMessage(message) {
365
+ return detectSingleMessageCharacteristics(message) === `has-ui-specific-parts`;
366
+ }
367
+ function isCoreMessage(message) {
368
+ return [`has-core-specific-parts`, `message`].includes(detectSingleMessageCharacteristics(message));
369
+ }
370
+ var SQL_IDENTIFIER_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
371
+ function parseSqlIdentifier(name, kind = "identifier") {
372
+ if (!SQL_IDENTIFIER_PATTERN.test(name) || name.length > 63) {
373
+ throw new Error(
374
+ `Invalid ${kind}: ${name}. Must start with a letter or underscore, contain only letters, numbers, or underscores, and be at most 63 characters long.`
375
+ );
376
+ }
377
+ return name;
378
+ }
379
+ function parseFieldKey(key) {
380
+ if (!key) throw new Error("Field key cannot be empty");
381
+ const segments = key.split(".");
382
+ for (const segment of segments) {
383
+ if (!SQL_IDENTIFIER_PATTERN.test(segment) || segment.length > 63) {
384
+ throw new Error(`Invalid field key segment: ${segment} in ${key}`);
385
+ }
386
+ }
387
+ return key;
388
+ }
389
+
390
+ export { checkEvalStorageFields, createMastraProxy, deepMerge, delay, ensureToolProperties, isCoreMessage, isUiMessage, isZodType, makeCoreTool, maskStreamTags, parseFieldKey, parseSqlIdentifier, resolveSerializedZodOutput };
@@ -1,5 +1,5 @@
1
1
  import { InstrumentClass } from './chunk-EWDGXKOQ.js';
2
- import { MastraBase } from './chunk-JOCKZ2US.js';
2
+ import { MastraBase } from './chunk-5IEKR756.js';
3
3
  import { __decoratorStart, __decorateElement, __runInitializers } from './chunk-C6A6W6XS.js';
4
4
 
5
5
  // src/tts/index.ts
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkBB6DPGIV_cjs = require('./chunk-BB6DPGIV.cjs');
4
- var chunkMVXVUMLA_cjs = require('./chunk-MVXVUMLA.cjs');
4
+ var chunkMHN2BI4P_cjs = require('./chunk-MHN2BI4P.cjs');
5
5
  var chunk4Z3OU5RY_cjs = require('./chunk-4Z3OU5RY.cjs');
6
- var chunkVHZPWE5L_cjs = require('./chunk-VHZPWE5L.cjs');
7
- var chunkRFAN7FAT_cjs = require('./chunk-RFAN7FAT.cjs');
6
+ var chunkP3Q73CAW_cjs = require('./chunk-P3Q73CAW.cjs');
7
+ var chunkZIZ3CVHN_cjs = require('./chunk-ZIZ3CVHN.cjs');
8
8
  var chunkLABUWBKX_cjs = require('./chunk-LABUWBKX.cjs');
9
9
  var crypto = require('crypto');
10
10
  var EventEmitter = require('events');
@@ -16,10 +16,10 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
16
  var EventEmitter__default = /*#__PURE__*/_interopDefault(EventEmitter);
17
17
 
18
18
  // src/workflows/execution-engine.ts
19
- var ExecutionEngine = class extends chunkVHZPWE5L_cjs.MastraBase {
19
+ var ExecutionEngine = class extends chunkP3Q73CAW_cjs.MastraBase {
20
20
  mastra;
21
21
  constructor({ mastra }) {
22
- super({ name: "ExecutionEngine", component: chunkRFAN7FAT_cjs.RegisteredLogger.WORKFLOW });
22
+ super({ name: "ExecutionEngine", component: chunkZIZ3CVHN_cjs.RegisteredLogger.WORKFLOW });
23
23
  this.mastra = mastra;
24
24
  }
25
25
  __registerMastra(mastra) {
@@ -720,7 +720,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
720
720
 
721
721
  // src/workflows/workflow.ts
722
722
  function createStep(params) {
723
- if (params instanceof chunkMVXVUMLA_cjs.Agent) {
723
+ if (params instanceof chunkMHN2BI4P_cjs.Agent) {
724
724
  return {
725
725
  id: params.name,
726
726
  // @ts-ignore
@@ -838,7 +838,7 @@ function cloneWorkflow(workflow, opts) {
838
838
  wf.commit();
839
839
  return wf;
840
840
  }
841
- var Workflow = class extends chunkVHZPWE5L_cjs.MastraBase {
841
+ var Workflow = class extends chunkP3Q73CAW_cjs.MastraBase {
842
842
  id;
843
843
  description;
844
844
  inputSchema;
@@ -862,7 +862,7 @@ var Workflow = class extends chunkVHZPWE5L_cjs.MastraBase {
862
862
  retryConfig,
863
863
  steps
864
864
  }) {
865
- super({ name: id, component: chunkRFAN7FAT_cjs.RegisteredLogger.WORKFLOW });
865
+ super({ name: id, component: chunkZIZ3CVHN_cjs.RegisteredLogger.WORKFLOW });
866
866
  this.id = id;
867
867
  this.description = description;
868
868
  this.inputSchema = inputSchema;
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkTICDQWVJ_cjs = require('./chunk-TICDQWVJ.cjs');
4
- var chunkVHZPWE5L_cjs = require('./chunk-VHZPWE5L.cjs');
4
+ var chunkP3Q73CAW_cjs = require('./chunk-P3Q73CAW.cjs');
5
5
 
6
6
  // src/storage/base.ts
7
- var MastraStorage = class extends chunkVHZPWE5L_cjs.MastraBase {
7
+ var MastraStorage = class extends chunkP3Q73CAW_cjs.MastraBase {
8
8
  /** @deprecated import from { TABLE_WORKFLOW_SNAPSHOT } '@mastra/core/storage' instead */
9
9
  static TABLE_WORKFLOW_SNAPSHOT = chunkTICDQWVJ_cjs.TABLE_WORKFLOW_SNAPSHOT;
10
10
  /** @deprecated import from { TABLE_EVALS } '@mastra/core/storage' instead */
@@ -1,4 +1,4 @@
1
- import { isUiMessage, isCoreMessage } from './chunk-Y5BGCPNZ.js';
1
+ import { isUiMessage, isCoreMessage } from './chunk-TRJIWZKM.js';
2
2
  import { randomUUID } from 'crypto';
3
3
  import { convertToCoreMessages } from 'ai';
4
4
  import { convertUint8ArrayToBase64, convertBase64ToUint8Array } from '@ai-sdk/provider-utils';
@@ -1,7 +1,7 @@
1
1
  import { augmentWithInit } from './chunk-YOQP5T77.js';
2
2
  import { InstrumentClass, Telemetry } from './chunk-EWDGXKOQ.js';
3
- import { noopLogger } from './chunk-OBEALYTK.js';
4
- import { ConsoleLogger, LogLevel } from './chunk-XXVGT7SJ.js';
3
+ import { noopLogger } from './chunk-DO5R43AJ.js';
4
+ import { ConsoleLogger, LogLevel } from './chunk-5YDTZN2X.js';
5
5
  import { __decoratorStart, __decorateElement, __runInitializers } from './chunk-C6A6W6XS.js';
6
6
 
7
7
  // src/mastra/index.ts
@@ -436,7 +436,13 @@ do:
436
436
  }
437
437
  async getLogsByRunId({
438
438
  runId,
439
- transportId
439
+ transportId,
440
+ fromDate,
441
+ toDate,
442
+ logLevel,
443
+ filters,
444
+ page,
445
+ perPage
440
446
  }) {
441
447
  if (!transportId) {
442
448
  throw new Error("Transport ID is required");
@@ -446,18 +452,23 @@ do:
446
452
  }
447
453
  return await this.#logger.getLogsByRunId({
448
454
  runId,
449
- transportId
455
+ transportId,
456
+ fromDate,
457
+ toDate,
458
+ logLevel,
459
+ filters,
460
+ page,
461
+ perPage
450
462
  });
451
463
  }
452
- async getLogs(transportId) {
464
+ async getLogs(transportId, params) {
453
465
  if (!transportId) {
454
466
  throw new Error("Transport ID is required");
455
467
  }
456
468
  if (!this.#logger?.getLogs) {
457
469
  throw new Error("Logger is not set");
458
470
  }
459
- console.log(this.#logger);
460
- return await this.#logger.getLogs(transportId);
471
+ return await this.#logger.getLogs(transportId, params);
461
472
  }
462
473
  /**
463
474
  * Get all registered MCP server instances.
@@ -38,17 +38,40 @@ var MastraLogger = class {
38
38
  getTransports() {
39
39
  return this.transports;
40
40
  }
41
- async getLogs(transportId) {
41
+ trackException(_error) {
42
+ }
43
+ async getLogs(transportId, params) {
42
44
  if (!transportId || !this.transports.has(transportId)) {
43
- return [];
45
+ return { logs: [], total: 0, page: params?.page ?? 1, perPage: params?.perPage ?? 100, hasMore: false };
44
46
  }
45
- return this.transports.get(transportId).getLogs() ?? [];
47
+ return this.transports.get(transportId).getLogs(params) ?? {
48
+ logs: [],
49
+ total: 0,
50
+ page: params?.page ?? 1,
51
+ perPage: params?.perPage ?? 100,
52
+ hasMore: false
53
+ };
46
54
  }
47
- async getLogsByRunId({ transportId, runId }) {
55
+ async getLogsByRunId({
56
+ transportId,
57
+ runId,
58
+ fromDate,
59
+ toDate,
60
+ logLevel,
61
+ filters,
62
+ page,
63
+ perPage
64
+ }) {
48
65
  if (!transportId || !this.transports.has(transportId) || !runId) {
49
- return [];
66
+ return { logs: [], total: 0, page: page ?? 1, perPage: perPage ?? 100, hasMore: false };
50
67
  }
51
- return this.transports.get(transportId).getLogsByRunId({ runId }) ?? [];
68
+ return this.transports.get(transportId).getLogsByRunId({ runId, fromDate, toDate, logLevel, filters, page, perPage }) ?? {
69
+ logs: [],
70
+ total: 0,
71
+ page: page ?? 1,
72
+ perPage: perPage ?? 100,
73
+ hasMore: false
74
+ };
52
75
  }
53
76
  };
54
77
 
@@ -82,11 +105,11 @@ var ConsoleLogger = class extends MastraLogger {
82
105
  console.error(message, ...args);
83
106
  }
84
107
  }
85
- async getLogs(_transportId) {
86
- return [];
108
+ async getLogs(_transportId, _params) {
109
+ return { logs: [], total: 0, page: _params?.page ?? 1, perPage: _params?.perPage ?? 100, hasMore: false };
87
110
  }
88
111
  async getLogsByRunId(_args) {
89
- return [];
112
+ return { logs: [], total: 0, page: _args.page ?? 1, perPage: _args.perPage ?? 100, hasMore: false };
90
113
  }
91
114
  };
92
115
 
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunkCYJF6U6B_cjs = require('./chunk-CYJF6U6B.cjs');
3
+ var chunkFEYYOBBG_cjs = require('./chunk-FEYYOBBG.cjs');
4
4
 
5
5
  // src/deployer/index.ts
6
- var MastraDeployer = class extends chunkCYJF6U6B_cjs.MastraBundler {
6
+ var MastraDeployer = class extends chunkFEYYOBBG_cjs.MastraBundler {
7
7
  constructor({ name }) {
8
8
  super({ component: "DEPLOYER", name });
9
9
  }
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkPKYG5CWB_cjs = require('../chunk-PKYG5CWB.cjs');
3
+ var chunkZZLBNB3U_cjs = require('../chunk-ZZLBNB3U.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "MastraDeployer", {
8
8
  enumerable: true,
9
- get: function () { return chunkPKYG5CWB_cjs.MastraDeployer; }
9
+ get: function () { return chunkZZLBNB3U_cjs.MastraDeployer; }
10
10
  });
@@ -1,7 +1,8 @@
1
1
  import { MastraBundler, IBundler } from '../bundler/index.cjs';
2
- import '../base-BY9WFI65.cjs';
2
+ import '../base-CO-L7hF9.cjs';
3
3
  import '@opentelemetry/api';
4
- import '../logger-BF2Sn7JX.cjs';
4
+ import '../logger-CpL0z5v_.cjs';
5
+ import '../error/index.cjs';
5
6
  import 'stream';
6
7
  import '@opentelemetry/sdk-trace-base';
7
8
 
@@ -1,7 +1,8 @@
1
1
  import { MastraBundler, IBundler } from '../bundler/index.js';
2
- import '../base-C0yUw8BC.js';
2
+ import '../base-Bi9KB0TN.js';
3
3
  import '@opentelemetry/api';
4
- import '../logger-BF2Sn7JX.js';
4
+ import '../logger-DtVDdb81.js';
5
+ import '../error/index.js';
5
6
  import 'stream';
6
7
  import '@opentelemetry/sdk-trace-base';
7
8
 
@@ -1 +1 @@
1
- export { MastraDeployer } from '../chunk-XJCP3SLA.js';
1
+ export { MastraDeployer } from '../chunk-JNMQKJH4.js';