@mastra/server 0.10.10-alpha.0 → 0.10.10
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/_tsup-dts-rollup.d.cts +9 -1
- package/dist/_tsup-dts-rollup.d.ts +9 -1
- package/dist/{chunk-SAI3WQ7Z.cjs → chunk-B2PAS2IB.cjs} +31 -0
- package/dist/{chunk-I2PBVVNV.js → chunk-H7DMHBKY.js} +31 -1
- package/dist/server/handlers/workflows.cjs +18 -14
- package/dist/server/handlers/workflows.d.cts +1 -0
- package/dist/server/handlers/workflows.d.ts +1 -0
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +2 -2
- package/dist/server/handlers.js +1 -1
- package/package.json +3 -3
|
@@ -791,6 +791,13 @@ export declare function saveMessagesHandler({ mastra, agentId, body, networkId,
|
|
|
791
791
|
};
|
|
792
792
|
}): Promise<MastraMessageV1[]>;
|
|
793
793
|
|
|
794
|
+
export declare function sendWorkflowRunEventHandler({ mastra, workflowId, runId, event, data, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
795
|
+
event: string;
|
|
796
|
+
data: unknown;
|
|
797
|
+
}): Promise<{
|
|
798
|
+
message: string;
|
|
799
|
+
}>;
|
|
800
|
+
|
|
794
801
|
declare type SerializedStep = {
|
|
795
802
|
id: string;
|
|
796
803
|
description: string;
|
|
@@ -1063,7 +1070,8 @@ export declare namespace workflows {
|
|
|
1063
1070
|
resumeAsyncWorkflowHandler,
|
|
1064
1071
|
resumeWorkflowHandler,
|
|
1065
1072
|
getWorkflowRunsHandler,
|
|
1066
|
-
cancelWorkflowRunHandler
|
|
1073
|
+
cancelWorkflowRunHandler,
|
|
1074
|
+
sendWorkflowRunEventHandler
|
|
1067
1075
|
}
|
|
1068
1076
|
}
|
|
1069
1077
|
|
|
@@ -791,6 +791,13 @@ export declare function saveMessagesHandler({ mastra, agentId, body, networkId,
|
|
|
791
791
|
};
|
|
792
792
|
}): Promise<MastraMessageV1[]>;
|
|
793
793
|
|
|
794
|
+
export declare function sendWorkflowRunEventHandler({ mastra, workflowId, runId, event, data, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
|
|
795
|
+
event: string;
|
|
796
|
+
data: unknown;
|
|
797
|
+
}): Promise<{
|
|
798
|
+
message: string;
|
|
799
|
+
}>;
|
|
800
|
+
|
|
794
801
|
declare type SerializedStep = {
|
|
795
802
|
id: string;
|
|
796
803
|
description: string;
|
|
@@ -1063,7 +1070,8 @@ export declare namespace workflows {
|
|
|
1063
1070
|
resumeAsyncWorkflowHandler,
|
|
1064
1071
|
resumeWorkflowHandler,
|
|
1065
1072
|
getWorkflowRunsHandler,
|
|
1066
|
-
cancelWorkflowRunHandler
|
|
1073
|
+
cancelWorkflowRunHandler,
|
|
1074
|
+
sendWorkflowRunEventHandler
|
|
1067
1075
|
}
|
|
1068
1076
|
}
|
|
1069
1077
|
|
|
@@ -18,6 +18,7 @@ chunk75ZPJI57_cjs.__export(workflows_exports, {
|
|
|
18
18
|
getWorkflowsHandler: () => getWorkflowsHandler,
|
|
19
19
|
resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
|
|
20
20
|
resumeWorkflowHandler: () => resumeWorkflowHandler,
|
|
21
|
+
sendWorkflowRunEventHandler: () => sendWorkflowRunEventHandler,
|
|
21
22
|
startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
|
|
22
23
|
startWorkflowRunHandler: () => startWorkflowRunHandler,
|
|
23
24
|
streamWorkflowHandler: () => streamWorkflowHandler,
|
|
@@ -466,6 +467,35 @@ async function cancelWorkflowRunHandler({
|
|
|
466
467
|
return chunkPZQDCRPV_cjs.handleError(error, "Error canceling workflow run");
|
|
467
468
|
}
|
|
468
469
|
}
|
|
470
|
+
async function sendWorkflowRunEventHandler({
|
|
471
|
+
mastra,
|
|
472
|
+
workflowId,
|
|
473
|
+
runId,
|
|
474
|
+
event,
|
|
475
|
+
data
|
|
476
|
+
}) {
|
|
477
|
+
try {
|
|
478
|
+
if (!workflowId) {
|
|
479
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "Workflow ID is required" });
|
|
480
|
+
}
|
|
481
|
+
if (!runId) {
|
|
482
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(400, { message: "runId required to send workflow run event" });
|
|
483
|
+
}
|
|
484
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
485
|
+
if (!workflow) {
|
|
486
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow not found" });
|
|
487
|
+
}
|
|
488
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
489
|
+
if (!run) {
|
|
490
|
+
throw new chunk2KZFMI6P_cjs.HTTPException(404, { message: "Workflow run not found" });
|
|
491
|
+
}
|
|
492
|
+
const _run = await workflow.createRunAsync({ runId });
|
|
493
|
+
await _run.sendEvent(event, data);
|
|
494
|
+
return { message: "Workflow run event sent" };
|
|
495
|
+
} catch (error) {
|
|
496
|
+
return chunkPZQDCRPV_cjs.handleError(error, "Error sending workflow run event");
|
|
497
|
+
}
|
|
498
|
+
}
|
|
469
499
|
|
|
470
500
|
exports.cancelWorkflowRunHandler = cancelWorkflowRunHandler;
|
|
471
501
|
exports.createWorkflowRunHandler = createWorkflowRunHandler;
|
|
@@ -476,6 +506,7 @@ exports.getWorkflowRunsHandler = getWorkflowRunsHandler;
|
|
|
476
506
|
exports.getWorkflowsHandler = getWorkflowsHandler;
|
|
477
507
|
exports.resumeAsyncWorkflowHandler = resumeAsyncWorkflowHandler;
|
|
478
508
|
exports.resumeWorkflowHandler = resumeWorkflowHandler;
|
|
509
|
+
exports.sendWorkflowRunEventHandler = sendWorkflowRunEventHandler;
|
|
479
510
|
exports.startAsyncWorkflowHandler = startAsyncWorkflowHandler;
|
|
480
511
|
exports.startWorkflowRunHandler = startWorkflowRunHandler;
|
|
481
512
|
exports.streamWorkflowHandler = streamWorkflowHandler;
|
|
@@ -16,6 +16,7 @@ __export(workflows_exports, {
|
|
|
16
16
|
getWorkflowsHandler: () => getWorkflowsHandler,
|
|
17
17
|
resumeAsyncWorkflowHandler: () => resumeAsyncWorkflowHandler,
|
|
18
18
|
resumeWorkflowHandler: () => resumeWorkflowHandler,
|
|
19
|
+
sendWorkflowRunEventHandler: () => sendWorkflowRunEventHandler,
|
|
19
20
|
startAsyncWorkflowHandler: () => startAsyncWorkflowHandler,
|
|
20
21
|
startWorkflowRunHandler: () => startWorkflowRunHandler,
|
|
21
22
|
streamWorkflowHandler: () => streamWorkflowHandler,
|
|
@@ -464,5 +465,34 @@ async function cancelWorkflowRunHandler({
|
|
|
464
465
|
return handleError(error, "Error canceling workflow run");
|
|
465
466
|
}
|
|
466
467
|
}
|
|
468
|
+
async function sendWorkflowRunEventHandler({
|
|
469
|
+
mastra,
|
|
470
|
+
workflowId,
|
|
471
|
+
runId,
|
|
472
|
+
event,
|
|
473
|
+
data
|
|
474
|
+
}) {
|
|
475
|
+
try {
|
|
476
|
+
if (!workflowId) {
|
|
477
|
+
throw new HTTPException(400, { message: "Workflow ID is required" });
|
|
478
|
+
}
|
|
479
|
+
if (!runId) {
|
|
480
|
+
throw new HTTPException(400, { message: "runId required to send workflow run event" });
|
|
481
|
+
}
|
|
482
|
+
const { workflow } = await getWorkflowsFromSystem({ mastra, workflowId });
|
|
483
|
+
if (!workflow) {
|
|
484
|
+
throw new HTTPException(404, { message: "Workflow not found" });
|
|
485
|
+
}
|
|
486
|
+
const run = await workflow.getWorkflowRunById(runId);
|
|
487
|
+
if (!run) {
|
|
488
|
+
throw new HTTPException(404, { message: "Workflow run not found" });
|
|
489
|
+
}
|
|
490
|
+
const _run = await workflow.createRunAsync({ runId });
|
|
491
|
+
await _run.sendEvent(event, data);
|
|
492
|
+
return { message: "Workflow run event sent" };
|
|
493
|
+
} catch (error) {
|
|
494
|
+
return handleError(error, "Error sending workflow run event");
|
|
495
|
+
}
|
|
496
|
+
}
|
|
467
497
|
|
|
468
|
-
export { cancelWorkflowRunHandler, createWorkflowRunHandler, getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunExecutionResultHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, streamWorkflowHandler, watchWorkflowHandler, workflows_exports };
|
|
498
|
+
export { cancelWorkflowRunHandler, createWorkflowRunHandler, getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunExecutionResultHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, sendWorkflowRunEventHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, streamWorkflowHandler, watchWorkflowHandler, workflows_exports };
|
|
@@ -1,58 +1,62 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkB2PAS2IB_cjs = require('../../chunk-B2PAS2IB.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "cancelWorkflowRunHandler", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkB2PAS2IB_cjs.cancelWorkflowRunHandler; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "createWorkflowRunHandler", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkB2PAS2IB_cjs.createWorkflowRunHandler; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getWorkflowByIdHandler", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkB2PAS2IB_cjs.getWorkflowByIdHandler; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "getWorkflowRunByIdHandler", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkB2PAS2IB_cjs.getWorkflowRunByIdHandler; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "getWorkflowRunExecutionResultHandler", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkB2PAS2IB_cjs.getWorkflowRunExecutionResultHandler; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "getWorkflowRunsHandler", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkB2PAS2IB_cjs.getWorkflowRunsHandler; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "getWorkflowsHandler", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkB2PAS2IB_cjs.getWorkflowsHandler; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "resumeAsyncWorkflowHandler", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkB2PAS2IB_cjs.resumeAsyncWorkflowHandler; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "resumeWorkflowHandler", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkB2PAS2IB_cjs.resumeWorkflowHandler; }
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "sendWorkflowRunEventHandler", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () { return chunkB2PAS2IB_cjs.sendWorkflowRunEventHandler; }
|
|
42
46
|
});
|
|
43
47
|
Object.defineProperty(exports, "startAsyncWorkflowHandler", {
|
|
44
48
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkB2PAS2IB_cjs.startAsyncWorkflowHandler; }
|
|
46
50
|
});
|
|
47
51
|
Object.defineProperty(exports, "startWorkflowRunHandler", {
|
|
48
52
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkB2PAS2IB_cjs.startWorkflowRunHandler; }
|
|
50
54
|
});
|
|
51
55
|
Object.defineProperty(exports, "streamWorkflowHandler", {
|
|
52
56
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunkB2PAS2IB_cjs.streamWorkflowHandler; }
|
|
54
58
|
});
|
|
55
59
|
Object.defineProperty(exports, "watchWorkflowHandler", {
|
|
56
60
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunkB2PAS2IB_cjs.watchWorkflowHandler; }
|
|
58
62
|
});
|
|
@@ -11,3 +11,4 @@ export { resumeAsyncWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
|
|
|
11
11
|
export { resumeWorkflowHandler } from '../../_tsup-dts-rollup.cjs';
|
|
12
12
|
export { getWorkflowRunsHandler } from '../../_tsup-dts-rollup.cjs';
|
|
13
13
|
export { cancelWorkflowRunHandler } from '../../_tsup-dts-rollup.cjs';
|
|
14
|
+
export { sendWorkflowRunEventHandler } from '../../_tsup-dts-rollup.cjs';
|
|
@@ -11,3 +11,4 @@ export { resumeAsyncWorkflowHandler } from '../../_tsup-dts-rollup.js';
|
|
|
11
11
|
export { resumeWorkflowHandler } from '../../_tsup-dts-rollup.js';
|
|
12
12
|
export { getWorkflowRunsHandler } from '../../_tsup-dts-rollup.js';
|
|
13
13
|
export { cancelWorkflowRunHandler } from '../../_tsup-dts-rollup.js';
|
|
14
|
+
export { sendWorkflowRunEventHandler } from '../../_tsup-dts-rollup.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { cancelWorkflowRunHandler, createWorkflowRunHandler, getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunExecutionResultHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, streamWorkflowHandler, watchWorkflowHandler } from '../../chunk-
|
|
1
|
+
export { cancelWorkflowRunHandler, createWorkflowRunHandler, getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunExecutionResultHandler, getWorkflowRunsHandler, getWorkflowsHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, sendWorkflowRunEventHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, streamWorkflowHandler, watchWorkflowHandler } from '../../chunk-H7DMHBKY.js';
|
package/dist/server/handlers.cjs
CHANGED
|
@@ -5,7 +5,7 @@ var chunkG7KH752Y_cjs = require('../chunk-G7KH752Y.cjs');
|
|
|
5
5
|
var chunkFRVBFMO2_cjs = require('../chunk-FRVBFMO2.cjs');
|
|
6
6
|
var chunk7TP2LX5L_cjs = require('../chunk-7TP2LX5L.cjs');
|
|
7
7
|
var chunkRHSWAXKB_cjs = require('../chunk-RHSWAXKB.cjs');
|
|
8
|
-
var
|
|
8
|
+
var chunkB2PAS2IB_cjs = require('../chunk-B2PAS2IB.cjs');
|
|
9
9
|
var chunkSDPGVWQJ_cjs = require('../chunk-SDPGVWQJ.cjs');
|
|
10
10
|
var chunkLZ3VJXSO_cjs = require('../chunk-LZ3VJXSO.cjs');
|
|
11
11
|
var chunkJMLYCXMK_cjs = require('../chunk-JMLYCXMK.cjs');
|
|
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "voice", {
|
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(exports, "workflows", {
|
|
38
38
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkB2PAS2IB_cjs.workflows_exports; }
|
|
40
40
|
});
|
|
41
41
|
Object.defineProperty(exports, "a2a", {
|
|
42
42
|
enumerable: true,
|
package/dist/server/handlers.js
CHANGED
|
@@ -3,7 +3,7 @@ export { telemetry_exports as telemetry } from '../chunk-RG473F6Y.js';
|
|
|
3
3
|
export { tools_exports as tools } from '../chunk-LRCAAFUA.js';
|
|
4
4
|
export { vector_exports as vector } from '../chunk-WNVFNNWN.js';
|
|
5
5
|
export { voice_exports as voice } from '../chunk-KHZKYUNR.js';
|
|
6
|
-
export { workflows_exports as workflows } from '../chunk-
|
|
6
|
+
export { workflows_exports as workflows } from '../chunk-H7DMHBKY.js';
|
|
7
7
|
export { a2a_exports as a2a } from '../chunk-GHC4YV6R.js';
|
|
8
8
|
export { agents_exports as agents } from '../chunk-BK4XT6EG.js';
|
|
9
9
|
export { legacyWorkflows_exports as legacyWorkflows } from '../chunk-5PQQ42EZ.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/server",
|
|
3
|
-
"version": "0.10.10
|
|
3
|
+
"version": "0.10.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"vitest": "^3.2.4",
|
|
60
60
|
"zod": "^3.25.67",
|
|
61
61
|
"zod-to-json-schema": "^3.24.5",
|
|
62
|
-
"@internal/lint": "0.0.
|
|
63
|
-
"@mastra/core": "0.10.10
|
|
62
|
+
"@internal/lint": "0.0.17",
|
|
63
|
+
"@mastra/core": "0.10.10"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
66
|
"build": "tsup src/index.ts src/server/handlers.ts src/server/handlers/*.ts !src/server/handlers/*.test.ts --format esm,cjs --clean --experimental-dts --treeshake=smallest --splitting",
|