@mastra/client-js 0.0.0-vnextAgentNetwork-20250527111332 → 0.0.0-vnextAgentNetwork-20250602134426

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.
package/CHANGELOG.md CHANGED
@@ -1,11 +1,61 @@
1
1
  # @mastra/client-js
2
2
 
3
- ## 0.0.0-vnextAgentNetwork-20250527111332
3
+ ## 0.0.0-vnextAgentNetwork-20250602134426
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - 592a2db: Added different icons for agents and workflows in mcp tools list
8
+ - c5bf1ce: Add backwards compat code for new MessageList in storage
9
+ - f0d559f: Fix peerdeps for alpha channel
10
+ - Updated dependencies [ee77e78]
11
+ - Updated dependencies [592a2db]
12
+ - Updated dependencies [e5dc18d]
13
+ - Updated dependencies [ab5adbe]
14
+ - Updated dependencies [1e8bb40]
15
+ - Updated dependencies [195c428]
16
+ - Updated dependencies [f73e11b]
17
+ - Updated dependencies [c5bf1ce]
18
+ - Updated dependencies [12b7002]
19
+ - Updated dependencies [2901125]
20
+ - @mastra/core@0.0.0-vnextAgentNetwork-20250602134426
21
+
22
+ ## 0.10.2-alpha.2
23
+
24
+ ### Patch Changes
25
+
26
+ - c5bf1ce: Add backwards compat code for new MessageList in storage
27
+ - Updated dependencies [c5bf1ce]
28
+ - Updated dependencies [12b7002]
29
+ - @mastra/core@0.10.2-alpha.4
30
+
31
+ ## 0.10.2-alpha.1
32
+
33
+ ### Patch Changes
34
+
35
+ - f0d559f: Fix peerdeps for alpha channel
36
+ - Updated dependencies [1e8bb40]
37
+ - @mastra/core@0.10.2-alpha.2
38
+
39
+ ## 0.10.2-alpha.0
40
+
41
+ ### Patch Changes
42
+
43
+ - 592a2db: Added different icons for agents and workflows in mcp tools list
44
+ - Updated dependencies [592a2db]
45
+ - Updated dependencies [e5dc18d]
46
+ - @mastra/core@0.10.2-alpha.0
47
+
48
+ ## 0.10.1
49
+
50
+ ### Patch Changes
51
+
52
+ - 267773e: Show map config on workflow graph
53
+ Highlight borders for conditions too on workflow graph
54
+ Fix watch stream
7
55
  - 5343f93: Move emitter to symbol to make private
8
56
  - f622cfa: Make some properties of CreateMemoryThreadParams optional
57
+ - 6015bdf: Leverage defaultAgentStreamOption, defaultAgentGenerateOption in playground
58
+ - Updated dependencies [d70b807]
9
59
  - Updated dependencies [6d16390]
10
60
  - Updated dependencies [1e4a421]
11
61
  - Updated dependencies [200d0da]
@@ -14,7 +64,37 @@
14
64
  - Updated dependencies [38aee50]
15
65
  - Updated dependencies [5c41100]
16
66
  - Updated dependencies [d6a759b]
17
- - @mastra/core@0.0.0-vnextAgentNetwork-20250527111332
67
+ - Updated dependencies [6015bdf]
68
+ - @mastra/core@0.10.1
69
+
70
+ ## 0.10.1-alpha.3
71
+
72
+ ### Patch Changes
73
+
74
+ - 267773e: Show map config on workflow graph
75
+ Highlight borders for conditions too on workflow graph
76
+ Fix watch stream
77
+
78
+ ## 0.10.1-alpha.2
79
+
80
+ ### Patch Changes
81
+
82
+ - 6015bdf: Leverage defaultAgentStreamOption, defaultAgentGenerateOption in playground
83
+ - Updated dependencies [6015bdf]
84
+ - @mastra/core@0.10.1-alpha.2
85
+
86
+ ## 0.10.1-alpha.1
87
+
88
+ ### Patch Changes
89
+
90
+ - 5343f93: Move emitter to symbol to make private
91
+ - Updated dependencies [200d0da]
92
+ - Updated dependencies [bf5f17b]
93
+ - Updated dependencies [5343f93]
94
+ - Updated dependencies [38aee50]
95
+ - Updated dependencies [5c41100]
96
+ - Updated dependencies [d6a759b]
97
+ - @mastra/core@0.10.1-alpha.1
18
98
 
19
99
  ## 0.10.1-alpha.0
20
100
 
package/dist/index.cjs CHANGED
@@ -318,6 +318,13 @@ var AgentVoice = class extends BaseResource {
318
318
  getSpeakers() {
319
319
  return this.request(`/api/agents/${this.agentId}/voice/speakers`);
320
320
  }
321
+ /**
322
+ * Get the listener configuration for the agent's voice provider
323
+ * @returns Promise containing a check if the agent has listening capabilities
324
+ */
325
+ getListener() {
326
+ return this.request(`/api/agents/${this.agentId}/voice/listener`);
327
+ }
321
328
  };
322
329
  var Agent = class extends BaseResource {
323
330
  constructor(options, agentId) {
@@ -955,9 +962,9 @@ var Workflow = class extends BaseResource {
955
962
  });
956
963
  }
957
964
  /**
958
- * Starts a vNext workflow run and returns a stream
965
+ * Starts a workflow run and returns a stream
959
966
  * @param params - Object containing the optional runId, inputData and runtimeContext
960
- * @returns Promise containing the vNext workflow execution results
967
+ * @returns Promise containing the workflow execution results
961
968
  */
