@mastra/client-js 0.0.0-switch-to-core-20250424015131 → 0.0.0-vnext-inngest-20250506123700

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,15 +1,183 @@
1
1
  # @mastra/client-js
2
2
 
3
- ## 0.0.0-switch-to-core-20250424015131
3
+ ## 0.0.0-vnext-inngest-20250506123700
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - 4155f47: Add parameters to filter workflow runs
8
+ Add fromDate and toDate to telemetry parameters
9
+ - 254f5c3: Audit, cleanup MastraClient
10
+ - 0097d50: Add serializedStepGraph to vNext workflow
11
+ Return serializedStepGraph from vNext workflow
12
+ Use serializedStepGraph in vNext workflow graph
13
+ - 2429c74: Add get workflow runs api to client-js
14
+ - 2e4f8e9: Agui client integration
15
+ - Updated dependencies [6052aa6]
16
+ - Updated dependencies [967b41c]
17
+ - Updated dependencies [3d2fb5c]
18
+ - Updated dependencies [26738f4]
19
+ - Updated dependencies [4155f47]
20
+ - Updated dependencies [7eeb2bc]
21
+ - Updated dependencies [b804723]
22
+ - Updated dependencies [8607972]
23
+ - Updated dependencies [ccef9f9]
24
+ - Updated dependencies [0097d50]
25
+ - Updated dependencies [7eeb2bc]
26
+ - Updated dependencies [17826a9]
27
+ - Updated dependencies [fba031f]
28
+ - Updated dependencies [51e6923]
29
+ - @mastra/core@0.0.0-vnext-inngest-20250506123700
30
+
31
+ ## 0.1.20-alpha.5
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies [3d2fb5c]
36
+ - Updated dependencies [7eeb2bc]
37
+ - Updated dependencies [8607972]
38
+ - Updated dependencies [7eeb2bc]
39
+ - Updated dependencies [fba031f]
40
+ - @mastra/core@0.9.2-alpha.5
41
+
42
+ ## 0.1.20-alpha.4
43
+
44
+ ### Patch Changes
45
+
46
+ - Updated dependencies [ccef9f9]
47
+ - Updated dependencies [51e6923]
48
+ - @mastra/core@0.9.2-alpha.4
49
+
50
+ ## 0.1.20-alpha.3
51
+
52
+ ### Patch Changes
53
+
54
+ - 4155f47: Add parameters to filter workflow runs
55
+ Add fromDate and toDate to telemetry parameters
56
+ - Updated dependencies [967b41c]
57
+ - Updated dependencies [4155f47]
58
+ - Updated dependencies [17826a9]
59
+ - @mastra/core@0.9.2-alpha.3
60
+
61
+ ## 0.1.20-alpha.2
62
+
63
+ ### Patch Changes
64
+
65
+ - Updated dependencies [26738f4]
66
+ - @mastra/core@0.9.2-alpha.2
67
+
68
+ ## 0.1.20-alpha.1
69
+
70
+ ### Patch Changes
71
+
72
+ - 254f5c3: Audit, cleanup MastraClient
73
+ - 2429c74: Add get workflow runs api to client-js
74
+ - Updated dependencies [b804723]
75
+ - @mastra/core@0.9.2-alpha.1
76
+
77
+ ## 0.1.20-alpha.0
78
+
79
+ ### Patch Changes
80
+
81
+ - 0097d50: Add serializedStepGraph to vNext workflow
82
+ Return serializedStepGraph from vNext workflow
83
+ Use serializedStepGraph in vNext workflow graph
84
+ - Updated dependencies [0097d50]
85
+ - @mastra/core@0.9.2-alpha.0
86
+
87
+ ## 0.1.19
88
+
89
+ ### Patch Changes
90
+
91
+ - b50b9b7: Add vNext workflow to client-js
92
+ - 11d4485: Show VNext workflows on the playground
93
+ Show running status for step in vNext workflowState
94
+ - Updated dependencies [405b63d]
7
95
  - Updated dependencies [81fb7f6]
