@mastra/server 0.0.0-feat-tool-input-validation-20250731232758 → 0.0.0-feat-support-ai-sdk-5-again-20250813225910
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-GHC4YV6R.js → chunk-25LDKW7R.js} +109 -136
- package/dist/chunk-25LDKW7R.js.map +1 -0
- package/dist/{chunk-4D66QEKC.js → chunk-4MQU6AJN.js} +5 -3
- package/dist/chunk-4MQU6AJN.js.map +1 -0
- package/dist/{chunk-CCGRCYWJ.cjs → chunk-4QSNRCOT.cjs} +4 -2
- package/dist/chunk-4QSNRCOT.cjs.map +1 -0
- package/dist/{chunk-RHSWAXKB.cjs → chunk-4US5W7PH.cjs} +26 -24
- package/dist/chunk-4US5W7PH.cjs.map +1 -0
- package/dist/{chunk-36BLNJHS.js → chunk-7FHF55WA.js} +2 -0
- package/dist/chunk-7FHF55WA.js.map +1 -0
- package/dist/{chunk-2KZFMI6P.cjs → chunk-7NADHFD2.cjs} +2 -0
- package/dist/chunk-7NADHFD2.cjs.map +1 -0
- package/dist/{chunk-QGX47B5D.cjs → chunk-BED2O446.cjs} +11 -9
- package/dist/chunk-BED2O446.cjs.map +1 -0
- package/dist/{chunk-T7HAZC2E.js → chunk-BUOJL3MN.js} +6 -4
- package/dist/chunk-BUOJL3MN.js.map +1 -0
- package/dist/{chunk-2SLFAFTR.cjs → chunk-CERIVHRO.cjs} +26 -21
- package/dist/chunk-CERIVHRO.cjs.map +1 -0
- package/dist/{chunk-LF7P5PLR.js → chunk-CY4TP3FK.js} +3 -1
- package/dist/chunk-CY4TP3FK.js.map +1 -0
- package/dist/{chunk-WNVFNNWN.js → chunk-G7NVCO5M.js} +5 -3
- package/dist/chunk-G7NVCO5M.js.map +1 -0
- package/dist/{chunk-KHZKYUNR.js → chunk-HWHKM67I.js} +6 -4
- package/dist/chunk-HWHKM67I.js.map +1 -0
- package/dist/{chunk-CRCR3ZUK.js → chunk-HXZTRBY4.js} +16 -11
- package/dist/chunk-HXZTRBY4.js.map +1 -0
- package/dist/{chunk-G7KH752Y.cjs → chunk-ILCWPBYQ.cjs} +9 -7
- package/dist/chunk-ILCWPBYQ.cjs.map +1 -0
- package/dist/{chunk-UCV4247U.cjs → chunk-JGVY3KWV.cjs} +47 -45
- package/dist/chunk-JGVY3KWV.cjs.map +1 -0
- package/dist/{chunk-PIAJQ75M.js → chunk-KXXJ7Y4H.js} +64 -11
- package/dist/chunk-KXXJ7Y4H.js.map +1 -0
- package/dist/{chunk-6T5JUKOQ.js → chunk-L7YG7WQH.js} +5 -3
- package/dist/chunk-L7YG7WQH.js.map +1 -0
- package/dist/{chunk-HISYIDYH.cjs → chunk-LRUH33B4.cjs} +2 -0
- package/dist/chunk-LRUH33B4.cjs.map +1 -0
- package/dist/{chunk-UEVYOKAH.cjs → chunk-LZASFI6W.cjs} +118 -64
- package/dist/chunk-LZASFI6W.cjs.map +1 -0
- package/dist/{chunk-LCM566I4.js → chunk-MMROOK5J.js} +2 -0
- package/dist/chunk-MMROOK5J.js.map +1 -0
- package/dist/{chunk-7TP2LX5L.cjs → chunk-NCS2OXX6.cjs} +20 -18
- package/dist/chunk-NCS2OXX6.cjs.map +1 -0
- package/dist/{chunk-HRSAZUIK.cjs → chunk-O4I563YW.cjs} +24 -22
- package/dist/chunk-O4I563YW.cjs.map +1 -0
- package/dist/{chunk-RSEO4XPX.js → chunk-OW4FX5TS.js} +3 -1
- package/dist/chunk-OW4FX5TS.js.map +1 -0
- package/dist/{chunk-MLKGABMK.js → chunk-PZ5AY32C.js} +2 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/{chunk-I5JKUCGE.cjs → chunk-Q4OQ4DOR.cjs} +67 -41
- package/dist/chunk-Q4OQ4DOR.cjs.map +1 -0
- package/dist/{chunk-75ZPJI57.cjs → chunk-Q7SFCCGT.cjs} +2 -0
- package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
- package/dist/{chunk-PZQDCRPV.cjs → chunk-RE4RPXT2.cjs} +4 -2
- package/dist/chunk-RE4RPXT2.cjs.map +1 -0
- package/dist/{chunk-424T5F2J.cjs → chunk-RQQNZZAI.cjs} +10 -8
- package/dist/chunk-RQQNZZAI.cjs.map +1 -0
- package/dist/{chunk-6KP2OBYA.cjs → chunk-S37KCGOR.cjs} +88 -86
- package/dist/chunk-S37KCGOR.cjs.map +1 -0
- package/dist/{chunk-RG473F6Y.js → chunk-SQ7KKIH3.js} +5 -3
- package/dist/chunk-SQ7KKIH3.js.map +1 -0
- package/dist/{chunk-VTTN2FW3.js → chunk-SXXGIMWO.js} +45 -20
- package/dist/chunk-SXXGIMWO.js.map +1 -0
- package/dist/{chunk-ZYAFP2AV.js → chunk-UVOSITKU.js} +6 -4
- package/dist/chunk-UVOSITKU.js.map +1 -0
- package/dist/{chunk-SDPGVWQJ.cjs → chunk-WNK42E5I.cjs} +110 -137
- package/dist/chunk-WNK42E5I.cjs.map +1 -0
- package/dist/{chunk-WBRFIHSF.js → chunk-YS66MFDY.js} +7 -5
- package/dist/chunk-YS66MFDY.js.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/agents.cjs +14 -8
- package/dist/server/handlers/agents.cjs.map +1 -0
- package/dist/server/handlers/agents.d.ts +89 -7
- 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 +21 -15
- package/dist/server/handlers/memory.cjs.map +1 -0
- package/dist/server/handlers/memory.d.ts +121 -14
- 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 +51 -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/scores.cjs +9 -7
- package/dist/server/handlers/scores.cjs.map +1 -0
- package/dist/server/handlers/scores.d.ts +49 -6
- package/dist/server/handlers/scores.d.ts.map +1 -0
- package/dist/server/handlers/scores.js +3 -1
- package/dist/server/handlers/scores.js.map +1 -0
- package/dist/server/handlers/telemetry.cjs +5 -3
- package/dist/server/handlers/telemetry.cjs.map +1 -0
- package/dist/server/handlers/telemetry.d.ts +32 -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 +7 -5
- package/dist/server/handlers/tools.cjs.map +1 -0
- package/dist/server/handlers/tools.d.ts +21 -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 +4 -2
- package/dist/server/handlers/utils.cjs.map +1 -0
- package/dist/server/handlers/utils.d.ts +2 -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 +25 -23
- package/dist/server/handlers/vNextNetwork.cjs.map +1 -0
- package/dist/server/handlers/vNextNetwork.d.ts +179 -6
- package/dist/server/handlers/vNextNetwork.d.ts.map +1 -0
- package/dist/server/handlers/vNextNetwork.js +6 -4
- package/dist/server/handlers/vNextNetwork.js.map +1 -0
- package/dist/server/handlers/vector.cjs +9 -7
- package/dist/server/handlers/vector.cjs.map +1 -0
- package/dist/server/handlers/vector.d.ts +51 -6
- package/dist/server/handlers/vector.d.ts.map +1 -0
- package/dist/server/handlers/vector.js +3 -1
- package/dist/server/handlers/vector.js.map +1 -0
- package/dist/server/handlers/voice.cjs +7 -5
- package/dist/server/handlers/voice.cjs.map +1 -0
- package/dist/server/handlers/voice.d.ts +39 -4
- package/dist/server/handlers/voice.d.ts.map +1 -0
- package/dist/server/handlers/voice.js +3 -1
- package/dist/server/handlers/voice.js.map +1 -0
- package/dist/server/handlers/workflows.cjs +18 -16
- package/dist/server/handlers/workflows.cjs.map +1 -0
- package/dist/server/handlers/workflows.d.ts +88 -15
- 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 +32 -30
- package/dist/server/handlers.cjs.map +1 -0
- package/dist/server/handlers.d.ts +13 -12
- package/dist/server/handlers.d.ts.map +1 -0
- package/dist/server/handlers.js +14 -12
- 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/package.json +21 -10
- package/dist/_tsup-dts-rollup.d.cts +0 -1260
- package/dist/_tsup-dts-rollup.d.ts +0 -1260
- package/dist/index.d.cts +0 -1
- package/dist/server/handlers/a2a.d.cts +0 -6
- package/dist/server/handlers/agents.d.cts +0 -7
- 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 -14
- package/dist/server/handlers/network.d.cts +0 -4
- package/dist/server/handlers/scores.d.cts +0 -6
- 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/vNextNetwork.d.cts +0 -6
- package/dist/server/handlers/vector.d.cts +0 -6
- package/dist/server/handlers/voice.d.cts +0 -4
- package/dist/server/handlers/workflows.d.cts +0 -15
- package/dist/server/handlers.d.cts +0 -12
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk7NADHFD2_cjs = require('./chunk-7NADHFD2.cjs');
|
|
4
4
|
|
|
5
5
|
// src/server/handlers/error.ts
|
|
6
6
|
function handleError(error, defaultMessage) {
|
|
7
7
|
const apiError = error;
|
|
8
8
|
const apiErrorStatus = apiError.status || apiError.details?.status || 500;
|
|
9
|
-
throw new
|
|
9
|
+
throw new chunk7NADHFD2_cjs.HTTPException(apiErrorStatus, {
|
|
10
10
|
message: apiError.message || defaultMessage,
|
|
11
11
|
stack: apiError.stack,
|
|
12
12
|
cause: apiError.cause
|
|
@@ -14,3 +14,5 @@ function handleError(error, defaultMessage) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
exports.handleError = handleError;
|
|
17
|
+
//# sourceMappingURL=chunk-RE4RPXT2.cjs.map
|
|
18
|
+
//# sourceMappingURL=chunk-RE4RPXT2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server/handlers/error.ts"],"names":["HTTPException"],"mappings":";;;;;AAKO,SAAS,WAAA,CAAY,OAAgB,cAAA,EAA+B;AACzE,EAAA,MAAM,QAAA,GAAW,KAAA;AAEjB,EAAA,MAAM,cAAA,GAAiB,QAAA,CAAS,MAAA,IAAU,QAAA,CAAS,SAAS,MAAA,IAAU,GAAA;AAEtE,EAAA,MAAM,IAAIA,gCAAc,cAAA,EAA8B;AAAA,IACpD,OAAA,EAAS,SAAS,OAAA,IAAW,cAAA;AAAA,IAC7B,OAAO,QAAA,CAAS,KAAA;AAAA,IAChB,OAAO,QAAA,CAAS;AAAA,GACjB,CAAA;AACH","file":"chunk-RE4RPXT2.cjs","sourcesContent":["import { HTTPException } from '../http-exception';\nimport type { StatusCode } from '../http-exception';\nimport type { ApiError } from '../types';\n\n// Helper to handle errors consistently\nexport function handleError(error: unknown, defaultMessage: string): never {\n const apiError = error as ApiError;\n\n const apiErrorStatus = apiError.status || apiError.details?.status || 500;\n\n throw new HTTPException(apiErrorStatus as StatusCode, {\n message: apiError.message || defaultMessage,\n stack: apiError.stack,\n cause: apiError.cause,\n });\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkRE4RPXT2_cjs = require('./chunk-RE4RPXT2.cjs');
|
|
4
|
+
var chunkQ7SFCCGT_cjs = require('./chunk-Q7SFCCGT.cjs');
|
|
5
5
|
|
|
6
6
|
// src/server/handlers/scores.ts
|
|
7
7
|
var scores_exports = {};
|
|
8
|
-
|
|
8
|
+
chunkQ7SFCCGT_cjs.__export(scores_exports, {
|
|
9
9
|
getScorerHandler: () => getScorerHandler,
|
|
10
10
|
getScorersHandler: () => getScorersHandler,
|
|
11
11
|
getScoresByEntityIdHandler: () => getScoresByEntityIdHandler,
|
|
@@ -32,7 +32,7 @@ async function getScorersFromSystem({
|
|
|
32
32
|
scorersMap.set(scorerId, {
|
|
33
33
|
workflowIds: [],
|
|
34
34
|
...scorer,
|
|
35
|
-
agentIds: [
|
|
35
|
+
agentIds: [agentId]
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -92,7 +92,7 @@ async function getScoresByRunIdHandler({
|
|
|
92
92
|
}) || [];
|
|
93
93
|
return scores;
|
|
94
94
|
} catch (error) {
|
|
95
|
-
return
|
|
95
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error getting scores by run id");
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
async function getScoresByScorerIdHandler({
|
|
@@ -111,7 +111,7 @@ async function getScoresByScorerIdHandler({
|
|
|
111
111
|
}) || [];
|
|
112
112
|
return scores;
|
|
113
113
|
} catch (error) {
|
|
114
|
-
return
|
|
114
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error getting scores by scorer id");
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
async function getScoresByEntityIdHandler({
|
|
@@ -136,7 +136,7 @@ async function getScoresByEntityIdHandler({
|
|
|
136
136
|
}) || [];
|
|
137
137
|
return scores;
|
|
138
138
|
} catch (error) {
|
|
139
|
-
return
|
|
139
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error getting scores by entity id");
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
async function saveScoreHandler({ mastra, score }) {
|
|
@@ -144,7 +144,7 @@ async function saveScoreHandler({ mastra, score }) {
|
|
|
144
144
|
const scores = await mastra.getStorage()?.saveScore?.(score) || [];
|
|
145
145
|
return scores;
|
|
146
146
|
} catch (error) {
|
|
147
|
-
return
|
|
147
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error saving score");
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
|
|
@@ -155,3 +155,5 @@ exports.getScoresByRunIdHandler = getScoresByRunIdHandler;
|
|
|
155
155
|
exports.getScoresByScorerIdHandler = getScoresByScorerIdHandler;
|
|
156
156
|
exports.saveScoreHandler = saveScoreHandler;
|
|
157
157
|
exports.scores_exports = scores_exports;
|
|
158
|
+
//# sourceMappingURL=chunk-RQQNZZAI.cjs.map
|
|
159
|
+
//# sourceMappingURL=chunk-RQQNZZAI.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server/handlers/scores.ts"],"names":["__export","handleError"],"mappings":";;;;;;AAAA,IAAA,cAAA,GAAA;AAAAA,0BAAA,CAAA,cAAA,EAAA;AAAA,EAAA,gBAAA,EAAA,MAAA,gBAAA;AAAA,EAAA,iBAAA,EAAA,MAAA,iBAAA;AAAA,EAAA,0BAAA,EAAA,MAAA,0BAAA;AAAA,EAAA,uBAAA,EAAA,MAAA,uBAAA;AAAA,EAAA,0BAAA,EAAA,MAAA,0BAAA;AAAA,EAAA,gBAAA,EAAA,MAAA;AAAA,CAAA,CAAA;AAMA,eAAe,oBAAA,CAAqB;AAAA,EAClC,MAAA;AAAA,EACA;AACF,CAAA,EAEG;AACD,EAAA,MAAM,MAAA,GAAS,OAAO,SAAA,EAAU;AAChC,EAAA,MAAM,SAAA,GAAY,OAAO,YAAA,EAAa;AAEtC,EAAA,MAAM,UAAA,uBAAiB,GAAA,EAA+E;AAEtG,EAAA,KAAA,MAAW,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M,MAAA,CAAO,UAAA,IAAc,SAAA,GAAY,KAAK,KAAM,EAAC;AACnE,IAAA,OAAO,MAAA;AAAA,EACT,SAAS,KAAA,EAAO;AACd,IAAA,OAAOA,6BAAA,CAAY,OAAO,oBAAoB,CAAA;AAAA,EAChD;AACF","file":"chunk-RQQNZZAI.cjs","sourcesContent":["import type { RuntimeContext } from '@mastra/core/runtime-context';\nimport type { MastraScorerEntry, ScoreRowData } from '@mastra/core/scores';\nimport type { StoragePagination } from '@mastra/core/storage';\nimport type { Context } from '../types';\nimport { handleError } from './error';\n\nasync function getScorersFromSystem({\n mastra,\n runtimeContext,\n}: Context & {\n runtimeContext: RuntimeContext;\n}) {\n const agents = mastra.getAgents();\n const workflows = mastra.getWorkflows();\n\n const scorersMap = new Map<string, MastraScorerEntry & { agentIds: string[]; workflowIds: string[] }>();\n\n for (const [agentId, agent] of Object.entries(agents)) {\n const scorers =\n (await agent.getScorers({\n runtimeContext,\n })) || {};\n\n if (Object.keys(scorers).length > 0) {\n for (const [scorerId, scorer] of Object.entries(scorers)) {\n if (scorersMap.has(scorerId)) {\n scorersMap.get(scorerId)?.agentIds.push(agentId);\n } else {\n scorersMap.set(scorerId, {\n workflowIds: [],\n ...scorer,\n agentIds: [agentId],\n });\n }\n }\n }\n }\n\n for (const [workflowId, workflow] of Object.entries(workflows)) {\n const scorers =\n (await workflow.getScorers({\n runtimeContext,\n })) || {};\n\n if (Object.keys(scorers).length > 0) {\n for (const [scorerId, scorer] of Object.entries(scorers)) {\n if (scorersMap.has(scorerId)) {\n scorersMap.get(scorerId)?.workflowIds.push(workflowId);\n } else {\n scorersMap.set(scorerId, {\n agentIds: [],\n ...scorer,\n workflowIds: [workflowId],\n });\n }\n }\n }\n }\n\n return Object.fromEntries(scorersMap.entries());\n}\n\nexport async function getScorersHandler({ mastra, runtimeContext }: Context & { runtimeContext: RuntimeContext }) {\n const scorers = await getScorersFromSystem({\n mastra,\n runtimeContext,\n });\n\n return scorers;\n}\n\nexport async function getScorerHandler({\n mastra,\n scorerId,\n runtimeContext,\n}: Context & { scorerId: string; runtimeContext: RuntimeContext }) {\n const scorers = await getScorersFromSystem({\n mastra,\n runtimeContext,\n });\n\n const scorer = scorers[scorerId];\n\n if (!scorer) {\n return null;\n }\n\n return scorer;\n}\n\nexport async function getScoresByRunIdHandler({\n mastra,\n runId,\n pagination,\n}: Context & { runId: string; pagination: StoragePagination }) {\n try {\n const scores =\n (await mastra.getStorage()?.getScoresByRunId?.({\n runId,\n pagination,\n })) || [];\n return scores;\n } catch (error) {\n return handleError(error, 'Error getting scores by run id');\n }\n}\n\nexport async function getScoresByScorerIdHandler({\n mastra,\n scorerId,\n pagination,\n entityId,\n entityType,\n}: Context & { scorerId: string; pagination: StoragePagination; entityId?: string; entityType?: string }) {\n try {\n const scores =\n (await mastra.getStorage()?.getScoresByScorerId?.({\n scorerId,\n pagination,\n entityId,\n entityType,\n })) || [];\n return scores;\n } catch (error) {\n return handleError(error, 'Error getting scores by scorer id');\n }\n}\n\nexport async function getScoresByEntityIdHandler({\n mastra,\n entityId,\n entityType,\n pagination,\n}: Context & { entityId: string; entityType: string; pagination: StoragePagination }) {\n try {\n let entityIdToUse = entityId;\n\n if (entityType === 'AGENT') {\n const agent = mastra.getAgentById(entityId);\n entityIdToUse = agent.id;\n } else if (entityType === 'WORKFLOW') {\n const workflow = mastra.getWorkflowById(entityId);\n entityIdToUse = workflow.id;\n }\n\n const scores =\n (await mastra.getStorage()?.getScoresByEntityId?.({\n entityId: entityIdToUse,\n entityType,\n pagination,\n })) || [];\n\n return scores;\n } catch (error) {\n return handleError(error, 'Error getting scores by entity id');\n }\n}\n\nexport async function saveScoreHandler({ mastra, score }: Context & { score: ScoreRowData }) {\n try {\n const scores = (await mastra.getStorage()?.saveScore?.(score)) || [];\n return scores;\n } catch (error) {\n return handleError(error, 'Error saving score');\n }\n}\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var chunkLRUH33B4_cjs = require('./chunk-LRUH33B4.cjs');
|
|
4
|
+
var chunkRE4RPXT2_cjs = require('./chunk-RE4RPXT2.cjs');
|
|
5
|
+
var chunk7NADHFD2_cjs = require('./chunk-7NADHFD2.cjs');
|
|
6
|
+
var chunkQ7SFCCGT_cjs = require('./chunk-Q7SFCCGT.cjs');
|
|
7
7
|
var web = require('stream/web');
|
|
8
8
|
|
|
9
9
|
// src/server/handlers/workflows.ts
|
|
10
10
|
var workflows_exports = {};
|
|
11
|
-
|
|
11
|
+
chunkQ7SFCCGT_cjs.__export(workflows_exports, {
|
|
12
12
|
cancelWorkflowRunHandler: () => cancelWorkflowRunHandler,
|
|
13
13
|
createWorkflowRunHandler: () => createWorkflowRunHandler,
|
|
14
14
|
getWorkflowByIdHandler: () => getWorkflowByIdHandler,
|
|
@@ -31,10 +31,10 @@ function getSteps(steps, path) {
|
|
|
31
31
|
acc[fullKey] = {
|
|
32
32
|
id: step.id,
|
|
33
33
|
description: step.description,
|
|
34
|
-
inputSchema: step.inputSchema ?
|
|
35
|
-
outputSchema: step.outputSchema ?
|
|
36
|
-
resumeSchema: step.resumeSchema ?
|
|
37
|
-
suspendSchema: step.suspendSchema ?
|
|
34
|
+
inputSchema: step.inputSchema ? chunkLRUH33B4_cjs.stringify(chunkLRUH33B4_cjs.esm_default(step.inputSchema)) : void 0,
|
|
35
|
+
outputSchema: step.outputSchema ? chunkLRUH33B4_cjs.stringify(chunkLRUH33B4_cjs.esm_default(step.outputSchema)) : void 0,
|
|
36
|
+
resumeSchema: step.resumeSchema ? chunkLRUH33B4_cjs.stringify(chunkLRUH33B4_cjs.esm_default(step.resumeSchema)) : void 0,
|
|
37
|
+
suspendSchema: step.suspendSchema ? chunkLRUH33B4_cjs.stringify(chunkLRUH33B4_cjs.esm_default(step.suspendSchema)) : void 0,
|
|
38
38
|
isWorkflow: step.component === "WORKFLOW"
|
|
39
39
|
};
|
|
40
40
|
if (step.component === "WORKFLOW" && step.steps) {
|
|
@@ -55,29 +55,29 @@ async function getWorkflowsHandler({ mastra }) {
|
|
|
55
55
|
acc2[key2] = {
|
|
56
56
|
id: step.id,
|
|
57
57
|
description: step.description,
|
|
58
|
-
inputSchema: step.inputSchema ?
|
|
59
|
-
outputSchema: step.outputSchema ?
|
|
60
|
-
resumeSchema: step.resumeSchema ?
|
|
61
|
-
suspendSchema: step.suspendSchema ?
|
|
58
|
+
inputSchema: step.inputSchema ? chunkLRUH33B4_cjs.stringify(chunkLRUH33B4_cjs.esm_default(step.inputSchema)) : void 0,
|
|
59
|
+
outputSchema: step.outputSchema ? chunkLRUH33B4_cjs.stringify(chunkLRUH33B4_cjs.esm_default(step.outputSchema)) : void 0,
|
|
60
|
+
resumeSchema: step.resumeSchema ? chunkLRUH33B4_cjs.stringify(chunkLRUH33B4_cjs.esm_default(step.resumeSchema)) : void 0,
|
|
61
|
+
suspendSchema: step.suspendSchema ? chunkLRUH33B4_cjs.stringify(chunkLRUH33B4_cjs.esm_default(step.suspendSchema)) : void 0
|
|
62
62
|
};
|
|
63
63
|
return acc2;
|
|
64
64
|
}, {}),
|
|
65
65
|
allSteps: getSteps(workflow.steps) || {},
|
|
66
66
|
stepGraph: workflow.serializedStepGraph,
|
|
67
|
-
inputSchema: workflow.inputSchema ?
|
|
68
|
-
outputSchema: workflow.outputSchema ?
|
|
67
|
+
inputSchema: workflow.inputSchema ? chunkLRUH33B4_cjs.stringify(chunkLRUH33B4_cjs.esm_default(workflow.inputSchema)) : void 0,
|
|
68
|
+
outputSchema: workflow.outputSchema ? chunkLRUH33B4_cjs.stringify(chunkLRUH33B4_cjs.esm_default(workflow.outputSchema)) : void 0
|
|
69
69
|
};
|
|
70
70
|
return acc;
|
|
71
71
|
}, {});
|
|
72
72
|
return _workflows;
|
|
73
73
|
} catch (error) {
|
|
74
|
-
return
|
|
74
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error getting workflows");
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
async function getWorkflowsFromSystem({ mastra, workflowId }) {
|
|
78
78
|
const logger = mastra.getLogger();
|
|
79
79
|
if (!workflowId) {
|
|
80
|
-
throw new
|
|
80
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
81
81
|
}
|
|
82
82
|
let workflow;
|
|
83
83
|
try {
|
|
@@ -104,28 +104,28 @@ async function getWorkflowsFromSystem({ mastra, workflowId }) {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
if (!workflow) {
|
|
107
|
-
throw new
|
|
107
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
108
108
|
}
|
|
109
109
|
return { workflow };
|
|
110
110
|
}
|
|
111
111
|
async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
112
112
|
try {
|
|
113
113
|
if (!workflowId) {
|
|
114
|
-
throw new
|
|
114
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
115
115
|
}
|
|
116
116
|
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
117
117
|
if (!workflow) {
|
|
118
|
-
throw new
|
|
118
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
119
119
|
}
|
|
120
120
|
return {
|
|
121
121
|
steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
|
|
122
122
|
acc[key] = {
|
|
123
123
|
id: step.id,
|
|
124
124
|
description: step.description,
|
|
125
|
-
inputSchema: step.inputSchema ?
|
|
126
|
-
outputSchema: step.outputSchema ?
|
|
127
|
-
resumeSchema: step.resumeSchema ?
|
|
128
|
-
suspendSchema: step.suspendSchema ?
|
|
125
|
+
inputSchema: step.inputSchema ? chunkLRUH33B4_cjs.stringify(chunkLRUH33B4_cjs.esm_default(step.inputSchema)) : void 0,
|
|
126
|
+
outputSchema: step.outputSchema ? chunkLRUH33B4_cjs.stringify(chunkLRUH33B4_cjs.esm_default(step.outputSchema)) : void 0,
|
|
127
|
+
resumeSchema: step.resumeSchema ? chunkLRUH33B4_cjs.stringify(chunkLRUH33B4_cjs.esm_default(step.resumeSchema)) : void 0,
|
|
128
|
+
suspendSchema: step.suspendSchema ? chunkLRUH33B4_cjs.stringify(chunkLRUH33B4_cjs.esm_default(step.suspendSchema)) : void 0
|
|
129
129
|
};
|
|
130
130
|
return acc;
|
|
131
131
|
}, {}),
|
|
@@ -133,11 +133,11 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
|
|
|
133
133
|
name: workflow.name,
|
|
134
134
|
description: workflow.description,
|
|
135
135
|
stepGraph: workflow.serializedStepGraph,
|
|
136
|
-
inputSchema: workflow.inputSchema ?
|
|
137
|
-
outputSchema: workflow.outputSchema ?
|
|
136
|
+
inputSchema: workflow.inputSchema ? chunkLRUH33B4_cjs.stringify(chunkLRUH33B4_cjs.esm_default(workflow.inputSchema)) : void 0,
|
|
137
|
+
outputSchema: workflow.outputSchema ? chunkLRUH33B4_cjs.stringify(chunkLRUH33B4_cjs.esm_default(workflow.outputSchema)) : void 0
|
|
138
138
|
};
|
|
139
139
|
} catch (error) {
|
|
140
|
-
return
|
|
140
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error getting workflow");
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
async function getWorkflowRunByIdHandler({
|
|
@@ -147,22 +147,22 @@ async function getWorkflowRunByIdHandler({
|
|
|
147
147
|
}) {
|
|
148
148
|
try {
|
|
149
149
|
if (!workflowId) {
|
|
150
|
-
throw new
|
|
150
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
151
151
|
}
|
|
152
152
|
if (!runId) {
|
|
153
|
-
throw new
|
|
153
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Run ID is required" });
|
|
154
154
|
}
|
|
155
155
|
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
156
156
|
if (!workflow) {
|
|
157
|
-
throw new
|
|
157
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
158
158
|
}
|
|
159
159
|
const run = await workflow.getWorkflowRunById(runId);
|
|
160
160
|
if (!run) {
|
|
161
|
-
throw new
|
|
161
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
162
162
|
}
|
|
163
163
|
return run;
|
|
164
164
|
} catch (error) {
|
|
165
|
-
return
|
|
165
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error getting workflow run");
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
async function getWorkflowRunExecutionResultHandler({
|
|
@@ -172,22 +172,22 @@ async function getWorkflowRunExecutionResultHandler({
|
|
|
172
172
|
}) {
|
|
173
173
|
try {
|
|
174
174
|
if (!workflowId) {
|
|
175
|
-
throw new
|
|
175
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
176
176
|
}
|
|
177
177
|
if (!runId) {
|
|
178
|
-
throw new
|
|
178
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Run ID is required" });
|
|
179
179
|
}
|
|
180
180
|
const workflow = mastra.getWorkflow(workflowId);
|
|
181
181
|
if (!workflow) {
|
|
182
|
-
throw new
|
|
182
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
183
183
|
}
|
|
184
184
|
const executionResult = await workflow.getWorkflowRunExecutionResult(runId);
|
|
185
185
|
if (!executionResult) {
|
|
186
|
-
throw new
|
|
186
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run execution result not found" });
|
|
187
187
|
}
|
|
188
188
|
return executionResult;
|
|
189
189
|
} catch (error) {
|
|
190
|
-
return
|
|
190
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error getting workflow run execution result");
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
async function createWorkflowRunHandler({
|
|
@@ -197,16 +197,16 @@ async function createWorkflowRunHandler({
|
|
|
197
197
|
}) {
|
|
198
198
|
try {
|
|
199
199
|
if (!workflowId) {
|
|
200
|
-
throw new
|
|
200
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
201
201
|
}
|
|
202
202
|
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
203
203
|
if (!workflow) {
|
|
204
|
-
throw new
|
|
204
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
205
205
|
}
|
|
206
206
|
const run = await workflow.createRunAsync({ runId: prevRunId });
|
|
207
207
|
return { runId: run.runId };
|
|
208
208
|
} catch (error) {
|
|
209
|
-
return
|
|
209
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error creating workflow run");
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
async function startAsyncWorkflowHandler({
|
|
@@ -218,11 +218,11 @@ async function startAsyncWorkflowHandler({
|
|
|
218
218
|
}) {
|
|
219
219
|
try {
|
|
220
220
|
if (!workflowId) {
|
|
221
|
-
throw new
|
|
221
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
222
222
|
}
|
|
223
223
|
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
224
224
|
if (!workflow) {
|
|
225
|
-
throw new
|
|
225
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
226
226
|
}
|
|
227
227
|
const _run = await workflow.createRunAsync({ runId });
|
|
228
228
|
const result = await _run.start({
|
|
@@ -231,7 +231,7 @@ async function startAsyncWorkflowHandler({
|
|
|
231
231
|
});
|
|
232
232
|
return result;
|
|
233
233
|
} catch (error) {
|
|
234
|
-
return
|
|
234
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error starting async workflow");
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
async function startWorkflowRunHandler({
|
|
@@ -243,18 +243,18 @@ async function startWorkflowRunHandler({
|
|
|
243
243
|
}) {
|
|
244
244
|
try {
|
|
245
245
|
if (!workflowId) {
|
|
246
|
-
throw new
|
|
246
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
247
247
|
}
|
|
248
248
|
if (!runId) {
|
|
249
|
-
throw new
|
|
249
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to start run" });
|
|
250
250
|
}
|
|
251
251
|
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
252
252
|
if (!workflow) {
|
|
253
|
-
throw new
|
|
253
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
254
254
|
}
|
|
255
255
|
const run = await workflow.getWorkflowRunById(runId);
|
|
256
256
|
if (!run) {
|
|
257
|
-
throw new
|
|
257
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
258
258
|
}
|
|
259
259
|
const _run = await workflow.createRunAsync({ runId });
|
|
260
260
|
void _run.start({
|
|
@@ -263,7 +263,7 @@ async function startWorkflowRunHandler({
|
|
|
263
263
|
});
|
|
264
264
|
return { message: "Workflow run started" };
|
|
265
265
|
} catch (e) {
|
|
266
|
-
return
|
|
266
|
+
return chunkRE4RPXT2_cjs.handleError(e, "Error starting workflow run");
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
async function watchWorkflowHandler({
|
|
@@ -273,18 +273,18 @@ async function watchWorkflowHandler({
|
|
|
273
273
|
}) {
|
|
274
274
|
try {
|
|
275
275
|
if (!workflowId) {
|
|
276
|
-
throw new
|
|
276
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
277
277
|
}
|
|
278
278
|
if (!runId) {
|
|
279
|
-
throw new
|
|
279
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to watch workflow" });
|
|
280
280
|
}
|
|
281
281
|
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
282
282
|
if (!workflow) {
|
|
283
|
-
throw new
|
|
283
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
284
284
|
}
|
|
285
285
|
const run = await workflow.getWorkflowRunById(runId);
|
|
286
286
|
if (!run) {
|
|
287
|
-
throw new
|
|
287
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
288
288
|
}
|
|
289
289
|
const _run = await workflow.createRunAsync({ runId });
|
|
290
290
|
let unwatch;
|
|
@@ -312,7 +312,7 @@ async function watchWorkflowHandler({
|
|
|
312
312
|
});
|
|
313
313
|
return stream;
|
|
314
314
|
} catch (error) {
|
|
315
|
-
return
|
|
315
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error watching workflow");
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
async function streamWorkflowHandler({
|
|
@@ -324,14 +324,14 @@ async function streamWorkflowHandler({
|
|
|
324
324
|
}) {
|
|
325
325
|
try {
|
|
326
326
|
if (!workflowId) {
|
|
327
|
-
throw new
|
|
327
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
328
328
|
}
|
|
329
329
|
if (!runId) {
|
|
330
|
-
throw new
|
|
330
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
331
331
|
}
|
|
332
332
|
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
333
333
|
if (!workflow) {
|
|
334
|
-
throw new
|
|
334
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
335
335
|
}
|
|
336
336
|
const run = await workflow.createRunAsync({ runId });
|
|
337
337
|
const result = run.stream({
|
|
@@ -340,7 +340,7 @@ async function streamWorkflowHandler({
|
|
|
340
340
|
});
|
|
341
341
|
return result;
|
|
342
342
|
} catch (error) {
|
|
343
|
-
return
|
|
343
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error executing workflow");
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
async function streamVNextWorkflowHandler({
|
|
@@ -352,14 +352,14 @@ async function streamVNextWorkflowHandler({
|
|
|
352
352
|
}) {
|
|
353
353
|
try {
|
|
354
354
|
if (!workflowId) {
|
|
355
|
-
throw new
|
|
355
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
356
356
|
}
|
|
357
357
|
if (!runId) {
|
|
358
|
-
throw new
|
|
358
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to stream workflow" });
|
|
359
359
|
}
|
|
360
360
|
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
361
361
|
if (!workflow) {
|
|
362
|
-
throw new
|
|
362
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
363
363
|
}
|
|
364
364
|
const run = await workflow.createRunAsync({ runId });
|
|
365
365
|
const result = run.streamVNext({
|
|
@@ -368,7 +368,7 @@ async function streamVNextWorkflowHandler({
|
|
|
368
368
|
});
|
|
369
369
|
return result;
|
|
370
370
|
} catch (error) {
|
|
371
|
-
return
|
|
371
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error streaming workflow");
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
async function resumeAsyncWorkflowHandler({
|
|
@@ -380,21 +380,21 @@ async function resumeAsyncWorkflowHandler({
|
|
|
380
380
|
}) {
|
|
381
381
|
try {
|
|
382
382
|
if (!workflowId) {
|
|
383
|
-
throw new
|
|
383
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
384
384
|
}
|
|
385
385
|
if (!runId) {
|
|
386
|
-
throw new
|
|
386
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
387
387
|
}
|
|
388
388
|
if (!body.step) {
|
|
389
|
-
throw new
|
|
389
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
390
390
|
}
|
|
391
391
|
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
392
392
|
if (!workflow) {
|
|
393
|
-
throw new
|
|
393
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
394
394
|
}
|
|
395
395
|
const run = await workflow.getWorkflowRunById(runId);
|
|
396
396
|
if (!run) {
|
|
397
|
-
throw new
|
|
397
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
398
398
|
}
|
|
399
399
|
const _run = await workflow.createRunAsync({ runId });
|
|
400
400
|
const result = await _run.resume({
|
|
@@ -404,7 +404,7 @@ async function resumeAsyncWorkflowHandler({
|
|
|
404
404
|
});
|
|
405
405
|
return result;
|
|
406
406
|
} catch (error) {
|
|
407
|
-
return
|
|
407
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error resuming workflow step");
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
async function resumeWorkflowHandler({
|
|
@@ -416,21 +416,21 @@ async function resumeWorkflowHandler({
|
|
|
416
416
|
}) {
|
|
417
417
|
try {
|
|
418
418
|
if (!workflowId) {
|
|
419
|
-
throw new
|
|
419
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
420
420
|
}
|
|
421
421
|
if (!runId) {
|
|
422
|
-
throw new
|
|
422
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to resume workflow" });
|
|
423
423
|
}
|
|
424
424
|
if (!body.step) {
|
|
425
|
-
throw new
|
|
425
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "step required to resume workflow" });
|
|
426
426
|
}
|
|
427
427
|
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
428
428
|
if (!workflow) {
|
|
429
|
-
throw new
|
|
429
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
430
430
|
}
|
|
431
431
|
const run = await workflow.getWorkflowRunById(runId);
|
|
432
432
|
if (!run) {
|
|
433
|
-
throw new
|
|
433
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
434
434
|
}
|
|
435
435
|
const _run = await workflow.createRunAsync({ runId });
|
|
436
436
|
void _run.resume({
|
|
@@ -440,7 +440,7 @@ async function resumeWorkflowHandler({
|
|
|
440
440
|
});
|
|
441
441
|
return { message: "Workflow run resumed" };
|
|
442
442
|
} catch (error) {
|
|
443
|
-
return
|
|
443
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error resuming workflow");
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
446
|
async function getWorkflowRunsHandler({
|
|
@@ -454,11 +454,11 @@ async function getWorkflowRunsHandler({
|
|
|
454
454
|
}) {
|
|
455
455
|
try {
|
|
456
456
|
if (!workflowId) {
|
|
457
|
-
throw new
|
|
457
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
458
458
|
}
|
|
459
459
|
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
460
460
|
if (!workflow) {
|
|
461
|
-
throw new
|
|
461
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
462
462
|
}
|
|
463
463
|
const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
|
|
464
464
|
runs: [],
|
|
@@ -466,7 +466,7 @@ async function getWorkflowRunsHandler({
|
|
|
466
466
|
};
|
|
467
467
|
return workflowRuns;
|
|
468
468
|
} catch (error) {
|
|
469
|
-
return
|
|
469
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error getting workflow runs");
|
|
470
470
|
}
|
|
471
471
|
}
|
|
472
472
|
async function cancelWorkflowRunHandler({
|
|
@@ -476,24 +476,24 @@ async function cancelWorkflowRunHandler({
|
|
|
476
476
|
}) {
|
|
477
477
|
try {
|
|
478
478
|
if (!workflowId) {
|
|
479
|
-
throw new
|
|
479
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
480
480
|
}
|
|
481
481
|
if (!runId) {
|
|
482
|
-
throw new
|
|
482
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to cancel workflow run" });
|
|
483
483
|
}
|
|
484
484
|
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
485
485
|
if (!workflow) {
|
|
486
|
-
throw new
|
|
486
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
487
487
|
}
|
|
488
488
|
const run = await workflow.getWorkflowRunById(runId);
|
|
489
489
|
if (!run) {
|
|
490
|
-
throw new
|
|
490
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
491
491
|
}
|
|
492
492
|
const _run = await workflow.createRunAsync({ runId });
|
|
493
493
|
await _run.cancel();
|
|
494
494
|
return { message: "Workflow run cancelled" };
|
|
495
495
|
} catch (error) {
|
|
496
|
-
return
|
|
496
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error canceling workflow run");
|
|
497
497
|
}
|
|
498
498
|
}
|
|
499
499
|
async function sendWorkflowRunEventHandler({
|
|
@@ -505,24 +505,24 @@ async function sendWorkflowRunEventHandler({
|
|
|
505
505
|
}) {
|
|
506
506
|
try {
|
|
507
507
|
if (!workflowId) {
|
|
508
|
-
throw new
|
|
508
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
509
509
|
}
|
|
510
510
|
if (!runId) {
|
|
511
|
-
throw new
|
|
511
|
+
throw new chunk7NADHFD2_cjs.HTTPException(400, { message: "runId required to send workflow run event" });
|
|
512
512
|
}
|
|
513
513
|
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
514
514
|
if (!workflow) {
|
|
515
|
-
throw new
|
|
515
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
516
516
|
}
|
|
517
517
|
const run = await workflow.getWorkflowRunById(runId);
|
|
518
518
|
if (!run) {
|
|
519
|
-
throw new
|
|
519
|
+
throw new chunk7NADHFD2_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
520
520
|
}
|
|
521
521
|
const _run = await workflow.createRunAsync({ runId });
|
|
522
522
|
await _run.sendEvent(event, data);
|
|
523
523
|
return { message: "Workflow run event sent" };
|
|
524
524
|
} catch (error) {
|
|
525
|
-
return
|
|
525
|
+
return chunkRE4RPXT2_cjs.handleError(error, "Error sending workflow run event");
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
528
|
|
|
@@ -542,3 +542,5 @@ exports.streamVNextWorkflowHandler = streamVNextWorkflowHandler;
|
|
|
542
542
|
exports.streamWorkflowHandler = streamWorkflowHandler;
|
|
543
543
|
exports.watchWorkflowHandler = watchWorkflowHandler;
|
|
544
544
|
exports.workflows_exports = workflows_exports;
|
|
545
|
+
//# sourceMappingURL=chunk-S37KCGOR.cjs.map
|
|
546
|
+
//# sourceMappingURL=chunk-S37KCGOR.cjs.map
|