@mastra/server 0.0.0-span-scorring-test-20251124132129 → 0.0.0-standard-schema-20260123120255
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 +1811 -32
- package/README.md +2 -2
- package/a2a/store.d.ts +1 -0
- package/auth.d.ts +1 -0
- package/dist/{chunk-SHWNNZBL.js → chunk-24SISJRB.js} +13 -17
- package/dist/chunk-24SISJRB.js.map +1 -0
- package/dist/{chunk-G7BPNX2V.js → chunk-2JNW2CLE.js} +64 -14
- package/dist/chunk-2JNW2CLE.js.map +1 -0
- package/dist/chunk-2UHOWYFV.js +184 -0
- package/dist/chunk-2UHOWYFV.js.map +1 -0
- package/dist/chunk-3W67K7YE.js +13 -0
- package/dist/chunk-3W67K7YE.js.map +1 -0
- package/dist/chunk-4HFYR562.cjs +82 -0
- package/dist/chunk-4HFYR562.cjs.map +1 -0
- package/dist/chunk-55TH4ME5.js +170 -0
- package/dist/chunk-55TH4ME5.js.map +1 -0
- package/dist/{chunk-Z36N2OQA.cjs → chunk-55XIQCGI.cjs} +358 -137
- package/dist/chunk-55XIQCGI.cjs.map +1 -0
- package/dist/{chunk-QGWCNTG6.cjs → chunk-5NQ3GWUJ.cjs} +493 -172
- package/dist/chunk-5NQ3GWUJ.cjs.map +1 -0
- package/dist/{chunk-QU6N55W6.cjs → chunk-6G2RQWKA.cjs} +17 -21
- package/dist/chunk-6G2RQWKA.cjs.map +1 -0
- package/dist/{chunk-KB5NSROG.cjs → chunk-6NLJ5YC3.cjs} +47 -42
- package/dist/chunk-6NLJ5YC3.cjs.map +1 -0
- package/dist/chunk-6OFKRQQL.js +45 -0
- package/dist/chunk-6OFKRQQL.js.map +1 -0
- package/dist/{chunk-UXGQZUYZ.js → chunk-7AINN3FK.js} +13 -3
- package/dist/chunk-7AINN3FK.js.map +1 -0
- package/dist/chunk-7D3UAMQM.cjs +82 -0
- package/dist/chunk-7D3UAMQM.cjs.map +1 -0
- package/dist/{chunk-I5VZ5SKG.js → chunk-7ERB6H6K.js} +17 -11
- package/dist/chunk-7ERB6H6K.js.map +1 -0
- package/dist/{chunk-NDFAQBQD.cjs → chunk-AEMLCRS5.cjs} +514 -166
- package/dist/chunk-AEMLCRS5.cjs.map +1 -0
- package/dist/chunk-BLCHLNBT.js +442 -0
- package/dist/chunk-BLCHLNBT.js.map +1 -0
- package/dist/{chunk-ZLRTFRL4.js → chunk-BSOLG32W.js} +407 -91
- package/dist/chunk-BSOLG32W.js.map +1 -0
- package/dist/{chunk-ASZUOBKV.js → chunk-CQUWREB2.js} +42 -20
- package/dist/chunk-CQUWREB2.js.map +1 -0
- package/dist/chunk-CRCXQW5R.cjs +47 -0
- package/dist/chunk-CRCXQW5R.cjs.map +1 -0
- package/dist/{chunk-3R5EV3HV.js → chunk-CT7S7VRG.js} +36 -29
- package/dist/chunk-CT7S7VRG.js.map +1 -0
- package/dist/{chunk-FAQICBMH.js → chunk-D23WBCJ6.js} +70 -7
- package/dist/chunk-D23WBCJ6.js.map +1 -0
- package/dist/{chunk-R4M3BSUG.js → chunk-DOU5IGJB.js} +26 -10
- package/dist/chunk-DOU5IGJB.js.map +1 -0
- package/dist/chunk-DUTGH2DM.js +31748 -0
- package/dist/chunk-DUTGH2DM.js.map +1 -0
- package/dist/{chunk-5PONYNYP.cjs → chunk-E2SZSFGZ.cjs} +20 -17
- package/dist/chunk-E2SZSFGZ.cjs.map +1 -0
- package/dist/chunk-EH45MGLR.cjs +322 -0
- package/dist/chunk-EH45MGLR.cjs.map +1 -0
- package/dist/chunk-FRRHYZR6.cjs +88 -0
- package/dist/chunk-FRRHYZR6.cjs.map +1 -0
- package/dist/{chunk-ZULZ2752.js → chunk-FXW7MD4U.js} +3 -3
- package/dist/chunk-FXW7MD4U.js.map +1 -0
- package/dist/{chunk-YJ3VDL3Z.cjs → chunk-GGAV65A7.cjs} +37 -31
- package/dist/chunk-GGAV65A7.cjs.map +1 -0
- package/dist/{chunk-PKRHEXX7.js → chunk-HT4LP3BO.js} +19 -18
- package/dist/chunk-HT4LP3BO.js.map +1 -0
- package/dist/chunk-HZINLMHL.cjs +252 -0
- package/dist/chunk-HZINLMHL.cjs.map +1 -0
- package/dist/{chunk-RQK4FQUD.js → chunk-IGXRQWNN.js} +6 -48
- package/dist/chunk-IGXRQWNN.js.map +1 -0
- package/dist/chunk-IROUDQSO.js +246 -0
- package/dist/chunk-IROUDQSO.js.map +1 -0
- package/dist/chunk-IS3HHGL4.js +250 -0
- package/dist/chunk-IS3HHGL4.js.map +1 -0
- package/dist/chunk-JJLEVKG7.js +576 -0
- package/dist/chunk-JJLEVKG7.js.map +1 -0
- package/dist/{chunk-UJNHKFBR.cjs → chunk-K34R4R2T.cjs} +72 -6
- package/dist/chunk-K34R4R2T.cjs.map +1 -0
- package/dist/chunk-K4HSW5ZF.js +77 -0
- package/dist/chunk-K4HSW5ZF.js.map +1 -0
- package/dist/{chunk-ZODCSH2W.cjs → chunk-L2U75ERO.cjs} +54 -32
- package/dist/chunk-L2U75ERO.cjs.map +1 -0
- package/dist/chunk-L2VZFGWH.cjs +31787 -0
- package/dist/chunk-L2VZFGWH.cjs.map +1 -0
- package/dist/chunk-L7LB66KK.cjs +450 -0
- package/dist/chunk-L7LB66KK.cjs.map +1 -0
- package/dist/chunk-LJ6YRVDI.cjs +15 -0
- package/dist/chunk-LJ6YRVDI.cjs.map +1 -0
- package/dist/{chunk-2NW6POYK.cjs → chunk-MCYD5LW7.cjs} +19 -18
- package/dist/chunk-MCYD5LW7.cjs.map +1 -0
- package/dist/{chunk-6DTV6NEW.js → chunk-MF4PZE2D.js} +11 -8
- package/dist/chunk-MF4PZE2D.js.map +1 -0
- package/dist/{chunk-35NT4TMQ.cjs → chunk-MP6TNZXA.cjs} +66 -55
- package/dist/chunk-MP6TNZXA.cjs.map +1 -0
- package/dist/chunk-MPM2W4IS.js +312 -0
- package/dist/chunk-MPM2W4IS.js.map +1 -0
- package/dist/chunk-NE4CLM6P.cjs +190 -0
- package/dist/chunk-NE4CLM6P.cjs.map +1 -0
- package/dist/chunk-NL6ELCFS.cjs +603 -0
- package/dist/chunk-NL6ELCFS.cjs.map +1 -0
- package/dist/{chunk-MWQQRVQC.cjs → chunk-OD6Y7FEM.cjs} +34 -13
- package/dist/chunk-OD6Y7FEM.cjs.map +1 -0
- package/dist/chunk-OS7SAIRA.js +250 -0
- package/dist/chunk-OS7SAIRA.js.map +1 -0
- package/dist/chunk-PWXUI3OG.cjs +252 -0
- package/dist/chunk-PWXUI3OG.cjs.map +1 -0
- package/dist/{chunk-UOFV2ZCI.js → chunk-QAXO2LQT.js} +316 -96
- package/dist/chunk-QAXO2LQT.js.map +1 -0
- package/dist/chunk-RIX6WEJ2.js +83 -0
- package/dist/chunk-RIX6WEJ2.js.map +1 -0
- package/dist/{chunk-FXDZLX2Y.js → chunk-RRVA4RVW.js} +37 -26
- package/dist/chunk-RRVA4RVW.js.map +1 -0
- package/dist/{chunk-LPM6BBAX.cjs → chunk-SLDAFSKJ.cjs} +5 -56
- package/dist/chunk-SLDAFSKJ.cjs.map +1 -0
- package/dist/{chunk-2PLXW4ZX.cjs → chunk-T6YYVQHJ.cjs} +74 -74
- package/dist/chunk-T6YYVQHJ.cjs.map +1 -0
- package/dist/chunk-TF4LSD27.cjs +180 -0
- package/dist/chunk-TF4LSD27.cjs.map +1 -0
- package/dist/chunk-TM6IOINJ.cjs +252 -0
- package/dist/chunk-TM6IOINJ.cjs.map +1 -0
- package/dist/{chunk-ICANWSEW.js → chunk-UVE6SV6I.js} +25 -20
- package/dist/chunk-UVE6SV6I.js.map +1 -0
- package/dist/{chunk-V5WWQN7P.cjs → chunk-UWYAL2Z3.cjs} +13 -2
- package/dist/chunk-UWYAL2Z3.cjs.map +1 -0
- package/dist/{chunk-UZ6CYAOG.cjs → chunk-VES6QKOW.cjs} +64 -14
- package/dist/chunk-VES6QKOW.cjs.map +1 -0
- package/dist/{chunk-VQAT5HX6.js → chunk-W7HAZD2A.js} +458 -116
- package/dist/chunk-W7HAZD2A.js.map +1 -0
- package/dist/{chunk-4ECGVOJZ.cjs → chunk-WNQUNLRT.cjs} +40 -33
- package/dist/chunk-WNQUNLRT.cjs.map +1 -0
- package/dist/chunk-XKLJYRAA.js +77 -0
- package/dist/chunk-XKLJYRAA.js.map +1 -0
- package/dist/{dist-G2BYZJOC.cjs → dist-2GQKYJ34.cjs} +28 -28
- package/dist/dist-2GQKYJ34.cjs.map +1 -0
- package/dist/{dist-X7XR3M3Z.js → dist-C6BUHOEE.js} +3 -3
- package/dist/dist-C6BUHOEE.js.map +1 -0
- package/dist/dist-DGOEFPQD.cjs +16 -0
- package/dist/{dist-P4MXBQ3U.cjs.map → dist-DGOEFPQD.cjs.map} +1 -1
- package/dist/dist-FT2OR7OS.js +3 -0
- package/dist/{dist-YREX2TJT.js.map → dist-FT2OR7OS.js.map} +1 -1
- package/dist/{dist-XVBSOGFK.js → dist-G4CR4WYY.js} +3 -3
- package/dist/dist-G4CR4WYY.js.map +1 -0
- package/dist/{dist-PQZUVLPC.js → dist-G5QFRYLQ.js} +3 -3
- package/dist/dist-G5QFRYLQ.js.map +1 -0
- package/dist/{dist-4MVGNSRL.cjs → dist-JPQK5S4K.cjs} +20 -20
- package/dist/dist-JPQK5S4K.cjs.map +1 -0
- package/dist/{dist-R7WYX6LC.js → dist-MIDN25GT.js} +3 -3
- package/dist/dist-MIDN25GT.js.map +1 -0
- package/dist/{dist-RFMYFILX.cjs → dist-SNKH6NS2.cjs} +30 -30
- package/dist/dist-SNKH6NS2.cjs.map +1 -0
- package/dist/{dist-FZYCV3VB.cjs → dist-XBQPKAO4.cjs} +26 -26
- package/dist/dist-XBQPKAO4.cjs.map +1 -0
- package/dist/docs/README.md +31 -0
- package/dist/docs/SKILL.md +32 -0
- package/dist/docs/SOURCE_MAP.json +6 -0
- package/dist/docs/server/01-custom-adapters.md +380 -0
- package/dist/docs/server/02-reference.md +819 -0
- package/dist/server/auth/defaults.d.ts +3 -0
- package/dist/server/auth/defaults.d.ts.map +1 -0
- package/dist/server/auth/helpers.d.ts +14 -0
- package/dist/server/auth/helpers.d.ts.map +1 -0
- package/dist/server/auth/index.cjs +44 -0
- package/dist/server/auth/index.cjs.map +1 -0
- package/dist/server/auth/index.d.ts +3 -0
- package/dist/server/auth/index.d.ts.map +1 -0
- package/dist/server/auth/index.js +3 -0
- package/dist/server/auth/index.js.map +1 -0
- package/dist/server/auth/path-pattern.d.ts +43 -0
- package/dist/server/auth/path-pattern.d.ts.map +1 -0
- package/dist/server/handlers/a2a.cjs +9 -9
- package/dist/server/handlers/a2a.d.ts +34 -420
- package/dist/server/handlers/a2a.d.ts.map +1 -1
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +16 -28
- package/dist/server/handlers/agent-builder.d.ts +154 -460
- package/dist/server/handlers/agent-builder.d.ts.map +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agent-versions.cjs +60 -0
- package/dist/server/handlers/agent-versions.cjs.map +1 -0
- package/dist/server/handlers/agent-versions.d.ts +425 -0
- package/dist/server/handlers/agent-versions.d.ts.map +1 -0
- package/dist/server/handlers/agent-versions.js +3 -0
- package/dist/server/handlers/agent-versions.js.map +1 -0
- package/dist/server/handlers/agents.cjs +43 -23
- package/dist/server/handlers/agents.d.ts +362 -2912
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/error.cjs +6 -2
- package/dist/server/handlers/error.d.ts +22 -0
- package/dist/server/handlers/error.d.ts.map +1 -1
- package/dist/server/handlers/error.js +1 -1
- package/dist/server/handlers/logs.cjs +4 -4
- package/dist/server/handlers/logs.d.ts +63 -111
- package/dist/server/handlers/logs.d.ts.map +1 -1
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/mcp.cjs +40 -0
- package/dist/server/handlers/mcp.cjs.map +1 -0
- package/dist/server/handlers/mcp.d.ts +92 -0
- package/dist/server/handlers/mcp.d.ts.map +1 -0
- package/dist/server/handlers/mcp.js +3 -0
- package/dist/server/handlers/mcp.js.map +1 -0
- package/dist/server/handlers/memory.cjs +28 -24
- package/dist/server/handlers/memory.d.ts +244 -756
- package/dist/server/handlers/memory.d.ts.map +1 -1
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/observability.cjs +7 -23
- package/dist/server/handlers/observability.d.ts +97 -114
- package/dist/server/handlers/observability.d.ts.map +1 -1
- package/dist/server/handlers/observability.js +1 -1
- package/dist/server/handlers/processors.cjs +20 -0
- package/dist/server/handlers/processors.cjs.map +1 -0
- package/dist/server/handlers/processors.d.ts +90 -0
- package/dist/server/handlers/processors.d.ts.map +1 -0
- package/dist/server/handlers/processors.js +3 -0
- package/dist/server/handlers/processors.js.map +1 -0
- package/dist/server/handlers/scores.cjs +7 -7
- package/dist/server/handlers/scores.d.ts +18 -54
- package/dist/server/handlers/scores.d.ts.map +1 -1
- package/dist/server/handlers/scores.js +1 -1
- package/dist/server/handlers/stored-agents.cjs +28 -0
- package/dist/server/handlers/stored-agents.cjs.map +1 -0
- package/dist/server/handlers/stored-agents.d.ts +214 -0
- package/dist/server/handlers/stored-agents.d.ts.map +1 -0
- package/dist/server/handlers/stored-agents.js +3 -0
- package/dist/server/handlers/stored-agents.js.map +1 -0
- package/dist/server/handlers/system.cjs +12 -0
- package/dist/server/handlers/system.cjs.map +1 -0
- package/dist/server/handlers/system.d.ts +7 -0
- package/dist/server/handlers/system.d.ts.map +1 -0
- package/dist/server/handlers/system.js +3 -0
- package/dist/server/handlers/system.js.map +1 -0
- package/dist/server/handlers/test-utils.cjs +2 -2
- package/dist/server/handlers/test-utils.cjs.map +1 -1
- package/dist/server/handlers/test-utils.d.ts +3 -3
- package/dist/server/handlers/test-utils.d.ts.map +1 -1
- package/dist/server/handlers/test-utils.js +2 -2
- package/dist/server/handlers/test-utils.js.map +1 -1
- package/dist/server/handlers/tools.cjs +6 -6
- package/dist/server/handlers/tools.d.ts +7 -36
- package/dist/server/handlers/tools.d.ts.map +1 -1
- package/dist/server/handlers/tools.js +1 -1
- package/dist/server/handlers/vector.cjs +13 -13
- package/dist/server/handlers/vector.d.ts +16 -57
- package/dist/server/handlers/vector.d.ts.map +1 -1
- package/dist/server/handlers/vector.js +1 -1
- package/dist/server/handlers/voice.cjs +8 -8
- package/dist/server/handlers/voice.d.ts +18 -56
- package/dist/server/handlers/voice.d.ts.map +1 -1
- package/dist/server/handlers/voice.js +1 -1
- package/dist/server/handlers/workflows.cjs +46 -26
- package/dist/server/handlers/workflows.d.ts +358 -533
- package/dist/server/handlers/workflows.d.ts.map +1 -1
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +36 -31
- package/dist/server/handlers.d.ts +1 -0
- package/dist/server/handlers.d.ts.map +1 -1
- package/dist/server/handlers.js +12 -11
- package/dist/server/schemas/a2a.d.ts +56 -700
- package/dist/server/schemas/a2a.d.ts.map +1 -1
- package/dist/server/schemas/agent-builder.d.ts +26 -143
- package/dist/server/schemas/agent-builder.d.ts.map +1 -1
- package/dist/server/schemas/agent-versions.d.ts +379 -0
- package/dist/server/schemas/agent-versions.d.ts.map +1 -0
- package/dist/server/schemas/agents.d.ts +152 -1031
- package/dist/server/schemas/agents.d.ts.map +1 -1
- package/dist/server/schemas/common.d.ts +37 -103
- package/dist/server/schemas/common.d.ts.map +1 -1
- package/dist/server/schemas/logs.d.ts +38 -106
- package/dist/server/schemas/logs.d.ts.map +1 -1
- package/dist/server/schemas/mcp.d.ts +91 -0
- package/dist/server/schemas/mcp.d.ts.map +1 -0
- package/dist/server/schemas/memory.d.ts +288 -831
- package/dist/server/schemas/memory.d.ts.map +1 -1
- package/dist/server/schemas/processors.d.ts +162 -0
- package/dist/server/schemas/processors.d.ts.map +1 -0
- package/dist/server/schemas/scores.d.ts +31 -213
- package/dist/server/schemas/scores.d.ts.map +1 -1
- package/dist/server/schemas/stored-agents.d.ts +274 -0
- package/dist/server/schemas/stored-agents.d.ts.map +1 -0
- package/dist/server/schemas/system.d.ts +14 -0
- package/dist/server/schemas/system.d.ts.map +1 -0
- package/dist/server/schemas/vectors.d.ts +21 -81
- package/dist/server/schemas/vectors.d.ts.map +1 -1
- package/dist/server/schemas/workflows.d.ts +248 -382
- package/dist/server/schemas/workflows.d.ts.map +1 -1
- package/dist/server/server-adapter/index.cjs +441 -137
- package/dist/server/server-adapter/index.cjs.map +1 -1
- package/dist/server/server-adapter/index.d.ts +94 -16
- package/dist/server/server-adapter/index.d.ts.map +1 -1
- package/dist/server/server-adapter/index.js +325 -35
- package/dist/server/server-adapter/index.js.map +1 -1
- package/dist/server/server-adapter/redact.d.ts +26 -0
- package/dist/server/server-adapter/redact.d.ts.map +1 -0
- package/dist/server/server-adapter/routes/agent-builder.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/agents.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/index.d.ts +18 -7
- package/dist/server/server-adapter/routes/index.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/mcp.d.ts +9 -0
- package/dist/server/server-adapter/routes/mcp.d.ts.map +1 -0
- package/dist/server/server-adapter/routes/memory.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/processors.d.ts +3 -0
- package/dist/server/server-adapter/routes/processors.d.ts.map +1 -0
- package/dist/server/server-adapter/routes/route-builder.d.ts +66 -6
- package/dist/server/server-adapter/routes/route-builder.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/stored-agents.d.ts +8 -0
- package/dist/server/server-adapter/routes/stored-agents.d.ts.map +1 -0
- package/dist/server/server-adapter/routes/system.d.ts +12 -0
- package/dist/server/server-adapter/routes/system.d.ts.map +1 -0
- package/dist/server/server-adapter/routes/workflows.d.ts.map +1 -1
- package/dist/server/utils.d.ts +1 -1
- package/dist/server/utils.d.ts.map +1 -1
- package/dist/{token-375W3LEI.cjs → token-6GSAFR2W-ABXTQD64-MC4IMVOB.cjs} +11 -12
- package/dist/token-6GSAFR2W-ABXTQD64-MC4IMVOB.cjs.map +1 -0
- package/dist/{token-C3IMNCC4.js → token-6GSAFR2W-ABXTQD64-Z6U2TA2C.js} +8 -9
- package/dist/token-6GSAFR2W-ABXTQD64-Z6U2TA2C.js.map +1 -0
- package/dist/token-6GSAFR2W-F2L44NEJ-B3QIV63M.cjs +63 -0
- package/dist/token-6GSAFR2W-F2L44NEJ-B3QIV63M.cjs.map +1 -0
- package/dist/token-6GSAFR2W-F2L44NEJ-GFZ37A2V.js +61 -0
- package/dist/token-6GSAFR2W-F2L44NEJ-GFZ37A2V.js.map +1 -0
- package/dist/token-6GSAFR2W-WGTMOPEU-6HSZQUFZ.cjs +63 -0
- package/dist/token-6GSAFR2W-WGTMOPEU-6HSZQUFZ.cjs.map +1 -0
- package/dist/token-6GSAFR2W-WGTMOPEU-JKP67ZX4.js +61 -0
- package/dist/token-6GSAFR2W-WGTMOPEU-JKP67ZX4.js.map +1 -0
- package/dist/token-util-NEHG7TUY-4YJ4EPCL-MBTAVIJ3.js +8 -0
- package/dist/token-util-NEHG7TUY-4YJ4EPCL-MBTAVIJ3.js.map +1 -0
- package/dist/token-util-NEHG7TUY-4YJ4EPCL-SQ4NADRW.cjs +10 -0
- package/dist/token-util-NEHG7TUY-4YJ4EPCL-SQ4NADRW.cjs.map +1 -0
- package/dist/token-util-NEHG7TUY-TV2H7N56-GGCGMPDG.js +8 -0
- package/dist/token-util-NEHG7TUY-TV2H7N56-GGCGMPDG.js.map +1 -0
- package/dist/token-util-NEHG7TUY-TV2H7N56-R7OENTCJ.cjs +10 -0
- package/dist/token-util-NEHG7TUY-TV2H7N56-R7OENTCJ.cjs.map +1 -0
- package/dist/token-util-NEHG7TUY-XQP3QSPX-BL5O5N7R.cjs +10 -0
- package/dist/token-util-NEHG7TUY-XQP3QSPX-BL5O5N7R.cjs.map +1 -0
- package/dist/token-util-NEHG7TUY-XQP3QSPX-YCJRRNXO.js +8 -0
- package/dist/token-util-NEHG7TUY-XQP3QSPX-YCJRRNXO.js.map +1 -0
- package/handlers/server/handlers.d.ts +1 -0
- package/handlers.d.ts +1 -0
- package/package.json +29 -17
- package/server-adapter.d.ts +1 -0
- package/dist/chunk-2NW6POYK.cjs.map +0 -1
- package/dist/chunk-2PLXW4ZX.cjs.map +0 -1
- package/dist/chunk-35NT4TMQ.cjs.map +0 -1
- package/dist/chunk-3R5EV3HV.js.map +0 -1
- package/dist/chunk-4ECGVOJZ.cjs.map +0 -1
- package/dist/chunk-5PONYNYP.cjs.map +0 -1
- package/dist/chunk-6BISSAIF.js +0 -23494
- package/dist/chunk-6BISSAIF.js.map +0 -1
- package/dist/chunk-6DTV6NEW.js.map +0 -1
- package/dist/chunk-AEO6IHLK.cjs +0 -368
- package/dist/chunk-AEO6IHLK.cjs.map +0 -1
- package/dist/chunk-ASZUOBKV.js.map +0 -1
- package/dist/chunk-ECIVTQ4E.js +0 -354
- package/dist/chunk-ECIVTQ4E.js.map +0 -1
- package/dist/chunk-FAQICBMH.js.map +0 -1
- package/dist/chunk-FXDZLX2Y.js.map +0 -1
- package/dist/chunk-G7BPNX2V.js.map +0 -1
- package/dist/chunk-I5VZ5SKG.js.map +0 -1
- package/dist/chunk-ICANWSEW.js.map +0 -1
- package/dist/chunk-KB5NSROG.cjs.map +0 -1
- package/dist/chunk-LPM6BBAX.cjs.map +0 -1
- package/dist/chunk-MWQQRVQC.cjs.map +0 -1
- package/dist/chunk-NDFAQBQD.cjs.map +0 -1
- package/dist/chunk-PKRHEXX7.js.map +0 -1
- package/dist/chunk-QGWCNTG6.cjs.map +0 -1
- package/dist/chunk-QU6N55W6.cjs.map +0 -1
- package/dist/chunk-R4M3BSUG.js.map +0 -1
- package/dist/chunk-RQK4FQUD.js.map +0 -1
- package/dist/chunk-SHWNNZBL.js.map +0 -1
- package/dist/chunk-TBVUN4XN.cjs +0 -23536
- package/dist/chunk-TBVUN4XN.cjs.map +0 -1
- package/dist/chunk-TOCYBDP2.js +0 -46
- package/dist/chunk-TOCYBDP2.js.map +0 -1
- package/dist/chunk-UJNHKFBR.cjs.map +0 -1
- package/dist/chunk-UOFV2ZCI.js.map +0 -1
- package/dist/chunk-UXGQZUYZ.js.map +0 -1
- package/dist/chunk-UZ6CYAOG.cjs.map +0 -1
- package/dist/chunk-V5WWQN7P.cjs.map +0 -1
- package/dist/chunk-VQAT5HX6.js.map +0 -1
- package/dist/chunk-X6C7BUWN.cjs +0 -48
- package/dist/chunk-X6C7BUWN.cjs.map +0 -1
- package/dist/chunk-YJ3VDL3Z.cjs.map +0 -1
- package/dist/chunk-Z36N2OQA.cjs.map +0 -1
- package/dist/chunk-ZLRTFRL4.js.map +0 -1
- package/dist/chunk-ZODCSH2W.cjs.map +0 -1
- package/dist/chunk-ZULZ2752.js.map +0 -1
- package/dist/dist-4MVGNSRL.cjs.map +0 -1
- package/dist/dist-FZYCV3VB.cjs.map +0 -1
- package/dist/dist-G2BYZJOC.cjs.map +0 -1
- package/dist/dist-P4MXBQ3U.cjs +0 -16
- package/dist/dist-PQZUVLPC.js.map +0 -1
- package/dist/dist-R7WYX6LC.js.map +0 -1
- package/dist/dist-RFMYFILX.cjs.map +0 -1
- package/dist/dist-X7XR3M3Z.js.map +0 -1
- package/dist/dist-XVBSOGFK.js.map +0 -1
- package/dist/dist-YREX2TJT.js +0 -3
- package/dist/server/schemas/observability.d.ts +0 -402
- package/dist/server/schemas/observability.d.ts.map +0 -1
- package/dist/token-375W3LEI.cjs.map +0 -1
- package/dist/token-C3IMNCC4.js.map +0 -1
- package/dist/token-util-CV3RRG6K.cjs +0 -9
- package/dist/token-util-CV3RRG6K.cjs.map +0 -1
- package/dist/token-util-E5QO2RCL.js +0 -7
- package/dist/token-util-E5QO2RCL.js.map +0 -1
|
@@ -1,35 +1,52 @@
|
|
|
1
|
-
import { getWorkflowInfo, WorkflowRegistry } from './chunk-
|
|
2
|
-
import { streamResponseSchema } from './chunk-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { handleError } from './chunk-UXGQZUYZ.js';
|
|
1
|
+
import { getWorkflowInfo, WorkflowRegistry } from './chunk-2JNW2CLE.js';
|
|
2
|
+
import { streamResponseSchema } from './chunk-DOU5IGJB.js';
|
|
3
|
+
import { createCombinedPaginationSchema, tracingOptionsSchema, messageResponseSchema, optionalRunIdSchema, runIdSchema } from './chunk-HT4LP3BO.js';
|
|
4
|
+
import { handleError } from './chunk-7AINN3FK.js';
|
|
6
5
|
import { HTTPException } from './chunk-6QWQZI4Q.js';
|
|
6
|
+
import { createRoute } from './chunk-D23WBCJ6.js';
|
|
7
7
|
import { __export } from './chunk-PR4QN5HX.js';
|
|
8
8
|
import { TransformStream, ReadableStream } from 'stream/web';
|
|
9
|
-
import z from 'zod';
|
|
9
|
+
import z, { z as z$1 } from 'zod';
|
|
10
10
|
|
|
11
11
|
// src/server/handlers/workflows.ts
|
|
12
12
|
var workflows_exports = {};
|
|
13
13
|
__export(workflows_exports, {
|
|
14
14
|
CANCEL_WORKFLOW_RUN_ROUTE: () => CANCEL_WORKFLOW_RUN_ROUTE,
|
|
15
15
|
CREATE_WORKFLOW_RUN_ROUTE: () => CREATE_WORKFLOW_RUN_ROUTE,
|
|
16
|
+
DELETE_WORKFLOW_RUN_BY_ID_ROUTE: () => DELETE_WORKFLOW_RUN_BY_ID_ROUTE,
|
|
16
17
|
GET_WORKFLOW_BY_ID_ROUTE: () => GET_WORKFLOW_BY_ID_ROUTE,
|
|
17
18
|
GET_WORKFLOW_RUN_BY_ID_ROUTE: () => GET_WORKFLOW_RUN_BY_ID_ROUTE,
|
|
18
|
-
GET_WORKFLOW_RUN_EXECUTION_RESULT_ROUTE: () => GET_WORKFLOW_RUN_EXECUTION_RESULT_ROUTE,
|
|
19
19
|
LIST_WORKFLOWS_ROUTE: () => LIST_WORKFLOWS_ROUTE,
|
|
20
20
|
LIST_WORKFLOW_RUNS_ROUTE: () => LIST_WORKFLOW_RUNS_ROUTE,
|
|
21
21
|
OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE: () => OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE,
|
|
22
|
-
OBSERVE_STREAM_VNEXT_WORKFLOW_ROUTE: () => OBSERVE_STREAM_VNEXT_WORKFLOW_ROUTE,
|
|
23
22
|
OBSERVE_STREAM_WORKFLOW_ROUTE: () => OBSERVE_STREAM_WORKFLOW_ROUTE,
|
|
23
|
+
RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ASYNC_ROUTE: () => RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ASYNC_ROUTE,
|
|
24
|
+
RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ROUTE: () => RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ROUTE,
|
|
25
|
+
RESTART_ASYNC_WORKFLOW_ROUTE: () => RESTART_ASYNC_WORKFLOW_ROUTE,
|
|
26
|
+
RESTART_WORKFLOW_ROUTE: () => RESTART_WORKFLOW_ROUTE,
|
|
24
27
|
RESUME_ASYNC_WORKFLOW_ROUTE: () => RESUME_ASYNC_WORKFLOW_ROUTE,
|
|
25
28
|
RESUME_STREAM_WORKFLOW_ROUTE: () => RESUME_STREAM_WORKFLOW_ROUTE,
|
|
26
29
|
RESUME_WORKFLOW_ROUTE: () => RESUME_WORKFLOW_ROUTE,
|
|
27
30
|
START_ASYNC_WORKFLOW_ROUTE: () => START_ASYNC_WORKFLOW_ROUTE,
|
|
28
31
|
START_WORKFLOW_RUN_ROUTE: () => START_WORKFLOW_RUN_ROUTE,
|
|
29
32
|
STREAM_LEGACY_WORKFLOW_ROUTE: () => STREAM_LEGACY_WORKFLOW_ROUTE,
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
STREAM_WORKFLOW_ROUTE: () => STREAM_WORKFLOW_ROUTE,
|
|
34
|
+
TIME_TRAVEL_ASYNC_WORKFLOW_ROUTE: () => TIME_TRAVEL_ASYNC_WORKFLOW_ROUTE,
|
|
35
|
+
TIME_TRAVEL_STREAM_WORKFLOW_ROUTE: () => TIME_TRAVEL_STREAM_WORKFLOW_ROUTE,
|
|
36
|
+
TIME_TRAVEL_WORKFLOW_ROUTE: () => TIME_TRAVEL_WORKFLOW_ROUTE
|
|
32
37
|
});
|
|
38
|
+
var workflowRunStatusSchema = z.enum([
|
|
39
|
+
"running",
|
|
40
|
+
"waiting",
|
|
41
|
+
"suspended",
|
|
42
|
+
"success",
|
|
43
|
+
"failed",
|
|
44
|
+
"canceled",
|
|
45
|
+
"pending",
|
|
46
|
+
"bailed",
|
|
47
|
+
"tripwire",
|
|
48
|
+
"paused"
|
|
49
|
+
]);
|
|
33
50
|
var workflowIdPathParams = z.object({
|
|
34
51
|
workflowId: z.string().describe("Unique identifier for the workflow")
|
|
35
52
|
});
|
|
@@ -38,7 +55,14 @@ var workflowRunPathParams = workflowIdPathParams.extend({
|
|
|
38
55
|
});
|
|
39
56
|
var serializedStepSchema = z.object({
|
|
40
57
|
id: z.string(),
|
|
41
|
-
description: z.string().optional()
|
|
58
|
+
description: z.string().optional(),
|
|
59
|
+
stateSchema: z.string().optional(),
|
|
60
|
+
inputSchema: z.string().optional(),
|
|
61
|
+
outputSchema: z.string().optional(),
|
|
62
|
+
resumeSchema: z.string().optional(),
|
|
63
|
+
suspendSchema: z.string().optional(),
|
|
64
|
+
component: z.string().optional(),
|
|
65
|
+
isWorkflow: z.boolean().optional()
|
|
42
66
|
});
|
|
43
67
|
var serializedStepFlowEntrySchema = z.object({
|
|
44
68
|
type: z.enum(["step", "sleep", "sleepUntil", "waitForEvent", "parallel", "conditional", "loop", "foreach"])
|
|
@@ -51,7 +75,9 @@ var workflowInfoSchema = z.object({
|
|
|
51
75
|
stepGraph: z.array(serializedStepFlowEntrySchema),
|
|
52
76
|
inputSchema: z.string().optional(),
|
|
53
77
|
outputSchema: z.string().optional(),
|
|
54
|
-
|
|
78
|
+
stateSchema: z.string().optional(),
|
|
79
|
+
options: z.object({}).optional(),
|
|
80
|
+
isProcessorWorkflow: z.boolean().optional()
|
|
55
81
|
});
|
|
56
82
|
var listWorkflowsResponseSchema = z.record(z.string(), workflowInfoSchema);
|
|
57
83
|
var workflowRunSchema = z.object({
|
|
@@ -66,16 +92,19 @@ var workflowRunsResponseSchema = z.object({
|
|
|
66
92
|
runs: z.array(workflowRunSchema),
|
|
67
93
|
total: z.number()
|
|
68
94
|
});
|
|
69
|
-
var
|
|
70
|
-
var listWorkflowRunsQuerySchema = createOffsetPaginationSchema().extend({
|
|
95
|
+
var listWorkflowRunsQuerySchema = createCombinedPaginationSchema().extend({
|
|
71
96
|
fromDate: z.coerce.date().optional(),
|
|
72
97
|
toDate: z.coerce.date().optional(),
|
|
73
|
-
resourceId: z.string().optional()
|
|
98
|
+
resourceId: z.string().optional(),
|
|
99
|
+
status: workflowRunStatusSchema.optional()
|
|
74
100
|
});
|
|
75
101
|
var workflowExecutionBodySchema = z.object({
|
|
102
|
+
resourceId: z.string().optional(),
|
|
76
103
|
inputData: z.unknown().optional(),
|
|
104
|
+
initialState: z.unknown().optional(),
|
|
77
105
|
requestContext: z.record(z.string(), z.unknown()).optional(),
|
|
78
|
-
tracingOptions: tracingOptionsSchema.optional()
|
|
106
|
+
tracingOptions: tracingOptionsSchema.optional(),
|
|
107
|
+
perStep: z.boolean().optional()
|
|
79
108
|
});
|
|
80
109
|
var streamLegacyWorkflowBodySchema = workflowExecutionBodySchema;
|
|
81
110
|
var streamWorkflowBodySchema = workflowExecutionBodySchema.extend({
|
|
@@ -85,23 +114,90 @@ var resumeBodySchema = z.object({
|
|
|
85
114
|
step: z.union([z.string(), z.array(z.string())]).optional(),
|
|
86
115
|
// Optional - workflow can auto-resume all suspended steps
|
|
87
116
|
resumeData: z.unknown().optional(),
|
|
117
|
+
requestContext: z.record(z.string(), z.unknown()).optional(),
|
|
118
|
+
tracingOptions: tracingOptionsSchema.optional(),
|
|
119
|
+
perStep: z.boolean().optional()
|
|
120
|
+
});
|
|
121
|
+
var restartBodySchema = z.object({
|
|
88
122
|
requestContext: z.record(z.string(), z.unknown()).optional(),
|
|
89
123
|
tracingOptions: tracingOptionsSchema.optional()
|
|
90
124
|
});
|
|
125
|
+
var timeTravelBodySchema = z.object({
|
|
126
|
+
inputData: z.unknown().optional(),
|
|
127
|
+
resumeData: z.unknown().optional(),
|
|
128
|
+
initialState: z.unknown().optional(),
|
|
129
|
+
step: z.union([z.string(), z.array(z.string())]),
|
|
130
|
+
context: z.record(z.string(), z.any()).optional(),
|
|
131
|
+
nestedStepsContext: z.record(z.string(), z.record(z.string(), z.any())).optional(),
|
|
132
|
+
requestContext: z.record(z.string(), z.unknown()).optional(),
|
|
133
|
+
tracingOptions: tracingOptionsSchema.optional(),
|
|
134
|
+
perStep: z.boolean().optional()
|
|
135
|
+
});
|
|
91
136
|
var startAsyncWorkflowBodySchema = workflowExecutionBodySchema;
|
|
92
137
|
z.object({
|
|
93
138
|
event: z.string(),
|
|
94
139
|
data: z.unknown()
|
|
95
140
|
});
|
|
141
|
+
var VALID_WORKFLOW_RESULT_FIELDS = /* @__PURE__ */ new Set([
|
|
142
|
+
"result",
|
|
143
|
+
"error",
|
|
144
|
+
"payload",
|
|
145
|
+
"steps",
|
|
146
|
+
"activeStepsPath",
|
|
147
|
+
"serializedStepGraph"
|
|
148
|
+
]);
|
|
149
|
+
var WORKFLOW_RESULT_FIELDS_ERROR = "Invalid field name. Available fields: result, error, payload, steps, activeStepsPath, serializedStepGraph";
|
|
150
|
+
var createFieldsValidator = (description) => z.string().optional().refine(
|
|
151
|
+
(value) => {
|
|
152
|
+
if (!value) return true;
|
|
153
|
+
const requestedFields = value.split(",").map((f) => f.trim());
|
|
154
|
+
return requestedFields.every((field) => VALID_WORKFLOW_RESULT_FIELDS.has(field));
|
|
155
|
+
},
|
|
156
|
+
{ message: WORKFLOW_RESULT_FIELDS_ERROR }
|
|
157
|
+
).describe(description);
|
|
158
|
+
var withNestedWorkflowsField = z.enum(["true", "false"]).optional().describe("Whether to include nested workflow data in steps. Defaults to true. Set to false for better performance.");
|
|
96
159
|
var workflowExecutionResultSchema = z.object({
|
|
97
|
-
status:
|
|
160
|
+
status: workflowRunStatusSchema.optional(),
|
|
98
161
|
result: z.unknown().optional(),
|
|
99
|
-
error: z.unknown().optional()
|
|
162
|
+
error: z.unknown().optional(),
|
|
163
|
+
payload: z.unknown().optional(),
|
|
164
|
+
initialState: z.unknown().optional(),
|
|
165
|
+
steps: z.record(z.string(), z.any()).optional(),
|
|
166
|
+
activeStepsPath: z.record(z.string(), z.array(z.number())).optional(),
|
|
167
|
+
serializedStepGraph: z.array(serializedStepFlowEntrySchema).optional()
|
|
168
|
+
});
|
|
169
|
+
var workflowRunResultQuerySchema = z.object({
|
|
170
|
+
fields: createFieldsValidator(
|
|
171
|
+
"Comma-separated list of fields to return. Available fields: result, error, payload, steps, activeStepsPath, serializedStepGraph. Metadata fields (runId, workflowName, resourceId, createdAt, updatedAt) and status are always included."
|
|
172
|
+
),
|
|
173
|
+
withNestedWorkflows: withNestedWorkflowsField
|
|
174
|
+
});
|
|
175
|
+
var workflowRunResultSchema = z.object({
|
|
176
|
+
// Metadata - always present
|
|
177
|
+
runId: z.string(),
|
|
178
|
+
workflowName: z.string(),
|
|
179
|
+
resourceId: z.string().optional(),
|
|
180
|
+
createdAt: z.date(),
|
|
181
|
+
updatedAt: z.date(),
|
|
182
|
+
// Execution state
|
|
183
|
+
status: workflowRunStatusSchema,
|
|
184
|
+
initialState: z.record(z.string(), z.any()).optional(),
|
|
185
|
+
result: z.unknown().optional(),
|
|
186
|
+
error: z.unknown().optional(),
|
|
187
|
+
payload: z.unknown().optional(),
|
|
188
|
+
steps: z.record(z.string(), z.any()).optional(),
|
|
189
|
+
// Optional detailed fields
|
|
190
|
+
activeStepsPath: z.record(z.string(), z.array(z.number())).optional(),
|
|
191
|
+
serializedStepGraph: z.array(serializedStepFlowEntrySchema).optional()
|
|
100
192
|
});
|
|
101
193
|
var workflowControlResponseSchema = messageResponseSchema;
|
|
102
194
|
var createWorkflowRunResponseSchema = z.object({
|
|
103
195
|
runId: z.string()
|
|
104
196
|
});
|
|
197
|
+
var createWorkflowRunBodySchema = z.object({
|
|
198
|
+
resourceId: z.string().optional(),
|
|
199
|
+
disableScorers: z.boolean().optional()
|
|
200
|
+
});
|
|
105
201
|
|
|
106
202
|
// src/server/handlers/workflows.ts
|
|
107
203
|
async function listWorkflowsFromSystem({ mastra, workflowId }) {
|
|
@@ -143,35 +239,41 @@ async function listWorkflowsFromSystem({ mastra, workflowId }) {
|
|
|
143
239
|
}
|
|
144
240
|
var LIST_WORKFLOWS_ROUTE = createRoute({
|
|
145
241
|
method: "GET",
|
|
146
|
-
path: "/
|
|
242
|
+
path: "/workflows",
|
|
147
243
|
responseType: "json",
|
|
244
|
+
queryParamSchema: z$1.object({
|
|
245
|
+
partial: z$1.string().optional()
|
|
246
|
+
}),
|
|
148
247
|
responseSchema: listWorkflowsResponseSchema,
|
|
149
248
|
summary: "List all workflows",
|
|
150
249
|
description: "Returns a list of all available workflows in the system",
|
|
151
250
|
tags: ["Workflows"],
|
|
152
|
-
|
|
251
|
+
requiresAuth: true,
|
|
252
|
+
handler: (async ({ mastra, partial }) => {
|
|
153
253
|
try {
|
|
154
254
|
const workflows = mastra.listWorkflows({ serialized: false });
|
|
255
|
+
const isPartial = partial === "true";
|
|
155
256
|
const _workflows = Object.entries(workflows).reduce((acc, [key, workflow]) => {
|
|
156
|
-
acc[key] = getWorkflowInfo(workflow);
|
|
257
|
+
acc[key] = getWorkflowInfo(workflow, isPartial);
|
|
157
258
|
return acc;
|
|
158
259
|
}, {});
|
|
159
260
|
return _workflows;
|
|
160
261
|
} catch (error) {
|
|
161
262
|
return handleError(error, "Error getting workflows");
|
|
162
263
|
}
|
|
163
|
-
}
|
|
264
|
+
})
|
|
164
265
|
});
|
|
165
266
|
var GET_WORKFLOW_BY_ID_ROUTE = createRoute({
|
|
166
267
|
method: "GET",
|
|
167
|
-
path: "/
|
|
268
|
+
path: "/workflows/:workflowId",
|
|
168
269
|
responseType: "json",
|
|
169
270
|
pathParamSchema: workflowIdPathParams,
|
|
170
271
|
responseSchema: workflowInfoSchema,
|
|
171
272
|
summary: "Get workflow by ID",
|
|
172
273
|
description: "Returns details for a specific workflow",
|
|
173
274
|
tags: ["Workflows"],
|
|
174
|
-
|
|
275
|
+
requiresAuth: true,
|
|
276
|
+
handler: (async ({ mastra, workflowId }) => {
|
|
175
277
|
try {
|
|
176
278
|
if (!workflowId) {
|
|
177
279
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
@@ -181,11 +283,11 @@ var GET_WORKFLOW_BY_ID_ROUTE = createRoute({
|
|
|
181
283
|
} catch (error) {
|
|
182
284
|
return handleError(error, "Error getting workflow");
|
|
183
285
|
}
|
|
184
|
-
}
|
|
286
|
+
})
|
|
185
287
|
});
|
|
186
288
|
var LIST_WORKFLOW_RUNS_ROUTE = createRoute({
|
|
187
289
|
method: "GET",
|
|
188
|
-
path: "/
|
|
290
|
+
path: "/workflows/:workflowId/runs",
|
|
189
291
|
responseType: "json",
|
|
190
292
|
pathParamSchema: workflowIdPathParams,
|
|
191
293
|
queryParamSchema: listWorkflowRunsQuerySchema,
|
|
@@ -193,17 +295,24 @@ var LIST_WORKFLOW_RUNS_ROUTE = createRoute({
|
|
|
193
295
|
summary: "List workflow runs",
|
|
194
296
|
description: "Returns a paginated list of execution runs for the specified workflow",
|
|
195
297
|
tags: ["Workflows"],
|
|
196
|
-
|
|
298
|
+
requiresAuth: true,
|
|
299
|
+
handler: (async ({ mastra, workflowId, fromDate, toDate, page, perPage, limit, offset, resourceId, status }) => {
|
|
197
300
|
try {
|
|
198
301
|
if (!workflowId) {
|
|
199
302
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
200
303
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
if (
|
|
204
|
-
|
|
304
|
+
let finalPage = page;
|
|
305
|
+
let finalPerPage = perPage;
|
|
306
|
+
if (finalPerPage === void 0 && limit !== void 0) {
|
|
307
|
+
finalPerPage = limit;
|
|
308
|
+
}
|
|
309
|
+
if (finalPage === void 0 && offset !== void 0 && finalPerPage !== void 0 && finalPerPage > 0) {
|
|
310
|
+
finalPage = Math.floor(offset / finalPerPage);
|
|
205
311
|
}
|
|
206
|
-
if (
|
|
312
|
+
if (finalPerPage !== void 0 && (typeof finalPerPage !== "number" || !Number.isInteger(finalPerPage) || finalPerPage <= 0)) {
|
|
313
|
+
throw new HTTPException(400, { message: "perPage must be a positive integer" });
|
|
314
|
+
}
|
|
315
|
+
if (finalPage !== void 0 && (!Number.isInteger(finalPage) || finalPage < 0)) {
|
|
207
316
|
throw new HTTPException(400, { message: "page must be a non-negative integer" });
|
|
208
317
|
}
|
|
209
318
|
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
@@ -213,9 +322,10 @@ var LIST_WORKFLOW_RUNS_ROUTE = createRoute({
|
|
|
213
322
|
const workflowRuns = await workflow.listWorkflowRuns({
|
|
214
323
|
fromDate: fromDate ? typeof fromDate === "string" ? new Date(fromDate) : fromDate : void 0,
|
|
215
324
|
toDate: toDate ? typeof toDate === "string" ? new Date(toDate) : toDate : void 0,
|
|
216
|
-
perPage,
|
|
217
|
-
page,
|
|
218
|
-
resourceId
|
|
325
|
+
perPage: finalPerPage,
|
|
326
|
+
page: finalPage,
|
|
327
|
+
resourceId,
|
|
328
|
+
status
|
|
219
329
|
}) || {
|
|
220
330
|
runs: [],
|
|
221
331
|
total: 0
|
|
@@ -224,18 +334,20 @@ var LIST_WORKFLOW_RUNS_ROUTE = createRoute({
|
|
|
224
334
|
} catch (error) {
|
|
225
335
|
return handleError(error, "Error getting workflow runs");
|
|
226
336
|
}
|
|
227
|
-
}
|
|
337
|
+
})
|
|
228
338
|
});
|
|
229
339
|
var GET_WORKFLOW_RUN_BY_ID_ROUTE = createRoute({
|
|
230
340
|
method: "GET",
|
|
231
|
-
path: "/
|
|
341
|
+
path: "/workflows/:workflowId/runs/:runId",
|
|
232
342
|
responseType: "json",
|
|
233
343
|
pathParamSchema: workflowRunPathParams,
|
|
234
|
-
|
|
344
|
+
queryParamSchema: workflowRunResultQuerySchema,
|
|
345
|
+
responseSchema: workflowRunResultSchema,
|
|
235
346
|
summary: "Get workflow run by ID",
|
|
236
|
-
description: "Returns
|
|
347
|
+
description: "Returns a workflow run with metadata and processed execution state. Use the fields query parameter to reduce payload size by requesting only specific fields (e.g., ?fields=status,result,metadata)",
|
|
237
348
|
tags: ["Workflows"],
|
|
238
|
-
|
|
349
|
+
requiresAuth: true,
|
|
350
|
+
handler: async ({ mastra, workflowId, runId, fields, withNestedWorkflows }) => {
|
|
239
351
|
try {
|
|
240
352
|
if (!workflowId) {
|
|
241
353
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
@@ -247,7 +359,12 @@ var GET_WORKFLOW_RUN_BY_ID_ROUTE = createRoute({
|
|
|
247
359
|
if (!workflow) {
|
|
248
360
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
249
361
|
}
|
|
250
|
-
const
|
|
362
|
+
const fieldList = fields ? fields.split(",").map((f) => f.trim()) : void 0;
|
|
363
|
+
const run = await workflow.getWorkflowRunById(runId, {
|
|
364
|
+
withNestedWorkflows: withNestedWorkflows !== "false",
|
|
365
|
+
// Default to true unless explicitly 'false'
|
|
366
|
+
fields: fieldList
|
|
367
|
+
});
|
|
251
368
|
if (!run) {
|
|
252
369
|
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
253
370
|
}
|
|
@@ -257,17 +374,48 @@ var GET_WORKFLOW_RUN_BY_ID_ROUTE = createRoute({
|
|
|
257
374
|
}
|
|
258
375
|
}
|
|
259
376
|
});
|
|
377
|
+
var DELETE_WORKFLOW_RUN_BY_ID_ROUTE = createRoute({
|
|
378
|
+
method: "DELETE",
|
|
379
|
+
path: "/workflows/:workflowId/runs/:runId",
|
|
380
|
+
responseType: "json",
|
|
381
|
+
pathParamSchema: workflowRunPathParams,
|
|
382
|
+
responseSchema: workflowControlResponseSchema,
|
|
383
|
+
summary: "Delete workflow run by ID",
|
|
384
|
+
description: "Deletes a specific workflow run by ID",
|
|
385
|
+
tags: ["Workflows"],
|
|
386
|
+
requiresAuth: true,
|
|
387
|
+
handler: async ({ mastra, workflowId, runId }) => {
|
|
388
|
+
try {
|
|
389
|
+
if (!workflowId) {
|
|
390
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
391
|
+
}
|
|
392
|
+
if (!runId) {
|
|
393
|
+
throw new HTTPException(400, { message: "Run ID is required" });
|
|
394
|
+
}
|
|
395
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
396
|
+
if (!workflow) {
|
|
397
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
398
|
+
}
|
|
399
|
+
await workflow.deleteWorkflowRunById(runId);
|
|
400
|
+
return { message: "Workflow run deleted" };
|
|
401
|
+
} catch (error) {
|
|
402
|
+
return handleError(error, "Error deleting workflow run");
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
});
|
|
260
406
|
var CREATE_WORKFLOW_RUN_ROUTE = createRoute({
|
|
261
407
|
method: "POST",
|
|
262
|
-
path: "/
|
|
408
|
+
path: "/workflows/:workflowId/create-run",
|
|
263
409
|
responseType: "json",
|
|
264
410
|
pathParamSchema: workflowIdPathParams,
|
|
265
411
|
queryParamSchema: optionalRunIdSchema,
|
|
412
|
+
bodySchema: createWorkflowRunBodySchema,
|
|
266
413
|
responseSchema: createWorkflowRunResponseSchema,
|
|
267
414
|
summary: "Create workflow run",
|
|
268
415
|
description: "Creates a new workflow execution instance with an optional custom run ID",
|
|
269
416
|
tags: ["Workflows"],
|
|
270
|
-
|
|
417
|
+
requiresAuth: true,
|
|
418
|
+
handler: async ({ mastra, workflowId, runId, resourceId, disableScorers }) => {
|
|
271
419
|
try {
|
|
272
420
|
if (!workflowId) {
|
|
273
421
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
@@ -276,7 +424,7 @@ var CREATE_WORKFLOW_RUN_ROUTE = createRoute({
|
|
|
276
424
|
if (!workflow) {
|
|
277
425
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
278
426
|
}
|
|
279
|
-
const run = await workflow.createRun({ runId });
|
|
427
|
+
const run = await workflow.createRun({ runId, resourceId, disableScorers });
|
|
280
428
|
return { runId: run.runId };
|
|
281
429
|
} catch (error) {
|
|
282
430
|
return handleError(error, "Error creating workflow run");
|
|
@@ -285,7 +433,7 @@ var CREATE_WORKFLOW_RUN_ROUTE = createRoute({
|
|
|
285
433
|
});
|
|
286
434
|
var STREAM_WORKFLOW_ROUTE = createRoute({
|
|
287
435
|
method: "POST",
|
|
288
|
-
path: "/
|
|
436
|
+
path: "/workflows/:workflowId/stream",
|
|
289
437
|
responseType: "stream",
|
|
290
438
|
pathParamSchema: workflowIdPathParams,
|
|
291
439
|
queryParamSchema: runIdSchema,
|
|
@@ -293,7 +441,8 @@ var STREAM_WORKFLOW_ROUTE = createRoute({
|
|
|
293
441
|
summary: "Stream workflow execution",
|
|
294
442
|
description: "Executes a workflow and streams the results in real-time",
|
|
295
443
|
tags: ["Workflows"],
|
|
296
|
-
|
|
444
|
+
requiresAuth: true,
|
|
445
|
+
handler: async ({ mastra, workflowId, runId, resourceId, ...params }) => {
|
|
297
446
|
try {
|
|
298
447
|
if (!workflowId) {
|
|
299
448
|
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
@@ -306,7 +455,7 @@ var STREAM_WORKFLOW_ROUTE = createRoute({
|
|
|
306
455
|
throw new HTTPException(404, { message: "Workflow not found" });
|
|
307
456
|
}
|
|
308
457
|
const serverCache = mastra.getServerCache();
|
|
309
|
-
const run = await workflow.createRun({ runId });
|
|
458
|
+
const run = await workflow.createRun({ runId, resourceId });
|
|
310
459
|
const result = run.stream(params);
|
|
311
460
|
return result.fullStream.pipeThrough(
|
|
312
461
|
new TransformStream({
|
|
@@ -325,21 +474,9 @@ var STREAM_WORKFLOW_ROUTE = createRoute({
|
|
|
325
474
|
}
|
|
326
475
|
}
|
|
327
476
|
});
|
|
328
|
-
var STREAM_VNEXT_WORKFLOW_ROUTE = createRoute({
|
|
329
|
-
method: "POST",
|
|
330
|
-
path: "/api/workflows/:workflowId/streamVNext",
|
|
331
|
-
responseType: "stream",
|
|
332
|
-
pathParamSchema: workflowIdPathParams,
|
|
333
|
-
queryParamSchema: runIdSchema,
|
|
334
|
-
bodySchema: streamWorkflowBodySchema,
|
|
335
|
-
summary: "Stream workflow execution (v2)",
|
|
336
|
-
description: "Executes a workflow using the v2 streaming API and streams the results in real-time",
|
|
337
|
-
tags: ["Workflows"],
|
|
338
|
-
handler: STREAM_WORKFLOW_ROUTE.handler
|
|
339
|
-
});
|
|
340
477
|
var RESUME_STREAM_WORKFLOW_ROUTE = createRoute({
|
|
341
478
|
method: "POST",
|
|
342
|
-
path: "/
|
|
479
|
+
path: "/workflows/:workflowId/resume-stream",
|
|
343
480
|
responseType: "stream",
|
|
344
481
|
pathParamSchema: workflowIdPathParams,
|
|
345
482
|
queryParamSchema: runIdSchema,
|
|
@@ -348,6 +485,7 @@ var RESUME_STREAM_WORKFLOW_ROUTE = createRoute({
|
|
|
348
485
|
summary: "Resume workflow stream",
|
|
349
486
|
description: "Resumes a suspended workflow execution and continues streaming results",
|
|
350
487
|
tags: ["Workflows"],
|
|
488
|
+
requiresAuth: true,
|
|
351
489
|
handler: async ({ mastra, workflowId, runId, ...params }) => {
|
|
352
490
|
try {
|
|
353
491
|
if (!workflowId) {
|
|
@@ -384,40 +522,9 @@ var RESUME_STREAM_WORKFLOW_ROUTE = createRoute({
|
|
|
384
522
|
}
|
|
385
523
|
}
|
|
386
524
|
});
|
|
387
|
-
var GET_WORKFLOW_RUN_EXECUTION_RESULT_ROUTE = createRoute({
|
|
388
|
-
method: "GET",
|
|
389
|
-
path: "/api/workflows/:workflowId/runs/:runId/execution-result",
|
|
390
|
-
responseType: "json",
|
|
391
|
-
pathParamSchema: workflowRunPathParams,
|
|
392
|
-
responseSchema: workflowExecutionResultSchema,
|
|
393
|
-
summary: "Get workflow execution result",
|
|
394
|
-
description: "Returns the final execution result of a completed workflow run",
|
|
395
|
-
tags: ["Workflows"],
|
|
396
|
-
handler: async ({ mastra, workflowId, runId }) => {
|
|
397
|
-
try {
|
|
398
|
-
if (!workflowId) {
|
|
399
|
-
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
400
|
-
}
|
|
401
|
-
if (!runId) {
|
|
402
|
-
throw new HTTPException(400, { message: "Run ID is required" });
|
|
403
|
-
}
|
|
404
|
-
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
405
|
-
if (!workflow) {
|
|
406
|
-
throw new HTTPException(404, { message: "Workflow not found" });
|
|
407
|
-
}
|
|
408
|
-
const executionResult = await workflow.getWorkflowRunExecutionResult(runId);
|
|
409
|
-
if (!executionResult) {
|
|
410
|
-
throw new HTTPException(404, { message: "Workflow run execution result not found" });
|
|
411
|
-
}
|
|
412
|
-
return executionResult;
|
|
413
|
-
} catch (error) {
|
|
414
|
-
return handleError(error, "Error getting workflow run execution result");
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
});
|
|
418
525
|
var START_ASYNC_WORKFLOW_ROUTE = createRoute({
|
|
419
526
|
method: "POST",
|
|
420
|
-
path: "/
|
|
527
|
+
path: "/workflows/:workflowId/start-async",
|
|
421
528
|
responseType: "json",
|
|
422
529
|
pathParamSchema: workflowIdPathParams,
|
|
423
530
|
queryParamSchema: optionalRunIdSchema,
|
|
@@ -426,6 +533,7 @@ var START_ASYNC_WORKFLOW_ROUTE = createRoute({
|
|
|
426
533
|
summary: "Start workflow asynchronously",
|
|
427
534
|
description: "Starts a workflow execution asynchronously without streaming results",
|
|
428
535
|
tags: ["Workflows"],
|
|
536
|
+
requiresAuth: true,
|
|
429
537
|
handler: async ({ mastra, workflowId, runId, ...params }) => {
|
|
430
538
|
try {
|
|
431
539
|
if (!workflowId) {
|
|
@@ -445,7 +553,7 @@ var START_ASYNC_WORKFLOW_ROUTE = createRoute({
|
|
|
445
553
|
});
|
|
446
554
|
var START_WORKFLOW_RUN_ROUTE = createRoute({
|
|
447
555
|
method: "POST",
|
|
448
|
-
path: "/
|
|
556
|
+
path: "/workflows/:workflowId/start",
|
|
449
557
|
responseType: "json",
|
|
450
558
|
pathParamSchema: workflowIdPathParams,
|
|
451
559
|
queryParamSchema: runIdSchema,
|
|
@@ -454,6 +562,7 @@ var START_WORKFLOW_RUN_ROUTE = createRoute({
|
|
|
454
562
|
summary: "Start specific workflow run",
|
|
455
563
|
description: "Starts execution of a specific workflow run by ID",
|
|
456
564
|
tags: ["Workflows"],
|
|
565
|
+
requiresAuth: true,
|
|
457
566
|
handler: async ({ mastra, workflowId, runId, ...params }) => {
|
|
458
567
|
try {
|
|
459
568
|
if (!workflowId) {
|
|
@@ -482,7 +591,7 @@ var START_WORKFLOW_RUN_ROUTE = createRoute({
|
|
|
482
591
|
});
|
|
483
592
|
var OBSERVE_STREAM_WORKFLOW_ROUTE = createRoute({
|
|
484
593
|
method: "POST",
|
|
485
|
-
path: "/
|
|
594
|
+
path: "/workflows/:workflowId/observe",
|
|
486
595
|
responseType: "stream",
|
|
487
596
|
pathParamSchema: workflowIdPathParams,
|
|
488
597
|
queryParamSchema: runIdSchema,
|
|
@@ -490,6 +599,7 @@ var OBSERVE_STREAM_WORKFLOW_ROUTE = createRoute({
|
|
|
490
599
|
summary: "Observe workflow stream",
|
|
491
600
|
description: "Observes and streams updates from an already running workflow execution",
|
|
492
601
|
tags: ["Workflows"],
|
|
602
|
+
requiresAuth: true,
|
|
493
603
|
handler: async ({ mastra, workflowId, runId }) => {
|
|
494
604
|
try {
|
|
495
605
|
if (!workflowId) {
|
|
@@ -550,21 +660,9 @@ var OBSERVE_STREAM_WORKFLOW_ROUTE = createRoute({
|
|
|
550
660
|
}
|
|
551
661
|
}
|
|
552
662
|
});
|
|
553
|
-
var OBSERVE_STREAM_VNEXT_WORKFLOW_ROUTE = createRoute({
|
|
554
|
-
method: "POST",
|
|
555
|
-
path: "/api/workflows/:workflowId/observe-streamVNext",
|
|
556
|
-
responseType: "stream",
|
|
557
|
-
pathParamSchema: workflowIdPathParams,
|
|
558
|
-
queryParamSchema: runIdSchema,
|
|
559
|
-
responseSchema: streamResponseSchema,
|
|
560
|
-
summary: "Observe workflow stream (v2)",
|
|
561
|
-
description: "Observes and streams updates from an already running workflow execution using v2 streaming API",
|
|
562
|
-
tags: ["Workflows"],
|
|
563
|
-
handler: OBSERVE_STREAM_WORKFLOW_ROUTE.handler
|
|
564
|
-
});
|
|
565
663
|
var RESUME_ASYNC_WORKFLOW_ROUTE = createRoute({
|
|
566
664
|
method: "POST",
|
|
567
|
-
path: "/
|
|
665
|
+
path: "/workflows/:workflowId/resume-async",
|
|
568
666
|
responseType: "json",
|
|
569
667
|
pathParamSchema: workflowIdPathParams,
|
|
570
668
|
queryParamSchema: runIdSchema,
|
|
@@ -573,6 +671,7 @@ var RESUME_ASYNC_WORKFLOW_ROUTE = createRoute({
|
|
|
573
671
|
summary: "Resume workflow asynchronously",
|
|
574
672
|
description: "Resumes a suspended workflow execution asynchronously without streaming",
|
|
575
673
|
tags: ["Workflows"],
|
|
674
|
+
requiresAuth: true,
|
|
576
675
|
handler: async ({ mastra, workflowId, runId, ...params }) => {
|
|
577
676
|
try {
|
|
578
677
|
if (!workflowId) {
|
|
@@ -599,7 +698,7 @@ var RESUME_ASYNC_WORKFLOW_ROUTE = createRoute({
|
|
|
599
698
|
});
|
|
600
699
|
var RESUME_WORKFLOW_ROUTE = createRoute({
|
|
601
700
|
method: "POST",
|
|
602
|
-
path: "/
|
|
701
|
+
path: "/workflows/:workflowId/resume",
|
|
603
702
|
responseType: "json",
|
|
604
703
|
pathParamSchema: workflowIdPathParams,
|
|
605
704
|
queryParamSchema: runIdSchema,
|
|
@@ -608,6 +707,7 @@ var RESUME_WORKFLOW_ROUTE = createRoute({
|
|
|
608
707
|
summary: "Resume workflow",
|
|
609
708
|
description: "Resumes a suspended workflow execution from a specific step",
|
|
610
709
|
tags: ["Workflows"],
|
|
710
|
+
requiresAuth: true,
|
|
611
711
|
handler: async ({ mastra, workflowId, runId, ...params }) => {
|
|
612
712
|
try {
|
|
613
713
|
if (!workflowId) {
|
|
@@ -632,15 +732,255 @@ var RESUME_WORKFLOW_ROUTE = createRoute({
|
|
|
632
732
|
}
|
|
633
733
|
}
|
|
634
734
|
});
|
|
735
|
+
var RESTART_ASYNC_WORKFLOW_ROUTE = createRoute({
|
|
736
|
+
method: "POST",
|
|
737
|
+
path: "/workflows/:workflowId/restart-async",
|
|
738
|
+
responseType: "json",
|
|
739
|
+
pathParamSchema: workflowIdPathParams,
|
|
740
|
+
queryParamSchema: runIdSchema,
|
|
741
|
+
bodySchema: restartBodySchema,
|
|
742
|
+
responseSchema: workflowExecutionResultSchema,
|
|
743
|
+
summary: "Restart workflow asynchronously",
|
|
744
|
+
description: "Restarts an active workflow execution asynchronously",
|
|
745
|
+
tags: ["Workflows"],
|
|
746
|
+
requiresAuth: true,
|
|
747
|
+
handler: async ({ mastra, workflowId, runId, ...params }) => {
|
|
748
|
+
try {
|
|
749
|
+
if (!workflowId) {
|
|
750
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
751
|
+
}
|
|
752
|
+
if (!runId) {
|
|
753
|
+
throw new HTTPException(400, { message: "runId required to restart workflow" });
|
|
754
|
+
}
|
|
755
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
756
|
+
if (!workflow) {
|
|
757
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
758
|
+
}
|
|
759
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
760
|
+
if (!run) {
|
|
761
|
+
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
762
|
+
}
|
|
763
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
764
|
+
const result = await _run.restart(params);
|
|
765
|
+
return result;
|
|
766
|
+
} catch (error) {
|
|
767
|
+
return handleError(error, "Error restarting workflow");
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
var RESTART_WORKFLOW_ROUTE = createRoute({
|
|
772
|
+
method: "POST",
|
|
773
|
+
path: "/workflows/:workflowId/restart",
|
|
774
|
+
responseType: "json",
|
|
775
|
+
pathParamSchema: workflowIdPathParams,
|
|
776
|
+
queryParamSchema: runIdSchema,
|
|
777
|
+
bodySchema: restartBodySchema,
|
|
778
|
+
responseSchema: workflowControlResponseSchema,
|
|
779
|
+
summary: "Restart workflow",
|
|
780
|
+
description: "Restarts an active workflow execution",
|
|
781
|
+
tags: ["Workflows"],
|
|
782
|
+
requiresAuth: true,
|
|
783
|
+
handler: async ({ mastra, workflowId, runId, ...params }) => {
|
|
784
|
+
try {
|
|
785
|
+
if (!workflowId) {
|
|
786
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
787
|
+
}
|
|
788
|
+
if (!runId) {
|
|
789
|
+
throw new HTTPException(400, { message: "runId required to restart workflow" });
|
|
790
|
+
}
|
|
791
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
792
|
+
if (!workflow) {
|
|
793
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
794
|
+
}
|
|
795
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
796
|
+
if (!run) {
|
|
797
|
+
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
798
|
+
}
|
|
799
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
800
|
+
void _run.restart(params);
|
|
801
|
+
return { message: "Workflow run restarted" };
|
|
802
|
+
} catch (error) {
|
|
803
|
+
return handleError(error, "Error restarting workflow");
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
var RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ASYNC_ROUTE = createRoute({
|
|
808
|
+
method: "POST",
|
|
809
|
+
path: "/workflows/:workflowId/restart-all-active-workflow-runs-async",
|
|
810
|
+
responseType: "json",
|
|
811
|
+
pathParamSchema: workflowIdPathParams,
|
|
812
|
+
responseSchema: workflowControlResponseSchema,
|
|
813
|
+
summary: "Restart all active workflow runs asynchronously",
|
|
814
|
+
description: "Restarts all active workflow runs asynchronously",
|
|
815
|
+
tags: ["Workflows"],
|
|
816
|
+
requiresAuth: true,
|
|
817
|
+
handler: async ({ mastra, workflowId }) => {
|
|
818
|
+
try {
|
|
819
|
+
if (!workflowId) {
|
|
820
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
821
|
+
}
|
|
822
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
823
|
+
if (!workflow) {
|
|
824
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
825
|
+
}
|
|
826
|
+
await workflow.restartAllActiveWorkflowRuns();
|
|
827
|
+
return { message: "All active workflow runs restarted" };
|
|
828
|
+
} catch (error) {
|
|
829
|
+
return handleError(error, "Error restarting workflow");
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
var RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ROUTE = createRoute({
|
|
834
|
+
method: "POST",
|
|
835
|
+
path: "/workflows/:workflowId/restart-all-active-workflow-runs",
|
|
836
|
+
responseType: "json",
|
|
837
|
+
pathParamSchema: workflowIdPathParams,
|
|
838
|
+
responseSchema: workflowControlResponseSchema,
|
|
839
|
+
summary: "Restart all active workflow runs",
|
|
840
|
+
description: "Restarts all active workflow runs",
|
|
841
|
+
tags: ["Workflows"],
|
|
842
|
+
requiresAuth: true,
|
|
843
|
+
handler: async ({ mastra, workflowId }) => {
|
|
844
|
+
try {
|
|
845
|
+
if (!workflowId) {
|
|
846
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
847
|
+
}
|
|
848
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
849
|
+
if (!workflow) {
|
|
850
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
851
|
+
}
|
|
852
|
+
void workflow.restartAllActiveWorkflowRuns();
|
|
853
|
+
return { message: "All active workflow runs restarted" };
|
|
854
|
+
} catch (error) {
|
|
855
|
+
return handleError(error, "Error restarting workflow");
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
});
|
|
859
|
+
var TIME_TRAVEL_ASYNC_WORKFLOW_ROUTE = createRoute({
|
|
860
|
+
method: "POST",
|
|
861
|
+
path: "/workflows/:workflowId/time-travel-async",
|
|
862
|
+
responseType: "json",
|
|
863
|
+
pathParamSchema: workflowIdPathParams,
|
|
864
|
+
queryParamSchema: runIdSchema,
|
|
865
|
+
bodySchema: timeTravelBodySchema,
|
|
866
|
+
responseSchema: workflowExecutionResultSchema,
|
|
867
|
+
summary: "Time travel workflow asynchronously",
|
|
868
|
+
description: "Time travels a workflow run asynchronously without streaming",
|
|
869
|
+
tags: ["Workflows"],
|
|
870
|
+
requiresAuth: true,
|
|
871
|
+
handler: async ({ mastra, workflowId, runId, ...params }) => {
|
|
872
|
+
try {
|
|
873
|
+
if (!workflowId) {
|
|
874
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
875
|
+
}
|
|
876
|
+
if (!runId) {
|
|
877
|
+
throw new HTTPException(400, { message: "runId required to time travel workflow" });
|
|
878
|
+
}
|
|
879
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
880
|
+
if (!workflow) {
|
|
881
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
882
|
+
}
|
|
883
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
884
|
+
if (!run) {
|
|
885
|
+
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
886
|
+
}
|
|
887
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
888
|
+
const result = await _run.timeTravel(params);
|
|
889
|
+
return result;
|
|
890
|
+
} catch (error) {
|
|
891
|
+
return handleError(error, "Error time traveling workflow");
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
var TIME_TRAVEL_WORKFLOW_ROUTE = createRoute({
|
|
896
|
+
method: "POST",
|
|
897
|
+
path: "/workflows/:workflowId/time-travel",
|
|
898
|
+
responseType: "json",
|
|
899
|
+
pathParamSchema: workflowIdPathParams,
|
|
900
|
+
queryParamSchema: runIdSchema,
|
|
901
|
+
bodySchema: timeTravelBodySchema,
|
|
902
|
+
responseSchema: workflowControlResponseSchema,
|
|
903
|
+
summary: "Time travel workflow",
|
|
904
|
+
description: "Time travels a workflow run, starting from a specific step",
|
|
905
|
+
tags: ["Workflows"],
|
|
906
|
+
requiresAuth: true,
|
|
907
|
+
handler: async ({ mastra, workflowId, runId, ...params }) => {
|
|
908
|
+
try {
|
|
909
|
+
if (!workflowId) {
|
|
910
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
911
|
+
}
|
|
912
|
+
if (!runId) {
|
|
913
|
+
throw new HTTPException(400, { message: "runId required to time travel workflow" });
|
|
914
|
+
}
|
|
915
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
916
|
+
if (!workflow) {
|
|
917
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
918
|
+
}
|
|
919
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
920
|
+
if (!run) {
|
|
921
|
+
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
922
|
+
}
|
|
923
|
+
const _run = await workflow.createRun({ runId, resourceId: run.resourceId });
|
|
924
|
+
void _run.timeTravel(params);
|
|
925
|
+
return { message: "Workflow run time travel started" };
|
|
926
|
+
} catch (error) {
|
|
927
|
+
return handleError(error, "Error time traveling workflow");
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
});
|
|
931
|
+
var TIME_TRAVEL_STREAM_WORKFLOW_ROUTE = createRoute({
|
|
932
|
+
method: "POST",
|
|
933
|
+
path: "/workflows/:workflowId/time-travel-stream",
|
|
934
|
+
responseType: "stream",
|
|
935
|
+
pathParamSchema: workflowIdPathParams,
|
|
936
|
+
queryParamSchema: runIdSchema,
|
|
937
|
+
bodySchema: timeTravelBodySchema,
|
|
938
|
+
summary: "Time travel workflow stream",
|
|
939
|
+
description: "Time travels a workflow run, starting from a specific step, and streams the results in real-time",
|
|
940
|
+
tags: ["Workflows"],
|
|
941
|
+
requiresAuth: true,
|
|
942
|
+
handler: async ({ mastra, workflowId, runId, ...params }) => {
|
|
943
|
+
try {
|
|
944
|
+
if (!workflowId) {
|
|
945
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
946
|
+
}
|
|
947
|
+
if (!runId) {
|
|
948
|
+
throw new HTTPException(400, { message: "runId required to time travel workflow stream" });
|
|
949
|
+
}
|
|
950
|
+
const { workflow } = await listWorkflowsFromSystem({ mastra, workflowId });
|
|
951
|
+
if (!workflow) {
|
|
952
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
953
|
+
}
|
|
954
|
+
const serverCache = mastra.getServerCache();
|
|
955
|
+
const run = await workflow.createRun({ runId });
|
|
956
|
+
const result = run.timeTravelStream(params);
|
|
957
|
+
return result.fullStream.pipeThrough(
|
|
958
|
+
new TransformStream({
|
|
959
|
+
transform(chunk, controller) {
|
|
960
|
+
if (serverCache) {
|
|
961
|
+
const cacheKey = runId;
|
|
962
|
+
serverCache.listPush(cacheKey, chunk).catch(() => {
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
controller.enqueue(chunk);
|
|
966
|
+
}
|
|
967
|
+
})
|
|
968
|
+
);
|
|
969
|
+
} catch (error) {
|
|
970
|
+
return handleError(error, "Error time traveling workflow stream");
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
});
|
|
635
974
|
var CANCEL_WORKFLOW_RUN_ROUTE = createRoute({
|
|
636
975
|
method: "POST",
|
|
637
|
-
path: "/
|
|
976
|
+
path: "/workflows/:workflowId/runs/:runId/cancel",
|
|
638
977
|
responseType: "json",
|
|
639
978
|
pathParamSchema: workflowRunPathParams,
|
|
640
979
|
responseSchema: workflowControlResponseSchema,
|
|
641
980
|
summary: "Cancel workflow run",
|
|
642
981
|
description: "Cancels an in-progress workflow execution",
|
|
643
982
|
tags: ["Workflows"],
|
|
983
|
+
requiresAuth: true,
|
|
644
984
|
handler: async ({ mastra, workflowId, runId }) => {
|
|
645
985
|
try {
|
|
646
986
|
if (!workflowId) {
|
|
@@ -667,15 +1007,16 @@ var CANCEL_WORKFLOW_RUN_ROUTE = createRoute({
|
|
|
667
1007
|
});
|
|
668
1008
|
var STREAM_LEGACY_WORKFLOW_ROUTE = createRoute({
|
|
669
1009
|
method: "POST",
|
|
670
|
-
path: "/
|
|
1010
|
+
path: "/workflows/:workflowId/stream-legacy",
|
|
671
1011
|
responseType: "stream",
|
|
672
1012
|
pathParamSchema: workflowIdPathParams,
|
|
673
1013
|
queryParamSchema: runIdSchema,
|
|
674
1014
|
bodySchema: streamWorkflowBodySchema,
|
|
675
1015
|
responseSchema: streamResponseSchema,
|
|
676
1016
|
summary: "[DEPRECATED] Stream workflow with legacy format",
|
|
677
|
-
description: "Legacy endpoint for streaming workflow execution. Use /
|
|
1017
|
+
description: "Legacy endpoint for streaming workflow execution. Use /workflows/:workflowId/stream instead.",
|
|
678
1018
|
tags: ["Workflows", "Legacy"],
|
|
1019
|
+
requiresAuth: true,
|
|
679
1020
|
handler: async ({ mastra, workflowId, runId, ...params }) => {
|
|
680
1021
|
try {
|
|
681
1022
|
if (!workflowId) {
|
|
@@ -707,14 +1048,15 @@ var STREAM_LEGACY_WORKFLOW_ROUTE = createRoute({
|
|
|
707
1048
|
});
|
|
708
1049
|
var OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE = createRoute({
|
|
709
1050
|
method: "POST",
|
|
710
|
-
path: "/
|
|
1051
|
+
path: "/workflows/:workflowId/observe-stream-legacy",
|
|
711
1052
|
responseType: "stream",
|
|
712
1053
|
pathParamSchema: workflowIdPathParams,
|
|
713
1054
|
queryParamSchema: runIdSchema,
|
|
714
1055
|
responseSchema: streamResponseSchema,
|
|
715
1056
|
summary: "[DEPRECATED] Observe workflow stream with legacy format",
|
|
716
|
-
description: "Legacy endpoint for observing workflow stream. Use /
|
|
1057
|
+
description: "Legacy endpoint for observing workflow stream. Use /workflows/:workflowId/observe instead.",
|
|
717
1058
|
tags: ["Workflows", "Legacy"],
|
|
1059
|
+
requiresAuth: true,
|
|
718
1060
|
handler: async ({ mastra, workflowId, runId }) => {
|
|
719
1061
|
try {
|
|
720
1062
|
if (!workflowId) {
|
|
@@ -751,6 +1093,6 @@ var OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE = createRoute({
|
|
|
751
1093
|
}
|
|
752
1094
|
});
|
|
753
1095
|
|
|
754
|
-
export { CANCEL_WORKFLOW_RUN_ROUTE, CREATE_WORKFLOW_RUN_ROUTE, GET_WORKFLOW_BY_ID_ROUTE, GET_WORKFLOW_RUN_BY_ID_ROUTE,
|
|
755
|
-
//# sourceMappingURL=chunk-
|
|
756
|
-
//# sourceMappingURL=chunk-
|
|
1096
|
+
export { CANCEL_WORKFLOW_RUN_ROUTE, CREATE_WORKFLOW_RUN_ROUTE, DELETE_WORKFLOW_RUN_BY_ID_ROUTE, GET_WORKFLOW_BY_ID_ROUTE, GET_WORKFLOW_RUN_BY_ID_ROUTE, LIST_WORKFLOWS_ROUTE, LIST_WORKFLOW_RUNS_ROUTE, OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE, OBSERVE_STREAM_WORKFLOW_ROUTE, RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ASYNC_ROUTE, RESTART_ALL_ACTIVE_WORKFLOW_RUNS_ROUTE, RESTART_ASYNC_WORKFLOW_ROUTE, RESTART_WORKFLOW_ROUTE, RESUME_ASYNC_WORKFLOW_ROUTE, RESUME_STREAM_WORKFLOW_ROUTE, RESUME_WORKFLOW_ROUTE, START_ASYNC_WORKFLOW_ROUTE, START_WORKFLOW_RUN_ROUTE, STREAM_LEGACY_WORKFLOW_ROUTE, STREAM_WORKFLOW_ROUTE, TIME_TRAVEL_ASYNC_WORKFLOW_ROUTE, TIME_TRAVEL_STREAM_WORKFLOW_ROUTE, TIME_TRAVEL_WORKFLOW_ROUTE, createWorkflowRunResponseSchema, listWorkflowRunsQuerySchema, listWorkflowsResponseSchema, resumeBodySchema, startAsyncWorkflowBodySchema, streamLegacyWorkflowBodySchema, streamWorkflowBodySchema, workflowControlResponseSchema, workflowExecutionResultSchema, workflowInfoSchema, workflowRunResultQuerySchema, workflowRunResultSchema, workflowRunsResponseSchema, workflows_exports };
|
|
1097
|
+
//# sourceMappingURL=chunk-W7HAZD2A.js.map
|
|
1098
|
+
//# sourceMappingURL=chunk-W7HAZD2A.js.map
|