@mastra/server 0.0.0-cli-debug-2-20250611100354 → 0.0.0-cloudflare-deployer-dont-install-deps-20250714111754
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 +275 -28
- package/dist/_tsup-dts-rollup.d.ts +275 -28
- package/dist/{chunk-OCWPVYNI.cjs → chunk-2KZFMI6P.cjs} +1 -0
- package/dist/{chunk-VPNDC2DI.cjs → chunk-2SLFAFTR.cjs} +12 -12
- package/dist/chunk-3CNDE7QY.cjs +308 -0
- package/dist/{chunk-QLG2PFHE.js → chunk-4D66QEKC.js} +2 -2
- package/dist/{chunk-TEZOEGR4.js → chunk-5PQQ42EZ.js} +8 -8
- package/dist/{chunk-BNEY4P4P.cjs → chunk-7TP2LX5L.cjs} +16 -16
- package/dist/chunk-B2PAS2IB.cjs +514 -0
- package/dist/{chunk-6F2H7Y45.js → chunk-BK4XT6EG.js} +29 -14
- package/dist/{chunk-57CJTIPW.cjs → chunk-CCGRCYWJ.cjs} +2 -2
- package/dist/{chunk-C7564HUT.js → chunk-CRCR3ZUK.js} +3 -3
- package/dist/{chunk-TJO277H7.cjs → chunk-FRVBFMO2.cjs} +20 -20
- package/dist/{chunk-B4MQFJ7G.cjs → chunk-G7KH752Y.cjs} +5 -5
- package/dist/{chunk-7IBZ4L35.js → chunk-H7DMHBKY.js} +181 -27
- package/dist/{chunk-UZ7FJ66C.cjs → chunk-JMLYCXMK.cjs} +43 -43
- package/dist/{chunk-CP55EVBK.js → chunk-KHZKYUNR.js} +15 -11
- package/dist/{chunk-I7KJZNX5.js → chunk-KOHWJYJT.js} +110 -25
- package/dist/{chunk-NYN7KFXL.js → chunk-LCM566I4.js} +1 -0
- package/dist/chunk-LF7P5PLR.js +14 -0
- package/dist/{chunk-XUGQSVZ4.cjs → chunk-LI436ITD.cjs} +107 -69
- package/dist/{chunk-HYP7B2TL.js → chunk-LRCAAFUA.js} +4 -4
- package/dist/{chunk-JEWNMAYQ.cjs → chunk-LZ3VJXSO.cjs} +43 -28
- package/dist/{chunk-WKWHYFX4.js → chunk-MEGCYGBU.js} +108 -70
- package/dist/chunk-PZQDCRPV.cjs +16 -0
- package/dist/{chunk-IMBY5XUG.cjs → chunk-QGX47B5D.cjs} +7 -7
- package/dist/{chunk-BFOA2QQY.js → chunk-RG473F6Y.js} +2 -2
- package/dist/{chunk-CMMOIUFC.cjs → chunk-RHSWAXKB.cjs} +34 -30
- package/dist/{chunk-H5PTF3Y4.js → chunk-RSEO4XPX.js} +1 -1
- package/dist/{chunk-55DOQLP6.js → chunk-WNVFNNWN.js} +2 -2
- package/dist/server/handlers/agents.cjs +7 -7
- 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 +17 -9
- package/dist/server/handlers/memory.d.cts +2 -0
- package/dist/server/handlers/memory.d.ts +2 -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/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 +218 -0
- package/dist/server/handlers/vNextNetwork.d.cts +6 -0
- package/dist/server/handlers/vNextNetwork.d.ts +6 -0
- package/dist/server/handlers/vNextNetwork.js +211 -0
- 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 +24 -12
- 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 +20 -20
- package/dist/server/handlers.js +10 -10
- package/package.json +11 -12
- package/dist/chunk-64U3UDTH.cjs +0 -13
- package/dist/chunk-6TJSHFCJ.cjs +0 -221
- package/dist/chunk-JKF6PRPU.cjs +0 -357
- package/dist/chunk-M5ABIP7D.js +0 -11
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var chunkLI436ITD_cjs = require('./chunk-LI436ITD.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
|
|
|
@@ -25,12 +25,14 @@ async function getAgentsHandler({ mastra, runtimeContext }) {
|
|
|
25
25
|
const instructions = await agent.getInstructions({ runtimeContext });
|
|
26
26
|
const tools = await agent.getTools({ runtimeContext });
|
|
27
27
|
const llm = await agent.getLLM({ runtimeContext });
|
|
28
|
+
const defaultGenerateOptions = await agent.getDefaultGenerateOptions({ runtimeContext });
|
|
29
|
+
const defaultStreamOptions = await agent.getDefaultStreamOptions({ runtimeContext });
|
|
28
30
|
const serializedAgentTools = Object.entries(tools || {}).reduce((acc, [key, tool]) => {
|
|
29
31
|
const _tool = tool;
|
|
30
32
|
acc[key] = {
|
|
31
33
|
..._tool,
|
|
32
|
-
inputSchema: _tool.inputSchema ?
|
|
33
|
-
outputSchema: _tool.outputSchema ?
|
|
34
|
+
inputSchema: _tool.inputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(_tool.inputSchema)) : void 0,
|
|
35
|
+
outputSchema: _tool.outputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(_tool.outputSchema)) : void 0
|
|
34
36
|
};
|
|
35
37
|
return acc;
|
|
36
38
|
}, {});
|
|
@@ -59,8 +61,8 @@ async function getAgentsHandler({ mastra, runtimeContext }) {
|
|
|
59
61
|
workflows: serializedAgentWorkflows,
|
|
60
62
|
provider: llm?.getProvider(),
|
|
61
63
|
modelId: llm?.getModelId(),
|
|
62
|
-
defaultGenerateOptions
|
|
63
|
-
defaultStreamOptions
|
|
64
|
+
defaultGenerateOptions,
|
|
65
|
+
defaultStreamOptions
|
|
64
66
|
};
|
|
65
67
|
})
|
|
66
68
|
);
|
|
@@ -70,7 +72,7 @@ async function getAgentsHandler({ mastra, runtimeContext }) {
|
|
|
70
72
|
}, {});
|
|
71
73
|
return serializedAgents;
|
|
72
74
|
} catch (error) {
|
|
73
|
-
return
|
|
75
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error getting agents");
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
async function getAgentByIdHandler({
|
|
@@ -82,15 +84,15 @@ async function getAgentByIdHandler({
|
|
|
82
84
|
try {
|
|
83
85
|
const agent = mastra.getAgent(agentId);
|
|
84
86
|
if (!agent) {
|
|
85
|
-
throw new
|
|
87
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
|
|
86
88
|
}
|
|
87
89
|
const tools = await agent.getTools({ runtimeContext });
|
|
88
90
|
const serializedAgentTools = Object.entries(tools || {}).reduce((acc, [key, tool]) => {
|
|
89
91
|
const _tool = tool;
|
|
90
92
|
acc[key] = {
|
|
91
93
|
..._tool,
|
|
92
|
-
inputSchema: _tool.inputSchema ?
|
|
93
|
-
outputSchema: _tool.outputSchema ?
|
|
94
|
+
inputSchema: _tool.inputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(_tool.inputSchema)) : void 0,
|
|
95
|
+
outputSchema: _tool.outputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(_tool.outputSchema)) : void 0
|
|
94
96
|
};
|
|
95
97
|
return acc;
|
|
96
98
|
}, {});
|
|
@@ -136,6 +138,8 @@ async function getAgentByIdHandler({
|
|
|
136
138
|
}
|
|
137
139
|
const instructions = await agent.getInstructions({ runtimeContext: proxyRuntimeContext });
|
|
138
140
|
const llm = await agent.getLLM({ runtimeContext });
|
|
141
|
+
const defaultGenerateOptions = await agent.getDefaultGenerateOptions({ runtimeContext: proxyRuntimeContext });
|
|
142
|
+
const defaultStreamOptions = await agent.getDefaultStreamOptions({ runtimeContext: proxyRuntimeContext });
|
|
139
143
|
return {
|
|
140
144
|
name: agent.name,
|
|
141
145
|
instructions,
|
|
@@ -143,11 +147,11 @@ async function getAgentByIdHandler({
|
|
|
143
147
|
workflows: serializedAgentWorkflows,
|
|
144
148
|
provider: llm?.getProvider(),
|
|
145
149
|
modelId: llm?.getModelId(),
|
|
146
|
-
defaultGenerateOptions
|
|
147
|
-
defaultStreamOptions
|
|
150
|
+
defaultGenerateOptions,
|
|
151
|
+
defaultStreamOptions
|
|
148
152
|
};
|
|
149
153
|
} catch (error) {
|
|
150
|
-
return
|
|
154
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error getting agent");
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
157
|
async function getEvalsByAgentIdHandler({
|
|
@@ -166,7 +170,7 @@ async function getEvalsByAgentIdHandler({
|
|
|
166
170
|
evals
|
|
167
171
|
};
|
|
168
172
|
} catch (error) {
|
|
169
|
-
return
|
|
173
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error getting test evals");
|
|
170
174
|
}
|
|
171
175
|
}
|
|
172
176
|
async function getLiveEvalsByAgentIdHandler({
|
|
@@ -185,19 +189,20 @@ async function getLiveEvalsByAgentIdHandler({
|
|
|
185
189
|
evals
|
|
186
190
|
};
|
|
187
191
|
} catch (error) {
|
|
188
|
-
return
|
|
192
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error getting live evals");
|
|
189
193
|
}
|
|
190
194
|
}
|
|
191
195
|
async function generateHandler({
|
|
192
196
|
mastra,
|
|
193
197
|
runtimeContext: runtimeContext$1,
|
|
194
198
|
agentId,
|
|
195
|
-
body
|
|
199
|
+
body,
|
|
200
|
+
abortSignal
|
|
196
201
|
}) {
|
|
197
202
|
try {
|
|
198
203
|
const agent = mastra.getAgent(agentId);
|
|
199
204
|
if (!agent) {
|
|
200
|
-
throw new
|
|
205
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
|
|
201
206
|
}
|
|
202
207
|
const { messages, resourceId, resourceid, runtimeContext: agentRuntimeContext, ...rest } = body;
|
|
203
208
|
const finalResourceId = resourceId ?? resourceid;
|
|
@@ -205,28 +210,30 @@ async function generateHandler({
|
|
|
205
210
|
...Array.from(runtimeContext$1.entries()),
|
|
206
211
|
...Array.from(Object.entries(agentRuntimeContext ?? {}))
|
|
207
212
|
]);
|
|
208
|
-
|
|
213
|
+
chunkCCGRCYWJ_cjs.validateBody({ messages });
|
|
209
214
|
const result = await agent.generate(messages, {
|
|
210
215
|
...rest,
|
|
211
216
|
// @ts-expect-error TODO fix types
|
|
212
217
|
resourceId: finalResourceId,
|
|
213
|
-
runtimeContext: finalRuntimeContext
|
|
218
|
+
runtimeContext: finalRuntimeContext,
|
|
219
|
+
signal: abortSignal
|
|
214
220
|
});
|
|
215
221
|
return result;
|
|
216
222
|
} catch (error) {
|
|
217
|
-
return
|
|
223
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error generating from agent");
|
|
218
224
|
}
|
|
219
225
|
}
|
|
220
226
|
async function streamGenerateHandler({
|
|
221
227
|
mastra,
|
|
222
228
|
runtimeContext: runtimeContext$1,
|
|
223
229
|
agentId,
|
|
224
|
-
body
|
|
230
|
+
body,
|
|
231
|
+
abortSignal
|
|
225
232
|
}) {
|
|
226
233
|
try {
|
|
227
234
|
const agent = mastra.getAgent(agentId);
|
|
228
235
|
if (!agent) {
|
|
229
|
-
throw new
|
|
236
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Agent not found" });
|
|
230
237
|
}
|
|
231
238
|
const { messages, resourceId, resourceid, runtimeContext: agentRuntimeContext, ...rest } = body;
|
|
232
239
|
const finalResourceId = resourceId ?? resourceid;
|
|
@@ -234,23 +241,31 @@ async function streamGenerateHandler({
|
|
|
234
241
|
...Array.from(runtimeContext$1.entries()),
|
|
235
242
|
...Array.from(Object.entries(agentRuntimeContext ?? {}))
|
|
236
243
|
]);
|
|
237
|
-
|
|
244
|
+
chunkCCGRCYWJ_cjs.validateBody({ messages });
|
|
238
245
|
const streamResult = await agent.stream(messages, {
|
|
239
246
|
...rest,
|
|
240
247
|
// @ts-expect-error TODO fix types
|
|
241
248
|
resourceId: finalResourceId,
|
|
242
|
-
runtimeContext: finalRuntimeContext
|
|
249
|
+
runtimeContext: finalRuntimeContext,
|
|
250
|
+
signal: abortSignal
|
|
243
251
|
});
|
|
244
|
-
const streamResponse = rest.output ? streamResult.toTextStreamResponse(
|
|
252
|
+
const streamResponse = rest.output ? streamResult.toTextStreamResponse({
|
|
253
|
+
headers: {
|
|
254
|
+
"Transfer-Encoding": "chunked"
|
|
255
|
+
}
|
|
256
|
+
}) : streamResult.toDataStreamResponse({
|
|
245
257
|
sendUsage: true,
|
|
246
258
|
sendReasoning: true,
|
|
247
259
|
getErrorMessage: (error) => {
|
|
248
260
|
return `An error occurred while processing your request. ${error instanceof Error ? error.message : JSON.stringify(error)}`;
|
|
261
|
+
},
|
|
262
|
+
headers: {
|
|
263
|
+
"Transfer-Encoding": "chunked"
|
|
249
264
|
}
|
|
250
265
|
});
|
|
251
266
|
return streamResponse;
|
|
252
267
|
} catch (error) {
|
|
253
|
-
|
|
268
|
+
return chunkPZQDCRPV_cjs.handleError(error, "error streaming agent response");
|
|
254
269
|
}
|
|
255
270
|
}
|
|
256
271
|
|