@mastra/deployer 0.24.7-alpha.0 → 0.24.7-alpha.2
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 +25 -0
- package/dist/build/analyze.cjs +2 -2
- package/dist/build/analyze.js +1 -1
- package/dist/build/bundler.cjs +3 -3
- package/dist/build/bundler.js +1 -1
- package/dist/build/index.cjs +12 -12
- package/dist/build/index.js +4 -4
- package/dist/build/plugins/esm-shim.d.ts +14 -0
- package/dist/build/plugins/esm-shim.d.ts.map +1 -0
- package/dist/build/plugins/tsconfig-paths.d.ts.map +1 -1
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-WAOHI5EJ.cjs → chunk-53B6GOCH.cjs} +10 -12
- package/dist/chunk-53B6GOCH.cjs.map +1 -0
- package/dist/{chunk-RF47PPL3.cjs → chunk-6R73ZVZX.cjs} +114 -27
- package/dist/chunk-6R73ZVZX.cjs.map +1 -0
- package/dist/{chunk-BKJTYNXV.js → chunk-7VIDVYTY.js} +3 -4
- package/dist/chunk-7VIDVYTY.js.map +1 -0
- package/dist/{chunk-WU6TBWIM.cjs → chunk-FHZKTDSF.cjs} +5 -5
- package/dist/{chunk-WU6TBWIM.cjs.map → chunk-FHZKTDSF.cjs.map} +1 -1
- package/dist/{chunk-CEFGVAGJ.cjs → chunk-K7JCMIZW.cjs} +16 -16
- package/dist/{chunk-CEFGVAGJ.cjs.map → chunk-K7JCMIZW.cjs.map} +1 -1
- package/dist/{chunk-IRM6HLVR.js → chunk-KEU3VV3H.js} +3 -3
- package/dist/{chunk-IRM6HLVR.js.map → chunk-KEU3VV3H.js.map} +1 -1
- package/dist/{chunk-YEXJWCJ4.js → chunk-KLIBX4WB.js} +5 -5
- package/dist/{chunk-YEXJWCJ4.js.map → chunk-KLIBX4WB.js.map} +1 -1
- package/dist/{chunk-KAY4EXIV.js → chunk-MYLM6HSI.js} +4 -4
- package/dist/{chunk-KAY4EXIV.js.map → chunk-MYLM6HSI.js.map} +1 -1
- package/dist/{chunk-MA7YOG2H.js → chunk-PHZK4P6J.js} +112 -26
- package/dist/chunk-PHZK4P6J.js.map +1 -0
- package/dist/{chunk-JZHZQN5X.cjs → chunk-UWCXK7X6.cjs} +14 -14
- package/dist/{chunk-JZHZQN5X.cjs.map → chunk-UWCXK7X6.cjs.map} +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.js +2 -2
- package/dist/server/handlers/auth/helpers.d.ts +1 -1
- package/dist/server/handlers/auth/helpers.d.ts.map +1 -1
- package/dist/server/handlers/restart-active-runs.d.ts +3 -0
- package/dist/server/handlers/restart-active-runs.d.ts.map +1 -0
- package/dist/server/handlers/routes/agents/handlers.d.ts.map +1 -1
- package/dist/server/handlers/routes/workflows/handlers.d.ts +7 -0
- package/dist/server/handlers/routes/workflows/handlers.d.ts.map +1 -1
- package/dist/server/handlers/routes/workflows/router.d.ts.map +1 -1
- package/dist/server/index.cjs +497 -6
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +498 -7
- package/dist/server/index.js.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-BKJTYNXV.js.map +0 -1
- package/dist/chunk-MA7YOG2H.js.map +0 -1
- package/dist/chunk-RF47PPL3.cjs.map +0 -1
- package/dist/chunk-WAOHI5EJ.cjs.map +0 -1
package/dist/server/index.cjs
CHANGED
|
@@ -1078,8 +1078,9 @@ var defaultAuthConfig = {
|
|
|
1078
1078
|
};
|
|
1079
1079
|
|
|
1080
1080
|
// src/server/handlers/auth/helpers.ts
|
|
1081
|
-
var isDevPlaygroundRequest = (req) => {
|
|
1082
|
-
|
|
1081
|
+
var isDevPlaygroundRequest = (req, authConfig) => {
|
|
1082
|
+
const protectedAccess = [...defaultAuthConfig.protected || [], ...authConfig.protected || []];
|
|
1083
|
+
return process.env.MASTRA_DEV === "true" && (!isAnyMatch(req.path, req.method, protectedAccess) || req.header("x-mastra-dev-playground") === "true");
|
|
1083
1084
|
};
|
|
1084
1085
|
var isCustomRoutePublic = (path, method, customRouteAuthConfig) => {
|
|
1085
1086
|
if (!customRouteAuthConfig) {
|
|
@@ -1184,7 +1185,7 @@ var authenticationMiddleware = async (c2, next) => {
|
|
|
1184
1185
|
if (!authConfig) {
|
|
1185
1186
|
return next();
|
|
1186
1187
|
}
|
|
1187
|
-
if (isDevPlaygroundRequest(c2.req)) {
|
|
1188
|
+
if (isDevPlaygroundRequest(c2.req, authConfig)) {
|
|
1188
1189
|
return next();
|
|
1189
1190
|
}
|
|
1190
1191
|
if (!isProtectedPath(c2.req.path, c2.req.method, authConfig, customRouteAuthConfig)) {
|
|
@@ -1227,7 +1228,7 @@ var authorizationMiddleware = async (c2, next) => {
|
|
|
1227
1228
|
}
|
|
1228
1229
|
const path = c2.req.path;
|
|
1229
1230
|
const method = c2.req.method;
|
|
1230
|
-
if (isDevPlaygroundRequest(c2.req)) {
|
|
1231
|
+
if (isDevPlaygroundRequest(c2.req, authConfig)) {
|
|
1231
1232
|
return next();
|
|
1232
1233
|
}
|
|
1233
1234
|
if (!isProtectedPath(c2.req.path, c2.req.method, authConfig, customRouteAuthConfig)) {
|
|
@@ -1343,6 +1344,17 @@ async function healthHandler(c2) {
|
|
|
1343
1344
|
return c2.json({ success: true }, 200);
|
|
1344
1345
|
}
|
|
1345
1346
|
|
|
1347
|
+
// src/server/handlers/restart-active-runs.ts
|
|
1348
|
+
async function restartAllActiveWorkflowRunsHandler(c2) {
|
|
1349
|
+
try {
|
|
1350
|
+
const mastra = c2.get("mastra");
|
|
1351
|
+
void mastra.restartAllActiveWorkflowRuns();
|
|
1352
|
+
return c2.json({ message: "Restarting all active workflow runs..." });
|
|
1353
|
+
} catch (error) {
|
|
1354
|
+
return handleError(error, "Error restarting active workflow runs");
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1346
1358
|
// src/server/handlers/root.ts
|
|
1347
1359
|
async function rootHandler(c2) {
|
|
1348
1360
|
const baseUrl = new URL(c2.req.url).origin;
|
|
@@ -2581,9 +2593,11 @@ var vNextBodyOptions = {
|
|
|
2581
2593
|
...sharedBodyOptions
|
|
2582
2594
|
};
|
|
2583
2595
|
async function getAgentsHandler(c2) {
|
|
2596
|
+
const partial = c2.req.query("partial") === "true";
|
|
2584
2597
|
const serializedAgents = await agents.getAgentsHandler({
|
|
2585
2598
|
mastra: c2.get("mastra"),
|
|
2586
|
-
runtimeContext: c2.get("runtimeContext")
|
|
2599
|
+
runtimeContext: c2.get("runtimeContext"),
|
|
2600
|
+
partial
|
|
2587
2601
|
});
|
|
2588
2602
|
return c2.json(serializedAgents);
|
|
2589
2603
|
}
|
|
@@ -9914,8 +9928,10 @@ function vectorRouter(bodyLimitOptions) {
|
|
|
9914
9928
|
async function getWorkflowsHandler(c2) {
|
|
9915
9929
|
try {
|
|
9916
9930
|
const mastra = c2.get("mastra");
|
|
9931
|
+
const partial = c2.req.query("partial") === "true";
|
|
9917
9932
|
const workflows$1 = await workflows.getWorkflowsHandler({
|
|
9918
|
-
mastra
|
|
9933
|
+
mastra,
|
|
9934
|
+
partial
|
|
9919
9935
|
});
|
|
9920
9936
|
return c2.json(workflows$1);
|
|
9921
9937
|
} catch (error) {
|
|
@@ -10358,6 +10374,163 @@ async function sendWorkflowRunEventHandler(c2) {
|
|
|
10358
10374
|
return handleError(error, "Error sending workflow run event");
|
|
10359
10375
|
}
|
|
10360
10376
|
}
|
|
10377
|
+
async function restartAsyncWorkflowHandler(c2) {
|
|
10378
|
+
try {
|
|
10379
|
+
const mastra = c2.get("mastra");
|
|
10380
|
+
const runtimeContext = c2.get("runtimeContext");
|
|
10381
|
+
const workflowId = c2.req.param("workflowId");
|
|
10382
|
+
const runId = c2.req.query("runId");
|
|
10383
|
+
const { tracingOptions } = await c2.req.json();
|
|
10384
|
+
if (!runId) {
|
|
10385
|
+
throw new httpException.HTTPException(400, { message: "runId required to restart workflow" });
|
|
10386
|
+
}
|
|
10387
|
+
const result = await workflows.restartAsyncWorkflowHandler({
|
|
10388
|
+
mastra,
|
|
10389
|
+
runtimeContext,
|
|
10390
|
+
workflowId,
|
|
10391
|
+
runId,
|
|
10392
|
+
tracingOptions
|
|
10393
|
+
});
|
|
10394
|
+
return c2.json(result);
|
|
10395
|
+
} catch (error) {
|
|
10396
|
+
return handleError(error, "Error restarting workflow run");
|
|
10397
|
+
}
|
|
10398
|
+
}
|
|
10399
|
+
async function restartWorkflowHandler(c2) {
|
|
10400
|
+
try {
|
|
10401
|
+
const mastra = c2.get("mastra");
|
|
10402
|
+
const runtimeContext = c2.get("runtimeContext");
|
|
10403
|
+
const workflowId = c2.req.param("workflowId");
|
|
10404
|
+
const runId = c2.req.query("runId");
|
|
10405
|
+
const { tracingOptions } = await c2.req.json();
|
|
10406
|
+
if (!runId) {
|
|
10407
|
+
throw new httpException.HTTPException(400, { message: "runId required to restart workflow" });
|
|
10408
|
+
}
|
|
10409
|
+
await workflows.restartWorkflowHandler({
|
|
10410
|
+
mastra,
|
|
10411
|
+
runtimeContext,
|
|
10412
|
+
workflowId,
|
|
10413
|
+
runId,
|
|
10414
|
+
tracingOptions
|
|
10415
|
+
});
|
|
10416
|
+
return c2.json({ message: "Workflow run restarted" });
|
|
10417
|
+
} catch (error) {
|
|
10418
|
+
return handleError(error, "Error restarting workflow");
|
|
10419
|
+
}
|
|
10420
|
+
}
|
|
10421
|
+
async function restartAllActiveWorkflowRunsAsyncHandler(c2) {
|
|
10422
|
+
try {
|
|
10423
|
+
const mastra = c2.get("mastra");
|
|
10424
|
+
const workflowId = c2.req.param("workflowId");
|
|
10425
|
+
const result = await workflows.restartAllActiveWorkflowRunsAsyncHandler({
|
|
10426
|
+
mastra,
|
|
10427
|
+
workflowId
|
|
10428
|
+
});
|
|
10429
|
+
return c2.json(result);
|
|
10430
|
+
} catch (error) {
|
|
10431
|
+
return handleError(error, "Error restarting all active workflow runs");
|
|
10432
|
+
}
|
|
10433
|
+
}
|
|
10434
|
+
async function restartAllActiveWorkflowRunsHandler2(c2) {
|
|
10435
|
+
try {
|
|
10436
|
+
const mastra = c2.get("mastra");
|
|
10437
|
+
const workflowId = c2.req.param("workflowId");
|
|
10438
|
+
await workflows.restartAllActiveWorkflowRunsHandler({
|
|
10439
|
+
mastra,
|
|
10440
|
+
workflowId
|
|
10441
|
+
});
|
|
10442
|
+
return c2.json({ message: "All active workflow runs restarted" });
|
|
10443
|
+
} catch (error) {
|
|
10444
|
+
return handleError(error, "Error restarting all active workflow runs");
|
|
10445
|
+
}
|
|
10446
|
+
}
|
|
10447
|
+
async function timeTravelAsyncWorkflowHandler(c2) {
|
|
10448
|
+
try {
|
|
10449
|
+
const mastra = c2.get("mastra");
|
|
10450
|
+
const runtimeContext = c2.get("runtimeContext");
|
|
10451
|
+
const workflowId = c2.req.param("workflowId");
|
|
10452
|
+
const runId = c2.req.query("runId");
|
|
10453
|
+
const { tracingOptions, ...body } = await c2.req.json();
|
|
10454
|
+
if (!runId) {
|
|
10455
|
+
throw new httpException.HTTPException(400, { message: "runId required to time travel workflow" });
|
|
10456
|
+
}
|
|
10457
|
+
const result = await workflows.timeTravelAsyncWorkflowHandler({
|
|
10458
|
+
mastra,
|
|
10459
|
+
runtimeContext,
|
|
10460
|
+
workflowId,
|
|
10461
|
+
runId,
|
|
10462
|
+
tracingOptions,
|
|
10463
|
+
body
|
|
10464
|
+
});
|
|
10465
|
+
return c2.json(result);
|
|
10466
|
+
} catch (error) {
|
|
10467
|
+
return handleError(error, "Error time traveling workflow run");
|
|
10468
|
+
}
|
|
10469
|
+
}
|
|
10470
|
+
async function timeTravelWorkflowHandler(c2) {
|
|
10471
|
+
try {
|
|
10472
|
+
const mastra = c2.get("mastra");
|
|
10473
|
+
const runtimeContext = c2.get("runtimeContext");
|
|
10474
|
+
const workflowId = c2.req.param("workflowId");
|
|
10475
|
+
const runId = c2.req.query("runId");
|
|
10476
|
+
const { tracingOptions, ...body } = await c2.req.json();
|
|
10477
|
+
if (!runId) {
|
|
10478
|
+
throw new httpException.HTTPException(400, { message: "runId required to time travel workflow" });
|
|
10479
|
+
}
|
|
10480
|
+
await workflows.timeTravelWorkflowHandler({
|
|
10481
|
+
mastra,
|
|
10482
|
+
runtimeContext,
|
|
10483
|
+
workflowId,
|
|
10484
|
+
runId,
|
|
10485
|
+
tracingOptions,
|
|
10486
|
+
body
|
|
10487
|
+
});
|
|
10488
|
+
return c2.json({ message: "Workflow run time traveled" });
|
|
10489
|
+
} catch (error) {
|
|
10490
|
+
return handleError(error, "Error time traveling workflow");
|
|
10491
|
+
}
|
|
10492
|
+
}
|
|
10493
|
+
async function timeTravelStreamWorkflowHandler(c2) {
|
|
10494
|
+
try {
|
|
10495
|
+
const mastra = c2.get("mastra");
|
|
10496
|
+
const runtimeContext = c2.get("runtimeContext");
|
|
10497
|
+
const logger2 = mastra.getLogger();
|
|
10498
|
+
const workflowId = c2.req.param("workflowId");
|
|
10499
|
+
const { tracingOptions, ...body } = await c2.req.json();
|
|
10500
|
+
const runId = c2.req.query("runId");
|
|
10501
|
+
c2.header("Transfer-Encoding", "chunked");
|
|
10502
|
+
return streaming.stream(
|
|
10503
|
+
c2,
|
|
10504
|
+
async (stream6) => {
|
|
10505
|
+
try {
|
|
10506
|
+
const result = await workflows.timeTravelStreamWorkflowHandler({
|
|
10507
|
+
mastra,
|
|
10508
|
+
workflowId,
|
|
10509
|
+
runId,
|
|
10510
|
+
body,
|
|
10511
|
+
runtimeContext,
|
|
10512
|
+
tracingOptions
|
|
10513
|
+
});
|
|
10514
|
+
const reader = result.getReader();
|
|
10515
|
+
stream6.onAbort(() => {
|
|
10516
|
+
void reader.cancel("request aborted");
|
|
10517
|
+
});
|
|
10518
|
+
let chunkResult;
|
|
10519
|
+
while ((chunkResult = await reader.read()) && !chunkResult.done) {
|
|
10520
|
+
await stream6.write(JSON.stringify(chunkResult.value) + "");
|
|
10521
|
+
}
|
|
10522
|
+
} catch (err) {
|
|
10523
|
+
logger2.error("Error in workflow time travel stream: " + (err?.message ?? "Unknown error"));
|
|
10524
|
+
}
|
|
10525
|
+
},
|
|
10526
|
+
async (err) => {
|
|
10527
|
+
logger2.error("Error in workflow time travel stream: " + err?.message);
|
|
10528
|
+
}
|
|
10529
|
+
);
|
|
10530
|
+
} catch (error) {
|
|
10531
|
+
return handleError(error, "Error streaming time traveled workflow");
|
|
10532
|
+
}
|
|
10533
|
+
}
|
|
10361
10534
|
async function getLegacyWorkflowsHandler(c2) {
|
|
10362
10535
|
try {
|
|
10363
10536
|
const mastra = c2.get("mastra");
|
|
@@ -11100,6 +11273,315 @@ function workflowsRouter(bodyLimitOptions) {
|
|
|
11100
11273
|
}),
|
|
11101
11274
|
resumeAsyncWorkflowHandler
|
|
11102
11275
|
);
|
|
11276
|
+
router.post(
|
|
11277
|
+
"/:workflowId/time-travel",
|
|
11278
|
+
w({
|
|
11279
|
+
description: "Time travel a workflow run",
|
|
11280
|
+
tags: ["workflows"],
|
|
11281
|
+
parameters: [
|
|
11282
|
+
{
|
|
11283
|
+
name: "workflowId",
|
|
11284
|
+
in: "path",
|
|
11285
|
+
required: true,
|
|
11286
|
+
schema: { type: "string" }
|
|
11287
|
+
},
|
|
11288
|
+
{
|
|
11289
|
+
name: "runId",
|
|
11290
|
+
in: "query",
|
|
11291
|
+
required: true,
|
|
11292
|
+
schema: { type: "string" }
|
|
11293
|
+
}
|
|
11294
|
+
],
|
|
11295
|
+
requestBody: {
|
|
11296
|
+
required: true,
|
|
11297
|
+
content: {
|
|
11298
|
+
"application/json": {
|
|
11299
|
+
schema: {
|
|
11300
|
+
type: "object",
|
|
11301
|
+
properties: {
|
|
11302
|
+
step: {
|
|
11303
|
+
oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }]
|
|
11304
|
+
},
|
|
11305
|
+
inputData: { type: "object" },
|
|
11306
|
+
resumeData: { type: "object" },
|
|
11307
|
+
initialState: { type: "object" },
|
|
11308
|
+
context: { type: "object", description: "Context for the workflow execution" },
|
|
11309
|
+
nestedStepsContext: { type: "object", description: "Nested steps context for the workflow execution" },
|
|
11310
|
+
runtimeContext: {
|
|
11311
|
+
type: "object",
|
|
11312
|
+
description: "Runtime context for the workflow execution"
|
|
11313
|
+
},
|
|
11314
|
+
tracingOptions: {
|
|
11315
|
+
type: "object",
|
|
11316
|
+
description: "Tracing options for the workflow execution",
|
|
11317
|
+
properties: {
|
|
11318
|
+
metadata: {
|
|
11319
|
+
type: "object",
|
|
11320
|
+
description: "Custom metadata to attach to the trace",
|
|
11321
|
+
additionalProperties: true
|
|
11322
|
+
}
|
|
11323
|
+
}
|
|
11324
|
+
}
|
|
11325
|
+
},
|
|
11326
|
+
required: ["step"]
|
|
11327
|
+
}
|
|
11328
|
+
}
|
|
11329
|
+
}
|
|
11330
|
+
}
|
|
11331
|
+
}),
|
|
11332
|
+
timeTravelWorkflowHandler
|
|
11333
|
+
);
|
|
11334
|
+
router.post(
|
|
11335
|
+
"/:workflowId/time-travel-stream",
|
|
11336
|
+
w({
|
|
11337
|
+
description: "Time travel a workflow run using streamVNext",
|
|
11338
|
+
tags: ["workflows"],
|
|
11339
|
+
parameters: [
|
|
11340
|
+
{
|
|
11341
|
+
name: "workflowId",
|
|
11342
|
+
in: "path",
|
|
11343
|
+
required: true,
|
|
11344
|
+
schema: { type: "string" }
|
|
11345
|
+
},
|
|
11346
|
+
{
|
|
11347
|
+
name: "runId",
|
|
11348
|
+
in: "query",
|
|
11349
|
+
required: true,
|
|
11350
|
+
schema: { type: "string" }
|
|
11351
|
+
}
|
|
11352
|
+
],
|
|
11353
|
+
requestBody: {
|
|
11354
|
+
required: true,
|
|
11355
|
+
content: {
|
|
11356
|
+
"application/json": {
|
|
11357
|
+
schema: {
|
|
11358
|
+
type: "object",
|
|
11359
|
+
properties: {
|
|
11360
|
+
step: {
|
|
11361
|
+
oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }]
|
|
11362
|
+
},
|
|
11363
|
+
inputData: { type: "object" },
|
|
11364
|
+
resumeData: { type: "object" },
|
|
11365
|
+
initialState: { type: "object" },
|
|
11366
|
+
context: { type: "object", description: "Context for the workflow execution" },
|
|
11367
|
+
nestedStepsContext: { type: "object", description: "Nested steps context for the workflow execution" },
|
|
11368
|
+
runtimeContext: {
|
|
11369
|
+
type: "object",
|
|
11370
|
+
description: "Runtime context for the workflow execution"
|
|
11371
|
+
},
|
|
11372
|
+
tracingOptions: {
|
|
11373
|
+
type: "object",
|
|
11374
|
+
description: "Tracing options for the workflow execution",
|
|
11375
|
+
properties: {
|
|
11376
|
+
metadata: {
|
|
11377
|
+
type: "object",
|
|
11378
|
+
description: "Custom metadata to attach to the trace",
|
|
11379
|
+
additionalProperties: true
|
|
11380
|
+
}
|
|
11381
|
+
}
|
|
11382
|
+
}
|
|
11383
|
+
},
|
|
11384
|
+
required: ["step"]
|
|
11385
|
+
}
|
|
11386
|
+
}
|
|
11387
|
+
}
|
|
11388
|
+
}
|
|
11389
|
+
}),
|
|
11390
|
+
timeTravelStreamWorkflowHandler
|
|
11391
|
+
);
|
|
11392
|
+
router.post(
|
|
11393
|
+
"/:workflowId/time-travel-async",
|
|
11394
|
+
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
11395
|
+
w({
|
|
11396
|
+
description: "Time travel a workflow run asynchronously",
|
|
11397
|
+
tags: ["workflows"],
|
|
11398
|
+
parameters: [
|
|
11399
|
+
{
|
|
11400
|
+
name: "workflowId",
|
|
11401
|
+
in: "path",
|
|
11402
|
+
required: true,
|
|
11403
|
+
schema: { type: "string" }
|
|
11404
|
+
},
|
|
11405
|
+
{
|
|
11406
|
+
name: "runId",
|
|
11407
|
+
in: "query",
|
|
11408
|
+
required: true,
|
|
11409
|
+
schema: { type: "string" }
|
|
11410
|
+
}
|
|
11411
|
+
],
|
|
11412
|
+
requestBody: {
|
|
11413
|
+
required: true,
|
|
11414
|
+
content: {
|
|
11415
|
+
"application/json": {
|
|
11416
|
+
schema: {
|
|
11417
|
+
type: "object",
|
|
11418
|
+
properties: {
|
|
11419
|
+
step: {
|
|
11420
|
+
oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }]
|
|
11421
|
+
},
|
|
11422
|
+
inputData: { type: "object" },
|
|
11423
|
+
resumeData: { type: "object" },
|
|
11424
|
+
initialState: { type: "object" },
|
|
11425
|
+
context: { type: "object", description: "Context for the workflow execution" },
|
|
11426
|
+
nestedStepsContext: { type: "object", description: "Nested steps context for the workflow execution" },
|
|
11427
|
+
runtimeContext: {
|
|
11428
|
+
type: "object",
|
|
11429
|
+
description: "Runtime context for the workflow execution"
|
|
11430
|
+
},
|
|
11431
|
+
tracingOptions: {
|
|
11432
|
+
type: "object",
|
|
11433
|
+
description: "Tracing options for the workflow execution",
|
|
11434
|
+
properties: {
|
|
11435
|
+
metadata: {
|
|
11436
|
+
type: "object",
|
|
11437
|
+
description: "Custom metadata to attach to the trace",
|
|
11438
|
+
additionalProperties: true
|
|
11439
|
+
}
|
|
11440
|
+
}
|
|
11441
|
+
}
|
|
11442
|
+
},
|
|
11443
|
+
required: ["step"]
|
|
11444
|
+
}
|
|
11445
|
+
}
|
|
11446
|
+
}
|
|
11447
|
+
}
|
|
11448
|
+
}),
|
|
11449
|
+
timeTravelAsyncWorkflowHandler
|
|
11450
|
+
);
|
|
11451
|
+
router.post(
|
|
11452
|
+
"/:workflowId/restart",
|
|
11453
|
+
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
11454
|
+
w({
|
|
11455
|
+
description: "Restart a workflow run",
|
|
11456
|
+
tags: ["workflows"],
|
|
11457
|
+
parameters: [
|
|
11458
|
+
{
|
|
11459
|
+
name: "workflowId",
|
|
11460
|
+
in: "path",
|
|
11461
|
+
required: true,
|
|
11462
|
+
schema: { type: "string" }
|
|
11463
|
+
},
|
|
11464
|
+
{
|
|
11465
|
+
name: "runId",
|
|
11466
|
+
in: "query",
|
|
11467
|
+
required: true,
|
|
11468
|
+
schema: { type: "string" }
|
|
11469
|
+
}
|
|
11470
|
+
],
|
|
11471
|
+
requestBody: {
|
|
11472
|
+
required: true,
|
|
11473
|
+
content: {
|
|
11474
|
+
"application/json": {
|
|
11475
|
+
schema: {
|
|
11476
|
+
type: "object",
|
|
11477
|
+
properties: {
|
|
11478
|
+
runtimeContext: {
|
|
11479
|
+
type: "object",
|
|
11480
|
+
description: "Runtime context for the workflow execution"
|
|
11481
|
+
},
|
|
11482
|
+
tracingOptions: {
|
|
11483
|
+
type: "object",
|
|
11484
|
+
description: "Tracing options for the workflow execution",
|
|
11485
|
+
properties: {
|
|
11486
|
+
metadata: {
|
|
11487
|
+
type: "object",
|
|
11488
|
+
description: "Custom metadata to attach to the trace",
|
|
11489
|
+
additionalProperties: true
|
|
11490
|
+
}
|
|
11491
|
+
}
|
|
11492
|
+
}
|
|
11493
|
+
}
|
|
11494
|
+
}
|
|
11495
|
+
}
|
|
11496
|
+
}
|
|
11497
|
+
}
|
|
11498
|
+
}),
|
|
11499
|
+
restartWorkflowHandler
|
|
11500
|
+
);
|
|
11501
|
+
router.post(
|
|
11502
|
+
"/:workflowId/restart-async",
|
|
11503
|
+
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
11504
|
+
w({
|
|
11505
|
+
description: "Restart a workflow run asynchronously",
|
|
11506
|
+
tags: ["workflows"],
|
|
11507
|
+
parameters: [
|
|
11508
|
+
{
|
|
11509
|
+
name: "workflowId",
|
|
11510
|
+
in: "path",
|
|
11511
|
+
required: true,
|
|
11512
|
+
schema: { type: "string" }
|
|
11513
|
+
},
|
|
11514
|
+
{
|
|
11515
|
+
name: "runId",
|
|
11516
|
+
in: "query",
|
|
11517
|
+
required: true,
|
|
11518
|
+
schema: { type: "string" }
|
|
11519
|
+
}
|
|
11520
|
+
],
|
|
11521
|
+
requestBody: {
|
|
11522
|
+
required: true,
|
|
11523
|
+
content: {
|
|
11524
|
+
"application/json": {
|
|
11525
|
+
schema: {
|
|
11526
|
+
type: "object",
|
|
11527
|
+
properties: {
|
|
11528
|
+
runtimeContext: {
|
|
11529
|
+
type: "object",
|
|
11530
|
+
description: "Runtime context for the workflow execution"
|
|
11531
|
+
},
|
|
11532
|
+
tracingOptions: {
|
|
11533
|
+
type: "object",
|
|
11534
|
+
description: "Tracing options for the workflow execution",
|
|
11535
|
+
properties: {
|
|
11536
|
+
metadata: {
|
|
11537
|
+
type: "object",
|
|
11538
|
+
description: "Custom metadata to attach to the trace",
|
|
11539
|
+
additionalProperties: true
|
|
11540
|
+
}
|
|
11541
|
+
}
|
|
11542
|
+
}
|
|
11543
|
+
}
|
|
11544
|
+
}
|
|
11545
|
+
}
|
|
11546
|
+
}
|
|
11547
|
+
}
|
|
11548
|
+
}),
|
|
11549
|
+
restartAsyncWorkflowHandler
|
|
11550
|
+
);
|
|
11551
|
+
router.post(
|
|
11552
|
+
"/:workflowId/restart-all-active-workflow-runs",
|
|
11553
|
+
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
11554
|
+
w({
|
|
11555
|
+
description: "Restart all active workflow runs",
|
|
11556
|
+
tags: ["workflows"],
|
|
11557
|
+
parameters: [
|
|
11558
|
+
{
|
|
11559
|
+
name: "workflowId",
|
|
11560
|
+
in: "path",
|
|
11561
|
+
required: true,
|
|
11562
|
+
schema: { type: "string" }
|
|
11563
|
+
}
|
|
11564
|
+
]
|
|
11565
|
+
}),
|
|
11566
|
+
restartAllActiveWorkflowRunsHandler2
|
|
11567
|
+
);
|
|
11568
|
+
router.post(
|
|
11569
|
+
"/:workflowId/restart-all-active-workflow-runs-async",
|
|
11570
|
+
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
11571
|
+
w({
|
|
11572
|
+
description: "Restart all active workflow runs asynchronously",
|
|
11573
|
+
tags: ["workflows"],
|
|
11574
|
+
parameters: [
|
|
11575
|
+
{
|
|
11576
|
+
name: "workflowId",
|
|
11577
|
+
in: "path",
|
|
11578
|
+
required: true,
|
|
11579
|
+
schema: { type: "string" }
|
|
11580
|
+
}
|
|
11581
|
+
]
|
|
11582
|
+
}),
|
|
11583
|
+
restartAllActiveWorkflowRunsAsyncHandler
|
|
11584
|
+
);
|
|
11103
11585
|
router.post(
|
|
11104
11586
|
"/:workflowId/stream-legacy",
|
|
11105
11587
|
w({
|
|
@@ -12083,6 +12565,15 @@ async function createHonoServer(mastra, options = {
|
|
|
12083
12565
|
middleware({ url: "/openapi.json" })
|
|
12084
12566
|
);
|
|
12085
12567
|
}
|
|
12568
|
+
if (options?.isDev) {
|
|
12569
|
+
app.post(
|
|
12570
|
+
"/__restart-active-workflow-runs",
|
|
12571
|
+
w({
|
|
12572
|
+
hide: true
|
|
12573
|
+
}),
|
|
12574
|
+
restartAllActiveWorkflowRunsHandler
|
|
12575
|
+
);
|
|
12576
|
+
}
|
|
12086
12577
|
if (options?.playground) {
|
|
12087
12578
|
app.get(
|
|
12088
12579
|
"/refresh-events",
|