@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
@@ -19,7 +19,7 @@ import { timeout } from 'hono/timeout';
19
19
  import { HTTPException } from 'hono/http-exception';
20
20
  import { getAgentCardByIdHandler as getAgentCardByIdHandler$1, getAgentExecutionHandler as getAgentExecutionHandler$1 } from '@mastra/server/handlers/a2a';
21
21
  import { stream } from 'hono/streaming';
22
- import { getAgentsHandler as getAgentsHandler$1, getAgentByIdHandler as getAgentByIdHandler$1, getEvalsByAgentIdHandler as getEvalsByAgentIdHandler$1, getLiveEvalsByAgentIdHandler as getLiveEvalsByAgentIdHandler$1, generateHandler as generateHandler$1, streamGenerateHandler as streamGenerateHandler$1, streamVNextGenerateHandler as streamVNextGenerateHandler$1, updateAgentModelHandler as updateAgentModelHandler$1 } from '@mastra/server/handlers/agents';
22
+ import { getAgentsHandler as getAgentsHandler$1, getAgentByIdHandler as getAgentByIdHandler$1, getEvalsByAgentIdHandler as getEvalsByAgentIdHandler$1, getLiveEvalsByAgentIdHandler as getLiveEvalsByAgentIdHandler$1, generateHandler as generateHandler$1, generateVNextHandler as generateVNextHandler$1, streamVNextGenerateHandler as streamVNextGenerateHandler$1, streamGenerateHandler as streamGenerateHandler$1, streamVNextUIMessageHandler as streamVNextUIMessageHandler$1, updateAgentModelHandler as updateAgentModelHandler$1 } from '@mastra/server/handlers/agents';
23
23
  import { bodyLimit } from 'hono/body-limit';
24
24
  import { Agent } from '@mastra/core/agent';
25
25
  import { z } from 'zod';
@@ -1244,6 +1244,56 @@ var AllowedProviderKeys = {
1244
1244
  };
1245
1245
 
1246
1246
  // src/server/handlers/routes/agents/handlers.ts
