@mastra/server 0.0.0-vector-sources-20250516175436 → 0.0.0-vector-extension-schema-20250922130418
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 +3745 -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-57HWW2TY.cjs +587 -0
- package/dist/chunk-57HWW2TY.cjs.map +1 -0
- package/dist/chunk-5DP5XZH6.cjs +928 -0
- package/dist/chunk-5DP5XZH6.cjs.map +1 -0
- package/dist/chunk-66YYHFGF.js +761 -0
- package/dist/chunk-66YYHFGF.js.map +1 -0
- package/dist/chunk-6GMFZ5LK.js +2774 -0
- package/dist/chunk-6GMFZ5LK.js.map +1 -0
- package/dist/chunk-743UIDHI.cjs +2013 -0
- package/dist/chunk-743UIDHI.cjs.map +1 -0
- package/dist/chunk-7JYXPDM4.js +15712 -0
- package/dist/chunk-7JYXPDM4.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-7QEJ5QG5.js +151 -0
- package/dist/chunk-7QEJ5QG5.js.map +1 -0
- package/dist/chunk-A3AL7EWJ.js +83 -0
- package/dist/chunk-A3AL7EWJ.js.map +1 -0
- package/dist/chunk-AK2FXLLB.cjs +849 -0
- package/dist/chunk-AK2FXLLB.cjs.map +1 -0
- package/dist/{chunk-5SN4U5AC.cjs → chunk-AVEPEUN4.cjs} +115 -138
- package/dist/chunk-AVEPEUN4.cjs.map +1 -0
- package/dist/chunk-CNU4A2XU.js +129 -0
- package/dist/chunk-CNU4A2XU.js.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-EMNGA4R4.js +845 -0
- package/dist/chunk-EMNGA4R4.js.map +1 -0
- package/dist/chunk-FALVL2VV.cjs +3525 -0
- package/dist/chunk-FALVL2VV.cjs.map +1 -0
- package/dist/chunk-FQNT7PI4.js +937 -0
- package/dist/chunk-FQNT7PI4.js.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-G662L2YZ.js +568 -0
- package/dist/chunk-G662L2YZ.js.map +1 -0
- package/dist/chunk-GDWMF6SB.cjs +133 -0
- package/dist/chunk-GDWMF6SB.cjs.map +1 -0
- package/dist/chunk-GU4EWMZB.cjs +769 -0
- package/dist/chunk-GU4EWMZB.cjs.map +1 -0
- package/dist/chunk-GUI3CROV.cjs +159 -0
- package/dist/chunk-GUI3CROV.cjs.map +1 -0
- package/dist/chunk-HJQKWRKQ.cjs +764 -0
- package/dist/chunk-HJQKWRKQ.cjs.map +1 -0
- package/dist/{chunk-YWLUOY3D.cjs → chunk-HVBBFCDH.cjs} +1110 -793
- package/dist/chunk-HVBBFCDH.cjs.map +1 -0
- package/dist/chunk-HZJRQ5L3.cjs +1411 -0
- package/dist/chunk-HZJRQ5L3.cjs.map +1 -0
- package/dist/chunk-IGFMAZZ5.cjs +1150 -0
- package/dist/chunk-IGFMAZZ5.cjs.map +1 -0
- package/dist/chunk-ILESGJ6N.js +524 -0
- package/dist/chunk-ILESGJ6N.js.map +1 -0
- package/dist/chunk-IOQGI4ML.js +931 -0
- package/dist/chunk-IOQGI4ML.js.map +1 -0
- package/dist/chunk-J7BPKKOG.cjs +163 -0
- package/dist/chunk-J7BPKKOG.cjs.map +1 -0
- package/dist/{chunk-HFWCEP5S.js → chunk-JRDEOHAJ.js} +47 -14
- package/dist/chunk-JRDEOHAJ.js.map +1 -0
- package/dist/chunk-KNGXRN26.cjs +335 -0
- package/dist/chunk-KNGXRN26.cjs.map +1 -0
- package/dist/{chunk-OR3CIE2H.js → chunk-KV6VHX4V.js} +29 -7
- package/dist/chunk-KV6VHX4V.js.map +1 -0
- package/dist/chunk-L265APUD.cjs +69 -0
- package/dist/chunk-L265APUD.cjs.map +1 -0
- package/dist/chunk-LF2ZLOFP.js +767 -0
- package/dist/chunk-LF2ZLOFP.js.map +1 -0
- package/dist/chunk-LYPU75T6.js +1147 -0
- package/dist/chunk-LYPU75T6.js.map +1 -0
- package/dist/{chunk-NYN7KFXL.js → chunk-MMROOK5J.js} +3 -0
- package/dist/chunk-MMROOK5J.js.map +1 -0
- package/dist/chunk-N35YCWQ5.cjs +540 -0
- package/dist/chunk-N35YCWQ5.cjs.map +1 -0
- package/dist/{chunk-LIVAK2DM.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-OGW6HHVI.js +1408 -0
- package/dist/chunk-OGW6HHVI.js.map +1 -0
- package/dist/chunk-OJQOYXHU.cjs +15748 -0
- package/dist/chunk-OJQOYXHU.cjs.map +1 -0
- package/dist/chunk-OZLRIVC4.cjs +588 -0
- package/dist/chunk-OZLRIVC4.cjs.map +1 -0
- package/dist/chunk-P7CIEIJ3.js +925 -0
- package/dist/chunk-P7CIEIJ3.js.map +1 -0
- package/dist/chunk-P7RBMCBE.cjs +934 -0
- package/dist/chunk-P7RBMCBE.cjs.map +1 -0
- package/dist/chunk-PPYGWINI.cjs +2777 -0
- package/dist/chunk-PPYGWINI.cjs.map +1 -0
- package/dist/{chunk-P6SCPDYW.js → chunk-PUYSH3IL.js} +114 -137
- package/dist/chunk-PUYSH3IL.js.map +1 -0
- package/dist/{chunk-MHKNLNAN.cjs → chunk-PWTXZZTR.cjs} +33 -10
- package/dist/chunk-PWTXZZTR.cjs.map +1 -0
- package/dist/chunk-R7NOGUZG.js +65 -0
- package/dist/chunk-R7NOGUZG.js.map +1 -0
- package/dist/chunk-RCHEPTZZ.js +2006 -0
- package/dist/chunk-RCHEPTZZ.js.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-SPLSYTYW.cjs +88 -0
- 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-TJKLBTFB.js → chunk-SYRRSBGL.js} +51 -27
- package/dist/chunk-SYRRSBGL.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-EJO45KYT.js → chunk-TTHEEIZ3.js} +53 -50
- package/dist/chunk-TTHEEIZ3.js.map +1 -0
- package/dist/chunk-TVSIG4JE.cjs +940 -0
- package/dist/chunk-TVSIG4JE.cjs.map +1 -0
- package/dist/{chunk-55DOQLP6.js → chunk-WHN4VX55.js} +5 -3
- package/dist/chunk-WHN4VX55.js.map +1 -0
- package/dist/dist-26HWEQY6.js +3 -0
- package/dist/dist-26HWEQY6.js.map +1 -0
- package/dist/dist-3A5DXB37.cjs +20 -0
- package/dist/dist-3A5DXB37.cjs.map +1 -0
- package/dist/dist-3SJKQJGY.cjs +16 -0
- package/dist/dist-3SJKQJGY.cjs.map +1 -0
- package/dist/dist-4ZQSPE5K.js +3 -0
- package/dist/dist-4ZQSPE5K.js.map +1 -0
- package/dist/dist-5W5QNRTD.js +3 -0
- package/dist/dist-5W5QNRTD.js.map +1 -0
- package/dist/dist-653SRMPL.js +3 -0
- package/dist/dist-653SRMPL.js.map +1 -0
- package/dist/dist-6U6EFC5C.cjs +16 -0
- package/dist/dist-6U6EFC5C.cjs.map +1 -0
- package/dist/dist-7IHNNYMF.cjs +16 -0
- package/dist/dist-7IHNNYMF.cjs.map +1 -0
- package/dist/dist-B5IPRF6W.js +3 -0
- package/dist/dist-B5IPRF6W.js.map +1 -0
- package/dist/dist-EOMYFT4Y.cjs +16 -0
- package/dist/dist-EOMYFT4Y.cjs.map +1 -0
- package/dist/dist-EZZMMMNT.cjs +16 -0
- package/dist/dist-EZZMMMNT.cjs.map +1 -0
- package/dist/dist-F2ET4MNO.cjs +16 -0
- package/dist/dist-F2ET4MNO.cjs.map +1 -0
- package/dist/dist-H64VX6DE.js +3 -0
- package/dist/dist-H64VX6DE.js.map +1 -0
- package/dist/dist-HY7RMLJQ.cjs +16 -0
- package/dist/dist-HY7RMLJQ.cjs.map +1 -0
- package/dist/dist-M6S4P3FJ.js +3 -0
- package/dist/dist-M6S4P3FJ.js.map +1 -0
- package/dist/dist-NR7QSCQT.js +3 -0
- package/dist/dist-NR7QSCQT.js.map +1 -0
- package/dist/dist-QLFMCMCX.js +3 -0
- package/dist/dist-QLFMCMCX.js.map +1 -0
- package/dist/dist-UY46BFRP.js +3 -0
- package/dist/dist-UY46BFRP.js.map +1 -0
- package/dist/dist-WCQDRTIV.cjs +16 -0
- package/dist/dist-WCQDRTIV.cjs.map +1 -0
- package/dist/dist-WKYB3LTJ.cjs +16 -0
- package/dist/dist-WKYB3LTJ.cjs.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 +88 -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 +41 -7
- package/dist/server/handlers/agents.cjs.map +1 -0
- package/dist/server/handlers/agents.d.ts +139 -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 +48 -0
- package/dist/server/handlers/legacyWorkflows.cjs.map +1 -0
- package/dist/server/handlers/legacyWorkflows.d.ts +59 -0
- package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -0
- package/dist/server/handlers/legacyWorkflows.js +3 -0
- 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 +16 -0
- package/dist/server/handlers/observability.cjs.map +1 -0
- package/dist/server/handlers/observability.d.ts +23 -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 +49 -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 +10 -4
- package/dist/server/handlers/voice.cjs.map +1 -0
- package/dist/server/handlers/voice.d.ts +41 -3
- 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 +43 -13
- package/dist/server/handlers/workflows.cjs.map +1 -0
- package/dist/server/handlers/workflows.d.ts +82 -10
- 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 +51 -21
- package/dist/_tsup-dts-rollup.d.cts +0 -816
- package/dist/_tsup-dts-rollup.d.ts +0 -816
- package/dist/chunk-57CJTIPW.cjs +0 -18
- package/dist/chunk-64U3UDTH.cjs +0 -13
- package/dist/chunk-75ZPJI57.cjs +0 -9
- package/dist/chunk-C7564HUT.js +0 -142
- package/dist/chunk-D4IRYCUI.cjs +0 -235
- package/dist/chunk-DJJIUEL2.js +0 -211
- package/dist/chunk-HWZVAG3H.js +0 -49
- package/dist/chunk-I2B73Y4I.cjs +0 -332
- package/dist/chunk-M5ABIP7D.js +0 -11
- package/dist/chunk-MIQYDLLM.js +0 -329
- package/dist/chunk-MLKGABMK.js +0 -7
- package/dist/chunk-OGCNNUHF.cjs +0 -54
- package/dist/chunk-UCTEMO2Q.cjs +0 -341
- package/dist/chunk-VPNDC2DI.cjs +0 -148
- package/dist/chunk-WUC6LSTW.js +0 -227
- package/dist/chunk-Y7UWRW5X.cjs +0 -221
- package/dist/chunk-YBVOQN4M.cjs +0 -94
- package/dist/chunk-ZE5AAC4I.cjs +0 -138
- 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/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/vNextWorkflows.cjs +0 -46
- package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
- package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
- package/dist/server/handlers/vNextWorkflows.js +0 -1
- package/dist/server/handlers/vector.d.cts +0 -6
- package/dist/server/handlers/voice.d.cts +0 -3
- package/dist/server/handlers/workflows.d.cts +0 -10
- package/dist/server/handlers.d.cts +0 -11
package/dist/chunk-OGCNNUHF.cjs
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunk57CJTIPW_cjs = require('./chunk-57CJTIPW.cjs');
|
|
4
|
-
var chunk64U3UDTH_cjs = require('./chunk-64U3UDTH.cjs');
|
|
5
|
-
var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
|
|
6
|
-
|
|
7
|
-
// src/server/handlers/logs.ts
|
|
8
|
-
var logs_exports = {};
|
|
9
|
-
chunk75ZPJI57_cjs.__export(logs_exports, {
|
|
10
|
-
getLogTransports: () => getLogTransports,
|
|
11
|
-
getLogsByRunIdHandler: () => getLogsByRunIdHandler,
|
|
12
|
-
getLogsHandler: () => getLogsHandler
|
|
13
|
-
});
|
|
14
|
-
async function getLogsHandler({
|
|
15
|
-
mastra,
|
|
16
|
-
transportId
|
|
17
|
-
}) {
|
|
18
|
-
try {
|
|
19
|
-
chunk57CJTIPW_cjs.validateBody({ transportId });
|
|
20
|
-
const logs = await mastra.getLogs(transportId);
|
|
21
|
-
return logs;
|
|
22
|
-
} catch (error) {
|
|
23
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error getting logs");
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
async function getLogsByRunIdHandler({
|
|
27
|
-
mastra,
|
|
28
|
-
runId,
|
|
29
|
-
transportId
|
|
30
|
-
}) {
|
|
31
|
-
try {
|
|
32
|
-
chunk57CJTIPW_cjs.validateBody({ runId, transportId });
|
|
33
|
-
const logs = await mastra.getLogsByRunId({ runId, transportId });
|
|
34
|
-
return logs;
|
|
35
|
-
} catch (error) {
|
|
36
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error getting logs by run ID");
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
async function getLogTransports({ mastra }) {
|
|
40
|
-
try {
|
|
41
|
-
const logger = mastra.getLogger();
|
|
42
|
-
const transports = logger.transports;
|
|
43
|
-
return {
|
|
44
|
-
transports: transports ? Object.keys(transports) : []
|
|
45
|
-
};
|
|
46
|
-
} catch (error) {
|
|
47
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error getting log Transports");
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
exports.getLogTransports = getLogTransports;
|
|
52
|
-
exports.getLogsByRunIdHandler = getLogsByRunIdHandler;
|
|
53
|
-
exports.getLogsHandler = getLogsHandler;
|
|
54
|
-
exports.logs_exports = logs_exports;
|
package/dist/chunk-UCTEMO2Q.cjs
DELETED
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkYWLUOY3D_cjs = require('./chunk-YWLUOY3D.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
|
-
var di = require('@mastra/core/di');
|
|
9
|
-
|
|
10
|
-
// src/server/handlers/vNextWorkflows.ts
|
|
11
|
-
var vNextWorkflows_exports = {};
|
|
12
|
-
chunk75ZPJI57_cjs.__export(vNextWorkflows_exports, {
|
|
13
|
-
createVNextWorkflowRunHandler: () => createVNextWorkflowRunHandler,
|
|
14
|
-
getVNextWorkflowByIdHandler: () => getVNextWorkflowByIdHandler,
|
|
15
|
-
getVNextWorkflowRunByIdHandler: () => getVNextWorkflowRunByIdHandler,
|
|
16
|
-
getVNextWorkflowRunsHandler: () => getVNextWorkflowRunsHandler,
|
|
17
|
-
getVNextWorkflowsHandler: () => getVNextWorkflowsHandler,
|
|
18
|
-
resumeAsyncVNextWorkflowHandler: () => resumeAsyncVNextWorkflowHandler,
|
|
19
|
-
resumeVNextWorkflowHandler: () => resumeVNextWorkflowHandler,
|
|
20
|
-
startAsyncVNextWorkflowHandler: () => startAsyncVNextWorkflowHandler,
|
|
21
|
-
startVNextWorkflowRunHandler: () => startVNextWorkflowRunHandler,
|
|
22
|
-
watchVNextWorkflowHandler: () => watchVNextWorkflowHandler
|
|
23
|
-
});
|
|
24
|
-
async function getVNextWorkflowsHandler({ mastra }) {
|
|
25
|
-
try {
|
|
26
|
-
const workflows = mastra.vnext_getWorkflows({ serialized: false });
|
|
27
|
-
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
28
|
-
acc[key] = {
|
|
29
|
-
name: workflow.name,
|
|
30
|
-
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
31
|
-
acc2[key2] = {
|
|
32
|
-
id: step.id,
|
|
33
|
-
description: step.description,
|
|
34
|
-
inputSchema: step.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.inputSchema)) : void 0,
|
|
35
|
-
outputSchema: step.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.outputSchema)) : void 0,
|
|
36
|
-
resumeSchema: step.resumeSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.resumeSchema)) : void 0,
|
|
37
|
-
suspendSchema: step.suspendSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.suspendSchema)) : void 0
|
|
38
|
-
};
|
|
39
|
-
return acc2;
|
|
40
|
-
}, {}),
|
|
41
|
-
stepGraph: workflow.serializedStepGraph,
|
|
42
|
-
inputSchema: workflow.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.inputSchema)) : void 0,
|
|
43
|
-
outputSchema: workflow.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.outputSchema)) : void 0
|
|
44
|
-
};
|
|
45
|
-
return acc;
|
|
46
|
-
}, {});
|
|
47
|
-
return _workflows;
|
|
48
|
-
} catch (error) {
|
|
49
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflows" });
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async function getVNextWorkflowByIdHandler({ mastra, workflowId }) {
|
|
53
|
-
try {
|
|
54
|
-
if (!workflowId) {
|
|
55
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
56
|
-
}
|
|
57
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
58
|
-
if (!workflow) {
|
|
59
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
|
|
63
|
-
acc[key] = {
|
|
64
|
-
id: step.id,
|
|
65
|
-
description: step.description,
|
|
66
|
-
inputSchema: step.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.inputSchema)) : void 0,
|
|
67
|
-
outputSchema: step.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.outputSchema)) : void 0,
|
|
68
|
-
resumeSchema: step.resumeSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.resumeSchema)) : void 0,
|
|
69
|
-
suspendSchema: step.suspendSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.suspendSchema)) : void 0
|
|
70
|
-
};
|
|
71
|
-
return acc;
|
|
72
|
-
}, {}),
|
|
73
|
-
name: workflow.name,
|
|
74
|
-
stepGraph: workflow.serializedStepGraph,
|
|
75
|
-
inputSchema: workflow.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.inputSchema)) : void 0,
|
|
76
|
-
outputSchema: workflow.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.outputSchema)) : void 0
|
|
77
|
-
};
|
|
78
|
-
} catch (error) {
|
|
79
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
async function getVNextWorkflowRunByIdHandler({
|
|
83
|
-
mastra,
|
|
84
|
-
workflowId,
|
|
85
|
-
runId
|
|
86
|
-
}) {
|
|
87
|
-
try {
|
|
88
|
-
if (!workflowId) {
|
|
89
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
90
|
-
}
|
|
91
|
-
if (!runId) {
|
|
92
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
|
|
93
|
-
}
|
|
94
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
95
|
-
if (!workflow) {
|
|
96
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
97
|
-
}
|
|
98
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
99
|
-
if (!run) {
|
|
100
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
101
|
-
}
|
|
102
|
-
return run;
|
|
103
|
-
} catch (error) {
|
|
104
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
async function createVNextWorkflowRunHandler({
|
|
108
|
-
mastra,
|
|
109
|
-
workflowId,
|
|
110
|
-
runId: prevRunId
|
|
111
|
-
}) {
|
|
112
|
-
try {
|
|
113
|
-
if (!workflowId) {
|
|
114
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
115
|
-
}
|
|
116
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
117
|
-
if (!workflow) {
|
|
118
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
119
|
-
}
|
|
120
|
-
const run = workflow.createRun({ runId: prevRunId });
|
|
121
|
-
return { runId: run.runId };
|
|
122
|
-
} catch (error) {
|
|
123
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
async function startAsyncVNextWorkflowHandler({
|
|
127
|
-
mastra,
|
|
128
|
-
runtimeContext,
|
|
129
|
-
workflowId,
|
|
130
|
-
runId,
|
|
131
|
-
inputData,
|
|
132
|
-
runtimeContextFromRequest
|
|
133
|
-
}) {
|
|
134
|
-
try {
|
|
135
|
-
if (!workflowId) {
|
|
136
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
137
|
-
}
|
|
138
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
139
|
-
if (!workflow) {
|
|
140
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
141
|
-
}
|
|
142
|
-
const finalRuntimeContext = new di.RuntimeContext([
|
|
143
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
144
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
145
|
-
]);
|
|
146
|
-
const _run = workflow.createRun({ runId });
|
|
147
|
-
const result = await _run.start({
|
|
148
|
-
inputData,
|
|
149
|
-
runtimeContext: finalRuntimeContext
|
|
150
|
-
});
|
|
151
|
-
return result;
|
|
152
|
-
} catch (error) {
|
|
153
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error executing workflow" });
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
async function startVNextWorkflowRunHandler({
|
|
157
|
-
mastra,
|
|
158
|
-
runtimeContext,
|
|
159
|
-
workflowId,
|
|
160
|
-
runId,
|
|
161
|
-
inputData,
|
|
162
|
-
runtimeContextFromRequest
|
|
163
|
-
}) {
|
|
164
|
-
try {
|
|
165
|
-
if (!workflowId) {
|
|
166
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
167
|
-
}
|
|
168
|
-
if (!runId) {
|
|
169
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to start run" });
|
|
170
|
-
}
|
|
171
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
172
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
173
|
-
if (!run) {
|
|
174
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
175
|
-
}
|
|
176
|
-
const finalRuntimeContext = new di.RuntimeContext([
|
|
177
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
178
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
179
|
-
]);
|
|
180
|
-
const _run = workflow.createRun({ runId });
|
|
181
|
-
void _run.start({
|
|
182
|
-
inputData,
|
|
183
|
-
runtimeContext: finalRuntimeContext
|
|
184
|
-
});
|
|
185
|
-
return { message: "Workflow run started" };
|
|
186
|
-
} catch (e) {
|
|
187
|
-
return chunk64U3UDTH_cjs.handleError(e, "Error starting workflow run");
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
async function watchVNextWorkflowHandler({
|
|
191
|
-
mastra,
|
|
192
|
-
workflowId,
|
|
193
|
-
runId
|
|
194
|
-
}) {
|
|
195
|
-
try {
|
|
196
|
-
if (!workflowId) {
|
|
197
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
198
|
-
}
|
|
199
|
-
if (!runId) {
|
|
200
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to watch workflow" });
|
|
201
|
-
}
|
|
202
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
203
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
204
|
-
if (!run) {
|
|
205
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
206
|
-
}
|
|
207
|
-
const _run = workflow.createRun({ runId });
|
|
208
|
-
let unwatch;
|
|
209
|
-
let asyncRef = null;
|
|
210
|
-
const stream = new web.ReadableStream({
|
|
211
|
-
start(controller) {
|
|
212
|
-
unwatch = _run.watch(({ type, payload, eventTimestamp }) => {
|
|
213
|
-
controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
|
|
214
|
-
if (asyncRef) {
|
|
215
|
-
clearImmediate(asyncRef);
|
|
216
|
-
asyncRef = null;
|
|
217
|
-
}
|
|
218
|
-
asyncRef = setImmediate(async () => {
|
|
219
|
-
const runDone = payload.workflowState.status !== "running";
|
|
220
|
-
if (runDone) {
|
|
221
|
-
controller.close();
|
|
222
|
-
unwatch?.();
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
},
|
|
227
|
-
cancel() {
|
|
228
|
-
unwatch?.();
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
return stream;
|
|
232
|
-
} catch (error) {
|
|
233
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error watching workflow");
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
async function resumeAsyncVNextWorkflowHandler({
|
|
237
|
-
mastra,
|
|
238
|
-
workflowId,
|
|
239
|
-
runId,
|
|
240
|
-
body,
|
|
241
|
-
runtimeContext,
|
|
242
|
-
runtimeContextFromRequest
|
|
243
|
-
}) {
|
|
244
|
-
try {
|
|
245
|
-
if (!workflowId) {
|
|
246
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
247
|
-
}
|
|
248
|
-
if (!runId) {
|
|
249
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
250
|
-
}
|
|
251
|
-
if (!body.step) {
|
|
252
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
253
|
-
}
|
|
254
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
255
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
256
|
-
if (!run) {
|
|
257
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
258
|
-
}
|
|
259
|
-
const finalRuntimeContext = new di.RuntimeContext([
|
|
260
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
261
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
262
|
-
]);
|
|
263
|
-
const _run = workflow.createRun({ runId });
|
|
264
|
-
const result = await _run.resume({
|
|
265
|
-
step: body.step,
|
|
266
|
-
resumeData: body.resumeData,
|
|
267
|
-
runtimeContext: finalRuntimeContext
|
|
268
|
-
});
|
|
269
|
-
return result;
|
|
270
|
-
} catch (error) {
|
|
271
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow step");
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
async function resumeVNextWorkflowHandler({
|
|
275
|
-
mastra,
|
|
276
|
-
workflowId,
|
|
277
|
-
runId,
|
|
278
|
-
body,
|
|
279
|
-
runtimeContext
|
|
280
|
-
}) {
|
|
281
|
-
try {
|
|
282
|
-
if (!workflowId) {
|
|
283
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
284
|
-
}
|
|
285
|
-
if (!runId) {
|
|
286
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
287
|
-
}
|
|
288
|
-
if (!body.step) {
|
|
289
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
290
|
-
}
|
|
291
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
292
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
293
|
-
if (!run) {
|
|
294
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
295
|
-
}
|
|
296
|
-
const _run = workflow.createRun({ runId });
|
|
297
|
-
void _run.resume({
|
|
298
|
-
step: body.step,
|
|
299
|
-
resumeData: body.resumeData,
|
|
300
|
-
runtimeContext
|
|
301
|
-
});
|
|
302
|
-
return { message: "Workflow run resumed" };
|
|
303
|
-
} catch (error) {
|
|
304
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow");
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
async function getVNextWorkflowRunsHandler({
|
|
308
|
-
mastra,
|
|
309
|
-
workflowId,
|
|
310
|
-
fromDate,
|
|
311
|
-
toDate,
|
|
312
|
-
limit,
|
|
313
|
-
offset,
|
|
314
|
-
resourceId
|
|
315
|
-
}) {
|
|
316
|
-
try {
|
|
317
|
-
if (!workflowId) {
|
|
318
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
319
|
-
}
|
|
320
|
-
const workflow = mastra.vnext_getWorkflow(workflowId);
|
|
321
|
-
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
322
|
-
runs: [],
|
|
323
|
-
total: 0
|
|
324
|
-
};
|
|
325
|
-
return workflowRuns;
|
|
326
|
-
} catch (error) {
|
|
327
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error getting workflow runs");
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
exports.createVNextWorkflowRunHandler = createVNextWorkflowRunHandler;
|
|
332
|
-
exports.getVNextWorkflowByIdHandler = getVNextWorkflowByIdHandler;
|
|
333
|
-
exports.getVNextWorkflowRunByIdHandler = getVNextWorkflowRunByIdHandler;
|
|
334
|
-
exports.getVNextWorkflowRunsHandler = getVNextWorkflowRunsHandler;
|
|
335
|
-
exports.getVNextWorkflowsHandler = getVNextWorkflowsHandler;
|
|
336
|
-
exports.resumeAsyncVNextWorkflowHandler = resumeAsyncVNextWorkflowHandler;
|
|
337
|
-
exports.resumeVNextWorkflowHandler = resumeVNextWorkflowHandler;
|
|
338
|
-
exports.startAsyncVNextWorkflowHandler = startAsyncVNextWorkflowHandler;
|
|
339
|
-
exports.startVNextWorkflowRunHandler = startVNextWorkflowRunHandler;
|
|
340
|
-
exports.vNextWorkflows_exports = vNextWorkflows_exports;
|
|
341
|
-
exports.watchVNextWorkflowHandler = watchVNextWorkflowHandler;
|
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;
|