@mastra/client-js 0.0.0-mcp-server-update-parse-20250421171139 → 0.0.0-mcp-server-deploy-20250507160341
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 +191 -3
- package/dist/index.cjs +272 -5
- package/dist/index.d.cts +180 -5
- package/dist/index.d.ts +180 -5
- package/dist/index.js +272 -5
- package/package.json +6 -3
- package/src/client.ts +54 -11
- 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 +2 -0
- package/src/resources/mcp.ts +22 -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 +257 -0
- package/src/resources/workflow.ts +38 -2
- package/src/types.ts +51 -2
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,14 @@ interface GetWorkflowResponse {
|
|
|
53
58
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
54
59
|
workflowId?: string;
|
|
55
60
|
}
|
|
61
|
+
interface GetWorkflowRunsParams {
|
|
62
|
+
fromDate?: Date;
|
|
63
|
+
toDate?: Date;
|
|
64
|
+
limit?: number;
|
|
65
|
+
offset?: number;
|
|
66
|
+
resourceId?: string;
|
|
67
|
+
}
|
|
68
|
+
type GetWorkflowRunsResponse = WorkflowRuns;
|
|
56
69
|
type WorkflowRunResult = {
|
|
57
70
|
activePaths: Record<string, {
|
|
58
71
|
status: string;
|
|
@@ -63,6 +76,26 @@ type WorkflowRunResult = {
|
|
|
63
76
|
timestamp: number;
|
|
64
77
|
runId: string;
|
|
65
78
|
};
|
|
79
|
+
interface GetVNextWorkflowResponse {
|
|
80
|
+
name: string;
|
|
81
|
+
steps: {
|
|
82
|
+
[key: string]: {
|
|
83
|
+
id: string;
|
|
84
|
+
description: string;
|
|
85
|
+
inputSchema: string;
|
|
86
|
+
outputSchema: string;
|
|
87
|
+
resumeSchema: string;
|
|
88
|
+
suspendSchema: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
stepGraph: NewWorkflow['serializedStepGraph'];
|
|
92
|
+
inputSchema: string;
|
|
93
|
+
outputSchema: string;
|
|
94
|
+
}
|
|
95
|
+
type VNextWorkflowWatchResult = WatchEvent & {
|
|
96
|
+
runId: string;
|
|
97
|
+
};
|
|
98
|
+
type VNextWorkflowRunResult = WorkflowResult<any, any>;
|
|
66
99
|
interface UpsertVectorParams {
|
|
67
100
|
indexName: string;
|
|
68
101
|
vectors: number[][];
|
|
@@ -97,7 +130,7 @@ type SaveMessageToMemoryResponse = MessageType[];
|
|
|
97
130
|
interface CreateMemoryThreadParams {
|
|
98
131
|
title: string;
|
|
99
132
|
metadata: Record<string, any>;
|
|
100
|
-
|
|
133
|
+
resourceId: string;
|
|
101
134
|
threadId: string;
|
|
102
135
|
agentId: string;
|
|
103
136
|
}
|
|
@@ -110,7 +143,7 @@ type GetMemoryThreadResponse = StorageThreadType[];
|
|
|
110
143
|
interface UpdateMemoryThreadParams {
|
|
111
144
|
title: string;
|
|
112
145
|
metadata: Record<string, any>;
|
|
113
|
-
|
|
146
|
+
resourceId: string;
|
|
114
147
|
}
|
|
115
148
|
interface GetMemoryThreadMessagesResponse {
|
|
116
149
|
messages: CoreMessage[];
|
|
@@ -171,6 +204,8 @@ interface GetTelemetryParams {
|
|
|
171
204
|
page?: number;
|
|
172
205
|
perPage?: number;
|
|
173
206
|
attribute?: Record<string, string>;
|
|
207
|
+
fromDate?: Date;
|
|
208
|
+
toDate?: Date;
|
|
174
209
|
}
|
|
175
210
|
interface GetNetworkResponse {
|
|
176
211
|
name: string;
|
|
@@ -186,6 +221,16 @@ interface GetNetworkResponse {
|
|
|
186
221
|
};
|
|
187
222
|
state?: Record<string, any>;
|
|
188
223
|
}
|
|
224
|
+
interface GetMCPServerResponse {
|
|
225
|
+
id: string;
|
|
226
|
+
name: string;
|
|
227
|
+
description?: string;
|
|
228
|
+
tools: Array<{
|
|
229
|
+
name: string;
|
|
230
|
+
description: string;
|
|
231
|
+
parameters: Record<string, any>;
|
|
232
|
+
}>;
|
|
233
|
+
}
|
|
189
234
|
|
|
190
235
|
declare class BaseResource {
|
|
191
236
|
readonly options: ClientOptions;
|
|
@@ -376,6 +421,12 @@ declare class Workflow extends BaseResource {
|
|
|
376
421
|
* @returns Promise containing workflow details including steps and graphs
|
|
377
422
|
*/
|
|
378
423
|
details(): Promise<GetWorkflowResponse>;
|
|
424
|
+
/**
|
|
425
|
+
* Retrieves all runs for a workflow
|
|
426
|
+
* @param params - Parameters for filtering runs
|
|
427
|
+
* @returns Promise containing workflow runs array
|
|
428
|
+
*/
|
|
429
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
379
430
|
/**
|
|
380
431
|
* @deprecated Use `startAsync` instead
|
|
381
432
|
* Executes the workflow with the provided parameters
|
|
@@ -469,9 +520,111 @@ declare class Tool extends BaseResource {
|
|
|
469
520
|
*/
|
|
470
521
|
execute(params: {
|
|
471
522
|
data: any;
|
|
523
|
+
runId?: string;
|
|
472
524
|
}): Promise<any>;
|
|
473
525
|
}
|
|
474
526
|
|
|
527
|
+
declare class VNextWorkflow extends BaseResource {
|
|
528
|
+
private workflowId;
|
|
529
|
+
constructor(options: ClientOptions, workflowId: string);
|
|
530
|
+
/**
|
|
531
|
+
* Creates an async generator that processes a readable stream and yields vNext workflow records
|
|
532
|
+
* separated by the Record Separator character (\x1E)
|
|
533
|
+
*
|
|
534
|
+
* @param stream - The readable stream to process
|
|
535
|
+
* @returns An async generator that yields parsed records
|
|
536
|
+
*/
|
|
537
|
+
private streamProcessor;
|
|
538
|
+
/**
|
|
539
|
+
* Retrieves details about the vNext workflow
|
|
540
|
+
* @returns Promise containing vNext workflow details including steps and graphs
|
|
541
|
+
*/
|
|
542
|
+
details(): Promise<GetVNextWorkflowResponse>;
|
|
543
|
+
/**
|
|
544
|
+
* Retrieves all runs for a vNext workflow
|
|
545
|
+
* @param params - Parameters for filtering runs
|
|
546
|
+
* @returns Promise containing vNext workflow runs array
|
|
547
|
+
*/
|
|
548
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
549
|
+
/**
|
|
550
|
+
* Creates a new vNext workflow run
|
|
551
|
+
* @param params - Optional object containing the optional runId
|
|
552
|
+
* @returns Promise containing the runId of the created run
|
|
553
|
+
*/
|
|
554
|
+
createRun(params?: {
|
|
555
|
+
runId?: string;
|
|
556
|
+
}): Promise<{
|
|
557
|
+
runId: string;
|
|
558
|
+
}>;
|
|
559
|
+
/**
|
|
560
|
+
* Starts a vNext workflow run synchronously without waiting for the workflow to complete
|
|
561
|
+
* @param params - Object containing the runId, inputData and runtimeContext
|
|
562
|
+
* @returns Promise containing success message
|
|
563
|
+
*/
|
|
564
|
+
start(params: {
|
|
565
|
+
runId: string;
|
|
566
|
+
inputData: Record<string, any>;
|
|
567
|
+
runtimeContext?: RuntimeContext;
|
|
568
|
+
}): Promise<{
|
|
569
|
+
message: string;
|
|
570
|
+
}>;
|
|
571
|
+
/**
|
|
572
|
+
* Resumes a suspended vNext workflow step synchronously without waiting for the vNext workflow to complete
|
|
573
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
574
|
+
* @returns Promise containing success message
|
|
575
|
+
*/
|
|
576
|
+
resume({ step, runId, resumeData, runtimeContext, }: {
|
|
577
|
+
step: string | string[];
|
|
578
|
+
runId: string;
|
|
579
|
+
resumeData?: Record<string, any>;
|
|
580
|
+
runtimeContext?: RuntimeContext;
|
|
581
|
+
}): Promise<{
|
|
582
|
+
message: string;
|
|
583
|
+
}>;
|
|
584
|
+
/**
|
|
585
|
+
* Starts a vNext workflow run asynchronously and returns a promise that resolves when the vNext workflow is complete
|
|
586
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
587
|
+
* @returns Promise containing the vNext workflow execution results
|
|
588
|
+
*/
|
|
589
|
+
startAsync(params: {
|
|
590
|
+
runId?: string;
|
|
591
|
+
inputData: Record<string, any>;
|
|
592
|
+
runtimeContext?: RuntimeContext;
|
|
593
|
+
}): Promise<VNextWorkflowRunResult>;
|
|
594
|
+
/**
|
|
595
|
+
* Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
|
|
596
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
597
|
+
* @returns Promise containing the vNext workflow resume results
|
|
598
|
+
*/
|
|
599
|
+
resumeAsync(params: {
|
|
600
|
+
runId: string;
|
|
601
|
+
step: string | string[];
|
|
602
|
+
resumeData?: Record<string, any>;
|
|
603
|
+
runtimeContext?: RuntimeContext;
|
|
604
|
+
}): Promise<VNextWorkflowRunResult>;
|
|
605
|
+
/**
|
|
606
|
+
* Watches vNext workflow transitions in real-time
|
|
607
|
+
* @param runId - Optional run ID to filter the watch stream
|
|
608
|
+
* @returns AsyncGenerator that yields parsed records from the vNext workflow watch stream
|
|
609
|
+
*/
|
|
610
|
+
watch({ runId }: {
|
|
611
|
+
runId?: string;
|
|
612
|
+
}, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* MCP Server resource for interacting with MCP servers
|
|
617
|
+
*/
|
|
618
|
+
declare class MCPServer extends BaseResource {
|
|
619
|
+
private serverId;
|
|
620
|
+
constructor(options: ClientOptions, serverId: string);
|
|
621
|
+
/**
|
|
622
|
+
* Get details about the MCP server
|
|
623
|
+
* @returns Promise containing server details
|
|
624
|
+
*/
|
|
625
|
+
details(): Promise<GetMCPServerResponse>;
|
|
626
|
+
}
|
|
627
|
+
|
|
475
628
|
declare class MastraClient extends BaseResource {
|
|
476
629
|
constructor(options: ClientOptions);
|
|
477
630
|
/**
|
|
@@ -538,6 +691,17 @@ declare class MastraClient extends BaseResource {
|
|
|
538
691
|
* @returns Workflow instance
|
|
539
692
|
*/
|
|
540
693
|
getWorkflow(workflowId: string): Workflow;
|
|
694
|
+
/**
|
|
695
|
+
* Retrieves all available vNext workflows
|
|
696
|
+
* @returns Promise containing map of vNext workflow IDs to vNext workflow details
|
|
697
|
+
*/
|
|
698
|
+
getVNextWorkflows(): Promise<Record<string, GetVNextWorkflowResponse>>;
|
|
699
|
+
/**
|
|
700
|
+
* Gets a vNext workflow instance by ID
|
|
701
|
+
* @param workflowId - ID of the vNext workflow to retrieve
|
|
702
|
+
* @returns vNext Workflow instance
|
|
703
|
+
*/
|
|
704
|
+
getVNextWorkflow(workflowId: string): VNextWorkflow;
|
|
541
705
|
/**
|
|
542
706
|
* Gets a vector instance by name
|
|
543
707
|
* @param vectorName - Name of the vector to retrieve
|
|
@@ -580,6 +744,17 @@ declare class MastraClient extends BaseResource {
|
|
|
580
744
|
* @returns Network instance
|
|
581
745
|
*/
|
|
582
746
|
getNetwork(networkId: string): Network;
|
|
747
|
+
/**
|
|
748
|
+
* Retrieves all available MCP servers
|
|
749
|
+
* @returns Promise containing map of MCP server IDs to server details
|
|
750
|
+
*/
|
|
751
|
+
getMCPServers(): Promise<Record<string, GetMCPServerResponse>>;
|
|
752
|
+
/**
|
|
753
|
+
* Gets an MCP server instance by ID
|
|
754
|
+
* @param serverId - ID of the MCP server to retrieve
|
|
755
|
+
* @returns MCPServer instance
|
|
756
|
+
*/
|
|
757
|
+
getMCPServer(serverId: string): MCPServer;
|
|
583
758
|
}
|
|
584
759
|
|
|
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 };
|
|
760
|
+
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMCPServerResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, 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 };
|
package/dist/index.d.ts
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,14 @@ interface GetWorkflowResponse {
|
|
|
53
58
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
54
59
|
workflowId?: string;
|
|
55
60
|
}
|
|
61
|
+
interface GetWorkflowRunsParams {
|
|
62
|
+
fromDate?: Date;
|
|
63
|
+
toDate?: Date;
|
|
64
|
+
limit?: number;
|
|
65
|
+
offset?: number;
|
|
66
|
+
resourceId?: string;
|
|
67
|
+
}
|
|
68
|
+
type GetWorkflowRunsResponse = WorkflowRuns;
|
|
56
69
|
type WorkflowRunResult = {
|
|
57
70
|
activePaths: Record<string, {
|
|
58
71
|
status: string;
|
|
@@ -63,6 +76,26 @@ type WorkflowRunResult = {
|
|
|
63
76
|
timestamp: number;
|
|
64
77
|
runId: string;
|
|
65
78
|
};
|
|
79
|
+
interface GetVNextWorkflowResponse {
|
|
80
|
+
name: string;
|
|
81
|
+
steps: {
|
|
82
|
+
[key: string]: {
|
|
83
|
+
id: string;
|
|
84
|
+
description: string;
|
|
85
|
+
inputSchema: string;
|
|
86
|
+
outputSchema: string;
|
|
87
|
+
resumeSchema: string;
|
|
88
|
+
suspendSchema: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
stepGraph: NewWorkflow['serializedStepGraph'];
|
|
92
|
+
inputSchema: string;
|
|
93
|
+
outputSchema: string;
|
|
94
|
+
}
|
|
95
|
+
type VNextWorkflowWatchResult = WatchEvent & {
|
|
96
|
+
runId: string;
|
|
97
|
+
};
|
|
98
|
+
type VNextWorkflowRunResult = WorkflowResult<any, any>;
|
|
66
99
|
interface UpsertVectorParams {
|
|
67
100
|
indexName: string;
|
|
68
101
|
vectors: number[][];
|
|
@@ -97,7 +130,7 @@ type SaveMessageToMemoryResponse = MessageType[];
|
|
|
97
130
|
interface CreateMemoryThreadParams {
|
|
98
131
|
title: string;
|
|
99
132
|
metadata: Record<string, any>;
|
|
100
|
-
|
|
133
|
+
resourceId: string;
|
|
101
134
|
threadId: string;
|
|
102
135
|
agentId: string;
|
|
103
136
|
}
|
|
@@ -110,7 +143,7 @@ type GetMemoryThreadResponse = StorageThreadType[];
|
|
|
110
143
|
interface UpdateMemoryThreadParams {
|
|
111
144
|
title: string;
|
|
112
145
|
metadata: Record<string, any>;
|
|
113
|
-
|
|
146
|
+
resourceId: string;
|
|
114
147
|
}
|
|
115
148
|
interface GetMemoryThreadMessagesResponse {
|
|
116
149
|
messages: CoreMessage[];
|
|
@@ -171,6 +204,8 @@ interface GetTelemetryParams {
|
|
|
171
204
|
page?: number;
|
|
172
205
|
perPage?: number;
|
|
173
206
|
attribute?: Record<string, string>;
|
|
207
|
+
fromDate?: Date;
|
|
208
|
+
toDate?: Date;
|
|
174
209
|
}
|
|
175
210
|
interface GetNetworkResponse {
|
|
176
211
|
name: string;
|
|
@@ -186,6 +221,16 @@ interface GetNetworkResponse {
|
|
|
186
221
|
};
|
|
187
222
|
state?: Record<string, any>;
|
|
188
223
|
}
|
|
224
|
+
interface GetMCPServerResponse {
|
|
225
|
+
id: string;
|
|
226
|
+
name: string;
|
|
227
|
+
description?: string;
|
|
228
|
+
tools: Array<{
|
|
229
|
+
name: string;
|
|
230
|
+
description: string;
|
|
231
|
+
parameters: Record<string, any>;
|
|
232
|
+
}>;
|
|
233
|
+
}
|
|
189
234
|
|
|
190
235
|
declare class BaseResource {
|
|
191
236
|
readonly options: ClientOptions;
|
|
@@ -376,6 +421,12 @@ declare class Workflow extends BaseResource {
|
|
|
376
421
|
* @returns Promise containing workflow details including steps and graphs
|
|
377
422
|
*/
|
|
378
423
|
details(): Promise<GetWorkflowResponse>;
|
|
424
|
+
/**
|
|
425
|
+
* Retrieves all runs for a workflow
|
|
426
|
+
* @param params - Parameters for filtering runs
|
|
427
|
+
* @returns Promise containing workflow runs array
|
|
428
|
+
*/
|
|
429
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
379
430
|
/**
|
|
380
431
|
* @deprecated Use `startAsync` instead
|
|
381
432
|
* Executes the workflow with the provided parameters
|
|
@@ -469,9 +520,111 @@ declare class Tool extends BaseResource {
|
|
|
469
520
|
*/
|
|
470
521
|
execute(params: {
|
|
471
522
|
data: any;
|
|
523
|
+
runId?: string;
|
|
472
524
|
}): Promise<any>;
|
|
473
525
|
}
|
|
474
526
|
|
|
527
|
+
declare class VNextWorkflow extends BaseResource {
|
|
528
|
+
private workflowId;
|
|
529
|
+
constructor(options: ClientOptions, workflowId: string);
|
|
530
|
+
/**
|
|
531
|
+
* Creates an async generator that processes a readable stream and yields vNext workflow records
|
|
532
|
+
* separated by the Record Separator character (\x1E)
|
|
533
|
+
*
|
|
534
|
+
* @param stream - The readable stream to process
|
|
535
|
+
* @returns An async generator that yields parsed records
|
|
536
|
+
*/
|
|
537
|
+
private streamProcessor;
|
|
538
|
+
/**
|
|
539
|
+
* Retrieves details about the vNext workflow
|
|
540
|
+
* @returns Promise containing vNext workflow details including steps and graphs
|
|
541
|
+
*/
|
|
542
|
+
details(): Promise<GetVNextWorkflowResponse>;
|
|
543
|
+
/**
|
|
544
|
+
* Retrieves all runs for a vNext workflow
|
|
545
|
+
* @param params - Parameters for filtering runs
|
|
546
|
+
* @returns Promise containing vNext workflow runs array
|
|
547
|
+
*/
|
|
548
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
549
|
+
/**
|
|
550
|
+
* Creates a new vNext workflow run
|
|
551
|
+
* @param params - Optional object containing the optional runId
|
|
552
|
+
* @returns Promise containing the runId of the created run
|
|
553
|
+
*/
|
|
554
|
+
createRun(params?: {
|
|
555
|
+
runId?: string;
|
|
556
|
+
}): Promise<{
|
|
557
|
+
runId: string;
|
|
558
|
+
}>;
|
|
559
|
+
/**
|
|
560
|
+
* Starts a vNext workflow run synchronously without waiting for the workflow to complete
|
|
561
|
+
* @param params - Object containing the runId, inputData and runtimeContext
|
|
562
|
+
* @returns Promise containing success message
|
|
563
|
+
*/
|
|
564
|
+
start(params: {
|
|
565
|
+
runId: string;
|
|
566
|
+
inputData: Record<string, any>;
|
|
567
|
+
runtimeContext?: RuntimeContext;
|
|
568
|
+
}): Promise<{
|
|
569
|
+
message: string;
|
|
570
|
+
}>;
|
|
571
|
+
/**
|
|
572
|
+
* Resumes a suspended vNext workflow step synchronously without waiting for the vNext workflow to complete
|
|
573
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
574
|
+
* @returns Promise containing success message
|
|
575
|
+
*/
|
|
576
|
+
resume({ step, runId, resumeData, runtimeContext, }: {
|
|
577
|
+
step: string | string[];
|
|
578
|
+
runId: string;
|
|
579
|
+
resumeData?: Record<string, any>;
|
|
580
|
+
runtimeContext?: RuntimeContext;
|
|
581
|
+
}): Promise<{
|
|
582
|
+
message: string;
|
|
583
|
+
}>;
|
|
584
|
+
/**
|
|
585
|
+
* Starts a vNext workflow run asynchronously and returns a promise that resolves when the vNext workflow is complete
|
|
586
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
587
|
+
* @returns Promise containing the vNext workflow execution results
|
|
588
|
+
*/
|
|
589
|
+
startAsync(params: {
|
|
590
|
+
runId?: string;
|
|
591
|
+
inputData: Record<string, any>;
|
|
592
|
+
runtimeContext?: RuntimeContext;
|
|
593
|
+
}): Promise<VNextWorkflowRunResult>;
|
|
594
|
+
/**
|
|
595
|
+
* Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
|
|
596
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
597
|
+
* @returns Promise containing the vNext workflow resume results
|
|
598
|
+
*/
|
|
599
|
+
resumeAsync(params: {
|
|
600
|
+
runId: string;
|
|
601
|
+
step: string | string[];
|
|
602
|
+
resumeData?: Record<string, any>;
|
|
603
|
+
runtimeContext?: RuntimeContext;
|
|
604
|
+
}): Promise<VNextWorkflowRunResult>;
|
|
605
|
+
/**
|
|
606
|
+
* Watches vNext workflow transitions in real-time
|
|
607
|
+
* @param runId - Optional run ID to filter the watch stream
|
|
608
|
+
* @returns AsyncGenerator that yields parsed records from the vNext workflow watch stream
|
|
609
|
+
*/
|
|
610
|
+
watch({ runId }: {
|
|
611
|
+
runId?: string;
|
|
612
|
+
}, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* MCP Server resource for interacting with MCP servers
|
|
617
|
+
*/
|
|
618
|
+
declare class MCPServer extends BaseResource {
|
|
619
|
+
private serverId;
|
|
620
|
+
constructor(options: ClientOptions, serverId: string);
|
|
621
|
+
/**
|
|
622
|
+
* Get details about the MCP server
|
|
623
|
+
* @returns Promise containing server details
|
|
624
|
+
*/
|
|
625
|
+
details(): Promise<GetMCPServerResponse>;
|
|
626
|
+
}
|
|
627
|
+
|
|
475
628
|
declare class MastraClient extends BaseResource {
|
|
476
629
|
constructor(options: ClientOptions);
|
|
477
630
|
/**
|
|
@@ -538,6 +691,17 @@ declare class MastraClient extends BaseResource {
|
|
|
538
691
|
* @returns Workflow instance
|
|
539
692
|
*/
|
|
540
693
|
getWorkflow(workflowId: string): Workflow;
|
|
694
|
+
/**
|
|
695
|
+
* Retrieves all available vNext workflows
|
|
696
|
+
* @returns Promise containing map of vNext workflow IDs to vNext workflow details
|
|
697
|
+
*/
|
|
698
|
+
getVNextWorkflows(): Promise<Record<string, GetVNextWorkflowResponse>>;
|
|
699
|
+
/**
|
|
700
|
+
* Gets a vNext workflow instance by ID
|
|
701
|
+
* @param workflowId - ID of the vNext workflow to retrieve
|
|
702
|
+
* @returns vNext Workflow instance
|
|
703
|
+
*/
|
|
704
|
+
getVNextWorkflow(workflowId: string): VNextWorkflow;
|
|
541
705
|
/**
|
|
542
706
|
* Gets a vector instance by name
|
|
543
707
|
* @param vectorName - Name of the vector to retrieve
|
|
@@ -580,6 +744,17 @@ declare class MastraClient extends BaseResource {
|
|
|
580
744
|
* @returns Network instance
|
|
581
745
|
*/
|
|
582
746
|
getNetwork(networkId: string): Network;
|
|
747
|
+
/**
|
|
748
|
+
* Retrieves all available MCP servers
|
|
749
|
+
* @returns Promise containing map of MCP server IDs to server details
|
|
750
|
+
*/
|
|
751
|
+
getMCPServers(): Promise<Record<string, GetMCPServerResponse>>;
|
|
752
|
+
/**
|
|
753
|
+
* Gets an MCP server instance by ID
|
|
754
|
+
* @param serverId - ID of the MCP server to retrieve
|
|
755
|
+
* @returns MCPServer instance
|
|
756
|
+
*/
|
|
757
|
+
getMCPServer(serverId: string): MCPServer;
|
|
583
758
|
}
|
|
584
759
|
|
|
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 };
|
|
760
|
+
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMCPServerResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, 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 };
|