@mastra/deployer 0.19.1-alpha.1 → 0.20.0-alpha.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 (54) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/dist/build/analyze/analyzeEntry.d.ts.map +1 -1
  3. package/dist/build/analyze/bundleExternals.d.ts.map +1 -1
  4. package/dist/build/analyze.cjs +2 -2
  5. package/dist/build/analyze.js +1 -1
  6. package/dist/build/bundler.cjs +3 -3
  7. package/dist/build/bundler.js +1 -1
  8. package/dist/build/index.cjs +12 -12
  9. package/dist/build/index.js +4 -4
  10. package/dist/build/utils.d.ts +1 -1
  11. package/dist/build/utils.d.ts.map +1 -1
  12. package/dist/bundler/index.cjs +2 -2
  13. package/dist/bundler/index.js +1 -1
  14. package/dist/{chunk-7XYNDWHM.cjs → chunk-4I4DWMYP.cjs} +81 -33
  15. package/dist/chunk-4I4DWMYP.cjs.map +1 -0
  16. package/dist/{chunk-RZGW2FV5.js → chunk-7YSO4XUX.js} +3 -3
  17. package/dist/{chunk-RZGW2FV5.js.map → chunk-7YSO4XUX.js.map} +1 -1
  18. package/dist/{chunk-JKSGIHN5.cjs → chunk-D5U2TTNK.cjs} +5 -5
  19. package/dist/{chunk-JKSGIHN5.cjs.map → chunk-D5U2TTNK.cjs.map} +1 -1
  20. package/dist/{chunk-LSVYJCYH.cjs → chunk-H7R3PAM4.cjs} +17 -17
  21. package/dist/{chunk-LSVYJCYH.cjs.map → chunk-H7R3PAM4.cjs.map} +1 -1
  22. package/dist/{chunk-C63Y45DE.cjs → chunk-OWF6JR2D.cjs} +9 -9
  23. package/dist/{chunk-C63Y45DE.cjs.map → chunk-OWF6JR2D.cjs.map} +1 -1
  24. package/dist/{chunk-5HLB56SX.cjs → chunk-QT4EHSOA.cjs} +14 -14
  25. package/dist/{chunk-5HLB56SX.cjs.map → chunk-QT4EHSOA.cjs.map} +1 -1
  26. package/dist/{chunk-P76ACDWK.js → chunk-SLXO6AYI.js} +3 -3
  27. package/dist/{chunk-P76ACDWK.js.map → chunk-SLXO6AYI.js.map} +1 -1
  28. package/dist/{chunk-RCG3326W.js → chunk-V6M3WK2G.js} +5 -5
  29. package/dist/{chunk-RCG3326W.js.map → chunk-V6M3WK2G.js.map} +1 -1
  30. package/dist/{chunk-E56YDU6G.js → chunk-YA2QB5O6.js} +80 -33
  31. package/dist/chunk-YA2QB5O6.js.map +1 -0
  32. package/dist/{chunk-G6MQAGP6.js → chunk-YY75MSEU.js} +4 -4
  33. package/dist/{chunk-G6MQAGP6.js.map → chunk-YY75MSEU.js.map} +1 -1
  34. package/dist/index.cjs +5 -5
  35. package/dist/index.js +2 -2
  36. package/dist/server/handlers/routes/agents/handlers.d.ts +3 -3
  37. package/dist/server/handlers/routes/agents/handlers.d.ts.map +1 -1
  38. package/dist/server/handlers/routes/agents/router.d.ts.map +1 -1
  39. package/dist/server/handlers/routes/memory/handlers.d.ts.map +1 -1
  40. package/dist/server/handlers/routes/workflows/handlers.d.ts +1 -0
  41. package/dist/server/handlers/routes/workflows/handlers.d.ts.map +1 -1
  42. package/dist/server/handlers/routes/workflows/router.d.ts.map +1 -1
  43. package/dist/server/index.cjs +389 -558
  44. package/dist/server/index.cjs.map +1 -1
  45. package/dist/server/index.d.ts.map +1 -1
  46. package/dist/server/index.js +391 -560
  47. package/dist/server/index.js.map +1 -1
  48. package/package.json +8 -7
  49. package/dist/chunk-7XYNDWHM.cjs.map +0 -1
  50. package/dist/chunk-E56YDU6G.js.map +0 -1
  51. package/dist/server/handlers/routes/networks/router.d.ts +0 -4
  52. package/dist/server/handlers/routes/networks/router.d.ts.map +0 -1
  53. package/dist/server/handlers/routes/networks/vNextNetwork.d.ts +0 -8
  54. package/dist/server/handlers/routes/networks/vNextNetwork.d.ts.map +0 -1
@@ -24,7 +24,7 @@ import { bodyLimit } from 'hono/body-limit';
24
24
  import { getAgentBuilderActionsHandler as getAgentBuilderActionsHandler$1, getAgentBuilderActionByIdHandler as getAgentBuilderActionByIdHandler$1, getAgentBuilderActionRunsHandler as getAgentBuilderActionRunsHandler$1, getAgentBuilderActionRunExecutionResultHandler as getAgentBuilderActionRunExecutionResultHandler$1, getAgentBuilderActionRunByIdHandler as getAgentBuilderActionRunByIdHandler$1, resumeAgentBuilderActionHandler as resumeAgentBuilderActionHandler$1, resumeAsyncAgentBuilderActionHandler as resumeAsyncAgentBuilderActionHandler$1, streamAgentBuilderActionHandler as streamAgentBuilderActionHandler$1, streamVNextAgentBuilderActionHandler as streamVNextAgentBuilderActionHandler$1, createAgentBuilderActionRunHandler as createAgentBuilderActionRunHandler$1, startAsyncAgentBuilderActionHandler as startAsyncAgentBuilderActionHandler$1, startAgentBuilderActionRunHandler as startAgentBuilderActionRunHandler$1, watchAgentBuilderActionHandler as watchAgentBuilderActionHandler$1, cancelAgentBuilderActionRunHandler as cancelAgentBuilderActionRunHandler$1, sendAgentBuilderActionRunEventHandler as sendAgentBuilderActionRunEventHandler$1 } from '@mastra/server/handlers/agent-builder';
25
25
  import { MastraError, ErrorCategory, ErrorDomain } from '@mastra/core/error';
26
26
  import { getProviderConfig, PROVIDER_REGISTRY } from '@mastra/core/llm';
27
- import { getAgentsHandler as getAgentsHandler$1, getAgentByIdHandler as getAgentByIdHandler$1, getEvalsByAgentIdHandler as getEvalsByAgentIdHandler$1, getLiveEvalsByAgentIdHandler as getLiveEvalsByAgentIdHandler$1, generateLegacyHandler as generateLegacyHandler$1, generateHandler as generateHandler$1, streamNetworkHandler as streamNetworkHandler$1, generateVNextHandler as generateVNextHandler$1, streamVNextGenerateHandler as streamVNextGenerateHandler$1, streamGenerateLegacyHandler as streamGenerateLegacyHandler$1, streamGenerateHandler as streamGenerateHandler$1, streamVNextUIMessageHandler as streamVNextUIMessageHandler$1, updateAgentModelHandler as updateAgentModelHandler$1, reorderAgentModelListHandler as reorderAgentModelListHandler$1, updateAgentModelInModelListHandler as updateAgentModelInModelListHandler$1 } from '@mastra/server/handlers/agents';
27
+ import { getAgentsHandler as getAgentsHandler$1, getAgentByIdHandler as getAgentByIdHandler$1, getEvalsByAgentIdHandler as getEvalsByAgentIdHandler$1, getLiveEvalsByAgentIdHandler as getLiveEvalsByAgentIdHandler$1, generateLegacyHandler as generateLegacyHandler$1, generateHandler as generateHandler$1, streamNetworkHandler as streamNetworkHandler$1, streamGenerateHandler as streamGenerateHandler$1, streamGenerateLegacyHandler as streamGenerateLegacyHandler$1, streamUIMessageHandler as streamUIMessageHandler$1, updateAgentModelHandler as updateAgentModelHandler$1, reorderAgentModelListHandler as reorderAgentModelListHandler$1, updateAgentModelInModelListHandler as updateAgentModelInModelListHandler$1, approveToolCallHandler as approveToolCallHandler$1, declineToolCallHandler as declineToolCallHandler$1 } from '@mastra/server/handlers/agents';
28
28
  import { Agent } from '@mastra/core/agent';
29
29
  import { z } from 'zod';
30
30
  import { getAgentToolHandler as getAgentToolHandler$1, executeAgentToolHandler as executeAgentToolHandler$1, getToolsHandler as getToolsHandler$1, getToolByIdHandler as getToolByIdHandler$1, executeToolHandler as executeToolHandler$1 } from '@mastra/server/handlers/tools';
