@mastra/deployer 0.3.0-alpha.9 → 0.3.1-alpha.1
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 +23 -3
- package/dist/_tsup-dts-rollup.d.ts +23 -3
- package/dist/build/analyze.cjs +2 -2
- package/dist/build/analyze.js +1 -1
- package/dist/build/index.cjs +6 -6
- package/dist/build/index.js +2 -2
- package/dist/bundler/index.cjs +2 -2
- package/dist/bundler/index.js +1 -1
- package/dist/{chunk-LA6Y6GAB.cjs → chunk-6J52IX4J.cjs} +10 -0
- package/dist/{chunk-ITJLMUBF.js → chunk-ABTWXYGO.js} +1 -1
- package/dist/{chunk-EZPRF2XZ.cjs → chunk-GO4WLOL7.cjs} +9 -9
- package/dist/{chunk-GDLBKKIV.cjs → chunk-KCX3UGHY.cjs} +2 -2
- package/dist/{chunk-M6HTLNVA.js → chunk-OV2EMRTY.js} +6 -6
- package/dist/{chunk-USZDOFES.js → chunk-QJQ2V3Z2.js} +10 -0
- package/dist/index.cjs +12 -8
- package/dist/index.js +11 -7
- package/dist/server/index.cjs +479 -30
- package/dist/server/index.js +477 -27
- package/package.json +3 -3
package/dist/server/index.cjs
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var crypto = require('crypto');
|
|
4
4
|
var promises = require('fs/promises');
|
|
5
|
-
var path = require('path');
|
|
6
5
|
var posix = require('path/posix');
|
|
7
|
-
var url = require('url');
|
|
8
6
|
var http = require('http');
|
|
9
7
|
var http2 = require('http2');
|
|
10
8
|
var stream = require('stream');
|
|
@@ -13,7 +11,7 @@ var mime = require('hono/utils/mime');
|
|
|
13
11
|
var fs = require('fs');
|
|
14
12
|
var html = require('hono/html');
|
|
15
13
|
var core = require('@mastra/core');
|
|
16
|
-
var
|
|
14
|
+
var runtimeContext = require('@mastra/core/runtime-context');
|
|
17
15
|
var hono = require('hono');
|
|
18
16
|
var bodyLimit = require('hono/body-limit');
|
|
19
17
|
var cors = require('hono/cors');
|
|
@@ -29,11 +27,11 @@ var zod = require('zod');
|
|
|
29
27
|
var telemetry = require('@mastra/server/handlers/telemetry');
|
|
30
28
|
var tools = require('@mastra/server/handlers/tools');
|
|
31
29
|
var vector = require('@mastra/server/handlers/vector');
|
|
30
|
+
var vNextWorkflows = require('@mastra/server/handlers/vNextWorkflows');
|
|
31
|
+
var streaming = require('hono/streaming');
|
|
32
32
|
var voice = require('@mastra/server/handlers/voice');
|
|
33
33
|
var workflows = require('@mastra/server/handlers/workflows');
|
|
34
|
-
var streaming = require('hono/streaming');
|
|
35
34
|
|
|
36
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
37
35
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
38
36
|
|
|
39
37
|
var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
@@ -174,14 +172,14 @@ var newRequest = (incoming, defaultHostname) => {
|
|
|
174
172
|
req[urlKey] = url.href;
|
|
175
173
|
return req;
|
|
176
174
|
};
|
|
177
|
-
function writeFromReadableStream(
|
|
178
|
-
if (
|
|
175
|
+
function writeFromReadableStream(stream3, writable) {
|
|
176
|
+
if (stream3.locked) {
|
|
179
177
|
throw new TypeError("ReadableStream is locked.");
|
|
180
178
|
} else if (writable.destroyed) {
|
|
181
|
-
|
|
179
|
+
stream3.cancel();
|
|
182
180
|
return;
|
|
183
181
|
}
|
|
184
|
-
const reader =
|
|
182
|
+
const reader = stream3.getReader();
|
|
185
183
|
writable.on("close", cancel);
|
|
186
184
|
writable.on("error", cancel);
|
|
187
185
|
reader.read().then(flow, cancel);
|
|
@@ -379,7 +377,7 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
|
|
379
377
|
const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
|
|
380
378
|
const internalBody = getInternalBody(res);
|
|
381
379
|
if (internalBody) {
|
|
382
|
-
const { length, source, stream:
|
|
380
|
+
const { length, source, stream: stream3 } = internalBody;
|
|
383
381
|
if (source instanceof Uint8Array && source.byteLength !== length) ; else {
|
|
384
382
|
if (length) {
|
|
385
383
|
resHeaderRecord["content-length"] = length;
|
|
@@ -390,7 +388,7 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
|
|
390
388
|
} else if (source instanceof Blob) {
|
|
391
389
|
outgoing.end(new Uint8Array(await source.arrayBuffer()));
|
|
392
390
|
} else {
|
|
393
|
-
await writeFromReadableStream(
|
|
391
|
+
await writeFromReadableStream(stream3, outgoing);
|
|
394
392
|
}
|
|
395
393
|
return;
|
|
396
394
|
}
|
|
@@ -494,18 +492,18 @@ var ENCODINGS = {
|
|
|
494
492
|
gzip: ".gz"
|
|
495
493
|
};
|
|
496
494
|
var ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS);
|
|
497
|
-
var createStreamBody = (
|
|
495
|
+
var createStreamBody = (stream3) => {
|
|
498
496
|
const body = new ReadableStream({
|
|
499
497
|
start(controller) {
|
|
500
|
-
|
|
498
|
+
stream3.on("data", (chunk) => {
|
|
501
499
|
controller.enqueue(chunk);
|
|
502
500
|
});
|
|
503
|
-
|
|
501
|
+
stream3.on("end", () => {
|
|
504
502
|
controller.close();
|
|
505
503
|
});
|
|
506
504
|
},
|
|
507
505
|
cancel() {
|
|
508
|
-
|
|
506
|
+
stream3.destroy();
|
|
509
507
|
}
|
|
510
508
|
});
|
|
511
509
|
return body;
|
|
@@ -601,10 +599,10 @@ var serveStatic = (options = { root: "" }) => {
|
|
|
601
599
|
end = size - 1;
|
|
602
600
|
}
|
|
603
601
|
const chunksize = end - start + 1;
|
|
604
|
-
const
|
|
602
|
+
const stream3 = fs.createReadStream(path, { start, end });
|
|
605
603
|
c2.header("Content-Length", chunksize.toString());
|
|
606
604
|
c2.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
|
|
607
|
-
return c2.body(createStreamBody(
|
|
605
|
+
return c2.body(createStreamBody(stream3), 206);
|
|
608
606
|
};
|
|
609
607
|
};
|
|
610
608
|
var RENDER_TYPE = {
|
|
@@ -962,7 +960,7 @@ async function setAgentInstructionsHandler(c2) {
|
|
|
962
960
|
// src/server/handlers/client.ts
|
|
963
961
|
var clients = /* @__PURE__ */ new Set();
|
|
964
962
|
function handleClientsRefresh(c2) {
|
|
965
|
-
const
|
|
963
|
+
const stream3 = new ReadableStream({
|
|
966
964
|
start(controller) {
|
|
967
965
|
clients.add(controller);
|
|
968
966
|
controller.enqueue("data: connected\n\n");
|
|
@@ -971,7 +969,7 @@ function handleClientsRefresh(c2) {
|
|
|
971
969
|
});
|
|
972
970
|
}
|
|
973
971
|
});
|
|
974
|
-
return new Response(
|
|
972
|
+
return new Response(stream3, {
|
|
975
973
|
headers: {
|
|
976
974
|
"Content-Type": "text/event-stream",
|
|
977
975
|
"Cache-Control": "no-cache",
|
|
@@ -1508,6 +1506,174 @@ async function deleteIndex(c2) {
|
|
|
1508
1506
|
return handleError(error, "Error deleting index");
|
|
1509
1507
|
}
|
|
1510
1508
|
}
|
|
1509
|
+
async function getVNextWorkflowsHandler(c2) {
|
|
1510
|
+
try {
|
|
1511
|
+
const mastra = c2.get("mastra");
|
|
1512
|
+
const workflows = await vNextWorkflows.getVNextWorkflowsHandler({
|
|
1513
|
+
mastra
|
|
1514
|
+
});
|
|
1515
|
+
return c2.json(workflows);
|
|
1516
|
+
} catch (error) {
|
|
1517
|
+
return handleError(error, "Error getting workflows");
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
async function getVNextWorkflowByIdHandler(c2) {
|
|
1521
|
+
try {
|
|
1522
|
+
const mastra = c2.get("mastra");
|
|
1523
|
+
const workflowId = c2.req.param("workflowId");
|
|
1524
|
+
const workflow = await vNextWorkflows.getVNextWorkflowByIdHandler({
|
|
1525
|
+
mastra,
|
|
1526
|
+
workflowId
|
|
1527
|
+
});
|
|
1528
|
+
return c2.json(workflow);
|
|
1529
|
+
} catch (error) {
|
|
1530
|
+
return handleError(error, "Error getting workflow");
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
async function createVNextWorkflowRunHandler(c2) {
|
|
1534
|
+
try {
|
|
1535
|
+
const mastra = c2.get("mastra");
|
|
1536
|
+
const workflowId = c2.req.param("workflowId");
|
|
1537
|
+
const prevRunId = c2.req.query("runId");
|
|
1538
|
+
const result = await vNextWorkflows.createVNextWorkflowRunHandler({
|
|
1539
|
+
mastra,
|
|
1540
|
+
workflowId,
|
|
1541
|
+
runId: prevRunId
|
|
1542
|
+
});
|
|
1543
|
+
return c2.json(result);
|
|
1544
|
+
} catch (e2) {
|
|
1545
|
+
return handleError(e2, "Error creating run");
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
async function startAsyncVNextWorkflowHandler(c2) {
|
|
1549
|
+
try {
|
|
1550
|
+
const mastra = c2.get("mastra");
|
|
1551
|
+
const workflowId = c2.req.param("workflowId");
|
|
1552
|
+
const { inputData, runtimeContext } = await c2.req.json();
|
|
1553
|
+
const runId = c2.req.query("runId");
|
|
1554
|
+
const result = await vNextWorkflows.startAsyncVNextWorkflowHandler({
|
|
1555
|
+
mastra,
|
|
1556
|
+
runtimeContext,
|
|
1557
|
+
workflowId,
|
|
1558
|
+
runId,
|
|
1559
|
+
inputData
|
|
1560
|
+
});
|
|
1561
|
+
return c2.json(result);
|
|
1562
|
+
} catch (error) {
|
|
1563
|
+
return handleError(error, "Error executing workflow");
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
async function startVNextWorkflowRunHandler(c2) {
|
|
1567
|
+
try {
|
|
1568
|
+
const mastra = c2.get("mastra");
|
|
1569
|
+
const workflowId = c2.req.param("workflowId");
|
|
1570
|
+
const { inputData, runtimeContext } = await c2.req.json();
|
|
1571
|
+
const runId = c2.req.query("runId");
|
|
1572
|
+
await vNextWorkflows.startVNextWorkflowRunHandler({
|
|
1573
|
+
mastra,
|
|
1574
|
+
runtimeContext,
|
|
1575
|
+
workflowId,
|
|
1576
|
+
runId,
|
|
1577
|
+
inputData
|
|
1578
|
+
});
|
|
1579
|
+
return c2.json({ message: "Workflow run started" });
|
|
1580
|
+
} catch (e2) {
|
|
1581
|
+
return handleError(e2, "Error starting workflow run");
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
function watchVNextWorkflowHandler(c2) {
|
|
1585
|
+
try {
|
|
1586
|
+
const mastra = c2.get("mastra");
|
|
1587
|
+
const logger2 = mastra.getLogger();
|
|
1588
|
+
const workflowId = c2.req.param("workflowId");
|
|
1589
|
+
const runId = c2.req.query("runId");
|
|
1590
|
+
if (!runId) {
|
|
1591
|
+
throw new httpException.HTTPException(400, { message: "runId required to watch workflow" });
|
|
1592
|
+
}
|
|
1593
|
+
return streaming.stream(
|
|
1594
|
+
c2,
|
|
1595
|
+
async (stream3) => {
|
|
1596
|
+
try {
|
|
1597
|
+
const result = await vNextWorkflows.watchVNextWorkflowHandler({
|
|
1598
|
+
mastra,
|
|
1599
|
+
workflowId,
|
|
1600
|
+
runId
|
|
1601
|
+
});
|
|
1602
|
+
stream3.onAbort(() => {
|
|
1603
|
+
if (!result.locked) {
|
|
1604
|
+
return result.cancel();
|
|
1605
|
+
}
|
|
1606
|
+
});
|
|
1607
|
+
for await (const chunk of result) {
|
|
1608
|
+
await stream3.write(chunk.toString() + "");
|
|
1609
|
+
}
|
|
1610
|
+
} catch (err) {
|
|
1611
|
+
console.log(err);
|
|
1612
|
+
}
|
|
1613
|
+
},
|
|
1614
|
+
async (err) => {
|
|
1615
|
+
logger2.error("Error in watch stream: " + err?.message);
|
|
1616
|
+
}
|
|
1617
|
+
);
|
|
1618
|
+
} catch (error) {
|
|
1619
|
+
return handleError(error, "Error watching workflow");
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
async function resumeAsyncVNextWorkflowHandler(c2) {
|
|
1623
|
+
try {
|
|
1624
|
+
const mastra = c2.get("mastra");
|
|
1625
|
+
const workflowId = c2.req.param("workflowId");
|
|
1626
|
+
const runId = c2.req.query("runId");
|
|
1627
|
+
const { step, resumeData, runtimeContext } = await c2.req.json();
|
|
1628
|
+
if (!runId) {
|
|
1629
|
+
throw new httpException.HTTPException(400, { message: "runId required to resume workflow" });
|
|
1630
|
+
}
|
|
1631
|
+
const result = await vNextWorkflows.resumeAsyncVNextWorkflowHandler({
|
|
1632
|
+
mastra,
|
|
1633
|
+
runtimeContext,
|
|
1634
|
+
workflowId,
|
|
1635
|
+
runId,
|
|
1636
|
+
body: { step, resumeData }
|
|
1637
|
+
});
|
|
1638
|
+
return c2.json(result);
|
|
1639
|
+
} catch (error) {
|
|
1640
|
+
return handleError(error, "Error resuming workflow step");
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
async function resumeVNextWorkflowHandler(c2) {
|
|
1644
|
+
try {
|
|
1645
|
+
const mastra = c2.get("mastra");
|
|
1646
|
+
const workflowId = c2.req.param("workflowId");
|
|
1647
|
+
const runId = c2.req.query("runId");
|
|
1648
|
+
const { step, resumeData, runtimeContext } = await c2.req.json();
|
|
1649
|
+
if (!runId) {
|
|
1650
|
+
throw new httpException.HTTPException(400, { message: "runId required to resume workflow" });
|
|
1651
|
+
}
|
|
1652
|
+
await vNextWorkflows.resumeVNextWorkflowHandler({
|
|
1653
|
+
mastra,
|
|
1654
|
+
runtimeContext,
|
|
1655
|
+
workflowId,
|
|
1656
|
+
runId,
|
|
1657
|
+
body: { step, resumeData }
|
|
1658
|
+
});
|
|
1659
|
+
return c2.json({ message: "Workflow run resumed" });
|
|
1660
|
+
} catch (error) {
|
|
1661
|
+
return handleError(error, "Error resuming workflow");
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
async function getVNextWorkflowRunsHandler(c2) {
|
|
1665
|
+
try {
|
|
1666
|
+
const mastra = c2.get("mastra");
|
|
1667
|
+
const workflowId = c2.req.param("workflowId");
|
|
1668
|
+
const workflowRuns = await vNextWorkflows.getVNextWorkflowRunsHandler({
|
|
1669
|
+
mastra,
|
|
1670
|
+
workflowId
|
|
1671
|
+
});
|
|
1672
|
+
return c2.json(workflowRuns);
|
|
1673
|
+
} catch (error) {
|
|
1674
|
+
return handleError(error, "Error getting workflow runs");
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1511
1677
|
async function getSpeakersHandler(c2) {
|
|
1512
1678
|
try {
|
|
1513
1679
|
const mastra = c2.get("mastra");
|
|
@@ -1655,20 +1821,20 @@ function watchWorkflowHandler(c2) {
|
|
|
1655
1821
|
}
|
|
1656
1822
|
return streaming.stream(
|
|
1657
1823
|
c2,
|
|
1658
|
-
async (
|
|
1824
|
+
async (stream3) => {
|
|
1659
1825
|
try {
|
|
1660
1826
|
const result = await workflows.watchWorkflowHandler({
|
|
1661
1827
|
mastra,
|
|
1662
1828
|
workflowId,
|
|
1663
1829
|
runId
|
|
1664
1830
|
});
|
|
1665
|
-
|
|
1831
|
+
stream3.onAbort(() => {
|
|
1666
1832
|
if (!result.locked) {
|
|
1667
1833
|
return result.cancel();
|
|
1668
1834
|
}
|
|
1669
1835
|
});
|
|
1670
1836
|
for await (const chunk of result) {
|
|
1671
|
-
await
|
|
1837
|
+
await stream3.write(chunk.toString() + "");
|
|
1672
1838
|
}
|
|
1673
1839
|
} catch (err) {
|
|
1674
1840
|
console.log(err);
|
|
@@ -1851,12 +2017,12 @@ var html2 = `
|
|
|
1851
2017
|
async function createHonoServer(mastra, options = {}) {
|
|
1852
2018
|
const app = new hono.Hono();
|
|
1853
2019
|
const server = mastra.getServer();
|
|
1854
|
-
const
|
|
1855
|
-
const mastraToolsPaths = (await import(
|
|
2020
|
+
const toolsPath = "./tools.mjs";
|
|
2021
|
+
const mastraToolsPaths = (await import(toolsPath)).tools;
|
|
1856
2022
|
const toolImports = mastraToolsPaths ? await Promise.all(
|
|
1857
2023
|
// @ts-ignore
|
|
1858
2024
|
mastraToolsPaths.map(async (toolPath) => {
|
|
1859
|
-
return import(
|
|
2025
|
+
return import(toolPath);
|
|
1860
2026
|
})
|
|
1861
2027
|
) : [];
|
|
1862
2028
|
const tools = toolImports.reduce((acc, toolModule) => {
|
|
@@ -1886,8 +2052,8 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
1886
2052
|
});
|
|
1887
2053
|
app.onError(errorHandler);
|
|
1888
2054
|
app.use("*", function setContext(c2, next) {
|
|
1889
|
-
const runtimeContext = new
|
|
1890
|
-
c2.set("runtimeContext", runtimeContext);
|
|
2055
|
+
const runtimeContext$1 = new runtimeContext.RuntimeContext();
|
|
2056
|
+
c2.set("runtimeContext", runtimeContext$1);
|
|
1891
2057
|
c2.set("mastra", mastra);
|
|
1892
2058
|
c2.set("tools", tools);
|
|
1893
2059
|
c2.set("playground", options.playground === true);
|
|
@@ -1955,7 +2121,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
1955
2121
|
}
|
|
1956
2122
|
}
|
|
1957
2123
|
}
|
|
1958
|
-
if (
|
|
2124
|
+
if (server?.build?.apiReqLogs) {
|
|
1959
2125
|
app.use(logger.logger());
|
|
1960
2126
|
}
|
|
1961
2127
|
app.get(
|
|
@@ -3092,6 +3258,289 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
3092
3258
|
}),
|
|
3093
3259
|
storeTelemetryHandler
|
|
3094
3260
|
);
|
|
3261
|
+
app.get(
|
|
3262
|
+
"/api/workflows/v-next",
|
|
3263
|
+
h({
|
|
3264
|
+
description: "Get all vNext workflows",
|
|
3265
|
+
tags: ["vNextWorkflows"],
|
|
3266
|
+
responses: {
|
|
3267
|
+
200: {
|
|
3268
|
+
description: "List of all vNext workflows"
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
}),
|
|
3272
|
+
getVNextWorkflowsHandler
|
|
3273
|
+
);
|
|
3274
|
+
app.get(
|
|
3275
|
+
"/api/workflows/v-next/:workflowId",
|
|
3276
|
+
h({
|
|
3277
|
+
description: "Get vNext workflow by ID",
|
|
3278
|
+
tags: ["vNextWorkflows"],
|
|
3279
|
+
parameters: [
|
|
3280
|
+
{
|
|
3281
|
+
name: "workflowId",
|
|
3282
|
+
in: "path",
|
|
3283
|
+
required: true,
|
|
3284
|
+
schema: { type: "string" }
|
|
3285
|
+
}
|
|
3286
|
+
],
|
|
3287
|
+
responses: {
|
|
3288
|
+
200: {
|
|
3289
|
+
description: "vNext workflow details"
|
|
3290
|
+
},
|
|
3291
|
+
404: {
|
|
3292
|
+
description: "vNext workflow not found"
|
|
3293
|
+
}
|
|
3294
|
+
}
|
|
3295
|
+
}),
|
|
3296
|
+
getVNextWorkflowByIdHandler
|
|
3297
|
+
);
|
|
3298
|
+
app.get(
|
|
3299
|
+
"/api/workflows/v-next/:workflowId/runs",
|
|
3300
|
+
h({
|
|
3301
|
+
description: "Get all runs for a vNext workflow",
|
|
3302
|
+
tags: ["vNextWorkflows"],
|
|
3303
|
+
parameters: [
|
|
3304
|
+
{
|
|
3305
|
+
name: "workflowId",
|
|
3306
|
+
in: "path",
|
|
3307
|
+
required: true,
|
|
3308
|
+
schema: { type: "string" }
|
|
3309
|
+
}
|
|
3310
|
+
],
|
|
3311
|
+
responses: {
|
|
3312
|
+
200: {
|
|
3313
|
+
description: "List of vNext workflow runs from storage"
|
|
3314
|
+
}
|
|
3315
|
+
}
|
|
3316
|
+
}),
|
|
3317
|
+
getVNextWorkflowRunsHandler
|
|
3318
|
+
);
|
|
3319
|
+
app.post(
|
|
3320
|
+
"/api/workflows/v-next/:workflowId/resume",
|
|
3321
|
+
h({
|
|
3322
|
+
description: "Resume a suspended vNext workflow step",
|
|
3323
|
+
tags: ["vNextWorkflows"],
|
|
3324
|
+
parameters: [
|
|
3325
|
+
{
|
|
3326
|
+
name: "workflowId",
|
|
3327
|
+
in: "path",
|
|
3328
|
+
required: true,
|
|
3329
|
+
schema: { type: "string" }
|
|
3330
|
+
},
|
|
3331
|
+
{
|
|
3332
|
+
name: "runId",
|
|
3333
|
+
in: "query",
|
|
3334
|
+
required: true,
|
|
3335
|
+
schema: { type: "string" }
|
|
3336
|
+
}
|
|
3337
|
+
],
|
|
3338
|
+
requestBody: {
|
|
3339
|
+
required: true,
|
|
3340
|
+
content: {
|
|
3341
|
+
"application/json": {
|
|
3342
|
+
schema: {
|
|
3343
|
+
type: "object",
|
|
3344
|
+
properties: {
|
|
3345
|
+
step: {
|
|
3346
|
+
oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }]
|
|
3347
|
+
},
|
|
3348
|
+
resumeData: { type: "object" },
|
|
3349
|
+
runtimeContext: { type: "object" }
|
|
3350
|
+
},
|
|
3351
|
+
required: ["step"]
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
}
|
|
3355
|
+
}
|
|
3356
|
+
}),
|
|
3357
|
+
resumeVNextWorkflowHandler
|
|
3358
|
+
);
|
|
3359
|
+
app.post(
|
|
3360
|
+
"/api/workflows/v-next/:workflowId/resume-async",
|
|
3361
|
+
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
3362
|
+
h({
|
|
3363
|
+
description: "Resume a suspended vNext workflow step",
|
|
3364
|
+
tags: ["vNextWorkflows"],
|
|
3365
|
+
parameters: [
|
|
3366
|
+
{
|
|
3367
|
+
name: "workflowId",
|
|
3368
|
+
in: "path",
|
|
3369
|
+
required: true,
|
|
3370
|
+
schema: { type: "string" }
|
|
3371
|
+
},
|
|
3372
|
+
{
|
|
3373
|
+
name: "runId",
|
|
3374
|
+
in: "query",
|
|
3375
|
+
required: true,
|
|
3376
|
+
schema: { type: "string" }
|
|
3377
|
+
}
|
|
3378
|
+
],
|
|
3379
|
+
requestBody: {
|
|
3380
|
+
required: true,
|
|
3381
|
+
content: {
|
|
3382
|
+
"application/json": {
|
|
3383
|
+
schema: {
|
|
3384
|
+
type: "object",
|
|
3385
|
+
properties: {
|
|
3386
|
+
step: {
|
|
3387
|
+
oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }]
|
|
3388
|
+
},
|
|
3389
|
+
resumeData: { type: "object" },
|
|
3390
|
+
runtimeContext: { type: "object" }
|
|
3391
|
+
},
|
|
3392
|
+
required: ["step"]
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
}
|
|
3396
|
+
}
|
|
3397
|
+
}),
|
|
3398
|
+
resumeAsyncVNextWorkflowHandler
|
|
3399
|
+
);
|
|
3400
|
+
app.post(
|
|
3401
|
+
"/api/workflows/v-next/:workflowId/create-run",
|
|
3402
|
+
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
3403
|
+
h({
|
|
3404
|
+
description: "Create a new vNext workflow run",
|
|
3405
|
+
tags: ["vNextWorkflows"],
|
|
3406
|
+
parameters: [
|
|
3407
|
+
{
|
|
3408
|
+
name: "workflowId",
|
|
3409
|
+
in: "path",
|
|
3410
|
+
required: true,
|
|
3411
|
+
schema: { type: "string" }
|
|
3412
|
+
},
|
|
3413
|
+
{
|
|
3414
|
+
name: "runId",
|
|
3415
|
+
in: "query",
|
|
3416
|
+
required: false,
|
|
3417
|
+
schema: { type: "string" }
|
|
3418
|
+
}
|
|
3419
|
+
],
|
|
3420
|
+
responses: {
|
|
3421
|
+
200: {
|
|
3422
|
+
description: "New vNext workflow run created"
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3425
|
+
}),
|
|
3426
|
+
createVNextWorkflowRunHandler
|
|
3427
|
+
);
|
|
3428
|
+
app.post(
|
|
3429
|
+
"/api/workflows/v-next/:workflowId/start-async",
|
|
3430
|
+
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
3431
|
+
h({
|
|
3432
|
+
description: "Execute/Start a vNext workflow",
|
|
3433
|
+
tags: ["vNextWorkflows"],
|
|
3434
|
+
parameters: [
|
|
3435
|
+
{
|
|
3436
|
+
name: "workflowId",
|
|
3437
|
+
in: "path",
|
|
3438
|
+
required: true,
|
|
3439
|
+
schema: { type: "string" }
|
|
3440
|
+
},
|
|
3441
|
+
{
|
|
3442
|
+
name: "runId",
|
|
3443
|
+
in: "query",
|
|
3444
|
+
required: false,
|
|
3445
|
+
schema: { type: "string" }
|
|
3446
|
+
}
|
|
3447
|
+
],
|
|
3448
|
+
requestBody: {
|
|
3449
|
+
required: true,
|
|
3450
|
+
content: {
|
|
3451
|
+
"application/json": {
|
|
3452
|
+
schema: {
|
|
3453
|
+
type: "object",
|
|
3454
|
+
properties: {
|
|
3455
|
+
inputData: { type: "object" },
|
|
3456
|
+
runtimeContext: { type: "object" }
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
}
|
|
3460
|
+
}
|
|
3461
|
+
},
|
|
3462
|
+
responses: {
|
|
3463
|
+
200: {
|
|
3464
|
+
description: "vNext workflow execution result"
|
|
3465
|
+
},
|
|
3466
|
+
404: {
|
|
3467
|
+
description: "vNext workflow not found"
|
|
3468
|
+
}
|
|
3469
|
+
}
|
|
3470
|
+
}),
|
|
3471
|
+
startAsyncVNextWorkflowHandler
|
|
3472
|
+
);
|
|
3473
|
+
app.post(
|
|
3474
|
+
"/api/workflows/v-next/:workflowId/start",
|
|
3475
|
+
h({
|
|
3476
|
+
description: "Create and start a new vNext workflow run",
|
|
3477
|
+
tags: ["vNextWorkflows"],
|
|
3478
|
+
parameters: [
|
|
3479
|
+
{
|
|
3480
|
+
name: "workflowId",
|
|
3481
|
+
in: "path",
|
|
3482
|
+
required: true,
|
|
3483
|
+
schema: { type: "string" }
|
|
3484
|
+
},
|
|
3485
|
+
{
|
|
3486
|
+
name: "runId",
|
|
3487
|
+
in: "query",
|
|
3488
|
+
required: true,
|
|
3489
|
+
schema: { type: "string" }
|
|
3490
|
+
}
|
|
3491
|
+
],
|
|
3492
|
+
requestBody: {
|
|
3493
|
+
required: true,
|
|
3494
|
+
content: {
|
|
3495
|
+
"application/json": {
|
|
3496
|
+
schema: {
|
|
3497
|
+
type: "object",
|
|
3498
|
+
properties: {
|
|
3499
|
+
inputData: { type: "object" },
|
|
3500
|
+
runtimeContext: { type: "object" }
|
|
3501
|
+
}
|
|
3502
|
+
}
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3505
|
+
},
|
|
3506
|
+
responses: {
|
|
3507
|
+
200: {
|
|
3508
|
+
description: "vNext workflow run started"
|
|
3509
|
+
},
|
|
3510
|
+
404: {
|
|
3511
|
+
description: "vNext workflow not found"
|
|
3512
|
+
}
|
|
3513
|
+
}
|
|
3514
|
+
}),
|
|
3515
|
+
startVNextWorkflowRunHandler
|
|
3516
|
+
);
|
|
3517
|
+
app.get(
|
|
3518
|
+
"/api/workflows/v-next/:workflowId/watch",
|
|
3519
|
+
h({
|
|
3520
|
+
description: "Watch vNext workflow transitions in real-time",
|
|
3521
|
+
parameters: [
|
|
3522
|
+
{
|
|
3523
|
+
name: "workflowId",
|
|
3524
|
+
in: "path",
|
|
3525
|
+
required: true,
|
|
3526
|
+
schema: { type: "string" }
|
|
3527
|
+
},
|
|
3528
|
+
{
|
|
3529
|
+
name: "runId",
|
|
3530
|
+
in: "query",
|
|
3531
|
+
required: false,
|
|
3532
|
+
schema: { type: "string" }
|
|
3533
|
+
}
|
|
3534
|
+
],
|
|
3535
|
+
tags: ["vNextWorkflows"],
|
|
3536
|
+
responses: {
|
|
3537
|
+
200: {
|
|
3538
|
+
description: "vNext workflow transitions in real-time"
|
|
3539
|
+
}
|
|
3540
|
+
}
|
|
3541
|
+
}),
|
|
3542
|
+
watchVNextWorkflowHandler
|
|
3543
|
+
);
|
|
3095
3544
|
app.get(
|
|
3096
3545
|
"/api/workflows",
|
|
3097
3546
|
h({
|
|
@@ -3291,7 +3740,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
3291
3740
|
"/api/workflows/:workflowId/startAsync",
|
|
3292
3741
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
3293
3742
|
h({
|
|
3294
|
-
description: "
|
|
3743
|
+
description: "@deprecated Use /api/workflows/:workflowId/start-async instead",
|
|
3295
3744
|
tags: ["workflows"],
|
|
3296
3745
|
parameters: [
|
|
3297
3746
|
{
|
|
@@ -3335,7 +3784,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
3335
3784
|
"/api/workflows/:workflowId/start-async",
|
|
3336
3785
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
3337
3786
|
h({
|
|
3338
|
-
description: "
|
|
3787
|
+
description: "Execute/Start a workflow",
|
|
3339
3788
|
tags: ["workflows"],
|
|
3340
3789
|
parameters: [
|
|
3341
3790
|
{
|