@mastra/server 0.10.7-alpha.1 → 0.10.7-alpha.3

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