@mastra/deployer 0.14.0-alpha.2 → 0.14.0-alpha.4

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 (87) hide show
  1. package/dist/build/analyze.cjs +3 -3
  2. package/dist/build/analyze.d.ts.map +1 -1
  3. package/dist/build/analyze.js +1 -1
  4. package/dist/build/babel/remove-all-options-bundler.d.ts +2 -1
  5. package/dist/build/babel/remove-all-options-bundler.d.ts.map +1 -1
  6. package/dist/build/babel/remove-all-options-deployer.d.ts +5 -0
  7. package/dist/build/babel/remove-all-options-deployer.d.ts.map +1 -0
  8. package/dist/build/babel/remove-all-options-except.d.ts +2 -1
  9. package/dist/build/babel/remove-all-options-except.d.ts.map +1 -1
  10. package/dist/build/babel/remove-all-options-server.d.ts +2 -1
  11. package/dist/build/babel/remove-all-options-server.d.ts.map +1 -1
  12. package/dist/build/babel/remove-all-options-telemetry.d.ts +1 -1
  13. package/dist/build/babel/remove-all-options-telemetry.d.ts.map +1 -1
  14. package/dist/build/bundler.cjs +3 -3
  15. package/dist/build/bundler.d.ts.map +1 -1
  16. package/dist/build/bundler.js +1 -1
  17. package/dist/build/bundlerOptions.d.ts +3 -2
  18. package/dist/build/bundlerOptions.d.ts.map +1 -1
  19. package/dist/build/customInstrumentation.d.ts.map +1 -1
  20. package/dist/build/deployer.d.ts +4 -3
  21. package/dist/build/deployer.d.ts.map +1 -1
  22. package/dist/build/index.cjs +12 -12
  23. package/dist/build/index.js +4 -4
  24. package/dist/build/plugins/esbuild.d.ts +3 -0
  25. package/dist/build/plugins/esbuild.d.ts.map +1 -0
  26. package/dist/build/plugins/tsconfig-paths.d.ts.map +1 -1
  27. package/dist/build/serverOptions.d.ts +3 -2
  28. package/dist/build/serverOptions.d.ts.map +1 -1
  29. package/dist/build/shared/extract-mastra-option.d.ts +15 -0
  30. package/dist/build/shared/extract-mastra-option.d.ts.map +1 -0
  31. package/dist/build/telemetry.d.ts +3 -11
  32. package/dist/build/telemetry.d.ts.map +1 -1
  33. package/dist/bundler/index.cjs +2 -2
  34. package/dist/bundler/index.d.ts.map +1 -1
  35. package/dist/bundler/index.js +1 -1
  36. package/dist/{chunk-VZK2Z2KV.js → chunk-3ZVEABRA.js} +21 -100
  37. package/dist/chunk-3ZVEABRA.js.map +1 -0
  38. package/dist/{chunk-JSDQFNHH.js → chunk-4HS72TCL.js} +13 -24
  39. package/dist/chunk-4HS72TCL.js.map +1 -0
  40. package/dist/{chunk-J42QUFVB.cjs → chunk-FIOHFXQ4.cjs} +8 -14
  41. package/dist/chunk-FIOHFXQ4.cjs.map +1 -0
  42. package/dist/{chunk-F3EQZ6KY.cjs → chunk-G4TSJE4W.cjs} +48 -53
  43. package/dist/chunk-G4TSJE4W.cjs.map +1 -0
  44. package/dist/{chunk-W4GA27OK.js → chunk-GXPWEOOA.js} +44 -48
  45. package/dist/chunk-GXPWEOOA.js.map +1 -0
  46. package/dist/chunk-HHNOUMJH.js +26 -0
  47. package/dist/chunk-HHNOUMJH.js.map +1 -0
  48. package/dist/{chunk-VAE7BL7I.cjs → chunk-LG5W6D2R.cjs} +19 -10
  49. package/dist/chunk-LG5W6D2R.cjs.map +1 -0
  50. package/dist/{chunk-OOVC5E4J.js → chunk-NOI4CTSN.js} +18 -10
  51. package/dist/chunk-NOI4CTSN.js.map +1 -0
  52. package/dist/{chunk-N66CXJKO.js → chunk-SBEJU32H.js} +4 -9
  53. package/dist/chunk-SBEJU32H.js.map +1 -0
  54. package/dist/chunk-UD4WRJI3.cjs +28 -0
  55. package/dist/chunk-UD4WRJI3.cjs.map +1 -0
  56. package/dist/{chunk-2QJ6ZW3U.cjs → chunk-UYBVYWPG.cjs} +24 -124
  57. package/dist/chunk-UYBVYWPG.cjs.map +1 -0
  58. package/dist/{chunk-UUOQ3FAM.cjs → chunk-V7XDPQFQ.cjs} +19 -31
  59. package/dist/chunk-V7XDPQFQ.cjs.map +1 -0
  60. package/dist/index.cjs +20 -154
  61. package/dist/index.cjs.map +1 -1
  62. package/dist/index.js +19 -129
  63. package/dist/index.js.map +1 -1
  64. package/dist/server/handlers/routes/agents/handlers.d.ts +12 -1
  65. package/dist/server/handlers/routes/agents/handlers.d.ts.map +1 -1
  66. package/dist/server/handlers/routes/agents/router.d.ts.map +1 -1
  67. package/dist/server/handlers/routes/scores/handlers.d.ts +52 -2
  68. package/dist/server/handlers/routes/scores/handlers.d.ts.map +1 -1
  69. package/dist/server/index.cjs +228 -5
  70. package/dist/server/index.cjs.map +1 -1
  71. package/dist/server/index.js +229 -6
  72. package/dist/server/index.js.map +1 -1
  73. package/package.json +5 -5
  74. package/dist/chunk-2QJ6ZW3U.cjs.map +0 -1
  75. package/dist/chunk-F3EQZ6KY.cjs.map +0 -1
  76. package/dist/chunk-J42QUFVB.cjs.map +0 -1
  77. package/dist/chunk-JSDQFNHH.js.map +0 -1
  78. package/dist/chunk-LX5TJLI5.js +0 -107
  79. package/dist/chunk-LX5TJLI5.js.map +0 -1
  80. package/dist/chunk-N66CXJKO.js.map +0 -1
  81. package/dist/chunk-OOVC5E4J.js.map +0 -1
  82. package/dist/chunk-UUOQ3FAM.cjs.map +0 -1
  83. package/dist/chunk-VAE7BL7I.cjs.map +0 -1
  84. package/dist/chunk-VZK2Z2KV.js.map +0 -1
  85. package/dist/chunk-W4GA27OK.js.map +0 -1
  86. package/dist/chunk-YKO2TTMS.cjs +0 -133
  87. package/dist/chunk-YKO2TTMS.cjs.map +0 -1
