@mastra/client-js 0.0.0-commonjs-20250414101718 → 0.0.0-expose-more-playground-ui-20250501175749

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,18 +1,270 @@
1
1
  # @mastra/client-js
2
2
 
3
- ## 0.0.0-commonjs-20250414101718
3
+ ## 0.0.0-expose-more-playground-ui-20250501175749
4
+
5
+ ### Patch Changes
6
+
7
+ - 254f5c3: Audit, cleanup MastraClient
8
+ - 0097d50: Add serializedStepGraph to vNext workflow
9
+ Return serializedStepGraph from vNext workflow
10
+ Use serializedStepGraph in vNext workflow graph
11
+ - 2429c74: Add get workflow runs api to client-js
12
+ - Updated dependencies [967b41c]
13
+ - Updated dependencies [26738f4]
14
+ - Updated dependencies [b804723]
15
+ - Updated dependencies [0097d50]
16
+ - @mastra/core@0.0.0-expose-more-playground-ui-20250501175749
17
+
18
+ ## 0.1.20-alpha.2
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [26738f4]
23
+ - @mastra/core@0.9.2-alpha.2
24
+
25
+ ## 0.1.20-alpha.1
26
+
27
+ ### Patch Changes
28
+
29
+ - 254f5c3: Audit, cleanup MastraClient
30
+ - 2429c74: Add get workflow runs api to client-js
31
+ - Updated dependencies [b804723]
32
+ - @mastra/core@0.9.2-alpha.1
33
+
34
+ ## 0.1.20-alpha.0
35
+
36
+ ### Patch Changes
37
+
38
+ - 0097d50: Add serializedStepGraph to vNext workflow
39
+ Return serializedStepGraph from vNext workflow
40
+ Use serializedStepGraph in vNext workflow graph
41
+ - Updated dependencies [0097d50]
42
+ - @mastra/core@0.9.2-alpha.0
43
+
44
+ ## 0.1.19
45
+
46
+ ### Patch Changes
47
+
48
+ - b50b9b7: Add vNext workflow to client-js
49
+ - 11d4485: Show VNext workflows on the playground
50
+ Show running status for step in vNext workflowState
51
+ - Updated dependencies [405b63d]
52
+ - Updated dependencies [81fb7f6]
53
+ - Updated dependencies [20275d4]
54
+ - Updated dependencies [7d1892c]
55
+ - Updated dependencies [a90a082]
56
+ - Updated dependencies [2d17c73]
57
+ - Updated dependencies [61e92f5]
58
+ - Updated dependencies [35955b0]
59
+ - Updated dependencies [6262bd5]
60
+ - Updated dependencies [c1409ef]
61
+ - Updated dependencies [3e7b69d]
62
+ - Updated dependencies [e4943b8]
63
+ - Updated dependencies [11d4485]
64
+ - Updated dependencies [479f490]
65
+ - Updated dependencies [c23a81c]
66
+ - Updated dependencies [2d4001d]
67
+ - Updated dependencies [c71013a]
68
+ - Updated dependencies [1d3b1cd]
69
+ - @mastra/core@0.9.1
70
+
71
+ ## 0.1.19-alpha.8
72
+
73
+ ### Patch Changes
74
+
75
+ - Updated dependencies [2d17c73]
76
+ - @mastra/core@0.9.1-alpha.8
77
+
78
+ ## 0.1.19-alpha.7
79
+
80
+ ### Patch Changes
81
+
82
+ - Updated dependencies [1d3b1cd]
83
+ - @mastra/core@0.9.1-alpha.7
84
+
85
+ ## 0.1.19-alpha.6
86
+
87
+ ### Patch Changes
88
+
89
+ - Updated dependencies [c23a81c]
90
+ - @mastra/core@0.9.1-alpha.6
91
+
92
+ ## 0.1.19-alpha.5
93
+
94
+ ### Patch Changes
95
+
96
+ - Updated dependencies [3e7b69d]
97
+ - @mastra/core@0.9.1-alpha.5
98
+
99
+ ## 0.1.19-alpha.4
100
+
101
+ ### Patch Changes
102
+
103
+ - Updated dependencies [e4943b8]
104
+ - Updated dependencies [479f490]
105
+ - @mastra/core@0.9.1-alpha.4
106
+
107
+ ## 0.1.19-alpha.3
108
+
109
+ ### Patch Changes
110
+
111
+ - Updated dependencies [6262bd5]
112
+ - @mastra/core@0.9.1-alpha.3
113
+
114
+ ## 0.1.19-alpha.2
115
+
116
+ ### Patch Changes
117
+
118
+ - Updated dependencies [405b63d]
119
+ - Updated dependencies [61e92f5]
120
+ - Updated dependencies [c71013a]
121
+ - @mastra/core@0.9.1-alpha.2
122
+
123
+ ## 0.1.19-alpha.1
124
+
125
+ ### Patch Changes
126
+
127
+ - b50b9b7: Add vNext workflow to client-js
128
+ - 11d4485: Show VNext workflows on the playground
129
+ Show running status for step in vNext workflowState
130
+ - Updated dependencies [20275d4]
131
+ - Updated dependencies [7d1892c]
132
+ - Updated dependencies [a90a082]
133
+ - Updated dependencies [35955b0]
134
+ - Updated dependencies [c1409ef]
135
+ - Updated dependencies [11d4485]
136
+ - Updated dependencies [2d4001d]
137
+ - @mastra/core@0.9.1-alpha.1
138
+
139
+ ## 0.1.19-alpha.0
140
+
141
+ ### Patch Changes
142
+
143
+ - Updated dependencies [81fb7f6]
144
+ - @mastra/core@0.9.1-alpha.0
145
+
146
+ ## 0.1.18
147
+
148
+ ### Patch Changes
149
+
150
+ - 2538066: Fix memory thread creation from client SDK
151
+ - Updated dependencies [000a6d4]
152
+ - Updated dependencies [08bb78e]
153
+ - Updated dependencies [ed2f549]
154
+ - Updated dependencies [7e92011]
155
+ - Updated dependencies [9ee4293]
156
+ - Updated dependencies [03f3cd0]
157
+ - Updated dependencies [c0f22b4]
158
+ - Updated dependencies [71d9444]
159
+ - Updated dependencies [157c741]
160
+ - Updated dependencies [8a8a73b]
161
+ - Updated dependencies [0a033fa]
162
+ - Updated dependencies [fe3ae4d]
163
+ - Updated dependencies [9c26508]
164
+ - Updated dependencies [0f4eae3]
165
+ - Updated dependencies [16a8648]
166
+ - Updated dependencies [6f92295]
167
+ - @mastra/core@0.9.0
168
+
169
+ ## 0.1.18-alpha.8
170
+
171
+ ### Patch Changes
172
+
173
+ - 2538066: Fix memory thread creation from client SDK
174
+ - Updated dependencies [000a6d4]
175
+ - Updated dependencies [ed2f549]
176
+ - Updated dependencies [c0f22b4]
177
+ - Updated dependencies [0a033fa]
178
+ - Updated dependencies [9c26508]
179
+ - Updated dependencies [0f4eae3]
180
+ - Updated dependencies [16a8648]
181
+ - @mastra/core@0.9.0-alpha.8
182
+
183
+ ## 0.1.18-alpha.7
184
+
185
+ ### Patch Changes
186
+
187
+ - Updated dependencies [71d9444]
188
+ - @mastra/core@0.9.0-alpha.7
189
+
190
+ ## 0.1.18-alpha.6
191
+
192
+ ### Patch Changes
193
+
194
+ - Updated dependencies [157c741]
195
+ - @mastra/core@0.9.0-alpha.6
196
+
197
+ ## 0.1.18-alpha.5
198
+
199
+ ### Patch Changes
200
+
201
+ - Updated dependencies [08bb78e]
202
+ - @mastra/core@0.9.0-alpha.5
203
+
204
+ ## 0.1.18-alpha.4
205
+
206
+ ### Patch Changes
207
+
208
+ - Updated dependencies [7e92011]
209
+ - @mastra/core@0.9.0-alpha.4
210
+
211
+ ## 0.1.18-alpha.3
212
+
213
+ ### Patch Changes
214
+
215
+ - Updated dependencies [fe3ae4d]
216
+ - @mastra/core@0.9.0-alpha.3
217
+
218
+ ## 0.1.18-alpha.2
219
+
220
+ ### Patch Changes
221
+
222
+ - Updated dependencies [9ee4293]
223
+ - @mastra/core@0.8.4-alpha.2
224
+
225
+ ## 0.1.18-alpha.1
226
+
227
+ ### Patch Changes
228
+
229
+ - Updated dependencies [8a8a73b]
230
+ - Updated dependencies [6f92295]
231
+ - @mastra/core@0.8.4-alpha.1
232
+
233
+ ## 0.1.18-alpha.0
234
+
235
+ ### Patch Changes
236
+
237
+ - Updated dependencies [03f3cd0]
238
+ - @mastra/core@0.8.4-alpha.0
239
+
240
+ ## 0.1.17
4
241
 
