@mastra/server 0.0.0-taofeeqInngest-20250603090617 → 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/dist/_tsup-dts-rollup.d.cts +252 -35
- package/dist/_tsup-dts-rollup.d.ts +252 -35
- package/dist/{chunk-J3PKLB3A.js → chunk-2BCWG3EZ.js} +52 -13
- package/dist/{chunk-KUNQFY2W.js → chunk-72LOJGUV.js} +106 -50
- package/dist/{chunk-W7VCKPAD.js → chunk-E2LP4J6K.js} +2 -2
- package/dist/{chunk-A3KDUGS7.cjs → chunk-EP3XVEVC.cjs} +56 -17
- package/dist/{chunk-TJKLBTFB.js → chunk-EWLR2PNT.js} +7 -17
- package/dist/{chunk-NEOOQUKW.cjs → chunk-IMBY5XUG.cjs} +36 -4
- package/dist/{chunk-MMO2HDM6.cjs → chunk-L3VURYKY.cjs} +117 -60
- package/dist/{chunk-YWLUOY3D.cjs → chunk-LI436ITD.cjs} +107 -69
- package/dist/{chunk-LIVAK2DM.js → chunk-MEGCYGBU.js} +108 -70
- package/dist/{chunk-YIOVBYZH.cjs → chunk-NGHSYB5B.cjs} +7 -7
- package/dist/{chunk-DQLE3DVM.js → chunk-QLG2PFHE.js} +36 -4
- package/dist/{chunk-CP55EVBK.js → chunk-R5VGYBV6.js} +12 -8
- package/dist/{chunk-Y7UWRW5X.cjs → chunk-RQ2Z56EC.cjs} +51 -21
- package/dist/{chunk-CMMOIUFC.cjs → chunk-WJY57THV.cjs} +12 -8
- package/dist/{chunk-DJJIUEL2.js → chunk-XUIJ7WRT.js} +51 -21
- package/dist/{chunk-ZE5AAC4I.cjs → chunk-Z3PTO2AK.cjs} +11 -21
- package/dist/server/handlers/agents.cjs +7 -7
- package/dist/server/handlers/agents.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 +9 -9
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/tools.cjs +5 -5
- package/dist/server/handlers/tools.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/voice.cjs +5 -5
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +16 -12
- package/dist/server/handlers/workflows.d.cts +1 -0
- package/dist/server/handlers/workflows.d.ts +1 -0
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +14 -14
- package/dist/server/handlers.js +7 -7
- package/package.json +12 -13
|
@@ -17,20 +17,36 @@ chunk75ZPJI57_cjs.__export(memory_exports, {
|
|
|
17
17
|
saveMessagesHandler: () => saveMessagesHandler,
|
|
18
18
|
updateThreadHandler: () => updateThreadHandler
|
|
19
19
|
});
|
|
20
|
-
function getMemoryFromContext({
|
|
20
|
+
async function getMemoryFromContext({
|
|
21
21
|
mastra,
|
|
22
|
-
agentId
|
|
22
|
+
agentId,
|
|
23
|
+
networkId,
|
|
24
|
+
runtimeContext
|
|
23
25
|
}) {
|
|
24
26
|
const agent = agentId ? mastra.getAgent(agentId) : null;
|
|
25
27
|
if (agentId && !agent) {
|
|
26
28
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
|
|
27
29
|
}
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
+
const network = networkId ? mastra.vnext_getNetwork(networkId) : null;
|
|
31
|
+
if (networkId && !network) {
|
|
32
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Network not found" });
|
|
33
|
+
}
|
|
34
|
+
if (agent) {
|
|
35
|
+
return agent?.getMemory() || mastra.getMemory();
|
|
36
|
+
}
|
|
37
|
+
if (network) {
|
|
38
|
+
return await network?.getMemory({ runtimeContext }) || mastra.getMemory();
|
|
39
|
+
}
|
|
40
|
+
return mastra.getMemory();
|
|
30
41
|
}
|
|
31
|
-
async function getMemoryStatusHandler({
|
|
42
|
+
async function getMemoryStatusHandler({
|
|
43
|
+
mastra,
|
|
44
|
+
agentId,
|
|
45
|
+
networkId,
|
|
46
|
+
runtimeContext
|
|
47
|
+
}) {
|
|
32
48
|
try {
|
|
33
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
49
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
34
50
|
if (!memory) {
|
|
35
51
|
return { result: false };
|
|
36
52
|
}
|
|
@@ -42,10 +58,12 @@ async function getMemoryStatusHandler({ mastra, agentId }) {
|
|
|
42
58
|
async function getThreadsHandler({
|
|
43
59
|
mastra,
|
|
44
60
|
agentId,
|
|
45
|
-
resourceId
|
|
61
|
+
resourceId,
|
|
62
|
+
networkId,
|
|
63
|
+
runtimeContext
|
|
46
64
|
}) {
|
|
47
65
|
try {
|
|
48
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
66
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
49
67
|
if (!memory) {
|
|
50
68
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
|
|
51
69
|
}
|
|
@@ -59,11 +77,13 @@ async function getThreadsHandler({
|
|
|
59
77
|
async function getThreadByIdHandler({
|
|
60
78
|
mastra,
|
|
61
79
|
agentId,
|
|
62
|
-
threadId
|
|
80
|
+
threadId,
|
|
81
|
+
networkId,
|
|
82
|
+
runtimeContext
|
|
63
83
|
}) {
|
|
64
84
|
try {
|
|
65
85
|
chunk57CJTIPW_cjs.validateBody({ threadId });
|
|
66
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
86
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
67
87
|
if (!memory) {
|
|
68
88
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
|
|
69
89
|
}
|
|
@@ -79,10 +99,12 @@ async function getThreadByIdHandler({
|
|
|
79
99
|
async function saveMessagesHandler({
|
|
80
100
|
mastra,
|
|
81
101
|
agentId,
|
|
82
|
-
body
|
|
102
|
+
body,
|
|
103
|
+
networkId,
|
|
104
|
+
runtimeContext
|
|
83
105
|
}) {
|
|
84
106
|
try {
|
|
85
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
107
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
86
108
|
if (!memory) {
|
|
87
109
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
|
|
88
110
|
}
|
|
@@ -106,10 +128,12 @@ async function saveMessagesHandler({
|
|
|
106
128
|
async function createThreadHandler({
|
|
107
129
|
mastra,
|
|
108
130
|
agentId,
|
|
109
|
-
body
|
|
131
|
+
body,
|
|
132
|
+
networkId,
|
|
133
|
+
runtimeContext
|
|
110
134
|
}) {
|
|
111
135
|
try {
|
|
112
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
136
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
113
137
|
if (!memory) {
|
|
114
138
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
|
|
115
139
|
}
|
|
@@ -129,10 +153,12 @@ async function updateThreadHandler({
|
|
|
129
153
|
mastra,
|
|
130
154
|
agentId,
|
|
131
155
|
threadId,
|
|
132
|
-
body
|
|
156
|
+
body,
|
|
157
|
+
networkId,
|
|
158
|
+
runtimeContext
|
|
133
159
|
}) {
|
|
134
160
|
try {
|
|
135
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
161
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
136
162
|
if (!body) {
|
|
137
163
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Body is required" });
|
|
138
164
|
}
|
|
@@ -163,11 +189,13 @@ async function updateThreadHandler({
|
|
|
163
189
|
async function deleteThreadHandler({
|
|
164
190
|
mastra,
|
|
165
191
|
agentId,
|
|
166
|
-
threadId
|
|
192
|
+
threadId,
|
|
193
|
+
networkId,
|
|
194
|
+
runtimeContext
|
|
167
195
|
}) {
|
|
168
196
|
try {
|
|
169
197
|
chunk57CJTIPW_cjs.validateBody({ threadId });
|
|
170
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
198
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
171
199
|
if (!memory) {
|
|
172
200
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
|
|
173
201
|
}
|
|
@@ -185,14 +213,16 @@ async function getMessagesHandler({
|
|
|
185
213
|
mastra,
|
|
186
214
|
agentId,
|
|
187
215
|
threadId,
|
|
188
|
-
limit
|
|
216
|
+
limit,
|
|
217
|
+
networkId,
|
|
218
|
+
runtimeContext
|
|
189
219
|
}) {
|
|
190
220
|
if (limit !== void 0 && (!Number.isInteger(limit) || limit <= 0)) {
|
|
191
221
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Invalid limit: must be a positive integer" });
|
|
192
222
|
}
|
|
193
223
|
try {
|
|
194
224
|
chunk57CJTIPW_cjs.validateBody({ threadId });
|
|
195
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
225
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
196
226
|
if (!memory) {
|
|
197
227
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
|
|
198
228
|
}
|
|
@@ -204,7 +234,7 @@ async function getMessagesHandler({
|
|
|
204
234
|
threadId,
|
|
205
235
|
...limit && { selectBy: { last: limit } }
|
|
206
236
|
});
|
|
207
|
-
return result;
|
|
237
|
+
return { messages: result.messages, uiMessages: result.uiMessages };
|
|
208
238
|
} catch (error) {
|
|
209
239
|
return chunk64U3UDTH_cjs.handleError(error, "Error getting messages");
|
|
210
240
|
}
|
|
@@ -23,10 +23,11 @@ async function getSpeakersHandler({ mastra, agentId }) {
|
|
|
23
23
|
if (!agent) {
|
|
24
24
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
const voice = await agent.getVoice();
|
|
27
|
+
if (!voice) {
|
|
27
28
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
28
29
|
}
|
|
29
|
-
const speakers = await
|
|
30
|
+
const speakers = await voice.getSpeakers();
|
|
30
31
|
return speakers;
|
|
31
32
|
} catch (error) {
|
|
32
33
|
return chunk64U3UDTH_cjs.handleError(error, "Error getting speakers");
|
|
@@ -48,10 +49,11 @@ async function generateSpeechHandler({
|
|
|
48
49
|
if (!agent) {
|
|
49
50
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
+
const voice = await agent.getVoice();
|
|
53
|
+
if (!voice) {
|
|
52
54
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
53
55
|
}
|
|
54
|
-
const audioStream = await
|
|
56
|
+
const audioStream = await voice.speak(body.text, { speaker: body.speakerId });
|
|
55
57
|
if (!audioStream) {
|
|
56
58
|
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: "Failed to generate speech" });
|
|
57
59
|
}
|
|
@@ -76,13 +78,14 @@ async function transcribeSpeechHandler({
|
|
|
76
78
|
if (!agent) {
|
|
77
79
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
|
|
78
80
|
}
|
|
79
|
-
|
|
81
|
+
const voice = await agent.getVoice();
|
|
82
|
+
if (!voice) {
|
|
80
83
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
81
84
|
}
|
|
82
85
|
const audioStream = new stream.Readable();
|
|
83
86
|
audioStream.push(body.audioData);
|
|
84
87
|
audioStream.push(null);
|
|
85
|
-
const text = await
|
|
88
|
+
const text = await voice.listen(audioStream, body.options);
|
|
86
89
|
return { text };
|
|
87
90
|
} catch (error) {
|
|
88
91
|
return chunk64U3UDTH_cjs.handleError(error, "Error transcribing speech");
|
|
@@ -97,10 +100,11 @@ async function getListenerHandler({ mastra, agentId }) {
|
|
|
97
100
|
if (!agent) {
|
|
98
101
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
|
|
99
102
|
}
|
|
100
|
-
|
|
103
|
+
const voice = await agent.getVoice();
|
|
104
|
+
if (!voice) {
|
|
101
105
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Agent does not have voice capabilities" });
|
|
102
106
|
}
|
|
103
|
-
const listeners = await
|
|
107
|
+
const listeners = await voice.getListener();
|
|
104
108
|
return listeners;
|
|
105
109
|
} catch (error) {
|
|
106
110
|
return chunk64U3UDTH_cjs.handleError(error, "Error getting listeners");
|
|
@@ -15,20 +15,36 @@ __export(memory_exports, {
|
|
|
15
15
|
saveMessagesHandler: () => saveMessagesHandler,
|
|
16
16
|
updateThreadHandler: () => updateThreadHandler
|
|
17
17
|
});
|
|
18
|
-
function getMemoryFromContext({
|
|
18
|
+
async function getMemoryFromContext({
|
|
19
19
|
mastra,
|
|
20
|
-
agentId
|
|
20
|
+
agentId,
|
|
21
|
+
networkId,
|
|
22
|
+
runtimeContext
|
|
21
23
|
}) {
|
|
22
24
|
const agent = agentId ? mastra.getAgent(agentId) : null;
|
|
23
25
|
if (agentId && !agent) {
|
|
24
26
|
throw new HTTPException(404, { message: "Agent not found" });
|
|
25
27
|
}
|
|
26
|
-
const
|
|
27
|
-
|
|
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();
|
|
28
39
|
}
|
|
29
|
-
async function getMemoryStatusHandler({
|
|
40
|
+
async function getMemoryStatusHandler({
|
|
41
|
+
mastra,
|
|
42
|
+
agentId,
|
|
43
|
+
networkId,
|
|
44
|
+
runtimeContext
|
|
45
|
+
}) {
|
|
30
46
|
try {
|
|
31
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
47
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
32
48
|
if (!memory) {
|
|
33
49
|
return { result: false };
|
|
34
50
|
}
|
|
@@ -40,10 +56,12 @@ async function getMemoryStatusHandler({ mastra, agentId }) {
|
|
|
40
56
|
async function getThreadsHandler({
|
|
41
57
|
mastra,
|
|
42
58
|
agentId,
|
|
43
|
-
resourceId
|
|
59
|
+
resourceId,
|
|
60
|
+
networkId,
|
|
61
|
+
runtimeContext
|
|
44
62
|
}) {
|
|
45
63
|
try {
|
|
46
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
64
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
47
65
|
if (!memory) {
|
|
48
66
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
49
67
|
}
|
|
@@ -57,11 +75,13 @@ async function getThreadsHandler({
|
|
|
57
75
|
async function getThreadByIdHandler({
|
|
58
76
|
mastra,
|
|
59
77
|
agentId,
|
|
60
|
-
threadId
|
|
78
|
+
threadId,
|
|
79
|
+
networkId,
|
|
80
|
+
runtimeContext
|
|
61
81
|
}) {
|
|
62
82
|
try {
|
|
63
83
|
validateBody({ threadId });
|
|
64
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
84
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
65
85
|
if (!memory) {
|
|
66
86
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
67
87
|
}
|
|
@@ -77,10 +97,12 @@ async function getThreadByIdHandler({
|
|
|
77
97
|
async function saveMessagesHandler({
|
|
78
98
|
mastra,
|
|
79
99
|
agentId,
|
|
80
|
-
body
|
|
100
|
+
body,
|
|
101
|
+
networkId,
|
|
102
|
+
runtimeContext
|
|
81
103
|
}) {
|
|
82
104
|
try {
|
|
83
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
105
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
84
106
|
if (!memory) {
|
|
85
107
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
86
108
|
}
|
|
@@ -104,10 +126,12 @@ async function saveMessagesHandler({
|
|
|
104
126
|
async function createThreadHandler({
|
|
105
127
|
mastra,
|
|
106
128
|
agentId,
|
|
107
|
-
body
|
|
129
|
+
body,
|
|
130
|
+
networkId,
|
|
131
|
+
runtimeContext
|
|
108
132
|
}) {
|
|
109
133
|
try {
|
|
110
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
134
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
111
135
|
if (!memory) {
|
|
112
136
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
113
137
|
}
|
|
@@ -127,10 +151,12 @@ async function updateThreadHandler({
|
|
|
127
151
|
mastra,
|
|
128
152
|
agentId,
|
|
129
153
|
threadId,
|
|
130
|
-
body
|
|
154
|
+
body,
|
|
155
|
+
networkId,
|
|
156
|
+
runtimeContext
|
|
131
157
|
}) {
|
|
132
158
|
try {
|
|
133
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
159
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
134
160
|
if (!body) {
|
|
135
161
|
throw new HTTPException(400, { message: "Body is required" });
|
|
136
162
|
}
|
|
@@ -161,11 +187,13 @@ async function updateThreadHandler({
|
|
|
161
187
|
async function deleteThreadHandler({
|
|
162
188
|
mastra,
|
|
163
189
|
agentId,
|
|
164
|
-
threadId
|
|
190
|
+
threadId,
|
|
191
|
+
networkId,
|
|
192
|
+
runtimeContext
|
|
165
193
|
}) {
|
|
166
194
|
try {
|
|
167
195
|
validateBody({ threadId });
|
|
168
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
196
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
169
197
|
if (!memory) {
|
|
170
198
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
171
199
|
}
|
|
@@ -183,14 +211,16 @@ async function getMessagesHandler({
|
|
|
183
211
|
mastra,
|
|
184
212
|
agentId,
|
|
185
213
|
threadId,
|
|
186
|
-
limit
|
|
214
|
+
limit,
|
|
215
|
+
networkId,
|
|
216
|
+
runtimeContext
|
|
187
217
|
}) {
|
|
188
218
|
if (limit !== void 0 && (!Number.isInteger(limit) || limit <= 0)) {
|
|
189
219
|
throw new HTTPException(400, { message: "Invalid limit: must be a positive integer" });
|
|
190
220
|
}
|
|
191
221
|
try {
|
|
192
222
|
validateBody({ threadId });
|
|
193
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
223
|
+
const memory = await getMemoryFromContext({ mastra, agentId, networkId, runtimeContext });
|
|
194
224
|
if (!memory) {
|
|
195
225
|
throw new HTTPException(400, { message: "Memory is not initialized" });
|
|
196
226
|
}
|
|
@@ -202,7 +232,7 @@ async function getMessagesHandler({
|
|
|
202
232
|
threadId,
|
|
203
233
|
...limit && { selectBy: { last: limit } }
|
|
204
234
|
});
|
|
205
|
-
return result;
|
|
235
|
+
return { messages: result.messages, uiMessages: result.uiMessages };
|
|
206
236
|
} catch (error) {
|
|
207
237
|
return handleError(error, "Error getting messages");
|
|
208
238
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkLI436ITD_cjs = require('./chunk-LI436ITD.cjs');
|
|
4
4
|
var chunk57CJTIPW_cjs = require('./chunk-57CJTIPW.cjs');
|
|
5
5
|
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
6
6
|
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
7
7
|
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
8
|
-
var di = require('@mastra/core/di');
|
|
9
8
|
var tools = require('@mastra/core/tools');
|
|
10
9
|
|
|
11
10
|
// src/server/handlers/tools.ts
|
|
@@ -26,8 +25,8 @@ async function getToolsHandler({ tools }) {
|
|
|
26
25
|
const tool = _tool;
|
|
27
26
|
acc[id] = {
|
|
28
27
|
...tool,
|
|
29
|
-
inputSchema: tool.inputSchema ?
|
|
30
|
-
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
|
|
31
30
|
};
|
|
32
31
|
return acc;
|
|
33
32
|
},
|
|
@@ -46,8 +45,8 @@ async function getToolByIdHandler({ tools, toolId }) {
|
|
|
46
45
|
}
|
|
47
46
|
const serializedTool = {
|
|
48
47
|
...tool,
|
|
49
|
-
inputSchema: tool.inputSchema ?
|
|
50
|
-
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
|
|
51
50
|
};
|
|
52
51
|
return serializedTool;
|
|
53
52
|
} catch (error) {
|
|
@@ -60,8 +59,7 @@ function executeToolHandler(tools$1) {
|
|
|
60
59
|
runId,
|
|
61
60
|
toolId,
|
|
62
61
|
data,
|
|
63
|
-
runtimeContext
|
|
64
|
-
runtimeContextFromRequest
|
|
62
|
+
runtimeContext
|
|
65
63
|
}) => {
|
|
66
64
|
try {
|
|
67
65
|
if (!toolId) {
|
|
@@ -79,15 +77,11 @@ function executeToolHandler(tools$1) {
|
|
|
79
77
|
const result2 = await tool.execute(data);
|
|
80
78
|
return result2;
|
|
81
79
|
}
|
|
82
|
-
const finalRuntimeContext = new di.RuntimeContext([
|
|
83
|
-
...Array.from(runtimeContext.entries()),
|
|
84
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
85
|
-
]);
|
|
86
80
|
const result = await tool.execute({
|
|
87
81
|
context: data,
|
|
88
82
|
mastra,
|
|
89
83
|
runId,
|
|
90
|
-
runtimeContext
|
|
84
|
+
runtimeContext
|
|
91
85
|
});
|
|
92
86
|
return result;
|
|
93
87
|
} catch (error) {
|
|
@@ -100,28 +94,24 @@ async function executeAgentToolHandler({
|
|
|
100
94
|
agentId,
|
|
101
95
|
toolId,
|
|
102
96
|
data,
|
|
103
|
-
runtimeContext
|
|
104
|
-
runtimeContextFromRequest
|
|
97
|
+
runtimeContext
|
|
105
98
|
}) {
|
|
106
99
|
try {
|
|
107
100
|
const agent = agentId ? mastra.getAgent(agentId) : null;
|
|
108
101
|
if (!agent) {
|
|
109
102
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Tool not found" });
|
|
110
103
|
}
|
|
111
|
-
const
|
|
104
|
+
const agentTools = await agent.getTools({ runtimeContext });
|
|
105
|
+
const tool = Object.values(agentTools || {}).find((tool2) => tool2.id === toolId);
|
|
112
106
|
if (!tool) {
|
|
113
107
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Tool not found" });
|
|
114
108
|
}
|
|
115
109
|
if (!tool?.execute) {
|
|
116
110
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Tool is not executable" });
|
|
117
111
|
}
|
|
118
|
-
const finalRuntimeContext = new di.RuntimeContext([
|
|
119
|
-
...Array.from(runtimeContext.entries()),
|
|
120
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
121
|
-
]);
|
|
122
112
|
const result = await tool.execute({
|
|
123
113
|
context: data,
|
|
124
|
-
runtimeContext
|
|
114
|
+
runtimeContext,
|
|
125
115
|
mastra,
|
|
126
116
|
runId: agentId
|
|
127
117
|
});
|
|
@@ -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,46 +1,46 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkNGHSYB5B_cjs = require('../../chunk-NGHSYB5B.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "createLegacyWorkflowRunHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkNGHSYB5B_cjs.createLegacyWorkflowRunHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "getLegacyWorkflowByIdHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkNGHSYB5B_cjs.getLegacyWorkflowByIdHandler; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getLegacyWorkflowRunHandler", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkNGHSYB5B_cjs.getLegacyWorkflowRunHandler; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getLegacyWorkflowRunsHandler", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkNGHSYB5B_cjs.getLegacyWorkflowRunsHandler; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "getLegacyWorkflowsHandler", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkNGHSYB5B_cjs.getLegacyWorkflowsHandler; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "resumeAsyncLegacyWorkflowHandler", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkNGHSYB5B_cjs.resumeAsyncLegacyWorkflowHandler; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "resumeLegacyWorkflowHandler", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkNGHSYB5B_cjs.resumeLegacyWorkflowHandler; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "startAsyncLegacyWorkflowHandler", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkNGHSYB5B_cjs.startAsyncLegacyWorkflowHandler; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "startLegacyWorkflowRunHandler", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkNGHSYB5B_cjs.startLegacyWorkflowRunHandler; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "watchLegacyWorkflowHandler", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkNGHSYB5B_cjs.watchLegacyWorkflowHandler; }
|
|
46
46
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createLegacyWorkflowRunHandler, getLegacyWorkflowByIdHandler, getLegacyWorkflowRunHandler, getLegacyWorkflowRunsHandler, getLegacyWorkflowsHandler, resumeAsyncLegacyWorkflowHandler, resumeLegacyWorkflowHandler, startAsyncLegacyWorkflowHandler, startLegacyWorkflowRunHandler, watchLegacyWorkflowHandler } from '../../chunk-
|
|
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';
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkRQ2Z56EC_cjs = require('../../chunk-RQ2Z56EC.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "createThreadHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkRQ2Z56EC_cjs.createThreadHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "deleteThreadHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkRQ2Z56EC_cjs.deleteThreadHandler; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getMemoryStatusHandler", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkRQ2Z56EC_cjs.getMemoryStatusHandler; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getMessagesHandler", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkRQ2Z56EC_cjs.getMessagesHandler; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "getThreadByIdHandler", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkRQ2Z56EC_cjs.getThreadByIdHandler; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "getThreadsHandler", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkRQ2Z56EC_cjs.getThreadsHandler; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "saveMessagesHandler", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkRQ2Z56EC_cjs.saveMessagesHandler; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "updateThreadHandler", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkRQ2Z56EC_cjs.updateThreadHandler; }
|
|
38
38
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createThreadHandler, deleteThreadHandler, getMemoryStatusHandler, getMessagesHandler, getThreadByIdHandler, getThreadsHandler, saveMessagesHandler, updateThreadHandler } from '../../chunk-
|
|
1
|
+
export { createThreadHandler, deleteThreadHandler, getMemoryStatusHandler, getMessagesHandler, getThreadByIdHandler, getThreadsHandler, saveMessagesHandler, updateThreadHandler } from '../../chunk-XUIJ7WRT.js';
|