@mastra/client-js 0.0.0-mcp-server-update-parse-20250421171139 → 0.0.0-mcp-schema-serializer-20250430202337
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 +149 -3
- package/dist/index.cjs +193 -4
- package/dist/index.d.cts +135 -5
- package/dist/index.d.ts +135 -5
- package/dist/index.js +193 -4
- package/package.json +6 -3
- package/src/client.ts +19 -10
- package/src/index.test.ts +4 -4
- package/src/resources/agent.ts +1 -2
- package/src/resources/base.ts +1 -1
- package/src/resources/index.ts +1 -0
- package/src/resources/memory-thread.ts +1 -8
- package/src/resources/network.ts +1 -1
- package/src/resources/tool.ts +9 -3
- package/src/resources/vnext-workflow.ts +234 -0
- package/src/resources/workflow.ts +10 -2
- package/src/types.ts +30 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,21 +1,167 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
-
## 0.0.0-mcp-
|
|
3
|
+
## 0.0.0-mcp-schema-serializer-20250430202337
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
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 [5316795]
|
|
13
|
+
- Updated dependencies [b804723]
|
|
14
|
+
- Updated dependencies [0097d50]
|
|
15
|
+
- @mastra/core@0.0.0-mcp-schema-serializer-20250430202337
|
|
16
|
+
|
|
17
|
+
## 0.1.20-alpha.0
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 0097d50: Add serializedStepGraph to vNext workflow
|
|
22
|
+
Return serializedStepGraph from vNext workflow
|
|
23
|
+
Use serializedStepGraph in vNext workflow graph
|
|
24
|
+
- Updated dependencies [0097d50]
|
|
25
|
+
- @mastra/core@0.9.2-alpha.0
|
|
26
|
+
|
|
27
|
+
## 0.1.19
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- b50b9b7: Add vNext workflow to client-js
|
|
32
|
+
- 11d4485: Show VNext workflows on the playground
|
|
33
|
+
Show running status for step in vNext workflowState
|
|
34
|
+
- Updated dependencies [405b63d]
|
|
35
|
+
- Updated dependencies [81fb7f6]
|
|
36
|
+
- Updated dependencies [20275d4]
|
|
37
|
+
- Updated dependencies [7d1892c]
|
|
38
|
+
- Updated dependencies [a90a082]
|
|
39
|
+
- Updated dependencies [2d17c73]
|
|
40
|
+
- Updated dependencies [61e92f5]
|
|
41
|
+
- Updated dependencies [35955b0]
|
|
42
|
+
- Updated dependencies [6262bd5]
|
|
43
|
+
- Updated dependencies [c1409ef]
|
|
44
|
+
- Updated dependencies [3e7b69d]
|
|
45
|
+
- Updated dependencies [e4943b8]
|
|
46
|
+
- Updated dependencies [11d4485]
|
|
47
|
+
- Updated dependencies [479f490]
|
|
48
|
+
- Updated dependencies [c23a81c]
|
|
49
|
+
- Updated dependencies [2d4001d]
|
|
50
|
+
- Updated dependencies [c71013a]
|
|
51
|
+
- Updated dependencies [1d3b1cd]
|
|
52
|
+
- @mastra/core@0.9.1
|
|
53
|
+
|
|
54
|
+
## 0.1.19-alpha.8
|
|
55
|
+
|
|
56
|
+
### Patch Changes
|
|
57
|
+
|
|
58
|
+
- Updated dependencies [2d17c73]
|
|
59
|
+
- @mastra/core@0.9.1-alpha.8
|
|
60
|
+
|
|
61
|
+
## 0.1.19-alpha.7
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- Updated dependencies [1d3b1cd]
|
|
66
|
+
- @mastra/core@0.9.1-alpha.7
|
|
67
|
+
|
|
68
|
+
## 0.1.19-alpha.6
|
|
69
|
+
|
|
70
|
+
### Patch Changes
|
|
71
|
+
|
|
72
|
+
- Updated dependencies [c23a81c]
|
|
73
|
+
- @mastra/core@0.9.1-alpha.6
|
|
74
|
+
|
|
75
|
+
## 0.1.19-alpha.5
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- Updated dependencies [3e7b69d]
|
|
80
|
+
- @mastra/core@0.9.1-alpha.5
|
|
81
|
+
|
|
82
|
+
## 0.1.19-alpha.4
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- Updated dependencies [e4943b8]
|
|
87
|
+
- Updated dependencies [479f490]
|
|
88
|
+
- @mastra/core@0.9.1-alpha.4
|
|
89
|
+
|
|
90
|
+
## 0.1.19-alpha.3
|
|
91
|
+
|
|
92
|
+
### Patch Changes
|
|
93
|
+
|
|
94
|
+
- Updated dependencies [6262bd5]
|
|
95
|
+
- @mastra/core@0.9.1-alpha.3
|
|
96
|
+
|
|
97
|
+
## 0.1.19-alpha.2
|
|
98
|
+
|
|
99
|
+
### Patch Changes
|
|
100
|
+
|
|
101
|
+
- Updated dependencies [405b63d]
|
|
102
|
+
- Updated dependencies [61e92f5]
|
|
103
|
+
- Updated dependencies [c71013a]
|
|
104
|
+
- @mastra/core@0.9.1-alpha.2
|
|
105
|
+
|
|
106
|
+
## 0.1.19-alpha.1
|
|
107
|
+
|
|
108
|
+
### Patch Changes
|
|
109
|
+
|
|
110
|
+
- b50b9b7: Add vNext workflow to client-js
|
|
111
|
+
- 11d4485: Show VNext workflows on the playground
|
|
112
|
+
Show running status for step in vNext workflowState
|
|
113
|
+
- Updated dependencies [20275d4]
|
|
114
|
+
- Updated dependencies [7d1892c]
|
|
115
|
+
- Updated dependencies [a90a082]
|
|
116
|
+
- Updated dependencies [35955b0]
|
|
117
|
+
- Updated dependencies [c1409ef]
|
|
118
|
+
- Updated dependencies [11d4485]
|
|
119
|
+
- Updated dependencies [2d4001d]
|
|
120
|
+
- @mastra/core@0.9.1-alpha.1
|
|
121
|
+
|
|
122
|
+
## 0.1.19-alpha.0
|
|
123
|
+
|
|
124
|
+
### Patch Changes
|
|
125
|
+
|
|
126
|
+
- Updated dependencies [81fb7f6]
|
|
127
|
+
- @mastra/core@0.9.1-alpha.0
|
|
128
|
+
|
|
129
|
+
## 0.1.18
|
|
130
|
+
|
|
131
|
+
### Patch Changes
|
|
132
|
+
|
|
133
|
+
- 2538066: Fix memory thread creation from client SDK
|
|
134
|
+
- Updated dependencies [000a6d4]
|
|
7
135
|
- Updated dependencies [08bb78e]
|
|
8
136
|
- Updated dependencies [ed2f549]
|
|
9
137
|
- Updated dependencies [7e92011]
|
|
10
138
|
- Updated dependencies [9ee4293]
|
|
11
139
|
- Updated dependencies [03f3cd0]
|
|
140
|
+
- Updated dependencies [c0f22b4]
|
|
12
141
|
- Updated dependencies [71d9444]
|
|
13
142
|
- Updated dependencies [157c741]
|
|
14
143
|
- Updated dependencies [8a8a73b]
|
|
15
|
-
- Updated dependencies [
|
|
144
|
+
- Updated dependencies [0a033fa]
|
|
16
145
|
- Updated dependencies [fe3ae4d]
|
|
146
|
+
- Updated dependencies [9c26508]
|
|
147
|
+
- Updated dependencies [0f4eae3]
|
|
148
|
+
- Updated dependencies [16a8648]
|
|
17
149
|
- Updated dependencies [6f92295]
|
|
18
|
-
- @mastra/core@0.
|
|
150
|
+
- @mastra/core@0.9.0
|
|
151
|
+
|
|
152
|
+
## 0.1.18-alpha.8
|
|
153
|
+
|
|
154
|
+
### Patch Changes
|
|
155
|
+
|
|
156
|
+
- 2538066: Fix memory thread creation from client SDK
|
|
157
|
+
- Updated dependencies [000a6d4]
|
|
158
|
+
- Updated dependencies [ed2f549]
|
|
159
|
+
- Updated dependencies [c0f22b4]
|
|
160
|
+
- Updated dependencies [0a033fa]
|
|
161
|
+
- Updated dependencies [9c26508]
|
|
162
|
+
- Updated dependencies [0f4eae3]
|
|
163
|
+
- Updated dependencies [16a8648]
|
|
164
|
+
- @mastra/core@0.9.0-alpha.8
|
|
19
165
|
|
|
20
166
|
## 0.1.18-alpha.7
|
|
21
167
|
|
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
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
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 };
|