962
969
  async stream(params) {
963
970
  const searchParams = new URLSearchParams();
@@ -1033,7 +1040,11 @@ var Workflow = class extends BaseResource {
1033
1040
  throw new Error("Response body is null");
1034
1041
  }
1035
1042
  for await (const record of this.streamProcessor(response.body)) {
1036
- onRecord(record);
1043
+ if (typeof record === "string") {
1044
+ onRecord(JSON.parse(record));
1045
+ } else {
1046
+ onRecord(record);
1047
+ }
1037
1048
  }
1038
1049
  }
1039
1050
  /**
@@ -1169,6 +1180,83 @@ var MCPTool = class extends BaseResource {
1169
1180
  }
1170
1181
  };
1171
1182
 
1183
+ // src/resources/vNextNetwork.ts
1184
+ var RECORD_SEPARATOR3 = "";
1185
+ var VNextNetwork = class extends BaseResource {
1186
+ constructor(options, networkId) {
1187
+ super(options);
1188
+ this.networkId = networkId;
1189
+ }
1190
+ /**
1191
+ * Retrieves details about the network
1192
+ * @returns Promise containing vNext network details
1193
+ */
1194
+ details() {
1195
+ return this.request(`/api/networks/v-next/${this.networkId}`);
1196
+ }
1197
+ /**
1198
+ * Generates a response from the v-next network
1199
+ * @param params - Generation parameters including message
1200
+ * @returns Promise containing the generated response
1201
+ */
1202
+ generate(params) {
1203
+ return this.request(`/api/networks/${this.networkId}/generate`, {
1204
+ method: "POST",
1205
+ body: params
1206
+ });
1207
+ }
1208
+ /**
1209
+ * Generates a response from the v-next network
1210
+ * @param params - Generation parameters including message
1211
+ * @returns Promise containing the generated response
1212
+ */
1213
+ loop(params) {
1214
+ return this.request(`/api/networks/${this.networkId}/loop`, {
1215
+ method: "POST",
1216
+ body: params
1217
+ });
1218
+ }
1219
+ /**
1220
+ * Streams a response from the v-next network
1221
+ * @param params - Stream parameters including message
1222
+ * @returns Promise containing the results
1223
+ */
1224
+ async stream(params) {
1225
+ const response = await this.request(`/api/networks/v-next/${this.networkId}/stream`, {
1226
+ method: "POST",
1227
+ body: { message: params.message },
1228
+ stream: true
1229
+ });
1230
+ if (!response.ok) {
1231
+ throw new Error(`Failed to stream vNext network: ${response.statusText}`);
1232
+ }
1233
+ if (!response.body) {
1234
+ throw new Error("Response body is null");
1235
+ }
1236
+ const transformStream = new TransformStream({
1237
+ start() {
1238
+ },
1239
+ async transform(chunk, controller) {
1240
+ try {
1241
+ const decoded = new TextDecoder().decode(chunk);
1242
+ const chunks = decoded.split(RECORD_SEPARATOR3);
1243
+ for (const chunk2 of chunks) {
1244
+ if (chunk2) {
1245
+ try {
1246
+ const parsedChunk = JSON.parse(chunk2);
1247
+ controller.enqueue(parsedChunk);
1248
+ } catch {
1249
+ }
1250
+ }
1251
+ }
1252
+ } catch {
1253
+ }
1254
+ }
1255
+ });
1256
+ return response.body.pipeThrough(transformStream);
1257
+ }
1258
+ };
1259
+
1172
1260
  // src/client.ts
