@mastra/server 0.0.0-fix-generate-title-20250616171351 → 0.0.0-fix-fetch-workflow-runs-20250624231457
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 +162 -22
- package/dist/_tsup-dts-rollup.d.ts +162 -22
- package/dist/{chunk-WE32JG64.cjs → chunk-4DTDPTQC.cjs} +7 -7
- package/dist/{chunk-NGURCFEJ.cjs → chunk-CPPYMJX5.cjs} +5 -5
- package/dist/{chunk-C75ZRJKD.cjs → chunk-GKM45O24.cjs} +21 -13
- package/dist/{chunk-ASKESBJW.cjs → chunk-MN6F4D5A.cjs} +35 -35
- package/dist/{chunk-CLYX4KLH.js → chunk-N2YBMSO2.js} +1 -1
- package/dist/{chunk-TGJMNUYJ.js → chunk-OSZM4EAY.js} +35 -35
- package/dist/{chunk-4O23XCE5.js → chunk-PMUATKV2.js} +17 -9
- package/dist/{chunk-CP55EVBK.js → chunk-R5VGYBV6.js} +12 -8
- package/dist/{chunk-6TJSHFCJ.cjs → chunk-RQ2Z56EC.cjs} +50 -20
- package/dist/{chunk-JKTNRUKY.js → chunk-SOBBILUG.js} +13 -49
- package/dist/{chunk-FRXZL32L.cjs → chunk-TO5U6HW3.cjs} +25 -61
- package/dist/{chunk-CMMOIUFC.cjs → chunk-WJY57THV.cjs} +12 -8
- package/dist/{chunk-2HXKRRNS.js → chunk-XR7VJOOP.js} +1 -1
- package/dist/{chunk-I7KJZNX5.js → chunk-XUIJ7WRT.js} +50 -20
- 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/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 +175 -0
- package/dist/server/handlers/vNextNetwork.d.cts +5 -0
- package/dist/server/handlers/vNextNetwork.d.ts +5 -0
- package/dist/server/handlers/vNextNetwork.js +169 -0
- package/dist/server/handlers/voice.cjs +5 -5
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +13 -13
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +12 -12
- package/dist/server/handlers.js +6 -6
- package/package.json +6 -6
|
@@ -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");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { stringify, esm_default } from './chunk-
|
|
1
|
+
import { stringify, esm_default } from './chunk-OSZM4EAY.js';
|
|
2
2
|
import { validateBody } from './chunk-H5PTF3Y4.js';
|
|
3
3
|
import { handleError } from './chunk-M5ABIP7D.js';
|
|
4
4
|
import { HTTPException } from './chunk-NYN7KFXL.js';
|
|
@@ -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
|
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkGKM45O24_cjs = require('../../chunk-GKM45O24.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 chunkGKM45O24_cjs.generateHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "getAgentByIdHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkGKM45O24_cjs.getAgentByIdHandler; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getAgentsHandler", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkGKM45O24_cjs.getAgentsHandler; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getEvalsByAgentIdHandler", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkGKM45O24_cjs.getEvalsByAgentIdHandler; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "getLiveEvalsByAgentIdHandler", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkGKM45O24_cjs.getLiveEvalsByAgentIdHandler; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "streamGenerateHandler", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkGKM45O24_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-PMUATKV2.js';
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk4DTDPTQC_cjs = require('../../chunk-4DTDPTQC.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 chunk4DTDPTQC_cjs.createLegacyWorkflowRunHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "getLegacyWorkflowByIdHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunk4DTDPTQC_cjs.getLegacyWorkflowByIdHandler; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getLegacyWorkflowRunHandler", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunk4DTDPTQC_cjs.getLegacyWorkflowRunHandler; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getLegacyWorkflowRunsHandler", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunk4DTDPTQC_cjs.getLegacyWorkflowRunsHandler; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "getLegacyWorkflowsHandler", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunk4DTDPTQC_cjs.getLegacyWorkflowsHandler; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "resumeAsyncLegacyWorkflowHandler", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunk4DTDPTQC_cjs.resumeAsyncLegacyWorkflowHandler; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "resumeLegacyWorkflowHandler", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunk4DTDPTQC_cjs.resumeLegacyWorkflowHandler; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "startAsyncLegacyWorkflowHandler", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunk4DTDPTQC_cjs.startAsyncLegacyWorkflowHandler; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "startLegacyWorkflowRunHandler", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunk4DTDPTQC_cjs.startLegacyWorkflowRunHandler; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "watchLegacyWorkflowHandler", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunk4DTDPTQC_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-N2YBMSO2.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';
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCPPYMJX5_cjs = require('../../chunk-CPPYMJX5.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "executeAgentToolHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkCPPYMJX5_cjs.executeAgentToolHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "executeToolHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkCPPYMJX5_cjs.executeToolHandler; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getToolByIdHandler", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkCPPYMJX5_cjs.getToolByIdHandler; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getToolsHandler", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkCPPYMJX5_cjs.getToolsHandler; }
|
|
22
22
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { executeAgentToolHandler, executeToolHandler, getToolByIdHandler, getToolsHandler } from '../../chunk-
|
|
1
|
+
export { executeAgentToolHandler, executeToolHandler, getToolByIdHandler, getToolsHandler } from '../../chunk-XR7VJOOP.js';
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkMN6F4D5A_cjs = require('../../chunk-MN6F4D5A.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
|
+
|
|
8
|
+
// src/server/handlers/vNextNetwork.ts
|
|
9
|
+
async function getVNextNetworksHandler({
|
|
10
|
+
mastra,
|
|
11
|
+
runtimeContext
|
|
12
|
+
}) {
|
|
13
|
+
try {
|
|
14
|
+
const networks = mastra.vnext_getNetworks();
|
|
15
|
+
const serializedNetworks = await Promise.all(
|
|
16
|
+
networks.map(async (network) => {
|
|
17
|
+
const routingAgent = await network.getRoutingAgent({ runtimeContext });
|
|
18
|
+
const routingLLM = await routingAgent.getLLM({ runtimeContext });
|
|
19
|
+
const agents = await network.getAgents({ runtimeContext });
|
|
20
|
+
const workflows = await network.getWorkflows({ runtimeContext });
|
|
21
|
+
const networkInstruction = await network.getInstructions({ runtimeContext });
|
|
22
|
+
return {
|
|
23
|
+
id: network.id,
|
|
24
|
+
name: network.name,
|
|
25
|
+
instructions: networkInstruction,
|
|
26
|
+
agents: await Promise.all(
|
|
27
|
+
Object.values(agents).map(async (agent) => {
|
|
28
|
+
const llm = await agent.getLLM({ runtimeContext });
|
|
29
|
+
return {
|
|
30
|
+
name: agent.name,
|
|
31
|
+
provider: llm?.getProvider(),
|
|
32
|
+
modelId: llm?.getModelId()
|
|
33
|
+
};
|
|
34
|
+
})
|
|
35
|
+
),
|
|
36
|
+
workflows: await Promise.all(
|
|
37
|
+
Object.values(workflows).map(async (workflow) => {
|
|
38
|
+
return {
|
|
39
|
+
name: workflow.name,
|
|
40
|
+
description: workflow.description,
|
|
41
|
+
inputSchema: workflow.inputSchema ? chunkMN6F4D5A_cjs.stringify(chunkMN6F4D5A_cjs.esm_default(workflow.inputSchema)) : void 0,
|
|
42
|
+
outputSchema: workflow.outputSchema ? chunkMN6F4D5A_cjs.stringify(chunkMN6F4D5A_cjs.esm_default(workflow.outputSchema)) : void 0
|
|
43
|
+
};
|
|
44
|
+
})
|
|
45
|
+
),
|
|
46
|
+
routingModel: {
|
|
47
|
+
provider: routingLLM?.getProvider(),
|
|
48
|
+
modelId: routingLLM?.getModelId()
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
})
|
|
52
|
+
);
|
|
53
|
+
return serializedNetworks;
|
|
54
|
+
} catch (error) {
|
|
55
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error getting networks");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async function getVNextNetworkByIdHandler({
|
|
59
|
+
mastra,
|
|
60
|
+
networkId,
|
|
61
|
+
runtimeContext
|
|
62
|
+
}) {
|
|
63
|
+
try {
|
|
64
|
+
const network = mastra.vnext_getNetwork(networkId);
|
|
65
|
+
if (!network) {
|
|
66
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Network not found" });
|
|
67
|
+
}
|
|
68
|
+
const routingAgent = await network.getRoutingAgent({ runtimeContext });
|
|
69
|
+
const routingLLM = await routingAgent.getLLM({ runtimeContext });
|
|
70
|
+
const agents = await network.getAgents({ runtimeContext });
|
|
71
|
+
const workflows = await network.getWorkflows({ runtimeContext });
|
|
72
|
+
const networkInstruction = await network.getInstructions({ runtimeContext });
|
|
73
|
+
const serializedNetwork = {
|
|
74
|
+
id: network.id,
|
|
75
|
+
name: network.name,
|
|
76
|
+
instructions: networkInstruction,
|
|
77
|
+
agents: await Promise.all(
|
|
78
|
+
Object.values(agents).map(async (agent) => {
|
|
79
|
+
const llm = await agent.getLLM({ runtimeContext });
|
|
80
|
+
return {
|
|
81
|
+
name: agent.name,
|
|
82
|
+
provider: llm?.getProvider(),
|
|
83
|
+
modelId: llm?.getModelId()
|
|
84
|
+
};
|
|
85
|
+
})
|
|
86
|
+
),
|
|
87
|
+
workflows: await Promise.all(
|
|
88
|
+
Object.values(workflows).map(async (workflow) => {
|
|
89
|
+
return {
|
|
90
|
+
name: workflow.name,
|
|
91
|
+
description: workflow.description,
|
|
92
|
+
inputSchema: workflow.inputSchema ? chunkMN6F4D5A_cjs.stringify(chunkMN6F4D5A_cjs.esm_default(workflow.inputSchema)) : void 0,
|
|
93
|
+
outputSchema: workflow.outputSchema ? chunkMN6F4D5A_cjs.stringify(chunkMN6F4D5A_cjs.esm_default(workflow.outputSchema)) : void 0
|
|
94
|
+
};
|
|
95
|
+
})
|
|
96
|
+
),
|
|
97
|
+
routingModel: {
|
|
98
|
+
provider: routingLLM?.getProvider(),
|
|
99
|
+
modelId: routingLLM?.getModelId()
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
return serializedNetwork;
|
|
103
|
+
} catch (error) {
|
|
104
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error getting network by ID");
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async function generateVNextNetworkHandler({
|
|
108
|
+
mastra,
|
|
109
|
+
runtimeContext,
|
|
110
|
+
networkId,
|
|
111
|
+
body
|
|
112
|
+
}) {
|
|
113
|
+
try {
|
|
114
|
+
const network = mastra.vnext_getNetwork(networkId);
|
|
115
|
+
if (!network) {
|
|
116
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Network not found" });
|
|
117
|
+
}
|
|
118
|
+
chunk57CJTIPW_cjs.validateBody({ message: body.message });
|
|
119
|
+
const { message, threadId, resourceId } = body;
|
|
120
|
+
const result = await network.generate(message, { runtimeContext, threadId, resourceId });
|
|
121
|
+
return result;
|
|
122
|
+
} catch (error) {
|
|
123
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error generating from network");
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async function streamGenerateVNextNetworkHandler({
|
|
127
|
+
mastra,
|
|
128
|
+
networkId,
|
|
129
|
+
body,
|
|
130
|
+
runtimeContext
|
|
131
|
+
}) {
|
|
132
|
+
try {
|
|
133
|
+
const network = mastra.vnext_getNetwork(networkId);
|
|
134
|
+
if (!network) {
|
|
135
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Network not found" });
|
|
136
|
+
}
|
|
137
|
+
chunk57CJTIPW_cjs.validateBody({ message: body.message });
|
|
138
|
+
const { message, threadId, resourceId } = body;
|
|
139
|
+
const streamResult = await network.stream(message, {
|
|
140
|
+
runtimeContext,
|
|
141
|
+
threadId,
|
|
142
|
+
resourceId
|
|
143
|
+
});
|
|
144
|
+
return streamResult;
|
|
145
|
+
} catch (error) {
|
|
146
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error streaming from network");
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
async function loopVNextNetworkHandler({
|
|
150
|
+
mastra,
|
|
151
|
+
networkId,
|
|
152
|
+
body,
|
|
153
|
+
runtimeContext
|
|
154
|
+
}) {
|
|
155
|
+
try {
|
|
156
|
+
const network = mastra.vnext_getNetwork(networkId);
|
|
157
|
+
if (!network) {
|
|
158
|
+
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Network not found" });
|
|
159
|
+
}
|
|
160
|
+
chunk57CJTIPW_cjs.validateBody({ message: body.message });
|
|
161
|
+
const { message } = body;
|
|
162
|
+
const result = await network.loop(message, {
|
|
163
|
+
runtimeContext
|
|
164
|
+
});
|
|
165
|
+
return result;
|
|
166
|
+
} catch (error) {
|
|
167
|
+
return chunk64U3UDTH_cjs.handleError(error, "Error looping network");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
exports.generateVNextNetworkHandler = generateVNextNetworkHandler;
|
|
172
|
+
exports.getVNextNetworkByIdHandler = getVNextNetworkByIdHandler;
|
|
173
|
+
exports.getVNextNetworksHandler = getVNextNetworksHandler;
|
|
174
|
+
exports.loopVNextNetworkHandler = loopVNextNetworkHandler;
|
|
175
|
+
exports.streamGenerateVNextNetworkHandler = streamGenerateVNextNetworkHandler;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { getVNextNetworksHandler } from '../../_tsup-dts-rollup.cjs';
|
|
2
|
+
export { getVNextNetworkByIdHandler } from '../../_tsup-dts-rollup.cjs';
|
|
3
|
+
export { generateVNextNetworkHandler } from '../../_tsup-dts-rollup.cjs';
|
|
4
|
+
export { streamGenerateVNextNetworkHandler } from '../../_tsup-dts-rollup.cjs';
|
|
5
|
+
export { loopVNextNetworkHandler } from '../../_tsup-dts-rollup.cjs';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { getVNextNetworksHandler } from '../../_tsup-dts-rollup.js';
|
|
2
|
+
export { getVNextNetworkByIdHandler } from '../../_tsup-dts-rollup.js';
|
|
3
|
+
export { generateVNextNetworkHandler } from '../../_tsup-dts-rollup.js';
|
|
4
|
+
export { streamGenerateVNextNetworkHandler } from '../../_tsup-dts-rollup.js';
|
|
5
|
+
export { loopVNextNetworkHandler } from '../../_tsup-dts-rollup.js';
|