1247
+ var vNextBodyOptions = {
1248
+ messages: {
1249
+ type: "array",
1250
+ items: { type: "object" }
1251
+ },
1252
+ threadId: { type: "string" },
1253
+ resourceId: { type: "string", description: "The resource ID for the conversation" },
1254
+ runId: { type: "string" },
1255
+ output: { type: "object" },
1256
+ instructions: { type: "string", description: "Optional instructions to override the agent's default instructions" },
1257
+ context: {
1258
+ type: "array",
1259
+ items: { type: "object" },
1260
+ description: "Additional context messages to include"
1261
+ },
1262
+ memory: {
1263
+ type: "object",
1264
+ properties: {
1265
+ threadId: { type: "string" },
1266
+ resourceId: { type: "string", description: "The resource ID for the conversation" },
1267
+ options: { type: "object", description: "Memory configuration options" }
1268
+ },
1269
+ description: "Memory options for the conversation"
1270
+ },
1271
+ savePerStep: { type: "boolean", description: "Whether to save messages incrementally on step finish" },
1272
+ format: { type: "string", enum: ["mastra", "aisdk"], description: "Response format" },
1273
+ toolChoice: {
1274
+ oneOf: [
1275
+ { type: "string", enum: ["auto", "none", "required"] },
1276
+ { type: "object", properties: { type: { type: "string" }, toolName: { type: "string" } } }
1277
+ ],
1278
+ description: "Controls how tools are selected during generation"
1279
+ },
1280
+ modelSettings: {
1281
+ type: "object",
1282
+ properties: {
1283
+ maxTokens: { type: "number", description: "Maximum number of tokens to generate" },
1284
+ temperature: { type: "number", minimum: 0, maximum: 1, description: "Temperature setting for randomness (0-1)" },
1285
+ topP: { type: "number", minimum: 0, maximum: 1, description: "Nucleus sampling (0-1)" },
1286
+ topK: { type: "number", description: "Only sample from the top K options for each subsequent token" },
1287
+ presencePenalty: { type: "number", minimum: -1, maximum: 1, description: "Presence penalty (-1 to 1)" },
1288
+ frequencyPenalty: { type: "number", minimum: -1, maximum: 1, description: "Frequency penalty (-1 to 1)" },
1289
+ stopSequences: { type: "array", items: { type: "string" }, description: "Stop sequences for text generation" },
1290
+ seed: { type: "number", description: "Seed for deterministic results" },
1291
+ maxRetries: { type: "number", description: "Maximum number of retries" },
1292
+ headers: { type: "object", description: "Additional HTTP headers" }
1293
+ },
1294
+ description: "Model settings for generation"
1295
+ }
1296
+ };
1247
1297
  async function getAgentsHandler(c2) {
1248
1298
  const serializedAgents = await getAgentsHandler$1({
1249
1299
  mastra: c2.get("mastra"),
@@ -1304,6 +1354,24 @@ async function generateHandler(c2) {
1304
1354
  return handleError(error, "Error generating from agent");
1305
1355
  }
1306
1356
  }
1357
+ async function generateVNextHandler(c2) {
1358
+ try {
1359
+ const mastra = c2.get("mastra");
1360
+ const agentId = c2.req.param("agentId");
1361
+ const runtimeContext = c2.get("runtimeContext");
1362
+ const body = await c2.req.json();
1363
+ const result = await generateVNextHandler$1({
1364
+ mastra,
1365
+ agentId,
1366
+ runtimeContext,
1367
+ body,
1368
+ abortSignal: c2.req.raw.signal
1369
+ });
1370
+ return c2.json(result);
1371
+ } catch (error) {
1372
+ return handleError(error, "Error generating vnext from agent");
1373
+ }
1374
+ }
1307
1375
  async function streamGenerateHandler(c2) {
1308
1376
  try {
1309
1377
  const mastra = c2.get("mastra");
@@ -1334,21 +1402,24 @@ async function streamVNextGenerateHandler(c2) {
1334
1402
  c2,
1335
1403
  async (stream6) => {
1336
1404
  try {
1337
- const result = streamVNextGenerateHandler$1({
1405
+ const streamResponse = await streamVNextGenerateHandler$1({
1338
1406
  mastra,
1339
1407
  agentId,
1340
1408
  runtimeContext,
1341
1409
  body,
1342
1410
  abortSignal: c2.req.raw.signal
1343
1411
  });
1344
- const reader = result.getReader();
1412
+ const reader = streamResponse.fullStream.getReader();
1345
1413
  stream6.onAbort(() => {
1346
1414
  void reader.cancel("request aborted");
1347
1415
  });
1348
1416
  let chunkResult;
1349
1417
  while ((chunkResult = await reader.read()) && !chunkResult.done) {
1350
- await stream6.write(JSON.stringify(chunkResult.value) + "");
1418
+ await stream6.write(`data: ${JSON.stringify(chunkResult.value)}
1419
+
1420
+ `);
1351
1421
  }
1422
+ await stream6.write("data: [DONE]\n\n");
1352
1423
  } catch (err) {
1353
1424
  logger2.error("Error in streamVNext generate: " + (err?.message ?? "Unknown error"));
1354
1425
  }
@@ -1362,6 +1433,24 @@ async function streamVNextGenerateHandler(c2) {
1362
1433
  return handleError(error, "Error streaming from agent");
1363
1434
  }
1364
1435
  }
1436
+ async function streamVNextUIMessageHandler(c2) {
1437
+ try {
1438
+ const mastra = c2.get("mastra");
1439
+ const agentId = c2.req.param("agentId");
1440
+ const runtimeContext = c2.get("runtimeContext");
1441
+ const body = await c2.req.json();
1442
+ const streamResponse = await streamVNextUIMessageHandler$1({
1443
+ mastra,
1444
+ agentId,
1445
+ runtimeContext,
1446
+ body,
1447
+ abortSignal: c2.req.raw.signal
1448
+ });
1449
+ return streamResponse;
1450
+ } catch (error) {
1451
+ return handleError(error, "Error streaming ui message from agent");
1452
+ }
1453
+ }
1365
1454
  async function setAgentInstructionsHandler(c2) {
1366
1455
  try {
1367
1456
  const isPlayground = c2.get("playground") === true;
@@ -1404,6 +1493,18 @@ async function updateAgentModelHandler(c2) {
1404
1493
  return handleError(error, "Error updating agent model");
1405
1494
  }
1406
1495
  }
1496
+ async function deprecatedStreamVNextHandler(c2) {
1497
+ return c2.json(
1498
+ {
1499
+ error: "This endpoint is deprecated",
1500
+ message: "The /streamVNext endpoint has been deprecated. Please use an alternative streaming endpoint.",
1501
+ deprecated_endpoint: "/api/agents/:agentId/streamVNext",
1502
+ replacement_endpoint: "/api/agents/:agentId/stream/vnext"
1503
+ },
1504
+ 410
1505
+ // 410 Gone status code for deprecated endpoints
1506
+ );
1507
+ }
1407
1508
  async function getModelProvidersHandler(c2) {
1408
1509
  const isPlayground = c2.get("playground") === true;
1409
1510
  if (!isPlayground) {
@@ -1795,6 +1896,80 @@ function agentsRouter(bodyLimitOptions) {
1795
1896
  }),
1796
1897
  generateHandler
1797
1898
  );
1899
+ router.post(
1900
+ "/:agentId/generate/vnext",
1901
+ bodyLimit(bodyLimitOptions),
1902
+ w({
1903
+ description: "Generate a response from an agent",
1904
+ tags: ["agents"],
1905
+ parameters: [
1906
+ {
1907
+ name: "agentId",
1908
+ in: "path",
1909
+ required: true,
1910
+ schema: { type: "string" }
1911
+ }
1912
+ ],
1913
+ requestBody: {
1914
+ required: true,
1915
+ content: {
1916
+ "application/json": {
1917
+ schema: {
1918
+ type: "object",
1919
+ properties: vNextBodyOptions,
1920
+ required: ["messages"]
1921
+ }
1922
+ }
1923
+ }
1924
+ },
1925
+ responses: {
1926
+ 200: {
1927
+ description: "Generated response"
1928
+ },
1929
+ 404: {
1930
+ description: "Agent not found"
1931
+ }
1932
+ }
1933
+ }),
1934
+ generateVNextHandler
1935
+ );
1936
+ router.post(
1937
+ "/:agentId/stream/vnext",
1938
+ bodyLimit(bodyLimitOptions),
1939
+ w({
1940
+ description: "Generate a response from an agent",
1941
+ tags: ["agents"],
1942
+ parameters: [
1943
+ {
1944
+ name: "agentId",
1945
+ in: "path",
1946
+ required: true,
1947
+ schema: { type: "string" }
1948
+ }
1949
+ ],
1950
+ requestBody: {
1951
+ required: true,
1952
+ content: {
1953
+ "application/json": {
1954
+ schema: {
1955
+ type: "object",
1956
+ properties: vNextBodyOptions,
1957
+ required: ["messages"]
1958
+ }
1959
+ }
1960
+ }
1961
+ },
1962
+ responses: {
1963
+ 200: {
1964
+ description: "Generated response"
1965
+ },
1966
+ 404: {
1967
+ description: "Agent not found"
1968
+ }
1969
+ }
1970
+ }),
1971
+ streamVNextGenerateHandler
1972
+ );
1798
1973
  router.post(
1799
1974
  "/:agentId/stream",
1800
1975
  bodyLimit(bodyLimitOptions),
@@ -1850,8 +2025,9 @@ function agentsRouter(bodyLimitOptions) {
1850
2025
  "/:agentId/streamVNext",
1851
2026
  bodyLimit(bodyLimitOptions),
1852
2027
  w({
1853
- description: "Stream a response from an agent using the VNext streaming API",
2028
+ description: "[DEPRECATED] This endpoint is deprecated. Please use /stream instead.",
1854
2029
  tags: ["agents"],
2030
+ deprecated: true,
1855
2031
  parameters: [
1856
2032
  {
1857
2033
  name: "agentId",
@@ -1900,6 +2076,53 @@ function agentsRouter(bodyLimitOptions) {
1900
2076
  }
1901
2077
  }
1902
2078
  },
2079
+ responses: {
2080
+ 410: {
2081
+ description: "Endpoint deprecated",
2082
+ content: {
2083
+ "application/json": {
2084
+ schema: {
2085
+ type: "object",
2086
+ properties: {
2087
+ error: { type: "string" },
2088
+ message: { type: "string" },
2089
+ deprecated_endpoint: { type: "string" },
2090
+ replacement_endpoint: { type: "string" }
2091
+ }
2092
+ }
2093
+ }
2094
+ }
2095
+ }
2096
+ }
2097
+ }),
2098
+ deprecatedStreamVNextHandler
2099
+ );
2100
+ router.post(
2101
+ "/:agentId/stream/vnext/ui",
2102
+ bodyLimit(bodyLimitOptions),
2103
+ w({
2104
+ description: "Stream a response from an agent",
2105
+ tags: ["agents"],
2106
+ parameters: [
2107
+ {
2108
+ name: "agentId",
2109
+ in: "path",
2110
+ required: true,
2111
+ schema: { type: "string" }
2112
+ }
2113
+ ],
2114
+ requestBody: {
2115
+ required: true,
2116
+ content: {
2117
+ "application/json": {
2118
+ schema: {
2119
+ type: "object",
2120
+ properties: vNextBodyOptions,
2121
+ required: ["messages"]
2122
+ }
2123
+ }
2124
+ }
2125
+ },
1903
2126
  responses: {
1904
2127
  200: {
1905
2128
  description: "Streamed response"
@@ -1909,7 +2132,7 @@ function agentsRouter(bodyLimitOptions) {
1909
2132
  }
1910
2133
  }
1911
2134
  }),
1912
- streamVNextGenerateHandler
2135
+ streamVNextUIMessageHandler
1913
2136
  );
1914
2137
  router.post(
1915
2138
  "/:agentId/model",