@mastra/deployer 0.10.7-alpha.1 → 0.10.7-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,6 +30,7 @@ import { z } from 'zod';
30
30
  import { getTelemetryHandler as getTelemetryHandler$1, storeTelemetryHandler as storeTelemetryHandler$1 } from '@mastra/server/handlers/telemetry';
31
31
  import { executeAgentToolHandler as executeAgentToolHandler$1, getToolsHandler as getToolsHandler$1, getToolByIdHandler as getToolByIdHandler$1, executeToolHandler as executeToolHandler$1 } from '@mastra/server/handlers/tools';
32
32
  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';
33
+ import { getVNextNetworksHandler as getVNextNetworksHandler$1, getVNextNetworkByIdHandler as getVNextNetworkByIdHandler$1, generateVNextNetworkHandler as generateVNextNetworkHandler$1, loopVNextNetworkHandler as loopVNextNetworkHandler$1, streamGenerateVNextNetworkHandler as streamGenerateVNextNetworkHandler$1 } from '@mastra/server/handlers/vNextNetwork';
33
34
  import { getSpeakersHandler as getSpeakersHandler$1, generateSpeechHandler, getListenerHandler as getListenerHandler$1, transcribeSpeechHandler } from '@mastra/server/handlers/voice';
34
35
  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, resumeAsyncWorkflowHandler as resumeAsyncWorkflowHandler$1, streamWorkflowHandler as streamWorkflowHandler$1, createWorkflowRunHandler as createWorkflowRunHandler$1, startAsyncWorkflowHandler as startAsyncWorkflowHandler$1, startWorkflowRunHandler as startWorkflowRunHandler$1, watchWorkflowHandler as watchWorkflowHandler$1 } from '@mastra/server/handlers/workflows';
35
36
 
@@ -256,14 +257,14 @@ var Response2 = class _Response {
256
257
  });
257
258
  Object.setPrototypeOf(Response2, GlobalResponse);
258
259
  Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