96
+ - Updated dependencies [20275d4]
97
+ - Updated dependencies [7d1892c]
98
+ - Updated dependencies [a90a082]
99
+ - Updated dependencies [2d17c73]
100
+ - Updated dependencies [61e92f5]
101
+ - Updated dependencies [35955b0]
102
+ - Updated dependencies [6262bd5]
103
+ - Updated dependencies [c1409ef]
104
+ - Updated dependencies [3e7b69d]
105
+ - Updated dependencies [e4943b8]
106
+ - Updated dependencies [11d4485]
107
+ - Updated dependencies [479f490]
108
+ - Updated dependencies [c23a81c]
109
+ - Updated dependencies [2d4001d]
110
+ - Updated dependencies [c71013a]
111
+ - Updated dependencies [1d3b1cd]
112
+ - @mastra/core@0.9.1
113
+
114
+ ## 0.1.19-alpha.8
115
+
116
+ ### Patch Changes
117
+
118
+ - Updated dependencies [2d17c73]
119
+ - @mastra/core@0.9.1-alpha.8
120
+
121
+ ## 0.1.19-alpha.7
122
+
123
+ ### Patch Changes
124
+
125
+ - Updated dependencies [1d3b1cd]
126
+ - @mastra/core@0.9.1-alpha.7
127
+
128
+ ## 0.1.19-alpha.6
129
+
130
+ ### Patch Changes
131
+
132
+ - Updated dependencies [c23a81c]
133
+ - @mastra/core@0.9.1-alpha.6
134
+
135
+ ## 0.1.19-alpha.5
136
+
137
+ ### Patch Changes
138
+
139
+ - Updated dependencies [3e7b69d]
140
+ - @mastra/core@0.9.1-alpha.5
141
+
142
+ ## 0.1.19-alpha.4
143
+
144
+ ### Patch Changes
145
+
146
+ - Updated dependencies [e4943b8]
147
+ - Updated dependencies [479f490]
148
+ - @mastra/core@0.9.1-alpha.4
149
+
150
+ ## 0.1.19-alpha.3
151
+
152
+ ### Patch Changes
153
+
154
+ - Updated dependencies [6262bd5]
155
+ - @mastra/core@0.9.1-alpha.3
156
+
157
+ ## 0.1.19-alpha.2
158
+
159
+ ### Patch Changes
160
+
161
+ - Updated dependencies [405b63d]
162
+ - Updated dependencies [61e92f5]
163
+ - Updated dependencies [c71013a]
164
+ - @mastra/core@0.9.1-alpha.2
165
+
166
+ ## 0.1.19-alpha.1
167
+
168
+ ### Patch Changes
169
+
170
+ - b50b9b7: Add vNext workflow to client-js
171
+ - 11d4485: Show VNext workflows on the playground
172
+ Show running status for step in vNext workflowState
173
+ - Updated dependencies [20275d4]
8
174
  - Updated dependencies [7d1892c]
9
175
  - Updated dependencies [a90a082]
10
176
  - Updated dependencies [35955b0]
177
+ - Updated dependencies [c1409ef]
178
+ - Updated dependencies [11d4485]
11
179
  - Updated dependencies [2d4001d]
12
- - @mastra/core@0.0.0-switch-to-core-20250424015131
180
+ - @mastra/core@0.9.1-alpha.1
13
181
 
14
182
  ## 0.1.19-alpha.0
15
183
 
package/dist/index.cjs CHANGED
@@ -1,10 +1,175 @@
1
1
  'use strict';
2
2
 
3
+ var client = require('@ag-ui/client');
4
+ var rxjs = require('rxjs');
5
+ var uiUtils = require('@ai-sdk/ui-utils');
3
6
  var zod = require('zod');
4
7
  var zodToJsonSchema = require('zod-to-json-schema');
5
- var uiUtils = require('@ai-sdk/ui-utils');
6
8
 
