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