5
242
  ### Patch Changes
6
243
 
7
244
  - 37bb612: Add Elastic-2.0 licensing for packages
8
245
  - bc4acb3: updated traces to not be wrapped in traces object
246
+ - Updated dependencies [d72318f]
9
247
  - Updated dependencies [0bcc862]
10
248
  - Updated dependencies [10a8caf]
11
249
  - Updated dependencies [359b089]
12
250
  - Updated dependencies [32e7b71]
13
251
  - Updated dependencies [37bb612]
14
252
  - Updated dependencies [7f1b291]
15
- - @mastra/core@0.0.0-commonjs-20250414101718
253
+ - @mastra/core@0.8.3
254
+
255
+ ## 0.1.17-alpha.5
256
+
257
+ ### Patch Changes
258
+
259
+ - Updated dependencies [d72318f]
260
+ - @mastra/core@0.8.3-alpha.5
261
+
262
+ ## 0.1.17-alpha.4
263
+
264
+ ### Patch Changes
265
+
266
+ - Updated dependencies [7f1b291]
267
+ - @mastra/core@0.8.3-alpha.4
16
268
 
17
269
  ## 0.1.17-alpha.3
18
270
 
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ var uiUtils = require('@ai-sdk/ui-utils');
3
4
  var zod = require('zod');
