@mastra/deployer 0.3.4-alpha.2 → 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.
@@ -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;
@@ -2997,38 +2997,26 @@ var getMcpServerMessageHandler = async (c2) => {
2997
2997
  return handleError(error, "Error sending MCP message");
2998
2998
  }
2999
2999
  };
3000
- var handleMcpServerSseRoutes = async (c2) => {
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.startSSE({
3011
+ return await server.startHonoSSE({
3013
3012
  url: requestUrl,
3014
3013
  ssePath: sseConnectionPath,
3015
3014
  messagePath: sseMessagePath,
3016
- req,
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
- if (!res.headersSent && !res.writableEnded) {
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
  }
@@ -5230,7 +5227,7 @@ async function createHonoServer(mastra, options = {}) {
5230
5227
  500: { description: "Internal server error establishing SSE connection." }
5231
5228
  }
5232
5229
  }),
5233
- handleMcpServerSseRoutes
5230
+ getMcpServerSseHandler
5234
5231
  );
5235
5232
  app.post(
5236
5233
  mcpSseMessagePath,
@@ -5263,7 +5260,7 @@ async function createHonoServer(mastra, options = {}) {
5263
5260
  503: { description: "SSE connection not established with this server, or server unable to process message." }
5264
5261
  }
5265
5262
  }),
5266
- handleMcpServerSseRoutes
5263
+ getMcpServerSseHandler
5267
5264
  );
5268
5265
  app.get(
5269
5266
  "/api/memory/status",
@@ -5360,6 +5357,13 @@ async function createHonoServer(mastra, options = {}) {
5360
5357
  in: "query",
5361
5358
  required: true,
5362
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)"
5363
5367
  }
5364
5368
  ],
5365
5369
  responses: {
@@ -2991,38 +2991,26 @@ var getMcpServerMessageHandler = async (c2) => {
2991
2991
  return handleError(error, "Error sending MCP message");
2992
2992
  }
2993
2993
  };
2994
- var handleMcpServerSseRoutes = async (c2) => {
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.startSSE({
3005
+ return await server.startHonoSSE({
3007
3006
  url: requestUrl,
3008
3007
  ssePath: sseConnectionPath,
3009
3008
  messagePath: sseMessagePath,
3010
- req,
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
- if (!res.headersSent && !res.writableEnded) {
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
  }
@@ -5224,7 +5221,7 @@ async function createHonoServer(mastra, options = {}) {
5224
5221
  500: { description: "Internal server error establishing SSE connection." }
5225
5222
  }
5226
5223
  }),
5227
- handleMcpServerSseRoutes
5224
+ getMcpServerSseHandler
5228
5225
  );
5229
5226
  app.post(
5230
5227
  mcpSseMessagePath,
@@ -5257,7 +5254,7 @@ async function createHonoServer(mastra, options = {}) {
5257
5254
  503: { description: "SSE connection not established with this server, or server unable to process message." }
5258
5255
  }
5259
5256
  }),
5260
- handleMcpServerSseRoutes
5257
+ getMcpServerSseHandler
5261
5258
  );
5262
5259
  app.get(
5263
5260
  "/api/memory/status",
@@ -5354,6 +5351,13 @@ async function createHonoServer(mastra, options = {}) {
5354
5351
  in: "query",
5355
5352
  required: true,
5356
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)"
5357
5361
  }
5358
5362
  ],
5359
5363
  responses: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/deployer",
3
- "version": "0.3.4-alpha.2",
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.2",
111
- "@mastra/server": "^2.0.4-alpha.2"
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
- "@internal/lint": "0.0.4",
131
- "@mastra/mcp": "^0.5.0-alpha.2"
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",