@mastra/client-js 0.0.0-bundle-dynamic-imports-20250424001248 → 0.0.0-cloud-transporter-20250513033346

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/dist/index.cjs CHANGED
@@ -1,10 +1,206 @@
1
1
  'use strict';
2
2
 
3
- var zod = require('zod');
4
- var zodToJsonSchema = require('zod-to-json-schema');
3
+ var client = require('@ag-ui/client');
4
+ var rxjs = require('rxjs');
5
5
  var uiUtils = require('@ai-sdk/ui-utils');
6
+ var zod = require('zod');
7
+ var originalZodToJsonSchema = require('zod-to-json-schema');
6
8
 
7
- // src/resources/agent.ts
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
+
11
+ var originalZodToJsonSchema__default = /*#__PURE__*/_interopDefault(originalZodToJsonSchema);
12
+
13
+ // src/adapters/agui.ts
14
+ var AGUIAdapter = class extends client.AbstractAgent {
15
+ agent;
16
+ resourceId;
17
+ constructor({ agent, agentId, resourceId, ...rest }) {
18
+ super({
19
+ agentId,
20
+ ...rest
21
+ });
22
+ this.agent = agent;
23
+ this.resourceId = resourceId;
24
+ }
25
+ run(input) {
26
+ return new rxjs.Observable((subscriber) => {
27
+ const convertedMessages = convertMessagesToMastraMessages(input.messages);
28
+ subscriber.next({
29
+ type: client.EventType.RUN_STARTED,
30
+ threadId: input.threadId,
31
+ runId: input.runId
32
+ });
33
+ this.agent.stream({
34
+ threadId: input.threadId,
35
+ resourceId: this.resourceId ?? "",
36
+ runId: input.runId,
37
+ messages: convertedMessages,
38
+ clientTools: input.tools.reduce(
39
+ (acc, tool) => {
40
+ acc[tool.name] = {
41
+ id: tool.name,
42
+ description: tool.description,
43
+ inputSchema: tool.parameters
44
+ };
45
+ return acc;
46
+ },
47
+ {}
48
+ )
49
+ }).then((response) => {
50
+ let currentMessageId = void 0;
51
+ let isInTextMessage = false;
52
+ return response.processDataStream({
53
+ onTextPart: (text) => {
54
+ if (currentMessageId === void 0) {
55
+ currentMessageId = generateUUID();
56
+ const message2 = {
57
+ type: client.EventType.TEXT_MESSAGE_START,
58
+ messageId: currentMessageId,
59
+ role: "assistant"
60
+ };
61
+ subscriber.next(message2);
62
+ isInTextMessage = true;
63
+ }
64
+ const message = {
65
+ type: client.EventType.TEXT_MESSAGE_CONTENT,
66
+ messageId: currentMessageId,
67
+ delta: text
68
+ };
69
+ subscriber.next(message);
70
+ },
71
+ onFinishMessagePart: () => {
72
+ if (currentMessageId !== void 0) {
73
+ const message = {
74
+ type: client.EventType.TEXT_MESSAGE_END,
75
+ messageId: currentMessageId
76
+ };
77
+ subscriber.next(message);
78
+ isInTextMessage = false;
79
+ }
80
+ subscriber.next({
81
+ type: client.EventType.RUN_FINISHED,
82
+ threadId: input.threadId,
83
+ runId: input.runId
84
+ });
85
+ subscriber.complete();
86
+ },
87
+ onToolCallPart(streamPart) {
88
+ const parentMessageId = currentMessageId || generateUUID();
89
+ if (isInTextMessage) {
90
+ const message = {
91
+ type: client.EventType.TEXT_MESSAGE_END,
92
+ messageId: parentMessageId
93
+ };
94
+ subscriber.next(message);
95
+ isInTextMessage = false;
96
+ }
97
+ subscriber.next({
98
+ type: client.EventType.TOOL_CALL_START,
99
+ toolCallId: streamPart.toolCallId,
100
+ toolCallName: streamPart.toolName,
101
+ parentMessageId
102
+ });
103
+ subscriber.next({
104
+ type: client.EventType.TOOL_CALL_ARGS,
105
+ toolCallId: streamPart.toolCallId,
106
+ delta: JSON.stringify(streamPart.args),
107
+ parentMessageId
108
+ });
109
+ subscriber.next({
110
+ type: client.EventType.TOOL_CALL_END,
111
+ toolCallId: streamPart.toolCallId,
112
+ parentMessageId
113
+ });
114
+ }
115
+ });
116
+ }).catch((error) => {
117
+ console.error("error", error);
118
+ subscriber.error(error);
119
+ });
120
+ return () => {
121
+ };
122
+ });
123
+ }
124
+ };
125
+ function generateUUID() {
126
+ if (typeof crypto !== "undefined") {
127
+ if (typeof crypto.randomUUID === "function") {
128
+ return crypto.randomUUID();
129
+ }
130
+ if (typeof crypto.getRandomValues === "function") {
131
+ const buffer = new Uint8Array(16);
132
+ crypto.getRandomValues(buffer);
133
+ buffer[6] = buffer[6] & 15 | 64;
134
+ buffer[8] = buffer[8] & 63 | 128;
135
+ let hex = "";
136
+ for (let i = 0; i < 16; i++) {
137
+ hex += buffer[i].toString(16).padStart(2, "0");
138
+ if (i === 3 || i === 5 || i === 7 || i === 9) hex += "-";
139
+ }
140
+ return hex;
141
+ }
142
+ }
143
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
144
+ const r = Math.random() * 16 | 0;
145
+ const v = c === "x" ? r : r & 3 | 8;
146
+ return v.toString(16);
147
+ });
148
+ }
149
+ function convertMessagesToMastraMessages(messages) {
150
+ const result = [];
151
+ for (const message of messages) {
152
+ if (message.role === "assistant") {
153
+ const parts = message.content ? [{ type: "text", text: message.content }] : [];
154
+ for (const toolCall of message.toolCalls ?? []) {
155
+ parts.push({
156
+ type: "tool-call",
157
+ toolCallId: toolCall.id,
158
+ toolName: toolCall.function.name,
159
+ args: JSON.parse(toolCall.function.arguments)
160
+ });
161
+ }
162
+ result.push({
163
+ role: "assistant",
164
+ content: parts
165
+ });
166
+ if (message.toolCalls?.length) {
167
+ result.push({
168
+ role: "tool",
169
+ content: message.toolCalls.map((toolCall) => ({
170
+ type: "tool-result",
171
+ toolCallId: toolCall.id,
172
+ toolName: toolCall.function.name,
173
+ result: JSON.parse(toolCall.function.arguments)
174
+ }))
175
+ });
176
+ }
177
+ } else if (message.role === "user") {
178
+ result.push({
179
+ role: "user",
180
+ content: message.content || ""
181
+ });
182
+ } else if (message.role === "tool") {
183
+ result.push({
184
+ role: "tool",
185
+ content: [
186
+ {
187
+ type: "tool-result",
188
+ toolCallId: message.toolCallId,
189
+ toolName: "unknown",
190
+ result: message.content
191
+ }
192
+ ]
193
+ });
194
+ }
195
+ }
196
+ return result;
197
+ }
198
+ function zodToJsonSchema(zodSchema) {
199
+ if (!(zodSchema instanceof zod.ZodSchema)) {
200
+ return zodSchema;
201
+ }
202
+ return originalZodToJsonSchema__default.default(zodSchema, { $refStrategy: "none" });
203
+ }
8
204
 
