@mastra/deployer 0.10.5 → 0.10.6-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 +6 -2
- package/dist/_tsup-dts-rollup.d.ts +6 -2
- package/dist/server/index.cjs +188 -65
- package/dist/server/index.js +189 -66
- package/package.json +13 -13
|
@@ -517,9 +517,9 @@ is_latest: boolean;
|
|
|
517
517
|
}, ContentfulStatusCode, "json">)>;
|
|
518
518
|
|
|
519
519
|
/**
|
|
520
|
-
* Handler for POST /api/mcp/:serverId/mcp
|
|
520
|
+
* Handler for Streamable HTTP requests (POST, GET, DELETE) to /api/mcp/:serverId/mcp
|
|
521
521
|
*/
|
|
522
|
-
export declare const getMcpServerMessageHandler: (c: Context) => Promise<Response>;
|
|
522
|
+
export declare const getMcpServerMessageHandler: (c: Context) => Promise<Response | undefined>;
|
|
523
523
|
|
|
524
524
|
/**
|
|
525
525
|
* Handler for SSE related routes for an MCP server.
|
|
@@ -572,6 +572,10 @@ export declare const getVector: (c: Context, vectorName: string) => MastraVector
|
|
|
572
572
|
|
|
573
573
|
export declare function getWorkflowByIdHandler(c: Context): Promise<Response>;
|
|
574
574
|
|
|
575
|
+
export declare function getWorkflowRunByIdHandler(c: Context): Promise<Response>;
|
|
576
|
+
|
|
577
|
+
export declare function getWorkflowRunExecutionResultHandler(c: Context): Promise<Response>;
|
|
578
|
+
|
|
575
579
|
export declare function getWorkflowRunsHandler(c: Context): Promise<Response>;
|
|
576
580
|
|
|
577
581
|
export declare function getWorkflowsHandler(c: Context): Promise<Response>;
|
|
@@ -517,9 +517,9 @@ is_latest: boolean;
|
|
|
517
517
|
}, ContentfulStatusCode, "json">)>;
|
|
518
518
|
|
|
519
519
|
/**
|
|
520
|
-
* Handler for POST /api/mcp/:serverId/mcp
|
|
520
|
+
* Handler for Streamable HTTP requests (POST, GET, DELETE) to /api/mcp/:serverId/mcp
|
|
521
521
|
*/
|
|
522
|
-
export declare const getMcpServerMessageHandler: (c: Context) => Promise<Response>;
|
|
522
|
+
export declare const getMcpServerMessageHandler: (c: Context) => Promise<Response | undefined>;
|
|
523
523
|
|
|
524
524
|
/**
|
|
525
525
|
* Handler for SSE related routes for an MCP server.
|
|
@@ -572,6 +572,10 @@ export declare const getVector: (c: Context, vectorName: string) => MastraVector
|
|
|
572
572
|
|
|
573
573
|
export declare function getWorkflowByIdHandler(c: Context): Promise<Response>;
|
|
574
574
|
|
|
575
|
+
export declare function getWorkflowRunByIdHandler(c: Context): Promise<Response>;
|
|
576
|
+
|
|
577
|
+
export declare function getWorkflowRunExecutionResultHandler(c: Context): Promise<Response>;
|
|
578
|
+
|
|
575
579
|
export declare function getWorkflowRunsHandler(c: Context): Promise<Response>;
|
|
576
580
|
|
|
577
581
|
export declare function getWorkflowsHandler(c: Context): Promise<Response>;
|
package/dist/server/index.cjs
CHANGED
|
@@ -736,7 +736,7 @@ var middleware = (options) => async (c2) => {
|
|
|
736
736
|
);
|
|
737
737
|
};
|
|
738
738
|
|
|
739
|
-
// ../../node_modules/.pnpm/hono-openapi@0.4.8_hono@4.7.11_openapi-types@12.1.3_zod@3.25.
|
|
739
|
+
// ../../node_modules/.pnpm/hono-openapi@0.4.8_hono@4.7.11_openapi-types@12.1.3_zod@3.25.57/node_modules/hono-openapi/utils.js
|
|
740
740
|
var e = Symbol("openapi");
|
|
741
741
|
var n = ["GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE"];
|
|
742
742
|
var s2 = (e2) => e2.charAt(0).toUpperCase() + e2.slice(1);
|
|
@@ -3378,22 +3378,35 @@ var getMcpServerMessageHandler = async (c2) => {
|
|
|
3378
3378
|
const { req, res } = toReqRes(c2.req.raw);
|
|
3379
3379
|
const server = mastra.getMCPServer(serverId);
|
|
3380
3380
|
if (!server) {
|
|
3381
|
-
|
|
3381
|
+
res.writeHead(404, { "Content-Type": "application/json" });
|
|
3382
|
+
res.end(JSON.stringify({ error: `MCP server '${serverId}' not found` }));
|
|
3383
|
+
return;
|
|
3382
3384
|
}
|
|
3383
3385
|
try {
|
|
3384
3386
|
await server.startHTTP({
|
|
3385
3387
|
url: new URL(c2.req.url),
|
|
3386
3388
|
httpPath: `/api/mcp/${serverId}/mcp`,
|
|
3387
3389
|
req,
|
|
3388
|
-
res
|
|
3389
|
-
options: {
|
|
3390
|
-
sessionIdGenerator: void 0
|
|
3391
|
-
}
|
|
3390
|
+
res
|
|
3392
3391
|
});
|
|
3393
|
-
|
|
3394
|
-
return toFetchRes;
|
|
3392
|
+
return await toFetchResponse(res);
|
|
3395
3393
|
} catch (error) {
|
|
3396
|
-
|
|
3394
|
+
if (!res.headersSent) {
|
|
3395
|
+
res.writeHead(500, { "Content-Type": "application/json" });
|
|
3396
|
+
res.end(
|
|
3397
|
+
JSON.stringify({
|
|
3398
|
+
jsonrpc: "2.0",
|
|
3399
|
+
error: {
|
|
3400
|
+
code: -32603,
|
|
3401
|
+
message: "Internal server error"
|
|
3402
|
+
},
|
|
3403
|
+
id: null
|
|
3404
|
+
// Cannot determine original request ID in catch
|
|
3405
|
+
})
|
|
3406
|
+
);
|
|
3407
|
+
} else {
|
|
3408
|
+
c2.get("logger")?.error("Error after headers sent:", error);
|
|
3409
|
+
}
|
|
3397
3410
|
}
|
|
3398
3411
|
};
|
|
3399
3412
|
var getMcpServerSseHandler = async (c2) => {
|
|
@@ -4177,8 +4190,7 @@ async function startAsyncWorkflowHandler(c2) {
|
|
|
4177
4190
|
try {
|
|
4178
4191
|
const mastra = c2.get("mastra");
|
|
4179
4192
|
const workflowId = c2.req.param("workflowId");
|
|
4180
|
-
const runtimeContext = c2.
|
|
4181
|
-
const { inputData } = await c2.req.json();
|
|
4193
|
+
const { inputData, runtimeContext } = await c2.req.json();
|
|
4182
4194
|
const runId = c2.req.query("runId");
|
|
4183
4195
|
const result = await workflows.startAsyncWorkflowHandler({
|
|
4184
4196
|
mastra,
|
|
@@ -4196,8 +4208,7 @@ async function startWorkflowRunHandler(c2) {
|
|
|
4196
4208
|
try {
|
|
4197
4209
|
const mastra = c2.get("mastra");
|
|
4198
4210
|
const workflowId = c2.req.param("workflowId");
|
|
4199
|
-
const runtimeContext = c2.
|
|
4200
|
-
const { inputData } = await c2.req.json();
|
|
4211
|
+
const { inputData, runtimeContext } = await c2.req.json();
|
|
4201
4212
|
const runId = c2.req.query("runId");
|
|
4202
4213
|
await workflows.startWorkflowRunHandler({
|
|
4203
4214
|
mastra,
|
|
@@ -4254,14 +4265,13 @@ async function streamWorkflowHandler(c2) {
|
|
|
4254
4265
|
const mastra = c2.get("mastra");
|
|
4255
4266
|
const logger2 = mastra.getLogger();
|
|
4256
4267
|
const workflowId = c2.req.param("workflowId");
|
|
4257
|
-
const runtimeContext = c2.
|
|
4258
|
-
const { inputData } = await c2.req.json();
|
|
4268
|
+
const { inputData, runtimeContext } = await c2.req.json();
|
|
4259
4269
|
const runId = c2.req.query("runId");
|
|
4260
4270
|
return streaming.stream(
|
|
4261
4271
|
c2,
|
|
4262
4272
|
async (stream4) => {
|
|
4263
4273
|
try {
|
|
4264
|
-
const result = workflows.streamWorkflowHandler({
|
|
4274
|
+
const result = await workflows.streamWorkflowHandler({
|
|
4265
4275
|
mastra,
|
|
4266
4276
|
workflowId,
|
|
4267
4277
|
runId,
|
|
@@ -4293,8 +4303,7 @@ async function resumeAsyncWorkflowHandler(c2) {
|
|
|
4293
4303
|
const mastra = c2.get("mastra");
|
|
4294
4304
|
const workflowId = c2.req.param("workflowId");
|
|
4295
4305
|
const runId = c2.req.query("runId");
|
|
4296
|
-
const runtimeContext = c2.
|
|
4297
|
-
const { step, resumeData } = await c2.req.json();
|
|
4306
|
+
const { step, resumeData, runtimeContext } = await c2.req.json();
|
|
4298
4307
|
if (!runId) {
|
|
4299
4308
|
throw new httpException.HTTPException(400, { message: "runId required to resume workflow" });
|
|
4300
4309
|
}
|
|
@@ -4350,6 +4359,36 @@ async function getWorkflowRunsHandler(c2) {
|
|
|
4350
4359
|
return handleError(error, "Error getting workflow runs");
|
|
4351
4360
|
}
|
|
4352
4361
|
}
|
|
4362
|
+
async function getWorkflowRunByIdHandler(c2) {
|
|
4363
|
+
try {
|
|
4364
|
+
const mastra = c2.get("mastra");
|
|
4365
|
+
const workflowId = c2.req.param("workflowId");
|
|
4366
|
+
const runId = c2.req.param("runId");
|
|
4367
|
+
const workflowRun = await workflows.getWorkflowRunByIdHandler({
|
|
4368
|
+
mastra,
|
|
4369
|
+
workflowId,
|
|
4370
|
+
runId
|
|
4371
|
+
});
|
|
4372
|
+
return c2.json(workflowRun);
|
|
4373
|
+
} catch (error) {
|
|
4374
|
+
return handleError(error, "Error getting workflow run");
|
|
4375
|
+
}
|
|
4376
|
+
}
|
|
4377
|
+
async function getWorkflowRunExecutionResultHandler(c2) {
|
|
4378
|
+
try {
|
|
4379
|
+
const mastra = c2.get("mastra");
|
|
4380
|
+
const workflowId = c2.req.param("workflowId");
|
|
4381
|
+
const runId = c2.req.param("runId");
|
|
4382
|
+
const workflowRunExecutionResult = await workflows.getWorkflowRunExecutionResultHandler({
|
|
4383
|
+
mastra,
|
|
4384
|
+
workflowId,
|
|
4385
|
+
runId
|
|
4386
|
+
});
|
|
4387
|
+
return c2.json(workflowRunExecutionResult);
|
|
4388
|
+
} catch (error) {
|
|
4389
|
+
return handleError(error, "Error getting workflow run execution result");
|
|
4390
|
+
}
|
|
4391
|
+
}
|
|
4353
4392
|
|
|
4354
4393
|
// src/server/welcome.ts
|
|
4355
4394
|
var html2 = `
|
|
@@ -5662,6 +5701,30 @@ ${err.stack.split("\n").slice(1).join("\n")}
|
|
|
5662
5701
|
}),
|
|
5663
5702
|
getMcpServerMessageHandler
|
|
5664
5703
|
);
|
|
5704
|
+
app.get(
|
|
5705
|
+
"/api/mcp/:serverId/mcp",
|
|
5706
|
+
w({
|
|
5707
|
+
description: "Send a message to an MCP server using Streamable HTTP",
|
|
5708
|
+
tags: ["mcp"],
|
|
5709
|
+
parameters: [
|
|
5710
|
+
{
|
|
5711
|
+
name: "serverId",
|
|
5712
|
+
in: "path",
|
|
5713
|
+
required: true,
|
|
5714
|
+
schema: { type: "string" }
|
|
5715
|
+
}
|
|
5716
|
+
],
|
|
5717
|
+
responses: {
|
|
5718
|
+
200: {
|
|
5719
|
+
description: "Streamable HTTP connection processed"
|
|
5720
|
+
},
|
|
5721
|
+
404: {
|
|
5722
|
+
description: "MCP server not found"
|
|
5723
|
+
}
|
|
5724
|
+
}
|
|
5725
|
+
}),
|
|
5726
|
+
getMcpServerMessageHandler
|
|
5727
|
+
);
|
|
5665
5728
|
const mcpSseBasePath = "/api/mcp/:serverId/sse";
|
|
5666
5729
|
const mcpSseMessagePath = "/api/mcp/:serverId/messages";
|
|
5667
5730
|
app.get(
|
|
@@ -6574,53 +6637,6 @@ ${err.stack.split("\n").slice(1).join("\n")}
|
|
|
6574
6637
|
}),
|
|
6575
6638
|
watchLegacyWorkflowHandler
|
|
6576
6639
|
);
|
|
6577
|
-
app.post(
|
|
6578
|
-
"/api/workflows/:workflowId/stream",
|
|
6579
|
-
w({
|
|
6580
|
-
description: "Stream workflow in real-time",
|
|
6581
|
-
parameters: [
|
|
6582
|
-
{
|
|
6583
|
-
name: "workflowId",
|
|
6584
|
-
in: "path",
|
|
6585
|
-
required: true,
|
|
6586
|
-
schema: { type: "string" }
|
|
6587
|
-
},
|
|
6588
|
-
{
|
|
6589
|
-
name: "runId",
|
|
6590
|
-
in: "query",
|
|
6591
|
-
required: false,
|
|
6592
|
-
schema: { type: "string" }
|
|
6593
|
-
}
|
|
6594
|
-
],
|
|
6595
|
-
requestBody: {
|
|
6596
|
-
required: true,
|
|
6597
|
-
content: {
|
|
6598
|
-
"application/json": {
|
|
6599
|
-
schema: {
|
|
6600
|
-
type: "object",
|
|
6601
|
-
properties: {
|
|
6602
|
-
inputData: { type: "object" },
|
|
6603
|
-
runtimeContext: {
|
|
6604
|
-
type: "object",
|
|
6605
|
-
description: "Runtime context for the workflow execution"
|
|
6606
|
-
}
|
|
6607
|
-
}
|
|
6608
|
-
}
|
|
6609
|
-
}
|
|
6610
|
-
}
|
|
6611
|
-
},
|
|
6612
|
-
responses: {
|
|
6613
|
-
200: {
|
|
6614
|
-
description: "vNext workflow run started"
|
|
6615
|
-
},
|
|
6616
|
-
404: {
|
|
6617
|
-
description: "vNext workflow not found"
|
|
6618
|
-
}
|
|
6619
|
-
},
|
|
6620
|
-
tags: ["vNextWorkflows"]
|
|
6621
|
-
}),
|
|
6622
|
-
streamWorkflowHandler
|
|
6623
|
-
);
|
|
6624
6640
|
app.get(
|
|
6625
6641
|
"/api/workflows",
|
|
6626
6642
|
w({
|
|
@@ -6684,6 +6700,66 @@ ${err.stack.split("\n").slice(1).join("\n")}
|
|
|
6684
6700
|
}),
|
|
6685
6701
|
getWorkflowRunsHandler
|
|
6686
6702
|
);
|
|
6703
|
+
app.get(
|
|
6704
|
+
"/api/workflows/:workflowId/runs/:runId/execution-result",
|
|
6705
|
+
w({
|
|
6706
|
+
description: "Get execution result for a workflow run",
|
|
6707
|
+
tags: ["workflows"],
|
|
6708
|
+
parameters: [
|
|
6709
|
+
{
|
|
6710
|
+
name: "workflowId",
|
|
6711
|
+
in: "path",
|
|
6712
|
+
required: true,
|
|
6713
|
+
schema: { type: "string" }
|
|
6714
|
+
},
|
|
6715
|
+
{
|
|
6716
|
+
name: "runId",
|
|
6717
|
+
in: "path",
|
|
6718
|
+
required: true,
|
|
6719
|
+
schema: { type: "string" }
|
|
6720
|
+
}
|
|
6721
|
+
],
|
|
6722
|
+
responses: {
|
|
6723
|
+
200: {
|
|
6724
|
+
description: "Workflow run execution result"
|
|
6725
|
+
},
|
|
6726
|
+
404: {
|
|
6727
|
+
description: "Workflow run execution result not found"
|
|
6728
|
+
}
|
|
6729
|
+
}
|
|
6730
|
+
}),
|
|
6731
|
+
getWorkflowRunExecutionResultHandler
|
|
6732
|
+
);
|
|
6733
|
+
app.get(
|
|
6734
|
+
"/api/workflows/:workflowId/runs/:runId",
|
|
6735
|
+
w({
|
|
6736
|
+
description: "Get workflow run by ID",
|
|
6737
|
+
tags: ["workflows"],
|
|
6738
|
+
parameters: [
|
|
6739
|
+
{
|
|
6740
|
+
name: "workflowId",
|
|
6741
|
+
in: "path",
|
|
6742
|
+
required: true,
|
|
6743
|
+
schema: { type: "string" }
|
|
6744
|
+
},
|
|
6745
|
+
{
|
|
6746
|
+
name: "runId",
|
|
6747
|
+
in: "path",
|
|
6748
|
+
required: true,
|
|
6749
|
+
schema: { type: "string" }
|
|
6750
|
+
}
|
|
6751
|
+
],
|
|
6752
|
+
responses: {
|
|
6753
|
+
200: {
|
|
6754
|
+
description: "Workflow run by ID"
|
|
6755
|
+
},
|
|
6756
|
+
404: {
|
|
6757
|
+
description: "Workflow run not found"
|
|
6758
|
+
}
|
|
6759
|
+
}
|
|
6760
|
+
}),
|
|
6761
|
+
getWorkflowRunByIdHandler
|
|
6762
|
+
);
|
|
6687
6763
|
app.post(
|
|
6688
6764
|
"/api/workflows/:workflowId/resume",
|
|
6689
6765
|
w({
|
|
@@ -6771,6 +6847,53 @@ ${err.stack.split("\n").slice(1).join("\n")}
|
|
|
6771
6847
|
}),
|
|
6772
6848
|
resumeAsyncWorkflowHandler
|
|
6773
6849
|
);
|
|
6850
|
+
app.post(
|
|
6851
|
+
"/api/workflows/:workflowId/stream",
|
|
6852
|
+
w({
|
|
6853
|
+
description: "Stream workflow in real-time",
|
|
6854
|
+
parameters: [
|
|
6855
|
+
{
|
|
6856
|
+
name: "workflowId",
|
|
6857
|
+
in: "path",
|
|
6858
|
+
required: true,
|
|
6859
|
+
schema: { type: "string" }
|
|
6860
|
+
},
|
|
6861
|
+
{
|
|
6862
|
+
name: "runId",
|
|
6863
|
+
in: "query",
|
|
6864
|
+
required: false,
|
|
6865
|
+
schema: { type: "string" }
|
|
6866
|
+
}
|
|
6867
|
+
],
|
|
6868
|
+
requestBody: {
|
|
6869
|
+
required: true,
|
|
6870
|
+
content: {
|
|
6871
|
+
"application/json": {
|
|
6872
|
+
schema: {
|
|
6873
|
+
type: "object",
|
|
6874
|
+
properties: {
|
|
6875
|
+
inputData: { type: "object" },
|
|
6876
|
+
runtimeContext: {
|
|
6877
|
+
type: "object",
|
|
6878
|
+
description: "Runtime context for the workflow execution"
|
|
6879
|
+
}
|
|
6880
|
+
}
|
|
6881
|
+
}
|
|
6882
|
+
}
|
|
6883
|
+
}
|
|
6884
|
+
},
|
|
6885
|
+
responses: {
|
|
6886
|
+
200: {
|
|
6887
|
+
description: "workflow run started"
|
|
6888
|
+
},
|
|
6889
|
+
404: {
|
|
6890
|
+
description: "workflow not found"
|
|
6891
|
+
}
|
|
6892
|
+
},
|
|
6893
|
+
tags: ["workflows"]
|
|
6894
|
+
}),
|
|
6895
|
+
streamWorkflowHandler
|
|
6896
|
+
);
|
|
6774
6897
|
app.post(
|
|
6775
6898
|
"/api/workflows/:workflowId/create-run",
|
|
6776
6899
|
bodyLimit.bodyLimit(bodyLimitOptions),
|
package/dist/server/index.js
CHANGED
|
@@ -31,7 +31,7 @@ import { getTelemetryHandler as getTelemetryHandler$1, storeTelemetryHandler as
|
|
|
31
31
|
import { executeAgentToolHandler as executeAgentToolHandler$1, getToolsHandler as getToolsHandler$1, getToolByIdHandler as getToolByIdHandler$1, executeToolHandler as executeToolHandler$1 } from '@mastra/server/handlers/tools';
|
|
32
32
|
import { upsertVectors as upsertVectors$1, createIndex as createIndex$1, queryVectors as queryVectors$1, listIndexes as listIndexes$1, describeIndex as describeIndex$1, deleteIndex as deleteIndex$1 } from '@mastra/server/handlers/vector';
|
|
33
33
|
import { getSpeakersHandler as getSpeakersHandler$1, generateSpeechHandler, getListenerHandler as getListenerHandler$1, transcribeSpeechHandler } from '@mastra/server/handlers/voice';
|
|
34
|
-
import {
|
|
34
|
+
import { getWorkflowsHandler as getWorkflowsHandler$1, getWorkflowByIdHandler as getWorkflowByIdHandler$1, getWorkflowRunsHandler as getWorkflowRunsHandler$1, getWorkflowRunExecutionResultHandler as getWorkflowRunExecutionResultHandler$1, getWorkflowRunByIdHandler as getWorkflowRunByIdHandler$1, resumeWorkflowHandler as resumeWorkflowHandler$1, resumeAsyncWorkflowHandler as resumeAsyncWorkflowHandler$1, streamWorkflowHandler as streamWorkflowHandler$1, createWorkflowRunHandler as createWorkflowRunHandler$1, startAsyncWorkflowHandler as startAsyncWorkflowHandler$1, startWorkflowRunHandler as startWorkflowRunHandler$1, watchWorkflowHandler as watchWorkflowHandler$1 } from '@mastra/server/handlers/workflows';
|
|
35
35
|
|
|
36
36
|
// src/server/index.ts
|
|
37
37
|
var RequestError = class extends Error {
|
|
@@ -729,7 +729,7 @@ var middleware = (options) => async (c2) => {
|
|
|
729
729
|
);
|
|
730
730
|
};
|
|
731
731
|
|
|
732
|
-
// ../../node_modules/.pnpm/hono-openapi@0.4.8_hono@4.7.11_openapi-types@12.1.3_zod@3.25.
|
|
732
|
+
// ../../node_modules/.pnpm/hono-openapi@0.4.8_hono@4.7.11_openapi-types@12.1.3_zod@3.25.57/node_modules/hono-openapi/utils.js
|
|
733
733
|
var e = Symbol("openapi");
|
|
734
734
|
var n = ["GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE"];
|
|
735
735
|
var s2 = (e2) => e2.charAt(0).toUpperCase() + e2.slice(1);
|
|
@@ -3371,22 +3371,35 @@ var getMcpServerMessageHandler = async (c2) => {
|
|
|
3371
3371
|
const { req, res } = toReqRes(c2.req.raw);
|
|
3372
3372
|
const server = mastra.getMCPServer(serverId);
|
|
3373
3373
|
if (!server) {
|
|
3374
|
-
|
|
3374
|
+
res.writeHead(404, { "Content-Type": "application/json" });
|
|
3375
|
+
res.end(JSON.stringify({ error: `MCP server '${serverId}' not found` }));
|
|
3376
|
+
return;
|
|
3375
3377
|
}
|
|
3376
3378
|
try {
|
|
3377
3379
|
await server.startHTTP({
|
|
3378
3380
|
url: new URL(c2.req.url),
|
|
3379
3381
|
httpPath: `/api/mcp/${serverId}/mcp`,
|
|
3380
3382
|
req,
|
|
3381
|
-
res
|
|
3382
|
-
options: {
|
|
3383
|
-
sessionIdGenerator: void 0
|
|
3384
|
-
}
|
|
3383
|
+
res
|
|
3385
3384
|
});
|
|
3386
|
-
|
|
3387
|
-
return toFetchRes;
|
|
3385
|
+
return await toFetchResponse(res);
|
|
3388
3386
|
} catch (error) {
|
|
3389
|
-
|
|
3387
|
+
if (!res.headersSent) {
|
|
3388
|
+
res.writeHead(500, { "Content-Type": "application/json" });
|
|
3389
|
+
res.end(
|
|
3390
|
+
JSON.stringify({
|
|
3391
|
+
jsonrpc: "2.0",
|
|
3392
|
+
error: {
|
|
3393
|
+
code: -32603,
|
|
3394
|
+
message: "Internal server error"
|
|
3395
|
+
},
|
|
3396
|
+
id: null
|
|
3397
|
+
// Cannot determine original request ID in catch
|
|
3398
|
+
})
|
|
3399
|
+
);
|
|
3400
|
+
} else {
|
|
3401
|
+
c2.get("logger")?.error("Error after headers sent:", error);
|
|
3402
|
+
}
|
|
3390
3403
|
}
|
|
3391
3404
|
};
|
|
3392
3405
|
var getMcpServerSseHandler = async (c2) => {
|
|
@@ -4170,8 +4183,7 @@ async function startAsyncWorkflowHandler(c2) {
|
|
|
4170
4183
|
try {
|
|
4171
4184
|
const mastra = c2.get("mastra");
|
|
4172
4185
|
const workflowId = c2.req.param("workflowId");
|
|
4173
|
-
const runtimeContext = c2.
|
|
4174
|
-
const { inputData } = await c2.req.json();
|
|
4186
|
+
const { inputData, runtimeContext } = await c2.req.json();
|
|
4175
4187
|
const runId = c2.req.query("runId");
|
|
4176
4188
|
const result = await startAsyncWorkflowHandler$1({
|
|
4177
4189
|
mastra,
|
|
@@ -4189,8 +4201,7 @@ async function startWorkflowRunHandler(c2) {
|
|
|
4189
4201
|
try {
|
|
4190
4202
|
const mastra = c2.get("mastra");
|
|
4191
4203
|
const workflowId = c2.req.param("workflowId");
|
|
4192
|
-
const runtimeContext = c2.
|
|
4193
|
-
const { inputData } = await c2.req.json();
|
|
4204
|
+
const { inputData, runtimeContext } = await c2.req.json();
|
|
4194
4205
|
const runId = c2.req.query("runId");
|
|
4195
4206
|
await startWorkflowRunHandler$1({
|
|
4196
4207
|
mastra,
|
|
@@ -4247,14 +4258,13 @@ async function streamWorkflowHandler(c2) {
|
|
|
4247
4258
|
const mastra = c2.get("mastra");
|
|
4248
4259
|
const logger2 = mastra.getLogger();
|
|
4249
4260
|
const workflowId = c2.req.param("workflowId");
|
|
4250
|
-
const runtimeContext = c2.
|
|
4251
|
-
const { inputData } = await c2.req.json();
|
|
4261
|
+
const { inputData, runtimeContext } = await c2.req.json();
|
|
4252
4262
|
const runId = c2.req.query("runId");
|
|
4253
4263
|
return stream(
|
|
4254
4264
|
c2,
|
|
4255
4265
|
async (stream4) => {
|
|
4256
4266
|
try {
|
|
4257
|
-
const result = streamWorkflowHandler$1({
|
|
4267
|
+
const result = await streamWorkflowHandler$1({
|
|
4258
4268
|
mastra,
|
|
4259
4269
|
workflowId,
|
|
4260
4270
|
runId,
|
|
@@ -4286,8 +4296,7 @@ async function resumeAsyncWorkflowHandler(c2) {
|
|
|
4286
4296
|
const mastra = c2.get("mastra");
|
|
4287
4297
|
const workflowId = c2.req.param("workflowId");
|
|
4288
4298
|
const runId = c2.req.query("runId");
|
|
4289
|
-
const runtimeContext = c2.
|
|
4290
|
-
const { step, resumeData } = await c2.req.json();
|
|
4299
|
+
const { step, resumeData, runtimeContext } = await c2.req.json();
|
|
4291
4300
|
if (!runId) {
|
|
4292
4301
|
throw new HTTPException(400, { message: "runId required to resume workflow" });
|
|
4293
4302
|
}
|
|
@@ -4343,6 +4352,36 @@ async function getWorkflowRunsHandler(c2) {
|
|
|
4343
4352
|
return handleError(error, "Error getting workflow runs");
|
|
4344
4353
|
}
|
|
4345
4354
|
}
|
|
4355
|
+
async function getWorkflowRunByIdHandler(c2) {
|
|
4356
|
+
try {
|
|
4357
|
+
const mastra = c2.get("mastra");
|
|
4358
|
+
const workflowId = c2.req.param("workflowId");
|
|
4359
|
+
const runId = c2.req.param("runId");
|
|
4360
|
+
const workflowRun = await getWorkflowRunByIdHandler$1({
|
|
4361
|
+
mastra,
|
|
4362
|
+
workflowId,
|
|
4363
|
+
runId
|
|
4364
|
+
});
|
|
4365
|
+
return c2.json(workflowRun);
|
|
4366
|
+
} catch (error) {
|
|
4367
|
+
return handleError(error, "Error getting workflow run");
|
|
4368
|
+
}
|
|
4369
|
+
}
|
|
4370
|
+
async function getWorkflowRunExecutionResultHandler(c2) {
|
|
4371
|
+
try {
|
|
4372
|
+
const mastra = c2.get("mastra");
|
|
4373
|
+
const workflowId = c2.req.param("workflowId");
|
|
4374
|
+
const runId = c2.req.param("runId");
|
|
4375
|
+
const workflowRunExecutionResult = await getWorkflowRunExecutionResultHandler$1({
|
|
4376
|
+
mastra,
|
|
4377
|
+
workflowId,
|
|
4378
|
+
runId
|
|
4379
|
+
});
|
|
4380
|
+
return c2.json(workflowRunExecutionResult);
|
|
4381
|
+
} catch (error) {
|
|
4382
|
+
return handleError(error, "Error getting workflow run execution result");
|
|
4383
|
+
}
|
|
4384
|
+
}
|
|
4346
4385
|
|
|
4347
4386
|
// src/server/welcome.ts
|
|
4348
4387
|
var html2 = `
|
|
@@ -5655,6 +5694,30 @@ ${err.stack.split("\n").slice(1).join("\n")}
|
|
|
5655
5694
|
}),
|
|
5656
5695
|
getMcpServerMessageHandler
|
|
5657
5696
|
);
|
|
5697
|
+
app.get(
|
|
5698
|
+
"/api/mcp/:serverId/mcp",
|
|
5699
|
+
w({
|
|
5700
|
+
description: "Send a message to an MCP server using Streamable HTTP",
|
|
5701
|
+
tags: ["mcp"],
|
|
5702
|
+
parameters: [
|
|
5703
|
+
{
|
|
5704
|
+
name: "serverId",
|
|
5705
|
+
in: "path",
|
|
5706
|
+
required: true,
|
|
5707
|
+
schema: { type: "string" }
|
|
5708
|
+
}
|
|
5709
|
+
],
|
|
5710
|
+
responses: {
|
|
5711
|
+
200: {
|
|
5712
|
+
description: "Streamable HTTP connection processed"
|
|
5713
|
+
},
|
|
5714
|
+
404: {
|
|
5715
|
+
description: "MCP server not found"
|
|
5716
|
+
}
|
|
5717
|
+
}
|
|
5718
|
+
}),
|
|
5719
|
+
getMcpServerMessageHandler
|
|
5720
|
+
);
|
|
5658
5721
|
const mcpSseBasePath = "/api/mcp/:serverId/sse";
|
|
5659
5722
|
const mcpSseMessagePath = "/api/mcp/:serverId/messages";
|
|
5660
5723
|
app.get(
|
|
@@ -6567,53 +6630,6 @@ ${err.stack.split("\n").slice(1).join("\n")}
|
|
|
6567
6630
|
}),
|
|
6568
6631
|
watchLegacyWorkflowHandler
|
|
6569
6632
|
);
|
|
6570
|
-
app.post(
|
|
6571
|
-
"/api/workflows/:workflowId/stream",
|
|
6572
|
-
w({
|
|
6573
|
-
description: "Stream workflow in real-time",
|
|
6574
|
-
parameters: [
|
|
6575
|
-
{
|
|
6576
|
-
name: "workflowId",
|
|
6577
|
-
in: "path",
|
|
6578
|
-
required: true,
|
|
6579
|
-
schema: { type: "string" }
|
|
6580
|
-
},
|
|
6581
|
-
{
|
|
6582
|
-
name: "runId",
|
|
6583
|
-
in: "query",
|
|
6584
|
-
required: false,
|
|
6585
|
-
schema: { type: "string" }
|
|
6586
|
-
}
|
|
6587
|
-
],
|
|
6588
|
-
requestBody: {
|
|
6589
|
-
required: true,
|
|
6590
|
-
content: {
|
|
6591
|
-
"application/json": {
|
|
6592
|
-
schema: {
|
|
6593
|
-
type: "object",
|
|
6594
|
-
properties: {
|
|
6595
|
-
inputData: { type: "object" },
|
|
6596
|
-
runtimeContext: {
|
|
6597
|
-
type: "object",
|
|
6598
|
-
description: "Runtime context for the workflow execution"
|
|
6599
|
-
}
|
|
6600
|
-
}
|
|
6601
|
-
}
|
|
6602
|
-
}
|
|
6603
|
-
}
|
|
6604
|
-
},
|
|
6605
|
-
responses: {
|
|
6606
|
-
200: {
|
|
6607
|
-
description: "vNext workflow run started"
|
|
6608
|
-
},
|
|
6609
|
-
404: {
|
|
6610
|
-
description: "vNext workflow not found"
|
|
6611
|
-
}
|
|
6612
|
-
},
|
|
6613
|
-
tags: ["vNextWorkflows"]
|
|
6614
|
-
}),
|
|
6615
|
-
streamWorkflowHandler
|
|
6616
|
-
);
|
|
6617
6633
|
app.get(
|
|
6618
6634
|
"/api/workflows",
|
|
6619
6635
|
w({
|
|
@@ -6677,6 +6693,66 @@ ${err.stack.split("\n").slice(1).join("\n")}
|
|
|
6677
6693
|
}),
|
|
6678
6694
|
getWorkflowRunsHandler
|
|
6679
6695
|
);
|
|
6696
|
+
app.get(
|
|
6697
|
+
"/api/workflows/:workflowId/runs/:runId/execution-result",
|
|
6698
|
+
w({
|
|
6699
|
+
description: "Get execution result for a workflow run",
|
|
6700
|
+
tags: ["workflows"],
|
|
6701
|
+
parameters: [
|
|
6702
|
+
{
|
|
6703
|
+
name: "workflowId",
|
|
6704
|
+
in: "path",
|
|
6705
|
+
required: true,
|
|
6706
|
+
schema: { type: "string" }
|
|
6707
|
+
},
|
|
6708
|
+
{
|
|
6709
|
+
name: "runId",
|
|
6710
|
+
in: "path",
|
|
6711
|
+
required: true,
|
|
6712
|
+
schema: { type: "string" }
|
|
6713
|
+
}
|
|
6714
|
+
],
|
|
6715
|
+
responses: {
|
|
6716
|
+
200: {
|
|
6717
|
+
description: "Workflow run execution result"
|
|
6718
|
+
},
|
|
6719
|
+
404: {
|
|
6720
|
+
description: "Workflow run execution result not found"
|
|
6721
|
+
}
|
|
6722
|
+
}
|
|
6723
|
+
}),
|
|
6724
|
+
getWorkflowRunExecutionResultHandler
|
|
6725
|
+
);
|
|
6726
|
+
app.get(
|
|
6727
|
+
"/api/workflows/:workflowId/runs/:runId",
|
|
6728
|
+
w({
|
|
6729
|
+
description: "Get workflow run by ID",
|
|
6730
|
+
tags: ["workflows"],
|
|
6731
|
+
parameters: [
|
|
6732
|
+
{
|
|
6733
|
+
name: "workflowId",
|
|
6734
|
+
in: "path",
|
|
6735
|
+
required: true,
|
|
6736
|
+
schema: { type: "string" }
|
|
6737
|
+
},
|
|
6738
|
+
{
|
|
6739
|
+
name: "runId",
|
|
6740
|
+
in: "path",
|
|
6741
|
+
required: true,
|
|
6742
|
+
schema: { type: "string" }
|
|
6743
|
+
}
|
|
6744
|
+
],
|
|
6745
|
+
responses: {
|
|
6746
|
+
200: {
|
|
6747
|
+
description: "Workflow run by ID"
|
|
6748
|
+
},
|
|
6749
|
+
404: {
|
|
6750
|
+
description: "Workflow run not found"
|
|
6751
|
+
}
|
|
6752
|
+
}
|
|
6753
|
+
}),
|
|
6754
|
+
getWorkflowRunByIdHandler
|
|
6755
|
+
);
|
|
6680
6756
|
app.post(
|
|
6681
6757
|
"/api/workflows/:workflowId/resume",
|
|
6682
6758
|
w({
|
|
@@ -6764,6 +6840,53 @@ ${err.stack.split("\n").slice(1).join("\n")}
|
|
|
6764
6840
|
}),
|
|
6765
6841
|
resumeAsyncWorkflowHandler
|
|
6766
6842
|
);
|
|
6843
|
+
app.post(
|
|
6844
|
+
"/api/workflows/:workflowId/stream",
|
|
6845
|
+
w({
|
|
6846
|
+
description: "Stream workflow in real-time",
|
|
6847
|
+
parameters: [
|
|
6848
|
+
{
|
|
6849
|
+
name: "workflowId",
|
|
6850
|
+
in: "path",
|
|
6851
|
+
required: true,
|
|
6852
|
+
schema: { type: "string" }
|
|
6853
|
+
},
|
|
6854
|
+
{
|
|
6855
|
+
name: "runId",
|
|
6856
|
+
in: "query",
|
|
6857
|
+
required: false,
|
|
6858
|
+
schema: { type: "string" }
|
|
6859
|
+
}
|
|
6860
|
+
],
|
|
6861
|
+
requestBody: {
|
|
6862
|
+
required: true,
|
|
6863
|
+
content: {
|
|
6864
|
+
"application/json": {
|
|
6865
|
+
schema: {
|
|
6866
|
+
type: "object",
|
|
6867
|
+
properties: {
|
|
6868
|
+
inputData: { type: "object" },
|
|
6869
|
+
runtimeContext: {
|
|
6870
|
+
type: "object",
|
|
6871
|
+
description: "Runtime context for the workflow execution"
|
|
6872
|
+
}
|
|
6873
|
+
}
|
|
6874
|
+
}
|
|
6875
|
+
}
|
|
6876
|
+
}
|
|
6877
|
+
},
|
|
6878
|
+
responses: {
|
|
6879
|
+
200: {
|
|
6880
|
+
description: "workflow run started"
|
|
6881
|
+
},
|
|
6882
|
+
404: {
|
|
6883
|
+
description: "workflow not found"
|
|
6884
|
+
}
|
|
6885
|
+
},
|
|
6886
|
+
tags: ["workflows"]
|
|
6887
|
+
}),
|
|
6888
|
+
streamWorkflowHandler
|
|
6889
|
+
);
|
|
6767
6890
|
app.post(
|
|
6768
6891
|
"/api/workflows/:workflowId/create-run",
|
|
6769
6892
|
bodyLimit(bodyLimitOptions),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.6-alpha.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -95,29 +95,29 @@
|
|
|
95
95
|
"@rollup/plugin-virtual": "^3.0.2",
|
|
96
96
|
"@sindresorhus/slugify": "^2.2.1",
|
|
97
97
|
"builtins": "^5.1.0",
|
|
98
|
-
"detect-libc": "^2.0.
|
|
98
|
+
"detect-libc": "^2.0.4",
|
|
99
99
|
"dotenv": "^16.5.0",
|
|
100
|
-
"esbuild": "^0.25.
|
|
100
|
+
"esbuild": "^0.25.5",
|
|
101
101
|
"find-workspaces": "^0.3.1",
|
|
102
102
|
"fs-extra": "^11.3.0",
|
|
103
103
|
"globby": "^14.1.0",
|
|
104
104
|
"hono": "^4.7.11",
|
|
105
105
|
"resolve-from": "^5.0.0",
|
|
106
|
-
"rollup": "^4.
|
|
106
|
+
"rollup": "^4.43.0",
|
|
107
107
|
"rollup-plugin-esbuild": "^6.2.1",
|
|
108
108
|
"rollup-plugin-node-externals": "^8.0.0",
|
|
109
109
|
"typescript-paths": "^1.5.1",
|
|
110
|
-
"zod": "^3.25.
|
|
111
|
-
"@mastra/server": "^0.10.
|
|
110
|
+
"zod": "^3.25.57",
|
|
111
|
+
"@mastra/server": "^0.10.6-alpha.1"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
|
-
"@hono/node-server": "^1.14.
|
|
115
|
-
"@hono/swagger-ui": "^0.5.
|
|
114
|
+
"@hono/node-server": "^1.14.4",
|
|
115
|
+
"@hono/swagger-ui": "^0.5.2",
|
|
116
116
|
"@microsoft/api-extractor": "^7.52.8",
|
|
117
117
|
"@types/babel__core": "^7.20.5",
|
|
118
118
|
"@types/babel__helper-module-imports": "^7.18.3",
|
|
119
119
|
"@types/fs-extra": "^11.0.4",
|
|
120
|
-
"@types/node": "^20.
|
|
120
|
+
"@types/node": "^20.19.0",
|
|
121
121
|
"eslint": "^9.28.0",
|
|
122
122
|
"fetch-to-node": "^2.1.0",
|
|
123
123
|
"hono-openapi": "^0.4.8",
|
|
@@ -125,11 +125,11 @@
|
|
|
125
125
|
"superjson": "^2.2.2",
|
|
126
126
|
"tsup": "^8.5.0",
|
|
127
127
|
"type-fest": "^4.41.0",
|
|
128
|
-
"typescript": "^5.8.
|
|
128
|
+
"typescript": "^5.8.3",
|
|
129
129
|
"vitest": "^2.1.9",
|
|
130
|
-
"@mastra/core": "0.10.
|
|
131
|
-
"@
|
|
132
|
-
"@
|
|
130
|
+
"@mastra/core": "0.10.6-alpha.1",
|
|
131
|
+
"@mastra/mcp": "^0.10.4-alpha.0",
|
|
132
|
+
"@internal/lint": "0.0.12"
|
|
133
133
|
},
|
|
134
134
|
"peerDependencies": {
|
|
135
135
|
"@mastra/core": "^0.10.2-alpha.0"
|