@@ -33,13 +33,12 @@ import { getLogsHandler as getLogsHandler$1, getLogTransports as getLogTransport
33
33
  import util from 'util';
34
34
  import { Buffer as Buffer$1 } from 'buffer';
35
35
  import { getMemoryStatusHandler as getMemoryStatusHandler$1, getThreadsHandler as getThreadsHandler$1, getThreadByIdHandler as getThreadByIdHandler$1, getMessagesHandler as getMessagesHandler$1, createThreadHandler as createThreadHandler$1, updateThreadHandler as updateThreadHandler$1, deleteThreadHandler as deleteThreadHandler$1, saveMessagesHandler as saveMessagesHandler$1, deleteMessagesHandler as deleteMessagesHandler$1, getMemoryConfigHandler as getMemoryConfigHandler$1, getThreadsPaginatedHandler as getThreadsPaginatedHandler$1, getMessagesPaginatedHandler as getMessagesPaginatedHandler$1, searchMemoryHandler as searchMemoryHandler$1, getWorkingMemoryHandler as getWorkingMemoryHandler$1, updateWorkingMemoryHandler as updateWorkingMemoryHandler$1 } from '@mastra/server/handlers/memory';
36
- import { getVNextNetworksHandler as getVNextNetworksHandler$1, getVNextNetworkByIdHandler as getVNextNetworkByIdHandler$1, generateVNextNetworkHandler as generateVNextNetworkHandler$1, loopVNextNetworkHandler as loopVNextNetworkHandler$1, loopStreamVNextNetworkHandler as loopStreamVNextNetworkHandler$1, streamGenerateVNextNetworkHandler as streamGenerateVNextNetworkHandler$1 } from '@mastra/server/handlers/vNextNetwork';
37
36
  import { AISpanType } from '@mastra/core/ai-tracing';
38
37
  import { getAITracesPaginatedHandler as getAITracesPaginatedHandler$1, getAITraceHandler as getAITraceHandler$1, getScoresBySpan as getScoresBySpan$1, scoreTracesHandler } from '@mastra/server/handlers/observability';
39
38
  import { getScorersHandler as getScorersHandler$1, getScorerHandler as getScorerHandler$1, getScoresByRunIdHandler as getScoresByRunIdHandler$1, getScoresByScorerIdHandler as getScoresByScorerIdHandler$1, getScoresByEntityIdHandler as getScoresByEntityIdHandler$1, saveScoreHandler as saveScoreHandler$1 } from '@mastra/server/handlers/scores';
40
39
  import { getTelemetryHandler as getTelemetryHandler$1, storeTelemetryHandler as storeTelemetryHandler$1 } from '@mastra/server/handlers/telemetry';
41
40
  import { upsertVectors as upsertVectors$1, createIndex as createIndex$1, queryVectors as queryVectors$1, listIndexes as listIndexes$1, describeIndex as describeIndex$1, deleteIndex as deleteIndex$1 } from '@mastra/server/handlers/vector';
42
- import { getWorkflowsHandler as getWorkflowsHandler$1, getWorkflowByIdHandler as getWorkflowByIdHandler$1, getWorkflowRunsHandler as getWorkflowRunsHandler$1, getWorkflowRunExecutionResultHandler as getWorkflowRunExecutionResultHandler$1, getWorkflowRunByIdHandler as getWorkflowRunByIdHandler$1, resumeWorkflowHandler as resumeWorkflowHandler$1, resumeStreamWorkflowHandler as resumeStreamWorkflowHandler$1, resumeAsyncWorkflowHandler as resumeAsyncWorkflowHandler$1, streamWorkflowHandler as streamWorkflowHandler$1, observeStreamWorkflowHandler as observeStreamWorkflowHandler$1, streamVNextWorkflowHandler as streamVNextWorkflowHandler$1, createWorkflowRunHandler as createWorkflowRunHandler$1, startAsyncWorkflowHandler as startAsyncWorkflowHandler$1, startWorkflowRunHandler as startWorkflowRunHandler$1, watchWorkflowHandler as watchWorkflowHandler$1, cancelWorkflowRunHandler as cancelWorkflowRunHandler$1, sendWorkflowRunEventHandler as sendWorkflowRunEventHandler$1 } from '@mastra/server/handlers/workflows';
41
+ import { getWorkflowsHandler as getWorkflowsHandler$1, getWorkflowByIdHandler as getWorkflowByIdHandler$1, getWorkflowRunsHandler as getWorkflowRunsHandler$1, getWorkflowRunExecutionResultHandler as getWorkflowRunExecutionResultHandler$1, getWorkflowRunByIdHandler as getWorkflowRunByIdHandler$1, resumeWorkflowHandler as resumeWorkflowHandler$1, resumeStreamWorkflowHandler as resumeStreamWorkflowHandler$1, resumeAsyncWorkflowHandler as resumeAsyncWorkflowHandler$1, streamWorkflowHandler as streamWorkflowHandler$1, observeStreamWorkflowHandler as observeStreamWorkflowHandler$1, streamVNextWorkflowHandler as streamVNextWorkflowHandler$1, observeStreamVNextWorkflowHandler as observeStreamVNextWorkflowHandler$1, createWorkflowRunHandler as createWorkflowRunHandler$1, startAsyncWorkflowHandler as startAsyncWorkflowHandler$1, startWorkflowRunHandler as startWorkflowRunHandler$1, watchWorkflowHandler as watchWorkflowHandler$1, cancelWorkflowRunHandler as cancelWorkflowRunHandler$1, sendWorkflowRunEventHandler as sendWorkflowRunEventHandler$1 } from '@mastra/server/handlers/workflows';
43
42
  import { getLegacyWorkflowsHandler as getLegacyWorkflowsHandler$1, getLegacyWorkflowByIdHandler as getLegacyWorkflowByIdHandler$1, getLegacyWorkflowRunsHandler as getLegacyWorkflowRunsHandler$1, resumeLegacyWorkflowHandler as resumeLegacyWorkflowHandler$1, resumeAsyncLegacyWorkflowHandler as resumeAsyncLegacyWorkflowHandler$1, createLegacyWorkflowRunHandler as createLegacyWorkflowRunHandler$1, startAsyncLegacyWorkflowHandler as startAsyncLegacyWorkflowHandler$1, startLegacyWorkflowRunHandler as startLegacyWorkflowRunHandler$1, watchLegacyWorkflowHandler as watchLegacyWorkflowHandler$1 } from '@mastra/server/handlers/legacyWorkflows';
44
43
 
45
44
  // src/server/index.ts
@@ -327,13 +326,13 @@ function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromi
327
326
  }
328
327
  }
329
328
  }