9
205
  // src/resources/base.ts
10
206
  var BaseResource = class {
@@ -135,8 +331,9 @@ var Agent = class extends BaseResource {
135
331
  generate(params) {
136
332
  const processedParams = {
137
333
  ...params,
138
- output: params.output instanceof zod.ZodSchema ? zodToJsonSchema.zodToJsonSchema(params.output) : params.output,
139
- experimental_output: params.experimental_output instanceof zod.ZodSchema ? zodToJsonSchema.zodToJsonSchema(params.experimental_output) : params.experimental_output
334
+ output: zodToJsonSchema(params.output),
335
+ experimental_output: zodToJsonSchema(params.experimental_output),
336
+ runtimeContext: params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0
140
337
  };
141
338
  return this.request(`/api/agents/${this.agentId}/generate`, {
142
339
  method: "POST",
@@ -151,8 +348,9 @@ var Agent = class extends BaseResource {
151
348
  async stream(params) {
152
349
  const processedParams = {
153
350
  ...params,
154
- output: params.output instanceof zod.ZodSchema ? zodToJsonSchema.zodToJsonSchema(params.output) : params.output,
155
- experimental_output: params.experimental_output instanceof zod.ZodSchema ? zodToJsonSchema.zodToJsonSchema(params.experimental_output) : params.experimental_output
351
+ output: zodToJsonSchema(params.output),
352
+ experimental_output: zodToJsonSchema(params.experimental_output),
353
+ runtimeContext: params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0
156
354
  };
157
355
  const response = await this.request(`/api/agents/${this.agentId}/stream`, {
158
356
  method: "POST",
@@ -178,6 +376,22 @@ var Agent = class extends BaseResource {
178
376
  getTool(toolId) {
179
377
  return this.request(`/api/agents/${this.agentId}/tools/${toolId}`);
180
378
  }
379
+ /**
380
+ * Executes a tool for the agent
381
+ * @param toolId - ID of the tool to execute
382
+ * @param params - Parameters required for tool execution
383
+ * @returns Promise containing the tool execution results
384
+ */
385
+ executeTool(toolId, params) {
386
+ const body = {
387
+ data: params.data,
388
+ runtimeContext: params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0
389
+ };
390
+ return this.request(`/api/agents/${this.agentId}/tools/${toolId}/execute`, {
391
+ method: "POST",
392
+ body
393
+ });
394
+ }
181
395
  /**
182
396
  * Retrieves evaluation results for the agent
183
397
  * @returns Promise containing agent evaluations
@@ -213,8 +427,8 @@ var Network = class extends BaseResource {
213
427
  generate(params) {
214
428
  const processedParams = {
215
429
  ...params,
216
- output: params.output instanceof zod.ZodSchema ? zodToJsonSchema.zodToJsonSchema(params.output) : params.output,
217
- experimental_output: params.experimental_output instanceof zod.ZodSchema ? zodToJsonSchema.zodToJsonSchema(params.experimental_output) : params.experimental_output
430
+ output: zodToJsonSchema(params.output),
431
+ experimental_output: zodToJsonSchema(params.experimental_output)
218
432
  };
219
433
  return this.request(`/api/networks/${this.networkId}/generate`, {
220
434
  method: "POST",
@@ -229,8 +443,8 @@ var Network = class extends BaseResource {
229
443
  async stream(params) {
230
444
  const processedParams = {
231
445
  ...params,
232
- output: params.output instanceof zod.ZodSchema ? zodToJsonSchema.zodToJsonSchema(params.output) : params.output,
233
- experimental_output: params.experimental_output instanceof zod.ZodSchema ? zodToJsonSchema.zodToJsonSchema(params.experimental_output) : params.experimental_output
446
+ output: zodToJsonSchema(params.output),
447
+ experimental_output: zodToJsonSchema(params.experimental_output)
234
448
  };
235
449
  const response = await this.request(`/api/networks/${this.networkId}/stream`, {
236
450
  method: "POST",
@@ -286,10 +500,15 @@ var MemoryThread = class extends BaseResource {
286
500
  }
287
501
  /**
288
502
  * Retrieves messages associated with the thread
503
+ * @param params - Optional parameters including limit for number of messages to retrieve
289
504
  * @returns Promise containing thread messages and UI messages
290
505
  */
291
- getMessages() {
292
- return this.request(`/api/memory/threads/${this.threadId}/messages?agentId=${this.agentId}`);
506
+ getMessages(params) {
507
+ const query = new URLSearchParams({
508
+ agentId: this.agentId,
509
+ ...params?.limit ? { limit: params.limit.toString() } : {}
510
+ });
511
+ return this.request(`/api/memory/threads/${this.threadId}/messages?${query.toString()}`);
293
512
  }
294
513
  };
295
514
 
@@ -373,6 +592,34 @@ var Workflow = class extends BaseResource {
373
592
  details() {
374
593
  return this.request(`/api/workflows/${this.workflowId}`);
375
594
  }
595
+ /**
596
+ * Retrieves all runs for a workflow
597
+ * @param params - Parameters for filtering runs
598
+ * @returns Promise containing workflow runs array
599
+ */
600
+ runs(params) {
601
+ const searchParams = new URLSearchParams();
602
+ if (params?.fromDate) {
603
+ searchParams.set("fromDate", params.fromDate.toISOString());
604
+ }
605
+ if (params?.toDate) {
606
+ searchParams.set("toDate", params.toDate.toISOString());
607
+ }
608
+ if (params?.limit) {
609
+ searchParams.set("limit", String(params.limit));
610
+ }
611
+ if (params?.offset) {
612
+ searchParams.set("offset", String(params.offset));
613
+ }
614
+ if (params?.resourceId) {
615
+ searchParams.set("resourceId", params.resourceId);
616
+ }
617
+ if (searchParams.size) {
618
+ return this.request(`/api/workflows/${this.workflowId}/runs?${searchParams}`);
619
+ } else {
620
+ return this.request(`/api/workflows/${this.workflowId}/runs`);
621
+ }
622
+ }
376
623
  /**
377
624
  * @deprecated Use `startAsync` instead
378
625
  * Executes the workflow with the provided parameters
@@ -489,7 +736,7 @@ var Workflow = class extends BaseResource {
489
736
  }
490
737
  }
491
738
  }
492
- } catch (error) {
739
+ } catch {
493
740
  }
494
741
  }
495
742
  if (buffer) {
@@ -543,9 +790,277 @@ var Tool = class extends BaseResource {
543
790
  * @returns Promise containing the tool execution results
544
791
  */
545
792
  execute(params) {
546
- return this.request(`/api/tools/${this.toolId}/execute`, {
793
+ const url = new URLSearchParams();
794
+ if (params.runId) {
795
+ url.set("runId", params.runId);
796
+ }
797
+ const body = {
798
+ data: params.data,
799
+ runtimeContext: params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0
800
+ };
801
+ return this.request(`/api/tools/${this.toolId}/execute?${url.toString()}`, {
547
802
  method: "POST",
548
- body: params
803
+ body
804
+ });
805
+ }
806
+ };
807
+ var RECORD_SEPARATOR2 = "";
808
+ var VNextWorkflow = class extends BaseResource {
809
+ constructor(options, workflowId) {
810
+ super(options);
811
+ this.workflowId = workflowId;
812
+ }
813
+ /**
814
+ * Creates an async generator that processes a readable stream and yields vNext workflow records
815
+ * separated by the Record Separator character (\x1E)
816
+ *
817
+ * @param stream - The readable stream to process
818
+ * @returns An async generator that yields parsed records
819
+ */
820
+ async *streamProcessor(stream) {
821
+ const reader = stream.getReader();
822
+ let doneReading = false;
823
+ let buffer = "";
824
+ try {
825
+ while (!doneReading) {
826
+ const { done, value } = await reader.read();
827
+ doneReading = done;
828
+ if (done && !value) continue;
829
+ try {
830
+ const decoded = value ? new TextDecoder().decode(value) : "";
831
+ const chunks = (buffer + decoded).split(RECORD_SEPARATOR2);
832
+ buffer = chunks.pop() || "";
833
+ for (const chunk of chunks) {
834
+ if (chunk) {
835
+ if (typeof chunk === "string") {
836
+ try {
837
+ const parsedChunk = JSON.parse(chunk);
838
+ yield parsedChunk;
839
+ } catch {
840
+ }
841
+ }
842
+ }
843
+ }
844
+ } catch {
845
+ }
846
+ }
847
+ if (buffer) {
848
+ try {
849
+ yield JSON.parse(buffer);
850
+ } catch {
851
+ }
852
+ }
853
+ } finally {
854
+ reader.cancel().catch(() => {
855
+ });
856
+ }
857
+ }
858
+ /**
859
+ * Retrieves details about the vNext workflow
860
+ * @returns Promise containing vNext workflow details including steps and graphs
861
+ */
862
+ details() {
863
+ return this.request(`/api/workflows/v-next/${this.workflowId}`);
864
+ }
865
+ /**
866
+ * Retrieves all runs for a vNext workflow
867
+ * @param params - Parameters for filtering runs
868
+ * @returns Promise containing vNext workflow runs array
869
+ */
870
+ runs(params) {
871
+ const searchParams = new URLSearchParams();
872
+ if (params?.fromDate) {
873
+ searchParams.set("fromDate", params.fromDate.toISOString());
874
+ }
875
+ if (params?.toDate) {
876
+ searchParams.set("toDate", params.toDate.toISOString());
877
+ }
878
+ if (params?.limit) {
879
+ searchParams.set("limit", String(params.limit));
880
+ }
881
+ if (params?.offset) {
882
+ searchParams.set("offset", String(params.offset));
883
+ }
884
+ if (params?.resourceId) {
885
+ searchParams.set("resourceId", params.resourceId);
886
+ }
887
+ if (searchParams.size) {
888
+ return this.request(`/api/workflows/v-next/${this.workflowId}/runs?${searchParams}`);
889
+ } else {
890
+ return this.request(`/api/workflows/v-next/${this.workflowId}/runs`);
891
+ }
892
+ }
893
+ /**
894
+ * Creates a new vNext workflow run
895
+ * @param params - Optional object containing the optional runId
896
+ * @returns Promise containing the runId of the created run
897
+ */
898
+ createRun(params) {
899
+ const searchParams = new URLSearchParams();
900
+ if (!!params?.runId) {
901
+ searchParams.set("runId", params.runId);
902
+ }
903
+ return this.request(`/api/workflows/v-next/${this.workflowId}/create-run?${searchParams.toString()}`, {
904
+ method: "POST"
905
+ });
906
+ }
907
+ /**
908
+ * Starts a vNext workflow run synchronously without waiting for the workflow to complete
909
+ * @param params - Object containing the runId, inputData and runtimeContext
910
+ * @returns Promise containing success message
911
+ */
912
+ start(params) {
913
+ const runtimeContext = params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0;
914
+ return this.request(`/api/workflows/v-next/${this.workflowId}/start?runId=${params.runId}`, {
915
+ method: "POST",
916
+ body: { inputData: params?.inputData, runtimeContext }
917
+ });
918
+ }
919
+ /**
920
+ * Resumes a suspended vNext workflow step synchronously without waiting for the vNext workflow to complete
921
+ * @param params - Object containing the runId, step, resumeData and runtimeContext
922
+ * @returns Promise containing success message
923
+ */
924
+ resume({
925
+ step,
926
+ runId,
927
+ resumeData,
928
+ ...rest
929
+ }) {
930
+ const runtimeContext = rest.runtimeContext ? Object.fromEntries(rest.runtimeContext.entries()) : void 0;
931
+ return this.request(`/api/workflows/v-next/${this.workflowId}/resume?runId=${runId}`, {
932
+ method: "POST",
933
+ stream: true,
934
+ body: {
935
+ step,
936
+ resumeData,
937
+ runtimeContext
938
+ }
939
+ });
940
+ }
941
+ /**
942
+ * Starts a vNext workflow run asynchronously and returns a promise that resolves when the vNext workflow is complete
943
+ * @param params - Object containing the optional runId, inputData and runtimeContext
944
+ * @returns Promise containing the vNext workflow execution results
945
+ */
946
+ startAsync(params) {
947
+ const searchParams = new URLSearchParams();
948
+ if (!!params?.runId) {
949
+ searchParams.set("runId", params.runId);
950
+ }
951
+ const runtimeContext = params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0;
952
+ return this.request(`/api/workflows/v-next/${this.workflowId}/start-async?${searchParams.toString()}`, {
953
+ method: "POST",
954
+ body: { inputData: params.inputData, runtimeContext }
955
+ });
956
+ }
957
+ /**
958
+ * Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
959
+ * @param params - Object containing the runId, step, resumeData and runtimeContext
960
+ * @returns Promise containing the vNext workflow resume results
961
+ */
962
+ resumeAsync(params) {
963
+ const runtimeContext = params.runtimeContext ? Object.fromEntries(params.runtimeContext.entries()) : void 0;
964
+ return this.request(`/api/workflows/v-next/${this.workflowId}/resume-async?runId=${params.runId}`, {
965
+ method: "POST",
966
+ body: {
967
+ step: params.step,
968
+ resumeData: params.resumeData,
969
+ runtimeContext
970
+ }
971
+ });
972
+ }
973
+ /**
974
+ * Watches vNext workflow transitions in real-time
975
+ * @param runId - Optional run ID to filter the watch stream
976
+ * @returns AsyncGenerator that yields parsed records from the vNext workflow watch stream
977
+ */
978
+ async watch({ runId }, onRecord) {
979
+ const response = await this.request(`/api/workflows/v-next/${this.workflowId}/watch?runId=${runId}`, {
980
+ stream: true
981
+ });
982
+ if (!response.ok) {
983
+ throw new Error(`Failed to watch vNext workflow: ${response.statusText}`);
984
+ }
985
+ if (!response.body) {
986
+ throw new Error("Response body is null");
987
+ }
988
+ for await (const record of this.streamProcessor(response.body)) {
989
+ onRecord(record);
990
+ }
991
+ }
992
+ };
993
+
994
+ // src/resources/a2a.ts
995
+ var A2A = class extends BaseResource {
996
+ constructor(options, agentId) {
997
+ super(options);
998
+ this.agentId = agentId;
999
+ }
1000
+ /**
1001
+ * Get the agent card with metadata about the agent
1002
+ * @returns Promise containing the agent card information
1003
+ */
1004
+ async getCard() {
1005
+ return this.request(`/.well-known/${this.agentId}/agent.json`);
1006
+ }
1007
+ /**
1008
+ * Send a message to the agent and get a response
1009
+ * @param params - Parameters for the task
1010
+ * @returns Promise containing the task response
1011
+ */
1012
+ async sendMessage(params) {
1013
+ const response = await this.request(`/a2a/${this.agentId}`, {
1014
+ method: "POST",
1015
+ body: {
1016
+ method: "tasks/send",
1017
+ params
1018
+ }
1019
+ });
1020
+ return { task: response.result };
1021
+ }
1022
+ /**
1023
+ * Get the status and result of a task
1024
+ * @param params - Parameters for querying the task
1025
+ * @returns Promise containing the task response
1026
+ */
1027
+ async getTask(params) {
1028
+ const response = await this.request(`/a2a/${this.agentId}`, {
1029
+ method: "POST",
1030
+ body: {
1031
+ method: "tasks/get",
1032
+ params
1033
+ }
1034
+ });
1035
+ return response.result;
1036
+ }
1037
+ /**
1038
+ * Cancel a running task
1039
+ * @param params - Parameters identifying the task to cancel
1040
+ * @returns Promise containing the task response
1041
+ */
1042
+ async cancelTask(params) {
1043
+ return this.request(`/a2a/${this.agentId}`, {
1044
+ method: "POST",
1045
+ body: {
1046
+ method: "tasks/cancel",
1047
+ params
1048
+ }
1049
+ });
1050
+ }
1051
+ /**
1052
+ * Send a message and subscribe to streaming updates (not fully implemented)
1053
+ * @param params - Parameters for the task
1054
+ * @returns Promise containing the task response
1055
+ */
1056
+ async sendAndSubscribe(params) {
1057
+ return this.request(`/a2a/${this.agentId}`, {
1058
+ method: "POST",
1059
+ body: {
1060
+ method: "tasks/sendSubscribe",
1061
+ params
1062
+ },
1063
+ stream: true
549
1064
  });
550
1065
  }
551
1066
  };
@@ -562,6 +1077,21 @@ var MastraClient = class extends BaseResource {
562
1077
  getAgents() {
563
1078
  return this.request("/api/agents");
564
1079
  }
1080
+ async getAGUI({ resourceId }) {
1081
+ const agents = await this.getAgents();
1082
+ return Object.entries(agents).reduce(
1083
+ (acc, [agentId]) => {
1084
+ const agent = this.getAgent(agentId);
1085
+ acc[agentId] = new AGUIAdapter({
1086
+ agentId,
1087
+ agent,
1088
+ resourceId
1089
+ });
1090
+ return acc;
1091
+ },
1092
+ {}
1093
+ );
1094
+ }
565
1095
  /**
566
1096
  * Gets an agent instance by ID
567
1097
  * @param agentId - ID of the agent to retrieve
@@ -642,6 +1172,21 @@ var MastraClient = class extends BaseResource {
642
1172
  getWorkflow(workflowId) {
643
1173
  return new Workflow(this.options, workflowId);
644
1174
  }
1175
+ /**
1176
+ * Retrieves all available vNext workflows
1177
+ * @returns Promise containing map of vNext workflow IDs to vNext workflow details
1178
+ */
1179
+ getVNextWorkflows() {
1180
+ return this.request("/api/workflows/v-next");
1181
+ }
1182
+ /**
1183
+ * Gets a vNext workflow instance by ID
1184
+ * @param workflowId - ID of the vNext workflow to retrieve
1185
+ * @returns vNext Workflow instance
1186
+ */
1187
+ getVNextWorkflow(workflowId) {
1188
+ return new VNextWorkflow(this.options, workflowId);
1189
+ }
645
1190
  /**
646
1191
  * Gets a vector instance by name
647
1192
  * @param vectorName - Name of the vector to retrieve
@@ -679,7 +1224,7 @@ var MastraClient = class extends BaseResource {
679
1224
  * @returns Promise containing telemetry data
680
1225
  */
681
1226
  getTelemetry(params) {
682
- const { name, scope, page, perPage, attribute } = params || {};
1227
+ const { name, scope, page, perPage, attribute, fromDate, toDate } = params || {};
683
1228
  const _attribute = attribute ? Object.entries(attribute).map(([key, value]) => `${key}:${value}`) : [];
684
1229
  const searchParams = new URLSearchParams();
685
1230
  if (name) {
@@ -703,6 +1248,12 @@ var MastraClient = class extends BaseResource {
703
1248
  searchParams.set("attribute", _attribute);
704
1249
  }
705
1250
  }
1251
+ if (fromDate) {
1252
+ searchParams.set("fromDate", fromDate.toISOString());
1253
+ }
1254
+ if (toDate) {
1255
+ searchParams.set("toDate", toDate.toISOString());
1256
+ }
706
1257
  if (searchParams.size) {
707
1258
  return this.request(`/api/telemetry?${searchParams}`);
708
1259
  } else {
@@ -724,6 +1275,14 @@ var MastraClient = class extends BaseResource {
724
1275
  getNetwork(networkId) {
725
1276
  return new Network(this.options, networkId);
726
1277
  }
1278
+ /**
1279
+ * Gets an A2A client for interacting with an agent via the A2A protocol
1280
+ * @param agentId - ID of the agent to interact with
1281
+ * @returns A2A client instance
1282
+ */
1283
+ getA2A(agentId) {
1284
+ return new A2A(this.options, agentId);
1285
+ }
727
1286
  };
728
1287
 
729
1288
  exports.MastraClient = MastraClient;