@@ -1251,6 +1251,56 @@ var AllowedProviderKeys = {
1251
1251
  };
1252
1252
 
1253
1253
  // src/server/handlers/routes/agents/handlers.ts
1254
+ var vNextBodyOptions = {
1255
+ messages: {
1256
+ type: "array",
1257
+ items: { type: "object" }
1258
+ },
1259
+ threadId: { type: "string" },
1260
+ resourceId: { type: "string", description: "The resource ID for the conversation" },
1261
+ runId: { type: "string" },
1262
+ output: { type: "object" },
1263
+ instructions: { type: "string", description: "Optional instructions to override the agent's default instructions" },
1264
+ context: {
1265
+ type: "array",
1266
+ items: { type: "object" },
1267
+ description: "Additional context messages to include"
1268
+ },
1269
+ memory: {
1270
+ type: "object",
1271
+ properties: {
1272
+ threadId: { type: "string" },
1273
+ resourceId: { type: "string", description: "The resource ID for the conversation" },
1274
+ options: { type: "object", description: "Memory configuration options" }
1275
+ },
1276
+ description: "Memory options for the conversation"
1277
+ },
1278
+ savePerStep: { type: "boolean", description: "Whether to save messages incrementally on step finish" },
1279
+ format: { type: "string", enum: ["mastra", "aisdk"], description: "Response format" },
1280
+ toolChoice: {
1281
+ oneOf: [
1282
+ { type: "string", enum: ["auto", "none", "required"] },
1283
+ { type: "object", properties: { type: { type: "string" }, toolName: { type: "string" } } }
1284
+ ],
1285
+ description: "Controls how tools are selected during generation"
1286
+ },
1287
+ modelSettings: {
1288
+ type: "object",
1289
+ properties: {
1290
+ maxTokens: { type: "number", description: "Maximum number of tokens to generate" },
1291
+ temperature: { type: "number", minimum: 0, maximum: 1, description: "Temperature setting for randomness (0-1)" },
1292
+ topP: { type: "number", minimum: 0, maximum: 1, description: "Nucleus sampling (0-1)" },
1293
+ topK: { type: "number", description: "Only sample from the top K options for each subsequent token" },
1294
+ presencePenalty: { type: "number", minimum: -1, maximum: 1, description: "Presence penalty (-1 to 1)" },
1295
+ frequencyPenalty: { type: "number", minimum: -1, maximum: 1, description: "Frequency penalty (-1 to 1)" },
1296
+ stopSequences: { type: "array", items: { type: "string" }, description: "Stop sequences for text generation" },
1297
+ seed: { type: "number", description: "Seed for deterministic results" },
1298
+ maxRetries: { type: "number", description: "Maximum number of retries" },
1299
+ headers: { type: "object", description: "Additional HTTP headers" }
1300
+ },
1301
+ description: "Model settings for generation"
1302
+ }
1303
+ };
1254
1304
  async function getAgentsHandler(c2) {
1255
1305
  const serializedAgents = await agents.getAgentsHandler({
1256
1306
  mastra: c2.get("mastra"),
@@ -1311,6 +1361,24 @@ async function generateHandler(c2) {
1311
1361
  return handleError(error, "Error generating from agent");
1312
1362
  }
1313
1363
  }
1364
+ async function generateVNextHandler(c2) {
1365
+ try {
1366
+ const mastra = c2.get("mastra");
1367
+ const agentId = c2.req.param("agentId");
1368
+ const runtimeContext = c2.get("runtimeContext");
1369
+ const body = await c2.req.json();
1370
+ const result = await agents.generateVNextHandler({
1371
+ mastra,
1372
+ agentId,
1373
+ runtimeContext,
1374
+ body,
1375
+ abortSignal: c2.req.raw.signal
1376
+ });
1377
+ return c2.json(result);
1378
+ } catch (error) {
1379
+ return handleError(error, "Error generating vnext from agent");
1380
+ }
1381
+ }
1314
1382
  async function streamGenerateHandler(c2) {
1315
1383
  try {
1316
1384
  const mastra = c2.get("mastra");
@@ -1341,21 +1409,24 @@ async function streamVNextGenerateHandler(c2) {
1341
1409
  c2,
1342
1410
  async (stream6) => {
1343
1411
  try {
1344
- const result = agents.streamVNextGenerateHandler({
1412
+ const streamResponse = await agents.streamVNextGenerateHandler({
1345
1413
  mastra,
1346
1414
  agentId,
1347
1415
  runtimeContext,
1348
1416
  body,
1349
1417
  abortSignal: c2.req.raw.signal
1350
1418
  });
1351
- const reader = result.getReader();
1419
+ const reader = streamResponse.fullStream.getReader();
1352
1420
  stream6.onAbort(() => {
1353
1421
  void reader.cancel("request aborted");
1354
1422
  });
1355
1423
  let chunkResult;
1356
1424
  while ((chunkResult = await reader.read()) && !chunkResult.done) {
1357
- await stream6.write(JSON.stringify(chunkResult.value) + "");
1425
+ await stream6.write(`data: ${JSON.stringify(chunkResult.value)}
1426
+
1427
+ `);
1358
1428
  }
1429
+ await stream6.write("data: [DONE]\n\n");
1359
1430
  } catch (err) {
1360
1431
  logger2.error("Error in streamVNext generate: " + (err?.message ?? "Unknown error"));
1361
1432
  }
@@ -1369,6 +1440,24 @@ async function streamVNextGenerateHandler(c2) {
1369
1440
  return handleError(error, "Error streaming from agent");
1370
1441
  }
1371
1442
  }
1443
+ async function streamVNextUIMessageHandler(c2) {
1444
+ try {
1445
+ const mastra = c2.get("mastra");
1446
+ const agentId = c2.req.param("agentId");
1447
+ const runtimeContext = c2.get("runtimeContext");
1448
+ const body = await c2.req.json();
1449
+ const streamResponse = await agents.streamVNextUIMessageHandler({
1450
+ mastra,
1451
+ agentId,
1452
+ runtimeContext,
1453
+ body,
1454
+ abortSignal: c2.req.raw.signal
1455
+ });
1456
+ return streamResponse;
1457
+ } catch (error) {
1458
+ return handleError(error, "Error streaming ui message from agent");
1459
+ }
1460
+ }
1372
1461
  async function setAgentInstructionsHandler(c2) {
1373
1462
  try {
1374
1463
  const isPlayground = c2.get("playground") === true;
@@ -1411,6 +1500,18 @@ async function updateAgentModelHandler(c2) {
1411
1500
  return handleError(error, "Error updating agent model");
1412
1501
  }
1413
1502
  }
1503
+ async function deprecatedStreamVNextHandler(c2) {
1504
+ return c2.json(
1505
+ {
1506
+ error: "This endpoint is deprecated",
1507
+ message: "The /streamVNext endpoint has been deprecated. Please use an alternative streaming endpoint.",
1508
+ deprecated_endpoint: "/api/agents/:agentId/streamVNext",
1509
+ replacement_endpoint: "/api/agents/:agentId/stream/vnext"
1510
+ },
1511
+ 410
1512
+ // 410 Gone status code for deprecated endpoints
1513
+ );
1514
+ }
1414
1515
  async function getModelProvidersHandler(c2) {
1415
1516
  const isPlayground = c2.get("playground") === true;
1416
1517
  if (!isPlayground) {
@@ -1802,6 +1903,80 @@ function agentsRouter(bodyLimitOptions) {
1802
1903
  }),
1803
1904
  generateHandler
1804
1905
  );
1906
+ router.post(
1907
+ "/:agentId/generate/vnext",
1908
+ bodyLimit.bodyLimit(bodyLimitOptions),
1909
+ w({
1910
+ description: "Generate a response from an agent",
1911
+ tags: ["agents"],
1912
+ parameters: [
1913
+ {
1914
+ name: "agentId",
1915
+ in: "path",
1916
+ required: true,
1917
+ schema: { type: "string" }
1918
+ }
1919
+ ],
1920
+ requestBody: {
1921
+ required: true,
1922
+ content: {
1923
+ "application/json": {
1924
+ schema: {
1925
+ type: "object",
1926
+ properties: vNextBodyOptions,
1927
+ required: ["messages"]
1928
+ }
1929
+ }
1930
+ }
1931
+ },
1932
+ responses: {
1933
+ 200: {
1934
+ description: "Generated response"
1935
+ },
1936
+ 404: {
1937
+ description: "Agent not found"
1938
+ }
1939
+ }
1940
+ }),
1941
+ generateVNextHandler
1942
+ );
1943
+ router.post(
1944
+ "/:agentId/stream/vnext",
1945
+ bodyLimit.bodyLimit(bodyLimitOptions),
1946
+ w({
1947
+ description: "Generate a response from an agent",
1948
+ tags: ["agents"],
1949
+ parameters: [
1950
+ {
1951
+ name: "agentId",
1952
+ in: "path",
1953
+ required: true,
1954
+ schema: { type: "string" }
1955
+ }
1956
+ ],
1957
+ requestBody: {
1958
+ required: true,
1959
+ content: {
1960
+ "application/json": {
1961
+ schema: {
1962
+ type: "object",
1963
+ properties: vNextBodyOptions,
1964
+ required: ["messages"]
1965
+ }
1966
+ }
1967
+ }
1968
+ },
1969
+ responses: {
1970
+ 200: {
1971
+ description: "Generated response"
1972
+ },
1973
+ 404: {
1974
+ description: "Agent not found"
1975
+ }
1976
+ }
1977
+ }),
1978
+ streamVNextGenerateHandler
1979
+ );
1805
1980
  router.post(
1806
1981
  "/:agentId/stream",
1807
1982
  bodyLimit.bodyLimit(bodyLimitOptions),
@@ -1857,8 +2032,9 @@ function agentsRouter(bodyLimitOptions) {
1857
2032
  "/:agentId/streamVNext",
1858
2033
  bodyLimit.bodyLimit(bodyLimitOptions),
1859
2034
  w({
1860
- description: "Stream a response from an agent using the VNext streaming API",
2035
+ description: "[DEPRECATED] This endpoint is deprecated. Please use /stream instead.",
1861
2036
  tags: ["agents"],
2037
+ deprecated: true,
1862
2038
  parameters: [
1863
2039
  {
1864
2040
  name: "agentId",
@@ -1907,6 +2083,53 @@ function agentsRouter(bodyLimitOptions) {
1907
2083
  }
1908
2084
  }
1909
2085
  },
2086
+ responses: {
2087
+ 410: {
2088
+ description: "Endpoint deprecated",
2089
+ content: {
2090
+ "application/json": {
2091
+ schema: {
2092
+ type: "object",
2093
+ properties: {
2094
+ error: { type: "string" },
2095
+ message: { type: "string" },
2096
+ deprecated_endpoint: { type: "string" },
2097
+ replacement_endpoint: { type: "string" }
2098
+ }
2099
+ }
2100
+ }
2101
+ }
2102
+ }
2103
+ }
2104
+ }),
2105
+ deprecatedStreamVNextHandler
2106
+ );
2107
+ router.post(
2108
+ "/:agentId/stream/vnext/ui",
2109
+ bodyLimit.bodyLimit(bodyLimitOptions),
2110
+ w({
2111
+ description: "Stream a response from an agent",
2112
+ tags: ["agents"],
2113
+ parameters: [
2114
+ {
2115
+ name: "agentId",
2116
+ in: "path",
2117
+ required: true,
2118
+ schema: { type: "string" }
2119
+ }
2120
+ ],
2121
+ requestBody: {
2122
+ required: true,
2123
+ content: {
2124
+ "application/json": {
2125
+ schema: {
2126
+ type: "object",
2127
+ properties: vNextBodyOptions,
2128
+ required: ["messages"]
2129
+ }
2130
+ }
2131
+ }
2132
+ },
1910
2133
  responses: {
1911
2134
  200: {
1912
2135
  description: "Streamed response"
@@ -1916,7 +2139,7 @@ function agentsRouter(bodyLimitOptions) {
1916
2139
  }
1917
2140
  }
1918
2141
  }),
1919
- streamVNextGenerateHandler
2142
+ streamVNextUIMessageHandler
1920
2143
  );
1921
2144
  router.post(
1922
2145
  "/:agentId/model",