@mastra/server 0.0.0-switch-to-core-20250424015131 → 0.0.0-tool-call-parts-20250630193309
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/README.md +48 -135
- package/dist/_tsup-dts-rollup.d.cts +541 -51
- package/dist/_tsup-dts-rollup.d.ts +541 -51
- package/dist/chunk-2BCWG3EZ.js +270 -0
- package/dist/{chunk-4JINXASC.js → chunk-55DOQLP6.js} +5 -4
- package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
- package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
- package/dist/chunk-72LOJGUV.js +421 -0
- package/dist/chunk-75ZPJI57.cjs +9 -0
- package/dist/{chunk-7IWQE76Z.cjs → chunk-B4MQFJ7G.cjs} +16 -10
- package/dist/{chunk-WTHDCRMY.js → chunk-BFOA2QQY.js} +12 -6
- package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
- package/dist/{chunk-RE6YL32K.js → chunk-C7564HUT.js} +52 -30
- package/dist/{chunk-LFOBHRFO.js → chunk-E2LP4J6K.js} +69 -54
- package/dist/chunk-EP3XVEVC.cjs +278 -0
- package/dist/{chunk-5JNVY6DU.js → chunk-EWLR2PNT.js} +7 -5
- package/dist/chunk-GHC4YV6R.js +504 -0
- package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
- package/dist/chunk-IMBY5XUG.cjs +86 -0
- package/dist/chunk-L3VURYKY.cjs +435 -0
- package/dist/chunk-LI436ITD.cjs +2042 -0
- package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
- package/dist/chunk-MEGCYGBU.js +2039 -0
- package/dist/chunk-MLKGABMK.js +7 -0
- package/dist/chunk-NGHSYB5B.cjs +332 -0
- package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
- package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
- package/dist/chunk-QLG2PFHE.js +81 -0
- package/dist/{chunk-Q6SHQECN.js → chunk-R5VGYBV6.js} +34 -10
- package/dist/{chunk-2FJURXCL.cjs → chunk-RQ2Z56EC.cjs} +93 -55
- package/dist/chunk-SDPGVWQJ.cjs +512 -0
- package/dist/{chunk-FPIWDH5Y.cjs → chunk-VPNDC2DI.cjs} +62 -40
- package/dist/chunk-WJY57THV.cjs +118 -0
- package/dist/{chunk-RBQASTUP.js → chunk-XUIJ7WRT.js} +63 -25
- package/dist/{chunk-D3G23FP3.cjs → chunk-Z3PTO2AK.cjs} +24 -22
- package/dist/server/handlers/a2a.cjs +30 -0
- package/dist/server/handlers/a2a.d.cts +6 -0
- package/dist/server/handlers/a2a.d.ts +6 -0
- package/dist/server/handlers/a2a.js +1 -0
- 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 +46 -0
- package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
- package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
- package/dist/server/handlers/legacyWorkflows.js +1 -0
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/memory.cjs +9 -9
- 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 +8 -4
- package/dist/server/handlers/voice.d.cts +1 -0
- package/dist/server/handlers/voice.d.ts +1 -0
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +21 -13
- package/dist/server/handlers/workflows.d.cts +4 -2
- package/dist/server/handlers/workflows.d.ts +4 -2
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +33 -23
- package/dist/server/handlers.d.cts +2 -0
- package/dist/server/handlers.d.ts +2 -0
- package/dist/server/handlers.js +11 -9
- package/package.json +13 -12
- package/dist/chunk-3EJZQ6TQ.js +0 -49
- package/dist/chunk-55HTWX4C.cjs +0 -93
- package/dist/chunk-5SWCVTNL.cjs +0 -5579
- package/dist/chunk-HCOPJZ4A.cjs +0 -164
- package/dist/chunk-OMN3UI6X.js +0 -5576
- package/dist/chunk-R4J7XQYU.js +0 -156
- package/dist/chunk-SKBVVI24.cjs +0 -54
- package/dist/chunk-TZK63M5N.cjs +0 -317
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk57CJTIPW_cjs = require('./chunk-57CJTIPW.cjs');
|
|
4
|
+
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
5
|
+
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
6
|
+
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
7
|
+
var stream = require('stream');
|
|
8
|
+
|
|
9
|
+
// src/server/handlers/voice.ts
|
|
10
|
+
var voice_exports = {};
|
|
11
|
+
chunk75ZPJI57_cjs.__export(voice_exports, {
|
|
12
|
+
generateSpeechHandler: () => generateSpeechHandler,
|
|
13
|
+
getListenerHandler: () => getListenerHandler,
|
|
14
|
+
getSpeakersHandler: () => getSpeakersHandler,
|
|
15
|
+
transcribeSpeechHandler: () => transcribeSpeechHandler
|
|
16
|
+
});
|
|
17
|
+
async function getSpeakersHandler({ mastra, agentId }) {
|
|
18
|
+
try {
|
|
19
|
+
if (!agentId) {
|
|
20
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
|
|
21
|
+
}
|
|
22
|
+
const agent = mastra.getAgent(agentId);
|
|
23
|
+
if (!agent) {
|
|
24
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
|
|
25
|
+
}
|
|
26
|
+
const voice = await agent.getVoice();
|
|
27
|
+
if (!voice) {
|
|
28
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
29
|
+
}
|
|
30
|
+
const speakers = await voice.getSpeakers();
|
|
31
|
+
return speakers;
|
|
32
|
+
} catch (error) {
|
|
33
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error getting speakers");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function generateSpeechHandler({
|
|
37
|
+
mastra,
|
|
38
|
+
agentId,
|
|
39
|
+
body
|
|
40
|
+
}) {
|
|
41
|
+
try {
|
|
42
|
+
if (!agentId) {
|
|
43
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
|
|
44
|
+
}
|
|
45
|
+
chunk57CJTIPW_cjs.validateBody({
|
|
46
|
+
text: body?.text
|
|
47
|
+
});
|
|
48
|
+
const agent = mastra.getAgent(agentId);
|
|
49
|
+
if (!agent) {
|
|
50
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
|
|
51
|
+
}
|
|
52
|
+
const voice = await agent.getVoice();
|
|
53
|
+
if (!voice) {
|
|
54
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
55
|
+
}
|
|
56
|
+
const audioStream = await voice.speak(body.text, { speaker: body.speakerId });
|
|
57
|
+
if (!audioStream) {
|
|
58
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: "Failed to generate speech" });
|
|
59
|
+
}
|
|
60
|
+
return audioStream;
|
|
61
|
+
} catch (error) {
|
|
62
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error generating speech");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function transcribeSpeechHandler({
|
|
66
|
+
mastra,
|
|
67
|
+
agentId,
|
|
68
|
+
body
|
|
69
|
+
}) {
|
|
70
|
+
try {
|
|
71
|
+
if (!agentId) {
|
|
72
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
|
|
73
|
+
}
|
|
74
|
+
if (!body?.audioData) {
|
|
75
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Audio data is required" });
|
|
76
|
+
}
|
|
77
|
+
const agent = mastra.getAgent(agentId);
|
|
78
|
+
if (!agent) {
|
|
79
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
|
|
80
|
+
}
|
|
81
|
+
const voice = await agent.getVoice();
|
|
82
|
+
if (!voice) {
|
|
83
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
84
|
+
}
|
|
85
|
+
const audioStream = new stream.Readable();
|
|
86
|
+
audioStream.push(body.audioData);
|
|
87
|
+
audioStream.push(null);
|
|
88
|
+
const text = await voice.listen(audioStream, body.options);
|
|
89
|
+
return { text };
|
|
90
|
+
} catch (error) {
|
|
91
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error transcribing speech");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
async function getListenerHandler({ mastra, agentId }) {
|
|
95
|
+
try {
|
|
96
|
+
if (!agentId) {
|
|
97
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent ID is required" });
|
|
98
|
+
}
|
|
99
|
+
const agent = mastra.getAgent(agentId);
|
|
100
|
+
if (!agent) {
|
|
101
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
|
|
102
|
+
}
|
|
103
|
+
const voice = await agent.getVoice();
|
|
104
|
+
if (!voice) {
|
|
105
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
106
|
+
}
|
|
107
|
+
const listeners = await voice.getListener();
|
|
108
|
+
return listeners;
|
|
109
|
+
} catch (error) {
|
|
110
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error getting listeners");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
exports.generateSpeechHandler = generateSpeechHandler;
|
|
115
|
+
exports.getListenerHandler = getListenerHandler;
|
|
116
|
+
exports.getSpeakersHandler = getSpeakersHandler;
|
|
117
|
+
exports.transcribeSpeechHandler = transcribeSpeechHandler;
|
|
118
|
+
exports.voice_exports = voice_exports;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { validateBody } from './chunk-
|
|
2
|
-
import { handleError } from './chunk-
|
|
3
|
-
import {
|
|
1
|
+
import { validateBody } from './chunk-H5PTF3Y4.js';
|
|
2
|
+
import { handleError } from './chunk-M5ABIP7D.js';
|
|
3
|
+
import { HTTPException } from './chunk-NYN7KFXL.js';
|
|
4
|
+
import { __export } from './chunk-MLKGABMK.js';
|
|
4
5
|
|
|
5
6
|
// src/server/handlers/memory.ts
|
|
6
7
|
var memory_exports = {};
|
|
@@ -14,20 +15,36 @@ __export(memory_exports, {
|
|
|
14
15
|
saveMessagesHandler: () => saveMessagesHandler,
|
|
15
16
|
updateThreadHandler: () => updateThreadHandler
|
|
16
17
|
});
|
|
17
|
-
function getMemoryFromContext({
|
|
18
|
+
async function getMemoryFromContext({
|
|
18
19
|
mastra,
|
|
19
|
-
agentId
|
|
20
|
+
agentId,
|
|
21
|
+
networkId,
|
|
22
|
+
runtimeContext
|
|
20
23
|
}) {
|
|
21
24
|
const agent = agentId ? mastra.getAgent(agentId) : null;
|
|
22
25
|
if (agentId && !agent) {
|
|
23
26
|
throw new HTTPException(404, { message: "Agent not found" });
|
|
24
27
|
}
|
|
25
|
-
const
|
|
26
|
-
|
|
28
|
+
const network = networkId ? mastra.vnext_getNetwork(networkId) : null;
|
|
29
|
+
if (networkId && !network) {
|
|
30
|
+
throw new HTTPException(404, { message: "Network not found" });
|
|
31
|
+
}
|
|
32
|
+
if (agent) {
|
|
33
|
+
return agent?.getMemory() || mastra.getMemory();
|
|
34
|
+
}
|
|
35
|
+
if (network) {
|
|
36
|
+
return await network?.getMemory({ runtimeContext }) || mastra.getMemory();
|
|
37
|
+
}
|
|
38
|
+
return mastra.getMemory();
|
|
27
39
|
}
|
|
28
|
-
async function getMemoryStatusHandler({
|
|
40
|
+
async function getMemoryStatusHandler({
|
|
41
|
+
mastra,
|
|
42
|
+
agentId,
|
|
43
|
+
networkId,
|
|
44
|
+
runtimeContext
|
|
45
|
+
}) {
|
|
29
46
|
try {
|
|
30
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
47
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
31
48
|
if (!memory) {
|
|
32
49
|
return { result: false };
|
|
33
50
|
}
|
|
@@ -39,10 +56,12 @@ async function getMemoryStatusHandler({ mastra, agentId }) {
|
|
|
39
56
|
async function getThreadsHandler({
|
|
40
57
|
mastra,
|
|
41
58
|
agentId,
|
|
42
|
-
resourceId
|
|
59
|
+
resourceId,
|
|
60
|
+
networkId,
|
|
61
|
+
runtimeContext
|
|
43
62
|
}) {
|
|
44
63
|
try {
|
|
45
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
64
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
46
65
|
if (!memory) {
|
|
47
66
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
48
67
|
}
|
|
@@ -56,11 +75,13 @@ async function getThreadsHandler({
|
|
|
56
75
|
async function getThreadByIdHandler({
|
|
57
76
|
mastra,
|
|
58
77
|
agentId,
|
|
59
|
-
threadId
|
|
78
|
+
threadId,
|
|
79
|
+
networkId,
|
|
80
|
+
runtimeContext
|
|
60
81
|
}) {
|
|
61
82
|
try {
|
|
62
83
|
validateBody({ threadId });
|
|
63
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
84
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
64
85
|
if (!memory) {
|
|
65
86
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
66
87
|
}
|
|
@@ -76,10 +97,12 @@ async function getThreadByIdHandler({
|
|
|
76
97
|
async function saveMessagesHandler({
|
|
77
98
|
mastra,
|
|
78
99
|
agentId,
|
|
79
|
-
body
|
|
100
|
+
body,
|
|
101
|
+
networkId,
|
|
102
|
+
runtimeContext
|
|
80
103
|
}) {
|
|
81
104
|
try {
|
|
82
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
105
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
83
106
|
if (!memory) {
|
|
84
107
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
85
108
|
}
|
|
@@ -103,10 +126,12 @@ async function saveMessagesHandler({
|
|
|
103
126
|
async function createThreadHandler({
|
|
104
127
|
mastra,
|
|
105
128
|
agentId,
|
|
106
|
-
body
|
|
129
|
+
body,
|
|
130
|
+
networkId,
|
|
131
|
+
runtimeContext
|
|
107
132
|
}) {
|
|
108
133
|
try {
|
|
109
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
134
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
110
135
|
if (!memory) {
|
|
111
136
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
112
137
|
}
|
|
@@ -126,10 +151,12 @@ async function updateThreadHandler({
|
|
|
126
151
|
mastra,
|
|
127
152
|
agentId,
|
|
128
153
|
threadId,
|
|
129
|
-
body
|
|
154
|
+
body,
|
|
155
|
+
networkId,
|
|
156
|
+
runtimeContext
|
|
130
157
|
}) {
|
|
131
158
|
try {
|
|
132
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
159
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
133
160
|
if (!body) {
|
|
134
161
|
throw new HTTPException(400, { message: "Body is required" });
|
|
135
162
|
}
|
|
@@ -160,11 +187,13 @@ async function updateThreadHandler({
|
|
|
160
187
|
async function deleteThreadHandler({
|
|
161
188
|
mastra,
|
|
162
189
|
agentId,
|
|
163
|
-
threadId
|
|
190
|
+
threadId,
|
|
191
|
+
networkId,
|
|
192
|
+
runtimeContext
|
|
164
193
|
}) {
|
|
165
194
|
try {
|
|
166
195
|
validateBody({ threadId });
|
|
167
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
196
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
168
197
|
if (!memory) {
|
|
169
198
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
170
199
|
}
|
|
@@ -181,11 +210,17 @@ async function deleteThreadHandler({
|
|
|
181
210
|
async function getMessagesHandler({
|
|
182
211
|
mastra,
|
|
183
212
|
agentId,
|
|
184
|
-
threadId
|
|
213
|
+
threadId,
|
|
214
|
+
limit,
|
|
215
|
+
networkId,
|
|
216
|
+
runtimeContext
|
|
185
217
|
}) {
|
|
218
|
+
if (limit !== void 0 && (!Number.isInteger(limit) || limit <= 0)) {
|
|
219
|
+
throw new HTTPException(400, { message: "Invalid limit: must be a positive integer" });
|
|
220
|
+
}
|
|
186
221
|
try {
|
|
187
222
|
validateBody({ threadId });
|
|
188
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
223
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
189
224
|
if (!memory) {
|
|
190
225
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
191
226
|
}
|
|
@@ -193,8 +228,11 @@ async function getMessagesHandler({
|
|
|
193
228
|
if (!thread) {
|
|
194
229
|
throw new HTTPException(404, { message: "Thread not found" });
|
|
195
230
|
}
|
|
196
|
-
const result = await memory.query({
|
|
197
|
-
|
|
231
|
+
const result = await memory.query({
|
|
232
|
+
threadId,
|
|
233
|
+
...limit && { selectBy: { last: limit } }
|
|
234
|
+
});
|
|
235
|
+
return { messages: result.messages, uiMessages: result.uiMessages };
|
|
198
236
|
} catch (error) {
|
|
199
237
|
return handleError(error, "Error getting messages");
|
|
200
238
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var chunkLI436ITD_cjs = require('./chunk-LI436ITD.cjs');
|
|
4
|
+
var chunk57CJTIPW_cjs = require('./chunk-57CJTIPW.cjs');
|
|
5
|
+
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
6
|
+
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
7
|
+
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
7
8
|
var tools = require('@mastra/core/tools');
|
|
8
9
|
|
|
9
10
|
// src/server/handlers/tools.ts
|
|
10
11
|
var tools_exports = {};
|
|
11
|
-
|
|
12
|
+
chunk75ZPJI57_cjs.__export(tools_exports, {
|
|
12
13
|
executeAgentToolHandler: () => executeAgentToolHandler,
|
|
13
14
|
executeToolHandler: () => executeToolHandler,
|
|
14
15
|
getToolByIdHandler: () => getToolByIdHandler,
|
|
@@ -24,8 +25,8 @@ async function getToolsHandler({ tools }) {
|
|
|
24
25
|
const tool = _tool;
|
|
25
26
|
acc[id] = {
|
|
26
27
|
...tool,
|
|
27
|
-
inputSchema: tool.inputSchema ?
|
|
28
|
-
outputSchema: tool.outputSchema ?
|
|
28
|
+
inputSchema: tool.inputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(tool.inputSchema)) : void 0,
|
|
29
|
+
outputSchema: tool.outputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(tool.outputSchema)) : void 0
|
|
29
30
|
};
|
|
30
31
|
return acc;
|
|
31
32
|
},
|
|
@@ -33,23 +34,23 @@ async function getToolsHandler({ tools }) {
|
|
|
33
34
|
);
|
|
34
35
|
return serializedTools;
|
|
35
36
|
} catch (error) {
|
|
36
|
-
return
|
|
37
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error getting tools");
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
async function getToolByIdHandler({ tools, toolId }) {
|
|
40
41
|
try {
|
|
41
42
|
const tool = Object.values(tools || {}).find((tool2) => tool2.id === toolId);
|
|
42
43
|
if (!tool) {
|
|
43
|
-
throw new
|
|
44
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Tool not found" });
|
|
44
45
|
}
|
|
45
46
|
const serializedTool = {
|
|
46
47
|
...tool,
|
|
47
|
-
inputSchema: tool.inputSchema ?
|
|
48
|
-
outputSchema: tool.outputSchema ?
|
|
48
|
+
inputSchema: tool.inputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(tool.inputSchema)) : void 0,
|
|
49
|
+
outputSchema: tool.outputSchema ? chunkLI436ITD_cjs.stringify(chunkLI436ITD_cjs.esm_default(tool.outputSchema)) : void 0
|
|
49
50
|
};
|
|
50
51
|
return serializedTool;
|
|
51
52
|
} catch (error) {
|
|
52
|
-
return
|
|
53
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error getting tool");
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
function executeToolHandler(tools$1) {
|
|
@@ -62,16 +63,16 @@ function executeToolHandler(tools$1) {
|
|
|
62
63
|
}) => {
|
|
63
64
|
try {
|
|
64
65
|
if (!toolId) {
|
|
65
|
-
throw new
|
|
66
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Tool ID is required" });
|
|
66
67
|
}
|
|
67
68
|
const tool = Object.values(tools$1 || {}).find((tool2) => tool2.id === toolId);
|
|
68
69
|
if (!tool) {
|
|
69
|
-
throw new
|
|
70
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Tool not found" });
|
|
70
71
|
}
|
|
71
72
|
if (!tool?.execute) {
|
|
72
|
-
throw new
|
|
73
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Tool is not executable" });
|
|
73
74
|
}
|
|
74
|
-
|
|
75
|
+
chunk57CJTIPW_cjs.validateBody({ data });
|
|
75
76
|
if (tools.isVercelTool(tool)) {
|
|
76
77
|
const result2 = await tool.execute(data);
|
|
77
78
|
return result2;
|
|
@@ -84,7 +85,7 @@ function executeToolHandler(tools$1) {
|
|
|
84
85
|
});
|
|
85
86
|
return result;
|
|
86
87
|
} catch (error) {
|
|
87
|
-
return
|
|
88
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error executing tool");
|
|
88
89
|
}
|
|
89
90
|
};
|
|
90
91
|
}
|
|
@@ -98,14 +99,15 @@ async function executeAgentToolHandler({
|
|
|
98
99
|
try {
|
|
99
100
|
const agent = agentId ? mastra.getAgent(agentId) : null;
|
|
100
101
|
if (!agent) {
|
|
101
|
-
throw new
|
|
102
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Tool not found" });
|
|
102
103
|
}
|
|
103
|
-
const
|
|
104
|
+
const agentTools = await agent.getTools({ runtimeContext });
|
|
105
|
+
const tool = Object.values(agentTools || {}).find((tool2) => tool2.id === toolId);
|
|
104
106
|
if (!tool) {
|
|
105
|
-
throw new
|
|
107
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Tool not found" });
|
|
106
108
|
}
|
|
107
109
|
if (!tool?.execute) {
|
|
108
|
-
throw new
|
|
110
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Tool is not executable" });
|
|
109
111
|
}
|
|
110
112
|
const result = await tool.execute({
|
|
111
113
|
context: data,
|
|
@@ -115,7 +117,7 @@ async function executeAgentToolHandler({
|
|
|
115
117
|
});
|
|
116
118
|
return result;
|
|
117
119
|
} catch (error) {
|
|
118
|
-
return
|
|
120
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error executing tool");
|
|
119
121
|
}
|
|
120
122
|
}
|
|
121
123
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkSDPGVWQJ_cjs = require('../../chunk-SDPGVWQJ.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "getAgentCardByIdHandler", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkSDPGVWQJ_cjs.getAgentCardByIdHandler; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "getAgentExecutionHandler", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkSDPGVWQJ_cjs.getAgentExecutionHandler; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "handleTaskCancel", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkSDPGVWQJ_cjs.handleTaskCancel; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "handleTaskGet", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkSDPGVWQJ_cjs.handleTaskGet; }
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "handleTaskSend", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkSDPGVWQJ_cjs.handleTaskSend; }
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "handleTaskSendSubscribe", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return chunkSDPGVWQJ_cjs.handleTaskSendSubscribe; }
|
|
30
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { getAgentCardByIdHandler } from '../../_tsup-dts-rollup.cjs';
|
|
2
|
+
export { handleTaskSend } from '../../_tsup-dts-rollup.cjs';
|
|
3
|
+
export { handleTaskGet } from '../../_tsup-dts-rollup.cjs';
|
|
4
|
+
export { handleTaskSendSubscribe } from '../../_tsup-dts-rollup.cjs';
|
|
5
|
+
export { handleTaskCancel } from '../../_tsup-dts-rollup.cjs';
|
|
6
|
+
export { getAgentExecutionHandler } from '../../_tsup-dts-rollup.cjs';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { getAgentCardByIdHandler } from '../../_tsup-dts-rollup.js';
|
|
2
|
+
export { handleTaskSend } from '../../_tsup-dts-rollup.js';
|
|
3
|
+
export { handleTaskGet } from '../../_tsup-dts-rollup.js';
|
|
4
|
+
export { handleTaskSendSubscribe } from '../../_tsup-dts-rollup.js';
|
|
5
|
+
export { handleTaskCancel } from '../../_tsup-dts-rollup.js';
|
|
6
|
+
export { getAgentExecutionHandler } from '../../_tsup-dts-rollup.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getAgentCardByIdHandler, getAgentExecutionHandler, handleTaskCancel, handleTaskGet, handleTaskSend, handleTaskSendSubscribe } from '../../chunk-GHC4YV6R.js';
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkEP3XVEVC_cjs = require('../../chunk-EP3XVEVC.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "generateHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkEP3XVEVC_cjs.generateHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "getAgentByIdHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkEP3XVEVC_cjs.getAgentByIdHandler; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getAgentsHandler", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkEP3XVEVC_cjs.getAgentsHandler; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getEvalsByAgentIdHandler", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkEP3XVEVC_cjs.getEvalsByAgentIdHandler; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "getLiveEvalsByAgentIdHandler", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkEP3XVEVC_cjs.getLiveEvalsByAgentIdHandler; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "streamGenerateHandler", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkEP3XVEVC_cjs.streamGenerateHandler; }
|
|
30
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { generateHandler, getAgentByIdHandler, getAgentsHandler, getEvalsByAgentIdHandler, getLiveEvalsByAgentIdHandler, streamGenerateHandler } from '../../chunk-
|
|
1
|
+
export { generateHandler, getAgentByIdHandler, getAgentsHandler, getEvalsByAgentIdHandler, getLiveEvalsByAgentIdHandler, streamGenerateHandler } from '../../chunk-2BCWG3EZ.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk64U3UDTH_cjs = require('../../chunk-64U3UDTH.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "handleError", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunk64U3UDTH_cjs.handleError; }
|
|
10
10
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { handleError } from '../../chunk-
|
|
1
|
+
export { handleError } from '../../chunk-M5ABIP7D.js';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkNGHSYB5B_cjs = require('../../chunk-NGHSYB5B.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "createLegacyWorkflowRunHandler", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkNGHSYB5B_cjs.createLegacyWorkflowRunHandler; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "getLegacyWorkflowByIdHandler", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkNGHSYB5B_cjs.getLegacyWorkflowByIdHandler; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "getLegacyWorkflowRunHandler", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkNGHSYB5B_cjs.getLegacyWorkflowRunHandler; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "getLegacyWorkflowRunsHandler", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkNGHSYB5B_cjs.getLegacyWorkflowRunsHandler; }
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "getLegacyWorkflowsHandler", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkNGHSYB5B_cjs.getLegacyWorkflowsHandler; }
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "resumeAsyncLegacyWorkflowHandler", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return chunkNGHSYB5B_cjs.resumeAsyncLegacyWorkflowHandler; }
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "resumeLegacyWorkflowHandler", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return chunkNGHSYB5B_cjs.resumeLegacyWorkflowHandler; }
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, "startAsyncLegacyWorkflowHandler", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () { return chunkNGHSYB5B_cjs.startAsyncLegacyWorkflowHandler; }
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "startLegacyWorkflowRunHandler", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () { return chunkNGHSYB5B_cjs.startLegacyWorkflowRunHandler; }
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "watchLegacyWorkflowHandler", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () { return chunkNGHSYB5B_cjs.watchLegacyWorkflowHandler; }
|
|
46
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { getLegacyWorkflowsHandler } from '../../_tsup-dts-rollup.cjs';
|
|
2
|
+
export { getLegacyWorkflowByIdHandler } from '../../_tsup-dts-rollup.cjs';
|
|
3
|
+
export { startAsyncLegacyWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
|
|
4
|
+
export { getLegacyWorkflowRunHandler } from '../../_tsup-dts-rollup.cjs';
|
|
5
|
+
export { createLegacyWorkflowRunHandler } from '../../_tsup-dts-rollup.cjs';
|
|
6
|
+
export { startLegacyWorkflowRunHandler } from '../../_tsup-dts-rollup.cjs';
|
|
7
|
+
export { watchLegacyWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
|
|
8
|
+
export { resumeAsyncLegacyWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
|
|
9
|
+
export { resumeLegacyWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
|
|
10
|
+
export { getLegacyWorkflowRunsHandler } from '../../_tsup-dts-rollup.cjs';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { getLegacyWorkflowsHandler } from '../../_tsup-dts-rollup.js';
|
|
2
|
+
export { getLegacyWorkflowByIdHandler } from '../../_tsup-dts-rollup.js';
|
|
3
|
+
export { startAsyncLegacyWorkflowHandler } from '../../_tsup-dts-rollup.js';
|
|
4
|
+
export { getLegacyWorkflowRunHandler } from '../../_tsup-dts-rollup.js';
|
|
5
|
+
export { createLegacyWorkflowRunHandler } from '../../_tsup-dts-rollup.js';
|
|
6
|
+
export { startLegacyWorkflowRunHandler } from '../../_tsup-dts-rollup.js';
|
|
7
|
+
export { watchLegacyWorkflowHandler } from '../../_tsup-dts-rollup.js';
|
|
8
|
+
export { resumeAsyncLegacyWorkflowHandler } from '../../_tsup-dts-rollup.js';
|
|
9
|
+
export { resumeLegacyWorkflowHandler } from '../../_tsup-dts-rollup.js';
|
|
10
|
+
export { getLegacyWorkflowRunsHandler } from '../../_tsup-dts-rollup.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createLegacyWorkflowRunHandler, getLegacyWorkflowByIdHandler, getLegacyWorkflowRunHandler, getLegacyWorkflowRunsHandler, getLegacyWorkflowsHandler, resumeAsyncLegacyWorkflowHandler, resumeLegacyWorkflowHandler, startAsyncLegacyWorkflowHandler, startLegacyWorkflowRunHandler, watchLegacyWorkflowHandler } from '../../chunk-E2LP4J6K.js';
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkIMBY5XUG_cjs = require('../../chunk-IMBY5XUG.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "getLogTransports", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkIMBY5XUG_cjs.getLogTransports; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "getLogsByRunIdHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkIMBY5XUG_cjs.getLogsByRunIdHandler; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getLogsHandler", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkIMBY5XUG_cjs.getLogsHandler; }
|
|
18
18
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { getLogTransports, getLogsByRunIdHandler, getLogsHandler } from '../../chunk-
|
|
1
|
+
export { getLogTransports, getLogsByRunIdHandler, getLogsHandler } from '../../chunk-QLG2PFHE.js';
|