4
5
  var zodToJsonSchema = require('zod-to-json-schema');
5
- var uiUtils = require('@ai-sdk/ui-utils');
6
6
 
7
7
  // src/resources/agent.ts
8
8
 
@@ -373,6 +373,13 @@ var Workflow = class extends BaseResource {
373
373
  details() {
374
374
  return this.request(`/api/workflows/${this.workflowId}`);
375
375
  }
376
+ /**
377
+ * Retrieves all runs for a workflow
378
+ * @returns Promise containing workflow runs array
379
+ */
380
+ runs() {
381
+ return this.request(`/api/workflows/${this.workflowId}/runs`);
382
+ }
376
383
  /**
377
384
  * @deprecated Use `startAsync` instead
378
385
  * Executes the workflow with the provided parameters
@@ -489,7 +496,7 @@ var Workflow = class extends BaseResource {
489
496
  }
490
497
  }
491
498
  }
492
- } catch (error) {
499
+ } catch {
493
500
  }
494
501
  }
495
502
  if (buffer) {
@@ -543,13 +550,180 @@ var Tool = class extends BaseResource {
543
550
  * @returns Promise containing the tool execution results
544
551
  */
545
552
  execute(params) {
546
- return this.request(`/api/tools/${this.toolId}/execute`, {
553
+ const url = new URLSearchParams();
554
+ if (params.runId) {
555
+ url.set("runId", params.runId);
556
+ }
557
+ return this.request(`/api/tools/${this.toolId}/execute?${url.toString()}`, {
547
558
  method: "POST",
548
- body: params
559
+ body: params.data
549
560
  });
550
561
  }
551
562
  };
552
563
 
564
+ // src/resources/vnext-workflow.ts
565
+ var RECORD_SEPARATOR2 = "";
566
+ var VNextWorkflow = class extends BaseResource {
567
+ constructor(options, workflowId) {
568
+ super(options);
569
+ this.workflowId = workflowId;
570
+ }
571
+ /**
572
+ * Creates an async generator that processes a readable stream and yields vNext workflow records
573
+ * separated by the Record Separator character (\x1E)
574
+ *
575
+ * @param stream - The readable stream to process
576
+ * @returns An async generator that yields parsed records
577
+ */
578
+ async *streamProcessor(stream) {
579
+ const reader = stream.getReader();
580
+ let doneReading = false;
581
+ let buffer = "";
582
+ try {
583
+ while (!doneReading) {
584
+ const { done, value } = await reader.read();
585
+ doneReading = done;
586
+ if (done && !value) continue;
587
+ try {
588
+ const decoded = value ? new TextDecoder().decode(value) : "";
589
+ const chunks = (buffer + decoded).split(RECORD_SEPARATOR2);
590
+ buffer = chunks.pop() || "";
591
+ for (const chunk of chunks) {
592
+ if (chunk) {
593
+ if (typeof chunk === "string") {
594
+ try {
595
+ const parsedChunk = JSON.parse(chunk);
596
+ yield parsedChunk;
597
+ } catch {
598
+ }
599
+ }
600
+ }
601
+ }
602
+ } catch {
603
+ }
604
+ }
605
+ if (buffer) {
606
+ try {
607
+ yield JSON.parse(buffer);
608
+ } catch {
609
+ }
610
+ }
611
+ } finally {
612
+ reader.cancel().catch(() => {
613
+ });
614
+ }
615
+ }
616
+ /**
617
+ * Retrieves details about the vNext workflow
618
+ * @returns Promise containing vNext workflow details including steps and graphs
619
+ */
620
+ details() {
621
+ return this.request(`/api/workflows/v-next/${this.workflowId}`);
622
+ }
623
+ /**
624
+ * Retrieves all runs for a vNext workflow
625
+ * @returns Promise containing vNext workflow runs array
626
+ */
627
+ runs() {
628
+ return this.request(`/api/workflows/v-next/${this.workflowId}/runs`);
629
+ }
630
+ /**
631
+ * Creates a new vNext workflow run
632
+ * @param params - Optional object containing the optional runId
633
+ * @returns Promise containing the runId of the created run
634
+ */
635
+ createRun(params) {
636
+ const searchParams = new URLSearchParams();
637
+ if (!!params?.runId) {
638
+ searchParams.set("runId", params.runId);
639
+ }
640
+ return this.request(`/api/workflows/v-next/${this.workflowId}/create-run?${searchParams.toString()}`, {
641
+ method: "POST"
642
+ });
643
+ }
644
+ /**
645
+ * Starts a vNext workflow run synchronously without waiting for the workflow to complete
646
+ * @param params - Object containing the runId, inputData and runtimeContext
647
+ * @returns Promise containing success message
648
+ */
649
+ start(params) {
650
+ return this.request(`/api/workflows/v-next/${this.workflowId}/start?runId=${params.runId}`, {
651
+ method: "POST",
652
+ body: { inputData: params?.inputData, runtimeContext: params.runtimeContext }
653
+ });
654
+ }
655
+ /**
656
+ * Resumes a suspended vNext workflow step synchronously without waiting for the vNext workflow to complete
657
+ * @param params - Object containing the runId, step, resumeData and runtimeContext
658
+ * @returns Promise containing success message
659
+ */
660
+ resume({
661
+ step,
662
+ runId,
663
+ resumeData,
664
+ runtimeContext
665
+ }) {
666
+ return this.request(`/api/workflows/v-next/${this.workflowId}/resume?runId=${runId}`, {
667
+ method: "POST",
668
+ stream: true,
669
+ body: {
670
+ step,
671
+ resumeData,
672
+ runtimeContext
673
+ }
674
+ });
675
+ }
676
+ /**
677
+ * Starts a vNext workflow run asynchronously and returns a promise that resolves when the vNext workflow is complete
678
+ * @param params - Object containing the optional runId, inputData and runtimeContext
679
+ * @returns Promise containing the vNext workflow execution results
680
+ */
681
+ startAsync(params) {
682
+ const searchParams = new URLSearchParams();
683
+ if (!!params?.runId) {
684
+ searchParams.set("runId", params.runId);
685
+ }
686
+ return this.request(`/api/workflows/v-next/${this.workflowId}/start-async?${searchParams.toString()}`, {
687
+ method: "POST",
688
+ body: { inputData: params.inputData, runtimeContext: params.runtimeContext }
689
+ });
690
+ }
691
+ /**
692
+ * Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
693
+ * @param params - Object containing the runId, step, resumeData and runtimeContext
694
+ * @returns Promise containing the vNext workflow resume results
695
+ */
696
+ resumeAsync(params) {
697
+ return this.request(`/api/workflows/v-next/${this.workflowId}/resume-async?runId=${params.runId}`, {
698
+ method: "POST",
699
+ body: {
700
+ step: params.step,
701
+ resumeData: params.resumeData,
702
+ runtimeContext: params.runtimeContext
703
+ }
704
+ });
705
+ }
706
+ /**
707
+ * Watches vNext workflow transitions in real-time
708
+ * @param runId - Optional run ID to filter the watch stream
709
+ * @returns AsyncGenerator that yields parsed records from the vNext workflow watch stream
710
+ */
711
+ async watch({ runId }, onRecord) {
712
+ const response = await this.request(`/api/workflows/v-next/${this.workflowId}/watch?runId=${runId}`, {
713
+ stream: true
714
+ });
715
+ if (!response.ok) {
716
+ throw new Error(`Failed to watch vNext workflow: ${response.statusText}`);
717
+ }
718
+ if (!response.body) {
719
+ throw new Error("Response body is null");
720
+ }
721
+ for await (const record of this.streamProcessor(response.body)) {
722
+ onRecord(record);
723
+ }
724
+ }
725
+ };
726
+
553
727
  // src/client.ts
554
728
  var MastraClient = class extends BaseResource {
555
729
  constructor(options) {
@@ -642,6 +816,21 @@ var MastraClient = class extends BaseResource {
642
816
  getWorkflow(workflowId) {
643
817
  return new Workflow(this.options, workflowId);
644
818
  }
819
+ /**
820
+ * Retrieves all available vNext workflows
821
+ * @returns Promise containing map of vNext workflow IDs to vNext workflow details
822
+ */
823
+ getVNextWorkflows() {
824
+ return this.request("/api/workflows/v-next");
825
+ }
826
+ /**
827
+ * Gets a vNext workflow instance by ID
828
+ * @param workflowId - ID of the vNext workflow to retrieve
829
+ * @returns vNext Workflow instance
830
+ */
831
+ getVNextWorkflow(workflowId) {
832
+ return new VNextWorkflow(this.options, workflowId);
833
+ }
645
834
  /**
646
835
  * Gets a vector instance by name
647
836
  * @param vectorName - Name of the vector to retrieve
package/dist/index.d.cts CHANGED
@@ -1,8 +1,10 @@
1
- import { CoreMessage, AiMessageType, StorageThreadType, MessageType, StepAction, StepGraph, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
1
+ import { processDataStream } from '@ai-sdk/ui-utils';
2
+ import { CoreMessage, AiMessageType, StorageThreadType, MessageType, StepAction, StepGraph, WorkflowRuns, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
2
3
  import { JSONSchema7 } from 'json-schema';
3
4
  import { ZodSchema } from 'zod';
4
- import { processDataStream } from '@ai-sdk/ui-utils';
5
5
  import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
6
+ import { NewWorkflow, WorkflowResult, WatchEvent } from '@mastra/core/workflows/vNext';
7
+ import { RuntimeContext } from '@mastra/core/runtime-context';
6
8
 
7
9
  interface ClientOptions {
8
10
  /** Base URL for API requests */
@@ -38,6 +40,9 @@ type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
38
40
  } & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry'>;
39
41
  interface GetEvalsByAgentIdResponse extends GetAgentResponse {
40
42
  evals: any[];
43
+ instructions: string;
44
+ name: string;
45
+ id: string;
41
46
  }
42
47
  interface GetToolResponse {
43
48
  id: string;
@@ -53,6 +58,7 @@ interface GetWorkflowResponse {
53
58
  stepSubscriberGraph: Record<string, StepGraph>;
54
59
  workflowId?: string;
55
60
  }
61
+ type GetWorkflowRunsResponse = WorkflowRuns;
56
62
  type WorkflowRunResult = {
57
63
  activePaths: Record<string, {
58
64
  status: string;
@@ -63,6 +69,26 @@ type WorkflowRunResult = {
63
69
  timestamp: number;
64
70
  runId: string;
65
71
  };
72
+ interface GetVNextWorkflowResponse {
73
+ name: string;
74
+ steps: {
75
+ [key: string]: {
76
+ id: string;
77
+ description: string;
78
+ inputSchema: string;
79
+ outputSchema: string;
80
+ resumeSchema: string;
81
+ suspendSchema: string;
82
+ };
83
+ };
84
+ stepGraph: NewWorkflow['serializedStepGraph'];
85
+ inputSchema: string;
86
+ outputSchema: string;
87
+ }
88
+ type VNextWorkflowWatchResult = WatchEvent & {
89
+ runId: string;
90
+ };
91
+ type VNextWorkflowRunResult = WorkflowResult<any, any>;
66
92
  interface UpsertVectorParams {
67
93
  indexName: string;
68
94
  vectors: number[][];
@@ -97,7 +123,7 @@ type SaveMessageToMemoryResponse = MessageType[];
97
123
  interface CreateMemoryThreadParams {
98
124
  title: string;
99
125
  metadata: Record<string, any>;
100
- resourceid: string;
126
+ resourceId: string;
101
127
  threadId: string;
102
128
  agentId: string;
103
129
  }
@@ -110,7 +136,7 @@ type GetMemoryThreadResponse = StorageThreadType[];
110
136
  interface UpdateMemoryThreadParams {
111
137
  title: string;
112
138
  metadata: Record<string, any>;
113
- resourceid: string;
139
+ resourceId: string;
114
140
  }
115
141
  interface GetMemoryThreadMessagesResponse {
116
142
  messages: CoreMessage[];
@@ -376,6 +402,11 @@ declare class Workflow extends BaseResource {
376
402
  * @returns Promise containing workflow details including steps and graphs
377
403
  */
378
404
  details(): Promise<GetWorkflowResponse>;
405
+ /**
406
+ * Retrieves all runs for a workflow
407
+ * @returns Promise containing workflow runs array
408
+ */
409
+ runs(): Promise<GetWorkflowRunsResponse>;
379
410
  /**
380
411
  * @deprecated Use `startAsync` instead
381
412
  * Executes the workflow with the provided parameters
@@ -469,9 +500,97 @@ declare class Tool extends BaseResource {
469
500
  */
470
501
  execute(params: {
471
502
  data: any;
503
+ runId?: string;
472
504
  }): Promise<any>;
473
505
  }
474
506
 
507
+ declare class VNextWorkflow extends BaseResource {
508
+ private workflowId;
509
+ constructor(options: ClientOptions, workflowId: string);
510
+ /**
511
+ * Creates an async generator that processes a readable stream and yields vNext workflow records
512
+ * separated by the Record Separator character (\x1E)
513
+ *
514
+ * @param stream - The readable stream to process
515
+ * @returns An async generator that yields parsed records
516
+ */
517
+ private streamProcessor;
518
+ /**
519
+ * Retrieves details about the vNext workflow
520
+ * @returns Promise containing vNext workflow details including steps and graphs
521
+ */
522
+ details(): Promise<GetVNextWorkflowResponse>;
523
+ /**
524
+ * Retrieves all runs for a vNext workflow
525
+ * @returns Promise containing vNext workflow runs array
526
+ */
527
+ runs(): Promise<GetWorkflowRunsResponse>;
528
+ /**
529
+ * Creates a new vNext workflow run
530
+ * @param params - Optional object containing the optional runId
531
+ * @returns Promise containing the runId of the created run
532
+ */
533
+ createRun(params?: {
534
+ runId?: string;
535
+ }): Promise<{
536
+ runId: string;
537
+ }>;
538
+ /**
539
+ * Starts a vNext workflow run synchronously without waiting for the workflow to complete
540
+ * @param params - Object containing the runId, inputData and runtimeContext
541
+ * @returns Promise containing success message
542
+ */
543
+ start(params: {
544
+ runId: string;
545
+ inputData: Record<string, any>;
546
+ runtimeContext?: RuntimeContext;
547
+ }): Promise<{
548
+ message: string;
549
+ }>;
550
+ /**
551
+ * Resumes a suspended vNext workflow step synchronously without waiting for the vNext workflow to complete
552
+ * @param params - Object containing the runId, step, resumeData and runtimeContext
553
+ * @returns Promise containing success message
554
+ */
555
+ resume({ step, runId, resumeData, runtimeContext, }: {
556
+ step: string | string[];
557
+ runId: string;
558
+ resumeData?: Record<string, any>;
559
+ runtimeContext?: RuntimeContext;
560
+ }): Promise<{
561
+ message: string;
562
+ }>;
563
+ /**
564
+ * Starts a vNext workflow run asynchronously and returns a promise that resolves when the vNext workflow is complete
565
+ * @param params - Object containing the optional runId, inputData and runtimeContext
566
+ * @returns Promise containing the vNext workflow execution results
567
+ */
568
+ startAsync(params: {
569
+ runId?: string;
570
+ inputData: Record<string, any>;
571
+ runtimeContext?: RuntimeContext;
572
+ }): Promise<VNextWorkflowRunResult>;
573
+ /**
574
+ * Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
575
+ * @param params - Object containing the runId, step, resumeData and runtimeContext
576
+ * @returns Promise containing the vNext workflow resume results
577
+ */
578
+ resumeAsync(params: {
579
+ runId: string;
580
+ step: string | string[];
581
+ resumeData?: Record<string, any>;
582
+ runtimeContext?: RuntimeContext;
583
+ }): Promise<VNextWorkflowRunResult>;
584
+ /**
585
+ * Watches vNext workflow transitions in real-time
586
+ * @param runId - Optional run ID to filter the watch stream
587
+ * @returns AsyncGenerator that yields parsed records from the vNext workflow watch stream
588
+ */
589
+ watch({ runId }: {
590
+ runId?: string;
591
+ }, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
592
+ }
593
+
475
594
  declare class MastraClient extends BaseResource {
476
595
  constructor(options: ClientOptions);
477
596
  /**
@@ -538,6 +657,17 @@ declare class MastraClient extends BaseResource {
538
657
  * @returns Workflow instance
539
658
  */
540
659
  getWorkflow(workflowId: string): Workflow;
660
+ /**
661
+ * Retrieves all available vNext workflows
662
+ * @returns Promise containing map of vNext workflow IDs to vNext workflow details
663
+ */
664
+ getVNextWorkflows(): Promise<Record<string, GetVNextWorkflowResponse>>;
665
+ /**
666
+ * Gets a vNext workflow instance by ID
667
+ * @param workflowId - ID of the vNext workflow to retrieve
668
+ * @returns vNext Workflow instance
669
+ */
670
+ getVNextWorkflow(workflowId: string): VNextWorkflow;
541
671
  /**
542
672
  * Gets a vector instance by name
543
673
  * @param vectorName - Name of the vector to retrieve
@@ -582,4 +712,4 @@ declare class MastraClient extends BaseResource {
582
712
  getNetwork(networkId: string): Network;
583
713
  }
584
714
 
585
- export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVectorIndexResponse, type GetWorkflowResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult };
715
+ export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };