@mastra/server 0.0.0-tool-call-parts-20250630193309 → 0.0.0-transpile-packages-20250730132657
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.
- package/LICENSE.md +11 -42
- package/dist/_tsup-dts-rollup.d.cts +212 -23
- package/dist/_tsup-dts-rollup.d.ts +212 -23
- package/dist/{chunk-OCWPVYNI.cjs → chunk-2KZFMI6P.cjs} +1 -0
- package/dist/{chunk-VPNDC2DI.cjs → chunk-2SLFAFTR.cjs} +12 -12
- package/dist/{chunk-MEGCYGBU.js → chunk-36BLNJHS.js} +37 -37
- package/dist/chunk-424T5F2J.cjs +157 -0
- package/dist/{chunk-QLG2PFHE.js → chunk-4D66QEKC.js} +2 -2
- package/dist/{chunk-L3VURYKY.cjs → chunk-6KP2OBYA.cjs} +177 -68
- package/dist/chunk-6T5JUKOQ.js +149 -0
- package/dist/{chunk-BNEY4P4P.cjs → chunk-7TP2LX5L.cjs} +16 -16
- package/dist/{chunk-57CJTIPW.cjs → chunk-CCGRCYWJ.cjs} +2 -2
- package/dist/{chunk-C7564HUT.js → chunk-CRCR3ZUK.js} +3 -3
- package/dist/{chunk-B4MQFJ7G.cjs → chunk-G7KH752Y.cjs} +5 -5
- package/dist/{chunk-LI436ITD.cjs → chunk-HISYIDYH.cjs} +37 -37
- package/dist/{chunk-Z3PTO2AK.cjs → chunk-HRSAZUIK.cjs} +20 -20
- package/dist/{chunk-EP3XVEVC.cjs → chunk-I5JKUCGE.cjs} +50 -20
- package/dist/{chunk-R5VGYBV6.js → chunk-KHZKYUNR.js} +3 -3
- package/dist/{chunk-NYN7KFXL.js → chunk-LCM566I4.js} +1 -0
- package/dist/chunk-LF7P5PLR.js +14 -0
- package/dist/chunk-PZQDCRPV.cjs +16 -0
- package/dist/{chunk-IMBY5XUG.cjs → chunk-QGX47B5D.cjs} +7 -7
- package/dist/chunk-R3I7AJVL.js +507 -0
- package/dist/{chunk-BFOA2QQY.js → chunk-RG473F6Y.js} +2 -2
- package/dist/{chunk-WJY57THV.cjs → chunk-RHSWAXKB.cjs} +22 -22
- package/dist/{chunk-H5PTF3Y4.js → chunk-RSEO4XPX.js} +1 -1
- package/dist/{chunk-72LOJGUV.js → chunk-T7HAZC2E.js} +118 -12
- package/dist/chunk-TTPJHP42.cjs +522 -0
- package/dist/{chunk-NGHSYB5B.cjs → chunk-UCV4247U.cjs} +43 -43
- package/dist/{chunk-2BCWG3EZ.js → chunk-VTTN2FW3.js} +36 -7
- package/dist/{chunk-EWLR2PNT.js → chunk-WBRFIHSF.js} +4 -4
- package/dist/{chunk-55DOQLP6.js → chunk-WNVFNNWN.js} +2 -2
- package/dist/{chunk-E2LP4J6K.js → chunk-ZYAFP2AV.js} +8 -8
- package/dist/server/handlers/agents.cjs +11 -7
- package/dist/server/handlers/agents.d.cts +1 -0
- package/dist/server/handlers/agents.d.ts +1 -0
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/error.cjs +2 -2
- package/dist/server/handlers/error.js +1 -1
- package/dist/server/handlers/legacyWorkflows.cjs +11 -11
- package/dist/server/handlers/legacyWorkflows.js +1 -1
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +29 -9
- package/dist/server/handlers/memory.d.cts +5 -0
- package/dist/server/handlers/memory.d.ts +5 -0
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/network.cjs +5 -5
- package/dist/server/handlers/network.js +1 -1
- package/dist/server/handlers/scores.cjs +30 -0
- package/dist/server/handlers/scores.d.cts +6 -0
- package/dist/server/handlers/scores.d.ts +6 -0
- package/dist/server/handlers/scores.js +1 -0
- package/dist/server/handlers/telemetry.cjs +3 -3
- package/dist/server/handlers/telemetry.js +1 -1
- package/dist/server/handlers/tools.cjs +5 -5
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/utils.cjs +2 -2
- package/dist/server/handlers/utils.js +1 -1
- package/dist/server/handlers/vNextNetwork.cjs +23 -23
- package/dist/server/handlers/vNextNetwork.js +4 -4
- package/dist/server/handlers/vector.cjs +7 -7
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/voice.cjs +5 -5
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +25 -13
- package/dist/server/handlers/workflows.d.cts +3 -0
- package/dist/server/handlers/workflows.d.ts +3 -0
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +28 -23
- package/dist/server/handlers.d.cts +3 -2
- package/dist/server/handlers.d.ts +3 -2
- package/dist/server/handlers.js +11 -10
- package/package.json +8 -7
- package/dist/chunk-64U3UDTH.cjs +0 -13
- package/dist/chunk-M5ABIP7D.js +0 -11
- package/dist/chunk-RQ2Z56EC.cjs +0 -251
- package/dist/chunk-XUIJ7WRT.js +0 -241
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var chunkHISYIDYH_cjs = require('./chunk-HISYIDYH.cjs');
|
|
4
|
+
var chunkCCGRCYWJ_cjs = require('./chunk-CCGRCYWJ.cjs');
|
|
5
|
+
var chunkPZQDCRPV_cjs = require('./chunk-PZQDCRPV.cjs');
|
|
6
|
+
var chunk2KZFMI6P_cjs = require('./chunk-2KZFMI6P.cjs');
|
|
7
7
|
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
8
8
|
var runtimeContext = require('@mastra/core/runtime-context');
|
|
9
9
|
|
|
@@ -15,7 +15,8 @@ chunk75ZPJI57_cjs.__export(agents_exports, {
|
|
|
15
15
|
getAgentsHandler: () => getAgentsHandler,
|
|
16
16
|
getEvalsByAgentIdHandler: () => getEvalsByAgentIdHandler,
|
|
17
17
|
getLiveEvalsByAgentIdHandler: () => getLiveEvalsByAgentIdHandler,
|
|
18
|
-
streamGenerateHandler: () => streamGenerateHandler
|
|
18
|
+
streamGenerateHandler: () => streamGenerateHandler,
|
|
19
|
+
streamVNextGenerateHandler: () => streamVNextGenerateHandler
|
|
19
20
|
});
|
|
20
21
|
async function getAgentsHandler({ mastra, runtimeContext }) {
|
|
21
22
|
try {
|
|
@@ -31,8 +32,8 @@ async function getAgentsHandler({ mastra, runtimeContext }) {
|
|
|
31
32
|
const _tool = tool;
|
|
32
33
|
acc[key] = {
|
|
33
34
|
..._tool,
|
|
34
|
-
inputSchema: _tool.inputSchema ?
|
|
35
|
-
outputSchema: _tool.outputSchema ?
|
|
35
|
+
inputSchema: _tool.inputSchema ? chunkHISYIDYH_cjs.stringify(chunkHISYIDYH_cjs.esm_default(_tool.inputSchema)) : void 0,
|
|
36
|
+
outputSchema: _tool.outputSchema ? chunkHISYIDYH_cjs.stringify(chunkHISYIDYH_cjs.esm_default(_tool.outputSchema)) : void 0
|
|
36
37
|
};
|
|
37
38
|
return acc;
|
|
38
39
|
}, {});
|
|
@@ -72,7 +73,7 @@ async function getAgentsHandler({ mastra, runtimeContext }) {
|
|
|
72
73
|
}, {});
|
|
73
74
|
return serializedAgents;
|
|
74
75
|
} catch (error) {
|
|
75
|
-
return
|
|
76
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error getting agents");
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
async function getAgentByIdHandler({
|
|
@@ -84,15 +85,15 @@ async function getAgentByIdHandler({
|
|
|
84
85
|
try {
|
|
85
86
|
const agent = mastra.getAgent(agentId);
|
|
86
87
|
if (!agent) {
|
|
87
|
-
throw new
|
|
88
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
|
|
88
89
|
}
|
|
89
90
|
const tools = await agent.getTools({ runtimeContext });
|
|
90
91
|
const serializedAgentTools = Object.entries(tools || {}).reduce((acc, [key, tool]) => {
|
|
91
92
|
const _tool = tool;
|
|
92
93
|
acc[key] = {
|
|
93
94
|
..._tool,
|
|
94
|
-
inputSchema: _tool.inputSchema ?
|
|
95
|
-
outputSchema: _tool.outputSchema ?
|
|
95
|
+
inputSchema: _tool.inputSchema ? chunkHISYIDYH_cjs.stringify(chunkHISYIDYH_cjs.esm_default(_tool.inputSchema)) : void 0,
|
|
96
|
+
outputSchema: _tool.outputSchema ? chunkHISYIDYH_cjs.stringify(chunkHISYIDYH_cjs.esm_default(_tool.outputSchema)) : void 0
|
|
96
97
|
};
|
|
97
98
|
return acc;
|
|
98
99
|
}, {});
|
|
@@ -151,7 +152,7 @@ async function getAgentByIdHandler({
|
|
|
151
152
|
defaultStreamOptions
|
|
152
153
|
};
|
|
153
154
|
} catch (error) {
|
|
154
|
-
return
|
|
155
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error getting agent");
|
|
155
156
|
}
|
|
156
157
|
}
|
|
157
158
|
async function getEvalsByAgentIdHandler({
|
|
@@ -170,7 +171,7 @@ async function getEvalsByAgentIdHandler({
|
|
|
170
171
|
evals
|
|
171
172
|
};
|
|
172
173
|
} catch (error) {
|
|
173
|
-
return
|
|
174
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error getting test evals");
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
177
|
async function getLiveEvalsByAgentIdHandler({
|
|
@@ -189,7 +190,7 @@ async function getLiveEvalsByAgentIdHandler({
|
|
|
189
190
|
evals
|
|
190
191
|
};
|
|
191
192
|
} catch (error) {
|
|
192
|
-
return
|
|
193
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error getting live evals");
|
|
193
194
|
}
|
|
194
195
|
}
|
|
195
196
|
async function generateHandler({
|
|
@@ -202,7 +203,7 @@ async function generateHandler({
|
|
|
202
203
|
try {
|
|
203
204
|
const agent = mastra.getAgent(agentId);
|
|
204
205
|
if (!agent) {
|
|
205
|
-
throw new
|
|
206
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
|
|
206
207
|
}
|
|
207
208
|
const { messages, resourceId, resourceid, runtimeContext: agentRuntimeContext, ...rest } = body;
|
|
208
209
|
const finalResourceId = resourceId ?? resourceid;
|
|
@@ -210,7 +211,7 @@ async function generateHandler({
|
|
|
210
211
|
...Array.from(runtimeContext$1.entries()),
|
|
211
212
|
...Array.from(Object.entries(agentRuntimeContext ?? {}))
|
|
212
213
|
]);
|
|
213
|
-
|
|
214
|
+
chunkCCGRCYWJ_cjs.validateBody({ messages });
|
|
214
215
|
const result = await agent.generate(messages, {
|
|
215
216
|
...rest,
|
|
216
217
|
// @ts-expect-error TODO fix types
|
|
@@ -220,7 +221,7 @@ async function generateHandler({
|
|
|
220
221
|
});
|
|
221
222
|
return result;
|
|
222
223
|
} catch (error) {
|
|
223
|
-
return
|
|
224
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error generating from agent");
|
|
224
225
|
}
|
|
225
226
|
}
|
|
226
227
|
async function streamGenerateHandler({
|
|
@@ -233,7 +234,7 @@ async function streamGenerateHandler({
|
|
|
233
234
|
try {
|
|
234
235
|
const agent = mastra.getAgent(agentId);
|
|
235
236
|
if (!agent) {
|
|
236
|
-
throw new
|
|
237
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
|
|
237
238
|
}
|
|
238
239
|
const { messages, resourceId, resourceid, runtimeContext: agentRuntimeContext, ...rest } = body;
|
|
239
240
|
const finalResourceId = resourceId ?? resourceid;
|
|
@@ -241,7 +242,7 @@ async function streamGenerateHandler({
|
|
|
241
242
|
...Array.from(runtimeContext$1.entries()),
|
|
242
243
|
...Array.from(Object.entries(agentRuntimeContext ?? {}))
|
|
243
244
|
]);
|
|
244
|
-
|
|
245
|
+
chunkCCGRCYWJ_cjs.validateBody({ messages });
|
|
245
246
|
const streamResult = await agent.stream(messages, {
|
|
246
247
|
...rest,
|
|
247
248
|
// @ts-expect-error TODO fix types
|
|
@@ -265,7 +266,35 @@ async function streamGenerateHandler({
|
|
|
265
266
|
});
|
|
266
267
|
return streamResponse;
|
|
267
268
|
} catch (error) {
|
|
268
|
-
|
|
269
|
+
return chunkPZQDCRPV_cjs.handleError(error, "error streaming agent response");
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function streamVNextGenerateHandler({
|
|
273
|
+
mastra,
|
|
274
|
+
runtimeContext: runtimeContext$1,
|
|
275
|
+
agentId,
|
|
276
|
+
body,
|
|
277
|
+
abortSignal
|
|
278
|
+
}) {
|
|
279
|
+
try {
|
|
280
|
+
const agent = mastra.getAgent(agentId);
|
|
281
|
+
if (!agent) {
|
|
282
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
|
|
283
|
+
}
|
|
284
|
+
const { messages, runtimeContext: agentRuntimeContext, ...rest } = body;
|
|
285
|
+
const finalRuntimeContext = new runtimeContext.RuntimeContext([
|
|
286
|
+
...Array.from(runtimeContext$1.entries()),
|
|
287
|
+
...Array.from(Object.entries(agentRuntimeContext ?? {}))
|
|
288
|
+
]);
|
|
289
|
+
chunkCCGRCYWJ_cjs.validateBody({ messages });
|
|
290
|
+
const streamResult = agent.streamVNext(messages, {
|
|
291
|
+
...rest,
|
|
292
|
+
runtimeContext: finalRuntimeContext,
|
|
293
|
+
abortSignal
|
|
294
|
+
});
|
|
295
|
+
return streamResult;
|
|
296
|
+
} catch (error) {
|
|
297
|
+
return chunkPZQDCRPV_cjs.handleError(error, "error streaming agent response");
|
|
269
298
|
}
|
|
270
299
|
}
|
|
271
300
|
|
|
@@ -276,3 +305,4 @@ exports.getAgentsHandler = getAgentsHandler;
|
|
|
276
305
|
exports.getEvalsByAgentIdHandler = getEvalsByAgentIdHandler;
|
|
277
306
|
exports.getLiveEvalsByAgentIdHandler = getLiveEvalsByAgentIdHandler;
|
|
278
307
|
exports.streamGenerateHandler = streamGenerateHandler;
|
|
308
|
+
exports.streamVNextGenerateHandler = streamVNextGenerateHandler;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { validateBody } from './chunk-
|
|
2
|
-
import { handleError } from './chunk-
|
|
3
|
-
import { HTTPException } from './chunk-
|
|
1
|
+
import { validateBody } from './chunk-RSEO4XPX.js';
|
|
2
|
+
import { handleError } from './chunk-LF7P5PLR.js';
|
|
3
|
+
import { HTTPException } from './chunk-LCM566I4.js';
|
|
4
4
|
import { __export } from './chunk-MLKGABMK.js';
|
|
5
5
|
import { Readable } from 'stream';
|
|
6
6
|
|
|
@@ -11,6 +11,7 @@ var HTTPException = class extends Error {
|
|
|
11
11
|
super(options?.message, { cause: options?.cause });
|
|
12
12
|
this.res = options?.res;
|
|
13
13
|
this.status = status;
|
|
14
|
+
this.stack = options?.stack || this.stack;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* Returns the response object associated with the exception.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HTTPException } from './chunk-LCM566I4.js';
|
|
2
|
+
|
|
3
|
+
// src/server/handlers/error.ts
|
|
4
|
+
function handleError(error, defaultMessage) {
|
|
5
|
+
const apiError = error;
|
|
6
|
+
const apiErrorStatus = apiError.status || apiError.details?.status || 500;
|
|
7
|
+
throw new HTTPException(apiErrorStatus, {
|
|
8
|
+
message: apiError.message || defaultMessage,
|
|
9
|
+
stack: apiError.stack,
|
|
10
|
+
cause: apiError.cause
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { handleError };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk2KZFMI6P_cjs = require('./chunk-2KZFMI6P.cjs');
|
|
4
|
+
|
|
5
|
+
// src/server/handlers/error.ts
|
|
6
|
+
function handleError(error, defaultMessage) {
|
|
7
|
+
const apiError = error;
|
|
8
|
+
const apiErrorStatus = apiError.status || apiError.details?.status || 500;
|
|
9
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(apiErrorStatus, {
|
|
10
|
+
message: apiError.message || defaultMessage,
|
|
11
|
+
stack: apiError.stack,
|
|
12
|
+
cause: apiError.cause
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.handleError = handleError;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkCCGRCYWJ_cjs = require('./chunk-CCGRCYWJ.cjs');
|
|
4
|
+
var chunkPZQDCRPV_cjs = require('./chunk-PZQDCRPV.cjs');
|
|
5
5
|
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
6
6
|
|
|
7
7
|
// src/server/handlers/logs.ts
|
|
@@ -17,7 +17,7 @@ async function getLogsHandler({
|
|
|
17
17
|
params
|
|
18
18
|
}) {
|
|
19
19
|
try {
|
|
20
|
-
|
|
20
|
+
chunkCCGRCYWJ_cjs.validateBody({ transportId });
|
|
21
21
|
const { fromDate, toDate, logLevel, filters: _filters, page, perPage } = params || {};
|
|
22
22
|
const filters = _filters ? Object.fromEntries(
|
|
23
23
|
(Array.isArray(_filters) ? _filters : [_filters]).map((attr) => {
|
|
@@ -35,7 +35,7 @@ async function getLogsHandler({
|
|
|
35
35
|
});
|
|
36
36
|
return logs;
|
|
37
37
|
} catch (error) {
|
|
38
|
-
return
|
|
38
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error getting logs");
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
async function getLogsByRunIdHandler({
|
|
@@ -45,7 +45,7 @@ async function getLogsByRunIdHandler({
|
|
|
45
45
|
params
|
|
46
46
|
}) {
|
|
47
47
|
try {
|
|
48
|
-
|
|
48
|
+
chunkCCGRCYWJ_cjs.validateBody({ runId, transportId });
|
|
49
49
|
const { fromDate, toDate, logLevel, filters: _filters, page, perPage } = params || {};
|
|
50
50
|
const filters = _filters ? Object.fromEntries(
|
|
51
51
|
(Array.isArray(_filters) ? _filters : [_filters]).map((attr) => {
|
|
@@ -65,7 +65,7 @@ async function getLogsByRunIdHandler({
|
|
|
65
65
|
});
|
|
66
66
|
return logs;
|
|
67
67
|
} catch (error) {
|
|
68
|
-
return
|
|
68
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error getting logs by run ID");
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
async function getLogTransports({ mastra }) {
|
|
@@ -76,7 +76,7 @@ async function getLogTransports({ mastra }) {
|
|
|
76
76
|
transports: transports ? [...transports.keys()] : []
|
|
77
77
|
};
|
|
78
78
|
} catch (error) {
|
|
79
|
-
return
|
|
79
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error getting log Transports");
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|