@mastra/deployer 0.3.4-alpha.1 → 0.3.4-alpha.3
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 +8 -7
- package/dist/_tsup-dts-rollup.d.ts +8 -7
- package/dist/server/index.cjs +121 -115
- package/dist/server/index.js +121 -115
- package/package.json +5 -5
|
@@ -265,6 +265,7 @@ export declare function getAgentByIdHandler(c: Context): Promise<Response & Type
|
|
|
265
265
|
name: any;
|
|
266
266
|
instructions: string;
|
|
267
267
|
tools: any;
|
|
268
|
+
workflows: {};
|
|
268
269
|
provider: string;
|
|
269
270
|
modelId: string;
|
|
270
271
|
}, ContentfulStatusCode, "json">>;
|
|
@@ -384,6 +385,13 @@ export declare function getLogTransports(c: Context): Promise<Response>;
|
|
|
384
385
|
*/
|
|
385
386
|
export declare const getMcpServerMessageHandler: (c: Context) => Promise<Response>;
|
|
386
387
|
|
|
388
|
+
/**
|
|
389
|
+
* Handler for SSE related routes for an MCP server.
|
|
390
|
+
* This function will be called for both establishing the SSE connection (GET)
|
|
391
|
+
* and for posting messages to it (POST).
|
|
392
|
+
*/
|
|
393
|
+
export declare const getMcpServerSseHandler: (c: Context) => Promise<Response | undefined>;
|
|
394
|
+
|
|
387
395
|
export declare function getMemoryStatusHandler(c: Context): Promise<Response>;
|
|
388
396
|
|
|
389
397
|
export declare function getMessagesHandler(c: Context): Promise<Response>;
|
|
@@ -437,13 +445,6 @@ export declare function handleClientsRefresh(c: Context): Response;
|
|
|
437
445
|
|
|
438
446
|
export declare function handleError(error: unknown, defaultMessage: string): Promise<Response>;
|
|
439
447
|
|
|
440
|
-
/**
|
|
441
|
-
* Handler for SSE related routes for an MCP server.
|
|
442
|
-
* This function will be called for both establishing the SSE connection (GET)
|
|
443
|
-
* and for posting messages to it (POST).
|
|
444
|
-
*/
|
|
445
|
-
export declare const handleMcpServerSseRoutes: (c: Context) => Promise<Response | undefined>;
|
|
446
|
-
|
|
447
448
|
export declare function handleTriggerClientsRefresh(c: Context): Response & TypedResponse< {
|
|
448
449
|
success: true;
|
|
449
450
|
clients: number;
|
|
@@ -265,6 +265,7 @@ export declare function getAgentByIdHandler(c: Context): Promise<Response & Type
|
|
|
265
265
|
name: any;
|
|
266
266
|
instructions: string;
|
|
267
267
|
tools: any;
|
|
268
|
+
workflows: {};
|
|
268
269
|
provider: string;
|
|
269
270
|
modelId: string;
|
|
270
271
|
}, ContentfulStatusCode, "json">>;
|
|
@@ -384,6 +385,13 @@ export declare function getLogTransports(c: Context): Promise<Response>;
|
|
|
384
385
|
*/
|
|
385
386
|
export declare const getMcpServerMessageHandler: (c: Context) => Promise<Response>;
|
|
386
387
|
|
|
388
|
+
/**
|
|
389
|
+
* Handler for SSE related routes for an MCP server.
|
|
390
|
+
* This function will be called for both establishing the SSE connection (GET)
|
|
391
|
+
* and for posting messages to it (POST).
|
|
392
|
+
*/
|
|
393
|
+
export declare const getMcpServerSseHandler: (c: Context) => Promise<Response | undefined>;
|
|
394
|
+
|
|
387
395
|
export declare function getMemoryStatusHandler(c: Context): Promise<Response>;
|
|
388
396
|
|
|
389
397
|
export declare function getMessagesHandler(c: Context): Promise<Response>;
|
|
@@ -437,13 +445,6 @@ export declare function handleClientsRefresh(c: Context): Response;
|
|
|
437
445
|
|
|
438
446
|
export declare function handleError(error: unknown, defaultMessage: string): Promise<Response>;
|
|
439
447
|
|
|
440
|
-
/**
|
|
441
|
-
* Handler for SSE related routes for an MCP server.
|
|
442
|
-
* This function will be called for both establishing the SSE connection (GET)
|
|
443
|
-
* and for posting messages to it (POST).
|
|
444
|
-
*/
|
|
445
|
-
export declare const handleMcpServerSseRoutes: (c: Context) => Promise<Response | undefined>;
|
|
446
|
-
|
|
447
448
|
export declare function handleTriggerClientsRefresh(c: Context): Response & TypedResponse< {
|
|
448
449
|
success: true;
|
|
449
450
|
clients: number;
|
package/dist/server/index.cjs
CHANGED
|
@@ -2997,38 +2997,26 @@ var getMcpServerMessageHandler = async (c2) => {
|
|
|
2997
2997
|
return handleError(error, "Error sending MCP message");
|
|
2998
2998
|
}
|
|
2999
2999
|
};
|
|
3000
|
-
var
|
|
3000
|
+
var getMcpServerSseHandler = async (c2) => {
|
|
3001
3001
|
const mastra = getMastra(c2);
|
|
3002
3002
|
const serverId = c2.req.param("serverId");
|
|
3003
3003
|
const server = mastra.getMCPServer(serverId);
|
|
3004
3004
|
if (!server) {
|
|
3005
3005
|
return c2.json({ error: `MCP server '${serverId}' not found` }, 404);
|
|
3006
3006
|
}
|
|
3007
|
-
const { req, res } = toReqRes(c2.req.raw);
|
|
3008
3007
|
const requestUrl = new URL(c2.req.url);
|
|
3009
3008
|
const sseConnectionPath = `/api/servers/${serverId}/sse`;
|
|
3010
3009
|
const sseMessagePath = `/api/servers/${serverId}/messages`;
|
|
3011
3010
|
try {
|
|
3012
|
-
await server.
|
|
3011
|
+
return await server.startHonoSSE({
|
|
3013
3012
|
url: requestUrl,
|
|
3014
3013
|
ssePath: sseConnectionPath,
|
|
3015
3014
|
messagePath: sseMessagePath,
|
|
3016
|
-
|
|
3017
|
-
res
|
|
3015
|
+
context: c2
|
|
3018
3016
|
});
|
|
3019
|
-
if (res.writableEnded || res.headersSent) {
|
|
3020
|
-
return toFetchResponse(res);
|
|
3021
|
-
}
|
|
3022
|
-
c2.get("logger")?.warn(
|
|
3023
|
-
{ serverId, path: requestUrl.pathname },
|
|
3024
|
-
"MCP SSE handler: MCPServer.startSSE did not seem to handle the response."
|
|
3025
|
-
);
|
|
3026
|
-
return c2.text("Internal Server Error: MCP SSE request not fully processed by server component", 500);
|
|
3027
3017
|
} catch (error) {
|
|
3028
3018
|
c2.get("logger")?.error({ err: error, serverId, path: requestUrl.pathname }, "Error in MCP SSE route handler");
|
|
3029
|
-
|
|
3030
|
-
return handleError(error, "Error handling MCP SSE request");
|
|
3031
|
-
}
|
|
3019
|
+
return handleError(error, "Error handling MCP SSE request");
|
|
3032
3020
|
}
|
|
3033
3021
|
};
|
|
3034
3022
|
async function getMemoryStatusHandler(c2) {
|
|
@@ -3141,10 +3129,19 @@ async function getMessagesHandler(c2) {
|
|
|
3141
3129
|
const mastra = c2.get("mastra");
|
|
3142
3130
|
const agentId = c2.req.query("agentId");
|
|
3143
3131
|
const threadId = c2.req.param("threadId");
|
|
3132
|
+
const rawLimit = c2.req.query("limit");
|
|
3133
|
+
let limit = void 0;
|
|
3134
|
+
if (rawLimit !== void 0) {
|
|
3135
|
+
const n2 = Number(rawLimit);
|
|
3136
|
+
if (Number.isFinite(n2) && Number.isInteger(n2) && n2 > 0) {
|
|
3137
|
+
limit = n2;
|
|
3138
|
+
}
|
|
3139
|
+
}
|
|
3144
3140
|
const result = await memory.getMessagesHandler({
|
|
3145
3141
|
mastra,
|
|
3146
3142
|
agentId,
|
|
3147
|
-
threadId
|
|
3143
|
+
threadId,
|
|
3144
|
+
limit
|
|
3148
3145
|
});
|
|
3149
3146
|
return c2.json(result);
|
|
3150
3147
|
} catch (error) {
|
|
@@ -3760,7 +3757,7 @@ async function listenHandler(c2) {
|
|
|
3760
3757
|
options: parsedOptions
|
|
3761
3758
|
}
|
|
3762
3759
|
});
|
|
3763
|
-
return c2.json({ text: transcription });
|
|
3760
|
+
return c2.json({ text: transcription?.text });
|
|
3764
3761
|
} catch (error) {
|
|
3765
3762
|
return handleError(error, "Error transcribing speech");
|
|
3766
3763
|
}
|
|
@@ -4644,121 +4641,123 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
4644
4641
|
}),
|
|
4645
4642
|
streamGenerateHandler
|
|
4646
4643
|
);
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
],
|
|
4661
|
-
requestBody: {
|
|
4662
|
-
required: true,
|
|
4663
|
-
content: {
|
|
4664
|
-
"application/json": {
|
|
4665
|
-
schema: {
|
|
4666
|
-
type: "object",
|
|
4667
|
-
properties: {
|
|
4668
|
-
instructions: {
|
|
4669
|
-
type: "string",
|
|
4670
|
-
description: "New instructions for the agent"
|
|
4671
|
-
}
|
|
4672
|
-
},
|
|
4673
|
-
required: ["instructions"]
|
|
4674
|
-
}
|
|
4644
|
+
if (options.isDev) {
|
|
4645
|
+
app.post(
|
|
4646
|
+
"/api/agents/:agentId/instructions",
|
|
4647
|
+
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
4648
|
+
h({
|
|
4649
|
+
description: "Update an agent's instructions",
|
|
4650
|
+
tags: ["agents"],
|
|
4651
|
+
parameters: [
|
|
4652
|
+
{
|
|
4653
|
+
name: "agentId",
|
|
4654
|
+
in: "path",
|
|
4655
|
+
required: true,
|
|
4656
|
+
schema: { type: "string" }
|
|
4675
4657
|
}
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
responses: {
|
|
4679
|
-
200: {
|
|
4680
|
-
description: "Instructions updated successfully"
|
|
4681
|
-
},
|
|
4682
|
-
403: {
|
|
4683
|
-
description: "Not allowed in non-playground environment"
|
|
4684
|
-
},
|
|
4685
|
-
404: {
|
|
4686
|
-
description: "Agent not found"
|
|
4687
|
-
}
|
|
4688
|
-
}
|
|
4689
|
-
}),
|
|
4690
|
-
setAgentInstructionsHandler
|
|
4691
|
-
);
|
|
4692
|
-
app.post(
|
|
4693
|
-
"/api/agents/:agentId/instructions/enhance",
|
|
4694
|
-
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
4695
|
-
h({
|
|
4696
|
-
description: "Generate an improved system prompt from instructions",
|
|
4697
|
-
tags: ["agents"],
|
|
4698
|
-
parameters: [
|
|
4699
|
-
{
|
|
4700
|
-
name: "agentId",
|
|
4701
|
-
in: "path",
|
|
4658
|
+
],
|
|
4659
|
+
requestBody: {
|
|
4702
4660
|
required: true,
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
type: "object",
|
|
4713
|
-
properties: {
|
|
4714
|
-
instructions: {
|
|
4715
|
-
type: "string",
|
|
4716
|
-
description: "Instructions to generate a system prompt from"
|
|
4661
|
+
content: {
|
|
4662
|
+
"application/json": {
|
|
4663
|
+
schema: {
|
|
4664
|
+
type: "object",
|
|
4665
|
+
properties: {
|
|
4666
|
+
instructions: {
|
|
4667
|
+
type: "string",
|
|
4668
|
+
description: "New instructions for the agent"
|
|
4669
|
+
}
|
|
4717
4670
|
},
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
description: "Optional comment for the enhanced prompt"
|
|
4721
|
-
}
|
|
4722
|
-
},
|
|
4723
|
-
required: ["instructions"]
|
|
4671
|
+
required: ["instructions"]
|
|
4672
|
+
}
|
|
4724
4673
|
}
|
|
4725
4674
|
}
|
|
4675
|
+
},
|
|
4676
|
+
responses: {
|
|
4677
|
+
200: {
|
|
4678
|
+
description: "Instructions updated successfully"
|
|
4679
|
+
},
|
|
4680
|
+
403: {
|
|
4681
|
+
description: "Not allowed in non-playground environment"
|
|
4682
|
+
},
|
|
4683
|
+
404: {
|
|
4684
|
+
description: "Agent not found"
|
|
4685
|
+
}
|
|
4726
4686
|
}
|
|
4727
|
-
},
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4687
|
+
}),
|
|
4688
|
+
setAgentInstructionsHandler
|
|
4689
|
+
);
|
|
4690
|
+
app.post(
|
|
4691
|
+
"/api/agents/:agentId/instructions/enhance",
|
|
4692
|
+
bodyLimit.bodyLimit(bodyLimitOptions),
|
|
4693
|
+
h({
|
|
4694
|
+
description: "Generate an improved system prompt from instructions",
|
|
4695
|
+
tags: ["agents"],
|
|
4696
|
+
parameters: [
|
|
4697
|
+
{
|
|
4698
|
+
name: "agentId",
|
|
4699
|
+
in: "path",
|
|
4700
|
+
required: true,
|
|
4701
|
+
schema: { type: "string" },
|
|
4702
|
+
description: "ID of the agent whose model will be used for prompt generation"
|
|
4703
|
+
}
|
|
4704
|
+
],
|
|
4705
|
+
requestBody: {
|
|
4706
|
+
required: true,
|
|
4731
4707
|
content: {
|
|
4732
4708
|
"application/json": {
|
|
4733
4709
|
schema: {
|
|
4734
4710
|
type: "object",
|
|
4735
4711
|
properties: {
|
|
4736
|
-
|
|
4712
|
+
instructions: {
|
|
4737
4713
|
type: "string",
|
|
4738
|
-
description: "
|
|
4714
|
+
description: "Instructions to generate a system prompt from"
|
|
4739
4715
|
},
|
|
4740
|
-
|
|
4716
|
+
comment: {
|
|
4741
4717
|
type: "string",
|
|
4742
|
-
description: "
|
|
4718
|
+
description: "Optional comment for the enhanced prompt"
|
|
4743
4719
|
}
|
|
4744
|
-
}
|
|
4720
|
+
},
|
|
4721
|
+
required: ["instructions"]
|
|
4745
4722
|
}
|
|
4746
4723
|
}
|
|
4747
4724
|
}
|
|
4748
4725
|
},
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4726
|
+
responses: {
|
|
4727
|
+
200: {
|
|
4728
|
+
description: "Generated system prompt and analysis",
|
|
4729
|
+
content: {
|
|
4730
|
+
"application/json": {
|
|
4731
|
+
schema: {
|
|
4732
|
+
type: "object",
|
|
4733
|
+
properties: {
|
|
4734
|
+
explanation: {
|
|
4735
|
+
type: "string",
|
|
4736
|
+
description: "Detailed analysis of the instructions"
|
|
4737
|
+
},
|
|
4738
|
+
new_prompt: {
|
|
4739
|
+
type: "string",
|
|
4740
|
+
description: "The enhanced system prompt"
|
|
4741
|
+
}
|
|
4742
|
+
}
|
|
4743
|
+
}
|
|
4744
|
+
}
|
|
4745
|
+
}
|
|
4746
|
+
},
|
|
4747
|
+
400: {
|
|
4748
|
+
description: "Missing or invalid request parameters"
|
|
4749
|
+
},
|
|
4750
|
+
404: {
|
|
4751
|
+
description: "Agent not found"
|
|
4752
|
+
},
|
|
4753
|
+
500: {
|
|
4754
|
+
description: "Internal server error or model response parsing error"
|
|
4755
|
+
}
|
|
4757
4756
|
}
|
|
4758
|
-
}
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4757
|
+
}),
|
|
4758
|
+
generateSystemPromptHandler
|
|
4759
|
+
);
|
|
4760
|
+
}
|
|
4762
4761
|
app.get(
|
|
4763
4762
|
"/api/agents/:agentId/speakers",
|
|
4764
4763
|
async (c2, next) => {
|
|
@@ -5228,7 +5227,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5228
5227
|
500: { description: "Internal server error establishing SSE connection." }
|
|
5229
5228
|
}
|
|
5230
5229
|
}),
|
|
5231
|
-
|
|
5230
|
+
getMcpServerSseHandler
|
|
5232
5231
|
);
|
|
5233
5232
|
app.post(
|
|
5234
5233
|
mcpSseMessagePath,
|
|
@@ -5261,7 +5260,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5261
5260
|
503: { description: "SSE connection not established with this server, or server unable to process message." }
|
|
5262
5261
|
}
|
|
5263
5262
|
}),
|
|
5264
|
-
|
|
5263
|
+
getMcpServerSseHandler
|
|
5265
5264
|
);
|
|
5266
5265
|
app.get(
|
|
5267
5266
|
"/api/memory/status",
|
|
@@ -5358,6 +5357,13 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5358
5357
|
in: "query",
|
|
5359
5358
|
required: true,
|
|
5360
5359
|
schema: { type: "string" }
|
|
5360
|
+
},
|
|
5361
|
+
{
|
|
5362
|
+
name: "limit",
|
|
5363
|
+
in: "query",
|
|
5364
|
+
required: false,
|
|
5365
|
+
schema: { type: "number" },
|
|
5366
|
+
description: "Limit the number of messages to retrieve (default: 40)"
|
|
5361
5367
|
}
|
|
5362
5368
|
],
|
|
5363
5369
|
responses: {
|
package/dist/server/index.js
CHANGED
|
@@ -2991,38 +2991,26 @@ var getMcpServerMessageHandler = async (c2) => {
|
|
|
2991
2991
|
return handleError(error, "Error sending MCP message");
|
|
2992
2992
|
}
|
|
2993
2993
|
};
|
|
2994
|
-
var
|
|
2994
|
+
var getMcpServerSseHandler = async (c2) => {
|
|
2995
2995
|
const mastra = getMastra(c2);
|
|
2996
2996
|
const serverId = c2.req.param("serverId");
|
|
2997
2997
|
const server = mastra.getMCPServer(serverId);
|
|
2998
2998
|
if (!server) {
|
|
2999
2999
|
return c2.json({ error: `MCP server '${serverId}' not found` }, 404);
|
|
3000
3000
|
}
|
|
3001
|
-
const { req, res } = toReqRes(c2.req.raw);
|
|
3002
3001
|
const requestUrl = new URL(c2.req.url);
|
|
3003
3002
|
const sseConnectionPath = `/api/servers/${serverId}/sse`;
|
|
3004
3003
|
const sseMessagePath = `/api/servers/${serverId}/messages`;
|
|
3005
3004
|
try {
|
|
3006
|
-
await server.
|
|
3005
|
+
return await server.startHonoSSE({
|
|
3007
3006
|
url: requestUrl,
|
|
3008
3007
|
ssePath: sseConnectionPath,
|
|
3009
3008
|
messagePath: sseMessagePath,
|
|
3010
|
-
|
|
3011
|
-
res
|
|
3009
|
+
context: c2
|
|
3012
3010
|
});
|
|
3013
|
-
if (res.writableEnded || res.headersSent) {
|
|
3014
|
-
return toFetchResponse(res);
|
|
3015
|
-
}
|
|
3016
|
-
c2.get("logger")?.warn(
|
|
3017
|
-
{ serverId, path: requestUrl.pathname },
|
|
3018
|
-
"MCP SSE handler: MCPServer.startSSE did not seem to handle the response."
|
|
3019
|
-
);
|
|
3020
|
-
return c2.text("Internal Server Error: MCP SSE request not fully processed by server component", 500);
|
|
3021
3011
|
} catch (error) {
|
|
3022
3012
|
c2.get("logger")?.error({ err: error, serverId, path: requestUrl.pathname }, "Error in MCP SSE route handler");
|
|
3023
|
-
|
|
3024
|
-
return handleError(error, "Error handling MCP SSE request");
|
|
3025
|
-
}
|
|
3013
|
+
return handleError(error, "Error handling MCP SSE request");
|
|
3026
3014
|
}
|
|
3027
3015
|
};
|
|
3028
3016
|
async function getMemoryStatusHandler(c2) {
|
|
@@ -3135,10 +3123,19 @@ async function getMessagesHandler(c2) {
|
|
|
3135
3123
|
const mastra = c2.get("mastra");
|
|
3136
3124
|
const agentId = c2.req.query("agentId");
|
|
3137
3125
|
const threadId = c2.req.param("threadId");
|
|
3126
|
+
const rawLimit = c2.req.query("limit");
|
|
3127
|
+
let limit = void 0;
|
|
3128
|
+
if (rawLimit !== void 0) {
|
|
3129
|
+
const n2 = Number(rawLimit);
|
|
3130
|
+
if (Number.isFinite(n2) && Number.isInteger(n2) && n2 > 0) {
|
|
3131
|
+
limit = n2;
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3138
3134
|
const result = await getMessagesHandler$1({
|
|
3139
3135
|
mastra,
|
|
3140
3136
|
agentId,
|
|
3141
|
-
threadId
|
|
3137
|
+
threadId,
|
|
3138
|
+
limit
|
|
3142
3139
|
});
|
|
3143
3140
|
return c2.json(result);
|
|
3144
3141
|
} catch (error) {
|
|
@@ -3754,7 +3751,7 @@ async function listenHandler(c2) {
|
|
|
3754
3751
|
options: parsedOptions
|
|
3755
3752
|
}
|
|
3756
3753
|
});
|
|
3757
|
-
return c2.json({ text: transcription });
|
|
3754
|
+
return c2.json({ text: transcription?.text });
|
|
3758
3755
|
} catch (error) {
|
|
3759
3756
|
return handleError(error, "Error transcribing speech");
|
|
3760
3757
|
}
|
|
@@ -4638,121 +4635,123 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
4638
4635
|
}),
|
|
4639
4636
|
streamGenerateHandler
|
|
4640
4637
|
);
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
],
|
|
4655
|
-
requestBody: {
|
|
4656
|
-
required: true,
|
|
4657
|
-
content: {
|
|
4658
|
-
"application/json": {
|
|
4659
|
-
schema: {
|
|
4660
|
-
type: "object",
|
|
4661
|
-
properties: {
|
|
4662
|
-
instructions: {
|
|
4663
|
-
type: "string",
|
|
4664
|
-
description: "New instructions for the agent"
|
|
4665
|
-
}
|
|
4666
|
-
},
|
|
4667
|
-
required: ["instructions"]
|
|
4668
|
-
}
|
|
4638
|
+
if (options.isDev) {
|
|
4639
|
+
app.post(
|
|
4640
|
+
"/api/agents/:agentId/instructions",
|
|
4641
|
+
bodyLimit(bodyLimitOptions),
|
|
4642
|
+
h({
|
|
4643
|
+
description: "Update an agent's instructions",
|
|
4644
|
+
tags: ["agents"],
|
|
4645
|
+
parameters: [
|
|
4646
|
+
{
|
|
4647
|
+
name: "agentId",
|
|
4648
|
+
in: "path",
|
|
4649
|
+
required: true,
|
|
4650
|
+
schema: { type: "string" }
|
|
4669
4651
|
}
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
responses: {
|
|
4673
|
-
200: {
|
|
4674
|
-
description: "Instructions updated successfully"
|
|
4675
|
-
},
|
|
4676
|
-
403: {
|
|
4677
|
-
description: "Not allowed in non-playground environment"
|
|
4678
|
-
},
|
|
4679
|
-
404: {
|
|
4680
|
-
description: "Agent not found"
|
|
4681
|
-
}
|
|
4682
|
-
}
|
|
4683
|
-
}),
|
|
4684
|
-
setAgentInstructionsHandler
|
|
4685
|
-
);
|
|
4686
|
-
app.post(
|
|
4687
|
-
"/api/agents/:agentId/instructions/enhance",
|
|
4688
|
-
bodyLimit(bodyLimitOptions),
|
|
4689
|
-
h({
|
|
4690
|
-
description: "Generate an improved system prompt from instructions",
|
|
4691
|
-
tags: ["agents"],
|
|
4692
|
-
parameters: [
|
|
4693
|
-
{
|
|
4694
|
-
name: "agentId",
|
|
4695
|
-
in: "path",
|
|
4652
|
+
],
|
|
4653
|
+
requestBody: {
|
|
4696
4654
|
required: true,
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
type: "object",
|
|
4707
|
-
properties: {
|
|
4708
|
-
instructions: {
|
|
4709
|
-
type: "string",
|
|
4710
|
-
description: "Instructions to generate a system prompt from"
|
|
4655
|
+
content: {
|
|
4656
|
+
"application/json": {
|
|
4657
|
+
schema: {
|
|
4658
|
+
type: "object",
|
|
4659
|
+
properties: {
|
|
4660
|
+
instructions: {
|
|
4661
|
+
type: "string",
|
|
4662
|
+
description: "New instructions for the agent"
|
|
4663
|
+
}
|
|
4711
4664
|
},
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
description: "Optional comment for the enhanced prompt"
|
|
4715
|
-
}
|
|
4716
|
-
},
|
|
4717
|
-
required: ["instructions"]
|
|
4665
|
+
required: ["instructions"]
|
|
4666
|
+
}
|
|
4718
4667
|
}
|
|
4719
4668
|
}
|
|
4669
|
+
},
|
|
4670
|
+
responses: {
|
|
4671
|
+
200: {
|
|
4672
|
+
description: "Instructions updated successfully"
|
|
4673
|
+
},
|
|
4674
|
+
403: {
|
|
4675
|
+
description: "Not allowed in non-playground environment"
|
|
4676
|
+
},
|
|
4677
|
+
404: {
|
|
4678
|
+
description: "Agent not found"
|
|
4679
|
+
}
|
|
4720
4680
|
}
|
|
4721
|
-
},
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4681
|
+
}),
|
|
4682
|
+
setAgentInstructionsHandler
|
|
4683
|
+
);
|
|
4684
|
+
app.post(
|
|
4685
|
+
"/api/agents/:agentId/instructions/enhance",
|
|
4686
|
+
bodyLimit(bodyLimitOptions),
|
|
4687
|
+
h({
|
|
4688
|
+
description: "Generate an improved system prompt from instructions",
|
|
4689
|
+
tags: ["agents"],
|
|
4690
|
+
parameters: [
|
|
4691
|
+
{
|
|
4692
|
+
name: "agentId",
|
|
4693
|
+
in: "path",
|
|
4694
|
+
required: true,
|
|
4695
|
+
schema: { type: "string" },
|
|
4696
|
+
description: "ID of the agent whose model will be used for prompt generation"
|
|
4697
|
+
}
|
|
4698
|
+
],
|
|
4699
|
+
requestBody: {
|
|
4700
|
+
required: true,
|
|
4725
4701
|
content: {
|
|
4726
4702
|
"application/json": {
|
|
4727
4703
|
schema: {
|
|
4728
4704
|
type: "object",
|
|
4729
4705
|
properties: {
|
|
4730
|
-
|
|
4706
|
+
instructions: {
|
|
4731
4707
|
type: "string",
|
|
4732
|
-
description: "
|
|
4708
|
+
description: "Instructions to generate a system prompt from"
|
|
4733
4709
|
},
|
|
4734
|
-
|
|
4710
|
+
comment: {
|
|
4735
4711
|
type: "string",
|
|
4736
|
-
description: "
|
|
4712
|
+
description: "Optional comment for the enhanced prompt"
|
|
4737
4713
|
}
|
|
4738
|
-
}
|
|
4714
|
+
},
|
|
4715
|
+
required: ["instructions"]
|
|
4739
4716
|
}
|
|
4740
4717
|
}
|
|
4741
4718
|
}
|
|
4742
4719
|
},
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4720
|
+
responses: {
|
|
4721
|
+
200: {
|
|
4722
|
+
description: "Generated system prompt and analysis",
|
|
4723
|
+
content: {
|
|
4724
|
+
"application/json": {
|
|
4725
|
+
schema: {
|
|
4726
|
+
type: "object",
|
|
4727
|
+
properties: {
|
|
4728
|
+
explanation: {
|
|
4729
|
+
type: "string",
|
|
4730
|
+
description: "Detailed analysis of the instructions"
|
|
4731
|
+
},
|
|
4732
|
+
new_prompt: {
|
|
4733
|
+
type: "string",
|
|
4734
|
+
description: "The enhanced system prompt"
|
|
4735
|
+
}
|
|
4736
|
+
}
|
|
4737
|
+
}
|
|
4738
|
+
}
|
|
4739
|
+
}
|
|
4740
|
+
},
|
|
4741
|
+
400: {
|
|
4742
|
+
description: "Missing or invalid request parameters"
|
|
4743
|
+
},
|
|
4744
|
+
404: {
|
|
4745
|
+
description: "Agent not found"
|
|
4746
|
+
},
|
|
4747
|
+
500: {
|
|
4748
|
+
description: "Internal server error or model response parsing error"
|
|
4749
|
+
}
|
|
4751
4750
|
}
|
|
4752
|
-
}
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4751
|
+
}),
|
|
4752
|
+
generateSystemPromptHandler
|
|
4753
|
+
);
|
|
4754
|
+
}
|
|
4756
4755
|
app.get(
|
|
4757
4756
|
"/api/agents/:agentId/speakers",
|
|
4758
4757
|
async (c2, next) => {
|
|
@@ -5222,7 +5221,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5222
5221
|
500: { description: "Internal server error establishing SSE connection." }
|
|
5223
5222
|
}
|
|
5224
5223
|
}),
|
|
5225
|
-
|
|
5224
|
+
getMcpServerSseHandler
|
|
5226
5225
|
);
|
|
5227
5226
|
app.post(
|
|
5228
5227
|
mcpSseMessagePath,
|
|
@@ -5255,7 +5254,7 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5255
5254
|
503: { description: "SSE connection not established with this server, or server unable to process message." }
|
|
5256
5255
|
}
|
|
5257
5256
|
}),
|
|
5258
|
-
|
|
5257
|
+
getMcpServerSseHandler
|
|
5259
5258
|
);
|
|
5260
5259
|
app.get(
|
|
5261
5260
|
"/api/memory/status",
|
|
@@ -5352,6 +5351,13 @@ async function createHonoServer(mastra, options = {}) {
|
|
|
5352
5351
|
in: "query",
|
|
5353
5352
|
required: true,
|
|
5354
5353
|
schema: { type: "string" }
|
|
5354
|
+
},
|
|
5355
|
+
{
|
|
5356
|
+
name: "limit",
|
|
5357
|
+
in: "query",
|
|
5358
|
+
required: false,
|
|
5359
|
+
schema: { type: "number" },
|
|
5360
|
+
description: "Limit the number of messages to retrieve (default: 40)"
|
|
5355
5361
|
}
|
|
5356
5362
|
],
|
|
5357
5363
|
responses: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/deployer",
|
|
3
|
-
"version": "0.3.4-alpha.
|
|
3
|
+
"version": "0.3.4-alpha.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
"rollup-plugin-node-externals": "^8.0.0",
|
|
108
108
|
"typescript-paths": "^1.5.1",
|
|
109
109
|
"zod": "^3.24.3",
|
|
110
|
-
"@mastra/core": "^0.9.4-alpha.
|
|
111
|
-
"@mastra/server": "^2.0.4-alpha.
|
|
110
|
+
"@mastra/core": "^0.9.4-alpha.3",
|
|
111
|
+
"@mastra/server": "^2.0.4-alpha.3"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
114
|
"@hono/node-server": "^1.13.8",
|
|
@@ -127,8 +127,8 @@
|
|
|
127
127
|
"type-fest": "^4.37.0",
|
|
128
128
|
"typescript": "^5.8.2",
|
|
129
129
|
"vitest": "^2.1.9",
|
|
130
|
-
"@
|
|
131
|
-
"@
|
|
130
|
+
"@mastra/mcp": "^0.5.0-alpha.4",
|
|
131
|
+
"@internal/lint": "0.0.4"
|
|
132
132
|
},
|
|
133
133
|
"scripts": {
|
|
134
134
|
"build": "tsup src/index.ts src/build/index.ts src/server/index.ts src/build/bundler.ts src/build/analyze.ts src/bundler/index.ts src/services/index.ts src/validator/loader.ts src/validator/custom-resolver.ts --format esm,cjs --clean --experimental-dts --treeshake=smallest --splitting --publicDir",
|