@mastra/deployer 0.10.9 → 0.10.10-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.
|
@@ -233,7 +233,7 @@ declare abstract class EnvService {
|
|
|
233
233
|
export { EnvService }
|
|
234
234
|
export { EnvService as EnvService_alias_1 }
|
|
235
235
|
|
|
236
|
-
export declare function errorHandler(err: Error, c: Context): Response;
|
|
236
|
+
export declare function errorHandler(err: Error, c: Context, isDev?: boolean): Response;
|
|
237
237
|
|
|
238
238
|
export declare function executeAgentToolHandler(c: Context): Promise<Response>;
|
|
239
239
|
|
|
@@ -737,6 +737,8 @@ export declare function rootHandler(c: Context): Promise<Response & TypedRespons
|
|
|
737
737
|
|
|
738
738
|
export declare function saveMessagesHandler(c: Context): Promise<Response>;
|
|
739
739
|
|
|
740
|
+
export declare function sendWorkflowRunEventHandler(c: Context): Promise<Response>;
|
|
741
|
+
|
|
740
742
|
declare type ServerBundleOptions = {
|
|
741
743
|
playground?: boolean;
|
|
742
744
|
isDev?: boolean;
|
|
@@ -233,7 +233,7 @@ declare abstract class EnvService {
|
|
|
233
233
|
export { EnvService }
|
|
234
234
|
export { EnvService as EnvService_alias_1 }
|
|
235
235
|
|
|
236
|
-
export declare function errorHandler(err: Error, c: Context): Response;
|
|
236
|
+
export declare function errorHandler(err: Error, c: Context, isDev?: boolean): Response;
|
|
237
237
|
|
|
238
238
|
export declare function executeAgentToolHandler(c: Context): Promise<Response>;
|
|
239
239
|
|
|
@@ -737,6 +737,8 @@ export declare function rootHandler(c: Context): Promise<Response & TypedRespons
|
|
|
737
737
|
|
|
738
738
|
export declare function saveMessagesHandler(c: Context): Promise<Response>;
|
|
739
739
|
|
|
740
|
+
export declare function sendWorkflowRunEventHandler(c: Context): Promise<Response>;
|
|
741
|
+
|
|
740
742
|
declare type ServerBundleOptions = {
|
|
741
743
|
playground?: boolean;
|
|
742
744
|
isDev?: boolean;
|
package/dist/server/index.cjs
CHANGED
|
@@ -936,11 +936,15 @@ async function getAgentExecutionHandler(c2) {
|
|
|
936
936
|
function handleError(error, defaultMessage) {
|
|
937
937
|
const apiError = error;
|
|
938
938
|
throw new httpException.HTTPException(apiError.status || 500, {
|
|
939
|
-
message: apiError.message || defaultMessage
|
|
939
|
+
message: apiError.message || defaultMessage,
|
|
940
|
+
cause: apiError.cause
|
|
940
941
|
});
|
|
941
942
|
}
|
|
942
|
-
function errorHandler(err, c2) {
|
|
943
|
+
function errorHandler(err, c2, isDev) {
|
|
943
944
|
if (err instanceof httpException.HTTPException) {
|
|
945
|
+
if (isDev) {
|
|
946
|
+
return c2.json({ error: err.message, cause: err.cause, stack: err.stack }, err.status);
|
|
947
|
+
}
|
|
944
948
|
return c2.json({ error: err.message }, err.status);
|
|
945
949
|
}
|
|
946
950
|
console.error(err);
|
|
@@ -4568,6 +4572,24 @@ async function cancelWorkflowRunHandler(c2) {
|
|
|
4568
4572
|
return handleError(error, "Error canceling workflow run");
|
|
4569
4573
|
}
|
|
4570
4574
|
}
|
|
4575
|
+
async function sendWorkflowRunEventHandler(c2) {
|
|
4576
|
+
try {
|
|
4577
|
+
const mastra = c2.get("mastra");
|
|
4578
|
+
const workflowId = c2.req.param("workflowId");
|
|
4579
|
+
const runId = c2.req.param("runId");
|
|
4580
|
+
const { event, data } = await c2.req.json();
|
|
4581
|
+
const result = await workflows.sendWorkflowRunEventHandler({
|
|
4582
|
+
mastra,
|
|
4583
|
+
workflowId,
|
|
4584
|
+
runId,
|
|
4585
|
+
event,
|
|
4586
|
+
data
|
|
4587
|
+
});
|
|
4588
|
+
return c2.json(result);
|
|
4589
|
+
} catch (error) {
|
|
4590
|
+
return handleError(error, "Error sending workflow run event");
|
|
4591
|
+
}
|
|
4592
|
+
}
|
|
4571
4593
|
|
|
4572
4594
|
// src/server/welcome.ts
|
|
4573
4595
|
var html2 = `
|
|
@@ -4717,7 +4739,7 @@ ${err.stack.split("\n").slice(1).join("\n")}
|
|
|
4717
4739
|
await next();
|
|
4718
4740
|
}
|
|
4719
4741
|
});
|
|
4720
|
-
app.onError(errorHandler);
|
|
4742
|
+
app.onError((err, c2) => errorHandler(err, c2, options.isDev));
|
|
4721
4743
|
app.use("*", async function setContext(c2, next) {
|
|
4722
4744
|
let runtimeContext$1 = new runtimeContext.RuntimeContext();
|
|
4723
4745
|
if (c2.req.method === "POST" || c2.req.method === "PUT") {
|
|
@@ -7733,6 +7755,41 @@ ${err.stack.split("\n").slice(1).join("\n")}
|
|
|
7733
7755
|
}),
|
|
7734
7756
|
cancelWorkflowRunHandler
|
|
7735
7757
|
);
|
|
7758
|
+
app.post(
|
|
7759
|
+
"/api/workflows/:workflowId/runs/:runId/send-event",
|
|
7760
|
+
w({
|
|
7761
|
+
description: "Send an event to a workflow run",
|
|
7762
|
+
parameters: [
|
|
7763
|
+
{
|
|
7764
|
+
name: "workflowId",
|
|
7765
|
+
in: "path",
|
|
7766
|
+
required: true,
|
|
7767
|
+
schema: { type: "string" }
|
|
7768
|
+
},
|
|
7769
|
+
{
|
|
7770
|
+
name: "runId",
|
|
7771
|
+
in: "path",
|
|
7772
|
+
required: true,
|
|
7773
|
+
schema: { type: "string" }
|
|
7774
|
+
}
|
|
7775
|
+
],
|
|
7776
|
+
requestBody: {
|
|
7777
|
+
required: true,
|
|
7778
|
+
content: {
|
|
7779
|
+
"application/json": {
|
|
7780
|
+
schema: { type: "object", properties: { event: { type: "string" }, data: { type: "object" } } }
|
|
7781
|
+
}
|
|
7782
|
+
}
|
|
7783
|
+
},
|
|
7784
|
+
tags: ["workflows"],
|
|
7785
|
+
responses: {
|
|
7786
|
+
200: {
|
|
7787
|
+
description: "workflow run event sent"
|
|
7788
|
+
}
|
|
7789
|
+
}
|
|
7790
|
+
}),
|
|
7791
|
+
sendWorkflowRunEventHandler
|
|
7792
|
+
);
|
|
7736
7793
|
app.get(
|
|
7737
7794
|
"/api/logs",
|
|
7738
7795
|
w({
|
package/dist/server/index.js
CHANGED
|
@@ -32,7 +32,7 @@ import { executeAgentToolHandler as executeAgentToolHandler$1, getToolsHandler a
|
|
|
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 { getVNextNetworksHandler as getVNextNetworksHandler$1, getVNextNetworkByIdHandler as getVNextNetworkByIdHandler$1, generateVNextNetworkHandler as generateVNextNetworkHandler$1, loopVNextNetworkHandler as loopVNextNetworkHandler$1, loopStreamVNextNetworkHandler as loopStreamVNextNetworkHandler$1, streamGenerateVNextNetworkHandler as streamGenerateVNextNetworkHandler$1 } from '@mastra/server/handlers/vNextNetwork';
|
|
34
34
|
import { getSpeakersHandler as getSpeakersHandler$1, generateSpeechHandler, getListenerHandler as getListenerHandler$1, transcribeSpeechHandler } from '@mastra/server/handlers/voice';
|
|
35
|
-
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, cancelWorkflowRunHandler as cancelWorkflowRunHandler$1 } from '@mastra/server/handlers/workflows';
|
|
35
|
+
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, cancelWorkflowRunHandler as cancelWorkflowRunHandler$1, sendWorkflowRunEventHandler as sendWorkflowRunEventHandler$1 } from '@mastra/server/handlers/workflows';
|
|
36
36
|
|
|
37
37
|
// src/server/index.ts
|
|
38
38
|
var RequestError = class extends Error {
|
|
@@ -929,11 +929,15 @@ async function getAgentExecutionHandler(c2) {
|
|
|
929
929
|
function handleError(error, defaultMessage) {
|
|
930
930
|
const apiError = error;
|
|
931
931
|
throw new HTTPException(apiError.status || 500, {
|
|
932
|
-
message: apiError.message || defaultMessage
|
|
932
|
+
message: apiError.message || defaultMessage,
|
|
933
|
+
cause: apiError.cause
|
|
933
934
|
});
|
|
934
935
|
}
|
|
935
|
-
function errorHandler(err, c2) {
|
|
936
|
+
function errorHandler(err, c2, isDev) {
|
|
936
937
|
if (err instanceof HTTPException) {
|
|
938
|
+
if (isDev) {
|
|
939
|
+
return c2.json({ error: err.message, cause: err.cause, stack: err.stack }, err.status);
|
|
940
|
+
}
|
|
937
941
|
return c2.json({ error: err.message }, err.status);
|
|
938
942
|
}
|
|
939
943
|
console.error(err);
|
|
@@ -4561,6 +4565,24 @@ async function cancelWorkflowRunHandler(c2) {
|
|
|
4561
4565
|
return handleError(error, "Error canceling workflow run");
|
|
4562
4566
|
}
|
|
4563
4567
|
}
|
|
4568
|
+
async function sendWorkflowRunEventHandler(c2) {
|
|
4569
|
+
try {
|
|
4570
|
+
const mastra = c2.get("mastra");
|
|
4571
|
+
const workflowId = c2.req.param("workflowId");
|
|
4572
|
+
const runId = c2.req.param("runId");
|
|
4573
|
+
const { event, data } = await c2.req.json();
|
|
4574
|
+
const result = await sendWorkflowRunEventHandler$1({
|
|
4575
|
+
mastra,
|
|
4576
|
+
workflowId,
|
|
4577
|
+
runId,
|
|
4578
|
+
event,
|
|
4579
|
+
data
|
|
4580
|
+
});
|
|
4581
|
+
return c2.json(result);
|
|
4582
|
+
} catch (error) {
|
|
4583
|
+
return handleError(error, "Error sending workflow run event");
|
|
4584
|
+
}
|
|
4585
|
+
}
|
|
4564
4586
|
|
|
4565
4587
|
// src/server/welcome.ts
|
|
4566
4588
|
var html2 = `
|
|
@@ -4710,7 +4732,7 @@ ${err.stack.split("\n").slice(1).join("\n")}
|
|
|
4710
4732
|
await next();
|
|
4711
4733
|
}
|
|
4712
4734
|
});
|
|
4713
|
-
app.onError(errorHandler);
|
|
4735
|
+
app.onError((err, c2) => errorHandler(err, c2, options.isDev));
|
|
4714
4736
|
app.use("*", async function setContext(c2, next) {
|
|
4715
4737
|
let runtimeContext = new RuntimeContext();
|
|
4716
4738
|
if (c2.req.method === "POST" || c2.req.method === "PUT") {
|
|
@@ -7726,6 +7748,41 @@ ${err.stack.split("\n").slice(1).join("\n")}
|
|
|
7726
7748
|
}),
|
|
7727
7749
|
cancelWorkflowRunHandler
|
|
7728
7750
|
);
|
|
7751
|
+
app.post(
|
|
7752
|
+
"/api/workflows/:workflowId/runs/:runId/send-event",
|
|
7753
|
+
w({
|
|
7754
|
+
description: "Send an event to a workflow run",
|
|
7755
|
+
parameters: [
|
|
7756
|
+
{
|
|
7757
|
+
name: "workflowId",
|
|
7758
|
+
in: "path",
|
|
7759
|
+
required: true,
|
|
7760
|
+
schema: { type: "string" }
|
|
7761
|
+
},
|
|
7762
|
+
{
|
|
7763
|
+
name: "runId",
|
|
7764
|
+
in: "path",
|
|
7765
|
+
required: true,
|
|
7766
|
+
schema: { type: "string" }
|
|
7767
|
+
}
|
|
7768
|
+
],
|
|
7769
|
+
requestBody: {
|
|
7770
|
+
required: true,
|
|
7771
|
+
content: {
|
|
7772
|
+
"application/json": {
|
|
7773
|
+
schema: { type: "object", properties: { event: { type: "string" }, data: { type: "object" } } }
|
|
7774
|
+
}
|
|
7775
|
+
}
|
|
7776
|
+
},
|
|
7777
|
+
tags: ["workflows"],
|
|
7778
|
+
responses: {
|
|
7779
|
+
200: {
|
|
7780
|
+
description: "workflow run event sent"
|
|
7781
|
+
}
|
|
7782
|
+
}
|
|
7783
|
+
}),
|
|
7784
|
+
sendWorkflowRunEventHandler
|
|
7785
|
+
);
|
|
7729
7786
|
app.get(
|
|
7730
7787
|
"/api/logs",
|
|
7731
7788
|
w({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.10-alpha.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"rollup-plugin-node-externals": "^8.0.1",
|
|
109
109
|
"typescript-paths": "^1.5.1",
|
|
110
110
|
"zod": "^3.25.67",
|
|
111
|
-
"@mastra/server": "^0.10.
|
|
111
|
+
"@mastra/server": "^0.10.10-alpha.1"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
114
|
"@hono/node-server": "^1.14.4",
|
|
@@ -128,8 +128,8 @@
|
|
|
128
128
|
"typescript": "^5.8.3",
|
|
129
129
|
"vitest": "^3.2.4",
|
|
130
130
|
"@internal/lint": "0.0.16",
|
|
131
|
-
"@mastra/
|
|
132
|
-
"@mastra/
|
|
131
|
+
"@mastra/core": "0.10.10-alpha.1",
|
|
132
|
+
"@mastra/mcp": "^0.10.5"
|
|
133
133
|
},
|
|
134
134
|
"peerDependencies": {
|
|
135
135
|
"@mastra/core": ">=0.10.9-0 <0.11.0-0"
|