@mastra/deployer 0.21.2-alpha.0 → 0.22.0

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/build/analyze/bundleExternals.d.ts.map +1 -1
  3. package/dist/build/analyze.cjs +2 -2
  4. package/dist/build/analyze.js +1 -1
  5. package/dist/build/bundler.cjs +3 -3
  6. package/dist/build/bundler.js +1 -1
  7. package/dist/build/index.cjs +12 -12
  8. package/dist/build/index.js +4 -4
  9. package/dist/bundler/index.cjs +2 -2
  10. package/dist/bundler/index.js +1 -1
  11. package/dist/{chunk-CEXVMFUD.js → chunk-BJHDR4SR.js} +5 -3
  12. package/dist/{chunk-CEXVMFUD.js.map → chunk-BJHDR4SR.js.map} +1 -1
  13. package/dist/{chunk-WIQEFIRX.cjs → chunk-CA6AZTUU.cjs} +5 -5
  14. package/dist/{chunk-WIQEFIRX.cjs.map → chunk-CA6AZTUU.cjs.map} +1 -1
  15. package/dist/{chunk-465ZVXAK.js → chunk-DVNT3PD3.js} +5 -5
  16. package/dist/{chunk-465ZVXAK.js.map → chunk-DVNT3PD3.js.map} +1 -1
  17. package/dist/{chunk-LGC3GUMR.cjs → chunk-EQZIOQE6.cjs} +15 -15
  18. package/dist/{chunk-LGC3GUMR.cjs.map → chunk-EQZIOQE6.cjs.map} +1 -1
  19. package/dist/{chunk-WAWEQ3DP.js → chunk-FUCT2436.js} +3 -3
  20. package/dist/{chunk-WAWEQ3DP.js.map → chunk-FUCT2436.js.map} +1 -1
  21. package/dist/{chunk-HMMDNIEQ.cjs → chunk-HLER5GBH.cjs} +9 -9
  22. package/dist/{chunk-HMMDNIEQ.cjs.map → chunk-HLER5GBH.cjs.map} +1 -1
  23. package/dist/{chunk-CKUCDCGI.js → chunk-PADCXECT.js} +4 -4
  24. package/dist/{chunk-CKUCDCGI.js.map → chunk-PADCXECT.js.map} +1 -1
  25. package/dist/{chunk-MCDDO4WY.cjs → chunk-VBZ7BDBX.cjs} +5 -3
  26. package/dist/{chunk-MCDDO4WY.cjs.map → chunk-VBZ7BDBX.cjs.map} +1 -1
  27. package/dist/{chunk-SBTEIZ3B.js → chunk-W6I7EZT3.js} +3 -3
  28. package/dist/{chunk-SBTEIZ3B.js.map → chunk-W6I7EZT3.js.map} +1 -1
  29. package/dist/{chunk-OYO2MJED.cjs → chunk-WMR25CFY.cjs} +14 -14
  30. package/dist/{chunk-OYO2MJED.cjs.map → chunk-WMR25CFY.cjs.map} +1 -1
  31. package/dist/index.cjs +5 -5
  32. package/dist/index.js +2 -2
  33. package/dist/server/handlers/a2a.d.ts +1 -1
  34. package/dist/server/handlers/routes/agents/handlers.d.ts +4 -4
  35. package/dist/server/handlers/routes/scores/handlers.d.ts +111 -111
  36. package/dist/server/handlers/routes/workflows/handlers.d.ts +2 -0
  37. package/dist/server/handlers/routes/workflows/handlers.d.ts.map +1 -1
  38. package/dist/server/handlers/routes/workflows/router.d.ts.map +1 -1
  39. package/dist/server/index.cjs +122 -30
  40. package/dist/server/index.cjs.map +1 -1
  41. package/dist/server/index.js +123 -31
  42. package/dist/server/index.js.map +1 -1
  43. package/package.json +7 -7
@@ -854,7 +854,7 @@ var middleware = (options) => async (c2) => {
854
854
  );
855
855
  };
856
856
 
857
- // ../../node_modules/.pnpm/hono-openapi@0.4.8_hono@4.9.7_openapi-types@12.1.3_zod@3.25.76/node_modules/hono-openapi/utils.js
857
+ // ../../node_modules/.pnpm/hono-openapi@0.4.8_hono@4.10.1_openapi-types@12.1.3_zod@3.25.76/node_modules/hono-openapi/utils.js
858
858
  var e = Symbol("openapi");