1173
1261
  var MastraClient = class extends BaseResource {
1174
1262
  constructor(options) {
@@ -1371,6 +1459,13 @@ var MastraClient = class extends BaseResource {
1371
1459
  getNetworks() {
1372
1460
  return this.request("/api/networks");
1373
1461
  }
1462
+ /**
1463
+ * Retrieves all available vNext networks
1464
+ * @returns Promise containing map of vNext network IDs to vNext network details
1465
+ */
1466
+ getVNextNetworks() {
1467
+ return this.request("/api/networks/v-next");
1468
+ }
1374
1469
  /**
1375
1470
  * Gets a network instance by ID
1376
1471
  * @param networkId - ID of the network to retrieve
@@ -1379,6 +1474,14 @@ var MastraClient = class extends BaseResource {
1379
1474
  getNetwork(networkId) {
1380
1475
  return new Network(this.options, networkId);
1381
1476
  }
1477
+ /**
1478
+ * Gets a vNext network instance by ID
1479
+ * @param networkId - ID of the vNext network to retrieve
1480
+ * @returns vNext Network instance
1481
+ */
1482
+ getVNextNetwork(networkId) {
1483
+ return new VNextNetwork(this.options, networkId);
1484
+ }
1382
1485
  /**
1383
1486
  * Retrieves a list of available MCP servers.
1384
1487
  * @param params - Optional parameters for pagination (limit, offset).
package/dist/index.d.cts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { AbstractAgent } from '@ag-ui/client';
2
- import { ServerInfo, ServerDetailInfo } from '@mastra/core/mcp';
2
+ import { ServerInfo, MCPToolType, ServerDetailInfo } from '@mastra/core/mcp';
3
3
  import { processDataStream } from '@ai-sdk/ui-utils';
4
- import { CoreMessage, AiMessageType, StorageThreadType, MessageType, LegacyWorkflowRuns, WorkflowRuns, QueryResult, GenerateReturn } from '@mastra/core';
4
+ import { CoreMessage, AiMessageType, StorageThreadType, MastraMessageV1, LegacyWorkflowRuns, WorkflowRuns, QueryResult, GenerateReturn } from '@mastra/core';
5
5
  import { JSONSchema7 } from 'json-schema';
6
6
  import { ZodSchema } from 'zod';
7
- import { BaseLogMessage } from '@mastra/core/logger';
8
7
  import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
8
+ import { BaseLogMessage } from '@mastra/core/logger';
9
9
  import { RuntimeContext } from '@mastra/core/runtime-context';
10
10
  import { Workflow as Workflow$1, WorkflowResult, WatchEvent } from '@mastra/core/workflows';
11
11
  import { StepAction, StepGraph, LegacyWorkflowRunResult as LegacyWorkflowRunResult$1 } from '@mastra/core/workflows/legacy';
@@ -43,6 +43,8 @@ interface GetAgentResponse {
43
43
  workflows: Record<string, GetWorkflowResponse>;
44
44
  provider: string;
45
45
  modelId: string;
46
+ defaultGenerateOptions: WithoutMethods<AgentGenerateOptions>;
47
+ defaultStreamOptions: WithoutMethods<AgentStreamOptions>;
46
48
  }
47
49
  type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
48
50
  messages: string | string[] | CoreMessage[] | AiMessageType[];
@@ -143,10 +145,10 @@ interface GetVectorIndexResponse {
143
145
  count: number;
144
146
  }
145
147
  interface SaveMessageToMemoryParams {
146
- messages: MessageType[];
148
+ messages: MastraMessageV1[];
147
149
  agentId: string;
148
150
  }
149
- type SaveMessageToMemoryResponse = MessageType[];
151
+ type SaveMessageToMemoryResponse = MastraMessageV1[];
150
152
  interface CreateMemoryThreadParams {
151
153
  title?: string;
152
154
  metadata?: Record<string, any>;
@@ -247,6 +249,39 @@ interface GetNetworkResponse {
247
249
  };
248
250
  state?: Record<string, any>;
249
251
  }
252
+ interface GetVNextNetworkResponse {
253
+ id: string;
254
+ name: string;
255
+ instructions: string;
256
+ agents: Array<{
257
+ name: string;
258
+ provider: string;
259
+ modelId: string;
260
+ }>;
261
+ routingModel: {
262
+ provider: string;
263
+ modelId: string;
264
+ };
265
+ workflows: Array<{
266
+ name: string;
267
+ description: string;
268
+ inputSchema: string | undefined;
269
+ outputSchema: string | undefined;
270
+ }>;
271
+ }
272
+ interface GenerateVNextNetworkResponse {
273
+ task: string;
274
+ result: string;
275
+ resourceId: string;
276
+ resourceType: 'none' | 'tool' | 'agent' | 'workflow';
277
+ }
278
+ interface LoopVNextNetworkResponse {
279
+ status: 'success';
280
+ result: {
281
+ text: string;
282
+ };
283
+ steps: WorkflowResult<any, any>['steps'];
284
+ }
250
285
  interface McpServerListResponse {
251
286
  servers: ServerInfo[];
252
287
  next: string | null;
@@ -257,6 +292,7 @@ interface McpToolInfo {
257
292
  name: string;
258
293
  description?: string;
259
294
  inputSchema: string;
295
+ toolType?: MCPToolType;
260
296
  }
261
297
  interface McpServerToolListResponse {
262
298
  tools: McpToolInfo[];
@@ -304,6 +340,13 @@ declare class AgentVoice extends BaseResource {
304
340
  voiceId: string;
305
341
  [key: string]: any;
306
342
  }>>;
343
+ /**
344
+ * Get the listener configuration for the agent's voice provider
345
+ * @returns Promise containing a check if the agent has listening capabilities
346
+ */
347
+ getListener(): Promise<{
348
+ enabled: boolean;
349
+ }>;
307
350
  }
308
351
  declare class Agent extends BaseResource {
309
352
  private agentId;
@@ -629,9 +672,9 @@ declare class Workflow extends BaseResource {
629
672
  runtimeContext?: RuntimeContext | Record<string, any>;
630
673
  }): Promise<WorkflowRunResult>;
631
674
  /**
632
- * Starts a vNext workflow run and returns a stream
675
+ * Starts a workflow run and returns a stream
633
676
  * @param params - Object containing the optional runId, inputData and runtimeContext
634
- * @returns Promise containing the vNext workflow execution results
677
+ * @returns Promise containing the workflow execution results
635
678
  */
636
679
  stream(params: {
637
680
  runId?: string;
@@ -732,6 +775,40 @@ declare class MCPTool extends BaseResource {
732
775
  }): Promise<any>;
733
776
  }
734
777
 
778
+ declare class VNextNetwork extends BaseResource {
779
+ private networkId;
780
+ constructor(options: ClientOptions, networkId: string);
781
+ /**
782
+ * Retrieves details about the network
783
+ * @returns Promise containing vNext network details
784
+ */
785
+ details(): Promise<GetVNextNetworkResponse>;
786
+ /**
787
+ * Generates a response from the v-next network
788
+ * @param params - Generation parameters including message
789
+ * @returns Promise containing the generated response
790
+ */
791
+ generate(params: {
792
+ message: string;
793
+ }): Promise<GenerateVNextNetworkResponse>;
794
+ /**
795
+ * Generates a response from the v-next network
796
+ * @param params - Generation parameters including message
797
+ * @returns Promise containing the generated response
798
+ */
799
+ loop(params: {
800
+ message: string;
801
+ }): Promise<LoopVNextNetworkResponse>;
802
+ /**
803
+ * Streams a response from the v-next network
804
+ * @param params - Stream parameters including message
805
+ * @returns Promise containing the results
806
+ */
807
+ stream(params: {
808
+ message: string;
809
+ }): Promise<stream_web.ReadableStream<any>>;
810
+ }
811
+
735
812
  declare class MastraClient extends BaseResource {
736
813
  constructor(options: ClientOptions);
737
814
  /**
@@ -848,12 +925,23 @@ declare class MastraClient extends BaseResource {
848
925
  * @returns Promise containing map of network IDs to network details
849
926
  */
850
927
  getNetworks(): Promise<Record<string, GetNetworkResponse>>;
928
+ /**
929
+ * Retrieves all available vNext networks
930
+ * @returns Promise containing map of vNext network IDs to vNext network details
931
+ */
932
+ getVNextNetworks(): Promise<Record<string, GetVNextNetworkResponse>>;
851
933
  /**
852
934
  * Gets a network instance by ID
853
935
  * @param networkId - ID of the network to retrieve
854
936
  * @returns Network instance
855
937
  */
856
938
  getNetwork(networkId: string): Network;
939
+ /**
940
+ * Gets a vNext network instance by ID
941
+ * @param networkId - ID of the vNext network to retrieve
942
+ * @returns vNext Network instance
943
+ */
944
+ getVNextNetwork(networkId: string): VNextNetwork;
857
945
  /**
858
946
  * Retrieves a list of available MCP servers.
859
947
  * @param params - Optional parameters for pagination (limit, offset).
@@ -894,4 +982,4 @@ declare class MastraClient extends BaseResource {
894
982
  getA2A(agentId: string): A2A;
895
983
  }
896
984
 
897
- export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
985
+ export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GenerateVNextNetworkResponse, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextNetworkResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, type LoopVNextNetworkResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { AbstractAgent } from '@ag-ui/client';
2
- import { ServerInfo, ServerDetailInfo } from '@mastra/core/mcp';
2
+ import { ServerInfo, MCPToolType, ServerDetailInfo } from '@mastra/core/mcp';
3
3
  import { processDataStream } from '@ai-sdk/ui-utils';
4
- import { CoreMessage, AiMessageType, StorageThreadType, MessageType, LegacyWorkflowRuns, WorkflowRuns, QueryResult, GenerateReturn } from '@mastra/core';
4
+ import { CoreMessage, AiMessageType, StorageThreadType, MastraMessageV1, LegacyWorkflowRuns, WorkflowRuns, QueryResult, GenerateReturn } from '@mastra/core';
5
5
  import { JSONSchema7 } from 'json-schema';
6
6
  import { ZodSchema } from 'zod';
7
- import { BaseLogMessage } from '@mastra/core/logger';
8
7
  import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
8
+ import { BaseLogMessage } from '@mastra/core/logger';
9
9
  import { RuntimeContext } from '@mastra/core/runtime-context';
10
10
  import { Workflow as Workflow$1, WorkflowResult, WatchEvent } from '@mastra/core/workflows';
11
11
  import { StepAction, StepGraph, LegacyWorkflowRunResult as LegacyWorkflowRunResult$1 } from '@mastra/core/workflows/legacy';
@@ -43,6 +43,8 @@ interface GetAgentResponse {
43
43
  workflows: Record<string, GetWorkflowResponse>;
44
44
  provider: string;
45
45
  modelId: string;
46
+ defaultGenerateOptions: WithoutMethods<AgentGenerateOptions>;
47
+ defaultStreamOptions: WithoutMethods<AgentStreamOptions>;
46
48
  }
47
49
  type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
48
50
  messages: string | string[] | CoreMessage[] | AiMessageType[];
@@ -143,10 +145,10 @@ interface GetVectorIndexResponse {
143
145
  count: number;
144
146
  }
145
147
  interface SaveMessageToMemoryParams {
146
- messages: MessageType[];
148
+ messages: MastraMessageV1[];
147
149
  agentId: string;
148
150
  }
149
- type SaveMessageToMemoryResponse = MessageType[];
151
+ type SaveMessageToMemoryResponse = MastraMessageV1[];
150
152
  interface CreateMemoryThreadParams {
151
153
  title?: string;
152
154
  metadata?: Record<string, any>;
@@ -247,6 +249,39 @@ interface GetNetworkResponse {
247
249
  };
248
250
  state?: Record<string, any>;
249
251
  }
252
+ interface GetVNextNetworkResponse {
253
+ id: string;
254
+ name: string;
255
+ instructions: string;
256
+ agents: Array<{
257
+ name: string;
258
+ provider: string;
259
+ modelId: string;
260
+ }>;
261
+ routingModel: {
262
+ provider: string;
263
+ modelId: string;
264
+ };
265
+ workflows: Array<{
266
+ name: string;
267
+ description: string;
268
+ inputSchema: string | undefined;
269
+ outputSchema: string | undefined;
270
+ }>;
271
+ }
272
+ interface GenerateVNextNetworkResponse {
273
+ task: string;
274
+ result: string;
275
+ resourceId: string;
276
+ resourceType: 'none' | 'tool' | 'agent' | 'workflow';
277
+ }
278
+ interface LoopVNextNetworkResponse {
279
+ status: 'success';
280
+ result: {
281
+ text: string;
282
+ };
283
+ steps: WorkflowResult<any, any>['steps'];
284
+ }
250
285
  interface McpServerListResponse {
251
286
  servers: ServerInfo[];
252
287
  next: string | null;
@@ -257,6 +292,7 @@ interface McpToolInfo {
257
292
  name: string;
258
293
  description?: string;
259
294
  inputSchema: string;
295
+ toolType?: MCPToolType;
260
296
  }
261
297
  interface McpServerToolListResponse {
262
298
  tools: McpToolInfo[];
@@ -304,6 +340,13 @@ declare class AgentVoice extends BaseResource {
304
340
  voiceId: string;
305
341
  [key: string]: any;
306
342
  }>>;
343
+ /**
344
+ * Get the listener configuration for the agent's voice provider
345
+ * @returns Promise containing a check if the agent has listening capabilities
346
+ */
347
+ getListener(): Promise<{
348
+ enabled: boolean;
349
+ }>;
307
350
  }
308
351
  declare class Agent extends BaseResource {
309
352
  private agentId;
@@ -629,9 +672,9 @@ declare class Workflow extends BaseResource {
629
672
  runtimeContext?: RuntimeContext | Record<string, any>;
630
673
  }): Promise<WorkflowRunResult>;
631
674
  /**
632
- * Starts a vNext workflow run and returns a stream
675
+ * Starts a workflow run and returns a stream
633
676
  * @param params - Object containing the optional runId, inputData and runtimeContext
634
- * @returns Promise containing the vNext workflow execution results
677
+ * @returns Promise containing the workflow execution results
635
678
  */
636
679
  stream(params: {
637
680
  runId?: string;
@@ -732,6 +775,40 @@ declare class MCPTool extends BaseResource {
732
775
  }): Promise<any>;
733
776
  }
734
777
 
778
+ declare class VNextNetwork extends BaseResource {
779
+ private networkId;
780
+ constructor(options: ClientOptions, networkId: string);
781
+ /**
782
+ * Retrieves details about the network
783
+ * @returns Promise containing vNext network details
784
+ */
785
+ details(): Promise<GetVNextNetworkResponse>;
786
+ /**
787
+ * Generates a response from the v-next network
788
+ * @param params - Generation parameters including message
789
+ * @returns Promise containing the generated response
790
+ */
791
+ generate(params: {
792
+ message: string;
793
+ }): Promise<GenerateVNextNetworkResponse>;
794
+ /**
795
+ * Generates a response from the v-next network
796
+ * @param params - Generation parameters including message
797
+ * @returns Promise containing the generated response
798
+ */
799
+ loop(params: {
800
+ message: string;
801
+ }): Promise<LoopVNextNetworkResponse>;
802
+ /**
803
+ * Streams a response from the v-next network
804
+ * @param params - Stream parameters including message
805
+ * @returns Promise containing the results
806
+ */
807
+ stream(params: {
808
+ message: string;
809
+ }): Promise<stream_web.ReadableStream<any>>;
810
+ }
811
+
735
812
  declare class MastraClient extends BaseResource {
736
813
  constructor(options: ClientOptions);
737
814
  /**
@@ -848,12 +925,23 @@ declare class MastraClient extends BaseResource {
848
925
  * @returns Promise containing map of network IDs to network details
849
926
  */
850
927
  getNetworks(): Promise<Record<string, GetNetworkResponse>>;
928
+ /**
929
+ * Retrieves all available vNext networks
930
+ * @returns Promise containing map of vNext network IDs to vNext network details
931
+ */
932
+ getVNextNetworks(): Promise<Record<string, GetVNextNetworkResponse>>;
851
933
  /**
852
934
  * Gets a network instance by ID
853
935
  * @param networkId - ID of the network to retrieve
854
936
  * @returns Network instance
855
937
  */
856
938
  getNetwork(networkId: string): Network;
939
+ /**
940
+ * Gets a vNext network instance by ID
941
+ * @param networkId - ID of the vNext network to retrieve
942
+ * @returns vNext Network instance
943
+ */
944
+ getVNextNetwork(networkId: string): VNextNetwork;
857
945
  /**
858
946
  * Retrieves a list of available MCP servers.
859
947
  * @param params - Optional parameters for pagination (limit, offset).
@@ -894,4 +982,4 @@ declare class MastraClient extends BaseResource {
894
982
  getA2A(agentId: string): A2A;
895
983
  }
896
984
 
897
- export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
985
+ export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GenerateVNextNetworkResponse, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextNetworkResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, type LoopVNextNetworkResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
package/dist/index.js CHANGED
@@ -312,6 +312,13 @@ var AgentVoice = class extends BaseResource {
312
312
  getSpeakers() {
313
313
  return this.request(`/api/agents/${this.agentId}/voice/speakers`);
314
314
  }
315
+ /**
316
+ * Get the listener configuration for the agent's voice provider
317
+ * @returns Promise containing a check if the agent has listening capabilities
318
+ */
319
+ getListener() {
320
+ return this.request(`/api/agents/${this.agentId}/voice/listener`);
321
+ }
315
322
  };
316
323
  var Agent = class extends BaseResource {
317
324
  constructor(options, agentId) {
@@ -949,9 +956,9 @@ var Workflow = class extends BaseResource {
949
956
  });
950
957
  }
951
958
  /**
952
- * Starts a vNext workflow run and returns a stream
959
+ * Starts a workflow run and returns a stream
953
960
  * @param params - Object containing the optional runId, inputData and runtimeContext
954
- * @returns Promise containing the vNext workflow execution results
961
+ * @returns Promise containing the workflow execution results
955
962
  */
956
963
  async stream(params) {
957
964
  const searchParams = new URLSearchParams();
@@ -1027,7 +1034,11 @@ var Workflow = class extends BaseResource {
1027
1034
  throw new Error("Response body is null");
1028
1035
  }
1029
1036
  for await (const record of this.streamProcessor(response.body)) {
1030
- onRecord(record);
1037
+ if (typeof record === "string") {
1038
+ onRecord(JSON.parse(record));
1039
+ } else {
1040
+ onRecord(record);
1041
+ }
1031
1042
  }
1032
1043
  }
1033
1044
  /**
@@ -1163,6 +1174,83 @@ var MCPTool = class extends BaseResource {
1163
1174
  }
1164
1175
  };
1165
1176
 
1177
+ // src/resources/vNextNetwork.ts
1178
+ var RECORD_SEPARATOR3 = "";
1179
+ var VNextNetwork = class extends BaseResource {
1180
+ constructor(options, networkId) {
1181
+ super(options);
1182
+ this.networkId = networkId;
1183
+ }
1184
+ /**
1185
+ * Retrieves details about the network
1186
+ * @returns Promise containing vNext network details
1187
+ */
1188
+ details() {
1189
+ return this.request(`/api/networks/v-next/${this.networkId}`);
1190
+ }
1191
+ /**
1192
+ * Generates a response from the v-next network
1193
+ * @param params - Generation parameters including message
1194
+ * @returns Promise containing the generated response
1195
+ */
1196
+ generate(params) {
1197
+ return this.request(`/api/networks/${this.networkId}/generate`, {
1198
+ method: "POST",
1199
+ body: params
1200
+ });
1201
+ }
1202
+ /**
1203
+ * Generates a response from the v-next network
1204
+ * @param params - Generation parameters including message
1205
+ * @returns Promise containing the generated response
1206
+ */
1207
+ loop(params) {
1208
+ return this.request(`/api/networks/${this.networkId}/loop`, {
1209
+ method: "POST",
1210
+ body: params
1211
+ });
1212
+ }
1213
+ /**
1214
+ * Streams a response from the v-next network
1215
+ * @param params - Stream parameters including message
1216
+ * @returns Promise containing the results
1217
+ */
1218
+ async stream(params) {
1219
+ const response = await this.request(`/api/networks/v-next/${this.networkId}/stream`, {
1220
+ method: "POST",
1221
+ body: { message: params.message },
1222
+ stream: true
1223
+ });
1224
+ if (!response.ok) {
1225
+ throw new Error(`Failed to stream vNext network: ${response.statusText}`);
1226
+ }
1227
+ if (!response.body) {
1228
+ throw new Error("Response body is null");
1229
+ }
1230
+ const transformStream = new TransformStream({
1231
+ start() {
1232
+ },
1233
+ async transform(chunk, controller) {
1234
+ try {
1235
+ const decoded = new TextDecoder().decode(chunk);
1236
+ const chunks = decoded.split(RECORD_SEPARATOR3);
1237
+ for (const chunk2 of chunks) {
1238
+ if (chunk2) {
1239
+ try {
1240
+ const parsedChunk = JSON.parse(chunk2);
1241
+ controller.enqueue(parsedChunk);
1242
+ } catch {
1243
+ }
1244
+ }
1245
+ }
1246
+ } catch {
1247
+ }
1248
+ }
1249
+ });
1250
+ return response.body.pipeThrough(transformStream);
1251
+ }
1252
+ };
1253
+
1166
1254
  // src/client.ts
1167
1255
  var MastraClient = class extends BaseResource {
1168
1256
  constructor(options) {
@@ -1365,6 +1453,13 @@ var MastraClient = class extends BaseResource {
1365
1453
  getNetworks() {
1366
1454
  return this.request("/api/networks");
1367
1455
  }
1456
+ /**
1457
+ * Retrieves all available vNext networks
1458
+ * @returns Promise containing map of vNext network IDs to vNext network details
1459
+ */
1460
+ getVNextNetworks() {
1461
+ return this.request("/api/networks/v-next");
1462
+ }
1368
1463
  /**
1369
1464
  * Gets a network instance by ID
1370
1465
  * @param networkId - ID of the network to retrieve
@@ -1373,6 +1468,14 @@ var MastraClient = class extends BaseResource {
1373
1468
  getNetwork(networkId) {
1374
1469
  return new Network(this.options, networkId);
1375
1470
  }
1471
+ /**
1472
+ * Gets a vNext network instance by ID
1473
+ * @param networkId - ID of the vNext network to retrieve
1474
+ * @returns vNext Network instance
1475
+ */
1476
+ getVNextNetwork(networkId) {
1477
+ return new VNextNetwork(this.options, networkId);
1478
+ }
1376
1479
  /**
1377
1480
  * Retrieves a list of available MCP servers.
1378
1481
  * @param params - Optional parameters for pagination (limit, offset).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/client-js",
3
- "version": "0.0.0-vnextAgentNetwork-20250527111332",
3
+ "version": "0.0.0-vnextAgentNetwork-20250602134426",
4
4
  "description": "The official TypeScript library for the Mastra Client API",
5
5
  "author": "",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "peerDependencies": {
33
33
  "zod": "^3.0.0",
34
- "@mastra/core": "^0.10.0"
34
+ "@mastra/core": "^0.10.0-alpha.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@babel/preset-env": "^7.26.9",
@@ -42,8 +42,8 @@
42
42
  "tsup": "^8.4.0",
43
43
  "typescript": "^5.8.2",
44
44
  "vitest": "^3.1.2",
45
- "@internal/lint": "0.0.0-vnextAgentNetwork-20250527111332",
46
- "@mastra/core": "0.0.0-vnextAgentNetwork-20250527111332"
45
+ "@internal/lint": "0.0.0-vnextAgentNetwork-20250602134426",
46
+ "@mastra/core": "0.0.0-vnextAgentNetwork-20250602134426"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsup src/index.ts --format esm,cjs --dts --clean --treeshake=smallest --splitting",
package/src/client.ts CHANGED
@@ -33,7 +33,9 @@ import type {
33
33
  McpServerListResponse,
34
34
  McpServerToolListResponse,
35
35
  GetLegacyWorkflowResponse,
36
+ GetVNextNetworkResponse,
36
37
  } from './types';
38
+ import { VNextNetwork } from './resources/vNextNetwork';
37
39
 
38
40
  export class MastraClient extends BaseResource {
39
41
  constructor(options: ClientOptions) {
@@ -262,6 +264,14 @@ export class MastraClient extends BaseResource {
262
264
  return this.request('/api/networks');
263
265
  }
264
266
 
267
+ /**
268
+ * Retrieves all available vNext networks
269
+ * @returns Promise containing map of vNext network IDs to vNext network details
270
+ */
271
+ public getVNextNetworks(): Promise<Record<string, GetVNextNetworkResponse>> {
272
+ return this.request('/api/networks/v-next');
273
+ }
274
+
265
275
  /**
266
276
  * Gets a network instance by ID
267
277
  * @param networkId - ID of the network to retrieve
@@ -271,6 +281,15 @@ export class MastraClient extends BaseResource {
271
281
  return new Network(this.options, networkId);
272
282
  }
273
283
 
284
+ /**
285
+ * Gets a vNext network instance by ID
286
+ * @param networkId - ID of the vNext network to retrieve
287
+ * @returns vNext Network instance
288
+ */
289
+ public getVNextNetwork(networkId: string) {
290
+ return new VNextNetwork(this.options, networkId);
291
+ }
292
+
274
293
  /**
275
294
  * Retrieves a list of available MCP servers.
276
295
  * @param params - Optional parameters for pagination (limit, offset).
@@ -70,6 +70,14 @@ export class AgentVoice extends BaseResource {
70
70
  getSpeakers(): Promise<Array<{ voiceId: string; [key: string]: any }>> {
71
71
  return this.request(`/api/agents/${this.agentId}/voice/speakers`);
72
72
  }
73
+
74
+ /**
75
+ * Get the listener configuration for the agent's voice provider
76
+ * @returns Promise containing a check if the agent has listening capabilities
77
+ */
78
+ getListener(): Promise<{ enabled: boolean }> {
79
+ return this.request(`/api/agents/${this.agentId}/voice/listener`);
80
+ }
73
81
  }
74
82
 
75
83
  export class Agent extends BaseResource {
@@ -1,10 +1,9 @@
1
1
  import { processDataStream } from '@ai-sdk/ui-utils';
2
2
  import type { GenerateReturn } from '@mastra/core';
3
3
  import type { JSONSchema7 } from 'json-schema';
4
- import { ZodSchema } from 'zod';
5
- import { zodToJsonSchema } from '../utils/zod-to-json-schema';
6
-
4
+ import type { ZodSchema } from 'zod';
7
5
  import type { GenerateParams, ClientOptions, StreamParams, GetNetworkResponse } from '../types';
6
+ import { zodToJsonSchema } from '../utils/zod-to-json-schema';
8
7
 
9
8
  import { BaseResource } from './base';
10
9
 
@@ -0,0 +1,103 @@
1
+ import type {
2
+ ClientOptions,
3
+ GetVNextNetworkResponse,
4
+ GenerateVNextNetworkResponse,
5
+ LoopVNextNetworkResponse,
6
+ } from '../types';
7
+
8
+ import { BaseResource } from './base';
9
+
10
+ const RECORD_SEPARATOR = '\x1E';
11
+
12
+ export class VNextNetwork extends BaseResource {
13
+ constructor(
14
+ options: ClientOptions,
15
+ private networkId: string,
16
+ ) {
17
+ super(options);
18
+ }
19
+
20
+ /**
21
+ * Retrieves details about the network
22
+ * @returns Promise containing vNext network details
23
+ */
24
+ details(): Promise<GetVNextNetworkResponse> {
25
+ return this.request(`/api/networks/v-next/${this.networkId}`);
26
+ }
27
+
28
+ /**
29
+ * Generates a response from the v-next network
30
+ * @param params - Generation parameters including message
31
+ * @returns Promise containing the generated response
32
+ */
33
+ generate(params: { message: string }): Promise<GenerateVNextNetworkResponse> {
34
+ return this.request(`/api/networks/${this.networkId}/generate`, {
35
+ method: 'POST',
36
+ body: params,
37
+ });
38
+ }
39
+
40
+ /**
41
+ * Generates a response from the v-next network
42
+ * @param params - Generation parameters including message
43
+ * @returns Promise containing the generated response
44
+ */
45
+ loop(params: { message: string }): Promise<LoopVNextNetworkResponse> {
46
+ return this.request(`/api/networks/${this.networkId}/loop`, {
47
+ method: 'POST',
48
+ body: params,
49
+ });
50
+ }
51
+
52
+ /**
53
+ * Streams a response from the v-next network
54
+ * @param params - Stream parameters including message
55
+ * @returns Promise containing the results
56
+ */
57
+ async stream(params: { message: string }) {
58
+ const response: Response = await this.request(`/api/networks/v-next/${this.networkId}/stream`, {
59
+ method: 'POST',
60
+ body: { message: params.message },
61
+ stream: true,
62
+ });
63
+
64
+ if (!response.ok) {
65
+ throw new Error(`Failed to stream vNext network: ${response.statusText}`);
66
+ }
67
+
68
+ if (!response.body) {
69
+ throw new Error('Response body is null');
70
+ }
71
+
72
+ // Create a transform stream that processes the response body
73
+ const transformStream = new TransformStream({
74
+ start() {},
75
+ async transform(chunk, controller) {
76
+ try {
77
+ // Decode binary data to text
78
+ const decoded = new TextDecoder().decode(chunk);
79
+
80
+ // Split by record separator
81
+ const chunks = decoded.split(RECORD_SEPARATOR);
82
+
83
+ // Process each chunk
84
+ for (const chunk of chunks) {
85
+ if (chunk) {
86
+ try {
87
+ const parsedChunk = JSON.parse(chunk);
88
+ controller.enqueue(parsedChunk);
89
+ } catch {
90
+ // Silently ignore parsing errors
91
+ }
92
+ }
93
+ }
94
+ } catch {
95
+ // Silently ignore processing errors
96
+ }
97
+ },
98
+ });
99
+
100
+ // Pipe the response body through the transform stream
101
+ return response.body.pipeThrough(transformStream);
102
+ }
103
+ }
@@ -217,9 +217,9 @@ export class Workflow extends BaseResource {
217
217
  }
218
218
 
219
219
  /**
220
- * Starts a vNext workflow run and returns a stream
220
+ * Starts a workflow run and returns a stream
221
221
  * @param params - Object containing the optional runId, inputData and runtimeContext
222
- * @returns Promise containing the vNext workflow execution results
222
+ * @returns Promise containing the workflow execution results
223
223
  */
224
224
  async stream(params: { runId?: string; inputData: Record<string, any>; runtimeContext?: RuntimeContext }) {
225
225
  const searchParams = new URLSearchParams();
@@ -319,7 +319,11 @@ export class Workflow extends BaseResource {
319
319
  }
320
320
 
321
321
  for await (const record of this.streamProcessor(response.body)) {
322
- onRecord(record);
322
+ if (typeof record === 'string') {
323
+ onRecord(JSON.parse(record));
324
+ } else {
325
+ onRecord(record);
326
+ }
323
327
  }
324
328
  }
325
329
 
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type {
2
- MessageType,
2
+ MastraMessageV1,
3
3
  AiMessageType,
4
4
  CoreMessage,
5
5
  QueryResult,
@@ -7,10 +7,10 @@ import type {
7
7
  WorkflowRuns,
8
8
  LegacyWorkflowRuns,
9
9
  } from '@mastra/core';
10
+ import type { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
10
11
  import type { BaseLogMessage } from '@mastra/core/logger';
11
12
 
12
- import type { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
13
- import type { ServerInfo } from '@mastra/core/mcp';
13
+ import type { MCPToolType, ServerInfo } from '@mastra/core/mcp';
14
14
  import type { RuntimeContext } from '@mastra/core/runtime-context';
15
15
  import type { Workflow, WatchEvent, WorkflowResult } from '@mastra/core/workflows';
16
16
  import type {
@@ -60,6 +60,8 @@ export interface GetAgentResponse {
60
60
  workflows: Record<string, GetWorkflowResponse>;
61
61
  provider: string;
62
62
  modelId: string;
63
+ defaultGenerateOptions: WithoutMethods<AgentGenerateOptions>;
64
+ defaultStreamOptions: WithoutMethods<AgentStreamOptions>;
63
65
  }
64
66
 
65
67
  export type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
@@ -170,11 +172,11 @@ export interface GetVectorIndexResponse {
170
172
  }
171
173
 
172
174
  export interface SaveMessageToMemoryParams {
173
- messages: MessageType[];
175
+ messages: MastraMessageV1[];
174
176
  agentId: string;
175
177
  }
176
178
 
177
- export type SaveMessageToMemoryResponse = MessageType[];
179
+ export type SaveMessageToMemoryResponse = MastraMessageV1[];
178
180
 
179
181
  export interface CreateMemoryThreadParams {
180
182
  title?: string;
@@ -293,6 +295,42 @@ export interface GetNetworkResponse {
293
295
  state?: Record<string, any>;
294
296
  }
295
297
 
298
+ export interface GetVNextNetworkResponse {
299
+ id: string;
300
+ name: string;
301
+ instructions: string;
302
+ agents: Array<{
303
+ name: string;
304
+ provider: string;
305
+ modelId: string;
306
+ }>;
307
+ routingModel: {
308
+ provider: string;
309
+ modelId: string;
310
+ };
311
+ workflows: Array<{
312
+ name: string;
313
+ description: string;
314
+ inputSchema: string | undefined;
315
+ outputSchema: string | undefined;
316
+ }>;
317
+ }
318
+
319
+ export interface GenerateVNextNetworkResponse {
320
+ task: string;
321
+ result: string;
322
+ resourceId: string;
323
+ resourceType: 'none' | 'tool' | 'agent' | 'workflow';
324
+ }
325
+
326
+ export interface LoopVNextNetworkResponse {
327
+ status: 'success';
328
+ result: {
329
+ text: string;
330
+ };
331
+ steps: WorkflowResult<any, any>['steps'];
332
+ }
333
+
296
334
  export interface McpServerListResponse {
297
335
  servers: ServerInfo[];
298
336
  next: string | null;
@@ -304,6 +342,7 @@ export interface McpToolInfo {
304
342
  name: string;
305
343
  description?: string;
306
344
  inputSchema: string;
345
+ toolType?: MCPToolType;
307
346
  }
308
347
 
309
348
  export interface McpServerToolListResponse {