@mastra/client-js 0.0.0-a2a-20250421213654 → 0.0.0-add-runtime-context-to-openai-realtime-20250516201052
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 +364 -2
- package/dist/index.cjs +632 -97
- package/dist/index.d.cts +285 -135
- package/dist/index.d.ts +285 -135
- package/dist/index.js +629 -96
- package/package.json +11 -6
- package/src/adapters/agui.test.ts +180 -0
- package/src/adapters/agui.ts +239 -0
- package/src/client.ts +119 -14
- package/src/example.ts +29 -30
- package/src/index.test.ts +125 -5
- package/src/resources/a2a.ts +60 -71
- package/src/resources/agent.ts +27 -36
- package/src/resources/base.ts +2 -2
- package/src/resources/index.ts +2 -0
- package/src/resources/mcp-tool.ts +48 -0
- package/src/resources/memory-thread.ts +8 -5
- package/src/resources/network.ts +6 -12
- package/src/resources/tool.ts +15 -3
- package/src/resources/vnext-workflow.ts +261 -0
- package/src/resources/workflow.ts +38 -2
- package/src/types.ts +80 -116
- package/src/utils/zod-to-json-schema.ts +10 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AbstractAgent } from '@ag-ui/client';
|
|
2
|
+
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
3
|
+
import { StepAction, StepGraph, CoreMessage, AiMessageType, StorageThreadType, MessageType, WorkflowRuns, WorkflowRunResult as WorkflowRunResult$1, VNextWorkflowRuns, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
|
|
2
4
|
import { JSONSchema7 } from 'json-schema';
|
|
3
5
|
import { ZodSchema } from 'zod';
|
|
4
|
-
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
5
6
|
import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
|
|
7
|
+
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
8
|
+
import { ServerInfo, ServerDetailInfo } from '@mastra/core/mcp';
|
|
9
|
+
import { NewWorkflow, WorkflowResult, WatchEvent } from '@mastra/core/workflows/vNext';
|
|
10
|
+
import { RuntimeContext as RuntimeContext$1 } from '@mastra/core/di';
|
|
11
|
+
import { AgentCard, TaskSendParams, Task, TaskQueryParams, TaskIdParams } from '@mastra/core/a2a';
|
|
6
12
|
|
|
7
13
|
interface ClientOptions {
|
|
8
14
|
/** Base URL for API requests */
|
|
@@ -23,21 +29,36 @@ interface RequestOptions {
|
|
|
23
29
|
stream?: boolean;
|
|
24
30
|
signal?: AbortSignal;
|
|
25
31
|
}
|
|
32
|
+
type WithoutMethods<T> = {
|
|
33
|
+
[K in keyof T as T[K] extends (...args: any[]) => any ? never : T[K] extends {
|
|
34
|
+
(): any;
|
|
35
|
+
} ? never : T[K] extends undefined | ((...args: any[]) => any) ? never : K]: T[K];
|
|
36
|
+
};
|
|
26
37
|
interface GetAgentResponse {
|
|
27
38
|
name: string;
|
|
28
39
|
instructions: string;
|
|
29
40
|
tools: Record<string, GetToolResponse>;
|
|
41
|
+
workflows: Record<string, GetWorkflowResponse>;
|
|
30
42
|
provider: string;
|
|
31
43
|
modelId: string;
|
|
32
44
|
}
|
|
33
45
|
type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
34
46
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
35
|
-
|
|
47
|
+
output?: T;
|
|
48
|
+
experimental_output?: T;
|
|
49
|
+
runtimeContext?: RuntimeContext;
|
|
50
|
+
} & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
|
|
36
51
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
37
52
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
38
|
-
|
|
53
|
+
output?: T;
|
|
54
|
+
experimental_output?: T;
|
|
55
|
+
runtimeContext?: RuntimeContext;
|
|
56
|
+
} & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
|
|
39
57
|
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
40
58
|
evals: any[];
|
|
59
|
+
instructions: string;
|
|
60
|
+
name: string;
|
|
61
|
+
id: string;
|
|
41
62
|
}
|
|
42
63
|
interface GetToolResponse {
|
|
43
64
|
id: string;
|
|
@@ -53,6 +74,15 @@ interface GetWorkflowResponse {
|
|
|
53
74
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
54
75
|
workflowId?: string;
|
|
55
76
|
}
|
|
77
|
+
interface GetWorkflowRunsParams {
|
|
78
|
+
fromDate?: Date;
|
|
79
|
+
toDate?: Date;
|
|
80
|
+
limit?: number;
|
|
81
|
+
offset?: number;
|
|
82
|
+
resourceId?: string;
|
|
83
|
+
}
|
|
84
|
+
type GetWorkflowRunsResponse = WorkflowRuns;
|
|
85
|
+
type GetVNextWorkflowRunsResponse = VNextWorkflowRuns;
|
|
56
86
|
type WorkflowRunResult = {
|
|
57
87
|
activePaths: Record<string, {
|
|
58
88
|
status: string;
|
|
@@ -63,6 +93,26 @@ type WorkflowRunResult = {
|
|
|
63
93
|
timestamp: number;
|
|
64
94
|
runId: string;
|
|
65
95
|
};
|
|
96
|
+
interface GetVNextWorkflowResponse {
|
|
97
|
+
name: string;
|
|
98
|
+
steps: {
|
|
99
|
+
[key: string]: {
|
|
100
|
+
id: string;
|
|
101
|
+
description: string;
|
|
102
|
+
inputSchema: string;
|
|
103
|
+
outputSchema: string;
|
|
104
|
+
resumeSchema: string;
|
|
105
|
+
suspendSchema: string;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
stepGraph: NewWorkflow['serializedStepGraph'];
|
|
109
|
+
inputSchema: string;
|
|
110
|
+
outputSchema: string;
|
|
111
|
+
}
|
|
112
|
+
type VNextWorkflowWatchResult = WatchEvent & {
|
|
113
|
+
runId: string;
|
|
114
|
+
};
|
|
115
|
+
type VNextWorkflowRunResult = WorkflowResult<any, any>;
|
|
66
116
|
interface UpsertVectorParams {
|
|
67
117
|
indexName: string;
|
|
68
118
|
vectors: number[][];
|
|
@@ -97,7 +147,7 @@ type SaveMessageToMemoryResponse = MessageType[];
|
|
|
97
147
|
interface CreateMemoryThreadParams {
|
|
98
148
|
title: string;
|
|
99
149
|
metadata: Record<string, any>;
|
|
100
|
-
|
|
150
|
+
resourceId: string;
|
|
101
151
|
threadId: string;
|
|
102
152
|
agentId: string;
|
|
103
153
|
}
|
|
@@ -110,7 +160,13 @@ type GetMemoryThreadResponse = StorageThreadType[];
|
|
|
110
160
|
interface UpdateMemoryThreadParams {
|
|
111
161
|
title: string;
|
|
112
162
|
metadata: Record<string, any>;
|
|
113
|
-
|
|
163
|
+
resourceId: string;
|
|
164
|
+
}
|
|
165
|
+
interface GetMemoryThreadMessagesParams {
|
|
166
|
+
/**
|
|
167
|
+
* Limit the number of messages to retrieve (default: 40)
|
|
168
|
+
*/
|
|
169
|
+
limit?: number;
|
|
114
170
|
}
|
|
115
171
|
interface GetMemoryThreadMessagesResponse {
|
|
116
172
|
messages: CoreMessage[];
|
|
@@ -171,6 +227,8 @@ interface GetTelemetryParams {
|
|
|
171
227
|
page?: number;
|
|
172
228
|
perPage?: number;
|
|
173
229
|
attribute?: Record<string, string>;
|
|
230
|
+
fromDate?: Date;
|
|
231
|
+
toDate?: Date;
|
|
174
232
|
}
|
|
175
233
|
interface GetNetworkResponse {
|
|
176
234
|
name: string;
|
|
@@ -186,104 +244,19 @@ interface GetNetworkResponse {
|
|
|
186
244
|
};
|
|
187
245
|
state?: Record<string, any>;
|
|
188
246
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
FAILED = "failed",
|
|
194
|
-
CANCELED = "canceled"
|
|
195
|
-
}
|
|
196
|
-
declare enum ErrorCode {
|
|
197
|
-
PARSE_ERROR = -32700,
|
|
198
|
-
INVALID_REQUEST = -32600,
|
|
199
|
-
METHOD_NOT_FOUND = -32601,
|
|
200
|
-
INVALID_PARAMS = -32602,
|
|
201
|
-
INTERNAL_ERROR = -32603,
|
|
202
|
-
TASK_NOT_FOUND = -32000,
|
|
203
|
-
TASK_NOT_CANCELABLE = -32001
|
|
204
|
-
}
|
|
205
|
-
interface A2AMessagePart {
|
|
206
|
-
type: string;
|
|
207
|
-
[key: string]: any;
|
|
208
|
-
}
|
|
209
|
-
interface A2AMessage {
|
|
210
|
-
role: 'user' | 'agent';
|
|
211
|
-
parts: A2AMessagePart[];
|
|
212
|
-
}
|
|
213
|
-
interface TaskStatus {
|
|
214
|
-
state: TaskState;
|
|
215
|
-
message?: A2AMessage;
|
|
216
|
-
timestamp: string;
|
|
217
|
-
}
|
|
218
|
-
interface Task {
|
|
219
|
-
id: string;
|
|
220
|
-
sessionId: string | null;
|
|
221
|
-
status: TaskStatus;
|
|
222
|
-
history: A2AMessage[];
|
|
223
|
-
}
|
|
224
|
-
interface JSONRPCRequest {
|
|
225
|
-
jsonrpc: '2.0';
|
|
226
|
-
id: string | number | null;
|
|
227
|
-
method: string;
|
|
228
|
-
params: Record<string, any>;
|
|
229
|
-
}
|
|
230
|
-
interface SendTaskRequest extends JSONRPCRequest {
|
|
231
|
-
method: 'tasks/send';
|
|
232
|
-
params: {
|
|
233
|
-
id: string;
|
|
234
|
-
message: A2AMessage;
|
|
235
|
-
sessionId?: string;
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
interface GetTaskRequest extends JSONRPCRequest {
|
|
239
|
-
method: 'tasks/get';
|
|
240
|
-
params: {
|
|
241
|
-
id: string;
|
|
242
|
-
historyLength?: number;
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
interface CancelTaskRequest extends JSONRPCRequest {
|
|
246
|
-
method: 'tasks/cancel';
|
|
247
|
-
params: {
|
|
248
|
-
id: string;
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
type A2ARequest = SendTaskRequest | GetTaskRequest | CancelTaskRequest;
|
|
252
|
-
interface JSONRPCSuccessResponse {
|
|
253
|
-
jsonrpc: '2.0';
|
|
254
|
-
id: string | number | null;
|
|
255
|
-
result: any;
|
|
256
|
-
}
|
|
257
|
-
interface JSONRPCErrorResponse {
|
|
258
|
-
jsonrpc: '2.0';
|
|
259
|
-
id: string | number | null;
|
|
260
|
-
error: {
|
|
261
|
-
code: ErrorCode;
|
|
262
|
-
message: string;
|
|
263
|
-
data?: any;
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
type JSONRPCResponse = JSONRPCSuccessResponse | JSONRPCErrorResponse;
|
|
267
|
-
interface AgentCapabilities {
|
|
268
|
-
tasks: {
|
|
269
|
-
send: boolean;
|
|
270
|
-
get: boolean;
|
|
271
|
-
cancel: boolean;
|
|
272
|
-
};
|
|
273
|
-
pushNotifications: boolean;
|
|
247
|
+
interface McpServerListResponse {
|
|
248
|
+
servers: ServerInfo[];
|
|
249
|
+
next: string | null;
|
|
250
|
+
total_count: number;
|
|
274
251
|
}
|
|
275
|
-
interface
|
|
252
|
+
interface McpToolInfo {
|
|
276
253
|
id: string;
|
|
277
254
|
name: string;
|
|
278
|
-
description
|
|
255
|
+
description?: string;
|
|
256
|
+
inputSchema: string;
|
|
279
257
|
}
|
|
280
|
-
interface
|
|
281
|
-
|
|
282
|
-
description: string;
|
|
283
|
-
url: string;
|
|
284
|
-
version: string;
|
|
285
|
-
capabilities: AgentCapabilities;
|
|
286
|
-
skills: AgentSkill[];
|
|
258
|
+
interface McpServerToolListResponse {
|
|
259
|
+
tools: McpToolInfo[];
|
|
287
260
|
}
|
|
288
261
|
|
|
289
262
|
declare class BaseResource {
|
|
@@ -317,7 +290,9 @@ declare class AgentVoice extends BaseResource {
|
|
|
317
290
|
* @param options - Optional provider-specific options
|
|
318
291
|
* @returns Promise containing the transcribed text
|
|
319
292
|
*/
|
|
320
|
-
listen(audio: Blob, options?: Record<string, any>): Promise<
|
|
293
|
+
listen(audio: Blob, options?: Record<string, any>): Promise<{
|
|
294
|
+
text: string;
|
|
295
|
+
}>;
|
|
321
296
|
/**
|
|
322
297
|
* Get available speakers for the agent's voice provider
|
|
323
298
|
* @returns Promise containing list of available speakers
|
|
@@ -356,6 +331,16 @@ declare class Agent extends BaseResource {
|
|
|
356
331
|
* @returns Promise containing tool details
|
|
357
332
|
*/
|
|
358
333
|
getTool(toolId: string): Promise<GetToolResponse>;
|
|
334
|
+
/**
|
|
335
|
+
* Executes a tool for the agent
|
|
336
|
+
* @param toolId - ID of the tool to execute
|
|
337
|
+
* @param params - Parameters required for tool execution
|
|
338
|
+
* @returns Promise containing the tool execution results
|
|
339
|
+
*/
|
|
340
|
+
executeTool(toolId: string, params: {
|
|
341
|
+
data: any;
|
|
342
|
+
runtimeContext?: RuntimeContext$1;
|
|
343
|
+
}): Promise<any>;
|
|
359
344
|
/**
|
|
360
345
|
* Retrieves evaluation results for the agent
|
|
361
346
|
* @returns Promise containing agent evaluations
|
|
@@ -416,9 +401,10 @@ declare class MemoryThread extends BaseResource {
|
|
|
416
401
|
}>;
|
|
417
402
|
/**
|
|
418
403
|
* Retrieves messages associated with the thread
|
|
404
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
419
405
|
* @returns Promise containing thread messages and UI messages
|
|
420
406
|
*/
|
|
421
|
-
getMessages(): Promise<GetMemoryThreadMessagesResponse>;
|
|
407
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
422
408
|
}
|
|
423
409
|
|
|
424
410
|
declare class Vector extends BaseResource {
|
|
@@ -475,6 +461,12 @@ declare class Workflow extends BaseResource {
|
|
|
475
461
|
* @returns Promise containing workflow details including steps and graphs
|
|
476
462
|
*/
|
|
477
463
|
details(): Promise<GetWorkflowResponse>;
|
|
464
|
+
/**
|
|
465
|
+
* Retrieves all runs for a workflow
|
|
466
|
+
* @param params - Parameters for filtering runs
|
|
467
|
+
* @returns Promise containing workflow runs array
|
|
468
|
+
*/
|
|
469
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
478
470
|
/**
|
|
479
471
|
* @deprecated Use `startAsync` instead
|
|
480
472
|
* Executes the workflow with the provided parameters
|
|
@@ -568,51 +560,162 @@ declare class Tool extends BaseResource {
|
|
|
568
560
|
*/
|
|
569
561
|
execute(params: {
|
|
570
562
|
data: any;
|
|
563
|
+
runId?: string;
|
|
564
|
+
runtimeContext?: RuntimeContext$1;
|
|
571
565
|
}): Promise<any>;
|
|
572
566
|
}
|
|
573
567
|
|
|
568
|
+
declare class VNextWorkflow extends BaseResource {
|
|
569
|
+
private workflowId;
|
|
570
|
+
constructor(options: ClientOptions, workflowId: string);
|
|
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
|
+
private streamProcessor;
|
|
579
|
+
/**
|
|
580
|
+
* Retrieves details about the vNext workflow
|
|
581
|
+
* @returns Promise containing vNext workflow details including steps and graphs
|
|
582
|
+
*/
|
|
583
|
+
details(): Promise<GetVNextWorkflowResponse>;
|
|
584
|
+
/**
|
|
585
|
+
* Retrieves all runs for a vNext workflow
|
|
586
|
+
* @param params - Parameters for filtering runs
|
|
587
|
+
* @returns Promise containing vNext workflow runs array
|
|
588
|
+
*/
|
|
589
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetVNextWorkflowRunsResponse>;
|
|
590
|
+
/**
|
|
591
|
+
* Creates a new vNext workflow run
|
|
592
|
+
* @param params - Optional object containing the optional runId
|
|
593
|
+
* @returns Promise containing the runId of the created run
|
|
594
|
+
*/
|
|
595
|
+
createRun(params?: {
|
|
596
|
+
runId?: string;
|
|
597
|
+
}): Promise<{
|
|
598
|
+
runId: string;
|
|
599
|
+
}>;
|
|
600
|
+
/**
|
|
601
|
+
* Starts a vNext workflow run synchronously without waiting for the workflow to complete
|
|
602
|
+
* @param params - Object containing the runId, inputData and runtimeContext
|
|
603
|
+
* @returns Promise containing success message
|
|
604
|
+
*/
|
|
605
|
+
start(params: {
|
|
606
|
+
runId: string;
|
|
607
|
+
inputData: Record<string, any>;
|
|
608
|
+
runtimeContext?: RuntimeContext;
|
|
609
|
+
}): Promise<{
|
|
610
|
+
message: string;
|
|
611
|
+
}>;
|
|
612
|
+
/**
|
|
613
|
+
* Resumes a suspended vNext workflow step synchronously without waiting for the vNext workflow to complete
|
|
614
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
615
|
+
* @returns Promise containing success message
|
|
616
|
+
*/
|
|
617
|
+
resume({ step, runId, resumeData, ...rest }: {
|
|
618
|
+
step: string | string[];
|
|
619
|
+
runId: string;
|
|
620
|
+
resumeData?: Record<string, any>;
|
|
621
|
+
runtimeContext?: RuntimeContext;
|
|
622
|
+
}): Promise<{
|
|
623
|
+
message: string;
|
|
624
|
+
}>;
|
|
625
|
+
/**
|
|
626
|
+
* Starts a vNext workflow run asynchronously and returns a promise that resolves when the vNext workflow is complete
|
|
627
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
628
|
+
* @returns Promise containing the vNext workflow execution results
|
|
629
|
+
*/
|
|
630
|
+
startAsync(params: {
|
|
631
|
+
runId?: string;
|
|
632
|
+
inputData: Record<string, any>;
|
|
633
|
+
runtimeContext?: RuntimeContext;
|
|
634
|
+
}): Promise<VNextWorkflowRunResult>;
|
|
635
|
+
/**
|
|
636
|
+
* Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
|
|
637
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
638
|
+
* @returns Promise containing the vNext workflow resume results
|
|
639
|
+
*/
|
|
640
|
+
resumeAsync(params: {
|
|
641
|
+
runId: string;
|
|
642
|
+
step: string | string[];
|
|
643
|
+
resumeData?: Record<string, any>;
|
|
644
|
+
runtimeContext?: RuntimeContext;
|
|
645
|
+
}): Promise<VNextWorkflowRunResult>;
|
|
646
|
+
/**
|
|
647
|
+
* Watches vNext workflow transitions in real-time
|
|
648
|
+
* @param runId - Optional run ID to filter the watch stream
|
|
649
|
+
* @returns AsyncGenerator that yields parsed records from the vNext workflow watch stream
|
|
650
|
+
*/
|
|
651
|
+
watch({ runId }: {
|
|
652
|
+
runId?: string;
|
|
653
|
+
}, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
|
|
654
|
+
}
|
|
655
|
+
|
|
574
656
|
/**
|
|
575
|
-
*
|
|
657
|
+
* Class for interacting with an agent via the A2A protocol
|
|
576
658
|
*/
|
|
577
659
|
declare class A2A extends BaseResource {
|
|
660
|
+
private agentId;
|
|
661
|
+
constructor(options: ClientOptions, agentId: string);
|
|
578
662
|
/**
|
|
579
|
-
*
|
|
580
|
-
* @
|
|
581
|
-
* @returns Promise containing the A2A protocol response
|
|
663
|
+
* Get the agent card with metadata about the agent
|
|
664
|
+
* @returns Promise containing the agent card information
|
|
582
665
|
*/
|
|
583
|
-
|
|
666
|
+
getCard(): Promise<AgentCard>;
|
|
584
667
|
/**
|
|
585
|
-
*
|
|
586
|
-
* @param params - Parameters for
|
|
587
|
-
* @returns Promise containing the task
|
|
668
|
+
* Send a message to the agent and get a response
|
|
669
|
+
* @param params - Parameters for the task
|
|
670
|
+
* @returns Promise containing the task response
|
|
588
671
|
*/
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
672
|
+
sendMessage(params: TaskSendParams): Promise<{
|
|
673
|
+
task: Task;
|
|
674
|
+
}>;
|
|
675
|
+
/**
|
|
676
|
+
* Get the status and result of a task
|
|
677
|
+
* @param params - Parameters for querying the task
|
|
678
|
+
* @returns Promise containing the task response
|
|
679
|
+
*/
|
|
680
|
+
getTask(params: TaskQueryParams): Promise<Task>;
|
|
594
681
|
/**
|
|
595
|
-
*
|
|
596
|
-
* @param params - Parameters
|
|
597
|
-
* @returns Promise containing the task
|
|
682
|
+
* Cancel a running task
|
|
683
|
+
* @param params - Parameters identifying the task to cancel
|
|
684
|
+
* @returns Promise containing the task response
|
|
598
685
|
*/
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
686
|
+
cancelTask(params: TaskIdParams): Promise<{
|
|
687
|
+
task: Task;
|
|
688
|
+
}>;
|
|
689
|
+
/**
|
|
690
|
+
* Send a message and subscribe to streaming updates (not fully implemented)
|
|
691
|
+
* @param params - Parameters for the task
|
|
692
|
+
* @returns Promise containing the task response
|
|
693
|
+
*/
|
|
694
|
+
sendAndSubscribe(params: TaskSendParams): Promise<Response>;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Represents a specific tool available on a specific MCP server.
|
|
699
|
+
* Provides methods to get details and execute the tool.
|
|
700
|
+
*/
|
|
701
|
+
declare class MCPTool extends BaseResource {
|
|
702
|
+
private serverId;
|
|
703
|
+
private toolId;
|
|
704
|
+
constructor(options: ClientOptions, serverId: string, toolId: string);
|
|
603
705
|
/**
|
|
604
|
-
*
|
|
605
|
-
* @
|
|
606
|
-
* @returns Promise containing the task
|
|
706
|
+
* Retrieves details about this specific tool from the MCP server.
|
|
707
|
+
* @returns Promise containing the tool's information (name, description, schema).
|
|
607
708
|
*/
|
|
608
|
-
|
|
609
|
-
id: string;
|
|
610
|
-
}): Promise<Task>;
|
|
709
|
+
details(): Promise<McpToolInfo>;
|
|
611
710
|
/**
|
|
612
|
-
*
|
|
613
|
-
* @
|
|
711
|
+
* Executes this specific tool on the MCP server.
|
|
712
|
+
* @param params - Parameters for tool execution, including data/args and optional runtimeContext.
|
|
713
|
+
* @returns Promise containing the result of the tool execution.
|
|
614
714
|
*/
|
|
615
|
-
|
|
715
|
+
execute(params: {
|
|
716
|
+
data?: any;
|
|
717
|
+
runtimeContext?: RuntimeContext;
|
|
718
|
+
}): Promise<any>;
|
|
616
719
|
}
|
|
617
720
|
|
|
618
721
|
declare class MastraClient extends BaseResource {
|
|
@@ -622,6 +725,9 @@ declare class MastraClient extends BaseResource {
|
|
|
622
725
|
* @returns Promise containing map of agent IDs to agent details
|
|
623
726
|
*/
|
|
624
727
|
getAgents(): Promise<Record<string, GetAgentResponse>>;
|
|
728
|
+
getAGUI({ resourceId }: {
|
|
729
|
+
resourceId: string;
|
|
730
|
+
}): Promise<Record<string, AbstractAgent>>;
|
|
625
731
|
/**
|
|
626
732
|
* Gets an agent instance by ID
|
|
627
733
|
* @param agentId - ID of the agent to retrieve
|
|
@@ -681,6 +787,17 @@ declare class MastraClient extends BaseResource {
|
|
|
681
787
|
* @returns Workflow instance
|
|
682
788
|
*/
|
|
683
789
|
getWorkflow(workflowId: string): Workflow;
|
|
790
|
+
/**
|
|
791
|
+
* Retrieves all available vNext workflows
|
|
792
|
+
* @returns Promise containing map of vNext workflow IDs to vNext workflow details
|
|
793
|
+
*/
|
|
794
|
+
getVNextWorkflows(): Promise<Record<string, GetVNextWorkflowResponse>>;
|
|
795
|
+
/**
|
|
796
|
+
* Gets a vNext workflow instance by ID
|
|
797
|
+
* @param workflowId - ID of the vNext workflow to retrieve
|
|
798
|
+
* @returns vNext Workflow instance
|
|
799
|
+
*/
|
|
800
|
+
getVNextWorkflow(workflowId: string): VNextWorkflow;
|
|
684
801
|
/**
|
|
685
802
|
* Gets a vector instance by name
|
|
686
803
|
* @param vectorName - Name of the vector to retrieve
|
|
@@ -724,10 +841,43 @@ declare class MastraClient extends BaseResource {
|
|
|
724
841
|
*/
|
|
725
842
|
getNetwork(networkId: string): Network;
|
|
726
843
|
/**
|
|
727
|
-
*
|
|
728
|
-
* @
|
|
844
|
+
* Retrieves a list of available MCP servers.
|
|
845
|
+
* @param params - Optional parameters for pagination (limit, offset).
|
|
846
|
+
* @returns Promise containing the list of MCP servers and pagination info.
|
|
847
|
+
*/
|
|
848
|
+
getMcpServers(params?: {
|
|
849
|
+
limit?: number;
|
|
850
|
+
offset?: number;
|
|
851
|
+
}): Promise<McpServerListResponse>;
|
|
852
|
+
/**
|
|
853
|
+
* Retrieves detailed information for a specific MCP server.
|
|
854
|
+
* @param serverId - The ID of the MCP server to retrieve.
|
|
855
|
+
* @param params - Optional parameters, e.g., specific version.
|
|
856
|
+
* @returns Promise containing the detailed MCP server information.
|
|
857
|
+
*/
|
|
858
|
+
getMcpServerDetails(serverId: string, params?: {
|
|
859
|
+
version?: string;
|
|
860
|
+
}): Promise<ServerDetailInfo>;
|
|
861
|
+
/**
|
|
862
|
+
* Retrieves a list of tools for a specific MCP server.
|
|
863
|
+
* @param serverId - The ID of the MCP server.
|
|
864
|
+
* @returns Promise containing the list of tools.
|
|
865
|
+
*/
|
|
866
|
+
getMcpServerTools(serverId: string): Promise<McpServerToolListResponse>;
|
|
867
|
+
/**
|
|
868
|
+
* Gets an MCPTool resource instance for a specific tool on an MCP server.
|
|
869
|
+
* This instance can then be used to fetch details or execute the tool.
|
|
870
|
+
* @param serverId - The ID of the MCP server.
|
|
871
|
+
* @param toolId - The ID of the tool.
|
|
872
|
+
* @returns MCPTool instance.
|
|
873
|
+
*/
|
|
874
|
+
getMcpServerTool(serverId: string, toolId: string): MCPTool;
|
|
875
|
+
/**
|
|
876
|
+
* Gets an A2A client for interacting with an agent via the A2A protocol
|
|
877
|
+
* @param agentId - ID of the agent to interact with
|
|
878
|
+
* @returns A2A client instance
|
|
729
879
|
*/
|
|
730
|
-
getA2A(): A2A;
|
|
880
|
+
getA2A(agentId: string): A2A;
|
|
731
881
|
}
|
|
732
882
|
|
|
733
|
-
export { type
|
|
883
|
+
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVNextWorkflowRunsResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
|