@mastra/server 0.10.3 → 0.10.4-alpha.1
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 +32 -16
- package/dist/_tsup-dts-rollup.d.ts +32 -16
- package/dist/{chunk-J3PKLB3A.js → chunk-6MQO3273.js} +18 -3
- package/dist/{chunk-KUNQFY2W.js → chunk-7IBZ4L35.js} +10 -31
- package/dist/{chunk-B6AYBJUA.js → chunk-HYP7B2TL.js} +5 -16
- package/dist/{chunk-NEOOQUKW.cjs → chunk-IMBY5XUG.cjs} +36 -4
- package/dist/{chunk-MMO2HDM6.cjs → chunk-JKF6PRPU.cjs} +21 -42
- package/dist/{chunk-A3KDUGS7.cjs → chunk-P77X4SV2.cjs} +22 -7
- package/dist/{chunk-DQLE3DVM.js → chunk-QLG2PFHE.js} +36 -4
- package/dist/{chunk-W7VCKPAD.js → chunk-TEZOEGR4.js} +2 -2
- package/dist/{chunk-7VOSGHNC.cjs → chunk-TJO277H7.cjs} +9 -20
- package/dist/{chunk-YIOVBYZH.cjs → chunk-UZ7FJ66C.cjs} +7 -7
- package/dist/{chunk-LIVAK2DM.js → chunk-WKWHYFX4.js} +35 -35
- package/dist/{chunk-YWLUOY3D.cjs → chunk-XUGQSVZ4.cjs} +35 -35
- 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/tools.cjs +5 -5
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/workflows.cjs +12 -12
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +10 -10
- package/dist/server/handlers.js +5 -5
- package/package.json +8 -8
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkXUGQSVZ4_cjs = require('./chunk-XUGQSVZ4.cjs');
|
|
4
4
|
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
5
5
|
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
6
6
|
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
7
7
|
var web = require('stream/web');
|
|
8
|
-
var di = require('@mastra/core/di');
|
|
9
8
|
|
|
10
9
|
// src/server/handlers/workflows.ts
|
|
11
10
|
var workflows_exports = {};
|
|
@@ -33,16 +32,16 @@ async function getWorkflowsHandler({ mastra }) {
|
|
|
33
32
|
acc2[key2] = {
|
|
34
33
|
id: step.id,
|
|
35
34
|
description: step.description,
|
|
36
|
-
inputSchema: step.inputSchema ?
|
|
37
|
-
outputSchema: step.outputSchema ?
|
|
38
|
-
resumeSchema: step.resumeSchema ?
|
|
39
|
-
suspendSchema: step.suspendSchema ?
|
|
35
|
+
inputSchema: step.inputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(step.inputSchema)) : void 0,
|
|
36
|
+
outputSchema: step.outputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(step.outputSchema)) : void 0,
|
|
37
|
+
resumeSchema: step.resumeSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(step.resumeSchema)) : void 0,
|
|
38
|
+
suspendSchema: step.suspendSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(step.suspendSchema)) : void 0
|
|
40
39
|
};
|
|
41
40
|
return acc2;
|
|
42
41
|
}, {}),
|
|
43
42
|
stepGraph: workflow.serializedStepGraph,
|
|
44
|
-
inputSchema: workflow.inputSchema ?
|
|
45
|
-
outputSchema: workflow.outputSchema ?
|
|
43
|
+
inputSchema: workflow.inputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(workflow.inputSchema)) : void 0,
|
|
44
|
+
outputSchema: workflow.outputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(workflow.outputSchema)) : void 0
|
|
46
45
|
};
|
|
47
46
|
return acc;
|
|
48
47
|
}, {});
|
|
@@ -65,18 +64,18 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
65
64
|
acc[key] = {
|
|
66
65
|
id: step.id,
|
|
67
66
|
description: step.description,
|
|
68
|
-
inputSchema: step.inputSchema ?
|
|
69
|
-
outputSchema: step.outputSchema ?
|
|
70
|
-
resumeSchema: step.resumeSchema ?
|
|
71
|
-
suspendSchema: step.suspendSchema ?
|
|
67
|
+
inputSchema: step.inputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(step.inputSchema)) : void 0,
|
|
68
|
+
outputSchema: step.outputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(step.outputSchema)) : void 0,
|
|
69
|
+
resumeSchema: step.resumeSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(step.resumeSchema)) : void 0,
|
|
70
|
+
suspendSchema: step.suspendSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(step.suspendSchema)) : void 0
|
|
72
71
|
};
|
|
73
72
|
return acc;
|
|
74
73
|
}, {}),
|
|
75
74
|
name: workflow.name,
|
|
76
75
|
description: workflow.description,
|
|
77
76
|
stepGraph: workflow.serializedStepGraph,
|
|
78
|
-
inputSchema: workflow.inputSchema ?
|
|
79
|
-
outputSchema: workflow.outputSchema ?
|
|
77
|
+
inputSchema: workflow.inputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(workflow.inputSchema)) : void 0,
|
|
78
|
+
outputSchema: workflow.outputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(workflow.outputSchema)) : void 0
|
|
80
79
|
};
|
|
81
80
|
} catch (error) {
|
|
82
81
|
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
@@ -131,8 +130,7 @@ async function startAsyncWorkflowHandler({
|
|
|
131
130
|
runtimeContext,
|
|
132
131
|
workflowId,
|
|
133
132
|
runId,
|
|
134
|
-
inputData
|
|
135
|
-
runtimeContextFromRequest
|
|
133
|
+
inputData
|
|
136
134
|
}) {
|
|
137
135
|
try {
|
|
138
136
|
if (!workflowId) {
|
|
@@ -142,14 +140,10 @@ async function startAsyncWorkflowHandler({
|
|
|
142
140
|
if (!workflow) {
|
|
143
141
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
144
142
|
}
|
|
145
|
-
const finalRuntimeContext = new di.RuntimeContext([
|
|
146
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
147
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
148
|
-
]);
|
|
149
143
|
const _run = workflow.createRun({ runId });
|
|
150
144
|
const result = await _run.start({
|
|
151
145
|
inputData,
|
|
152
|
-
runtimeContext
|
|
146
|
+
runtimeContext
|
|
153
147
|
});
|
|
154
148
|
return result;
|
|
155
149
|
} catch (error) {
|
|
@@ -161,8 +155,7 @@ async function startWorkflowRunHandler({
|
|
|
161
155
|
runtimeContext,
|
|
162
156
|
workflowId,
|
|
163
157
|
runId,
|
|
164
|
-
inputData
|
|
165
|
-
runtimeContextFromRequest
|
|
158
|
+
inputData
|
|
166
159
|
}) {
|
|
167
160
|
try {
|
|
168
161
|
if (!workflowId) {
|
|
@@ -176,14 +169,10 @@ async function startWorkflowRunHandler({
|
|
|
176
169
|
if (!run) {
|
|
177
170
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
178
171
|
}
|
|
179
|
-
const finalRuntimeContext = new di.RuntimeContext([
|
|
180
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
181
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
182
|
-
]);
|
|
183
172
|
const _run = workflow.createRun({ runId });
|
|
184
173
|
void _run.start({
|
|
185
174
|
inputData,
|
|
186
|
-
runtimeContext
|
|
175
|
+
runtimeContext
|
|
187
176
|
});
|
|
188
177
|
return { message: "Workflow run started" };
|
|
189
178
|
} catch (e) {
|
|
@@ -241,8 +230,7 @@ function streamWorkflowHandler({
|
|
|
241
230
|
runtimeContext,
|
|
242
231
|
workflowId,
|
|
243
232
|
runId,
|
|
244
|
-
inputData
|
|
245
|
-
runtimeContextFromRequest
|
|
233
|
+
inputData
|
|
246
234
|
}) {
|
|
247
235
|
try {
|
|
248
236
|
if (!workflowId) {
|
|
@@ -255,14 +243,10 @@ function streamWorkflowHandler({
|
|
|
255
243
|
if (!workflow) {
|
|
256
244
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
257
245
|
}
|
|
258
|
-
const finalRuntimeContext = new di.RuntimeContext([
|
|
259
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
260
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
261
|
-
]);
|
|
262
246
|
const run = workflow.createRun({ runId });
|
|
263
247
|
const result = run.stream({
|
|
264
248
|
inputData,
|
|
265
|
-
runtimeContext
|
|
249
|
+
runtimeContext
|
|
266
250
|
});
|
|
267
251
|
return result;
|
|
268
252
|
} catch (error) {
|
|
@@ -274,8 +258,7 @@ async function resumeAsyncWorkflowHandler({
|
|
|
274
258
|
workflowId,
|
|
275
259
|
runId,
|
|
276
260
|
body,
|
|
277
|
-
runtimeContext
|
|
278
|
-
runtimeContextFromRequest
|
|
261
|
+
runtimeContext
|
|
279
262
|
}) {
|
|
280
263
|
try {
|
|
281
264
|
if (!workflowId) {
|
|
@@ -292,15 +275,11 @@ async function resumeAsyncWorkflowHandler({
|
|
|
292
275
|
if (!run) {
|
|
293
276
|
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
294
277
|
}
|
|
295
|
-
const finalRuntimeContext = new di.RuntimeContext([
|
|
296
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
297
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
298
|
-
]);
|
|
299
278
|
const _run = workflow.createRun({ runId });
|
|
300
279
|
const result = await _run.resume({
|
|
301
280
|
step: body.step,
|
|
302
281
|
resumeData: body.resumeData,
|
|
303
|
-
runtimeContext
|
|
282
|
+
runtimeContext
|
|
304
283
|
});
|
|
305
284
|
return result;
|
|
306
285
|
} catch (error) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkXUGQSVZ4_cjs = require('./chunk-XUGQSVZ4.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');
|
|
@@ -29,8 +29,8 @@ async function getAgentsHandler({ mastra, runtimeContext }) {
|
|
|
29
29
|
const _tool = tool;
|
|
30
30
|
acc[key] = {
|
|
31
31
|
..._tool,
|
|
32
|
-
inputSchema: _tool.inputSchema ?
|
|
33
|
-
outputSchema: _tool.outputSchema ?
|
|
32
|
+
inputSchema: _tool.inputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(_tool.inputSchema)) : void 0,
|
|
33
|
+
outputSchema: _tool.outputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(_tool.outputSchema)) : void 0
|
|
34
34
|
};
|
|
35
35
|
return acc;
|
|
36
36
|
}, {});
|
|
@@ -76,7 +76,8 @@ async function getAgentsHandler({ mastra, runtimeContext }) {
|
|
|
76
76
|
async function getAgentByIdHandler({
|
|
77
77
|
mastra,
|
|
78
78
|
runtimeContext,
|
|
79
|
-
agentId
|
|
79
|
+
agentId,
|
|
80
|
+
isPlayground = false
|
|
80
81
|
}) {
|
|
81
82
|
try {
|
|
82
83
|
const agent = mastra.getAgent(agentId);
|
|
@@ -88,8 +89,8 @@ async function getAgentByIdHandler({
|
|
|
88
89
|
const _tool = tool;
|
|
89
90
|
acc[key] = {
|
|
90
91
|
..._tool,
|
|
91
|
-
inputSchema: _tool.inputSchema ?
|
|
92
|
-
outputSchema: _tool.outputSchema ?
|
|
92
|
+
inputSchema: _tool.inputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(_tool.inputSchema)) : void 0,
|
|
93
|
+
outputSchema: _tool.outputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(_tool.outputSchema)) : void 0
|
|
93
94
|
};
|
|
94
95
|
return acc;
|
|
95
96
|
}, {});
|
|
@@ -110,7 +111,21 @@ async function getAgentByIdHandler({
|
|
|
110
111
|
logger.error("Error getting workflows for agent", { agentName: agent.name, error });
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
|
-
|
|
114
|
+
let proxyRuntimeContext = runtimeContext;
|
|
115
|
+
if (isPlayground) {
|
|
116
|
+
proxyRuntimeContext = new Proxy(runtimeContext, {
|
|
117
|
+
get(target, prop) {
|
|
118
|
+
if (prop === "get") {
|
|
119
|
+
return function(key) {
|
|
120
|
+
const value = target.get(key);
|
|
121
|
+
return value ?? `<${key}>`;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
return Reflect.get(target, prop);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
const instructions = await agent.getInstructions({ runtimeContext: proxyRuntimeContext });
|
|
114
129
|
const llm = await agent.getLLM({ runtimeContext });
|
|
115
130
|
return {
|
|
116
131
|
name: agent.name,
|
|
@@ -11,11 +11,26 @@ __export(logs_exports, {
|
|
|
11
11
|
});
|
|
12
12
|
async function getLogsHandler({
|
|
13
13
|
mastra,
|
|
14
|
-
transportId
|
|
14
|
+
transportId,
|
|
15
|
+
params
|
|
15
16
|
}) {
|
|
16
17
|
try {
|
|
17
18
|
validateBody({ transportId });
|
|
18
|
-
const
|
|
19
|
+
const { fromDate, toDate, logLevel, filters: _filters, page, perPage } = params || {};
|
|
20
|
+
const filters = _filters ? Object.fromEntries(
|
|
21
|
+
(Array.isArray(_filters) ? _filters : [_filters]).map((attr) => {
|
|
22
|
+
const [key, value] = attr.split(":");
|
|
23
|
+
return [key, value];
|
|
24
|
+
})
|
|
25
|
+
) : void 0;
|
|
26
|
+
const logs = await mastra.getLogs(transportId, {
|
|
27
|
+
fromDate,
|
|
28
|
+
toDate,
|
|
29
|
+
logLevel,
|
|
30
|
+
filters,
|
|
31
|
+
page: page ? Number(page) : void 0,
|
|
32
|
+
perPage: perPage ? Number(perPage) : void 0
|
|
33
|
+
});
|
|
19
34
|
return logs;
|
|
20
35
|
} catch (error) {
|
|
21
36
|
return handleError(error, "Error getting logs");
|
|
@@ -24,11 +39,28 @@ async function getLogsHandler({
|
|
|
24
39
|
async function getLogsByRunIdHandler({
|
|
25
40
|
mastra,
|
|
26
41
|
runId,
|
|
27
|
-
transportId
|
|
42
|
+
transportId,
|
|
43
|
+
params
|
|
28
44
|
}) {
|
|
29
45
|
try {
|
|
30
46
|
validateBody({ runId, transportId });
|
|
31
|
-
const
|
|
47
|
+
const { fromDate, toDate, logLevel, filters: _filters, page, perPage } = params || {};
|
|
48
|
+
const filters = _filters ? Object.fromEntries(
|
|
49
|
+
(Array.isArray(_filters) ? _filters : [_filters]).map((attr) => {
|
|
50
|
+
const [key, value] = attr.split(":");
|
|
51
|
+
return [key, value];
|
|
52
|
+
})
|
|
53
|
+
) : void 0;
|
|
54
|
+
const logs = await mastra.getLogsByRunId({
|
|
55
|
+
runId,
|
|
56
|
+
transportId,
|
|
57
|
+
fromDate,
|
|
58
|
+
toDate,
|
|
59
|
+
logLevel,
|
|
60
|
+
filters,
|
|
61
|
+
page: page ? Number(page) : void 0,
|
|
62
|
+
perPage: perPage ? Number(perPage) : void 0
|
|
63
|
+
});
|
|
32
64
|
return logs;
|
|
33
65
|
} catch (error) {
|
|
34
66
|
return handleError(error, "Error getting logs by run ID");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { stringify, esm_default } from './chunk-
|
|
1
|
+
import { stringify, esm_default } from './chunk-WKWHYFX4.js';
|
|
2
2
|
import { handleError } from './chunk-M5ABIP7D.js';
|
|
3
3
|
import { HTTPException } from './chunk-NYN7KFXL.js';
|
|
4
4
|
import { __export } from './chunk-MLKGABMK.js';
|
|
5
|
-
import { ReadableStream } from '
|
|
5
|
+
import { ReadableStream } from 'stream/web';
|
|
6
6
|
|
|
7
7
|
// src/server/handlers/legacyWorkflows.ts
|
|
8
8
|
var legacyWorkflows_exports = {};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkXUGQSVZ4_cjs = require('./chunk-XUGQSVZ4.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 ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(tool.inputSchema)) : void 0,
|
|
29
|
+
outputSchema: tool.outputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_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 ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(tool.inputSchema)) : void 0,
|
|
49
|
+
outputSchema: tool.outputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_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,8 +94,7 @@ 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;
|
|
@@ -116,13 +109,9 @@ async function executeAgentToolHandler({
|
|
|
116
109
|
if (!tool?.execute) {
|
|
117
110
|
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Tool is not executable" });
|
|
118
111
|
}
|
|
119
|
-
const finalRuntimeContext = new di.RuntimeContext([
|
|
120
|
-
...Array.from(runtimeContext.entries()),
|
|
121
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
122
|
-
]);
|
|
123
112
|
const result = await tool.execute({
|
|
124
113
|
context: data,
|
|
125
|
-
runtimeContext
|
|
114
|
+
runtimeContext,
|
|
126
115
|
mastra,
|
|
127
116
|
runId: agentId
|
|
128
117
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkXUGQSVZ4_cjs = require('./chunk-XUGQSVZ4.cjs');
|
|
4
4
|
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
5
5
|
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
6
6
|
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
@@ -31,15 +31,15 @@ async function getLegacyWorkflowsHandler({ mastra }) {
|
|
|
31
31
|
serializedStepGraph: workflow.serializedStepGraph,
|
|
32
32
|
serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
|
|
33
33
|
name: workflow.name,
|
|
34
|
-
triggerSchema: workflow.triggerSchema ?
|
|
34
|
+
triggerSchema: workflow.triggerSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(workflow.triggerSchema)) : void 0,
|
|
35
35
|
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
36
36
|
const _step = step;
|
|
37
37
|
acc2[key2] = {
|
|
38
38
|
id: _step.id,
|
|
39
39
|
description: _step.description,
|
|
40
40
|
workflowId: _step.workflowId,
|
|
41
|
-
inputSchema: _step.inputSchema ?
|
|
42
|
-
outputSchema: _step.outputSchema ?
|
|
41
|
+
inputSchema: _step.inputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(_step.inputSchema)) : void 0,
|
|
42
|
+
outputSchema: _step.outputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(_step.outputSchema)) : void 0
|
|
43
43
|
};
|
|
44
44
|
return acc2;
|
|
45
45
|
}, {})
|
|
@@ -66,15 +66,15 @@ async function getLegacyWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
66
66
|
serializedStepGraph: workflow.serializedStepGraph,
|
|
67
67
|
serializedStepSubscriberGraph: workflow.serializedStepSubscriberGraph,
|
|
68
68
|
name: workflow.name,
|
|
69
|
-
triggerSchema: workflow.triggerSchema ?
|
|
69
|
+
triggerSchema: workflow.triggerSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(workflow.triggerSchema)) : void 0,
|
|
70
70
|
steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
|
|
71
71
|
const _step = step;
|
|
72
72
|
acc[key] = {
|
|
73
73
|
id: _step.id,
|
|
74
74
|
description: _step.description,
|
|
75
75
|
workflowId: _step.workflowId,
|
|
76
|
-
inputSchema: _step.inputSchema ?
|
|
77
|
-
outputSchema: _step.outputSchema ?
|
|
76
|
+
inputSchema: _step.inputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(_step.inputSchema)) : void 0,
|
|
77
|
+
outputSchema: _step.outputSchema ? chunkXUGQSVZ4_cjs.stringify(chunkXUGQSVZ4_cjs.esm_default(_step.outputSchema)) : void 0
|
|
78
78
|
};
|
|
79
79
|
return acc;
|
|
80
80
|
}, {})
|