@mastra/server 1.56.0-alpha.2 → 1.56.0-alpha.4
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 +43 -0
- package/dist/_types/@internal_voice/dist/_types/@internal_core/dist/request-context/index.d.ts +6 -0
- package/dist/{a2a-DaFY01Nq.js → a2a-BHqh8DdO.js} +2 -2
- package/dist/{a2a-DaFY01Nq.js.map → a2a-BHqh8DdO.js.map} +1 -1
- package/dist/{a2a-_ekkh9Eo.cjs → a2a-Dmw3AD3r.cjs} +2 -2
- package/dist/{a2a-_ekkh9Eo.cjs.map → a2a-Dmw3AD3r.cjs.map} +1 -1
- package/dist/{agent-builder-CaeaWZFr.cjs → agent-builder-BDYN3r89.cjs} +2 -2
- package/dist/{agent-builder-CaeaWZFr.cjs.map → agent-builder-BDYN3r89.cjs.map} +1 -1
- package/dist/{agent-builder-B077LU0q.js → agent-builder-Dqy_qumV.js} +2 -2
- package/dist/{agent-builder-B077LU0q.js.map → agent-builder-Dqy_qumV.js.map} +1 -1
- package/dist/{api-schema-manifest-TXvvzJiU.cjs → api-schema-manifest-BD9sVZgj.cjs} +2 -2
- package/dist/{api-schema-manifest-TXvvzJiU.cjs.map → api-schema-manifest-BD9sVZgj.cjs.map} +1 -1
- package/dist/{api-schema-manifest-BT6M02Lr.js → api-schema-manifest-DOHg_30B.js} +2 -2
- package/dist/{api-schema-manifest-BT6M02Lr.js.map → api-schema-manifest-DOHg_30B.js.map} +1 -1
- package/dist/{builder-registry-DLAloBZv.cjs → builder-registry-NmiGAW1q.cjs} +2 -2
- package/dist/{builder-registry-DLAloBZv.cjs.map → builder-registry-NmiGAW1q.cjs.map} +1 -1
- package/dist/{builder-registry-D-6UWXLu.js → builder-registry-dh22nXUR.js} +2 -2
- package/dist/{builder-registry-D-6UWXLu.js.map → builder-registry-dh22nXUR.js.map} +1 -1
- package/dist/{dist-CgHgmUmP.js → dist-BlHxui7N.js} +183 -33
- package/dist/dist-BlHxui7N.js.map +1 -0
- package/dist/{dist-3OAfymQm.cjs → dist-D9hQEsv9.cjs} +183 -33
- package/dist/dist-D9hQEsv9.cjs.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/{routes-5DQoCzuO.cjs → routes-Bmt4vUom.cjs} +19 -3
- package/dist/routes-Bmt4vUom.cjs.map +1 -0
- package/dist/{routes-C_zs_0NM.js → routes-YeBVxmmg.js} +19 -3
- package/dist/routes-YeBVxmmg.js.map +1 -0
- package/dist/server/fga-permissions.d.ts.map +1 -1
- package/dist/server/handlers/a2a.cjs +1 -1
- package/dist/server/handlers/a2a.d.ts +4 -4
- package/dist/server/handlers/a2a.js +1 -1
- package/dist/server/handlers/agent-builder.cjs +4 -4
- package/dist/server/handlers/agent-builder.d.ts +35 -5
- package/dist/server/handlers/agent-builder.d.ts.map +1 -1
- package/dist/server/handlers/agent-builder.js +4 -4
- package/dist/server/handlers/agent-versions.cjs +1 -1
- package/dist/server/handlers/agent-versions.js +1 -1
- package/dist/server/handlers/agents.cjs +2 -2
- package/dist/server/handlers/agents.js +2 -2
- package/dist/server/handlers/builder-registry.cjs +1 -1
- package/dist/server/handlers/builder-registry.js +1 -1
- package/dist/server/handlers/conversations.cjs +1 -1
- package/dist/server/handlers/conversations.js +1 -1
- package/dist/server/handlers/datasets.d.ts +11 -11
- package/dist/server/handlers/logs.cjs +1 -1
- package/dist/server/handlers/logs.js +1 -1
- package/dist/server/handlers/mcp-client-versions.cjs +1 -1
- package/dist/server/handlers/mcp-client-versions.js +1 -1
- package/dist/server/handlers/memory.cjs +1 -1
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/prompt-block-versions.cjs +1 -1
- package/dist/server/handlers/prompt-block-versions.js +1 -1
- package/dist/server/handlers/responses.cjs +1 -1
- package/dist/server/handlers/responses.js +1 -1
- package/dist/server/handlers/responses.storage.cjs +1 -1
- package/dist/server/handlers/responses.storage.js +1 -1
- package/dist/server/handlers/scorer-versions.cjs +1 -1
- package/dist/server/handlers/scorer-versions.js +1 -1
- package/dist/server/handlers/stored-agent-favorites.cjs +1 -1
- package/dist/server/handlers/stored-agent-favorites.js +1 -1
- package/dist/server/handlers/stored-agents.cjs +1 -1
- package/dist/server/handlers/stored-agents.js +1 -1
- package/dist/server/handlers/stored-mcp-clients.cjs +1 -1
- package/dist/server/handlers/stored-mcp-clients.js +1 -1
- package/dist/server/handlers/stored-prompt-blocks.cjs +1 -1
- package/dist/server/handlers/stored-prompt-blocks.js +1 -1
- package/dist/server/handlers/stored-scorers.cjs +1 -1
- package/dist/server/handlers/stored-scorers.js +1 -1
- package/dist/server/handlers/stored-skill-favorites.cjs +1 -1
- package/dist/server/handlers/stored-skill-favorites.js +1 -1
- package/dist/server/handlers/stored-skills.cjs +1 -1
- package/dist/server/handlers/stored-skills.js +1 -1
- package/dist/server/handlers/stored-workflows.cjs +6 -0
- package/dist/server/handlers/stored-workflows.d.ts +820 -0
- package/dist/server/handlers/stored-workflows.d.ts.map +1 -0
- package/dist/server/handlers/stored-workflows.js +2 -0
- package/dist/server/handlers/stored-workspaces.cjs +1 -1
- package/dist/server/handlers/stored-workspaces.js +1 -1
- package/dist/server/handlers/system.cjs +1 -1
- package/dist/server/handlers/system.js +1 -1
- package/dist/server/handlers/tools.cjs +2 -2
- package/dist/server/handlers/tools.js +2 -2
- package/dist/server/handlers/utils.cjs +1 -1
- package/dist/server/handlers/utils.js +1 -1
- package/dist/server/handlers/workflows.cjs +4 -4
- package/dist/server/handlers/workflows.cjs.map +1 -1
- package/dist/server/handlers/workflows.d.ts +45 -7
- package/dist/server/handlers/workflows.d.ts.map +1 -1
- package/dist/server/handlers/workflows.js +4 -4
- package/dist/server/handlers/workflows.js.map +1 -1
- package/dist/server/handlers.cjs +8 -1
- package/dist/server/handlers.d.ts +1 -0
- package/dist/server/handlers.d.ts.map +1 -1
- package/dist/server/handlers.js +3 -2
- package/dist/server/schemas/a2a.d.ts +3 -3
- package/dist/server/schemas/datasets.d.ts +5 -5
- package/dist/server/schemas/index.cjs +2 -2
- package/dist/server/schemas/index.js +2 -2
- package/dist/server/schemas/stored-workflows.d.ts +614 -0
- package/dist/server/schemas/stored-workflows.d.ts.map +1 -0
- package/dist/server/schemas/workflows.d.ts +24 -0
- package/dist/server/schemas/workflows.d.ts.map +1 -1
- package/dist/server/server-adapter/index.cjs +2 -2
- package/dist/server/server-adapter/index.js +2 -2
- package/dist/server/server-adapter/routes/a2a.d.ts +4 -4
- package/dist/server/server-adapter/routes/agent-builder.d.ts +35 -5
- package/dist/server/server-adapter/routes/agent-builder.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/datasets.d.ts +11 -11
- package/dist/server/server-adapter/routes/index.d.ts.map +1 -1
- package/dist/server/server-adapter/routes/stored-workflows.d.ts +16 -0
- package/dist/server/server-adapter/routes/stored-workflows.d.ts.map +1 -0
- package/dist/server/server-adapter/routes/workflows.d.ts +45 -7
- package/dist/server/server-adapter/routes/workflows.d.ts.map +1 -1
- package/dist/server/utils.d.ts.map +1 -1
- package/dist/stored-workflows-B3zZJg8e.js +338 -0
- package/dist/stored-workflows-B3zZJg8e.js.map +1 -0
- package/dist/stored-workflows-RgQKpn7N.cjs +367 -0
- package/dist/stored-workflows-RgQKpn7N.cjs.map +1 -0
- package/dist/{utils-BNoVHi8G.cjs → utils-5wLvbOLW.cjs} +4 -2
- package/dist/{utils-BNoVHi8G.cjs.map → utils-5wLvbOLW.cjs.map} +1 -1
- package/dist/{utils-Bfyc8rsg.js → utils-CmHd1Sgh.js} +3 -1
- package/dist/{utils-C1_mI2Ws.cjs.map → utils-CmHd1Sgh.js.map} +1 -1
- package/dist/{utils-EZi2K0ph.js → utils-DVelcVp5.js} +4 -2
- package/dist/{utils-EZi2K0ph.js.map → utils-DVelcVp5.js.map} +1 -1
- package/dist/{utils-C1_mI2Ws.cjs → utils-wTwyTjg3.cjs} +3 -1
- package/dist/utils-wTwyTjg3.cjs.map +1 -0
- package/dist/{workflows-CiUa_yVU.js → workflows-DPW6FrY0.js} +8 -3
- package/dist/workflows-DPW6FrY0.js.map +1 -0
- package/dist/{workflows-Bxy77CRQ.cjs → workflows-XfiENvkF.cjs} +8 -3
- package/dist/workflows-XfiENvkF.cjs.map +1 -0
- package/package.json +7 -7
- package/dist/dist-3OAfymQm.cjs.map +0 -1
- package/dist/dist-CgHgmUmP.js.map +0 -1
- package/dist/routes-5DQoCzuO.cjs.map +0 -1
- package/dist/routes-C_zs_0NM.js.map +0 -1
- package/dist/utils-Bfyc8rsg.js.map +0 -1
- package/dist/workflows-Bxy77CRQ.cjs.map +0 -1
- package/dist/workflows-CiUa_yVU.js.map +0 -1
|
@@ -26,7 +26,7 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
26
26
|
metadata?: Record<string, unknown> | undefined;
|
|
27
27
|
}>;
|
|
28
28
|
stepGraph: {
|
|
29
|
-
type: "step" | "sleep" | "sleepUntil" | "waitForEvent" | "parallel" | "conditional" | "loop" | "foreach";
|
|
29
|
+
type: "step" | "agent" | "tool" | "mapping" | "sleep" | "sleepUntil" | "waitForEvent" | "parallel" | "conditional" | "loop" | "foreach" | "workflow";
|
|
30
30
|
}[];
|
|
31
31
|
name?: string | undefined;
|
|
32
32
|
description?: string | undefined;
|
|
@@ -36,6 +36,7 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
36
36
|
stateSchema?: string | undefined;
|
|
37
37
|
options?: Record<string, never> | undefined;
|
|
38
38
|
isProcessorWorkflow?: boolean | undefined;
|
|
39
|
+
origin?: "code" | "stored" | undefined;
|
|
39
40
|
}>, "json", import(".").RouteSchemas<undefined, import("zod").ZodObject<{
|
|
40
41
|
partial: import("zod").ZodOptional<import("zod").ZodString>;
|
|
41
42
|
}, import("zod/v4/core").$strip>, undefined, import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodObject<{
|
|
@@ -69,6 +70,9 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
69
70
|
stepGraph: import("zod").ZodArray<import("zod").ZodObject<{
|
|
70
71
|
type: import("zod").ZodEnum<{
|
|
71
72
|
step: "step";
|
|
73
|
+
agent: "agent";
|
|
74
|
+
tool: "tool";
|
|
75
|
+
mapping: "mapping";
|
|
72
76
|
sleep: "sleep";
|
|
73
77
|
sleepUntil: "sleepUntil";
|
|
74
78
|
waitForEvent: "waitForEvent";
|
|
@@ -76,6 +80,7 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
76
80
|
conditional: "conditional";
|
|
77
81
|
loop: "loop";
|
|
78
82
|
foreach: "foreach";
|
|
83
|
+
workflow: "workflow";
|
|
79
84
|
}>;
|
|
80
85
|
}, import("zod/v4/core").$strip>>;
|
|
81
86
|
inputSchema: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -83,6 +88,10 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
83
88
|
stateSchema: import("zod").ZodOptional<import("zod").ZodString>;
|
|
84
89
|
options: import("zod").ZodOptional<import("zod").ZodObject<{}, import("zod/v4/core").$strip>>;
|
|
85
90
|
isProcessorWorkflow: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
91
|
+
origin: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
92
|
+
code: "code";
|
|
93
|
+
stored: "stored";
|
|
94
|
+
}>>;
|
|
86
95
|
}, import("zod/v4/core").$strip>>>, "GET", "/workflows">, import(".").ServerRoute<{
|
|
87
96
|
workflowId: string;
|
|
88
97
|
}, {
|
|
@@ -111,7 +120,7 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
111
120
|
metadata?: Record<string, unknown> | undefined;
|
|
112
121
|
}>;
|
|
113
122
|
stepGraph: {
|
|
114
|
-
type: "step" | "sleep" | "sleepUntil" | "waitForEvent" | "parallel" | "conditional" | "loop" | "foreach";
|
|
123
|
+
type: "step" | "agent" | "tool" | "mapping" | "sleep" | "sleepUntil" | "waitForEvent" | "parallel" | "conditional" | "loop" | "foreach" | "workflow";
|
|
115
124
|
}[];
|
|
116
125
|
name?: string | undefined;
|
|
117
126
|
description?: string | undefined;
|
|
@@ -121,6 +130,7 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
121
130
|
stateSchema?: string | undefined;
|
|
122
131
|
options?: Record<string, never> | undefined;
|
|
123
132
|
isProcessorWorkflow?: boolean | undefined;
|
|
133
|
+
origin?: "code" | "stored" | undefined;
|
|
124
134
|
}, "json", import(".").RouteSchemas<import("zod").ZodObject<{
|
|
125
135
|
workflowId: import("zod").ZodString;
|
|
126
136
|
}, import("zod/v4/core").$strip>, undefined, undefined, import("zod").ZodObject<{
|
|
@@ -154,6 +164,9 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
154
164
|
stepGraph: import("zod").ZodArray<import("zod").ZodObject<{
|
|
155
165
|
type: import("zod").ZodEnum<{
|
|
156
166
|
step: "step";
|
|
167
|
+
agent: "agent";
|
|
168
|
+
tool: "tool";
|
|
169
|
+
mapping: "mapping";
|
|
157
170
|
sleep: "sleep";
|
|
158
171
|
sleepUntil: "sleepUntil";
|
|
159
172
|
waitForEvent: "waitForEvent";
|
|
@@ -161,6 +174,7 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
161
174
|
conditional: "conditional";
|
|
162
175
|
loop: "loop";
|
|
163
176
|
foreach: "foreach";
|
|
177
|
+
workflow: "workflow";
|
|
164
178
|
}>;
|
|
165
179
|
}, import("zod/v4/core").$strip>>;
|
|
166
180
|
inputSchema: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -168,6 +182,10 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
168
182
|
stateSchema: import("zod").ZodOptional<import("zod").ZodString>;
|
|
169
183
|
options: import("zod").ZodOptional<import("zod").ZodObject<{}, import("zod/v4/core").$strip>>;
|
|
170
184
|
isProcessorWorkflow: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
185
|
+
origin: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
186
|
+
code: "code";
|
|
187
|
+
stored: "stored";
|
|
188
|
+
}>>;
|
|
171
189
|
}, import("zod/v4/core").$strip>>, "GET", "/workflows/:workflowId">, import(".").ServerRoute<import(".").InferParams<import("zod").ZodObject<{
|
|
172
190
|
workflowId: import("zod").ZodString;
|
|
173
191
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
@@ -257,7 +275,7 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
257
275
|
steps?: Record<string, unknown> | undefined;
|
|
258
276
|
activeStepsPath?: Record<string, number[]> | undefined;
|
|
259
277
|
serializedStepGraph?: {
|
|
260
|
-
type: "step" | "sleep" | "sleepUntil" | "waitForEvent" | "parallel" | "conditional" | "loop" | "foreach";
|
|
278
|
+
type: "step" | "agent" | "tool" | "mapping" | "sleep" | "sleepUntil" | "waitForEvent" | "parallel" | "conditional" | "loop" | "foreach" | "workflow";
|
|
261
279
|
}[] | undefined;
|
|
262
280
|
}, "json", import(".").RouteSchemas<import("zod").ZodObject<{
|
|
263
281
|
workflowId: import("zod").ZodString;
|
|
@@ -296,6 +314,9 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
296
314
|
serializedStepGraph: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
297
315
|
type: import("zod").ZodEnum<{
|
|
298
316
|
step: "step";
|
|
317
|
+
agent: "agent";
|
|
318
|
+
tool: "tool";
|
|
319
|
+
mapping: "mapping";
|
|
299
320
|
sleep: "sleep";
|
|
300
321
|
sleepUntil: "sleepUntil";
|
|
301
322
|
waitForEvent: "waitForEvent";
|
|
@@ -303,6 +324,7 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
303
324
|
conditional: "conditional";
|
|
304
325
|
loop: "loop";
|
|
305
326
|
foreach: "foreach";
|
|
327
|
+
workflow: "workflow";
|
|
306
328
|
}>;
|
|
307
329
|
}, import("zod/v4/core").$strip>>>;
|
|
308
330
|
}, import("zod/v4/core").$strip>>, "GET", "/workflows/:workflowId/runs/:runId">, import(".").ServerRoute<{
|
|
@@ -439,7 +461,7 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
439
461
|
steps?: Record<string, unknown> | undefined;
|
|
440
462
|
activeStepsPath?: Record<string, number[]> | undefined;
|
|
441
463
|
serializedStepGraph?: {
|
|
442
|
-
type: "step" | "sleep" | "sleepUntil" | "waitForEvent" | "parallel" | "conditional" | "loop" | "foreach";
|
|
464
|
+
type: "step" | "agent" | "tool" | "mapping" | "sleep" | "sleepUntil" | "waitForEvent" | "parallel" | "conditional" | "loop" | "foreach" | "workflow";
|
|
443
465
|
}[] | undefined;
|
|
444
466
|
}, "json", import(".").RouteSchemas<import("zod").ZodObject<{
|
|
445
467
|
workflowId: import("zod").ZodString;
|
|
@@ -483,6 +505,9 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
483
505
|
serializedStepGraph: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
484
506
|
type: import("zod").ZodEnum<{
|
|
485
507
|
step: "step";
|
|
508
|
+
agent: "agent";
|
|
509
|
+
tool: "tool";
|
|
510
|
+
mapping: "mapping";
|
|
486
511
|
sleep: "sleep";
|
|
487
512
|
sleepUntil: "sleepUntil";
|
|
488
513
|
waitForEvent: "waitForEvent";
|
|
@@ -490,6 +515,7 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
490
515
|
conditional: "conditional";
|
|
491
516
|
loop: "loop";
|
|
492
517
|
foreach: "foreach";
|
|
518
|
+
workflow: "workflow";
|
|
493
519
|
}>;
|
|
494
520
|
}, import("zod/v4/core").$strip>>>;
|
|
495
521
|
}, import("zod/v4/core").$strip>>, "POST", "/workflows/:workflowId/start-async">, import(".").ServerRoute<import(".").InferParams<import("zod").ZodObject<{
|
|
@@ -572,7 +598,7 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
572
598
|
steps?: Record<string, unknown> | undefined;
|
|
573
599
|
activeStepsPath?: Record<string, number[]> | undefined;
|
|
574
600
|
serializedStepGraph?: {
|
|
575
|
-
type: "step" | "sleep" | "sleepUntil" | "waitForEvent" | "parallel" | "conditional" | "loop" | "foreach";
|
|
601
|
+
type: "step" | "agent" | "tool" | "mapping" | "sleep" | "sleepUntil" | "waitForEvent" | "parallel" | "conditional" | "loop" | "foreach" | "workflow";
|
|
576
602
|
}[] | undefined;
|
|
577
603
|
}, "json", import(".").RouteSchemas<import("zod").ZodObject<{
|
|
578
604
|
workflowId: import("zod").ZodString;
|
|
@@ -616,6 +642,9 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
616
642
|
serializedStepGraph: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
617
643
|
type: import("zod").ZodEnum<{
|
|
618
644
|
step: "step";
|
|
645
|
+
agent: "agent";
|
|
646
|
+
tool: "tool";
|
|
647
|
+
mapping: "mapping";
|
|
619
648
|
sleep: "sleep";
|
|
620
649
|
sleepUntil: "sleepUntil";
|
|
621
650
|
waitForEvent: "waitForEvent";
|
|
@@ -623,6 +652,7 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
623
652
|
conditional: "conditional";
|
|
624
653
|
loop: "loop";
|
|
625
654
|
foreach: "foreach";
|
|
655
|
+
workflow: "workflow";
|
|
626
656
|
}>;
|
|
627
657
|
}, import("zod/v4/core").$strip>>>;
|
|
628
658
|
}, import("zod/v4/core").$strip>>, "POST", "/workflows/:workflowId/resume-async">, import(".").ServerRoute<import(".").InferParams<import("zod").ZodObject<{
|
|
@@ -798,7 +828,7 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
798
828
|
steps?: Record<string, unknown> | undefined;
|
|
799
829
|
activeStepsPath?: Record<string, number[]> | undefined;
|
|
800
830
|
serializedStepGraph?: {
|
|
801
|
-
type: "step" | "sleep" | "sleepUntil" | "waitForEvent" | "parallel" | "conditional" | "loop" | "foreach";
|
|
831
|
+
type: "step" | "agent" | "tool" | "mapping" | "sleep" | "sleepUntil" | "waitForEvent" | "parallel" | "conditional" | "loop" | "foreach" | "workflow";
|
|
802
832
|
}[] | undefined;
|
|
803
833
|
}, "json", import(".").RouteSchemas<import("zod").ZodObject<{
|
|
804
834
|
workflowId: import("zod").ZodString;
|
|
@@ -845,6 +875,9 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
845
875
|
serializedStepGraph: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
846
876
|
type: import("zod").ZodEnum<{
|
|
847
877
|
step: "step";
|
|
878
|
+
agent: "agent";
|
|
879
|
+
tool: "tool";
|
|
880
|
+
mapping: "mapping";
|
|
848
881
|
sleep: "sleep";
|
|
849
882
|
sleepUntil: "sleepUntil";
|
|
850
883
|
waitForEvent: "waitForEvent";
|
|
@@ -852,6 +885,7 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
852
885
|
conditional: "conditional";
|
|
853
886
|
loop: "loop";
|
|
854
887
|
foreach: "foreach";
|
|
888
|
+
workflow: "workflow";
|
|
855
889
|
}>;
|
|
856
890
|
}, import("zod/v4/core").$strip>>>;
|
|
857
891
|
}, import("zod/v4/core").$strip>>, "POST", "/workflows/:workflowId/time-travel-async">, import(".").ServerRoute<import(".").InferParams<import("zod").ZodObject<{
|
|
@@ -956,7 +990,7 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
956
990
|
steps?: Record<string, unknown> | undefined;
|
|
957
991
|
activeStepsPath?: Record<string, number[]> | undefined;
|
|
958
992
|
serializedStepGraph?: {
|
|
959
|
-
type: "step" | "sleep" | "sleepUntil" | "waitForEvent" | "parallel" | "conditional" | "loop" | "foreach";
|
|
993
|
+
type: "step" | "agent" | "tool" | "mapping" | "sleep" | "sleepUntil" | "waitForEvent" | "parallel" | "conditional" | "loop" | "foreach" | "workflow";
|
|
960
994
|
}[] | undefined;
|
|
961
995
|
}, "json", import(".").RouteSchemas<import("zod").ZodObject<{
|
|
962
996
|
workflowId: import("zod").ZodString;
|
|
@@ -996,6 +1030,9 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
996
1030
|
serializedStepGraph: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
997
1031
|
type: import("zod").ZodEnum<{
|
|
998
1032
|
step: "step";
|
|
1033
|
+
agent: "agent";
|
|
1034
|
+
tool: "tool";
|
|
1035
|
+
mapping: "mapping";
|
|
999
1036
|
sleep: "sleep";
|
|
1000
1037
|
sleepUntil: "sleepUntil";
|
|
1001
1038
|
waitForEvent: "waitForEvent";
|
|
@@ -1003,6 +1040,7 @@ export declare const WORKFLOWS_ROUTES: readonly [import(".").ServerRoute<{
|
|
|
1003
1040
|
conditional: "conditional";
|
|
1004
1041
|
loop: "loop";
|
|
1005
1042
|
foreach: "foreach";
|
|
1043
|
+
workflow: "workflow";
|
|
1006
1044
|
}>;
|
|
1007
1045
|
}, import("zod/v4/core").$strip>>>;
|
|
1008
1046
|
}, import("zod/v4/core").$strip>>, "POST", "/workflows/:workflowId/restart-async">, import(".").ServerRoute<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../../../src/server/server-adapter/routes/workflows.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../../../src/server/server-adapter/routes/workflows.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM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2
|
+
import { t as HTTPException } from "./http-exception-CyfxZB6W.js";
|
|
3
|
+
import { n as createRoute } from "./route-builder-CXe0EI1P.js";
|
|
4
|
+
import { handleError } from "./server/handlers/error.js";
|
|
5
|
+
import { z } from "zod/v4";
|
|
6
|
+
//#region src/server/schemas/stored-workflows.ts
|
|
7
|
+
const stepOptionsSchema = z.object({
|
|
8
|
+
retries: z.number().int().nonnegative().optional(),
|
|
9
|
+
metadata: z.record(z.string(), z.unknown()).optional()
|
|
10
|
+
}).optional();
|
|
11
|
+
const literalScalar = z.union([
|
|
12
|
+
z.string(),
|
|
13
|
+
z.number(),
|
|
14
|
+
z.boolean(),
|
|
15
|
+
z.null()
|
|
16
|
+
]);
|
|
17
|
+
const pathOrLiteral = z.union([z.object({ path: z.string().min(1) }).strict(), z.object({ literal: literalScalar }).strict()]);
|
|
18
|
+
const predicateSchema = z.lazy(() => z.union([
|
|
19
|
+
z.object({
|
|
20
|
+
op: z.enum([
|
|
21
|
+
"eq",
|
|
22
|
+
"ne",
|
|
23
|
+
"lt",
|
|
24
|
+
"lte",
|
|
25
|
+
"gt",
|
|
26
|
+
"gte"
|
|
27
|
+
]),
|
|
28
|
+
left: pathOrLiteral,
|
|
29
|
+
right: pathOrLiteral
|
|
30
|
+
}).strict(),
|
|
31
|
+
z.object({
|
|
32
|
+
op: z.enum(["in", "notIn"]),
|
|
33
|
+
value: pathOrLiteral,
|
|
34
|
+
set: z.array(literalScalar).min(1)
|
|
35
|
+
}).strict(),
|
|
36
|
+
z.object({
|
|
37
|
+
op: z.enum(["exists", "notExists"]),
|
|
38
|
+
path: z.string().min(1)
|
|
39
|
+
}).strict(),
|
|
40
|
+
z.object({
|
|
41
|
+
op: z.enum(["truthy", "falsy"]),
|
|
42
|
+
value: pathOrLiteral
|
|
43
|
+
}).strict(),
|
|
44
|
+
z.object({
|
|
45
|
+
op: z.enum(["and", "or"]),
|
|
46
|
+
args: z.array(predicateSchema).min(1)
|
|
47
|
+
}).strict(),
|
|
48
|
+
z.object({
|
|
49
|
+
op: z.literal("not"),
|
|
50
|
+
arg: predicateSchema
|
|
51
|
+
}).strict()
|
|
52
|
+
]));
|
|
53
|
+
const agentEntrySchema = z.object({
|
|
54
|
+
type: z.literal("agent"),
|
|
55
|
+
id: z.string(),
|
|
56
|
+
agentId: z.string(),
|
|
57
|
+
description: z.string().optional(),
|
|
58
|
+
outputSchema: z.record(z.string(), z.unknown()).optional(),
|
|
59
|
+
options: stepOptionsSchema
|
|
60
|
+
});
|
|
61
|
+
const toolEntrySchema = z.object({
|
|
62
|
+
type: z.literal("tool"),
|
|
63
|
+
id: z.string(),
|
|
64
|
+
toolId: z.string(),
|
|
65
|
+
description: z.string().optional(),
|
|
66
|
+
options: stepOptionsSchema
|
|
67
|
+
});
|
|
68
|
+
const mappingEntrySchema = z.object({
|
|
69
|
+
type: z.literal("mapping"),
|
|
70
|
+
id: z.string(),
|
|
71
|
+
mapConfig: z.string()
|
|
72
|
+
});
|
|
73
|
+
const workflowEntrySchema = z.object({
|
|
74
|
+
type: z.literal("workflow"),
|
|
75
|
+
id: z.string(),
|
|
76
|
+
workflowId: z.string(),
|
|
77
|
+
description: z.string().optional()
|
|
78
|
+
});
|
|
79
|
+
const singleStepEntrySchema = z.discriminatedUnion("type", [
|
|
80
|
+
agentEntrySchema,
|
|
81
|
+
toolEntrySchema,
|
|
82
|
+
mappingEntrySchema,
|
|
83
|
+
workflowEntrySchema
|
|
84
|
+
]);
|
|
85
|
+
const foreachInnerStepSchema = z.discriminatedUnion("type", [
|
|
86
|
+
agentEntrySchema,
|
|
87
|
+
toolEntrySchema,
|
|
88
|
+
workflowEntrySchema
|
|
89
|
+
]);
|
|
90
|
+
const graphEntrySchema = z.discriminatedUnion("type", [
|
|
91
|
+
agentEntrySchema,
|
|
92
|
+
toolEntrySchema,
|
|
93
|
+
mappingEntrySchema,
|
|
94
|
+
workflowEntrySchema,
|
|
95
|
+
z.object({
|
|
96
|
+
type: z.literal("parallel"),
|
|
97
|
+
steps: z.array(singleStepEntrySchema)
|
|
98
|
+
}),
|
|
99
|
+
z.object({
|
|
100
|
+
type: z.literal("foreach"),
|
|
101
|
+
step: foreachInnerStepSchema,
|
|
102
|
+
opts: z.object({ concurrency: z.number().int().positive() }).optional()
|
|
103
|
+
}),
|
|
104
|
+
z.object({
|
|
105
|
+
type: z.literal("sleep"),
|
|
106
|
+
id: z.string(),
|
|
107
|
+
duration: z.number()
|
|
108
|
+
}),
|
|
109
|
+
z.object({
|
|
110
|
+
type: z.literal("sleepUntil"),
|
|
111
|
+
id: z.string(),
|
|
112
|
+
date: z.string()
|
|
113
|
+
}),
|
|
114
|
+
z.object({
|
|
115
|
+
type: z.literal("conditional"),
|
|
116
|
+
steps: z.array(singleStepEntrySchema),
|
|
117
|
+
predicates: z.array(predicateSchema)
|
|
118
|
+
}).refine((entry) => entry.predicates.length === entry.steps.length, {
|
|
119
|
+
message: "conditional entries must have exactly one predicate per branch (`predicates` and `steps` must be the same length)",
|
|
120
|
+
path: ["predicates"]
|
|
121
|
+
}),
|
|
122
|
+
z.object({
|
|
123
|
+
type: z.literal("loop"),
|
|
124
|
+
step: singleStepEntrySchema,
|
|
125
|
+
loopType: z.enum(["dowhile", "dountil"]),
|
|
126
|
+
predicate: predicateSchema
|
|
127
|
+
})
|
|
128
|
+
]);
|
|
129
|
+
const storedWorkflowIdPathParams = z.object({ storedWorkflowId: z.string().describe("Unique identifier for the stored workflow definition") });
|
|
130
|
+
const listStoredWorkflowsQuerySchema = z.object({
|
|
131
|
+
status: z.enum(["active", "archived"]).optional().describe("Filter stored workflows by status (defaults to active when omitted by the handler)"),
|
|
132
|
+
authorId: z.string().optional().describe("Filter stored workflows by author identifier")
|
|
133
|
+
});
|
|
134
|
+
/**
|
|
135
|
+
* One static workflow definition on the wire. Matches the input shape of
|
|
136
|
+
* `mastra.addStoredWorkflow()`.
|
|
137
|
+
*/
|
|
138
|
+
const storedWorkflowDefinitionBodySchema = z.object({
|
|
139
|
+
id: z.string().describe("Workflow id — kebab-case, descriptive"),
|
|
140
|
+
description: z.string().optional(),
|
|
141
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
142
|
+
inputSchema: z.record(z.string(), z.unknown()).describe("JSON Schema (Draft 2020-12) for the workflow input"),
|
|
143
|
+
outputSchema: z.record(z.string(), z.unknown()).describe("JSON Schema (Draft 2020-12) for the workflow output"),
|
|
144
|
+
stateSchema: z.record(z.string(), z.unknown()).optional(),
|
|
145
|
+
requestContextSchema: z.record(z.string(), z.unknown()).optional(),
|
|
146
|
+
graph: z.array(graphEntrySchema).describe("Static workflow graph — ordered array of serialized step entries with all refs as ids.")
|
|
147
|
+
});
|
|
148
|
+
/**
|
|
149
|
+
* Body for `POST /stored/workflows` — upsert a static workflow definition,
|
|
150
|
+
* optionally together with the helper workflows it nests.
|
|
151
|
+
*/
|
|
152
|
+
const upsertStoredWorkflowBodySchema = storedWorkflowDefinitionBodySchema.extend({ dependencies: z.array(storedWorkflowDefinitionBodySchema).optional().describe("Helper workflow definitions this workflow nests. Saved with it as one unit — the whole set is validated together, hydrated in derived dependency order, and rejected together, so a failed save never leaves orphaned helpers behind. Each helper becomes an ordinary stored workflow in its own right.") });
|
|
153
|
+
/**
|
|
154
|
+
* Shape returned for any single stored workflow row.
|
|
155
|
+
*/
|
|
156
|
+
const storedWorkflowResponseSchema = z.object({
|
|
157
|
+
id: z.string(),
|
|
158
|
+
description: z.string().optional(),
|
|
159
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
160
|
+
inputSchema: z.unknown(),
|
|
161
|
+
outputSchema: z.unknown(),
|
|
162
|
+
stateSchema: z.unknown().optional(),
|
|
163
|
+
requestContextSchema: z.unknown().optional(),
|
|
164
|
+
graph: z.array(z.unknown()),
|
|
165
|
+
status: z.enum(["active", "archived"]),
|
|
166
|
+
source: z.literal("storage"),
|
|
167
|
+
authorId: z.string().optional(),
|
|
168
|
+
createdAt: z.union([z.date(), z.string()]),
|
|
169
|
+
updatedAt: z.union([z.date(), z.string()])
|
|
170
|
+
});
|
|
171
|
+
const listStoredWorkflowsResponseSchema = z.object({
|
|
172
|
+
workflows: z.array(storedWorkflowResponseSchema),
|
|
173
|
+
total: z.number()
|
|
174
|
+
});
|
|
175
|
+
const getStoredWorkflowResponseSchema = storedWorkflowResponseSchema;
|
|
176
|
+
const upsertStoredWorkflowResponseSchema = z.object({
|
|
177
|
+
ok: z.literal(true),
|
|
178
|
+
id: z.string(),
|
|
179
|
+
dependencyIds: z.array(z.string()).optional().describe("Ids of the helper workflows saved alongside this one. Present only when dependencies were supplied.")
|
|
180
|
+
});
|
|
181
|
+
const deleteStoredWorkflowResponseSchema = z.object({
|
|
182
|
+
success: z.literal(true),
|
|
183
|
+
message: z.string()
|
|
184
|
+
});
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region src/server/handlers/stored-workflows.ts
|
|
187
|
+
var stored_workflows_exports = /* @__PURE__ */ __exportAll({
|
|
188
|
+
DELETE_STORED_WORKFLOW_ROUTE: () => DELETE_STORED_WORKFLOW_ROUTE,
|
|
189
|
+
GET_STORED_WORKFLOW_ROUTE: () => GET_STORED_WORKFLOW_ROUTE,
|
|
190
|
+
LIST_STORED_WORKFLOWS_ROUTE: () => LIST_STORED_WORKFLOWS_ROUTE,
|
|
191
|
+
UPSERT_STORED_WORKFLOW_ROUTE: () => UPSERT_STORED_WORKFLOW_ROUTE
|
|
192
|
+
});
|
|
193
|
+
/**
|
|
194
|
+
* GET /stored/workflows — list stored static workflow definitions.
|
|
195
|
+
*
|
|
196
|
+
* Mirrors `LIST_STORED_AGENTS_ROUTE` but without favorites/visibility/authorship
|
|
197
|
+
* scoping (which the workflow-definitions domain doesn't carry in v1).
|
|
198
|
+
*/
|
|
199
|
+
const LIST_STORED_WORKFLOWS_ROUTE = createRoute({
|
|
200
|
+
method: "GET",
|
|
201
|
+
path: "/stored/workflows",
|
|
202
|
+
responseType: "json",
|
|
203
|
+
queryParamSchema: listStoredWorkflowsQuerySchema,
|
|
204
|
+
responseSchema: listStoredWorkflowsResponseSchema,
|
|
205
|
+
summary: "List stored workflow definitions",
|
|
206
|
+
description: "Returns workflow definitions persisted to storage. Filterable by status and authorId.",
|
|
207
|
+
tags: ["Stored Workflows"],
|
|
208
|
+
requiresAuth: true,
|
|
209
|
+
requiresPermission: "stored-workflows:read",
|
|
210
|
+
handler: async ({ mastra, status, authorId }) => {
|
|
211
|
+
try {
|
|
212
|
+
const storage = mastra.getStorage();
|
|
213
|
+
if (!storage) throw new HTTPException(500, { message: "Storage is not configured" });
|
|
214
|
+
const store = await storage.getStore("workflowDefinitions");
|
|
215
|
+
if (!store) throw new HTTPException(500, { message: "workflowDefinitions storage domain is not available" });
|
|
216
|
+
const result = await store.list({
|
|
217
|
+
status: status ?? "active",
|
|
218
|
+
authorId
|
|
219
|
+
});
|
|
220
|
+
return {
|
|
221
|
+
workflows: result.definitions,
|
|
222
|
+
total: result.total
|
|
223
|
+
};
|
|
224
|
+
} catch (error) {
|
|
225
|
+
return handleError(error, "Error listing stored workflows");
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
/**
|
|
230
|
+
* GET /stored/workflows/:storedWorkflowId — get one stored workflow.
|
|
231
|
+
*/
|
|
232
|
+
const GET_STORED_WORKFLOW_ROUTE = createRoute({
|
|
233
|
+
method: "GET",
|
|
234
|
+
path: "/stored/workflows/:storedWorkflowId",
|
|
235
|
+
responseType: "json",
|
|
236
|
+
pathParamSchema: storedWorkflowIdPathParams,
|
|
237
|
+
responseSchema: getStoredWorkflowResponseSchema,
|
|
238
|
+
summary: "Get a stored workflow definition by id",
|
|
239
|
+
description: "Returns a single workflow definition persisted to storage.",
|
|
240
|
+
tags: ["Stored Workflows"],
|
|
241
|
+
requiresAuth: true,
|
|
242
|
+
requiresPermission: "stored-workflows:read",
|
|
243
|
+
handler: async ({ mastra, storedWorkflowId }) => {
|
|
244
|
+
try {
|
|
245
|
+
const storage = mastra.getStorage();
|
|
246
|
+
if (!storage) throw new HTTPException(500, { message: "Storage is not configured" });
|
|
247
|
+
const store = await storage.getStore("workflowDefinitions");
|
|
248
|
+
if (!store) throw new HTTPException(500, { message: "workflowDefinitions storage domain is not available" });
|
|
249
|
+
const def = await store.get(storedWorkflowId);
|
|
250
|
+
if (!def) throw new HTTPException(404, { message: `Stored workflow "${storedWorkflowId}" not found` });
|
|
251
|
+
return def;
|
|
252
|
+
} catch (error) {
|
|
253
|
+
return handleError(error, "Error getting stored workflow");
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
/**
|
|
258
|
+
* POST /stored/workflows — upsert a static workflow definition and live-register
|
|
259
|
+
* it on the Mastra instance.
|
|
260
|
+
*
|
|
261
|
+
* Calls `mastra.addStoredWorkflow(def)` which persists the row + rehydrates a
|
|
262
|
+
* runnable workflow + registers it via `mastra.addWorkflow(workflow, id)`.
|
|
263
|
+
* After this returns, `GET /workflows/:id` and `POST /workflows/:id/run` work
|
|
264
|
+
* immediately — no server restart needed.
|
|
265
|
+
*/
|
|
266
|
+
const UPSERT_STORED_WORKFLOW_ROUTE = createRoute({
|
|
267
|
+
method: "POST",
|
|
268
|
+
path: "/stored/workflows",
|
|
269
|
+
responseType: "json",
|
|
270
|
+
bodySchema: upsertStoredWorkflowBodySchema,
|
|
271
|
+
responseSchema: upsertStoredWorkflowResponseSchema,
|
|
272
|
+
summary: "Upsert a stored workflow definition and live-register it",
|
|
273
|
+
description: "Persists a static workflow definition and live-registers it on the running Mastra instance. Idempotent — same id updates in place.",
|
|
274
|
+
tags: ["Stored Workflows"],
|
|
275
|
+
requiresAuth: true,
|
|
276
|
+
requiresPermission: "stored-workflows:write",
|
|
277
|
+
handler: async ({ mastra, id, description, metadata, inputSchema, outputSchema, stateSchema, requestContextSchema, graph, dependencies }) => {
|
|
278
|
+
try {
|
|
279
|
+
const def = {
|
|
280
|
+
id,
|
|
281
|
+
description,
|
|
282
|
+
metadata,
|
|
283
|
+
inputSchema,
|
|
284
|
+
outputSchema,
|
|
285
|
+
stateSchema,
|
|
286
|
+
requestContextSchema,
|
|
287
|
+
graph
|
|
288
|
+
};
|
|
289
|
+
const bundle = [...dependencies ?? [], def];
|
|
290
|
+
await mastra.addStoredWorkflows(bundle);
|
|
291
|
+
return {
|
|
292
|
+
ok: true,
|
|
293
|
+
id: def.id,
|
|
294
|
+
...dependencies?.length ? { dependencyIds: dependencies.map((dependency) => dependency.id) } : {}
|
|
295
|
+
};
|
|
296
|
+
} catch (error) {
|
|
297
|
+
return handleError(error, "Error upserting stored workflow");
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
/**
|
|
302
|
+
* DELETE /stored/workflows/:storedWorkflowId — delete a stored workflow.
|
|
303
|
+
*
|
|
304
|
+
* Removes the row from storage AND un-registers the live Workflow instance so
|
|
305
|
+
* a subsequent POST with the same id starts from a clean slate. Idempotent.
|
|
306
|
+
*/
|
|
307
|
+
const DELETE_STORED_WORKFLOW_ROUTE = createRoute({
|
|
308
|
+
method: "DELETE",
|
|
309
|
+
path: "/stored/workflows/:storedWorkflowId",
|
|
310
|
+
responseType: "json",
|
|
311
|
+
pathParamSchema: storedWorkflowIdPathParams,
|
|
312
|
+
responseSchema: deleteStoredWorkflowResponseSchema,
|
|
313
|
+
summary: "Delete a stored workflow definition",
|
|
314
|
+
description: "Removes a stored workflow definition and unregisters the live workflow instance. Idempotent.",
|
|
315
|
+
tags: ["Stored Workflows"],
|
|
316
|
+
requiresAuth: true,
|
|
317
|
+
requiresPermission: "stored-workflows:write",
|
|
318
|
+
handler: async ({ mastra, storedWorkflowId }) => {
|
|
319
|
+
try {
|
|
320
|
+
const storage = mastra.getStorage();
|
|
321
|
+
if (!storage) throw new HTTPException(500, { message: "Storage is not configured" });
|
|
322
|
+
const store = await storage.getStore("workflowDefinitions");
|
|
323
|
+
if (!store) throw new HTTPException(500, { message: "workflowDefinitions storage domain is not available" });
|
|
324
|
+
await store.delete(storedWorkflowId);
|
|
325
|
+
mastra.removeWorkflow(storedWorkflowId);
|
|
326
|
+
return {
|
|
327
|
+
success: true,
|
|
328
|
+
message: `Workflow ${storedWorkflowId} deleted`
|
|
329
|
+
};
|
|
330
|
+
} catch (error) {
|
|
331
|
+
return handleError(error, "Error deleting stored workflow");
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
//#endregion
|
|
336
|
+
export { stored_workflows_exports as a, UPSERT_STORED_WORKFLOW_ROUTE as i, GET_STORED_WORKFLOW_ROUTE as n, LIST_STORED_WORKFLOWS_ROUTE as r, DELETE_STORED_WORKFLOW_ROUTE as t };
|
|
337
|
+
|
|
338
|
+
//# sourceMappingURL=stored-workflows-B3zZJg8e.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stored-workflows-B3zZJg8e.js","names":[],"sources":["../src/server/schemas/stored-workflows.ts","../src/server/handlers/stored-workflows.ts"],"sourcesContent":["import { z } from 'zod/v4';\n\n// ============================================================================\n// Serialized graph — discriminated union mirroring core's SerializedStepFlowEntry.\n// Duplicated locally rather than imported from @mastra/core/workflows because\n// this file's peer-dependency floor predates that export. Structurally\n// compatible with `Mastra.addStoredWorkflow`'s input; the handler casts once\n// to bridge the remaining wire-vs-runtime divergences (sleepUntil.date as\n// ISO string, fluent-builder-only debug labels) that the core rehydrator\n// handles at runtime.\n// ============================================================================\n\nconst stepOptionsSchema = z\n .object({\n retries: z.number().int().nonnegative().optional(),\n metadata: z.record(z.string(), z.unknown()).optional(),\n })\n .optional();\n\n// ----------------------------------------------------------------------------\n// Predicate DSL — declarative condition for `conditional` / `loop` entries.\n// Mirrors `Predicate` in `@mastra/core/workflows/predicate`; duplicated\n// locally for the same peer-floor reason as the graph schema above.\n// ----------------------------------------------------------------------------\nconst literalScalar = z.union([z.string(), z.number(), z.boolean(), z.null()]);\nconst pathOrLiteral: z.ZodType = z.union([\n z.object({ path: z.string().min(1) }).strict(),\n z.object({ literal: literalScalar }).strict(),\n]);\nconst predicateSchema: z.ZodType = z.lazy(() =>\n z.union([\n z\n .object({\n op: z.enum(['eq', 'ne', 'lt', 'lte', 'gt', 'gte']),\n left: pathOrLiteral,\n right: pathOrLiteral,\n })\n .strict(),\n z\n .object({\n op: z.enum(['in', 'notIn']),\n value: pathOrLiteral,\n set: z.array(literalScalar).min(1),\n })\n .strict(),\n z.object({ op: z.enum(['exists', 'notExists']), path: z.string().min(1) }).strict(),\n z.object({ op: z.enum(['truthy', 'falsy']), value: pathOrLiteral }).strict(),\n z.object({ op: z.enum(['and', 'or']), args: z.array(predicateSchema).min(1) }).strict(),\n z.object({ op: z.literal('not'), arg: predicateSchema }).strict(),\n ]),\n);\n\nconst agentEntrySchema = z.object({\n type: z.literal('agent'),\n id: z.string(),\n agentId: z.string(),\n description: z.string().optional(),\n outputSchema: z.record(z.string(), z.unknown()).optional(),\n options: stepOptionsSchema,\n});\n\nconst toolEntrySchema = z.object({\n type: z.literal('tool'),\n id: z.string(),\n toolId: z.string(),\n description: z.string().optional(),\n options: stepOptionsSchema,\n});\n\nconst mappingEntrySchema = z.object({\n type: z.literal('mapping'),\n id: z.string(),\n mapConfig: z.string(),\n});\n\nconst workflowEntrySchema = z.object({\n type: z.literal('workflow'),\n id: z.string(),\n workflowId: z.string(),\n description: z.string().optional(),\n});\n\nconst singleStepEntrySchema = z.discriminatedUnion('type', [\n agentEntrySchema,\n toolEntrySchema,\n mappingEntrySchema,\n workflowEntrySchema,\n]);\n\nconst foreachInnerStepSchema = z.discriminatedUnion('type', [agentEntrySchema, toolEntrySchema, workflowEntrySchema]);\n\nconst graphEntrySchema = z.discriminatedUnion('type', [\n agentEntrySchema,\n toolEntrySchema,\n mappingEntrySchema,\n workflowEntrySchema,\n z.object({\n type: z.literal('parallel'),\n steps: z.array(singleStepEntrySchema),\n }),\n z.object({\n type: z.literal('foreach'),\n step: foreachInnerStepSchema,\n opts: z.object({ concurrency: z.number().int().positive() }).optional(),\n }),\n z.object({\n type: z.literal('sleep'),\n id: z.string(),\n duration: z.number(),\n }),\n z.object({\n type: z.literal('sleepUntil'),\n id: z.string(),\n date: z.string(),\n }),\n z\n .object({\n // Declarative-only conditional. Inbound stored workflows must ship a\n // `predicates` array aligned with `steps`; closure-based branches are not\n // accepted over the wire (they'd be arbitrary JS strings we can't\n // safely rehydrate).\n type: z.literal('conditional'),\n steps: z.array(singleStepEntrySchema),\n predicates: z.array(predicateSchema),\n })\n .refine(entry => entry.predicates.length === entry.steps.length, {\n message:\n 'conditional entries must have exactly one predicate per branch (`predicates` and `steps` must be the same length)',\n path: ['predicates'],\n }),\n z.object({\n // Declarative-only loop. Same rationale as `conditional`.\n type: z.literal('loop'),\n step: singleStepEntrySchema,\n loopType: z.enum(['dowhile', 'dountil']),\n predicate: predicateSchema,\n }),\n]);\n\n// ============================================================================\n// Path params\n// ============================================================================\n\nexport const storedWorkflowIdPathParams = z.object({\n storedWorkflowId: z.string().describe('Unique identifier for the stored workflow definition'),\n});\n\n// ============================================================================\n// Query params\n// ============================================================================\n\nexport const listStoredWorkflowsQuerySchema = z.object({\n status: z\n .enum(['active', 'archived'])\n .optional()\n .describe('Filter stored workflows by status (defaults to active when omitted by the handler)'),\n authorId: z.string().optional().describe('Filter stored workflows by author identifier'),\n});\n\n// ============================================================================\n// Body schemas\n// ============================================================================\n\n/**\n * One static workflow definition on the wire. Matches the input shape of\n * `mastra.addStoredWorkflow()`.\n */\nexport const storedWorkflowDefinitionBodySchema = z.object({\n id: z.string().describe('Workflow id — kebab-case, descriptive'),\n description: z.string().optional(),\n metadata: z.record(z.string(), z.unknown()).optional(),\n // Schemas are loose object bags by design: different JSON Schema producers\n // emit slightly different shapes and core's `JsonSchema` type is\n // `Record<string, any>`. Using `z.record` here aligns with that shape so\n // no cast is needed at the handler boundary.\n inputSchema: z.record(z.string(), z.unknown()).describe('JSON Schema (Draft 2020-12) for the workflow input'),\n outputSchema: z.record(z.string(), z.unknown()).describe('JSON Schema (Draft 2020-12) for the workflow output'),\n stateSchema: z.record(z.string(), z.unknown()).optional(),\n requestContextSchema: z.record(z.string(), z.unknown()).optional(),\n graph: z\n .array(graphEntrySchema)\n .describe('Static workflow graph — ordered array of serialized step entries with all refs as ids.'),\n});\n\n/**\n * Body for `POST /stored/workflows` — upsert a static workflow definition,\n * optionally together with the helper workflows it nests.\n */\nexport const upsertStoredWorkflowBodySchema = storedWorkflowDefinitionBodySchema.extend({\n // Deliberately a FLAT list rather than a recursive tree: helpers are peers\n // of each other, hydration order is derived from the graphs, and a\n // self-referential Zod schema would not survive OpenAPI generation.\n dependencies: z\n .array(storedWorkflowDefinitionBodySchema)\n .optional()\n .describe(\n 'Helper workflow definitions this workflow nests. Saved with it as one unit — the whole set is validated together, ' +\n 'hydrated in derived dependency order, and rejected together, so a failed save never leaves orphaned helpers behind. ' +\n 'Each helper becomes an ordinary stored workflow in its own right.',\n ),\n});\n\n// ============================================================================\n// Response schemas\n// ============================================================================\n\n/**\n * Shape returned for any single stored workflow row.\n */\nexport const storedWorkflowResponseSchema = z.object({\n id: z.string(),\n description: z.string().optional(),\n metadata: z.record(z.string(), z.unknown()).optional(),\n inputSchema: z.unknown(),\n outputSchema: z.unknown(),\n stateSchema: z.unknown().optional(),\n requestContextSchema: z.unknown().optional(),\n graph: z.array(z.unknown()),\n status: z.enum(['active', 'archived']),\n source: z.literal('storage'),\n authorId: z.string().optional(),\n createdAt: z.union([z.date(), z.string()]),\n updatedAt: z.union([z.date(), z.string()]),\n});\n\nexport const listStoredWorkflowsResponseSchema = z.object({\n workflows: z.array(storedWorkflowResponseSchema),\n total: z.number(),\n});\n\nexport const getStoredWorkflowResponseSchema = storedWorkflowResponseSchema;\n\nexport const upsertStoredWorkflowResponseSchema = z.object({\n ok: z.literal(true),\n id: z.string(),\n dependencyIds: z\n .array(z.string())\n .optional()\n .describe('Ids of the helper workflows saved alongside this one. Present only when dependencies were supplied.'),\n});\n\nexport const deleteStoredWorkflowResponseSchema = z.object({\n success: z.literal(true),\n message: z.string(),\n});\n","import type { Mastra } from '@mastra/core/mastra';\n\nimport { HTTPException } from '../http-exception';\nimport {\n storedWorkflowIdPathParams,\n listStoredWorkflowsQuerySchema,\n upsertStoredWorkflowBodySchema,\n listStoredWorkflowsResponseSchema,\n getStoredWorkflowResponseSchema,\n upsertStoredWorkflowResponseSchema,\n deleteStoredWorkflowResponseSchema,\n} from '../schemas/stored-workflows';\nimport { createRoute } from '../server-adapter/routes/route-builder';\n\nimport { handleError } from './error';\n\n/**\n * GET /stored/workflows — list stored static workflow definitions.\n *\n * Mirrors `LIST_STORED_AGENTS_ROUTE` but without favorites/visibility/authorship\n * scoping (which the workflow-definitions domain doesn't carry in v1).\n */\nexport const LIST_STORED_WORKFLOWS_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/workflows',\n responseType: 'json',\n queryParamSchema: listStoredWorkflowsQuerySchema,\n responseSchema: listStoredWorkflowsResponseSchema,\n summary: 'List stored workflow definitions',\n description: 'Returns workflow definitions persisted to storage. Filterable by status and authorId.',\n tags: ['Stored Workflows'],\n requiresAuth: true,\n requiresPermission: 'stored-workflows:read',\n handler: async ({ mastra, status, authorId }) => {\n try {\n const storage = mastra.getStorage();\n if (!storage) throw new HTTPException(500, { message: 'Storage is not configured' });\n\n const store = await storage.getStore('workflowDefinitions');\n if (!store) throw new HTTPException(500, { message: 'workflowDefinitions storage domain is not available' });\n\n const result = await store.list({ status: status ?? 'active', authorId });\n return { workflows: result.definitions, total: result.total };\n } catch (error) {\n return handleError(error, 'Error listing stored workflows');\n }\n },\n});\n\n/**\n * GET /stored/workflows/:storedWorkflowId — get one stored workflow.\n */\nexport const GET_STORED_WORKFLOW_ROUTE = createRoute({\n method: 'GET',\n path: '/stored/workflows/:storedWorkflowId',\n responseType: 'json',\n pathParamSchema: storedWorkflowIdPathParams,\n responseSchema: getStoredWorkflowResponseSchema,\n summary: 'Get a stored workflow definition by id',\n description: 'Returns a single workflow definition persisted to storage.',\n tags: ['Stored Workflows'],\n requiresAuth: true,\n requiresPermission: 'stored-workflows:read',\n handler: async ({ mastra, storedWorkflowId }) => {\n try {\n const storage = mastra.getStorage();\n if (!storage) throw new HTTPException(500, { message: 'Storage is not configured' });\n\n const store = await storage.getStore('workflowDefinitions');\n if (!store) throw new HTTPException(500, { message: 'workflowDefinitions storage domain is not available' });\n\n const def = await store.get(storedWorkflowId);\n if (!def) throw new HTTPException(404, { message: `Stored workflow \"${storedWorkflowId}\" not found` });\n return def;\n } catch (error) {\n return handleError(error, 'Error getting stored workflow');\n }\n },\n});\n\n/**\n * POST /stored/workflows — upsert a static workflow definition and live-register\n * it on the Mastra instance.\n *\n * Calls `mastra.addStoredWorkflow(def)` which persists the row + rehydrates a\n * runnable workflow + registers it via `mastra.addWorkflow(workflow, id)`.\n * After this returns, `GET /workflows/:id` and `POST /workflows/:id/run` work\n * immediately — no server restart needed.\n */\nexport const UPSERT_STORED_WORKFLOW_ROUTE = createRoute({\n method: 'POST',\n path: '/stored/workflows',\n responseType: 'json',\n bodySchema: upsertStoredWorkflowBodySchema,\n responseSchema: upsertStoredWorkflowResponseSchema,\n summary: 'Upsert a stored workflow definition and live-register it',\n description:\n 'Persists a static workflow definition and live-registers it on the running Mastra instance. Idempotent — same id updates in place.',\n tags: ['Stored Workflows'],\n requiresAuth: true,\n requiresPermission: 'stored-workflows:write',\n handler: async ({\n mastra,\n id,\n description,\n metadata,\n inputSchema,\n outputSchema,\n stateSchema,\n requestContextSchema,\n graph,\n dependencies,\n }) => {\n try {\n // Pick the body fields explicitly — handler args also carry server\n // context (requestContext, abortSignal, ...) which must not leak into\n // the stored definition.\n const def = { id, description, metadata, inputSchema, outputSchema, stateSchema, requestContextSchema, graph };\n // Helpers are saved with the root as one unit so a nested workflow that\n // does not exist yet resolves, and so a rejected root can never leave\n // its helpers behind as orphans. Order within the bundle is derived\n // from the graphs, not from the order the client sent them in.\n const bundle = [...(dependencies ?? []), def];\n // The Zod schema output is structurally compatible with\n // StoredWorkflowGraph but TS can't prove every arm:\n // - sleepUntil.date is an ISO string on the wire, Date on the\n // runtime type; the rehydrator parses it via `new Date(...)`.\n // - conditional/loop's `serializedConditions`/`serializedCondition`\n // debug labels are emitted by the fluent builder at rehydration\n // time; clients don't send them.\n // `addStoredWorkflows` runs a full registry pre-flight before\n // rehydration; the cast documents this boundary.\n await mastra.addStoredWorkflows(bundle as Parameters<Mastra['addStoredWorkflows']>[0]);\n return {\n ok: true as const,\n id: def.id,\n ...(dependencies?.length ? { dependencyIds: dependencies.map(dependency => dependency.id) } : {}),\n };\n } catch (error) {\n return handleError(error, 'Error upserting stored workflow');\n }\n },\n});\n\n/**\n * DELETE /stored/workflows/:storedWorkflowId — delete a stored workflow.\n *\n * Removes the row from storage AND un-registers the live Workflow instance so\n * a subsequent POST with the same id starts from a clean slate. Idempotent.\n */\nexport const DELETE_STORED_WORKFLOW_ROUTE = createRoute({\n method: 'DELETE',\n path: '/stored/workflows/:storedWorkflowId',\n responseType: 'json',\n pathParamSchema: storedWorkflowIdPathParams,\n responseSchema: deleteStoredWorkflowResponseSchema,\n summary: 'Delete a stored workflow definition',\n description: 'Removes a stored workflow definition and unregisters the live workflow instance. Idempotent.',\n tags: ['Stored Workflows'],\n requiresAuth: true,\n requiresPermission: 'stored-workflows:write',\n handler: async ({ mastra, storedWorkflowId }) => {\n try {\n const storage = mastra.getStorage();\n if (!storage) throw new HTTPException(500, { message: 'Storage is not configured' });\n\n const store = await storage.getStore('workflowDefinitions');\n if (!store) throw new HTTPException(500, { message: 'workflowDefinitions storage domain is not available' });\n\n await store.delete(storedWorkflowId);\n (mastra as Mastra).removeWorkflow(storedWorkflowId);\n return { success: true as const, message: `Workflow ${storedWorkflowId} deleted` };\n } catch (error) {\n return handleError(error, 'Error deleting stored workflow');\n }\n },\n});\n"],"mappings":";;;;;;AAYA,MAAM,oBAAoB,EACvB,OAAO;CACN,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS;CACjD,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ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