259
- function writeFromReadableStream(stream4, writable) {
260
- if (stream4.locked) {
260
+ function writeFromReadableStream(stream5, writable) {
261
+ if (stream5.locked) {
261
262
  throw new TypeError("ReadableStream is locked.");
262
263
  } else if (writable.destroyed) {
263
- stream4.cancel();
264
+ stream5.cancel();
264
265
  return;
265
266
  }
266
- const reader = stream4.getReader();
267
+ const reader = stream5.getReader();
267
268
  writable.on("close", cancel);
268
269
  writable.on("error", cancel);
269
270
  reader.read().then(flow, cancel);
@@ -498,18 +499,18 @@ var ENCODINGS = {
498
499
  gzip: ".gz"
499
500
  };
500
501
  var ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS);
501
- var createStreamBody = (stream4) => {
502
+ var createStreamBody = (stream5) => {
502
503
  const body = new ReadableStream({
503
504
  start(controller) {
504
- stream4.on("data", (chunk) => {
505
+ stream5.on("data", (chunk) => {
505
506
  controller.enqueue(chunk);
506
507
  });
507
- stream4.on("end", () => {
508
+ stream5.on("end", () => {
508
509
  controller.close();
509
510
  });
510
511
  },
511
512
  cancel() {
512
- stream4.destroy();
513
+ stream5.destroy();
513
514
  }
514
515
  });
515
516
  return body;
@@ -605,10 +606,10 @@ var serveStatic = (options = { root: "" }) => {
605
606
  end = size - 1;
606
607
  }
607
608
  const chunksize = end - start + 1;
608
- const stream4 = createReadStream(path, { start, end });
609
+ const stream5 = createReadStream(path, { start, end });
609
610
  c2.header("Content-Length", chunksize.toString());
610
611
  c2.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
611
- return c2.body(createStreamBody(stream4), 206);
612
+ return c2.body(createStreamBody(stream5), 206);
612
613
  };
613
614
  };
614
615
  var RENDER_TYPE = {
@@ -729,7 +730,7 @@ var middleware = (options) => async (c2) => {
729
730
  );
730
731
  };
731
732
 
732
- // ../../node_modules/.pnpm/hono-openapi@0.4.8_hono@4.7.11_openapi-types@12.1.3_zod@3.25.57/node_modules/hono-openapi/utils.js
733
+ // ../../node_modules/.pnpm/hono-openapi@0.4.8_hono@4.8.1_openapi-types@12.1.3_zod@3.25.67/node_modules/hono-openapi/utils.js
733
734
  var e = Symbol("openapi");
734
735
  var n = ["GET", "PUT", "POST", "DELETE", "OPTIONS", "HEAD", "PATCH", "TRACE"];
735
736
  var s2 = (e2) => e2.charAt(0).toUpperCase() + e2.slice(1);
@@ -904,15 +905,15 @@ async function getAgentExecutionHandler(c2) {
904
905
  if (body.method === "tasks/sendSubscribe") {
905
906
  return stream(
906
907
  c2,
907
- async (stream4) => {
908
+ async (stream5) => {
908
909
  try {
909
- stream4.onAbort(() => {
910
+ stream5.onAbort(() => {
910
911
  if (!result.locked) {
911
912
  return result.cancel();
912
913
  }
913
914
  });
914
915
  for await (const chunk of result) {
915
- await stream4.write(JSON.stringify(chunk) + "");
916
+ await stream5.write(JSON.stringify(chunk) + "");
916
917
  }
917
918
  } catch (err) {
918
919
  logger2.error("Error in tasks/sendSubscribe stream: " + err?.message);
@@ -992,7 +993,8 @@ async function generateHandler(c2) {
992
993
  mastra,
993
994
  agentId,
994
995
  runtimeContext,
995
- body
996
+ body,
997
+ abortSignal: c2.req.raw.signal
996
998
  });
997
999
  return c2.json(result);
998
1000
  } catch (error) {
@@ -1009,7 +1011,8 @@ async function streamGenerateHandler(c2) {
1009
1011
  mastra,
1010
1012
  agentId,
1011
1013
  runtimeContext,
1012
- body
1014
+ body,
1015
+ abortSignal: c2.req.raw.signal
1013
1016
  });
1014
1017
  return streamResponse;
1015
1018
  } catch (error) {
@@ -1243,7 +1246,7 @@ var authorizationMiddleware = async (c2, next) => {
1243
1246
  // src/server/handlers/client.ts
1244
1247
  var clients = /* @__PURE__ */ new Set();
1245
1248
  function handleClientsRefresh(c2) {
1246
- const stream4 = new ReadableStream({
1249
+ const stream5 = new ReadableStream({
1247
1250
  start(controller) {
1248
1251
  clients.add(controller);
1249
1252
  controller.enqueue("data: connected\n\n");
@@ -1252,7 +1255,7 @@ function handleClientsRefresh(c2) {
1252
1255
  });
1253
1256
  }
1254
1257
  });
1255
- return new Response(stream4, {
1258
+ return new Response(stream5, {
1256
1259
  headers: {
1257
1260
  "Content-Type": "text/event-stream",
1258
1261
  "Cache-Control": "no-cache",
@@ -1359,20 +1362,20 @@ function watchLegacyWorkflowHandler(c2) {
1359
1362
  }
1360
1363
  return stream(
1361
1364
  c2,
1362
- async (stream4) => {
1365
+ async (stream5) => {
1363
1366
  try {
1364
1367
  const result = await watchLegacyWorkflowHandler$1({
1365
1368
  mastra,
1366
1369
  workflowId,
1367
1370
  runId
1368
1371
  });
1369
- stream4.onAbort(() => {
1372
+ stream5.onAbort(() => {
1370
1373
  if (!result.locked) {
1371
1374
  return result.cancel();
1372
1375
  }
1373
1376
  });
1374
1377
  for await (const chunk of result) {
1375
- await stream4.write(chunk.toString() + "");
1378
+ await stream5.write(chunk.toString() + "");
1376
1379
  }
1377
1380
  } catch (err) {
1378
1381
  console.log(err);
@@ -3570,9 +3573,11 @@ async function getMemoryStatusHandler(c2) {
3570
3573
  try {
3571
3574
  const mastra = c2.get("mastra");
3572
3575
  const agentId = c2.req.query("agentId");
3576
+ const networkId = c2.req.query("networkId");
3573
3577
  const result = await getMemoryStatusHandler$1({
3574
3578
  mastra,
3575
- agentId
3579
+ agentId,
3580
+ networkId
3576
3581
  });
3577
3582
  return c2.json(result);
3578
3583
  } catch (error) {
@@ -3584,10 +3589,12 @@ async function getThreadsHandler(c2) {
3584
3589
  const mastra = c2.get("mastra");
3585
3590
  const agentId = c2.req.query("agentId");
3586
3591
  const resourceId = c2.req.query("resourceid");
3592
+ const networkId = c2.req.query("networkId");
3587
3593
  const result = await getThreadsHandler$1({
3588
3594
  mastra,
3589
3595
  agentId,
3590
- resourceId
3596
+ resourceId,
3597
+ networkId
3591
3598
  });
3592
3599
  return c2.json(result);
3593
3600
  } catch (error) {
@@ -3599,10 +3606,12 @@ async function getThreadByIdHandler(c2) {
3599
3606
  const mastra = c2.get("mastra");
3600
3607
  const agentId = c2.req.query("agentId");
3601
3608
  const threadId = c2.req.param("threadId");
3609
+ const networkId = c2.req.query("networkId");
3602
3610
  const result = await getThreadByIdHandler$1({
3603
3611
  mastra,
3604
3612
  agentId,
3605
- threadId
3613
+ threadId,
3614
+ networkId
3606
3615
  });
3607
3616
  return c2.json(result);
3608
3617
  } catch (error) {
@@ -3613,11 +3622,13 @@ async function saveMessagesHandler(c2) {
3613
3622
  try {
3614
3623
  const mastra = c2.get("mastra");
3615
3624
  const agentId = c2.req.query("agentId");
3625
+ const networkId = c2.req.query("networkId");
3616
3626
  const body = await c2.req.json();
3617
3627
  const result = await saveMessagesHandler$1({
3618
3628
  mastra,
3619
3629
  agentId,
3620
- body
3630
+ body,
3631
+ networkId
3621
3632
  });
3622
3633
  return c2.json(result);
3623
3634
  } catch (error) {
@@ -3628,11 +3639,13 @@ async function createThreadHandler(c2) {
3628
3639
  try {
3629
3640
  const mastra = c2.get("mastra");
3630
3641
  const agentId = c2.req.query("agentId");
3642
+ const networkId = c2.req.query("networkId");
3631
3643
  const body = await c2.req.json();
3632
3644
  const result = await createThreadHandler$1({
3633
3645
  mastra,
3634
3646
  agentId,
3635
- body
3647
+ body,
3648
+ networkId
3636
3649
  });
3637
3650
  return c2.json(result);
3638
3651
  } catch (error) {
@@ -3644,12 +3657,14 @@ async function updateThreadHandler(c2) {
3644
3657
  const mastra = c2.get("mastra");
3645
3658
  const agentId = c2.req.query("agentId");
3646
3659
  const threadId = c2.req.param("threadId");
3660
+ const networkId = c2.req.query("networkId");
3647
3661
  const body = await c2.req.json();
3648
3662
  const result = await updateThreadHandler$1({
3649
3663
  mastra,
3650
3664
  agentId,
3651
3665
  threadId,
3652
- body
3666
+ body,
3667
+ networkId
3653
3668
  });
3654
3669
  return c2.json(result);
3655
3670
  } catch (error) {
@@ -3661,10 +3676,12 @@ async function deleteThreadHandler(c2) {
3661
3676
  const mastra = c2.get("mastra");
3662
3677
  const agentId = c2.req.query("agentId");
3663
3678
  const threadId = c2.req.param("threadId");
3679
+ const networkId = c2.req.query("networkId");
3664
3680
  const result = await deleteThreadHandler$1({
3665
3681
  mastra,
3666
3682
  agentId,
3667
- threadId
3683
+ threadId,
3684
+ networkId
3668
3685
  });
3669
3686
  return c2.json(result);
3670
3687
  } catch (error) {
@@ -3675,6 +3692,7 @@ async function getMessagesHandler(c2) {
3675
3692
  try {
3676
3693
  const mastra = c2.get("mastra");
3677
3694
  const agentId = c2.req.query("agentId");
3695
+ const networkId = c2.req.query("networkId");
3678
3696
  const threadId = c2.req.param("threadId");
3679
3697
  const rawLimit = c2.req.query("limit");
3680
3698
  let limit = void 0;
@@ -3688,6 +3706,7 @@ async function getMessagesHandler(c2) {
3688
3706
  mastra,
3689
3707
  agentId,
3690
3708
  threadId,
3709
+ networkId,
3691
3710
  limit
3692
3711
  });
3693
3712
  return c2.json(result);
@@ -4068,6 +4087,106 @@ async function deleteIndex(c2) {
4068
4087
  return handleError(error, "Error deleting index");
4069
4088
  }
4070
4089
  }
4090
+ async function getVNextNetworksHandler(c2) {
4091
+ try {
4092
+ const mastra = c2.get("mastra");
4093
+ const runtimeContext = c2.get("runtimeContext");
4094
+ const networks = await getVNextNetworksHandler$1({
4095
+ mastra,
4096
+ runtimeContext
4097
+ });
4098
+ return c2.json(networks);
4099
+ } catch (error) {
4100
+ return handleError(error, "Error getting networks");
4101
+ }
4102
+ }
4103
+ async function getVNextNetworkByIdHandler(c2) {
4104
+ try {
4105
+ const mastra = c2.get("mastra");
4106
+ const networkId = c2.req.param("networkId");
4107
+ const runtimeContext = c2.get("runtimeContext");
4108
+ const network = await getVNextNetworkByIdHandler$1({
4109
+ mastra,
4110
+ networkId,
4111
+ runtimeContext
4112
+ });
4113
+ return c2.json(network);
4114
+ } catch (error) {
4115
+ return handleError(error, "Error getting network by ID");
4116
+ }
4117
+ }
4118
+ async function generateVNextNetworkHandler(c2) {
4119
+ try {
4120
+ const mastra = c2.get("mastra");
4121
+ const runtimeContext = c2.get("runtimeContext");
4122
+ const networkId = c2.req.param("networkId");
4123
+ const body = await c2.req.json();
4124
+ const result = await generateVNextNetworkHandler$1({
4125
+ mastra,
4126
+ runtimeContext,
4127
+ networkId,
4128
+ body
4129
+ });
4130
+ return c2.json(result);
4131
+ } catch (error) {
4132
+ return handleError(error, "Error generating from network");
4133
+ }
4134
+ }
4135
+ async function streamGenerateVNextNetworkHandler(c2) {
4136
+ try {
4137
+ const mastra = c2.get("mastra");
4138
+ const runtimeContext = c2.get("runtimeContext");
4139
+ const logger2 = mastra.getLogger();
4140
+ const networkId = c2.req.param("networkId");
4141
+ const body = await c2.req.json();
4142
+ c2.header("Transfer-Encoding", "chunked");
4143
+ return stream(
4144
+ c2,
4145
+ async (stream5) => {
4146
+ try {
4147
+ const result = await streamGenerateVNextNetworkHandler$1({
4148
+ mastra,
4149
+ runtimeContext,
4150
+ networkId,
4151
+ body
4152
+ });
4153
+ const reader = result.stream.getReader();
4154
+ stream5.onAbort(() => {
4155
+ void reader.cancel("request aborted");
4156
+ });
4157
+ let chunkResult;
4158
+ while ((chunkResult = await reader.read()) && !chunkResult.done) {
4159
+ await stream5.write(JSON.stringify(chunkResult.value) + "");
4160
+ }
4161
+ } catch (err) {
4162
+ mastra.getLogger().error("Error in watch stream: " + (err?.message ?? "Unknown error"));
4163
+ }
4164
+ },
4165
+ async (err) => {
4166
+ logger2.error("Error in watch stream: " + err?.message);
4167
+ }
4168
+ );
4169
+ } catch (error) {
4170
+ return handleError(error, "Error streaming from network");
4171
+ }
4172
+ }
4173
+ async function loopVNextNetworkHandler(c2) {
4174
+ try {
4175
+ const mastra = c2.get("mastra");
4176
+ const runtimeContext = c2.get("runtimeContext");
4177
+ const networkId = c2.req.param("networkId");
4178
+ const body = await c2.req.json();
4179
+ const result = await loopVNextNetworkHandler$1({
4180
+ mastra,
4181
+ runtimeContext,
4182
+ networkId,
4183
+ body
4184
+ });
4185
+ return c2.json(result);
4186
+ } catch (error) {
4187
+ return handleError(error, "Error looping from network");
4188
+ }
4189
+ }
4071
4190
  async function getSpeakersHandler(c2) {
4072
4191
  try {
4073
4192
  const mastra = c2.get("mastra");
@@ -4182,8 +4301,9 @@ async function createWorkflowRunHandler(c2) {
4182
4301
  async function startAsyncWorkflowHandler(c2) {
4183
4302
  try {
4184
4303
  const mastra = c2.get("mastra");
4304
+ const runtimeContext = c2.get("runtimeContext");
4185
4305
  const workflowId = c2.req.param("workflowId");
4186
- const { inputData, runtimeContext } = await c2.req.json();
4306
+ const { inputData } = await c2.req.json();
4187
4307
  const runId = c2.req.query("runId");
4188
4308
  const result = await startAsyncWorkflowHandler$1({
4189
4309
  mastra,
@@ -4200,8 +4320,9 @@ async function startAsyncWorkflowHandler(c2) {
4200
4320
  async function startWorkflowRunHandler(c2) {
4201
4321
  try {
4202
4322
  const mastra = c2.get("mastra");
4323
+ const runtimeContext = c2.get("runtimeContext");
4203
4324
  const workflowId = c2.req.param("workflowId");
4204
- const { inputData, runtimeContext } = await c2.req.json();
4325
+ const { inputData } = await c2.req.json();
4205
4326
  const runId = c2.req.query("runId");
4206
4327
  await startWorkflowRunHandler$1({
4207
4328
  mastra,
@@ -4224,9 +4345,10 @@ function watchWorkflowHandler(c2) {
4224
4345
  if (!runId) {
4225
4346
  throw new HTTPException(400, { message: "runId required to watch workflow" });
4226
4347
  }
4348
+ c2.header("Transfer-Encoding", "chunked");
4227
4349
  return stream(
4228
4350
  c2,
4229
- async (stream4) => {
4351
+ async (stream5) => {
4230
4352
  try {
4231
4353
  const result = await watchWorkflowHandler$1({
4232
4354
  mastra,
@@ -4234,12 +4356,12 @@ function watchWorkflowHandler(c2) {
4234
4356
  runId
4235
4357
  });
4236
4358
  const reader = result.getReader();
4237
- stream4.onAbort(() => {
4359
+ stream5.onAbort(() => {
4238
4360
  void reader.cancel("request aborted");
4239
4361
  });
4240
4362
  let chunkResult;
4241
4363
  while ((chunkResult = await reader.read()) && !chunkResult.done) {
4242
- await stream4.write(JSON.stringify(chunkResult.value) + "");
4364
+ await stream5.write(JSON.stringify(chunkResult.value) + "");
4243
4365
  }
4244
4366
  } catch (err) {
4245
4367
  mastra.getLogger().error("Error in watch stream: " + (err?.message ?? "Unknown error"));
@@ -4256,13 +4378,15 @@ function watchWorkflowHandler(c2) {
4256
4378
  async function streamWorkflowHandler(c2) {
4257
4379
  try {
4258
4380
  const mastra = c2.get("mastra");
4381
+ const runtimeContext = c2.get("runtimeContext");
4259
4382
  const logger2 = mastra.getLogger();
4260
4383
  const workflowId = c2.req.param("workflowId");
4261
- const { inputData, runtimeContext } = await c2.req.json();
4384
+ const { inputData } = await c2.req.json();
4262
4385
  const runId = c2.req.query("runId");
4386
+ c2.header("Transfer-Encoding", "chunked");
4263
4387
  return stream(
4264
4388
  c2,
4265
- async (stream4) => {
4389
+ async (stream5) => {
4266
4390
  try {
4267
4391
  const result = await streamWorkflowHandler$1({
4268
4392
  mastra,
@@ -4272,12 +4396,12 @@ async function streamWorkflowHandler(c2) {
4272
4396
  runtimeContext
4273
4397
  });
4274
4398
  const reader = result.stream.getReader();
4275
- stream4.onAbort(() => {
4399
+ stream5.onAbort(() => {
4276
4400
  void reader.cancel("request aborted");
4277
4401
  });
4278
4402
  let chunkResult;
4279
4403
  while ((chunkResult = await reader.read()) && !chunkResult.done) {
4280
- await stream4.write(JSON.stringify(chunkResult.value) + "");
4404
+ await stream5.write(JSON.stringify(chunkResult.value) + "");
4281
4405
  }
4282
4406
  } catch (err) {
4283
4407
  console.log(err);
@@ -4294,9 +4418,10 @@ async function streamWorkflowHandler(c2) {
4294
4418
  async function resumeAsyncWorkflowHandler(c2) {
4295
4419
  try {
4296
4420
  const mastra = c2.get("mastra");
4421
+ const runtimeContext = c2.get("runtimeContext");
4297
4422
  const workflowId = c2.req.param("workflowId");
4298
4423
  const runId = c2.req.query("runId");
4299
- const { step, resumeData, runtimeContext } = await c2.req.json();
4424
+ const { step, resumeData } = await c2.req.json();
4300
4425
  if (!runId) {
4301
4426
  throw new HTTPException(400, { message: "runId required to resume workflow" });
4302
4427
  }
@@ -4315,9 +4440,10 @@ async function resumeAsyncWorkflowHandler(c2) {
4315
4440
  async function resumeWorkflowHandler(c2) {
4316
4441
  try {
4317
4442
  const mastra = c2.get("mastra");
4443
+ const runtimeContext = c2.get("runtimeContext");
4318
4444
  const workflowId = c2.req.param("workflowId");
4319
4445
  const runId = c2.req.query("runId");
4320
- const { step, resumeData, runtimeContext } = await c2.req.json();
4446
+ const { step, resumeData } = await c2.req.json();
4321
4447
  if (!runId) {
4322
4448
  throw new HTTPException(400, { message: "runId required to resume workflow" });
4323
4449
  }
@@ -4792,6 +4918,185 @@ ${err.stack.split("\n").slice(1).join("\n")}
4792
4918
  }),
4793
4919
  getAgentsHandler
4794
4920
  );
4921
+ app.get(
4922
+ "/api/networks/v-next",
4923
+ w({
4924
+ description: "Get all available v-next networks",
4925
+ tags: ["vNextNetworks"],
4926
+ responses: {
4927
+ 200: {
4928
+ description: "List of all v-next networks"
4929
+ }
4930
+ }
4931
+ }),
4932
+ getVNextNetworksHandler
4933
+ );
4934
+ app.get(
4935
+ "/api/networks/v-next/:networkId",
4936
+ w({
4937
+ description: "Get v-next network by ID",
4938
+ tags: ["vNextNetworks"],
4939
+ parameters: [
4940
+ {
4941
+ name: "networkId",
4942
+ in: "path",
4943
+ required: true,
4944
+ schema: { type: "string" }
4945
+ }
4946
+ ],
4947
+ responses: {
4948
+ 200: {
4949
+ description: "v-next Network details"
4950
+ },
4951
+ 404: {
4952
+ description: "v-next Network not found"
4953
+ }
4954
+ }
4955
+ }),
4956
+ getVNextNetworkByIdHandler
4957
+ );
4958
+ app.post(
4959
+ "/api/networks/v-next/:networkId/generate",
4960
+ bodyLimit(bodyLimitOptions),
4961
+ w({
4962
+ description: "Generate a response from a v-next network",
4963
+ tags: ["vNextNetworks"],
4964
+ parameters: [
4965
+ {
4966
+ name: "networkId",
4967
+ in: "path",
4968
+ required: true,
4969
+ schema: { type: "string" }
4970
+ }
4971
+ ],
4972
+ requestBody: {
4973
+ required: true,
4974
+ content: {
4975
+ "application/json": {
4976
+ schema: {
4977
+ type: "object",
4978
+ properties: {
4979
+ message: {
4980
+ type: "string",
4981
+ description: "Message for the v-next network"
4982
+ },
4983
+ threadId: {
4984
+ type: "string",
4985
+ description: "Thread Id of the conversation"
4986
+ },
4987
+ resourceId: {
4988
+ type: "string",
4989
+ description: "Resource Id of the conversation"
4990
+ }
4991
+ },
4992
+ required: ["message"]
4993
+ }
4994
+ }
4995
+ }
4996
+ },
4997
+ responses: {
4998
+ 200: {
4999
+ description: "Generated response"
5000
+ },
5001
+ 404: {
5002
+ description: "v-next Network not found"
5003
+ }
5004
+ }
5005
+ }),
5006
+ generateVNextNetworkHandler
5007
+ );
5008
+ app.post(
5009
+ "/api/networks/v-next/:networkId/loop",
5010
+ bodyLimit(bodyLimitOptions),
5011
+ w({
5012
+ description: "Loop a v-next network",
5013
+ tags: ["vNextNetworks"],
5014
+ parameters: [
5015
+ {
5016
+ name: "networkId",
5017
+ in: "path",
5018
+ required: true,
5019
+ schema: { type: "string" }
5020
+ }
5021
+ ],
5022
+ requestBody: {
5023
+ required: true,
5024
+ content: {
5025
+ "application/json": {
5026
+ schema: {
5027
+ type: "object",
5028
+ properties: {
5029
+ message: {
5030
+ type: "string",
5031
+ description: "Message for the v-next network"
5032
+ }
5033
+ },
5034
+ required: ["message"]
5035
+ }
5036
+ }
5037
+ }
5038
+ },
5039
+ responses: {
5040
+ 200: {
5041
+ description: "Looped response"
5042
+ },
5043
+ 404: {
5044
+ description: "v-next Network not found"
5045
+ }
5046
+ }
5047
+ }),
5048
+ loopVNextNetworkHandler
5049
+ );
5050
+ app.post(
5051
+ "/api/networks/v-next/:networkId/stream",
5052
+ bodyLimit(bodyLimitOptions),
5053
+ w({
5054
+ description: "Generate a response from a v-next network",
5055
+ tags: ["vNextNetworks"],
5056
+ parameters: [
5057
+ {
5058
+ name: "networkId",
5059
+ in: "path",
5060
+ required: true,
5061
+ schema: { type: "string" }
5062
+ }
5063
+ ],
5064
+ requestBody: {
5065
+ required: true,
5066
+ content: {
5067
+ "application/json": {
5068
+ schema: {
5069
+ type: "object",
5070
+ properties: {
5071
+ message: {
5072
+ type: "string",
5073
+ description: "Message for the v-next network"
5074
+ },
5075
+ threadId: {
5076
+ type: "string",
5077
+ description: "Thread Id of the conversation"
5078
+ },
5079
+ resourceId: {
5080
+ type: "string",
5081
+ description: "Resource Id of the conversation"
5082
+ }
5083
+ },
5084
+ required: ["message"]
5085
+ }
5086
+ }
5087
+ }
5088
+ },
5089
+ responses: {
5090
+ 200: {
5091
+ description: "Generated response"
5092
+ },
5093
+ 404: {
5094
+ description: "v-next Network not found"
5095
+ }
5096
+ }
5097
+ }),
5098
+ streamGenerateVNextNetworkHandler
5099
+ );
4795
5100
  app.get(
4796
5101
  "/api/networks",
4797
5102
  w({
@@ -6070,6 +6375,263 @@ ${err.stack.split("\n").slice(1).join("\n")}
6070
6375
  }),
6071
6376
  executeMcpServerToolHandler
6072
6377
  );
6378
+ app.get(
6379
+ "/api/memory/network/status",
6380
+ w({
6381
+ description: "Get network memory status",
6382
+ tags: ["networkMemory"],
6383
+ parameters: [
6384
+ {
6385
+ name: "networkId",
6386
+ in: "query",
6387
+ required: true,
6388
+ schema: { type: "string" }
6389
+ }
6390
+ ],
6391
+ responses: {
6392
+ 200: {
6393
+ description: "Memory status"
6394
+ }
6395
+ }
6396
+ }),
6397
+ getMemoryStatusHandler
6398
+ );
6399
+ app.get(
6400
+ "/api/memory/network/threads",
6401
+ w({
6402
+ description: "Get all threads",
6403
+ tags: ["networkMemory"],
6404
+ parameters: [
6405
+ {
6406
+ name: "resourceid",
6407
+ in: "query",
6408
+ required: true,
6409
+ schema: { type: "string" }
6410
+ },
6411
+ {
6412
+ name: "networkId",
6413
+ in: "query",
6414
+ required: true,
6415
+ schema: { type: "string" }
6416
+ }
6417
+ ],
6418
+ responses: {
6419
+ 200: {
6420
+ description: "List of all threads"
6421
+ }
6422
+ }
6423
+ }),
6424
+ getThreadsHandler
6425
+ );
6426
+ app.get(
6427
+ "/api/memory/network/threads/:threadId",
6428
+ w({
6429
+ description: "Get thread by ID",
6430
+ tags: ["networkMemory"],
6431
+ parameters: [
6432
+ {
6433
+ name: "threadId",
6434
+ in: "path",
6435
+ required: true,
6436
+ schema: { type: "string" }
6437
+ },
6438
+ {
6439
+ name: "networkId",
6440
+ in: "query",
6441
+ required: true,
6442
+ schema: { type: "string" }
6443
+ }
6444
+ ],
6445
+ responses: {
6446
+ 200: {
6447
+ description: "Thread details"
6448
+ },
6449
+ 404: {
6450
+ description: "Thread not found"
6451
+ }
6452
+ }
6453
+ }),
6454
+ getThreadByIdHandler
6455
+ );
6456
+ app.get(
6457
+ "/api/memory/network/threads/:threadId/messages",
6458
+ w({
6459
+ description: "Get messages for a thread",
6460
+ tags: ["networkMemory"],
6461
+ parameters: [
6462
+ {
6463
+ name: "threadId",
6464
+ in: "path",
6465
+ required: true,
6466
+ schema: { type: "string" }
6467
+ },
6468
+ {
6469
+ name: "networkId",
6470
+ in: "query",
6471
+ required: true,
6472
+ schema: { type: "string" }
6473
+ },
6474
+ {
6475
+ name: "limit",
6476
+ in: "query",
6477
+ required: false,
6478
+ schema: { type: "number" },
6479
+ description: "Limit the number of messages to retrieve (default: 40)"
6480
+ }
6481
+ ],
6482
+ responses: {
6483
+ 200: {
6484
+ description: "List of messages"
6485
+ }
6486
+ }
6487
+ }),
6488
+ getMessagesHandler
6489
+ );
6490
+ app.post(
6491
+ "/api/memory/network/threads",
6492
+ bodyLimit(bodyLimitOptions),
6493
+ w({
6494
+ description: "Create a new thread",
6495
+ tags: ["networkMemory"],
6496
+ parameters: [
6497
+ {
6498
+ name: "networkId",
6499
+ in: "query",
6500
+ required: true,
6501
+ schema: { type: "string" }
6502
+ }
6503
+ ],
6504
+ requestBody: {
6505
+ required: true,
6506
+ content: {
6507
+ "application/json": {
6508
+ schema: {
6509
+ type: "object",
6510
+ properties: {
6511
+ title: { type: "string" },
6512
+ metadata: { type: "object" },
6513
+ resourceId: { type: "string" },
6514
+ threadId: { type: "string" }
6515
+ }
6516
+ }
6517
+ }
6518
+ }
6519
+ },
6520
+ responses: {
6521
+ 200: {
6522
+ description: "Created thread"
6523
+ }
6524
+ }
6525
+ }),
6526
+ createThreadHandler
6527
+ );
6528
+ app.patch(
6529
+ "/api/memory/network/threads/:threadId",
6530
+ w({
6531
+ description: "Update a thread",
6532
+ tags: ["networkMemory"],
6533
+ parameters: [
6534
+ {
6535
+ name: "threadId",
6536
+ in: "path",
6537
+ required: true,
6538
+ schema: { type: "string" }
6539
+ },
6540
+ {
6541
+ name: "networkId",
6542
+ in: "query",
6543
+ required: true,
6544
+ schema: { type: "string" }
6545
+ }
6546
+ ],
6547
+ requestBody: {
6548
+ required: true,
6549
+ content: {
6550
+ "application/json": {
6551
+ schema: { type: "object" }
6552
+ }
6553
+ }
6554
+ },
6555
+ responses: {
6556
+ 200: {
6557
+ description: "Updated thread"
6558
+ },
6559
+ 404: {
6560
+ description: "Thread not found"
6561
+ }
6562
+ }
6563
+ }),
6564
+ updateThreadHandler
6565
+ );
6566
+ app.delete(
6567
+ "/api/memory/network/threads/:threadId",
6568
+ w({
6569
+ description: "Delete a thread",
6570
+ tags: ["networkMemory"],
6571
+ parameters: [
6572
+ {
6573
+ name: "threadId",
6574
+ in: "path",
6575
+ required: true,
6576
+ schema: { type: "string" }
6577
+ },
6578
+ {
6579
+ name: "networkId",
6580
+ in: "query",
6581
+ required: true,
6582
+ schema: { type: "string" }
6583
+ }
6584
+ ],
6585
+ responses: {
6586
+ 200: {
6587
+ description: "Thread deleted"
6588
+ },
6589
+ 404: {
6590
+ description: "Thread not found"
6591
+ }
6592
+ }
6593
+ }),
6594
+ deleteThreadHandler
6595
+ );
6596
+ app.post(
6597
+ "/api/memory/network/save-messages",
6598
+ bodyLimit(bodyLimitOptions),
6599
+ w({
6600
+ description: "Save messages",
6601
+ tags: ["networkMemory"],
6602
+ parameters: [
6603
+ {
6604
+ name: "networkId",
6605
+ in: "query",
6606
+ required: true,
6607
+ schema: { type: "string" }
6608
+ }
6609
+ ],
6610
+ requestBody: {
6611
+ required: true,
6612
+ content: {
6613
+ "application/json": {
6614
+ schema: {
6615
+ type: "object",
6616
+ properties: {
6617
+ messages: {
6618
+ type: "array",
6619
+ items: { type: "object" }
6620
+ }
6621
+ },
6622
+ required: ["messages"]
6623
+ }
6624
+ }
6625
+ }
6626
+ },
6627
+ responses: {
6628
+ 200: {
6629
+ description: "Messages saved"
6630
+ }
6631
+ }
6632
+ }),
6633
+ saveMessagesHandler
6634
+ );
6073
6635
  app.get(
6074
6636
  "/api/memory/status",
6075
6637
  w({