7
- // src/resources/agent.ts
9
+ // src/adapters/agui.ts
10
+ var AGUIAdapter = class extends client.AbstractAgent {
11
+ agent;
12
+ resourceId;
13
+ constructor({ agent, agentId, resourceId, ...rest }) {
14
+ super({
15
+ agentId,
16
+ ...rest
17
+ });
18
+ this.agent = agent;
19
+ this.resourceId = resourceId;
20
+ }
21
+ run(input) {
22
+ return new rxjs.Observable((subscriber) => {
23
+ const convertedMessages = convertMessagesToMastraMessages(input.messages);
24
+ subscriber.next({
25
+ type: client.EventType.RUN_STARTED,
26
+ threadId: input.threadId,
27
+ runId: input.runId
28
+ });
29
+ this.agent.stream({
30
+ threadId: input.threadId,
31
+ resourceId: this.resourceId ?? "",
32
+ runId: input.runId,
33
+ messages: convertedMessages,
34
+ clientTools: input.tools.reduce(
35
+ (acc, tool) => {
36
+ acc[tool.name] = {
37
+ id: tool.name,
38
+ description: tool.description,
39
+ inputSchema: tool.parameters
40
+ };
41
+ return acc;
42
+ },
43
+ {}
44
+ )
45
+ }).then((response) => {
46
+ let currentMessageId = void 0;
47
+ return response.processDataStream({
48
+ onTextPart: (text) => {
49
+ if (currentMessageId === void 0) {
50
+ currentMessageId = generateUUID();
51
+ const message2 = {
52
+ type: client.EventType.TEXT_MESSAGE_START,
53
+ messageId: currentMessageId,
54
+ role: "assistant"
55
+ };
56
+ subscriber.next(message2);
57
+ }
58
+ const message = {
59
+ type: client.EventType.TEXT_MESSAGE_CONTENT,
60
+ messageId: currentMessageId,
61
+ delta: text
62
+ };
63
+ subscriber.next(message);
64
+ },
65
+ onFinishMessagePart: (message) => {
66
+ console.log("onFinishMessagePart", message);
67
+ if (currentMessageId !== void 0) {
68
+ const message2 = {
69
+ type: client.EventType.TEXT_MESSAGE_END,
70
+ messageId: currentMessageId
71
+ };
72
+ subscriber.next(message2);
73
+ }
74
+ subscriber.next({
75
+ type: client.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
+ subscriber.next({
84
+ type: client.EventType.TOOL_CALL_START,
85
+ toolCallId: streamPart.toolCallId,
86
+ toolCallName: streamPart.toolName,
87
+ parentMessageId
88
+ });
89
+ subscriber.next({
90
+ type: client.EventType.TOOL_CALL_ARGS,
91
+ toolCallId: streamPart.toolCallId,
92
+ delta: JSON.stringify(streamPart.args),
93
+ parentMessageId
94
+ });
95
+ subscriber.next({
96
+ type: client.EventType.TOOL_CALL_END,
97
+ toolCallId: streamPart.toolCallId,
98
+ parentMessageId
99
+ });
100
+ }
101
+ });
102
+ }).catch((error) => {
103
+ console.log("error", error);
104
+ subscriber.error(error);
105
+ });
106
+ return () => {
107
+ };
108
+ });
109
+ }
110
+ };
111
+ function generateUUID() {
112
+ if (typeof crypto !== "undefined") {
113
+ if (typeof crypto.randomUUID === "function") {
114
+ return crypto.randomUUID();
115
+ }
116
+ if (typeof crypto.getRandomValues === "function") {
117
+ const buffer = new Uint8Array(16);
118
+ crypto.getRandomValues(buffer);
119
+ buffer[6] = buffer[6] & 15 | 64;
120
+ buffer[8] = buffer[8] & 63 | 128;
121
+ let hex = "";
122
+ for (let i = 0; i < 16; i++) {
123
+ hex += buffer[i].toString(16).padStart(2, "0");
124
+ if (i === 3 || i === 5 || i === 7 || i === 9) hex += "-";
125
+ }
126
+ return hex;
127
+ }
128
+ }
129
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
130
+ const r = Math.random() * 16 | 0;
131
+ const v = c === "x" ? r : r & 3 | 8;
132
+ return v.toString(16);
133
+ });
134
+ }
135
+ function convertMessagesToMastraMessages(messages) {
136
+ const result = [];
137
+ for (const message of messages) {
138
+ if (message.role === "assistant") {
139
+ const parts = message.content ? [{ type: "text", text: message.content }] : [];
140
+ for (const toolCall of message.toolCalls ?? []) {
141
+ parts.push({
142
+ type: "tool-call",
143
+ toolCallId: toolCall.id,
144
+ toolName: toolCall.function.name,
145
+ args: JSON.parse(toolCall.function.arguments)
146
+ });
147
+ }
148
+ result.push({
149
+ role: "assistant",
150
+ content: parts
151
+ });
152
+ } else if (message.role === "user") {
153
+ result.push({
154
+ role: "user",
155
+ content: message.content || ""
156
+ });
157
+ } else if (message.role === "tool") {
158
+ result.push({
159
+ role: "tool",
160
+ content: [
161
+ {
162
+ type: "tool-result",
163
+ toolCallId: message.toolCallId,
164
+ toolName: "unknown",
165
+ result: message.content
166
+ }
167
+ ]
168
+ });
169
+ }
170
+ }
171
+ return result;
172
+ }
8
173
 
