@mastra/server 0.0.0-inject-middleware-20250528222017 → 0.0.0-interpolate-reporter-url-20250910180021
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 +3569 -0
- package/LICENSE.md +11 -42
- package/dist/{chunk-5SN4U5AC.cjs → chunk-3THIIWWW.cjs} +113 -137
- package/dist/chunk-3THIIWWW.cjs.map +1 -0
- 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-5DP5XZH6.cjs +928 -0
- package/dist/chunk-5DP5XZH6.cjs.map +1 -0
- package/dist/{chunk-P6SCPDYW.js → chunk-5QUKZCEF.js} +112 -136
- package/dist/chunk-5QUKZCEF.js.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-6LUKYSWE.cjs +610 -0
- package/dist/chunk-6LUKYSWE.cjs.map +1 -0
- package/dist/chunk-743UIDHI.cjs +2013 -0
- package/dist/chunk-743UIDHI.cjs.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-HFWCEP5S.js → chunk-A75S4TDD.js} +36 -11
- package/dist/chunk-A75S4TDD.js.map +1 -0
- package/dist/chunk-AK2FXLLB.cjs +849 -0
- package/dist/chunk-AK2FXLLB.cjs.map +1 -0
- package/dist/chunk-B2V3PUB7.js +591 -0
- package/dist/chunk-B2V3PUB7.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-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-IOQGI4ML.js +931 -0
- package/dist/chunk-IOQGI4ML.js.map +1 -0
- package/dist/{chunk-VPNDC2DI.cjs → chunk-IY34NOLA.cjs} +16 -14
- package/dist/chunk-IY34NOLA.cjs.map +1 -0
- package/dist/chunk-J7BPKKOG.cjs +163 -0
- package/dist/chunk-J7BPKKOG.cjs.map +1 -0
- package/dist/{chunk-YIOVBYZH.cjs → chunk-KNGXRN26.cjs} +48 -45
- 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-M2YFWHSB.js +455 -0
- package/dist/chunk-M2YFWHSB.js.map +1 -0
- package/dist/chunk-MLGHQDZZ.js +15671 -0
- package/dist/chunk-MLGHQDZZ.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-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-OGW6HHVI.js +1408 -0
- package/dist/chunk-OGW6HHVI.js.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-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-RW2D3G4K.cjs +470 -0
- package/dist/chunk-RW2D3G4K.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-W7VCKPAD.js → chunk-TTHEEIZ3.js} +19 -16
- 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-C7564HUT.js → chunk-U46VIX2V.js} +6 -4
- package/dist/chunk-U46VIX2V.js.map +1 -0
- package/dist/{chunk-55DOQLP6.js → chunk-WHN4VX55.js} +5 -3
- package/dist/chunk-WHN4VX55.js.map +1 -0
- package/dist/chunk-WZC6CIVD.cjs +120 -0
- package/dist/chunk-WZC6CIVD.cjs.map +1 -0
- package/dist/chunk-YITREQVN.cjs +15707 -0
- package/dist/chunk-YITREQVN.cjs.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 +2 -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 +2 -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 +87 -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 +37 -7
- package/dist/server/handlers/agents.cjs.map +1 -0
- package/dist/server/handlers/agents.d.ts +129 -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/network.cjs +7 -5
- package/dist/server/handlers/network.cjs.map +1 -0
- package/dist/server/handlers/network.d.ts +50 -4
- package/dist/server/handlers/network.d.ts.map +1 -0
- package/dist/server/handlers/network.js +3 -1
- package/dist/server/handlers/network.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 +179 -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 +39 -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 +30 -12
- package/dist/server/handlers/workflows.cjs.map +1 -0
- package/dist/server/handlers/workflows.d.ts +73 -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 +49 -32
- package/dist/server/handlers.cjs.map +1 -0
- package/dist/server/handlers.d.ts +15 -11
- package/dist/server/handlers.d.ts.map +1 -0
- package/dist/server/handlers.js +16 -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 +42 -0
- package/dist/server/utils.d.ts.map +1 -0
- package/package.json +51 -21
- package/dist/_tsup-dts-rollup.d.cts +0 -830
- package/dist/_tsup-dts-rollup.d.ts +0 -830
- package/dist/chunk-57CJTIPW.cjs +0 -18
- package/dist/chunk-64U3UDTH.cjs +0 -13
- package/dist/chunk-75ZPJI57.cjs +0 -9
- package/dist/chunk-A3KDUGS7.cjs +0 -239
- package/dist/chunk-DJJIUEL2.js +0 -211
- package/dist/chunk-DQLE3DVM.js +0 -49
- package/dist/chunk-J3PKLB3A.js +0 -231
- package/dist/chunk-KUNQFY2W.js +0 -365
- package/dist/chunk-M5ABIP7D.js +0 -11
- package/dist/chunk-MLKGABMK.js +0 -7
- package/dist/chunk-MMO2HDM6.cjs +0 -378
- package/dist/chunk-NEOOQUKW.cjs +0 -54
- 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/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.d.cts +0 -4
- 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 -3
- package/dist/server/handlers/workflows.d.cts +0 -11
- package/dist/server/handlers.d.cts +0 -11
package/dist/chunk-MMO2HDM6.cjs
DELETED
|
@@ -1,378 +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/workflows.ts
|
|
11
|
-
var workflows_exports = {};
|
|
12
|
-
chunk75ZPJI57_cjs.__export(workflows_exports, {
|
|
13
|
-
createWorkflowRunHandler: () => createWorkflowRunHandler,
|
|
14
|
-
getWorkflowByIdHandler: () => getWorkflowByIdHandler,
|
|
15
|
-
getWorkflowRunByIdHandler: () => getWorkflowRunByIdHandler,
|
|
16
|
-
getWorkflowRunsHandler: () => getWorkflowRunsHandler,
|
|
17
|
-
getWorkflowsHandler: () => getWorkflowsHandler,
|
|
18
|
-
resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
|
|
19
|
-
resumeWorkflowHandler: () => resumeWorkflowHandler,
|
|
20
|
-
startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
|
|
21
|
-
startWorkflowRunHandler: () => startWorkflowRunHandler,
|
|
22
|
-
streamWorkflowHandler: () => streamWorkflowHandler,
|
|
23
|
-
watchWorkflowHandler: () => watchWorkflowHandler
|
|
24
|
-
});
|
|
25
|
-
async function getWorkflowsHandler({ mastra }) {
|
|
26
|
-
try {
|
|
27
|
-
const workflows = mastra.getWorkflows({ serialized: false });
|
|
28
|
-
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
29
|
-
acc[key] = {
|
|
30
|
-
name: workflow.name,
|
|
31
|
-
description: workflow.description,
|
|
32
|
-
steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
|
|
33
|
-
acc2[key2] = {
|
|
34
|
-
id: step.id,
|
|
35
|
-
description: step.description,
|
|
36
|
-
inputSchema: step.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.inputSchema)) : void 0,
|
|
37
|
-
outputSchema: step.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.outputSchema)) : void 0,
|
|
38
|
-
resumeSchema: step.resumeSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.resumeSchema)) : void 0,
|
|
39
|
-
suspendSchema: step.suspendSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.suspendSchema)) : void 0
|
|
40
|
-
};
|
|
41
|
-
return acc2;
|
|
42
|
-
}, {}),
|
|
43
|
-
stepGraph: workflow.serializedStepGraph,
|
|
44
|
-
inputSchema: workflow.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.inputSchema)) : void 0,
|
|
45
|
-
outputSchema: workflow.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.outputSchema)) : void 0
|
|
46
|
-
};
|
|
47
|
-
return acc;
|
|
48
|
-
}, {});
|
|
49
|
-
return _workflows;
|
|
50
|
-
} catch (error) {
|
|
51
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflows" });
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
55
|
-
try {
|
|
56
|
-
if (!workflowId) {
|
|
57
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
58
|
-
}
|
|
59
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
60
|
-
if (!workflow) {
|
|
61
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
|
|
65
|
-
acc[key] = {
|
|
66
|
-
id: step.id,
|
|
67
|
-
description: step.description,
|
|
68
|
-
inputSchema: step.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.inputSchema)) : void 0,
|
|
69
|
-
outputSchema: step.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.outputSchema)) : void 0,
|
|
70
|
-
resumeSchema: step.resumeSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.resumeSchema)) : void 0,
|
|
71
|
-
suspendSchema: step.suspendSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(step.suspendSchema)) : void 0
|
|
72
|
-
};
|
|
73
|
-
return acc;
|
|
74
|
-
}, {}),
|
|
75
|
-
name: workflow.name,
|
|
76
|
-
description: workflow.description,
|
|
77
|
-
stepGraph: workflow.serializedStepGraph,
|
|
78
|
-
inputSchema: workflow.inputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.inputSchema)) : void 0,
|
|
79
|
-
outputSchema: workflow.outputSchema ? chunkYWLUOY3D_cjs.stringify(chunkYWLUOY3D_cjs.esm_default(workflow.outputSchema)) : void 0
|
|
80
|
-
};
|
|
81
|
-
} catch (error) {
|
|
82
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow" });
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
async function getWorkflowRunByIdHandler({
|
|
86
|
-
mastra,
|
|
87
|
-
workflowId,
|
|
88
|
-
runId
|
|
89
|
-
}) {
|
|
90
|
-
try {
|
|
91
|
-
if (!workflowId) {
|
|
92
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
93
|
-
}
|
|
94
|
-
if (!runId) {
|
|
95
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Run ID is required" });
|
|
96
|
-
}
|
|
97
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
98
|
-
if (!workflow) {
|
|
99
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
100
|
-
}
|
|
101
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
102
|
-
if (!run) {
|
|
103
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
104
|
-
}
|
|
105
|
-
return run;
|
|
106
|
-
} catch (error) {
|
|
107
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error getting workflow run" });
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
async function createWorkflowRunHandler({
|
|
111
|
-
mastra,
|
|
112
|
-
workflowId,
|
|
113
|
-
runId: prevRunId
|
|
114
|
-
}) {
|
|
115
|
-
try {
|
|
116
|
-
if (!workflowId) {
|
|
117
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
118
|
-
}
|
|
119
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
120
|
-
if (!workflow) {
|
|
121
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
122
|
-
}
|
|
123
|
-
const run = workflow.createRun({ runId: prevRunId });
|
|
124
|
-
return { runId: run.runId };
|
|
125
|
-
} catch (error) {
|
|
126
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error creating workflow run" });
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
async function startAsyncWorkflowHandler({
|
|
130
|
-
mastra,
|
|
131
|
-
runtimeContext,
|
|
132
|
-
workflowId,
|
|
133
|
-
runId,
|
|
134
|
-
inputData,
|
|
135
|
-
runtimeContextFromRequest
|
|
136
|
-
}) {
|
|
137
|
-
try {
|
|
138
|
-
if (!workflowId) {
|
|
139
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
140
|
-
}
|
|
141
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
142
|
-
if (!workflow) {
|
|
143
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
144
|
-
}
|
|
145
|
-
const finalRuntimeContext = new di.RuntimeContext([
|
|
146
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
147
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
148
|
-
]);
|
|
149
|
-
const _run = workflow.createRun({ runId });
|
|
150
|
-
const result = await _run.start({
|
|
151
|
-
inputData,
|
|
152
|
-
runtimeContext: finalRuntimeContext
|
|
153
|
-
});
|
|
154
|
-
return result;
|
|
155
|
-
} catch (error) {
|
|
156
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(500, { message: error?.message || "Error executing workflow" });
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
async function startWorkflowRunHandler({
|
|
160
|
-
mastra,
|
|
161
|
-
runtimeContext,
|
|
162
|
-
workflowId,
|
|
163
|
-
runId,
|
|
164
|
-
inputData,
|
|
165
|
-
runtimeContextFromRequest
|
|
166
|
-
}) {
|
|
167
|
-
try {
|
|
168
|
-
if (!workflowId) {
|
|
169
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
170
|
-
}
|
|
171
|
-
if (!runId) {
|
|
172
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to start run" });
|
|
173
|
-
}
|
|
174
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
175
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
176
|
-
if (!run) {
|
|
177
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
178
|
-
}
|
|
179
|
-
const finalRuntimeContext = new di.RuntimeContext([
|
|
180
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
181
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
182
|
-
]);
|
|
183
|
-
const _run = workflow.createRun({ runId });
|
|
184
|
-
void _run.start({
|
|
185
|
-
inputData,
|
|
186
|
-
runtimeContext: finalRuntimeContext
|
|
187
|
-
});
|
|
188
|
-
return { message: "Workflow run started" };
|
|
189
|
-
} catch (e) {
|
|
190
|
-
return chunk64U3UDTH_cjs.handleError(e, "Error starting workflow run");
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
async function watchWorkflowHandler({
|
|
194
|
-
mastra,
|
|
195
|
-
workflowId,
|
|
196
|
-
runId
|
|
197
|
-
}) {
|
|
198
|
-
try {
|
|
199
|
-
if (!workflowId) {
|
|
200
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
201
|
-
}
|
|
202
|
-
if (!runId) {
|
|
203
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to watch workflow" });
|
|
204
|
-
}
|
|
205
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
206
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
207
|
-
if (!run) {
|
|
208
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
209
|
-
}
|
|
210
|
-
const _run = workflow.createRun({ runId });
|
|
211
|
-
let unwatch;
|
|
212
|
-
let asyncRef = null;
|
|
213
|
-
const stream = new web.ReadableStream({
|
|
214
|
-
start(controller) {
|
|
215
|
-
unwatch = _run.watch(({ type, payload, eventTimestamp }) => {
|
|
216
|
-
controller.enqueue(JSON.stringify({ type, payload, eventTimestamp, runId }));
|
|
217
|
-
if (asyncRef) {
|
|
218
|
-
clearImmediate(asyncRef);
|
|
219
|
-
asyncRef = null;
|
|
220
|
-
}
|
|
221
|
-
asyncRef = setImmediate(async () => {
|
|
222
|
-
const runDone = payload.workflowState.status !== "running";
|
|
223
|
-
if (runDone) {
|
|
224
|
-
controller.close();
|
|
225
|
-
unwatch?.();
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
|
-
},
|
|
230
|
-
cancel() {
|
|
231
|
-
unwatch?.();
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
return stream;
|
|
235
|
-
} catch (error) {
|
|
236
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error watching workflow");
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
function streamWorkflowHandler({
|
|
240
|
-
mastra,
|
|
241
|
-
runtimeContext,
|
|
242
|
-
workflowId,
|
|
243
|
-
runId,
|
|
244
|
-
inputData,
|
|
245
|
-
runtimeContextFromRequest
|
|
246
|
-
}) {
|
|
247
|
-
try {
|
|
248
|
-
if (!workflowId) {
|
|
249
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
250
|
-
}
|
|
251
|
-
if (!runId) {
|
|
252
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
253
|
-
}
|
|
254
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
255
|
-
if (!workflow) {
|
|
256
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
257
|
-
}
|
|
258
|
-
const finalRuntimeContext = new di.RuntimeContext([
|
|
259
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
260
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
261
|
-
]);
|
|
262
|
-
const run = workflow.createRun({ runId });
|
|
263
|
-
const result = run.stream({
|
|
264
|
-
inputData,
|
|
265
|
-
runtimeContext: finalRuntimeContext
|
|
266
|
-
});
|
|
267
|
-
return result;
|
|
268
|
-
} catch (error) {
|
|
269
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error executing workflow");
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
async function resumeAsyncWorkflowHandler({
|
|
273
|
-
mastra,
|
|
274
|
-
workflowId,
|
|
275
|
-
runId,
|
|
276
|
-
body,
|
|
277
|
-
runtimeContext,
|
|
278
|
-
runtimeContextFromRequest
|
|
279
|
-
}) {
|
|
280
|
-
try {
|
|
281
|
-
if (!workflowId) {
|
|
282
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
283
|
-
}
|
|
284
|
-
if (!runId) {
|
|
285
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
286
|
-
}
|
|
287
|
-
if (!body.step) {
|
|
288
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
289
|
-
}
|
|
290
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
291
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
292
|
-
if (!run) {
|
|
293
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
294
|
-
}
|
|
295
|
-
const finalRuntimeContext = new di.RuntimeContext([
|
|
296
|
-
...Array.from(runtimeContext?.entries() ?? []),
|
|
297
|
-
...Array.from(Object.entries(runtimeContextFromRequest ?? {}))
|
|
298
|
-
]);
|
|
299
|
-
const _run = workflow.createRun({ runId });
|
|
300
|
-
const result = await _run.resume({
|
|
301
|
-
step: body.step,
|
|
302
|
-
resumeData: body.resumeData,
|
|
303
|
-
runtimeContext: finalRuntimeContext
|
|
304
|
-
});
|
|
305
|
-
return result;
|
|
306
|
-
} catch (error) {
|
|
307
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow step");
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
async function resumeWorkflowHandler({
|
|
311
|
-
mastra,
|
|
312
|
-
workflowId,
|
|
313
|
-
runId,
|
|
314
|
-
body,
|
|
315
|
-
runtimeContext
|
|
316
|
-
}) {
|
|
317
|
-
try {
|
|
318
|
-
if (!workflowId) {
|
|
319
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
320
|
-
}
|
|
321
|
-
if (!runId) {
|
|
322
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
323
|
-
}
|
|
324
|
-
if (!body.step) {
|
|
325
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
326
|
-
}
|
|
327
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
328
|
-
const run = await workflow.getWorkflowRunById(runId);
|
|
329
|
-
if (!run) {
|
|
330
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
331
|
-
}
|
|
332
|
-
const _run = workflow.createRun({ runId });
|
|
333
|
-
void _run.resume({
|
|
334
|
-
step: body.step,
|
|
335
|
-
resumeData: body.resumeData,
|
|
336
|
-
runtimeContext
|
|
337
|
-
});
|
|
338
|
-
return { message: "Workflow run resumed" };
|
|
339
|
-
} catch (error) {
|
|
340
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error resuming workflow");
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
async function getWorkflowRunsHandler({
|
|
344
|
-
mastra,
|
|
345
|
-
workflowId,
|
|
346
|
-
fromDate,
|
|
347
|
-
toDate,
|
|
348
|
-
limit,
|
|
349
|
-
offset,
|
|
350
|
-
resourceId
|
|
351
|
-
}) {
|
|
352
|
-
try {
|
|
353
|
-
if (!workflowId) {
|
|
354
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
355
|
-
}
|
|
356
|
-
const workflow = mastra.getWorkflow(workflowId);
|
|
357
|
-
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
358
|
-
runs: [],
|
|
359
|
-
total: 0
|
|
360
|
-
};
|
|
361
|
-
return workflowRuns;
|
|
362
|
-
} catch (error) {
|
|
363
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error getting workflow runs");
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
exports.createWorkflowRunHandler = createWorkflowRunHandler;
|
|
368
|
-
exports.getWorkflowByIdHandler = getWorkflowByIdHandler;
|
|
369
|
-
exports.getWorkflowRunByIdHandler = getWorkflowRunByIdHandler;
|
|
370
|
-
exports.getWorkflowRunsHandler = getWorkflowRunsHandler;
|
|
371
|
-
exports.getWorkflowsHandler = getWorkflowsHandler;
|
|
372
|
-
exports.resumeAsyncWorkflowHandler = resumeAsyncWorkflowHandler;
|
|
373
|
-
exports.resumeWorkflowHandler = resumeWorkflowHandler;
|
|
374
|
-
exports.startAsyncWorkflowHandler = startAsyncWorkflowHandler;
|
|
375
|
-
exports.startWorkflowRunHandler = startWorkflowRunHandler;
|
|
376
|
-
exports.streamWorkflowHandler = streamWorkflowHandler;
|
|
377
|
-
exports.watchWorkflowHandler = watchWorkflowHandler;
|
|
378
|
-
exports.workflows_exports = workflows_exports;
|
package/dist/chunk-NEOOQUKW.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.getTransports();
|
|
43
|
-
return {
|
|
44
|
-
transports: transports ? [...transports.keys()] : []
|
|
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-Y7UWRW5X.cjs
DELETED
|
@@ -1,221 +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/memory.ts
|
|
9
|
-
var memory_exports = {};
|
|
10
|
-
chunk75ZPJI57_cjs.__export(memory_exports, {
|
|
11
|
-
createThreadHandler: () => createThreadHandler,
|
|
12
|
-
deleteThreadHandler: () => deleteThreadHandler,
|
|
13
|
-
getMemoryStatusHandler: () => getMemoryStatusHandler,
|
|
14
|
-
getMessagesHandler: () => getMessagesHandler,
|
|
15
|
-
getThreadByIdHandler: () => getThreadByIdHandler,
|
|
16
|
-
getThreadsHandler: () => getThreadsHandler,
|
|
17
|
-
saveMessagesHandler: () => saveMessagesHandler,
|
|
18
|
-
updateThreadHandler: () => updateThreadHandler
|
|
19
|
-
});
|
|
20
|
-
function getMemoryFromContext({
|
|
21
|
-
mastra,
|
|
22
|
-
agentId
|
|
23
|
-
}) {
|
|
24
|
-
const agent = agentId ? mastra.getAgent(agentId) : null;
|
|
25
|
-
if (agentId && !agent) {
|
|
26
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Agent not found" });
|
|
27
|
-
}
|
|
28
|
-
const memory = agent?.getMemory?.() || mastra.getMemory();
|
|
29
|
-
return memory;
|
|
30
|
-
}
|
|
31
|
-
async function getMemoryStatusHandler({ mastra, agentId }) {
|
|
32
|
-
try {
|
|
33
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
34
|
-
if (!memory) {
|
|
35
|
-
return { result: false };
|
|
36
|
-
}
|
|
37
|
-
return { result: true };
|
|
38
|
-
} catch (error) {
|
|
39
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error getting memory status");
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
async function getThreadsHandler({
|
|
43
|
-
mastra,
|
|
44
|
-
agentId,
|
|
45
|
-
resourceId
|
|
46
|
-
}) {
|
|
47
|
-
try {
|
|
48
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
49
|
-
if (!memory) {
|
|
50
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
|
|
51
|
-
}
|
|
52
|
-
chunk57CJTIPW_cjs.validateBody({ resourceId });
|
|
53
|
-
const threads = await memory.getThreadsByResourceId({ resourceId });
|
|
54
|
-
return threads;
|
|
55
|
-
} catch (error) {
|
|
56
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error getting threads");
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
async function getThreadByIdHandler({
|
|
60
|
-
mastra,
|
|
61
|
-
agentId,
|
|
62
|
-
threadId
|
|
63
|
-
}) {
|
|
64
|
-
try {
|
|
65
|
-
chunk57CJTIPW_cjs.validateBody({ threadId });
|
|
66
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
67
|
-
if (!memory) {
|
|
68
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
|
|
69
|
-
}
|
|
70
|
-
const thread = await memory.getThreadById({ threadId });
|
|
71
|
-
if (!thread) {
|
|
72
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Thread not found" });
|
|
73
|
-
}
|
|
74
|
-
return thread;
|
|
75
|
-
} catch (error) {
|
|
76
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error getting thread");
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async function saveMessagesHandler({
|
|
80
|
-
mastra,
|
|
81
|
-
agentId,
|
|
82
|
-
body
|
|
83
|
-
}) {
|
|
84
|
-
try {
|
|
85
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
86
|
-
if (!memory) {
|
|
87
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
|
|
88
|
-
}
|
|
89
|
-
if (!body?.messages) {
|
|
90
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Messages are required" });
|
|
91
|
-
}
|
|
92
|
-
if (!Array.isArray(body.messages)) {
|
|
93
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Messages should be an array" });
|
|
94
|
-
}
|
|
95
|
-
const processedMessages = body.messages.map((message) => ({
|
|
96
|
-
...message,
|
|
97
|
-
id: memory.generateId(),
|
|
98
|
-
createdAt: message.createdAt ? new Date(message.createdAt) : /* @__PURE__ */ new Date()
|
|
99
|
-
}));
|
|
100
|
-
const result = await memory.saveMessages({ messages: processedMessages, memoryConfig: {} });
|
|
101
|
-
return result;
|
|
102
|
-
} catch (error) {
|
|
103
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error saving messages");
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
async function createThreadHandler({
|
|
107
|
-
mastra,
|
|
108
|
-
agentId,
|
|
109
|
-
body
|
|
110
|
-
}) {
|
|
111
|
-
try {
|
|
112
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
113
|
-
if (!memory) {
|
|
114
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
|
|
115
|
-
}
|
|
116
|
-
chunk57CJTIPW_cjs.validateBody({ resourceId: body?.resourceId });
|
|
117
|
-
const result = await memory.createThread({
|
|
118
|
-
resourceId: body?.resourceId,
|
|
119
|
-
title: body?.title,
|
|
120
|
-
metadata: body?.metadata,
|
|
121
|
-
threadId: body?.threadId
|
|
122
|
-
});
|
|
123
|
-
return result;
|
|
124
|
-
} catch (error) {
|
|
125
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error saving thread to memory");
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
async function updateThreadHandler({
|
|
129
|
-
mastra,
|
|
130
|
-
agentId,
|
|
131
|
-
threadId,
|
|
132
|
-
body
|
|
133
|
-
}) {
|
|
134
|
-
try {
|
|
135
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
136
|
-
if (!body) {
|
|
137
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Body is required" });
|
|
138
|
-
}
|
|
139
|
-
const { title, metadata, resourceId } = body;
|
|
140
|
-
const updatedAt = /* @__PURE__ */ new Date();
|
|
141
|
-
chunk57CJTIPW_cjs.validateBody({ threadId });
|
|
142
|
-
if (!memory) {
|
|
143
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
|
|
144
|
-
}
|
|
145
|
-
const thread = await memory.getThreadById({ threadId });
|
|
146
|
-
if (!thread) {
|
|
147
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Thread not found" });
|
|
148
|
-
}
|
|
149
|
-
const updatedThread = {
|
|
150
|
-
...thread,
|
|
151
|
-
title: title || thread.title,
|
|
152
|
-
metadata: metadata || thread.metadata,
|
|
153
|
-
resourceId: resourceId || thread.resourceId,
|
|
154
|
-
createdAt: thread.createdAt,
|
|
155
|
-
updatedAt
|
|
156
|
-
};
|
|
157
|
-
const result = await memory.saveThread({ thread: updatedThread });
|
|
158
|
-
return result;
|
|
159
|
-
} catch (error) {
|
|
160
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error updating thread");
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
async function deleteThreadHandler({
|
|
164
|
-
mastra,
|
|
165
|
-
agentId,
|
|
166
|
-
threadId
|
|
167
|
-
}) {
|
|
168
|
-
try {
|
|
169
|
-
chunk57CJTIPW_cjs.validateBody({ threadId });
|
|
170
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
171
|
-
if (!memory) {
|
|
172
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
|
|
173
|
-
}
|
|
174
|
-
const thread = await memory.getThreadById({ threadId });
|
|
175
|
-
if (!thread) {
|
|
176
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Thread not found" });
|
|
177
|
-
}
|
|
178
|
-
await memory.deleteThread(threadId);
|
|
179
|
-
return { result: "Thread deleted" };
|
|
180
|
-
} catch (error) {
|
|
181
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error deleting thread");
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
async function getMessagesHandler({
|
|
185
|
-
mastra,
|
|
186
|
-
agentId,
|
|
187
|
-
threadId,
|
|
188
|
-
limit
|
|
189
|
-
}) {
|
|
190
|
-
if (limit !== void 0 && (!Number.isInteger(limit) || limit <= 0)) {
|
|
191
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Invalid limit: must be a positive integer" });
|
|
192
|
-
}
|
|
193
|
-
try {
|
|
194
|
-
chunk57CJTIPW_cjs.validateBody({ threadId });
|
|
195
|
-
const memory = getMemoryFromContext({ mastra, agentId });
|
|
196
|
-
if (!memory) {
|
|
197
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: "Memory is not initialized" });
|
|
198
|
-
}
|
|
199
|
-
const thread = await memory.getThreadById({ threadId });
|
|
200
|
-
if (!thread) {
|
|
201
|
-
throw new chunkOCWPVYNI_cjs.HTTPException(404, { message: "Thread not found" });
|
|
202
|
-
}
|
|
203
|
-
const result = await memory.query({
|
|
204
|
-
threadId,
|
|
205
|
-
...limit && { selectBy: { last: limit } }
|
|
206
|
-
});
|
|
207
|
-
return result;
|
|
208
|
-
} catch (error) {
|
|
209
|
-
return chunk64U3UDTH_cjs.handleError(error, "Error getting messages");
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
exports.createThreadHandler = createThreadHandler;
|
|
214
|
-
exports.deleteThreadHandler = deleteThreadHandler;
|
|
215
|
-
exports.getMemoryStatusHandler = getMemoryStatusHandler;
|
|
216
|
-
exports.getMessagesHandler = getMessagesHandler;
|
|
217
|
-
exports.getThreadByIdHandler = getThreadByIdHandler;
|
|
218
|
-
exports.getThreadsHandler = getThreadsHandler;
|
|
219
|
-
exports.memory_exports = memory_exports;
|
|
220
|
-
exports.saveMessagesHandler = saveMessagesHandler;
|
|
221
|
-
exports.updateThreadHandler = updateThreadHandler;
|