330
- function writeFromReadableStream(stream7, writable) {
331
- if (stream7.locked) {
329
+ function writeFromReadableStream(stream6, writable) {
330
+ if (stream6.locked) {
332
331
  throw new TypeError("ReadableStream is locked.");
333
332
  } else if (writable.destroyed) {
334
333
  return;
335
334
  }
336
- return writeFromReadableStreamDefaultReader(stream7.getReader(), writable);
335
+ return writeFromReadableStreamDefaultReader(stream6.getReader(), writable);
337
336
  }
338
337
  var buildOutgoingHttpHeaders = (headers) => {
339
338
  const res = {};
@@ -598,21 +597,21 @@ var ENCODINGS = {
598
597
  gzip: ".gz"
599
598
  };
600
599
  var ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS);
601
- var createStreamBody = (stream7) => {
600
+ var createStreamBody = (stream6) => {
602
601
  const body = new ReadableStream({
603
602
  start(controller) {
604
- stream7.on("data", (chunk) => {
603
+ stream6.on("data", (chunk) => {
605
604
  controller.enqueue(chunk);
606
605
  });
607
- stream7.on("error", (err) => {
606
+ stream6.on("error", (err) => {
608
607
  controller.error(err);
609
608
  });
610
- stream7.on("end", () => {
609
+ stream6.on("end", () => {
611
610
  controller.close();
612
611
  });
613
612
  },
614
613
  cancel() {
615
- stream7.destroy();
614
+ stream6.destroy();
616
615
  }
617
616
  });
618
617
  return body;
@@ -704,10 +703,10 @@ var serveStatic = (options = { root: "" }) => {
704
703
  end = size - 1;
705
704
  }
706
705
  const chunksize = end - start + 1;
707
- const stream7 = createReadStream(path, { start, end });
706
+ const stream6 = createReadStream(path, { start, end });
708
707
  c2.header("Content-Length", chunksize.toString());
709
708
  c2.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
710
- return c2.body(createStreamBody(stream7), 206);
709
+ return c2.body(createStreamBody(stream6), 206);
711
710
  };
712
711
  };
713
712
  var RENDER_TYPE = {
@@ -1005,15 +1004,15 @@ async function getAgentExecutionHandler(c2) {
1005
1004
  if (body.method === "message/stream") {
1006
1005
  return stream(
1007
1006
  c2,
1008
- async (stream7) => {
1007
+ async (stream6) => {
1009
1008
  try {
1010
- stream7.onAbort(() => {
1009
+ stream6.onAbort(() => {
1011
1010
  if (!result.locked) {
1012
1011
  return result.cancel();
1013
1012
  }
1014
1013
  });
1015
1014
  for await (const chunk of result) {
1016
- await stream7.write(JSON.stringify(chunk) + "");
1015
+ await stream6.write(JSON.stringify(chunk) + "");
1017
1016
  }
1018
1017
  } catch (err) {
1019
1018
  logger2.error("Error in message/stream stream: " + err?.message);
@@ -1260,7 +1259,7 @@ var authorizationMiddleware = async (c2, next) => {
1260
1259
  var clients = /* @__PURE__ */ new Set();
1261
1260
  var hotReloadDisabled = false;
1262
1261
  function handleClientsRefresh(c2) {
1263
- const stream7 = new ReadableStream({
1262
+ const stream6 = new ReadableStream({
1264
1263
  start(controller) {
1265
1264
  clients.add(controller);
1266
1265
  controller.enqueue("data: connected\n\n");
@@ -1269,7 +1268,7 @@ function handleClientsRefresh(c2) {
1269
1268
  });
1270
1269
  }
1271
1270
  });
1272
- return new Response(stream7, {
1271
+ return new Response(stream6, {
1273
1272
  headers: {
1274
1273
  "Content-Type": "text/event-stream",
1275
1274
  "Cache-Control": "no-cache",
@@ -1527,7 +1526,7 @@ async function watchAgentBuilderActionHandler(c2) {
1527
1526
  throw new HTTPException(400, { message: "runId required to watch action" });
1528
1527
  }
1529
1528
  c2.header("Transfer-Encoding", "chunked");
1530
- return stream(c2, async (stream7) => {
1529
+ return stream(c2, async (stream6) => {
1531
1530
  try {
1532
1531
  disableHotReload();
1533
1532
  const result = await watchAgentBuilderActionHandler$1({
@@ -1537,12 +1536,12 @@ async function watchAgentBuilderActionHandler(c2) {
1537
1536
  eventType
1538
1537
  });
1539
1538
  const reader = result.getReader();
1540
- stream7.onAbort(() => {
1539
+ stream6.onAbort(() => {
1541
1540
  void reader.cancel("request aborted");
1542
1541
  });
1543
1542
  let chunkResult;
1544
1543
  while ((chunkResult = await reader.read()) && !chunkResult.done) {
1545
- await stream7.write(JSON.stringify(chunkResult.value) + "");
1544
+ await stream6.write(JSON.stringify(chunkResult.value) + "");
1546
1545
  }
1547
1546
  enableHotReload();
1548
1547
  } catch (err) {
@@ -1566,7 +1565,7 @@ async function streamAgentBuilderActionHandler(c2) {
1566
1565
  c2.header("Transfer-Encoding", "chunked");
1567
1566
  return stream(
1568
1567
  c2,
1569
- async (stream7) => {
1568
+ async (stream6) => {
1570
1569
  try {
1571
1570
  disableHotReload();
1572
1571
  const result = await streamAgentBuilderActionHandler$1({
@@ -1577,17 +1576,17 @@ async function streamAgentBuilderActionHandler(c2) {
1577
1576
  runtimeContext
1578
1577
  });
1579
1578
  const reader = result.stream.getReader();
1580
- stream7.onAbort(() => {
1579
+ stream6.onAbort(() => {
1581
1580
  void reader.cancel("request aborted");
1582
1581
  });
1583
1582
  let chunkResult;
1584
1583
  while ((chunkResult = await reader.read()) && !chunkResult.done) {
1585
- await stream7.write(JSON.stringify(chunkResult.value) + "");
1584
+ await stream6.write(JSON.stringify(chunkResult.value) + "");
1586
1585
  }
1587
1586
  } catch (err) {
1588
1587
  logger2.error("Error in action stream: " + (err?.message ?? "Unknown error"));
1589
1588
  }
1590
- await stream7.close();
1589
+ await stream6.close();
1591
1590
  enableHotReload();
1592
1591
  },
1593
1592
  async (err) => {
@@ -1610,7 +1609,7 @@ async function streamVNextAgentBuilderActionHandler(c2) {
1610
1609
  c2.header("Transfer-Encoding", "chunked");
1611
1610
  return stream(
1612
1611
  c2,
1613
- async (stream7) => {
1612
+ async (stream6) => {
1614
1613
  try {
1615
1614
  disableHotReload();
1616
1615
  const result = await streamVNextAgentBuilderActionHandler$1({
@@ -1621,12 +1620,12 @@ async function streamVNextAgentBuilderActionHandler(c2) {
1621
1620
  runtimeContext
1622
1621
  });
1623
1622
  const reader = result.getReader();
1624
- stream7.onAbort(() => {
1623
+ stream6.onAbort(() => {
1625
1624
  void reader.cancel("request aborted");
1626
1625
  });
1627
1626
  let chunkResult;
1628
1627
  while ((chunkResult = await reader.read()) && !chunkResult.done) {
1629
- await stream7.write(JSON.stringify(chunkResult.value) + "");
1628
+ await stream6.write(JSON.stringify(chunkResult.value) + "");
1630
1629
  }
1631
1630
  } catch (err) {
1632
1631
  logger2.error("Error in action VNext stream: " + (err?.message ?? "Unknown error"));
@@ -2474,61 +2473,112 @@ async function generateHandler(c2) {
2474
2473
  return handleError(error, "Error generating from agent");
2475
2474
  }
2476
2475
  }
2477
- async function generateVNextHandler(c2) {
2476
+ async function streamGenerateLegacyHandler(c2) {
2478
2477
  try {
2479
2478
  const mastra = c2.get("mastra");
2480
2479
  const agentId = c2.req.param("agentId");
2481
2480
  const runtimeContext = c2.get("runtimeContext");
2482
2481
  const body = await c2.req.json();
2483
- const result = await generateVNextHandler$1({
2482
+ const streamResponse = await streamGenerateLegacyHandler$1({
2484
2483
  mastra,
2485
2484
  agentId,
2486
2485
  runtimeContext,
2487
2486
  body,
2488
2487
  abortSignal: c2.req.raw.signal
2489
2488
  });
2490
- return c2.json(result);
2489
+ return streamResponse;
2491
2490
  } catch (error) {
2492
- return handleError(error, "Error generating vnext from agent");
2491
+ return handleError(error, "Error streaming from agent");
2493
2492
  }
2494
2493
  }
2495
- async function streamGenerateLegacyHandler(c2) {
2494
+ async function streamGenerateHandler(c2) {
2496
2495
  try {
2497
2496
  const mastra = c2.get("mastra");
2498
2497
  const agentId = c2.req.param("agentId");
2499
2498
  const runtimeContext = c2.get("runtimeContext");
2500
2499
  const body = await c2.req.json();
2501
- const streamResponse = await streamGenerateLegacyHandler$1({
2502
- mastra,
2503
- agentId,
2504
- runtimeContext,
2505
- body,
2506
- abortSignal: c2.req.raw.signal
2507
- });
2508
- return streamResponse;
2500
+ const logger2 = mastra.getLogger();
2501
+ c2.header("Transfer-Encoding", "chunked");
2502
+ return stream(
2503
+ c2,
2504
+ async (stream6) => {
2505
+ try {
2506
+ const streamResponse = await streamGenerateHandler$1({
2507
+ mastra,
2508
+ agentId,
2509
+ runtimeContext,
2510
+ body,
2511
+ abortSignal: c2.req.raw.signal
2512
+ });
2513
+ const reader = streamResponse.fullStream.getReader();
2514
+ stream6.onAbort(() => {
2515
+ void reader.cancel("request aborted");
2516
+ });
2517
+ let chunkResult;
2518
+ while ((chunkResult = await reader.read()) && !chunkResult.done) {
2519
+ await stream6.write(`data: ${JSON.stringify(chunkResult.value)}
2520
+
2521
+ `);
2522
+ }
2523
+ await stream6.write("data: [DONE]\n\n");
2524
+ } catch (err) {
2525
+ logger2.error("Error in stream generate: " + (err?.message ?? "Unknown error"));
2526
+ }
2527
+ await stream6.close();
2528
+ },
2529
+ async (err) => {
2530
+ logger2.error("Error in watch stream: " + err?.message);
2531
+ }
2532
+ );
2509
2533
  } catch (error) {
2510
2534
  return handleError(error, "Error streaming from agent");
2511
2535
  }
2512
2536
  }
2513
- async function streamGenerateHandler(c2) {
2537
+ async function approveToolCallHandler(c2) {
2514
2538
  try {
2515
2539
  const mastra = c2.get("mastra");
2516
2540
  const agentId = c2.req.param("agentId");
2517
2541
  const runtimeContext = c2.get("runtimeContext");
2518
2542
  const body = await c2.req.json();
2519
- const streamResponse = await streamGenerateHandler$1({
2520
- mastra,
2521
- agentId,
2522
- runtimeContext,
2523
- body,
2524
- abortSignal: c2.req.raw.signal
2525
- });
2526
- return streamResponse;
2543
+ const logger2 = mastra.getLogger();
2544
+ c2.header("Transfer-Encoding", "chunked");
2545
+ c2.header("Transfer-Encoding", "chunked");
2546
+ return stream(
2547
+ c2,
2548
+ async (stream6) => {
2549
+ try {
2550
+ const streamResponse = await approveToolCallHandler$1({
2551
+ mastra,
2552
+ runtimeContext,
2553
+ agentId,
2554
+ body,
2555
+ abortSignal: c2.req.raw.signal
2556
+ });
2557
+ const reader = streamResponse.fullStream.getReader();
2558
+ stream6.onAbort(() => {
2559
+ void reader.cancel("request aborted");
2560
+ });
2561
+ let chunkResult;
2562
+ while ((chunkResult = await reader.read()) && !chunkResult.done) {
2563
+ await stream6.write(`data: ${JSON.stringify(chunkResult.value)}
2564
+
2565
+ `);
2566
+ }
2567
+ await stream6.write("data: [DONE]\n\n");
2568
+ } catch (err) {
2569
+ logger2.error("Error in approve tool call: " + (err?.message ?? "Unknown error"));
2570
+ }
2571
+ await stream6.close();
2572
+ },
2573
+ async (err) => {
2574
+ logger2.error("Error in watch stream: " + err?.message);
2575
+ }
2576
+ );
2527
2577
  } catch (error) {
2528
- return handleError(error, "Error streaming from agent");
2578
+ return handleError(error, "Error approving tool call");
2529
2579
  }
2530
2580
  }
2531
- async function streamVNextGenerateHandler(c2) {
2581
+ async function declineToolCallHandler(c2) {
2532
2582
  try {
2533
2583
  const mastra = c2.get("mastra");
2534
2584
  const agentId = c2.req.param("agentId");
@@ -2538,37 +2588,37 @@ async function streamVNextGenerateHandler(c2) {
2538
2588
  c2.header("Transfer-Encoding", "chunked");
2539
2589
  return stream(
2540
2590
  c2,
2541
- async (stream7) => {
2591
+ async (stream6) => {
2542
2592
  try {
2543
- const streamResponse = await streamVNextGenerateHandler$1({
2593
+ const streamResponse = await declineToolCallHandler$1({
2544
2594
  mastra,
2545
- agentId,
2546
2595
  runtimeContext,
2596
+ agentId,
2547
2597
  body,
2548
2598
  abortSignal: c2.req.raw.signal
2549
2599
  });
2550
2600
  const reader = streamResponse.fullStream.getReader();
2551
- stream7.onAbort(() => {
2601
+ stream6.onAbort(() => {
2552
2602
  void reader.cancel("request aborted");
2553
2603
  });
2554
2604
  let chunkResult;
2555
2605
  while ((chunkResult = await reader.read()) && !chunkResult.done) {
2556
- await stream7.write(`data: ${JSON.stringify(chunkResult.value)}
2606
+ await stream6.write(`data: ${JSON.stringify(chunkResult.value)}
2557
2607
 
2558
2608
  `);
2559
2609
  }
2560
- await stream7.write("data: [DONE]\n\n");
2610
+ await stream6.write("data: [DONE]\n\n");
2561
2611
  } catch (err) {
2562
- logger2.error("Error in streamVNext generate: " + (err?.message ?? "Unknown error"));
2612
+ logger2.error("Error in decline tool call: " + (err?.message ?? "Unknown error"));
2563
2613
  }
2564
- await stream7.close();
2614
+ await stream6.close();
2565
2615
  },
2566
2616
  async (err) => {
2567
2617
  logger2.error("Error in watch stream: " + err?.message);
2568
2618
  }
2569
2619
  );
2570
2620
  } catch (error) {
2571
- return handleError(error, "Error streaming from agent");
2621
+ return handleError(error, "Error declining tool call");
2572
2622
  }
2573
2623
  }
2574
2624
  async function streamNetworkHandler(c2) {
@@ -2602,7 +2652,7 @@ async function streamNetworkHandler(c2) {
2602
2652
  c2.header("Transfer-Encoding", "chunked");
2603
2653
  return stream(
2604
2654
  c2,
2605
- async (stream7) => {
2655
+ async (stream6) => {
2606
2656
  try {
2607
2657
  const streamResponse = await streamNetworkHandler$1({
2608
2658
  mastra,
@@ -2612,20 +2662,20 @@ async function streamNetworkHandler(c2) {
2612
2662
  // abortSignal: c.req.raw.signal,
2613
2663
  });
2614
2664
  const reader = streamResponse.getReader();
2615
- stream7.onAbort(() => {
2665
+ stream6.onAbort(() => {
2616
2666
  void reader.cancel("request aborted");
2617
2667
  });
2618
2668
  let chunkResult;
2619
2669
  while ((chunkResult = await reader.read()) && !chunkResult.done) {
2620
- await stream7.write(`data: ${JSON.stringify(chunkResult.value)}
2670
+ await stream6.write(`data: ${JSON.stringify(chunkResult.value)}
2621
2671
 
2622
2672
  `);
2623
2673
  }
2624
- await stream7.write("data: [DONE]\n\n");
2674
+ await stream6.write("data: [DONE]\n\n");
2625
2675
  } catch (err) {
2626
2676
  logger2.error("Error in streamNetwork generate: " + (err?.message ?? "Unknown error"));
2627
2677
  }
2628
- await stream7.close();
2678
+ await stream6.close();
2629
2679
  },
2630
2680
  async (err) => {
2631
2681
  logger2.error("Error in watch stream: " + err?.message);
@@ -2635,13 +2685,13 @@ async function streamNetworkHandler(c2) {
2635
2685
  return handleError(error, "Error streaming from agent in network mode");
2636
2686
  }
2637
2687
  }
2638
- async function streamVNextUIMessageHandler(c2) {
2688
+ async function streamUIMessageHandler(c2) {
2639
2689
  try {
2640
2690
  const mastra = c2.get("mastra");
2641
2691
  const agentId = c2.req.param("agentId");
2642
2692
  const runtimeContext = c2.get("runtimeContext");
2643
2693
  const body = await c2.req.json();
2644
- const streamResponse = await streamVNextUIMessageHandler$1({
2694
+ const streamResponse = await streamUIMessageHandler$1({
2645
2695
  mastra,
2646
2696
  agentId,
2647
2697
  runtimeContext,
@@ -2699,9 +2749,9 @@ async function deprecatedStreamVNextHandler(c2) {
2699
2749
  return c2.json(
2700
2750
  {
2701
2751
  error: "This endpoint is deprecated",
2702
- message: "The /streamVNext endpoint has been deprecated. Please use an alternative streaming endpoint.",
2703
- deprecated_endpoint: "/api/agents/:agentId/streamVNext",
2704
- replacement_endpoint: "/api/agents/:agentId/stream/vnext"
2752
+ message: "The /stream/vnext endpoint has been deprecated. Please use an alternative streaming endpoint.",
2753
+ deprecated_endpoint: "/api/agents/:agentId/stream/vnext",
2754
+ replacement_endpoint: "/api/agents/:agentId/stream"
2705
2755
  },
2706
2756
  410
2707
2757
  // 410 Gone status code for deprecated endpoints
@@ -3315,14 +3365,15 @@ function agentsRouter(bodyLimitOptions) {
3315
3365
  }
3316
3366
  }
3317
3367
  }),
3318
- generateVNextHandler
3368
+ generateHandler
3319
3369
  );
3320
3370
  router.post(
3321
3371
  "/:agentId/stream/vnext",
3322
3372
  bodyLimit(bodyLimitOptions),
3323
3373
  w({
3324
- description: "Generate a response from an agent",
3374
+ description: "[DEPRECATED] This endpoint is deprecated. Please use /stream instead.",
3325
3375
  tags: ["agents"],
3376
+ deprecated: true,
3326
3377
  parameters: [
3327
3378
  {
3328
3379
  name: "agentId",
@@ -3352,7 +3403,7 @@ function agentsRouter(bodyLimitOptions) {
3352
3403
  }
3353
3404
  }
3354
3405
  }),
3355
- streamVNextGenerateHandler
3406
+ streamGenerateHandler
3356
3407
  );
3357
3408
  router.post(
3358
3409
  "/:agentId/stream-legacy",
@@ -3568,6 +3619,44 @@ function agentsRouter(bodyLimitOptions) {
3568
3619
  router.post(
3569
3620
  "/:agentId/stream/vnext/ui",
3570
3621
  bodyLimit(bodyLimitOptions),
3622
+ w({
3623
+ description: "[DEPRECATED] This endpoint is deprecated. Please use /stream/ui instead.",
3624
+ tags: ["agents"],
3625
+ deprecated: true,
3626
+ parameters: [
3627
+ {
3628
+ name: "agentId",
3629
+ in: "path",
3630
+ required: true,
3631
+ schema: { type: "string" }
3632
+ }
3633
+ ],
3634
+ requestBody: {
3635
+ required: true,
3636
+ content: {
3637
+ "application/json": {
3638
+ schema: {
3639
+ type: "object",
3640
+ properties: vNextBodyOptions,
3641
+ required: ["messages"]
3642
+ }
3643
+ }
3644
+ }
3645
+ },
3646
+ responses: {
3647
+ 200: {
3648
+ description: "Streamed response"
3649
+ },
3650
+ 404: {
3651
+ description: "Agent not found"
3652
+ }
3653
+ }
3654
+ }),
3655
+ streamUIMessageHandler
3656
+ );
3657
+ router.post(
3658
+ "/:agentId/stream/ui",
3659
+ bodyLimit(bodyLimitOptions),
3571
3660
  w({
3572
3661
  description: "Stream a response from an agent",
3573
3662
  tags: ["agents"],
@@ -3600,7 +3689,7 @@ function agentsRouter(bodyLimitOptions) {
3600
3689
  }
3601
3690
  }
3602
3691
  }),
3603
- streamVNextUIMessageHandler
3692
+ streamUIMessageHandler
3604
3693
  );
3605
3694
  router.post(
3606
3695
  "/:agentId/model",
@@ -4245,6 +4334,88 @@ function agentsRouter(bodyLimitOptions) {
4245
4334
  }),
4246
4335
  executeAgentToolHandler
4247
4336
  );
4337
+ router.post(
4338
+ "/:agentId/approve-tool-call",
4339
+ bodyLimit(bodyLimitOptions),
4340
+ w({
4341
+ description: "Approve a tool call in human-in-the-loop workflow",
4342
+ tags: ["agents"],
4343
+ parameters: [
4344
+ {
4345
+ name: "agentId",
4346
+ in: "path",
4347
+ required: true,
4348
+ schema: { type: "string" }
4349
+ }
4350
+ ],
4351
+ requestBody: {
4352
+ required: true,
4353
+ content: {
4354
+ "application/json": {
4355
+ schema: {
4356
+ type: "object",
4357
+ properties: {
4358
+ runId: { type: "string", description: "The run ID for the execution" },
4359
+ runtimeContext: { type: "object", description: "Runtime context for the execution" },
4360
+ format: { type: "string", enum: ["aisdk", "mastra"], description: "Output format" }
4361
+ },
4362
+ required: ["runId"]
4363
+ }
4364
+ }
4365
+ }
4366
+ },
4367
+ responses: {
4368
+ 200: {
4369
+ description: "Tool call approved and execution resumed"
4370
+ },
4371
+ 404: {
4372
+ description: "Agent not found"
4373
+ }
4374
+ }
4375
+ }),
4376
+ approveToolCallHandler
4377
+ );
4378
+ router.post(
4379
+ "/:agentId/decline-tool-call",
4380
+ bodyLimit(bodyLimitOptions),
4381
+ w({
4382
+ description: "Decline a tool call in human-in-the-loop workflow",
4383
+ tags: ["agents"],
4384
+ parameters: [
4385
+ {
4386
+ name: "agentId",
4387
+ in: "path",
4388
+ required: true,
4389
+ schema: { type: "string" }
4390
+ }
4391
+ ],
4392
+ requestBody: {
4393
+ required: true,
4394
+ content: {
4395
+ "application/json": {
4396
+ schema: {
4397
+ type: "object",
4398
+ properties: {
4399
+ runId: { type: "string", description: "The run ID for the execution" },
4400
+ runtimeContext: { type: "object", description: "Runtime context for the execution" },
4401
+ format: { type: "string", enum: ["aisdk", "mastra"], description: "Output format" }
4402
+ },
4403
+ required: ["runId"]
4404
+ }
4405
+ }
4406
+ }
4407
+ },
4408
+ responses: {
4409
+ 200: {
4410
+ description: "Tool call declined and execution resumed"
4411
+ },
4412
+ 404: {
4413
+ description: "Agent not found"
4414
+ }
4415
+ }
4416
+ }),
4417
+ declineToolCallHandler
4418
+ );
4248
4419
  return router;
4249
4420
  }
4250
4421
  function agentsRouterDev(bodyLimitOptions) {
@@ -7050,11 +7221,9 @@ async function getMemoryStatusHandler(c2) {
7050
7221
  try {
7051
7222
  const mastra = c2.get("mastra");
7052
7223
  const agentId = c2.req.query("agentId");
7053
- const networkId = c2.req.query("networkId");
7054
7224
  const result = await getMemoryStatusHandler$1({
7055
7225
  mastra,
7056
- agentId,
7057
- networkId
7226
+ agentId
7058
7227
  });
7059
7228
  return c2.json(result);
7060
7229
  } catch (error) {
@@ -7065,11 +7234,9 @@ async function getMemoryConfigHandler(c2) {
7065
7234
  try {
7066
7235
  const mastra = c2.get("mastra");
7067
7236
  const agentId = c2.req.query("agentId");
7068
- const networkId = c2.req.query("networkId");
7069
7237
  const result = await getMemoryConfigHandler$1({
7070
7238
  mastra,
7071
- agentId,
7072
- networkId
7239
+ agentId
7073
7240
  });
7074
7241
  return c2.json(result);
7075
7242
  } catch (error) {
@@ -7081,14 +7248,12 @@ async function getThreadsHandler(c2) {
7081
7248
  const mastra = c2.get("mastra");
7082
7249
  const agentId = c2.req.query("agentId");
7083
7250
  const resourceId = c2.req.query("resourceid");
7084
- const networkId = c2.req.query("networkId");
7085
7251
  const orderBy = c2.req.query("orderBy");
7086
7252
  const sortDirection = c2.req.query("sortDirection");
7087
7253
  const result = await getThreadsHandler$1({
7088
7254
  mastra,
7089
7255
  agentId,
7090
7256
  resourceId,
7091
- networkId,
7092
7257
  orderBy,
7093
7258
  sortDirection
7094
7259
  });
@@ -7102,7 +7267,6 @@ async function getThreadsPaginatedHandler(c2) {
7102
7267
  const mastra = c2.get("mastra");
7103
7268
  const agentId = c2.req.query("agentId");
7104
7269
  const resourceId = c2.req.query("resourceId");
7105
- const networkId = c2.req.query("networkId");
7106
7270
  const page = parseInt(c2.req.query("page") || "0", 10);
7107
7271
  const perPage = parseInt(c2.req.query("perPage") || "100", 10);
7108
7272
  const orderBy = c2.req.query("orderBy");
@@ -7111,7 +7275,6 @@ async function getThreadsPaginatedHandler(c2) {
7111
7275
  mastra,
7112
7276
  agentId,
7113
7277
  resourceId,
7114
- networkId,
7115
7278
  page,
7116
7279
  perPage,
7117
7280
  orderBy,
@@ -7127,12 +7290,10 @@ async function getThreadByIdHandler(c2) {
7127
7290
  const mastra = c2.get("mastra");
7128
7291
  const agentId = c2.req.query("agentId");
7129
7292
  const threadId = c2.req.param("threadId");
7130
- const networkId = c2.req.query("networkId");
7131
7293
  const result = await getThreadByIdHandler$1({
7132
7294
  mastra,
7133
7295
  agentId,
7134
- threadId,
7135
- networkId
7296
+ threadId
7136
7297
  });
7137
7298
  return c2.json(result);
7138
7299
  } catch (error) {
@@ -7143,13 +7304,11 @@ async function saveMessagesHandler(c2) {
7143
7304
  try {
7144
7305
  const mastra = c2.get("mastra");
7145
7306
  const agentId = c2.req.query("agentId");
7146
- const networkId = c2.req.query("networkId");
7147
7307
  const body = await c2.req.json();
7148
7308
  const result = await saveMessagesHandler$1({
7149
7309
  mastra,
7150
7310
  agentId,
7151
- body,
7152
- networkId
7311
+ body
7153
7312
  });
7154
7313
  return c2.json(result);
7155
7314
  } catch (error) {
@@ -7160,13 +7319,11 @@ async function createThreadHandler(c2) {
7160
7319
  try {
7161
7320
  const mastra = c2.get("mastra");
7162
7321
  const agentId = c2.req.query("agentId");
7163
- const networkId = c2.req.query("networkId");
7164
7322
  const body = await c2.req.json();
7165
7323
  const result = await createThreadHandler$1({
7166
7324
  mastra,
7167
7325
  agentId,
7168
- body,
7169
- networkId
7326
+ body
7170
7327
  });
7171
7328
  return c2.json(result);
7172
7329
  } catch (error) {
@@ -7178,14 +7335,12 @@ async function updateThreadHandler(c2) {
7178
7335
  const mastra = c2.get("mastra");
7179
7336
  const agentId = c2.req.query("agentId");
7180
7337
  const threadId = c2.req.param("threadId");
7181
- const networkId = c2.req.query("networkId");
7182
7338
  const body = await c2.req.json();
7183
7339
  const result = await updateThreadHandler$1({
7184
7340
  mastra,
7185
7341
  agentId,
7186
7342
  threadId,
7187
- body,
7188
- networkId
7343
+ body
7189
7344
  });
7190
7345
  return c2.json(result);
7191
7346
  } catch (error) {
@@ -7197,12 +7352,10 @@ async function deleteThreadHandler(c2) {
7197
7352
  const mastra = c2.get("mastra");
7198
7353
  const agentId = c2.req.query("agentId");
7199
7354
  const threadId = c2.req.param("threadId");
7200
- const networkId = c2.req.query("networkId");
7201
7355
  const result = await deleteThreadHandler$1({
7202
7356
  mastra,
7203
7357
  agentId,
7204
- threadId,
7205
- networkId
7358
+ threadId
7206
7359
  });
7207
7360
  return c2.json(result);
7208
7361
  } catch (error) {
@@ -7213,14 +7366,12 @@ async function getMessagesHandler(c2) {
7213
7366
  try {
7214
7367
  const mastra = c2.get("mastra");
7215
7368
  const agentId = c2.req.query("agentId");
7216
- const networkId = c2.req.query("networkId");
7217
7369
  const threadId = c2.req.param("threadId");
7218
7370
  const limit = parseLimit(c2.req.query("limit"));
7219
7371
  const result = await getMessagesHandler$1({
7220
7372
  mastra,
7221
7373
  agentId,
7222
7374
  threadId,
7223
- networkId,
7224
7375
  limit
7225
7376
  });
7226
7377
  return c2.json(result);
@@ -7259,14 +7410,12 @@ async function updateWorkingMemoryHandler(c2) {
7259
7410
  const mastra = c2.get("mastra");
7260
7411
  const agentId = c2.req.query("agentId");
7261
7412
  const threadId = c2.req.param("threadId");
7262
- const networkId = c2.req.query("networkId");
7263
7413
  const body = await c2.req.json();
7264
7414
  const result = await updateWorkingMemoryHandler$1({
7265
7415
  mastra,
7266
7416
  agentId,
7267
7417
  threadId,
7268
- body,
7269
- networkId
7418
+ body
7270
7419
  });
7271
7420
  return c2.json(result);
7272
7421
  } catch (error) {
@@ -7279,13 +7428,11 @@ async function getWorkingMemoryHandler(c2) {
7279
7428
  const agentId = c2.req.query("agentId");
7280
7429
  const threadId = c2.req.param("threadId");
7281
7430
  const resourceId = c2.req.query("resourceId");
7282
- const networkId = c2.req.query("networkId");
7283
7431
  const result = await getWorkingMemoryHandler$1({
7284
7432
  mastra,
7285
7433
  agentId,
7286
7434
  threadId,
7287
- resourceId,
7288
- networkId
7435
+ resourceId
7289
7436
  });
7290
7437
  return c2.json(result);
7291
7438
  } catch (error) {
@@ -7301,7 +7448,6 @@ async function searchMemoryHandler(c2) {
7301
7448
  const threadId = c2.req.query("threadId");
7302
7449
  const limit = parseLimit(c2.req.query("limit"));
7303
7450
  const memoryConfig = c2.req.query("memoryConfig") ? JSON.parse(c2.req.query("memoryConfig")) : void 0;
7304
- const networkId = c2.req.query("networkId");
7305
7451
  const runtimeContext = c2.get("runtimeContext");
7306
7452
  const result = await searchMemoryHandler$1({
7307
7453
  mastra,
@@ -7311,7 +7457,6 @@ async function searchMemoryHandler(c2) {
7311
7457
  threadId,
7312
7458
  limit,
7313
7459
  memoryConfig,
7314
- networkId,
7315
7460
  runtimeContext
7316
7461
  });
7317
7462
  return c2.json(result);
@@ -7323,7 +7468,6 @@ async function deleteMessagesHandler(c2) {
7323
7468
  try {
7324
7469
  const mastra = c2.get("mastra");
7325
7470
  const agentId = c2.req.query("agentId");
7326
- const networkId = c2.req.query("networkId");
7327
7471
  const runtimeContext = c2.get("runtimeContext");
7328
7472
  const body = await c2.req.json();
7329
7473
  const messageIds = body?.messageIds;
@@ -7331,7 +7475,6 @@ async function deleteMessagesHandler(c2) {
7331
7475
  mastra,
7332
7476
  agentId,
7333
7477
  messageIds,
7334
- networkId,
7335
7478
  runtimeContext
7336
7479
  });
7337
7480
  return c2.json(result);
@@ -8512,447 +8655,70 @@ function memoryRoutes(bodyLimitOptions) {
8512
8655
  );
8513
8656
  return router;
8514
8657
  }
8515
- async function getVNextNetworksHandler(c2) {
8658
+ async function getAITraceHandler(c2) {
8516
8659
  try {
8517
8660
  const mastra = c2.get("mastra");
8518
- const runtimeContext = c2.get("runtimeContext");
8519
- const networks = await getVNextNetworksHandler$1({
8661
+ const traceId = c2.req.param("traceId");
8662
+ if (!traceId) {
8663
+ return c2.json({ error: "Trace ID is required" }, 400);
8664
+ }
8665
+ const trace = await getAITraceHandler$1({
8520
8666
  mastra,
8521
- runtimeContext
8667
+ traceId
8522
8668
  });
8523
- return c2.json(networks);
8669
+ return c2.json(trace);
8524
8670
  } catch (error) {
8525
- return handleError(error, "Error getting networks");
8671
+ return handleError(error, "Error getting AI trace");
8526
8672
  }
8527
8673
  }
8528
- async function getVNextNetworkByIdHandler(c2) {
8674
+ async function getAITracesPaginatedHandler(c2) {
8529
8675
  try {
8530
8676
  const mastra = c2.get("mastra");
8531
- const networkId = c2.req.param("networkId");
8532
- const runtimeContext = c2.get("runtimeContext");
8533
- const network = await getVNextNetworkByIdHandler$1({
8677
+ const { page, perPage, name, spanType, dateRange, entityId, entityType } = c2.req.query();
8678
+ const pagination = {
8679
+ page: parseInt(page || "0"),
8680
+ perPage: parseInt(perPage || "10")
8681
+ };
8682
+ const filters = {};
8683
+ if (name) filters.name = name;
8684
+ if (spanType) {
8685
+ if (Object.values(AISpanType).includes(spanType)) {
8686
+ filters.spanType = spanType;
8687
+ } else {
8688
+ return c2.json({ error: "Invalid spanType" }, 400);
8689
+ }
8690
+ }
8691
+ if (entityId && entityType && (entityType === "agent" || entityType === "workflow")) {
8692
+ filters.entityId = entityId;
8693
+ filters.entityType = entityType;
8694
+ }
8695
+ let start;
8696
+ let end;
8697
+ if (dateRange) {
8698
+ try {
8699
+ const parsedDateRange = JSON.parse(dateRange);
8700
+ start = parsedDateRange.start ? new Date(parsedDateRange.start) : void 0;
8701
+ end = parsedDateRange.end ? new Date(parsedDateRange.end) : void 0;
8702
+ } catch {
8703
+ return c2.json({ error: "Invalid start date" }, 400);
8704
+ }
8705
+ }
8706
+ if (start || end) {
8707
+ pagination.dateRange = { start, end };
8708
+ }
8709
+ const result = await getAITracesPaginatedHandler$1({
8534
8710
  mastra,
8535
- networkId,
8536
- runtimeContext
8711
+ body: {
8712
+ pagination,
8713
+ filters
8714
+ }
8537
8715
  });
8538
- return c2.json(network);
8716
+ return c2.json(result);
8539
8717
  } catch (error) {
8540
- return handleError(error, "Error getting network by ID");
8718
+ return handleError(error, "Error getting AI traces paginated");
8541
8719
  }
8542
8720
  }
8543
- async function generateVNextNetworkHandler(c2) {
8544
- try {
8545
- const mastra = c2.get("mastra");
8546
- const runtimeContext = c2.get("runtimeContext");
8547
- const networkId = c2.req.param("networkId");
8548
- const body = await c2.req.json();
8549
- const result = await generateVNextNetworkHandler$1({
8550
- mastra,
8551
- runtimeContext,
8552
- networkId,
8553
- body
8554
- });
8555
- return c2.json(result);
8556
- } catch (error) {
8557
- return handleError(error, "Error generating from network");
8558
- }
8559
- }
8560
- async function streamGenerateVNextNetworkHandler(c2) {
8561
- try {
8562
- const mastra = c2.get("mastra");
8563
- const runtimeContext = c2.get("runtimeContext");
8564
- const logger2 = mastra.getLogger();
8565
- const networkId = c2.req.param("networkId");
8566
- const body = await c2.req.json();
8567
- c2.header("Transfer-Encoding", "chunked");
8568
- return stream(
8569
- c2,
8570
- async (stream7) => {
8571
- try {
8572
- const result = await streamGenerateVNextNetworkHandler$1({
8573
- mastra,
8574
- runtimeContext,
8575
- networkId,
8576
- body
8577
- });
8578
- const reader = result.stream.getReader();
8579
- stream7.onAbort(() => {
8580
- void reader.cancel("request aborted");
8581
- });
8582
- let chunkResult;
8583
- while ((chunkResult = await reader.read()) && !chunkResult.done) {
8584
- await stream7.write(JSON.stringify(chunkResult.value) + "");
8585
- }
8586
- } catch (err) {
8587
- mastra.getLogger().error("Error in network stream: " + (err?.message ?? "Unknown error"));
8588
- }
8589
- },
8590
- async (err) => {
8591
- logger2.error("Error in network stream: " + err?.message);
8592
- }
8593
- );
8594
- } catch (error) {
8595
- return handleError(error, "Error streaming from network");
8596
- }
8597
- }
8598
- async function loopVNextNetworkHandler(c2) {
8599
- try {
8600
- const mastra = c2.get("mastra");
8601
- const runtimeContext = c2.get("runtimeContext");
8602
- const networkId = c2.req.param("networkId");
8603
- const body = await c2.req.json();
8604
- const result = await loopVNextNetworkHandler$1({
8605
- mastra,
8606
- runtimeContext,
8607
- networkId,
8608
- body
8609
- });
8610
- return c2.json(result);
8611
- } catch (error) {
8612
- return handleError(error, "Error looping from network");
8613
- }
8614
- }
8615
- async function loopStreamVNextNetworkHandler(c2) {
8616
- try {
8617
- const mastra = c2.get("mastra");
8618
- const runtimeContext = c2.get("runtimeContext");
8619
- const logger2 = mastra.getLogger();
8620
- const networkId = c2.req.param("networkId");
8621
- const body = await c2.req.json();
8622
- c2.header("Transfer-Encoding", "chunked");
8623
- return stream(
8624
- c2,
8625
- async (stream7) => {
8626
- try {
8627
- const result = await loopStreamVNextNetworkHandler$1({
8628
- mastra,
8629
- runtimeContext,
8630
- networkId,
8631
- body
8632
- });
8633
- const reader = result.stream.getReader();
8634
- stream7.onAbort(() => {
8635
- void reader.cancel("request aborted");
8636
- });
8637
- let chunkResult;
8638
- while ((chunkResult = await reader.read()) && !chunkResult.done) {
8639
- await stream7.write(JSON.stringify(chunkResult.value) + "");
8640
- }
8641
- } catch (err) {
8642
- mastra.getLogger().error("Error in network loop stream: " + (err?.message ?? "Unknown error"));
8643
- }
8644
- },
8645
- async (err) => {
8646
- logger2.error("Error in network loop stream: " + err?.message);
8647
- }
8648
- );
8649
- } catch (error) {
8650
- return handleError(error, "Error streaming network loop");
8651
- }
8652
- }
8653
-
8654
- // src/server/handlers/routes/networks/router.ts
8655
- function vNextNetworksRouter(bodyLimitOptions) {
8656
- const router = new Hono();
8657
- router.get(
8658
- "/v-next",
8659
- w({
8660
- description: "Get all available v-next networks",
8661
- tags: ["vNextNetworks"],
8662
- responses: {
8663
- 200: {
8664
- description: "List of all v-next networks"
8665
- }
8666
- }
8667
- }),
8668
- getVNextNetworksHandler
8669
- );
8670
- router.get(
8671
- "/v-next/:networkId",
8672
- w({
8673
- description: "Get v-next network by ID",
8674
- tags: ["vNextNetworks"],
8675
- parameters: [
8676
- {
8677
- name: "networkId",
8678
- in: "path",
8679
- required: true,
8680
- schema: { type: "string" }
8681
- }
8682
- ],
8683
- responses: {
8684
- 200: {
8685
- description: "v-next Network details"
8686
- },
8687
- 404: {
8688
- description: "v-next Network not found"
8689
- }
8690
- }
8691
- }),
8692
- getVNextNetworkByIdHandler
8693
- );
8694
- router.post(
8695
- "/v-next/:networkId/generate",
8696
- bodyLimit(bodyLimitOptions),
8697
- w({
8698
- description: "Generate a response from a v-next network",
8699
- tags: ["vNextNetworks"],
8700
- parameters: [
8701
- {
8702
- name: "networkId",
8703
- in: "path",
8704
- required: true,
8705
- schema: { type: "string" }
8706
- }
8707
- ],
8708
- requestBody: {
8709
- required: true,
8710
- content: {
8711
- "application/json": {
8712
- schema: {
8713
- type: "object",
8714
- properties: {
8715
- message: {
8716
- type: "string",
8717
- description: "Message for the v-next network"
8718
- },
8719
- threadId: {
8720
- type: "string",
8721
- description: "Thread Id of the conversation"
8722
- },
8723
- resourceId: {
8724
- type: "string",
8725
- description: "Resource Id of the conversation"
8726
- }
8727
- },
8728
- required: ["message"]
8729
- }
8730
- }
8731
- }
8732
- },
8733
- responses: {
8734
- 200: {
8735
- description: "Generated response"
8736
- },
8737
- 404: {
8738
- description: "v-next Network not found"
8739
- }
8740
- }
8741
- }),
8742
- generateVNextNetworkHandler
8743
- );
8744
- router.post(
8745
- "/v-next/:networkId/loop",
8746
- bodyLimit(bodyLimitOptions),
8747
- w({
8748
- description: "Loop a v-next network",
8749
- tags: ["vNextNetworks"],
8750
- parameters: [
8751
- {
8752
- name: "networkId",
8753
- in: "path",
8754
- required: true,
8755
- schema: { type: "string" }
8756
- }
8757
- ],
8758
- requestBody: {
8759
- required: true,
8760
- content: {
8761
- "application/json": {
8762
- schema: {
8763
- type: "object",
8764
- properties: {
8765
- message: {
8766
- type: "string",
8767
- description: "Message for the v-next network"
8768
- }
8769
- },
8770
- required: ["message"]
8771
- }
8772
- }
8773
- }
8774
- },
8775
- responses: {
8776
- 200: {
8777
- description: "Looped response"
8778
- },
8779
- 404: {
8780
- description: "v-next Network not found"
8781
- }
8782
- }
8783
- }),
8784
- loopVNextNetworkHandler
8785
- );
8786
- router.post(
8787
- "/v-next/:networkId/loop-stream",
8788
- bodyLimit(bodyLimitOptions),
8789
- w({
8790
- description: "Stream a v-next network loop",
8791
- tags: ["vNextNetworks"],
8792
- parameters: [
8793
- {
8794
- name: "networkId",
8795
- in: "path",
8796
- required: true,
8797
- schema: { type: "string" }
8798
- }
8799
- ],
8800
- requestBody: {
8801
- required: true,
8802
- content: {
8803
- "application/json": {
8804
- schema: {
8805
- type: "object",
8806
- properties: {
8807
- message: {
8808
- type: "string",
8809
- description: "Message for the v-next network"
8810
- },
8811
- threadId: {
8812
- type: "string",
8813
- description: "Thread Id of the conversation"
8814
- },
8815
- resourceId: {
8816
- type: "string",
8817
- description: "Resource Id of the conversation"
8818
- },
8819
- maxIterations: {
8820
- type: "number",
8821
- description: "Maximum number of iterations to run"
8822
- }
8823
- },
8824
- required: ["message"]
8825
- }
8826
- }
8827
- }
8828
- },
8829
- responses: {
8830
- 200: {
8831
- description: "Streamed response"
8832
- },
8833
- 404: {
8834
- description: "v-next Network not found"
8835
- }
8836
- }
8837
- }),
8838
- loopStreamVNextNetworkHandler
8839
- );
8840
- router.post(
8841
- "/v-next/:networkId/stream",
8842
- bodyLimit(bodyLimitOptions),
8843
- w({
8844
- description: "Stream a response from a v-next network",
8845
- tags: ["vNextNetworks"],
8846
- parameters: [
8847
- {
8848
- name: "networkId",
8849
- in: "path",
8850
- required: true,
8851
- schema: { type: "string" }
8852
- }
8853
- ],
8854
- requestBody: {
8855
- required: true,
8856
- content: {
8857
- "application/json": {
8858
- schema: {
8859
- type: "object",
8860
- properties: {
8861
- message: {
8862
- type: "string",
8863
- description: "Message for the v-next network"
8864
- },
8865
- threadId: {
8866
- type: "string",
8867
- description: "Thread Id of the conversation"
8868
- },
8869
- resourceId: {
8870
- type: "string",
8871
- description: "Resource Id of the conversation"
8872
- }
8873
- },
8874
- required: ["message"]
8875
- }
8876
- }
8877
- }
8878
- },
8879
- responses: {
8880
- 200: {
8881
- description: "Streamed response"
8882
- },
8883
- 404: {
8884
- description: "v-next Network not found"
8885
- }
8886
- }
8887
- }),
8888
- streamGenerateVNextNetworkHandler
8889
- );
8890
- return router;
8891
- }
8892
- async function getAITraceHandler(c2) {
8893
- try {
8894
- const mastra = c2.get("mastra");
8895
- const traceId = c2.req.param("traceId");
8896
- if (!traceId) {
8897
- return c2.json({ error: "Trace ID is required" }, 400);
8898
- }
8899
- const trace = await getAITraceHandler$1({
8900
- mastra,
8901
- traceId
8902
- });
8903
- return c2.json(trace);
8904
- } catch (error) {
8905
- return handleError(error, "Error getting AI trace");
8906
- }
8907
- }
8908
- async function getAITracesPaginatedHandler(c2) {
8909
- try {
8910
- const mastra = c2.get("mastra");
8911
- const { page, perPage, name, spanType, dateRange, entityId, entityType } = c2.req.query();
8912
- const pagination = {
8913
- page: parseInt(page || "0"),
8914
- perPage: parseInt(perPage || "10")
8915
- };
8916
- const filters = {};
8917
- if (name) filters.name = name;
8918
- if (spanType) {
8919
- if (Object.values(AISpanType).includes(spanType)) {
8920
- filters.spanType = spanType;
8921
- } else {
8922
- return c2.json({ error: "Invalid spanType" }, 400);
8923
- }
8924
- }
8925
- if (entityId && entityType && (entityType === "agent" || entityType === "workflow")) {
8926
- filters.entityId = entityId;
8927
- filters.entityType = entityType;
8928
- }
8929
- let start;
8930
- let end;
8931
- if (dateRange) {
8932
- try {
8933
- const parsedDateRange = JSON.parse(dateRange);
8934
- start = parsedDateRange.start ? new Date(parsedDateRange.start) : void 0;
8935
- end = parsedDateRange.end ? new Date(parsedDateRange.end) : void 0;
8936
- } catch {
8937
- return c2.json({ error: "Invalid start date" }, 400);
8938
- }
8939
- }
8940
- if (start || end) {
8941
- pagination.dateRange = { start, end };
8942
- }
8943
- const result = await getAITracesPaginatedHandler$1({
8944
- mastra,
8945
- body: {
8946
- pagination,
8947
- filters
8948
- }
8949
- });
8950
- return c2.json(result);
8951
- } catch (error) {
8952
- return handleError(error, "Error getting AI traces paginated");
8953
- }
8954
- }
8955
- async function processTraceScoringHandler(c2) {
8721
+ async function processTraceScoringHandler(c2) {
8956
8722
  try {
8957
8723
  const mastra = c2.get("mastra");
8958
8724
  const { scorerName, targets } = await c2.req.json();
@@ -10081,7 +9847,7 @@ function watchWorkflowHandler(c2) {
10081
9847
  c2.header("Transfer-Encoding", "chunked");
10082
9848
  return stream(
10083
9849
  c2,
10084
- async (stream7) => {
9850
+ async (stream6) => {
10085
9851
  try {
10086
9852
  const result = await watchWorkflowHandler$1({
10087
9853
  mastra,
@@ -10089,12 +9855,12 @@ function watchWorkflowHandler(c2) {
10089
9855
  runId
10090
9856
  });
10091
9857
  const reader = result.getReader();
10092
- stream7.onAbort(() => {
9858
+ stream6.onAbort(() => {
10093
9859
  void reader.cancel("request aborted");
10094
9860
  });
10095
9861
  let chunkResult;
10096
9862
  while ((chunkResult = await reader.read()) && !chunkResult.done) {
10097
- await stream7.write(JSON.stringify(chunkResult.value) + "");
9863
+ await stream6.write(JSON.stringify(chunkResult.value) + "");
10098
9864
  }
10099
9865
  } catch (err) {
10100
9866
  logger2.error("Error in watch stream: " + (err?.message ?? "Unknown error"));
@@ -10119,7 +9885,7 @@ async function streamWorkflowHandler(c2) {
10119
9885
  c2.header("Transfer-Encoding", "chunked");
10120
9886
  return stream(
10121
9887
  c2,
10122
- async (stream7) => {
9888
+ async (stream6) => {
10123
9889
  try {
10124
9890
  const result = await streamWorkflowHandler$1({
10125
9891
  mastra,
@@ -10130,17 +9896,17 @@ async function streamWorkflowHandler(c2) {
10130
9896
  tracingOptions
10131
9897
  });
10132
9898
  const reader = result.stream.getReader();
10133
- stream7.onAbort(() => {
9899
+ stream6.onAbort(() => {
10134
9900
  void reader.cancel("request aborted");
10135
9901
  });
10136
9902
  let chunkResult;
10137
9903
  while ((chunkResult = await reader.read()) && !chunkResult.done) {
10138
- await stream7.write(JSON.stringify(chunkResult.value) + "");
9904
+ await stream6.write(JSON.stringify(chunkResult.value) + "");
10139
9905
  }
10140
9906
  } catch (err) {
10141
9907
  logger2.error("Error in workflow stream: " + (err?.message ?? "Unknown error"));
10142
9908
  }
10143
- await stream7.close();
9909
+ await stream6.close();
10144
9910
  },
10145
9911
  async (err) => {
10146
9912
  logger2.error("Error in workflow stream: " + err?.message);
@@ -10162,7 +9928,7 @@ async function observeStreamWorkflowHandler(c2) {
10162
9928
  c2.header("Transfer-Encoding", "chunked");
10163
9929
  return stream(
10164
9930
  c2,
10165
- async (stream7) => {
9931
+ async (stream6) => {
10166
9932
  try {
10167
9933
  const result = await observeStreamWorkflowHandler$1({
10168
9934
  mastra,
@@ -10170,17 +9936,17 @@ async function observeStreamWorkflowHandler(c2) {
10170
9936
  runId
10171
9937
  });
10172
9938
  const reader = result.getReader();
10173
- stream7.onAbort(() => {
9939
+ stream6.onAbort(() => {
10174
9940
  void reader.cancel("request aborted");
10175
9941
  });
10176
9942
  let chunkResult;
10177
9943
  while ((chunkResult = await reader.read()) && !chunkResult.done) {
10178
- await stream7.write(JSON.stringify(chunkResult.value) + "");
9944
+ await stream6.write(JSON.stringify(chunkResult.value) + "");
10179
9945
  }
10180
9946
  } catch (err) {
10181
9947
  logger2.error("Error in workflow observe stream: " + (err?.message ?? "Unknown error"));
10182
9948
  }
10183
- await stream7.close();
9949
+ await stream6.close();
10184
9950
  },
10185
9951
  async (err) => {
10186
9952
  logger2.error("Error in workflow observe stream: " + err?.message);
@@ -10201,7 +9967,7 @@ async function streamVNextWorkflowHandler(c2) {
10201
9967
  c2.header("Transfer-Encoding", "chunked");
10202
9968
  return stream(
10203
9969
  c2,
10204
- async (stream7) => {
9970
+ async (stream6) => {
10205
9971
  try {
10206
9972
  const result = await streamVNextWorkflowHandler$1({
10207
9973
  mastra,
@@ -10213,12 +9979,12 @@ async function streamVNextWorkflowHandler(c2) {
10213
9979
  tracingOptions
10214
9980
  });
10215
9981
  const reader = result.getReader();
10216
- stream7.onAbort(() => {
9982
+ stream6.onAbort(() => {
10217
9983
  void reader.cancel("request aborted");
10218
9984
  });
10219
9985
  let chunkResult;
10220
9986
  while ((chunkResult = await reader.read()) && !chunkResult.done) {
10221
- await stream7.write(JSON.stringify(chunkResult.value) + "");
9987
+ await stream6.write(JSON.stringify(chunkResult.value) + "");
10222
9988
  }
10223
9989
  } catch (err) {
10224
9990
  logger2.error("Error in workflow VNext stream: " + (err?.message ?? "Unknown error"));
@@ -10232,6 +9998,42 @@ async function streamVNextWorkflowHandler(c2) {
10232
9998
  return handleError(error, "Error streaming workflow");
10233
9999
  }
10234
10000
  }
10001
+ async function observeStreamVNextWorkflowHandler(c2) {
10002
+ try {
10003
+ const mastra = c2.get("mastra");
10004
+ const logger2 = mastra.getLogger();
10005
+ const workflowId = c2.req.param("workflowId");
10006
+ const runId = c2.req.query("runId");
10007
+ c2.header("Transfer-Encoding", "chunked");
10008
+ return stream(
10009
+ c2,
10010
+ async (stream6) => {
10011
+ try {
10012
+ const result = await observeStreamVNextWorkflowHandler$1({
10013
+ mastra,
10014
+ workflowId,
10015
+ runId
10016
+ });
10017
+ const reader = result.getReader();
10018
+ stream6.onAbort(() => {
10019
+ void reader.cancel("request aborted");
10020
+ });
10021
+ let chunkResult;
10022
+ while ((chunkResult = await reader.read()) && !chunkResult.done) {
10023
+ await stream6.write(JSON.stringify(chunkResult.value) + "");
10024
+ }
10025
+ } catch (err) {
10026
+ logger2.error("Error in workflow VNext observe stream: " + (err?.message ?? "Unknown error"));
10027
+ }
10028
+ },
10029
+ async (err) => {
10030
+ logger2.error("Error in workflow VNext observe stream: " + err?.message);
10031
+ }
10032
+ );
10033
+ } catch (error) {
10034
+ return handleError(error, "Error observing vNext workflow stream");
10035
+ }
10036
+ }
10235
10037
  async function resumeStreamWorkflowHandler(c2) {
10236
10038
  try {
10237
10039
  const mastra = c2.get("mastra");
@@ -10243,7 +10045,7 @@ async function resumeStreamWorkflowHandler(c2) {
10243
10045
  c2.header("Transfer-Encoding", "chunked");
10244
10046
  return stream(
10245
10047
  c2,
10246
- async (stream7) => {
10048
+ async (stream6) => {
10247
10049
  try {
10248
10050
  const result = await resumeStreamWorkflowHandler$1({
10249
10051
  mastra,
@@ -10254,12 +10056,12 @@ async function resumeStreamWorkflowHandler(c2) {
10254
10056
  tracingOptions
10255
10057
  });
10256
10058
  const reader = result.getReader();
10257
- stream7.onAbort(() => {
10059
+ stream6.onAbort(() => {
10258
10060
  void reader.cancel("request aborted");
10259
10061
  });
10260
10062
  let chunkResult;
10261
10063
  while ((chunkResult = await reader.read()) && !chunkResult.done) {
10262
- await stream7.write(JSON.stringify(chunkResult.value) + "");
10064
+ await stream6.write(JSON.stringify(chunkResult.value) + "");
10263
10065
  }
10264
10066
  } catch (err) {
10265
10067
  logger2.error("Error in workflow VNext stream: " + (err?.message ?? "Unknown error"));
@@ -10489,20 +10291,20 @@ function watchLegacyWorkflowHandler(c2) {
10489
10291
  }
10490
10292
  return stream(
10491
10293
  c2,
10492
- async (stream7) => {
10294
+ async (stream6) => {
10493
10295
  try {
10494
10296
  const result = await watchLegacyWorkflowHandler$1({
10495
10297
  mastra,
10496
10298
  workflowId,
10497
10299
  runId
10498
10300
  });
10499
- stream7.onAbort(() => {
10301
+ stream6.onAbort(() => {
10500
10302
  if (!result.locked) {
10501
10303
  return result.cancel();
10502
10304
  }
10503
10305
  });
10504
10306
  for await (const chunk of result) {
10505
- await stream7.write(chunk.toString() + "");
10307
+ await stream6.write(chunk.toString() + "");
10506
10308
  }
10507
10309
  } catch (err) {
10508
10310
  console.error(err);
@@ -11296,6 +11098,36 @@ function workflowsRouter(bodyLimitOptions) {
11296
11098
  }),
11297
11099
  streamVNextWorkflowHandler
11298
11100
  );
11101
+ router.post(
11102
+ "/:workflowId/observe-streamVNext",
11103
+ w({
11104
+ description: "Observe workflow stream in real-time using the VNext streaming API",
11105
+ parameters: [
11106
+ {
11107
+ name: "workflowId",
11108
+ in: "path",
11109
+ required: true,
11110
+ schema: { type: "string" }
11111
+ },
11112
+ {
11113
+ name: "runId",
11114
+ in: "query",
11115
+ required: true,
11116
+ schema: { type: "string" }
11117
+ }
11118
+ ],
11119
+ responses: {
11120
+ 200: {
11121
+ description: "workflow stream vNext observed"
11122
+ },
11123
+ 404: {
11124
+ description: "workflow not found"
11125
+ }
11126
+ },
11127
+ tags: ["workflows"]
11128
+ }),
11129
+ observeStreamVNextWorkflowHandler
11130
+ );
11299
11131
  router.post(
11300
11132
  "/:workflowId/create-run",
11301
11133
  bodyLimit(bodyLimitOptions),
@@ -11974,7 +11806,6 @@ async function createHonoServer(mastra, options = {
11974
11806
  getModelProvidersHandler
11975
11807
  );
11976
11808
  app.route("/api/agents", agentsRouter(bodyLimitOptions));
11977
- app.route("/api/networks", vNextNetworksRouter(bodyLimitOptions));
11978
11809
  if (options.isDev) {
11979
11810
  app.route("/api/agents", agentsRouterDev(bodyLimitOptions));
11980
11811
  }