9
174
  // src/resources/base.ts
10
175
  var BaseResource = class {
@@ -373,6 +538,34 @@ var Workflow = class extends BaseResource {
373
538
  details() {
374
539
  return this.request(`/api/workflows/${this.workflowId}`);
375
540
  }
541
+ /**
542
+ * Retrieves all runs for a workflow
543
+ * @param params - Parameters for filtering runs
544
+ * @returns Promise containing workflow runs array
545
+ */
546
+ runs(params) {
547
+ const searchParams = new URLSearchParams();
548
+ if (params?.fromDate) {
549
+ searchParams.set("fromDate", params.fromDate.toISOString());
550
+ }
551
+ if (params?.toDate) {
552
+ searchParams.set("toDate", params.toDate.toISOString());
553
+ }
554
+ if (params?.limit) {
555
+ searchParams.set("limit", String(params.limit));
556
+ }
557
+ if (params?.offset) {
558
+ searchParams.set("offset", String(params.offset));
559
+ }
560
+ if (params?.resourceId) {
561
+ searchParams.set("resourceId", params.resourceId);
562
+ }
563
+ if (searchParams.size) {
564
+ return this.request(`/api/workflows/${this.workflowId}/runs?${searchParams}`);
565
+ } else {
566
+ return this.request(`/api/workflows/${this.workflowId}/runs`);
567
+ }
568
+ }
376
569
  /**
377
570
  * @deprecated Use `startAsync` instead
378
571
  * Executes the workflow with the provided parameters
@@ -489,7 +682,7 @@ var Workflow = class extends BaseResource {
489
682
  }
490
683
  }
491
684
  }
492
- } catch (error) {
685
+ } catch {
493
686
  }
494
687
  }
495
688
  if (buffer) {
@@ -543,13 +736,201 @@ var Tool = class extends BaseResource {
543
736
  * @returns Promise containing the tool execution results
544
737
  */
545
738
  execute(params) {
546
- return this.request(`/api/tools/${this.toolId}/execute`, {
739
+ const url = new URLSearchParams();
740
+ if (params.runId) {
741
+ url.set("runId", params.runId);
742
+ }
743
+ return this.request(`/api/tools/${this.toolId}/execute?${url.toString()}`, {
547
744
  method: "POST",
548
- body: params
745
+ body: params.data
549
746
  });
550
747
  }
551
748
  };
552
749
 
750
+ // src/resources/vnext-workflow.ts
751
+ var RECORD_SEPARATOR2 = "";
752
+ var VNextWorkflow = class extends BaseResource {
753
+ constructor(options, workflowId) {
754
+ super(options);
755
+ this.workflowId = workflowId;
756
+ }
757
+ /**
758
+ * Creates an async generator that processes a readable stream and yields vNext workflow records
759
+ * separated by the Record Separator character (\x1E)
760
+ *
761
+ * @param stream - The readable stream to process
762
+ * @returns An async generator that yields parsed records
763
+ */
764
+ async *streamProcessor(stream) {
765
+ const reader = stream.getReader();
766
+ let doneReading = false;
767
+ let buffer = "";
768
+ try {
769
+ while (!doneReading) {
770
+ const { done, value } = await reader.read();
771
+ doneReading = done;
772
+ if (done && !value) continue;
773
+ try {
774
+ const decoded = value ? new TextDecoder().decode(value) : "";
775
+ const chunks = (buffer + decoded).split(RECORD_SEPARATOR2);
776
+ buffer = chunks.pop() || "";
777
+ for (const chunk of chunks) {
778
+ if (chunk) {
779
+ if (typeof chunk === "string") {
780
+ try {
781
+ const parsedChunk = JSON.parse(chunk);
782
+ yield parsedChunk;
783
+ } catch {
784
+ }
785
+ }
786
+ }
787
+ }
788
+ } catch {
789
+ }
790
+ }
791
+ if (buffer) {
792
+ try {
793
+ yield JSON.parse(buffer);
794
+ } catch {
795
+ }
796
+ }
797
+ } finally {
798
+ reader.cancel().catch(() => {
799
+ });
800
+ }
801
+ }
802
+ /**
803
+ * Retrieves details about the vNext workflow
804
+ * @returns Promise containing vNext workflow details including steps and graphs
805
+ */
806
+ details() {
807
+ return this.request(`/api/workflows/v-next/${this.workflowId}`);
808
+ }
809
+ /**
810
+ * Retrieves all runs for a vNext workflow
811
+ * @param params - Parameters for filtering runs
812
+ * @returns Promise containing vNext workflow runs array
813
+ */
814
+ runs(params) {
815
+ const searchParams = new URLSearchParams();
816
+ if (params?.fromDate) {
817
+ searchParams.set("fromDate", params.fromDate.toISOString());
818
+ }
819
+ if (params?.toDate) {
820
+ searchParams.set("toDate", params.toDate.toISOString());
821
+ }
822
+ if (params?.limit) {
823
+ searchParams.set("limit", String(params.limit));
824
+ }
825
+ if (params?.offset) {
826
+ searchParams.set("offset", String(params.offset));
827
+ }
828
+ if (params?.resourceId) {
829
+ searchParams.set("resourceId", params.resourceId);
830
+ }
831
+ if (searchParams.size) {
832
+ return this.request(`/api/workflows/v-next/${this.workflowId}/runs?${searchParams}`);
833
+ } else {
834
+ return this.request(`/api/workflows/v-next/${this.workflowId}/runs`);
835
+ }
836
+ }
837
+ /**
838
+ * Creates a new vNext workflow run
839
+ * @param params - Optional object containing the optional runId
840
+ * @returns Promise containing the runId of the created run
841
+ */
842
+ createRun(params) {
843
+ const searchParams = new URLSearchParams();
844
+ if (!!params?.runId) {
845
+ searchParams.set("runId", params.runId);
846
+ }
847
+ return this.request(`/api/workflows/v-next/${this.workflowId}/create-run?${searchParams.toString()}`, {
848
+ method: "POST"
849
+ });
850
+ }
851
+ /**
852
+ * Starts a vNext workflow run synchronously without waiting for the workflow to complete
853
+ * @param params - Object containing the runId, inputData and runtimeContext
854
+ * @returns Promise containing success message
855
+ */
856
+ start(params) {
857
+ return this.request(`/api/workflows/v-next/${this.workflowId}/start?runId=${params.runId}`, {
858
+ method: "POST",
859
+ body: { inputData: params?.inputData, runtimeContext: params.runtimeContext }
860
+ });
861
+ }
862
+ /**
863
+ * Resumes a suspended vNext workflow step synchronously without waiting for the vNext workflow to complete
864
+ * @param params - Object containing the runId, step, resumeData and runtimeContext
865
+ * @returns Promise containing success message
866
+ */
867
+ resume({
868
+ step,
869
+ runId,
870
+ resumeData,
871
+ runtimeContext
872
+ }) {
873
+ return this.request(`/api/workflows/v-next/${this.workflowId}/resume?runId=${runId}`, {
874
+ method: "POST",
875
+ stream: true,
876
+ body: {
877
+ step,
878
+ resumeData,
879
+ runtimeContext
880
+ }
881
+ });
882
+ }
883
+ /**
884
+ * Starts a vNext workflow run asynchronously and returns a promise that resolves when the vNext workflow is complete
885
+ * @param params - Object containing the optional runId, inputData and runtimeContext
886
+ * @returns Promise containing the vNext workflow execution results
887
+ */
888
+ startAsync(params) {
889
+ const searchParams = new URLSearchParams();
890
+ if (!!params?.runId) {
891
+ searchParams.set("runId", params.runId);
892
+ }
893
+ return this.request(`/api/workflows/v-next/${this.workflowId}/start-async?${searchParams.toString()}`, {
894
+ method: "POST",
895
+ body: { inputData: params.inputData, runtimeContext: params.runtimeContext }
896
+ });
897
+ }
898
+ /**
899
+ * Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
900
+ * @param params - Object containing the runId, step, resumeData and runtimeContext
901
+ * @returns Promise containing the vNext workflow resume results
902
+ */
903
+ resumeAsync(params) {
904
+ return this.request(`/api/workflows/v-next/${this.workflowId}/resume-async?runId=${params.runId}`, {
905
+ method: "POST",
906
+ body: {
907
+ step: params.step,
908
+ resumeData: params.resumeData,
909
+ runtimeContext: params.runtimeContext
910
+ }
911
+ });
912
+ }
913
+ /**
914
+ * Watches vNext workflow transitions in real-time
915
+ * @param runId - Optional run ID to filter the watch stream
916
+ * @returns AsyncGenerator that yields parsed records from the vNext workflow watch stream
917
+ */
918
+ async watch({ runId }, onRecord) {
919
+ const response = await this.request(`/api/workflows/v-next/${this.workflowId}/watch?runId=${runId}`, {
920
+ stream: true
921
+ });
922
+ if (!response.ok) {
923
+ throw new Error(`Failed to watch vNext workflow: ${response.statusText}`);
924
+ }
925
+ if (!response.body) {
926
+ throw new Error("Response body is null");
927
+ }
928
+ for await (const record of this.streamProcessor(response.body)) {
929
+ onRecord(record);
930
+ }
931
+ }
932
+ };
933
+
553
934
  // src/client.ts
554
935
  var MastraClient = class extends BaseResource {
555
936
  constructor(options) {
@@ -562,6 +943,21 @@ var MastraClient = class extends BaseResource {
562
943
  getAgents() {
563
944
  return this.request("/api/agents");
564
945
  }
946
+ async getAGUI({ resourceId }) {
947
+ const agents = await this.getAgents();
948
+ return Object.entries(agents).reduce(
949
+ (acc, [agentId]) => {
950
+ const agent = this.getAgent(agentId);
951
+ acc[agentId] = new AGUIAdapter({
952
+ agentId,
953
+ agent,
954
+ resourceId
955
+ });
956
+ return acc;
957
+ },
958
+ {}
959
+ );
960
+ }
565
961
  /**
566
962
  * Gets an agent instance by ID
567
963
  * @param agentId - ID of the agent to retrieve
@@ -642,6 +1038,21 @@ var MastraClient = class extends BaseResource {
642
1038
  getWorkflow(workflowId) {
643
1039
  return new Workflow(this.options, workflowId);
644
1040
  }
1041
+ /**
1042
+ * Retrieves all available vNext workflows
1043
+ * @returns Promise containing map of vNext workflow IDs to vNext workflow details
1044
+ */
1045
+ getVNextWorkflows() {
1046
+ return this.request("/api/workflows/v-next");
1047
+ }
1048
+ /**
1049
+ * Gets a vNext workflow instance by ID
1050
+ * @param workflowId - ID of the vNext workflow to retrieve
1051
+ * @returns vNext Workflow instance
1052
+ */
1053
+ getVNextWorkflow(workflowId) {
1054
+ return new VNextWorkflow(this.options, workflowId);
1055
+ }
645
1056
  /**
646
1057
  * Gets a vector instance by name
647
1058
  * @param vectorName - Name of the vector to retrieve
@@ -679,7 +1090,7 @@ var MastraClient = class extends BaseResource {
679
1090
  * @returns Promise containing telemetry data
680
1091
  */
681
1092
  getTelemetry(params) {
682
- const { name, scope, page, perPage, attribute } = params || {};
1093
+ const { name, scope, page, perPage, attribute, fromDate, toDate } = params || {};
683
1094
  const _attribute = attribute ? Object.entries(attribute).map(([key, value]) => `${key}:${value}`) : [];
684
1095
  const searchParams = new URLSearchParams();
685
1096
  if (name) {
@@ -703,6 +1114,12 @@ var MastraClient = class extends BaseResource {
703
1114
  searchParams.set("attribute", _attribute);
704
1115
  }
705
1116
  }
1117
+ if (fromDate) {
1118
+ searchParams.set("fromDate", fromDate.toISOString());
1119
+ }
1120
+ if (toDate) {
1121
+ searchParams.set("toDate", toDate.toISOString());
1122
+ }
706
1123
  if (searchParams.size) {
707
1124
  return this.request(`/api/telemetry?${searchParams}`);
708
1125
  } else {