@mastra/server 0.0.0-cli-debug-2-20250611100354 → 0.0.0-cloud-deployer-for-core-0.19.1-20251001164939
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/CHANGELOG.md +3867 -0
- package/LICENSE.md +11 -42
- package/README.md +0 -5
- package/dist/{chunk-H5PTF3Y4.js → chunk-4QCXUEAT.js} +11 -2
- package/dist/chunk-4QCXUEAT.js.map +1 -0
- package/dist/chunk-4RRMWXQ2.js +3522 -0
- package/dist/chunk-4RRMWXQ2.js.map +1 -0
- package/dist/chunk-4VJG7FZK.cjs +18023 -0
- package/dist/chunk-4VJG7FZK.cjs.map +1 -0
- package/dist/chunk-52UP7DFT.cjs +130 -0
- package/dist/chunk-52UP7DFT.cjs.map +1 -0
- package/dist/chunk-6GMFZ5LK.js +2774 -0
- package/dist/chunk-6GMFZ5LK.js.map +1 -0
- package/dist/{chunk-GHC4YV6R.js → chunk-6IJWRJZE.js} +109 -136
- package/dist/chunk-6IJWRJZE.js.map +1 -0
- package/dist/{chunk-OCWPVYNI.cjs → chunk-7NADHFD2.cjs} +3 -0
- package/dist/chunk-7NADHFD2.cjs.map +1 -0
- package/dist/{chunk-QLG2PFHE.js → chunk-A3AL7EWJ.js} +5 -3
- package/dist/chunk-A3AL7EWJ.js.map +1 -0
- package/dist/chunk-BKCWZLEL.cjs +197 -0
- package/dist/chunk-BKCWZLEL.cjs.map +1 -0
- package/dist/chunk-BX5XPVO2.cjs +676 -0
- package/dist/chunk-BX5XPVO2.cjs.map +1 -0
- package/dist/chunk-CY4TP3FK.js +16 -0
- package/dist/chunk-CY4TP3FK.js.map +1 -0
- package/dist/chunk-EMMSS5I5.cjs +37 -0
- package/dist/chunk-EMMSS5I5.cjs.map +1 -0
- package/dist/chunk-FALVL2VV.cjs +3525 -0
- package/dist/chunk-FALVL2VV.cjs.map +1 -0
- package/dist/chunk-G3PMV62Z.js +33 -0
- package/dist/chunk-G3PMV62Z.js.map +1 -0
- package/dist/chunk-G4PUALCE.cjs +28 -0
- package/dist/chunk-G4PUALCE.cjs.map +1 -0
- package/dist/chunk-GU4EWMZB.cjs +769 -0
- package/dist/chunk-GU4EWMZB.cjs.map +1 -0
- package/dist/chunk-HCFCPUTA.cjs +601 -0
- package/dist/chunk-HCFCPUTA.cjs.map +1 -0
- package/dist/chunk-HFEPCQAR.js +655 -0
- package/dist/chunk-HFEPCQAR.js.map +1 -0
- package/dist/{chunk-XUGQSVZ4.cjs → chunk-HVBBFCDH.cjs} +1110 -793
- package/dist/chunk-HVBBFCDH.cjs.map +1 -0
- package/dist/chunk-JLPZWKPR.js +582 -0
- package/dist/chunk-JLPZWKPR.js.map +1 -0
- package/dist/{chunk-CP55EVBK.js → chunk-JRDEOHAJ.js} +30 -16
- package/dist/chunk-JRDEOHAJ.js.map +1 -0
- package/dist/{chunk-HYP7B2TL.js → chunk-KM7EJKXV.js} +50 -12
- package/dist/chunk-KM7EJKXV.js.map +1 -0
- package/dist/{chunk-UZ7FJ66C.cjs → chunk-KNGXRN26.cjs} +48 -45
- package/dist/chunk-KNGXRN26.cjs.map +1 -0
- package/dist/{chunk-BFOA2QQY.js → chunk-KV6VHX4V.js} +24 -5
- package/dist/chunk-KV6VHX4V.js.map +1 -0
- package/dist/chunk-LF2ZLOFP.js +767 -0
- package/dist/chunk-LF2ZLOFP.js.map +1 -0
- package/dist/chunk-LJFAAEU7.cjs +167 -0
- package/dist/chunk-LJFAAEU7.cjs.map +1 -0
- package/dist/{chunk-NYN7KFXL.js → chunk-MMROOK5J.js} +3 -0
- package/dist/chunk-MMROOK5J.js.map +1 -0
- package/dist/{chunk-WKWHYFX4.js → chunk-N7F33WAD.js} +1083 -794
- package/dist/chunk-N7F33WAD.js.map +1 -0
- package/dist/chunk-NG5IVLEZ.js +1012 -0
- package/dist/chunk-NG5IVLEZ.js.map +1 -0
- package/dist/chunk-NLWACBE7.cjs +128 -0
- package/dist/chunk-NLWACBE7.cjs.map +1 -0
- package/dist/{chunk-SDPGVWQJ.cjs → chunk-OPI3FZYH.cjs} +110 -137
- package/dist/chunk-OPI3FZYH.cjs.map +1 -0
- package/dist/chunk-OZLRIVC4.cjs +588 -0
- package/dist/chunk-OZLRIVC4.cjs.map +1 -0
- package/dist/chunk-PPYGWINI.cjs +2777 -0
- package/dist/chunk-PPYGWINI.cjs.map +1 -0
- package/dist/{chunk-B4MQFJ7G.cjs → chunk-PWTXZZTR.cjs} +28 -8
- package/dist/chunk-PWTXZZTR.cjs.map +1 -0
- package/dist/chunk-RE4RPXT2.cjs +18 -0
- package/dist/chunk-RE4RPXT2.cjs.map +1 -0
- package/dist/chunk-SIGXR3JT.cjs +1043 -0
- package/dist/chunk-SIGXR3JT.cjs.map +1 -0
- package/dist/{chunk-IMBY5XUG.cjs → chunk-SPLSYTYW.cjs} +11 -9
- package/dist/chunk-SPLSYTYW.cjs.map +1 -0
- package/dist/chunk-SQY4T6EJ.js +571 -0
- package/dist/chunk-SQY4T6EJ.js.map +1 -0
- package/dist/{chunk-BNEY4P4P.cjs → chunk-T3TIA3O6.cjs} +20 -18
- package/dist/chunk-T3TIA3O6.cjs.map +1 -0
- package/dist/{chunk-TEZOEGR4.js → chunk-TTHEEIZ3.js} +18 -15
- package/dist/chunk-TTHEEIZ3.js.map +1 -0
- package/dist/chunk-VY4ENABS.cjs +135 -0
- package/dist/chunk-VY4ENABS.cjs.map +1 -0
- package/dist/{chunk-55DOQLP6.js → chunk-WHN4VX55.js} +5 -3
- package/dist/chunk-WHN4VX55.js.map +1 -0
- package/dist/chunk-WUJLVNLU.js +124 -0
- package/dist/chunk-WUJLVNLU.js.map +1 -0
- package/dist/chunk-XJOYGRTN.js +189 -0
- package/dist/chunk-XJOYGRTN.js.map +1 -0
- package/dist/chunk-YGQ5F6E6.js +17987 -0
- package/dist/chunk-YGQ5F6E6.js.map +1 -0
- package/dist/chunk-YWOK4F5A.js +131 -0
- package/dist/chunk-YWOK4F5A.js.map +1 -0
- package/dist/dist-26HWEQY6.js +3 -0
- package/dist/dist-26HWEQY6.js.map +1 -0
- package/dist/dist-3DRD6USP.cjs +1411 -0
- package/dist/dist-3DRD6USP.cjs.map +1 -0
- package/dist/dist-7GVM5ZCS.js +845 -0
- package/dist/dist-7GVM5ZCS.js.map +1 -0
- package/dist/dist-CCDXEZDR.js +1408 -0
- package/dist/dist-CCDXEZDR.js.map +1 -0
- package/dist/dist-COC6WFAX.js +761 -0
- package/dist/dist-COC6WFAX.js.map +1 -0
- package/dist/dist-EZZMMMNT.cjs +16 -0
- package/dist/dist-EZZMMMNT.cjs.map +1 -0
- package/dist/dist-H64VX6DE.js +3 -0
- package/dist/dist-H64VX6DE.js.map +1 -0
- package/dist/dist-H7RR3EXL.js +2006 -0
- package/dist/dist-H7RR3EXL.js.map +1 -0
- package/dist/dist-JNIWWFE5.js +1147 -0
- package/dist/dist-JNIWWFE5.js.map +1 -0
- package/dist/dist-L76NFIWM.cjs +934 -0
- package/dist/dist-L76NFIWM.cjs.map +1 -0
- package/dist/dist-LKU3RRT2.js +937 -0
- package/dist/dist-LKU3RRT2.js.map +1 -0
- package/dist/dist-MQUZENT7.js +931 -0
- package/dist/dist-MQUZENT7.js.map +1 -0
- package/dist/dist-N6P7NYGX.cjs +928 -0
- package/dist/dist-N6P7NYGX.cjs.map +1 -0
- package/dist/dist-OC4J73ML.cjs +940 -0
- package/dist/dist-OC4J73ML.cjs.map +1 -0
- package/dist/dist-QI7RYOYQ.cjs +764 -0
- package/dist/dist-QI7RYOYQ.cjs.map +1 -0
- package/dist/dist-R3L5J3LL.cjs +1150 -0
- package/dist/dist-R3L5J3LL.cjs.map +1 -0
- package/dist/dist-S3ILRJUH.cjs +2013 -0
- package/dist/dist-S3ILRJUH.cjs.map +1 -0
- package/dist/dist-WKYB3LTJ.cjs +16 -0
- package/dist/dist-WKYB3LTJ.cjs.map +1 -0
- package/dist/dist-WY4WSW7C.cjs +849 -0
- package/dist/dist-WY4WSW7C.cjs.map +1 -0
- package/dist/dist-ZHCN47XA.js +925 -0
- package/dist/dist-ZHCN47XA.js.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/server/a2a/protocol.d.ts +8 -0
- package/dist/server/a2a/protocol.d.ts.map +1 -0
- package/dist/server/a2a/store.cjs +25 -0
- package/dist/server/a2a/store.cjs.map +1 -0
- package/dist/server/a2a/store.d.ts +14 -0
- package/dist/server/a2a/store.d.ts.map +1 -0
- package/dist/server/a2a/store.js +23 -0
- package/dist/server/a2a/store.js.map +1 -0
- package/dist/server/a2a/tasks.d.ts +20 -0
- package/dist/server/a2a/tasks.d.ts.map +1 -0
- package/dist/server/handlers/a2a.cjs +13 -11
- package/dist/server/handlers/a2a.cjs.map +1 -0
- package/dist/server/handlers/a2a.d.ts +68 -6
- package/dist/server/handlers/a2a.d.ts.map +1 -0
- package/dist/server/handlers/a2a.js +3 -1
- package/dist/server/handlers/a2a.js.map +1 -0
- package/dist/server/handlers/agent-builder.cjs +68 -0
- package/dist/server/handlers/agent-builder.cjs.map +1 -0
- package/dist/server/handlers/agent-builder.d.ts +94 -0
- package/dist/server/handlers/agent-builder.d.ts.map +1 -0
- package/dist/server/handlers/agent-builder.js +3 -0
- package/dist/server/handlers/agent-builder.js.map +1 -0
- package/dist/server/handlers/agents.cjs +61 -7
- package/dist/server/handlers/agents.cjs.map +1 -0
- package/dist/server/handlers/agents.d.ts +216 -6
- package/dist/server/handlers/agents.d.ts.map +1 -0
- package/dist/server/handlers/agents.js +3 -1
- package/dist/server/handlers/agents.js.map +1 -0
- package/dist/server/handlers/error.cjs +4 -2
- package/dist/server/handlers/error.cjs.map +1 -0
- package/dist/server/handlers/error.d.ts +2 -1
- package/dist/server/handlers/error.d.ts.map +1 -0
- package/dist/server/handlers/error.js +3 -1
- package/dist/server/handlers/error.js.map +1 -0
- package/dist/server/handlers/legacyWorkflows.cjs +13 -11
- package/dist/server/handlers/legacyWorkflows.cjs.map +1 -0
- package/dist/server/handlers/legacyWorkflows.d.ts +59 -10
- package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -0
- package/dist/server/handlers/legacyWorkflows.js +3 -1
- package/dist/server/handlers/legacyWorkflows.js.map +1 -0
- package/dist/server/handlers/logs.cjs +6 -4
- package/dist/server/handlers/logs.cjs.map +1 -0
- package/dist/server/handlers/logs.d.ts +34 -3
- package/dist/server/handlers/logs.d.ts.map +1 -0
- package/dist/server/handlers/logs.js +3 -1
- package/dist/server/handlers/logs.js.map +1 -0
- package/dist/server/handlers/memory.cjs +39 -9
- package/dist/server/handlers/memory.cjs.map +1 -0
- package/dist/server/handlers/memory.d.ts +118 -8
- package/dist/server/handlers/memory.d.ts.map +1 -0
- package/dist/server/handlers/memory.js +3 -1
- package/dist/server/handlers/memory.js.map +1 -0
- package/dist/server/handlers/observability.cjs +24 -0
- package/dist/server/handlers/observability.cjs.map +1 -0
- package/dist/server/handlers/observability.d.ts +49 -0
- package/dist/server/handlers/observability.d.ts.map +1 -0
- package/dist/server/handlers/observability.js +3 -0
- package/dist/server/handlers/observability.js.map +1 -0
- package/dist/server/handlers/scores.cjs +32 -0
- package/dist/server/handlers/scores.cjs.map +1 -0
- package/dist/server/handlers/scores.d.ts +251 -0
- package/dist/server/handlers/scores.d.ts.map +1 -0
- package/dist/server/handlers/scores.js +3 -0
- package/dist/server/handlers/scores.js.map +1 -0
- package/dist/server/handlers/telemetry.cjs +9 -3
- package/dist/server/handlers/telemetry.cjs.map +1 -0
- package/dist/server/handlers/telemetry.d.ts +33 -2
- package/dist/server/handlers/telemetry.d.ts.map +1 -0
- package/dist/server/handlers/telemetry.js +3 -1
- package/dist/server/handlers/telemetry.js.map +1 -0
- package/dist/server/handlers/tools.cjs +11 -5
- package/dist/server/handlers/tools.cjs.map +1 -0
- package/dist/server/handlers/tools.d.ts +25 -4
- package/dist/server/handlers/tools.d.ts.map +1 -0
- package/dist/server/handlers/tools.js +3 -1
- package/dist/server/handlers/tools.js.map +1 -0
- package/dist/server/handlers/utils.cjs +8 -2
- package/dist/server/handlers/utils.cjs.map +1 -0
- package/dist/server/handlers/utils.d.ts +8 -1
- package/dist/server/handlers/utils.d.ts.map +1 -0
- package/dist/server/handlers/utils.js +3 -1
- package/dist/server/handlers/utils.js.map +1 -0
- package/dist/server/handlers/vNextNetwork.cjs +220 -0
- package/dist/server/handlers/vNextNetwork.cjs.map +1 -0
- package/dist/server/handlers/vNextNetwork.d.ts +246 -0
- package/dist/server/handlers/vNextNetwork.d.ts.map +1 -0
- package/dist/server/handlers/vNextNetwork.js +213 -0
- package/dist/server/handlers/vNextNetwork.js.map +1 -0
- package/dist/server/handlers/vector.cjs +9 -7
- package/dist/server/handlers/vector.cjs.map +1 -0
- package/dist/server/handlers/vector.d.ts +51 -6
- package/dist/server/handlers/vector.d.ts.map +1 -0
- package/dist/server/handlers/vector.js +3 -1
- package/dist/server/handlers/vector.js.map +1 -0
- package/dist/server/handlers/voice.cjs +7 -5
- package/dist/server/handlers/voice.cjs.map +1 -0
- package/dist/server/handlers/voice.d.ts +41 -4
- package/dist/server/handlers/voice.d.ts.map +1 -0
- package/dist/server/handlers/voice.js +3 -1
- package/dist/server/handlers/voice.js.map +1 -0
- package/dist/server/handlers/workflows.cjs +38 -12
- package/dist/server/handlers/workflows.cjs.map +1 -0
- package/dist/server/handlers/workflows.d.ts +90 -11
- package/dist/server/handlers/workflows.d.ts.map +1 -0
- package/dist/server/handlers/workflows.js +3 -1
- package/dist/server/handlers/workflows.js.map +1 -0
- package/dist/server/handlers.cjs +44 -32
- package/dist/server/handlers.cjs.map +1 -0
- package/dist/server/handlers.d.ts +14 -11
- package/dist/server/handlers.d.ts.map +1 -0
- package/dist/server/handlers.js +15 -11
- package/dist/server/handlers.js.map +1 -0
- package/dist/server/http-exception.d.ts +87 -0
- package/dist/server/http-exception.d.ts.map +1 -0
- package/dist/server/types.d.ts +10 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/utils.d.ts +44 -0
- package/dist/server/utils.d.ts.map +1 -0
- package/package.json +41 -19
- package/dist/_tsup-dts-rollup.d.cts +0 -860
- package/dist/_tsup-dts-rollup.d.ts +0 -860
- package/dist/chunk-57CJTIPW.cjs +0 -18
- package/dist/chunk-64U3UDTH.cjs +0 -13
- package/dist/chunk-6F2H7Y45.js +0 -255
- package/dist/chunk-6TJSHFCJ.cjs +0 -221
- package/dist/chunk-75ZPJI57.cjs +0 -9
- package/dist/chunk-7IBZ4L35.js +0 -344
- package/dist/chunk-C7564HUT.js +0 -142
- package/dist/chunk-CMMOIUFC.cjs +0 -114
- package/dist/chunk-I7KJZNX5.js +0 -211
- package/dist/chunk-JEWNMAYQ.cjs +0 -263
- package/dist/chunk-JKF6PRPU.cjs +0 -357
- package/dist/chunk-M5ABIP7D.js +0 -11
- package/dist/chunk-MLKGABMK.js +0 -7
- package/dist/chunk-TJO277H7.cjs +0 -128
- package/dist/chunk-VPNDC2DI.cjs +0 -148
- package/dist/index.d.cts +0 -1
- package/dist/server/handlers/a2a.d.cts +0 -6
- package/dist/server/handlers/agents.d.cts +0 -6
- package/dist/server/handlers/error.d.cts +0 -1
- package/dist/server/handlers/legacyWorkflows.d.cts +0 -10
- package/dist/server/handlers/logs.d.cts +0 -3
- package/dist/server/handlers/memory.d.cts +0 -8
- package/dist/server/handlers/network.cjs +0 -22
- package/dist/server/handlers/network.d.cts +0 -4
- package/dist/server/handlers/network.d.ts +0 -4
- package/dist/server/handlers/network.js +0 -1
- package/dist/server/handlers/telemetry.d.cts +0 -2
- package/dist/server/handlers/tools.d.cts +0 -4
- package/dist/server/handlers/utils.d.cts +0 -1
- package/dist/server/handlers/vector.d.cts +0 -6
- package/dist/server/handlers/voice.d.cts +0 -4
- package/dist/server/handlers/workflows.d.cts +0 -11
- package/dist/server/handlers.d.cts +0 -11
package/dist/chunk-JKF6PRPU.cjs
DELETED
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkXUGQSVZ4_cjs = require('./chunk-XUGQSVZ4.cjs');
|
|
4
|
-
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
5
|
-
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
6
|
-
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
7
|
-
var web = require('stream/web');
|
|
8
|
-
|
|
9
|
-
// src/server/handlers/workflows.ts
|
|
10
|
-
var workflows_exports = {};
|
|
11
|
-
chunk75ZPJI57_cjs.__export(workflows_exports, {
|
|
12
|
-
createWorkflowRunHandler: () => createWorkflowRunHandler,
|
|
13
|
-
getWorkflowByIdHandler: () => getWorkflowByIdHandler,
|
|
14
|
-
getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
|
|
15
|
-
getWorkflowRunsHandler: () => getWorkflowRunsHandler,
|
|
16
|
-
getWorkflowsHandler: () => getWorkflowsHandler,
|
|
17
|
-
resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
|
|
18
|
-
resumeWorkflowHandler: () => resumeWorkflowHandler,
|
|
19
|
-
startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
|
|
20
|
-
startWorkflowRunHandler: () => startWorkflowRunHandler,
|
|
21
|
-
streamWorkflowHandler: () => streamWorkflowHandler,
|
|
22
|
-
watchWorkflowHandler: () => watchWorkflowHandler
|
|
23
|
-
});
|
|
24
|
-
async function getWorkflowsHandler({ mastra }) {
|
|
25
|
-
try {
|
|
26
|
-
const workflows = mastra.getWorkflows({ serialized: false });
|
|
27
|
-
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
28
|
-
acc[key] = {
|
|
29
|
-
name: workflow.name,
|
|
30
|
-
description: workflow.description,
|
|
31
|
-
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
32
|
-
acc2[key2] = {
|
|
33
|
-
id: step.id,
|
|
34
|
-
description: step.description,
|
|
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
|
|
39
|
-
};
|
|
40
|
-
return acc2;
|
|
41
|
-
}, {}),
|
|
42
|
-
stepGraph: workflow.serializedStepGraph,
|
|
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
|
|
45
|
-
};
|
|
46
|
-
return acc;
|
|
47
|
-
}, {});
|
|
48
|
-
return _workflows;
|
|
49
|
-
} catch (error) {
|
|
50
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflows" });
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
54
|
-
try {
|
|
55
|
-
if (!workflowId) {
|
|
56
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
57
|
-
}
|
|
58
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
59
|
-
if (!workflow) {
|
|
60
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
|
|
64
|
-
acc[key] = {
|
|
65
|
-
id: step.id,
|
|
66
|
-
description: step.description,
|
|
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
|
|
71
|
-
};
|
|
72
|
-
return acc;
|
|
73
|
-
}, {}),
|
|
74
|
-
name: workflow.name,
|
|
75
|
-
description: workflow.description,
|
|
76
|
-
stepGraph: workflow.serializedStepGraph,
|
|
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
|
|
79
|
-
};
|
|
80
|
-
} catch (error) {
|
|
81
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
async function getWorkflowRunByIdHandler({
|
|
85
|
-
mastra,
|
|
86
|
-
workflowId,
|
|
87
|
-
runId
|
|
88
|
-
}) {
|
|
89
|
-
try {
|
|
90
|
-
if (!workflowId) {
|
|
91
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
92
|
-
}
|
|
93
|
-
if (!runId) {
|
|
94
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
|
|
95
|
-
}
|
|
96
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
97
|
-
if (!workflow) {
|
|
98
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
99
|
-
}
|
|
100
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
101
|
-
if (!run) {
|
|
102
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
103
|
-
}
|
|
104
|
-
return run;
|
|
105
|
-
} catch (error) {
|
|
106
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
async function createWorkflowRunHandler({
|
|
110
|
-
mastra,
|
|
111
|
-
workflowId,
|
|
112
|
-
runId: prevRunId
|
|
113
|
-
}) {
|
|
114
|
-
try {
|
|
115
|
-
if (!workflowId) {
|
|
116
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
117
|
-
}
|
|
118
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
119
|
-
if (!workflow) {
|
|
120
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
121
|
-
}
|
|
122
|
-
const run = workflow.createRun({ runId: prevRunId });
|
|
123
|
-
return { runId: run.runId };
|
|
124
|
-
} catch (error) {
|
|
125
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
async function startAsyncWorkflowHandler({
|
|
129
|
-
mastra,
|
|
130
|
-
runtimeContext,
|
|
131
|
-
workflowId,
|
|
132
|
-
runId,
|
|
133
|
-
inputData
|
|
134
|
-
}) {
|
|
135
|
-
try {
|
|
136
|
-
if (!workflowId) {
|
|
137
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
138
|
-
}
|
|
139
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
140
|
-
if (!workflow) {
|
|
141
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
142
|
-
}
|
|
143
|
-
const _run = workflow.createRun({ runId });
|
|
144
|
-
const result = await _run.start({
|
|
145
|
-
inputData,
|
|
146
|
-
runtimeContext
|
|
147
|
-
});
|
|
148
|
-
return result;
|
|
149
|
-
} catch (error) {
|
|
150
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error executing workflow" });
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
async function startWorkflowRunHandler({
|
|
154
|
-
mastra,
|
|
155
|
-
runtimeContext,
|
|
156
|
-
workflowId,
|
|
157
|
-
runId,
|
|
158
|
-
inputData
|
|
159
|
-
}) {
|
|
160
|
-
try {
|
|
161
|
-
if (!workflowId) {
|
|
162
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
163
|
-
}
|
|
164
|
-
if (!runId) {
|
|
165
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to start run" });
|
|
166
|
-
}
|
|
167
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
168
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
169
|
-
if (!run) {
|
|
170
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
171
|
-
}
|
|
172
|
-
const _run = workflow.createRun({ runId });
|
|
173
|
-
void _run.start({
|
|
174
|
-
inputData,
|
|
175
|
-
runtimeContext
|
|
176
|
-
});
|
|
177
|
-
return { message: "Workflow run started" };
|
|
178
|
-
} catch (e) {
|
|
179
|
-
return chunk64U3UDTH_cjs.handleError(e, "Error starting workflow run");
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
async function watchWorkflowHandler({
|
|
183
|
-
mastra,
|
|
184
|
-
workflowId,
|
|
185
|
-
runId
|
|
186
|
-
}) {
|
|
187
|
-
try {
|
|
188
|
-
if (!workflowId) {
|
|
189
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
190
|
-
}
|
|
191
|
-
if (!runId) {
|
|
192
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to watch workflow" });
|
|
193
|
-
}
|
|
194
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
195
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
196
|
-
if (!run) {
|
|
197
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
198
|
-
}
|
|
199
|
-
const _run = workflow.createRun({ runId });
|
|
200
|
-
let unwatch;
|
|
201
|
-
let asyncRef = null;
|
|
202
|
-
const stream = new web.ReadableStream({
|
|
203
|
-
start(controller) {
|
|
204
|
-
unwatch = _run.watch(({ type, payload, eventTimestamp }) => {
|
|
205
|
-
controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
|
|
206
|
-
if (asyncRef) {
|
|
207
|
-
clearImmediate(asyncRef);
|
|
208
|
-
asyncRef = null;
|
|
209
|
-
}
|
|
210
|
-
asyncRef = setImmediate(async () => {
|
|
211
|
-
const runDone = payload.workflowState.status !== "running";
|
|
212
|
-
if (runDone) {
|
|
213
|
-
controller.close();
|
|
214
|
-
unwatch?.();
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
},
|
|
219
|
-
cancel() {
|
|
220
|
-
unwatch?.();
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
return stream;
|
|
224
|
-
} catch (error) {
|
|
225
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error watching workflow");
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
function streamWorkflowHandler({
|
|
229
|
-
mastra,
|
|
230
|
-
runtimeContext,
|
|
231
|
-
workflowId,
|
|
232
|
-
runId,
|
|
233
|
-
inputData
|
|
234
|
-
}) {
|
|
235
|
-
try {
|
|
236
|
-
if (!workflowId) {
|
|
237
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
238
|
-
}
|
|
239
|
-
if (!runId) {
|
|
240
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
241
|
-
}
|
|
242
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
243
|
-
if (!workflow) {
|
|
244
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
245
|
-
}
|
|
246
|
-
const run = workflow.createRun({ runId });
|
|
247
|
-
const result = run.stream({
|
|
248
|
-
inputData,
|
|
249
|
-
runtimeContext
|
|
250
|
-
});
|
|
251
|
-
return result;
|
|
252
|
-
} catch (error) {
|
|
253
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error executing workflow");
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
async function resumeAsyncWorkflowHandler({
|
|
257
|
-
mastra,
|
|
258
|
-
workflowId,
|
|
259
|
-
runId,
|
|
260
|
-
body,
|
|
261
|
-
runtimeContext
|
|
262
|
-
}) {
|
|
263
|
-
try {
|
|
264
|
-
if (!workflowId) {
|
|
265
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
266
|
-
}
|
|
267
|
-
if (!runId) {
|
|
268
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
269
|
-
}
|
|
270
|
-
if (!body.step) {
|
|
271
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
272
|
-
}
|
|
273
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
274
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
275
|
-
if (!run) {
|
|
276
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
277
|
-
}
|
|
278
|
-
const _run = workflow.createRun({ runId });
|
|
279
|
-
const result = await _run.resume({
|
|
280
|
-
step: body.step,
|
|
281
|
-
resumeData: body.resumeData,
|
|
282
|
-
runtimeContext
|
|
283
|
-
});
|
|
284
|
-
return result;
|
|
285
|
-
} catch (error) {
|
|
286
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow step");
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
async function resumeWorkflowHandler({
|
|
290
|
-
mastra,
|
|
291
|
-
workflowId,
|
|
292
|
-
runId,
|
|
293
|
-
body,
|
|
294
|
-
runtimeContext
|
|
295
|
-
}) {
|
|
296
|
-
try {
|
|
297
|
-
if (!workflowId) {
|
|
298
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
299
|
-
}
|
|
300
|
-
if (!runId) {
|
|
301
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
302
|
-
}
|
|
303
|
-
if (!body.step) {
|
|
304
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
305
|
-
}
|
|
306
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
307
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
308
|
-
if (!run) {
|
|
309
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
310
|
-
}
|
|
311
|
-
const _run = workflow.createRun({ runId });
|
|
312
|
-
void _run.resume({
|
|
313
|
-
step: body.step,
|
|
314
|
-
resumeData: body.resumeData,
|
|
315
|
-
runtimeContext
|
|
316
|
-
});
|
|
317
|
-
return { message: "Workflow run resumed" };
|
|
318
|
-
} catch (error) {
|
|
319
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow");
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
async function getWorkflowRunsHandler({
|
|
323
|
-
mastra,
|
|
324
|
-
workflowId,
|
|
325
|
-
fromDate,
|
|
326
|
-
toDate,
|
|
327
|
-
limit,
|
|
328
|
-
offset,
|
|
329
|
-
resourceId
|
|
330
|
-
}) {
|
|
331
|
-
try {
|
|
332
|
-
if (!workflowId) {
|
|
333
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
334
|
-
}
|
|
335
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
336
|
-
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
337
|
-
runs: [],
|
|
338
|
-
total: 0
|
|
339
|
-
};
|
|
340
|
-
return workflowRuns;
|
|
341
|
-
} catch (error) {
|
|
342
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error getting workflow runs");
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
exports.createWorkflowRunHandler = createWorkflowRunHandler;
|
|
347
|
-
exports.getWorkflowByIdHandler = getWorkflowByIdHandler;
|
|
348
|
-
exports.getWorkflowRunByIdHandler = getWorkflowRunByIdHandler;
|
|
349
|
-
exports.getWorkflowRunsHandler = getWorkflowRunsHandler;
|
|
350
|
-
exports.getWorkflowsHandler = getWorkflowsHandler;
|
|
351
|
-
exports.resumeAsyncWorkflowHandler = resumeAsyncWorkflowHandler;
|
|
352
|
-
exports.resumeWorkflowHandler = resumeWorkflowHandler;
|
|
353
|
-
exports.startAsyncWorkflowHandler = startAsyncWorkflowHandler;
|
|
354
|
-
exports.startWorkflowRunHandler = startWorkflowRunHandler;
|
|
355
|
-
exports.streamWorkflowHandler = streamWorkflowHandler;
|
|
356
|
-
exports.watchWorkflowHandler = watchWorkflowHandler;
|
|
357
|
-
exports.workflows_exports = workflows_exports;
|
package/dist/chunk-M5ABIP7D.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { HTTPException } from './chunk-NYN7KFXL.js';
|
|
2
|
-
|
|
3
|
-
// src/server/handlers/error.ts
|
|
4
|
-
function handleError(error, defaultMessage) {
|
|
5
|
-
const apiError = error;
|
|
6
|
-
throw new HTTPException(apiError.status || 500, {
|
|
7
|
-
message: apiError.message || defaultMessage
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export { handleError };
|
package/dist/chunk-MLKGABMK.js
DELETED
package/dist/chunk-TJO277H7.cjs
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkXUGQSVZ4_cjs = require('./chunk-XUGQSVZ4.cjs');
|
|
4
|
-
var chunk57CJTIPW_cjs = require('./chunk-57CJTIPW.cjs');
|
|
5
|
-
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
6
|
-
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
7
|
-
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
8
|
-
var tools = require('@mastra/core/tools');
|
|
9
|
-
|
|
10
|
-
// src/server/handlers/tools.ts
|
|
11
|
-
var tools_exports = {};
|
|
12
|
-
chunk75ZPJI57_cjs.__export(tools_exports, {
|
|
13
|
-
executeAgentToolHandler: () => executeAgentToolHandler,
|
|
14
|
-
executeToolHandler: () => executeToolHandler,
|
|
15
|
-
getToolByIdHandler: () => getToolByIdHandler,
|
|
16
|
-
getToolsHandler: () => getToolsHandler
|
|
17
|
-
});
|
|
18
|
-
async function getToolsHandler({ tools }) {
|
|
19
|
-
try {
|
|
20
|
-
if (!tools) {
|
|
21
|
-
return {};
|
|
22
|
-
}
|
|
23
|
-
const serializedTools = Object.entries(tools).reduce(
|
|
24
|
-
(acc, [id, _tool]) => {
|
|
25
|
-
const tool = _tool;
|
|
26
|
-
acc[id] = {
|
|
27
|
-
...tool,
|
|
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
|
|
30
|
-
};
|
|
31
|
-
return acc;
|
|
32
|
-
},
|
|
33
|
-
{}
|
|
34
|
-
);
|
|
35
|
-
return serializedTools;
|
|
36
|
-
} catch (error) {
|
|
37
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error getting tools");
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
async function getToolByIdHandler({ tools, toolId }) {
|
|
41
|
-
try {
|
|
42
|
-
const tool = Object.values(tools || {}).find((tool2) => tool2.id === toolId);
|
|
43
|
-
if (!tool) {
|
|
44
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Tool not found" });
|
|
45
|
-
}
|
|
46
|
-
const serializedTool = {
|
|
47
|
-
...tool,
|
|
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
|
|
50
|
-
};
|
|
51
|
-
return serializedTool;
|
|
52
|
-
} catch (error) {
|
|
53
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error getting tool");
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function executeToolHandler(tools$1) {
|
|
57
|
-
return async ({
|
|
58
|
-
mastra,
|
|
59
|
-
runId,
|
|
60
|
-
toolId,
|
|
61
|
-
data,
|
|
62
|
-
runtimeContext
|
|
63
|
-
}) => {
|
|
64
|
-
try {
|
|
65
|
-
if (!toolId) {
|
|
66
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Tool ID is required" });
|
|
67
|
-
}
|
|
68
|
-
const tool = Object.values(tools$1 || {}).find((tool2) => tool2.id === toolId);
|
|
69
|
-
if (!tool) {
|
|
70
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Tool not found" });
|
|
71
|
-
}
|
|
72
|
-
if (!tool?.execute) {
|
|
73
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Tool is not executable" });
|
|
74
|
-
}
|
|
75
|
-
chunk57CJTIPW_cjs.validateBody({ data });
|
|
76
|
-
if (tools.isVercelTool(tool)) {
|
|
77
|
-
const result2 = await tool.execute(data);
|
|
78
|
-
return result2;
|
|
79
|
-
}
|
|
80
|
-
const result = await tool.execute({
|
|
81
|
-
context: data,
|
|
82
|
-
mastra,
|
|
83
|
-
runId,
|
|
84
|
-
runtimeContext
|
|
85
|
-
});
|
|
86
|
-
return result;
|
|
87
|
-
} catch (error) {
|
|
88
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error executing tool");
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
async function executeAgentToolHandler({
|
|
93
|
-
mastra,
|
|
94
|
-
agentId,
|
|
95
|
-
toolId,
|
|
96
|
-
data,
|
|
97
|
-
runtimeContext
|
|
98
|
-
}) {
|
|
99
|
-
try {
|
|
100
|
-
const agent = agentId ? mastra.getAgent(agentId) : null;
|
|
101
|
-
if (!agent) {
|
|
102
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Tool not found" });
|
|
103
|
-
}
|
|
104
|
-
const agentTools = await agent.getTools({ runtimeContext });
|
|
105
|
-
const tool = Object.values(agentTools || {}).find((tool2) => tool2.id === toolId);
|
|
106
|
-
if (!tool) {
|
|
107
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Tool not found" });
|
|
108
|
-
}
|
|
109
|
-
if (!tool?.execute) {
|
|
110
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Tool is not executable" });
|
|
111
|
-
}
|
|
112
|
-
const result = await tool.execute({
|
|
113
|
-
context: data,
|
|
114
|
-
runtimeContext,
|
|
115
|
-
mastra,
|
|
116
|
-
runId: agentId
|
|
117
|
-
});
|
|
118
|
-
return result;
|
|
119
|
-
} catch (error) {
|
|
120
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error executing tool");
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
exports.executeAgentToolHandler = executeAgentToolHandler;
|
|
125
|
-
exports.executeToolHandler = executeToolHandler;
|
|
126
|
-
exports.getToolByIdHandler = getToolByIdHandler;
|
|
127
|
-
exports.getToolsHandler = getToolsHandler;
|
|
128
|
-
exports.tools_exports = tools_exports;
|
package/dist/chunk-VPNDC2DI.cjs
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunk57CJTIPW_cjs = require('./chunk-57CJTIPW.cjs');
|
|
4
|
-
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
5
|
-
var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
|
|
6
|
-
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
7
|
-
|
|
8
|
-
// src/server/handlers/network.ts
|
|
9
|
-
var network_exports = {};
|
|
10
|
-
chunk75ZPJI57_cjs.__export(network_exports, {
|
|
11
|
-
generateHandler: () => generateHandler,
|
|
12
|
-
getNetworkByIdHandler: () => getNetworkByIdHandler,
|
|
13
|
-
getNetworksHandler: () => getNetworksHandler,
|
|
14
|
-
streamGenerateHandler: () => streamGenerateHandler
|
|
15
|
-
});
|
|
16
|
-
async function getNetworksHandler({
|
|
17
|
-
mastra,
|
|
18
|
-
runtimeContext
|
|
19
|
-
}) {
|
|
20
|
-
try {
|
|
21
|
-
const networks = mastra.getNetworks();
|
|
22
|
-
const serializedNetworks = await Promise.all(
|
|
23
|
-
networks.map(async (network) => {
|
|
24
|
-
const routingAgent = network.getRoutingAgent();
|
|
25
|
-
const routingLLM = await routingAgent.getLLM({ runtimeContext });
|
|
26
|
-
const agents = network.getAgents();
|
|
27
|
-
return {
|
|
28
|
-
id: network.formatAgentId(routingAgent.name),
|
|
29
|
-
name: routingAgent.name,
|
|
30
|
-
instructions: routingAgent.instructions,
|
|
31
|
-
agents: await Promise.all(
|
|
32
|
-
agents.map(async (agent) => {
|
|
33
|
-
const llm = await agent.getLLM({ runtimeContext });
|
|
34
|
-
return {
|
|
35
|
-
name: agent.name,
|
|
36
|
-
provider: llm?.getProvider(),
|
|
37
|
-
modelId: llm?.getModelId()
|
|
38
|
-
};
|
|
39
|
-
})
|
|
40
|
-
),
|
|
41
|
-
routingModel: {
|
|
42
|
-
provider: routingLLM?.getProvider(),
|
|
43
|
-
modelId: routingLLM?.getModelId()
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
})
|
|
47
|
-
);
|
|
48
|
-
return serializedNetworks;
|
|
49
|
-
} catch (error) {
|
|
50
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error getting networks");
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async function getNetworkByIdHandler({
|
|
54
|
-
mastra,
|
|
55
|
-
networkId,
|
|
56
|
-
runtimeContext
|
|
57
|
-
}) {
|
|
58
|
-
try {
|
|
59
|
-
const networks = mastra.getNetworks();
|
|
60
|
-
const network = networks.find((network2) => {
|
|
61
|
-
const routingAgent2 = network2.getRoutingAgent();
|
|
62
|
-
return network2.formatAgentId(routingAgent2.name) === networkId;
|
|
63
|
-
});
|
|
64
|
-
if (!network) {
|
|
65
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Network not found" });
|
|
66
|
-
}
|
|
67
|
-
const routingAgent = network.getRoutingAgent();
|
|
68
|
-
const routingLLM = await routingAgent.getLLM({ runtimeContext });
|
|
69
|
-
const agents = network.getAgents();
|
|
70
|
-
const serializedNetwork = {
|
|
71
|
-
id: network.formatAgentId(routingAgent.name),
|
|
72
|
-
name: routingAgent.name,
|
|
73
|
-
instructions: routingAgent.instructions,
|
|
74
|
-
agents: await Promise.all(
|
|
75
|
-
agents.map(async (agent) => {
|
|
76
|
-
const llm = await agent.getLLM({ runtimeContext });
|
|
77
|
-
return {
|
|
78
|
-
name: agent.name,
|
|
79
|
-
provider: llm?.getProvider(),
|
|
80
|
-
modelId: llm?.getModelId()
|
|
81
|
-
};
|
|
82
|
-
})
|
|
83
|
-
),
|
|
84
|
-
routingModel: {
|
|
85
|
-
provider: routingLLM?.getProvider(),
|
|
86
|
-
modelId: routingLLM?.getModelId()
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
return serializedNetwork;
|
|
90
|
-
} catch (error) {
|
|
91
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error getting network by ID");
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
async function generateHandler({
|
|
95
|
-
mastra,
|
|
96
|
-
runtimeContext,
|
|
97
|
-
networkId,
|
|
98
|
-
body
|
|
99
|
-
}) {
|
|
100
|
-
try {
|
|
101
|
-
const network = mastra.getNetwork(networkId);
|
|
102
|
-
if (!network) {
|
|
103
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Network not found" });
|
|
104
|
-
}
|
|
105
|
-
chunk57CJTIPW_cjs.validateBody({ messages: body.messages });
|
|
106
|
-
const { messages, ...rest } = body;
|
|
107
|
-
const result = await network.generate(messages, { ...rest, runtimeContext });
|
|
108
|
-
return result;
|
|
109
|
-
} catch (error) {
|
|
110
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error generating from network");
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
async function streamGenerateHandler({
|
|
114
|
-
mastra,
|
|
115
|
-
networkId,
|
|
116
|
-
body,
|
|
117
|
-
runtimeContext
|
|
118
|
-
}) {
|
|
119
|
-
try {
|
|
120
|
-
const network = mastra.getNetwork(networkId);
|
|
121
|
-
if (!network) {
|
|
122
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Network not found" });
|
|
123
|
-
}
|
|
124
|
-
chunk57CJTIPW_cjs.validateBody({ messages: body.messages });
|
|
125
|
-
const { messages, output, ...rest } = body;
|
|
126
|
-
const streamResult = await network.stream(messages, {
|
|
127
|
-
output,
|
|
128
|
-
...rest,
|
|
129
|
-
runtimeContext
|
|
130
|
-
});
|
|
131
|
-
const streamResponse = output ? streamResult.toTextStreamResponse() : streamResult.toDataStreamResponse({
|
|
132
|
-
sendUsage: true,
|
|
133
|
-
sendReasoning: true,
|
|
134
|
-
getErrorMessage: (error) => {
|
|
135
|
-
return `An error occurred while processing your request. ${error instanceof Error ? error.message : JSON.stringify(error)}`;
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
return streamResponse;
|
|
139
|
-
} catch (error) {
|
|
140
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error streaming from network");
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
exports.generateHandler = generateHandler;
|
|
145
|
-
exports.getNetworkByIdHandler = getNetworkByIdHandler;
|
|
146
|
-
exports.getNetworksHandler = getNetworksHandler;
|
|
147
|
-
exports.network_exports = network_exports;
|
|
148
|
-
exports.streamGenerateHandler = streamGenerateHandler;
|
package/dist/index.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { getAgentCardByIdHandler } from '../../_tsup-dts-rollup.cjs';
|
|
2
|
-
export { handleTaskSend } from '../../_tsup-dts-rollup.cjs';
|
|
3
|
-
export { handleTaskGet } from '../../_tsup-dts-rollup.cjs';
|
|
4
|
-
export { handleTaskSendSubscribe } from '../../_tsup-dts-rollup.cjs';
|
|
5
|
-
export { handleTaskCancel } from '../../_tsup-dts-rollup.cjs';
|
|
6
|
-
export { getAgentExecutionHandler } from '../../_tsup-dts-rollup.cjs';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { getAgentsHandler } from '../../_tsup-dts-rollup.cjs';
|
|
2
|
-
export { getAgentByIdHandler } from '../../_tsup-dts-rollup.cjs';
|
|
3
|
-
export { getEvalsByAgentIdHandler } from '../../_tsup-dts-rollup.cjs';
|
|
4
|
-
export { getLiveEvalsByAgentIdHandler } from '../../_tsup-dts-rollup.cjs';
|
|
5
|
-
export { generateHandler } from '../../_tsup-dts-rollup.cjs';
|
|
6
|
-
export { streamGenerateHandler } from '../../_tsup-dts-rollup.cjs';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { handleError } from '../../_tsup-dts-rollup.cjs';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { getLegacyWorkflowsHandler } from '../../_tsup-dts-rollup.cjs';
|
|
2
|
-
export { getLegacyWorkflowByIdHandler } from '../../_tsup-dts-rollup.cjs';
|
|
3
|
-
export { startAsyncLegacyWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
|
|
4
|
-
export { getLegacyWorkflowRunHandler } from '../../_tsup-dts-rollup.cjs';
|
|
5
|
-
export { createLegacyWorkflowRunHandler } from '../../_tsup-dts-rollup.cjs';
|
|
6
|
-
export { startLegacyWorkflowRunHandler } from '../../_tsup-dts-rollup.cjs';
|
|
7
|
-
export { watchLegacyWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
|
|
8
|
-
export { resumeAsyncLegacyWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
|
|
9
|
-
export { resumeLegacyWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
|
|
10
|
-
export { getLegacyWorkflowRunsHandler } from '../../_tsup-dts-rollup.cjs';
|