859
859
  var n = ["GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE"];
860
860
  var s2 = (e2) => e2.charAt(0).toUpperCase() + e2.slice(1);
@@ -1333,7 +1333,7 @@ function errorHandler(err, c2, isDev) {
1333
1333
  }
1334
1334
  return c2.json({ error: err.message }, err.status);
1335
1335
  }
1336
- console.error(err);
1336
+ c2.get("mastra").getLogger().error(err);
1337
1337
  return c2.json({ error: "Internal Server Error" }, 500);
1338
1338
  }
1339
1339
 
@@ -10010,28 +10010,29 @@ function watchWorkflowHandler(c2) {
10010
10010
  return handleError(error, "Error watching workflow");
10011
10011
  }
10012
10012
  }
10013
- async function streamWorkflowHandler(c2) {
10013
+ async function streamVNextWorkflowHandler(c2) {
10014
10014
  try {
10015
10015
  const mastra = c2.get("mastra");
10016
10016
  const runtimeContext = c2.get("runtimeContext");
10017
10017
  const logger2 = mastra.getLogger();
10018
10018
  const workflowId = c2.req.param("workflowId");
10019
- const { inputData, tracingOptions } = await c2.req.json();
10019
+ const { inputData, closeOnSuspend, tracingOptions } = await c2.req.json();
10020
10020
  const runId = c2.req.query("runId");
10021
10021
  c2.header("Transfer-Encoding", "chunked");
10022
10022
  return streaming.stream(
10023
10023
  c2,
10024
10024
  async (stream6) => {
10025
10025
  try {
10026
- const result = await workflows.streamWorkflowHandler({
10026
+ const result = await workflows.streamVNextWorkflowHandler({
10027
10027
  mastra,
10028
10028
  workflowId,
10029
10029
  runId,
10030
10030
  inputData,
10031
10031
  runtimeContext,
10032
+ closeOnSuspend,
10032
10033
  tracingOptions
10033
10034
  });
10034
- const reader = result.stream.getReader();
10035
+ const reader = result.getReader();
10035
10036
  stream6.onAbort(() => {
10036
10037
  void reader.cancel("request aborted");
10037
10038
  });
@@ -10042,7 +10043,6 @@ async function streamWorkflowHandler(c2) {
10042
10043
  } catch (err) {
10043
10044
  logger2.error("Error in workflow stream: " + (err?.message ?? "Unknown error"));
10044
10045
  }
10045
- await stream6.close();
10046
10046
  },
10047
10047
  async (err) => {
10048
10048
  logger2.error("Error in workflow stream: " + err?.message);
@@ -10052,21 +10052,18 @@ async function streamWorkflowHandler(c2) {
10052
10052
  return handleError(error, "Error streaming workflow");
10053
10053
  }
10054
10054
  }
10055
- async function observeStreamWorkflowHandler(c2) {
10055
+ async function observeStreamVNextWorkflowHandler(c2) {
10056
10056
  try {
10057
10057
  const mastra = c2.get("mastra");
10058
10058
  const logger2 = mastra.getLogger();
10059
10059
  const workflowId = c2.req.param("workflowId");
10060
10060
  const runId = c2.req.query("runId");
10061
- if (!runId) {
10062
- throw new httpException.HTTPException(400, { message: "runId required to observe workflow stream" });
10063
- }
10064
10061
  c2.header("Transfer-Encoding", "chunked");
10065
10062
  return streaming.stream(
10066
10063
  c2,
10067
10064
  async (stream6) => {
10068
10065
  try {
10069
- const result = await workflows.observeStreamWorkflowHandler({
10066
+ const result = await workflows.observeStreamVNextWorkflowHandler({
10070
10067
  mastra,
10071
10068
  workflowId,
10072
10069
  runId
@@ -10082,7 +10079,6 @@ async function observeStreamWorkflowHandler(c2) {
10082
10079
  } catch (err) {
10083
10080
  logger2.error("Error in workflow observe stream: " + (err?.message ?? "Unknown error"));
10084
10081
  }
10085
- await stream6.close();
10086
10082
  },
10087
10083
  async (err) => {
10088
10084
  logger2.error("Error in workflow observe stream: " + err?.message);
@@ -10092,29 +10088,28 @@ async function observeStreamWorkflowHandler(c2) {
10092
10088
  return handleError(error, "Error observing workflow stream");
10093
10089
  }
10094
10090
  }
10095
- async function streamVNextWorkflowHandler(c2) {
10091
+ async function streamLegacyWorkflowHandler(c2) {
10096
10092
  try {
10097
10093
  const mastra = c2.get("mastra");
10098
10094
  const runtimeContext = c2.get("runtimeContext");
10099
10095
  const logger2 = mastra.getLogger();
10100
10096
  const workflowId = c2.req.param("workflowId");
10101
- const { inputData, closeOnSuspend, tracingOptions } = await c2.req.json();
10097
+ const { inputData, tracingOptions } = await c2.req.json();
10102
10098
  const runId = c2.req.query("runId");
10103
10099
  c2.header("Transfer-Encoding", "chunked");
10104
10100
  return streaming.stream(
10105
10101
  c2,
10106
10102
  async (stream6) => {
10107
10103
  try {
10108
- const result = await workflows.streamVNextWorkflowHandler({
10104
+ const result = await workflows.streamLegacyWorkflowHandler({
10109
10105
  mastra,
10110
10106
  workflowId,
10111
10107
  runId,
10112
10108
  inputData,
10113
10109
  runtimeContext,
10114
- closeOnSuspend,
10115
10110
  tracingOptions
10116
10111
  });
10117
- const reader = result.getReader();
10112
+ const reader = result.stream.getReader();
10118
10113
  stream6.onAbort(() => {
10119
10114
  void reader.cancel("request aborted");
10120
10115
  });
@@ -10123,29 +10118,33 @@ async function streamVNextWorkflowHandler(c2) {
10123
10118
  await stream6.write(JSON.stringify(chunkResult.value) + "");
10124
10119
  }
10125
10120
  } catch (err) {
10126
- logger2.error("Error in workflow VNext stream: " + (err?.message ?? "Unknown error"));
10121
+ logger2.error("Error in workflow stream: " + (err?.message ?? "Unknown error"));
10127
10122
  }
10123
+ await stream6.close();
10128
10124
  },
10129
10125
  async (err) => {
10130
- logger2.error("Error in workflow VNext stream: " + err?.message);
10126
+ logger2.error("Error in workflow stream: " + err?.message);
10131
10127
  }
10132
10128
  );
10133
10129
  } catch (error) {
10134
10130
  return handleError(error, "Error streaming workflow");
10135
10131
  }
10136
10132
  }
10137
- async function observeStreamVNextWorkflowHandler(c2) {
10133
+ async function observeStreamLegacyWorkflowHandler(c2) {
10138
10134
  try {
10139
10135
  const mastra = c2.get("mastra");
10140
10136
  const logger2 = mastra.getLogger();
10141
10137
  const workflowId = c2.req.param("workflowId");
10142
10138
  const runId = c2.req.query("runId");
10139
+ if (!runId) {
10140
+ throw new httpException.HTTPException(400, { message: "runId required to observe workflow stream" });
10141
+ }
10143
10142
  c2.header("Transfer-Encoding", "chunked");
10144
10143
  return streaming.stream(
10145
10144
  c2,
10146
10145
  async (stream6) => {
10147
10146
  try {
10148
- const result = await workflows.observeStreamVNextWorkflowHandler({
10147
+ const result = await workflows.observeStreamLegacyWorkflowHandler({
10149
10148
  mastra,
10150
10149
  workflowId,
10151
10150
  runId
@@ -10159,15 +10158,16 @@ async function observeStreamVNextWorkflowHandler(c2) {
10159
10158
  await stream6.write(JSON.stringify(chunkResult.value) + "");
10160
10159
  }
10161
10160
  } catch (err) {
10162
- logger2.error("Error in workflow VNext observe stream: " + (err?.message ?? "Unknown error"));
10161
+ logger2.error("Error in workflow observe stream: " + (err?.message ?? "Unknown error"));
10163
10162
  }
10163
+ await stream6.close();
10164
10164
  },
10165
10165
  async (err) => {
10166
- logger2.error("Error in workflow VNext observe stream: " + err?.message);
10166
+ logger2.error("Error in workflow observe stream: " + err?.message);
10167
10167
  }
10168
10168
  );
10169
10169
  } catch (error) {
10170
- return handleError(error, "Error observing vNext workflow stream");
10170
+ return handleError(error, "Error observing workflow stream");
10171
10171
  }
10172
10172
  }
10173
10173
  async function resumeStreamWorkflowHandler(c2) {
@@ -11085,9 +11085,9 @@ function workflowsRouter(bodyLimitOptions) {
11085
11085
  resumeAsyncWorkflowHandler
11086
11086
  );
11087
11087
  router.post(
11088
- "/:workflowId/stream",
11088
+ "/:workflowId/stream-legacy",
11089
11089
  w({
11090
- description: "Stream workflow in real-time",
11090
+ description: "Stream legacy workflow in real-time",
11091
11091
  parameters: [
11092
11092
  {
11093
11093
  name: "workflowId",
@@ -11140,10 +11140,10 @@ function workflowsRouter(bodyLimitOptions) {
11140
11140
  },
11141
11141
  tags: ["workflows"]
11142
11142
  }),
11143
- streamWorkflowHandler
11143
+ streamLegacyWorkflowHandler
11144
11144
  );
11145
11145
  router.post(
11146
- "/:workflowId/observe-stream",
11146
+ "/:workflowId/observe-stream-legacy",
11147
11147
  w({
11148
11148
  description: "Observe workflow stream in real-time",
11149
11149
  parameters: [
@@ -11170,7 +11170,7 @@ function workflowsRouter(bodyLimitOptions) {
11170
11170
  },
11171
11171
  tags: ["workflows"]
11172
11172
  }),
11173
- observeStreamWorkflowHandler
11173
+ observeStreamLegacyWorkflowHandler
11174
11174
  );
11175
11175
  router.post(
11176
11176
  "/:workflowId/streamVNext",
@@ -11234,6 +11234,98 @@ function workflowsRouter(bodyLimitOptions) {
11234
11234
  }),
11235
11235
  streamVNextWorkflowHandler
11236
11236
  );
11237
+ router.post(
11238
+ "/:workflowId/observe",
11239
+ w({
11240
+ description: "Observe workflow stream in real-time using the streaming API",
11241
+ parameters: [
11242
+ {
11243
+ name: "workflowId",
11244
+ in: "path",
11245
+ required: true,
11246
+ schema: { type: "string" }
11247
+ },
11248
+ {
11249
+ name: "runId",
11250
+ in: "query",
11251
+ required: true,
11252
+ schema: { type: "string" }
11253
+ }
11254
+ ],
11255
+ responses: {
11256
+ 200: {
11257
+ description: "workflow stream observed"
11258
+ },
11259
+ 404: {
11260
+ description: "workflow not found"
11261
+ }
11262
+ },
11263
+ tags: ["workflows"]
11264
+ }),
11265
+ observeStreamVNextWorkflowHandler
11266
+ );
11267
+ router.post(
11268
+ "/:workflowId/stream",
11269
+ w({
11270
+ description: "Stream workflow in real-time using the streaming API",
11271
+ parameters: [
11272
+ {
11273
+ name: "workflowId",
11274
+ in: "path",
11275
+ required: true,
11276
+ schema: { type: "string" }
11277
+ },
11278
+ {
11279
+ name: "runId",
11280
+ in: "query",
11281
+ required: false,
11282
+ schema: { type: "string" }
11283
+ }
11284
+ ],
11285
+ requestBody: {
11286
+ required: true,
11287
+ content: {
11288
+ "application/json": {
11289
+ schema: {
11290
+ type: "object",
11291
+ properties: {
11292
+ inputData: { type: "object" },
11293
+ runtimeContext: {
11294
+ type: "object",
11295
+ description: "Runtime context for the workflow execution"
11296
+ },
11297
+ closeOnSuspend: {
11298
+ type: "boolean",
11299
+ description: "Close the stream on suspend"
11300
+ },
11301
+ tracingOptions: {
11302
+ type: "object",
11303
+ description: "Tracing options for the workflow execution",
11304
+ properties: {
11305
+ metadata: {
11306
+ type: "object",
11307
+ description: "Custom metadata to attach to the trace",
11308
+ additionalProperties: true
11309
+ }
11310
+ }
11311
+ }
11312
+ }
11313
+ }
11314
+ }
11315
+ }
11316
+ },
11317
+ responses: {
11318
+ 200: {
11319
+ description: "workflow run started"
11320
+ },
11321
+ 404: {
11322
+ description: "workflow not found"
11323
+ }
11324
+ },
11325
+ tags: ["workflows"]
11326
+ }),
11327
+ streamVNextWorkflowHandler
11328
+ );
11237
11329
  router.post(
11238
11330
  "/:workflowId/observe-streamVNext",
11239
11331
  w({