@mastra/client-js 0.0.0-bundle-dynamic-imports-20250424001248 → 0.0.0-cli-debug-20250611094457
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/.turbo/turbo-build.log +19 -0
- package/CHANGELOG.md +590 -2
- package/dist/index.cjs +873 -55
- package/dist/index.d.cts +392 -39
- package/dist/index.d.ts +392 -39
- package/dist/index.js +869 -55
- package/package.json +11 -9
- package/src/adapters/agui.test.ts +180 -0
- package/src/adapters/agui.ts +239 -0
- package/src/client.ts +200 -4
- package/src/example.ts +29 -30
- package/src/index.test.ts +125 -5
- package/src/resources/a2a.ts +88 -0
- package/src/resources/agent.ts +49 -37
- package/src/resources/base.ts +2 -2
- package/src/resources/index.ts +4 -1
- package/src/resources/legacy-workflow.ts +242 -0
- package/src/resources/mcp-tool.ts +48 -0
- package/src/resources/memory-thread.ts +13 -3
- package/src/resources/network.ts +6 -12
- package/src/resources/tool.ts +16 -3
- package/src/resources/workflow.ts +234 -96
- package/src/types.ts +127 -17
- package/src/utils/index.ts +11 -0
- package/src/utils/process-client-tools.ts +31 -0
- package/src/utils/zod-to-json-schema.ts +10 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AbstractAgent } from '@ag-ui/client';
|
|
2
|
+
import { ServerInfo, MCPToolType, ServerDetailInfo } from '@mastra/core/mcp';
|
|
3
|
+
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
4
|
+
import { CoreMessage, AiMessageType, StorageThreadType, MastraMessageV1, LegacyWorkflowRuns, WorkflowRuns, QueryResult, GenerateReturn } from '@mastra/core';
|
|
2
5
|
import { JSONSchema7 } from 'json-schema';
|
|
3
6
|
import { ZodSchema } from 'zod';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
7
|
+
import { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
|
|
8
|
+
import { LogLevel, BaseLogMessage } from '@mastra/core/logger';
|
|
9
|
+
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
10
|
+
import { Workflow as Workflow$1, WorkflowResult, WatchEvent } from '@mastra/core/workflows';
|
|
11
|
+
import { StepAction, StepGraph, LegacyWorkflowRunResult as LegacyWorkflowRunResult$1 } from '@mastra/core/workflows/legacy';
|
|
12
|
+
import * as stream_web from 'stream/web';
|
|
13
|
+
import { AgentCard, TaskSendParams, Task, TaskQueryParams, TaskIdParams } from '@mastra/core/a2a';
|
|
6
14
|
|
|
7
15
|
interface ClientOptions {
|
|
8
16
|
/** Base URL for API requests */
|
|
@@ -23,21 +31,40 @@ interface RequestOptions {
|
|
|
23
31
|
stream?: boolean;
|
|
24
32
|
signal?: AbortSignal;
|
|
25
33
|
}
|
|
34
|
+
type WithoutMethods<T> = {
|
|
35
|
+
[K in keyof T as T[K] extends (...args: any[]) => any ? never : T[K] extends {
|
|
36
|
+
(): any;
|
|
37
|
+
} ? never : T[K] extends undefined | ((...args: any[]) => any) ? never : K]: T[K];
|
|
38
|
+
};
|
|
26
39
|
interface GetAgentResponse {
|
|
27
40
|
name: string;
|
|
28
41
|
instructions: string;
|
|
29
42
|
tools: Record<string, GetToolResponse>;
|
|
43
|
+
workflows: Record<string, GetWorkflowResponse>;
|
|
30
44
|
provider: string;
|
|
31
45
|
modelId: string;
|
|
46
|
+
defaultGenerateOptions: WithoutMethods<AgentGenerateOptions>;
|
|
47
|
+
defaultStreamOptions: WithoutMethods<AgentStreamOptions>;
|
|
32
48
|
}
|
|
33
49
|
type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
34
50
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
35
|
-
|
|
51
|
+
output?: T;
|
|
52
|
+
experimental_output?: T;
|
|
53
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
54
|
+
clientTools?: ToolsInput;
|
|
55
|
+
} & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
|
|
36
56
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
37
57
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
38
|
-
|
|
58
|
+
output?: T;
|
|
59
|
+
experimental_output?: T;
|
|
60
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
61
|
+
clientTools?: ToolsInput;
|
|
62
|
+
} & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
|
|
39
63
|
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
40
64
|
evals: any[];
|
|
65
|
+
instructions: string;
|
|
66
|
+
name: string;
|
|
67
|
+
id: string;
|
|
41
68
|
}
|
|
42
69
|
interface GetToolResponse {
|
|
43
70
|
id: string;
|
|
@@ -45,7 +72,7 @@ interface GetToolResponse {
|
|
|
45
72
|
inputSchema: string;
|
|
46
73
|
outputSchema: string;
|
|
47
74
|
}
|
|
48
|
-
interface
|
|
75
|
+
interface GetLegacyWorkflowResponse {
|
|
49
76
|
name: string;
|
|
50
77
|
triggerSchema: string;
|
|
51
78
|
steps: Record<string, StepAction<any, any, any, any>>;
|
|
@@ -53,16 +80,46 @@ interface GetWorkflowResponse {
|
|
|
53
80
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
54
81
|
workflowId?: string;
|
|
55
82
|
}
|
|
56
|
-
|
|
83
|
+
interface GetWorkflowRunsParams {
|
|
84
|
+
fromDate?: Date;
|
|
85
|
+
toDate?: Date;
|
|
86
|
+
limit?: number;
|
|
87
|
+
offset?: number;
|
|
88
|
+
resourceId?: string;
|
|
89
|
+
}
|
|
90
|
+
type GetLegacyWorkflowRunsResponse = LegacyWorkflowRuns;
|
|
91
|
+
type GetWorkflowRunsResponse = WorkflowRuns;
|
|
92
|
+
type LegacyWorkflowRunResult = {
|
|
57
93
|
activePaths: Record<string, {
|
|
58
94
|
status: string;
|
|
59
95
|
suspendPayload?: any;
|
|
60
96
|
stepPath: string[];
|
|
61
97
|
}>;
|
|
62
|
-
results:
|
|
98
|
+
results: LegacyWorkflowRunResult$1<any, any, any>['results'];
|
|
63
99
|
timestamp: number;
|
|
64
100
|
runId: string;
|
|
65
101
|
};
|
|
102
|
+
interface GetWorkflowResponse {
|
|
103
|
+
name: string;
|
|
104
|
+
description?: string;
|
|
105
|
+
steps: {
|
|
106
|
+
[key: string]: {
|
|
107
|
+
id: string;
|
|
108
|
+
description: string;
|
|
109
|
+
inputSchema: string;
|
|
110
|
+
outputSchema: string;
|
|
111
|
+
resumeSchema: string;
|
|
112
|
+
suspendSchema: string;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
stepGraph: Workflow$1['serializedStepGraph'];
|
|
116
|
+
inputSchema: string;
|
|
117
|
+
outputSchema: string;
|
|
118
|
+
}
|
|
119
|
+
type WorkflowWatchResult = WatchEvent & {
|
|
120
|
+
runId: string;
|
|
121
|
+
};
|
|
122
|
+
type WorkflowRunResult = WorkflowResult<any, any>;
|
|
66
123
|
interface UpsertVectorParams {
|
|
67
124
|
indexName: string;
|
|
68
125
|
vectors: number[][];
|
|
@@ -90,15 +147,15 @@ interface GetVectorIndexResponse {
|
|
|
90
147
|
count: number;
|
|
91
148
|
}
|
|
92
149
|
interface SaveMessageToMemoryParams {
|
|
93
|
-
messages:
|
|
150
|
+
messages: MastraMessageV1[];
|
|
94
151
|
agentId: string;
|
|
95
152
|
}
|
|
96
|
-
type SaveMessageToMemoryResponse =
|
|
153
|
+
type SaveMessageToMemoryResponse = MastraMessageV1[];
|
|
97
154
|
interface CreateMemoryThreadParams {
|
|
98
|
-
title
|
|
99
|
-
metadata
|
|
155
|
+
title?: string;
|
|
156
|
+
metadata?: Record<string, any>;
|
|
100
157
|
resourceId: string;
|
|
101
|
-
threadId
|
|
158
|
+
threadId?: string;
|
|
102
159
|
agentId: string;
|
|
103
160
|
}
|
|
104
161
|
type CreateMemoryThreadResponse = StorageThreadType;
|
|
@@ -112,18 +169,42 @@ interface UpdateMemoryThreadParams {
|
|
|
112
169
|
metadata: Record<string, any>;
|
|
113
170
|
resourceId: string;
|
|
114
171
|
}
|
|
172
|
+
interface GetMemoryThreadMessagesParams {
|
|
173
|
+
/**
|
|
174
|
+
* Limit the number of messages to retrieve (default: 40)
|
|
175
|
+
*/
|
|
176
|
+
limit?: number;
|
|
177
|
+
}
|
|
115
178
|
interface GetMemoryThreadMessagesResponse {
|
|
116
179
|
messages: CoreMessage[];
|
|
117
180
|
uiMessages: AiMessageType[];
|
|
118
181
|
}
|
|
119
182
|
interface GetLogsParams {
|
|
120
183
|
transportId: string;
|
|
184
|
+
fromDate?: Date;
|
|
185
|
+
toDate?: Date;
|
|
186
|
+
logLevel?: LogLevel;
|
|
187
|
+
filters?: Record<string, string>;
|
|
188
|
+
page?: number;
|
|
189
|
+
perPage?: number;
|
|
121
190
|
}
|
|
122
191
|
interface GetLogParams {
|
|
123
192
|
runId: string;
|
|
124
193
|
transportId: string;
|
|
194
|
+
fromDate?: Date;
|
|
195
|
+
toDate?: Date;
|
|
196
|
+
logLevel?: LogLevel;
|
|
197
|
+
filters?: Record<string, string>;
|
|
198
|
+
page?: number;
|
|
199
|
+
perPage?: number;
|
|
125
200
|
}
|
|
126
|
-
type GetLogsResponse =
|
|
201
|
+
type GetLogsResponse = {
|
|
202
|
+
logs: BaseLogMessage[];
|
|
203
|
+
total: number;
|
|
204
|
+
page: number;
|
|
205
|
+
perPage: number;
|
|
206
|
+
hasMore: boolean;
|
|
207
|
+
};
|
|
127
208
|
type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
|
|
128
209
|
type SpanStatus = {
|
|
129
210
|
code: number;
|
|
@@ -171,6 +252,8 @@ interface GetTelemetryParams {
|
|
|
171
252
|
page?: number;
|
|
172
253
|
perPage?: number;
|
|
173
254
|
attribute?: Record<string, string>;
|
|
255
|
+
fromDate?: Date;
|
|
256
|
+
toDate?: Date;
|
|
174
257
|
}
|
|
175
258
|
interface GetNetworkResponse {
|
|
176
259
|
name: string;
|
|
@@ -186,6 +269,21 @@ interface GetNetworkResponse {
|
|
|
186
269
|
};
|
|
187
270
|
state?: Record<string, any>;
|
|
188
271
|
}
|
|
272
|
+
interface McpServerListResponse {
|
|
273
|
+
servers: ServerInfo[];
|
|
274
|
+
next: string | null;
|
|
275
|
+
total_count: number;
|
|
276
|
+
}
|
|
277
|
+
interface McpToolInfo {
|
|
278
|
+
id: string;
|
|
279
|
+
name: string;
|
|
280
|
+
description?: string;
|
|
281
|
+
inputSchema: string;
|
|
282
|
+
toolType?: MCPToolType;
|
|
283
|
+
}
|
|
284
|
+
interface McpServerToolListResponse {
|
|
285
|
+
tools: McpToolInfo[];
|
|
286
|
+
}
|
|
189
287
|
|
|
190
288
|
declare class BaseResource {
|
|
191
289
|
readonly options: ClientOptions;
|
|
@@ -218,7 +316,9 @@ declare class AgentVoice extends BaseResource {
|
|
|
218
316
|
* @param options - Optional provider-specific options
|
|
219
317
|
* @returns Promise containing the transcribed text
|
|
220
318
|
*/
|
|
221
|
-
listen(audio: Blob, options?: Record<string, any>): Promise<
|
|
319
|
+
listen(audio: Blob, options?: Record<string, any>): Promise<{
|
|
320
|
+
text: string;
|
|
321
|
+
}>;
|
|
222
322
|
/**
|
|
223
323
|
* Get available speakers for the agent's voice provider
|
|
224
324
|
* @returns Promise containing list of available speakers
|
|
@@ -227,6 +327,13 @@ declare class AgentVoice extends BaseResource {
|
|
|
227
327
|
voiceId: string;
|
|
228
328
|
[key: string]: any;
|
|
229
329
|
}>>;
|
|
330
|
+
/**
|
|
331
|
+
* Get the listener configuration for the agent's voice provider
|
|
332
|
+
* @returns Promise containing a check if the agent has listening capabilities
|
|
333
|
+
*/
|
|
334
|
+
getListener(): Promise<{
|
|
335
|
+
enabled: boolean;
|
|
336
|
+
}>;
|
|
230
337
|
}
|
|
231
338
|
declare class Agent extends BaseResource {
|
|
232
339
|
private agentId;
|
|
@@ -242,7 +349,18 @@ declare class Agent extends BaseResource {
|
|
|
242
349
|
* @param params - Generation parameters including prompt
|
|
243
350
|
* @returns Promise containing the generated response
|
|
244
351
|
*/
|
|
245
|
-
generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T>
|
|
352
|
+
generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
|
|
353
|
+
output?: never;
|
|
354
|
+
experimental_output?: never;
|
|
355
|
+
}): Promise<GenerateReturn<T>>;
|
|
356
|
+
generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
|
|
357
|
+
output: T;
|
|
358
|
+
experimental_output?: never;
|
|
359
|
+
}): Promise<GenerateReturn<T>>;
|
|
360
|
+
generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
|
|
361
|
+
output?: never;
|
|
362
|
+
experimental_output: T;
|
|
363
|
+
}): Promise<GenerateReturn<T>>;
|
|
246
364
|
/**
|
|
247
365
|
* Streams a response from the agent
|
|
248
366
|
* @param params - Stream parameters including prompt
|
|
@@ -257,6 +375,16 @@ declare class Agent extends BaseResource {
|
|
|
257
375
|
* @returns Promise containing tool details
|
|
258
376
|
*/
|
|
259
377
|
getTool(toolId: string): Promise<GetToolResponse>;
|
|
378
|
+
/**
|
|
379
|
+
* Executes a tool for the agent
|
|
380
|
+
* @param toolId - ID of the tool to execute
|
|
381
|
+
* @param params - Parameters required for tool execution
|
|
382
|
+
* @returns Promise containing the tool execution results
|
|
383
|
+
*/
|
|
384
|
+
executeTool(toolId: string, params: {
|
|
385
|
+
data: any;
|
|
386
|
+
runtimeContext?: RuntimeContext;
|
|
387
|
+
}): Promise<any>;
|
|
260
388
|
/**
|
|
261
389
|
* Retrieves evaluation results for the agent
|
|
262
390
|
* @returns Promise containing agent evaluations
|
|
@@ -317,9 +445,10 @@ declare class MemoryThread extends BaseResource {
|
|
|
317
445
|
}>;
|
|
318
446
|
/**
|
|
319
447
|
* Retrieves messages associated with the thread
|
|
448
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
320
449
|
* @returns Promise containing thread messages and UI messages
|
|
321
450
|
*/
|
|
322
|
-
getMessages(): Promise<GetMemoryThreadMessagesResponse>;
|
|
451
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
323
452
|
}
|
|
324
453
|
|
|
325
454
|
declare class Vector extends BaseResource {
|
|
@@ -368,23 +497,22 @@ declare class Vector extends BaseResource {
|
|
|
368
497
|
query(params: QueryVectorParams): Promise<QueryVectorResponse>;
|
|
369
498
|
}
|
|
370
499
|
|
|
371
|
-
declare class
|
|
500
|
+
declare class LegacyWorkflow extends BaseResource {
|
|
372
501
|
private workflowId;
|
|
373
502
|
constructor(options: ClientOptions, workflowId: string);
|
|
374
503
|
/**
|
|
375
|
-
* Retrieves details about the workflow
|
|
376
|
-
* @returns Promise containing workflow details including steps and graphs
|
|
504
|
+
* Retrieves details about the legacy workflow
|
|
505
|
+
* @returns Promise containing legacy workflow details including steps and graphs
|
|
377
506
|
*/
|
|
378
|
-
details(): Promise<
|
|
507
|
+
details(): Promise<GetLegacyWorkflowResponse>;
|
|
379
508
|
/**
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
* @
|
|
383
|
-
* @returns Promise containing the workflow execution results
|
|
509
|
+
* Retrieves all runs for a legacy workflow
|
|
510
|
+
* @param params - Parameters for filtering runs
|
|
511
|
+
* @returns Promise containing legacy workflow runs array
|
|
384
512
|
*/
|
|
385
|
-
|
|
513
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetLegacyWorkflowRunsResponse>;
|
|
386
514
|
/**
|
|
387
|
-
* Creates a new workflow run
|
|
515
|
+
* Creates a new legacy workflow run
|
|
388
516
|
* @returns Promise containing the generated run ID
|
|
389
517
|
*/
|
|
390
518
|
createRun(params?: {
|
|
@@ -393,7 +521,7 @@ declare class Workflow extends BaseResource {
|
|
|
393
521
|
runId: string;
|
|
394
522
|
}>;
|
|
395
523
|
/**
|
|
396
|
-
* Starts a workflow run synchronously without waiting for the workflow to complete
|
|
524
|
+
* Starts a legacy workflow run synchronously without waiting for the workflow to complete
|
|
397
525
|
* @param params - Object containing the runId and triggerData
|
|
398
526
|
* @returns Promise containing success message
|
|
399
527
|
*/
|
|
@@ -404,11 +532,11 @@ declare class Workflow extends BaseResource {
|
|
|
404
532
|
message: string;
|
|
405
533
|
}>;
|
|
406
534
|
/**
|
|
407
|
-
* Resumes a suspended workflow step synchronously without waiting for the workflow to complete
|
|
535
|
+
* Resumes a suspended legacy workflow step synchronously without waiting for the workflow to complete
|
|
408
536
|
* @param stepId - ID of the step to resume
|
|
409
|
-
* @param runId - ID of the workflow run
|
|
410
|
-
* @param context - Context to resume the workflow with
|
|
411
|
-
* @returns Promise containing the workflow resume results
|
|
537
|
+
* @param runId - ID of the legacy workflow run
|
|
538
|
+
* @param context - Context to resume the legacy workflow with
|
|
539
|
+
* @returns Promise containing the legacy workflow resume results
|
|
412
540
|
*/
|
|
413
541
|
resume({ stepId, runId, context, }: {
|
|
414
542
|
stepId: string;
|
|
@@ -425,9 +553,9 @@ declare class Workflow extends BaseResource {
|
|
|
425
553
|
startAsync(params: {
|
|
426
554
|
runId?: string;
|
|
427
555
|
triggerData: Record<string, any>;
|
|
428
|
-
}): Promise<
|
|
556
|
+
}): Promise<LegacyWorkflowRunResult>;
|
|
429
557
|
/**
|
|
430
|
-
* Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
558
|
+
* Resumes a suspended legacy workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
431
559
|
* @param params - Object containing the runId, stepId, and context
|
|
432
560
|
* @returns Promise containing the workflow resume results
|
|
433
561
|
*/
|
|
@@ -435,7 +563,7 @@ declare class Workflow extends BaseResource {
|
|
|
435
563
|
runId: string;
|
|
436
564
|
stepId: string;
|
|
437
565
|
context: Record<string, any>;
|
|
438
|
-
}): Promise<
|
|
566
|
+
}): Promise<LegacyWorkflowRunResult>;
|
|
439
567
|
/**
|
|
440
568
|
* Creates an async generator that processes a readable stream and yields records
|
|
441
569
|
* separated by the Record Separator character (\x1E)
|
|
@@ -445,13 +573,13 @@ declare class Workflow extends BaseResource {
|
|
|
445
573
|
*/
|
|
446
574
|
private streamProcessor;
|
|
447
575
|
/**
|
|
448
|
-
* Watches workflow transitions in real-time
|
|
576
|
+
* Watches legacy workflow transitions in real-time
|
|
449
577
|
* @param runId - Optional run ID to filter the watch stream
|
|
450
|
-
* @returns AsyncGenerator that yields parsed records from the workflow watch stream
|
|
578
|
+
* @returns AsyncGenerator that yields parsed records from the legacy workflow watch stream
|
|
451
579
|
*/
|
|
452
580
|
watch({ runId }: {
|
|
453
581
|
runId?: string;
|
|
454
|
-
}, onRecord: (record:
|
|
582
|
+
}, onRecord: (record: LegacyWorkflowRunResult) => void): Promise<void>;
|
|
455
583
|
}
|
|
456
584
|
|
|
457
585
|
declare class Tool extends BaseResource {
|
|
@@ -469,6 +597,179 @@ declare class Tool extends BaseResource {
|
|
|
469
597
|
*/
|
|
470
598
|
execute(params: {
|
|
471
599
|
data: any;
|
|
600
|
+
runId?: string;
|
|
601
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
602
|
+
}): Promise<any>;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
declare class Workflow extends BaseResource {
|
|
606
|
+
private workflowId;
|
|
607
|
+
constructor(options: ClientOptions, workflowId: string);
|
|
608
|
+
/**
|
|
609
|
+
* Creates an async generator that processes a readable stream and yields workflow records
|
|
610
|
+
* separated by the Record Separator character (\x1E)
|
|
611
|
+
*
|
|
612
|
+
* @param stream - The readable stream to process
|
|
613
|
+
* @returns An async generator that yields parsed records
|
|
614
|
+
*/
|
|
615
|
+
private streamProcessor;
|
|
616
|
+
/**
|
|
617
|
+
* Retrieves details about the workflow
|
|
618
|
+
* @returns Promise containing workflow details including steps and graphs
|
|
619
|
+
*/
|
|
620
|
+
details(): Promise<GetWorkflowResponse>;
|
|
621
|
+
/**
|
|
622
|
+
* Retrieves all runs for a workflow
|
|
623
|
+
* @param params - Parameters for filtering runs
|
|
624
|
+
* @returns Promise containing workflow runs array
|
|
625
|
+
*/
|
|
626
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
627
|
+
/**
|
|
628
|
+
* Creates a new workflow run
|
|
629
|
+
* @param params - Optional object containing the optional runId
|
|
630
|
+
* @returns Promise containing the runId of the created run
|
|
631
|
+
*/
|
|
632
|
+
createRun(params?: {
|
|
633
|
+
runId?: string;
|
|
634
|
+
}): Promise<{
|
|
635
|
+
runId: string;
|
|
636
|
+
}>;
|
|
637
|
+
/**
|
|
638
|
+
* Starts a workflow run synchronously without waiting for the workflow to complete
|
|
639
|
+
* @param params - Object containing the runId, inputData and runtimeContext
|
|
640
|
+
* @returns Promise containing success message
|
|
641
|
+
*/
|
|
642
|
+
start(params: {
|
|
643
|
+
runId: string;
|
|
644
|
+
inputData: Record<string, any>;
|
|
645
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
646
|
+
}): Promise<{
|
|
647
|
+
message: string;
|
|
648
|
+
}>;
|
|
649
|
+
/**
|
|
650
|
+
* Resumes a suspended workflow step synchronously without waiting for the workflow to complete
|
|
651
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
652
|
+
* @returns Promise containing success message
|
|
653
|
+
*/
|
|
654
|
+
resume({ step, runId, resumeData, ...rest }: {
|
|
655
|
+
step: string | string[];
|
|
656
|
+
runId: string;
|
|
657
|
+
resumeData?: Record<string, any>;
|
|
658
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
659
|
+
}): Promise<{
|
|
660
|
+
message: string;
|
|
661
|
+
}>;
|
|
662
|
+
/**
|
|
663
|
+
* Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
|
|
664
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
665
|
+
* @returns Promise containing the workflow execution results
|
|
666
|
+
*/
|
|
667
|
+
startAsync(params: {
|
|
668
|
+
runId?: string;
|
|
669
|
+
inputData: Record<string, any>;
|
|
670
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
671
|
+
}): Promise<WorkflowRunResult>;
|
|
672
|
+
/**
|
|
673
|
+
* Starts a vNext workflow run and returns a stream
|
|
674
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
675
|
+
* @returns Promise containing the vNext workflow execution results
|
|
676
|
+
*/
|
|
677
|
+
stream(params: {
|
|
678
|
+
runId?: string;
|
|
679
|
+
inputData: Record<string, any>;
|
|
680
|
+
runtimeContext?: RuntimeContext;
|
|
681
|
+
}): Promise<stream_web.ReadableStream<WorkflowWatchResult>>;
|
|
682
|
+
/**
|
|
683
|
+
* Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
684
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
685
|
+
* @returns Promise containing the workflow resume results
|
|
686
|
+
*/
|
|
687
|
+
resumeAsync(params: {
|
|
688
|
+
runId: string;
|
|
689
|
+
step: string | string[];
|
|
690
|
+
resumeData?: Record<string, any>;
|
|
691
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
692
|
+
}): Promise<WorkflowRunResult>;
|
|
693
|
+
/**
|
|
694
|
+
* Watches workflow transitions in real-time
|
|
695
|
+
* @param runId - Optional run ID to filter the watch stream
|
|
696
|
+
* @returns AsyncGenerator that yields parsed records from the workflow watch stream
|
|
697
|
+
*/
|
|
698
|
+
watch({ runId }: {
|
|
699
|
+
runId?: string;
|
|
700
|
+
}, onRecord: (record: WorkflowWatchResult) => void): Promise<void>;
|
|
701
|
+
/**
|
|
702
|
+
* Creates a new ReadableStream from an iterable or async iterable of objects,
|
|
703
|
+
* serializing each as JSON and separating them with the record separator (\x1E).
|
|
704
|
+
*
|
|
705
|
+
* @param records - An iterable or async iterable of objects to stream
|
|
706
|
+
* @returns A ReadableStream emitting the records as JSON strings separated by the record separator
|
|
707
|
+
*/
|
|
708
|
+
static createRecordStream(records: Iterable<any> | AsyncIterable<any>): ReadableStream;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Class for interacting with an agent via the A2A protocol
|
|
713
|
+
*/
|
|
714
|
+
declare class A2A extends BaseResource {
|
|
715
|
+
private agentId;
|
|
716
|
+
constructor(options: ClientOptions, agentId: string);
|
|
717
|
+
/**
|
|
718
|
+
* Get the agent card with metadata about the agent
|
|
719
|
+
* @returns Promise containing the agent card information
|
|
720
|
+
*/
|
|
721
|
+
getCard(): Promise<AgentCard>;
|
|
722
|
+
/**
|
|
723
|
+
* Send a message to the agent and get a response
|
|
724
|
+
* @param params - Parameters for the task
|
|
725
|
+
* @returns Promise containing the task response
|
|
726
|
+
*/
|
|
727
|
+
sendMessage(params: TaskSendParams): Promise<{
|
|
728
|
+
task: Task;
|
|
729
|
+
}>;
|
|
730
|
+
/**
|
|
731
|
+
* Get the status and result of a task
|
|
732
|
+
* @param params - Parameters for querying the task
|
|
733
|
+
* @returns Promise containing the task response
|
|
734
|
+
*/
|
|
735
|
+
getTask(params: TaskQueryParams): Promise<Task>;
|
|
736
|
+
/**
|
|
737
|
+
* Cancel a running task
|
|
738
|
+
* @param params - Parameters identifying the task to cancel
|
|
739
|
+
* @returns Promise containing the task response
|
|
740
|
+
*/
|
|
741
|
+
cancelTask(params: TaskIdParams): Promise<{
|
|
742
|
+
task: Task;
|
|
743
|
+
}>;
|
|
744
|
+
/**
|
|
745
|
+
* Send a message and subscribe to streaming updates (not fully implemented)
|
|
746
|
+
* @param params - Parameters for the task
|
|
747
|
+
* @returns Promise containing the task response
|
|
748
|
+
*/
|
|
749
|
+
sendAndSubscribe(params: TaskSendParams): Promise<Response>;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* Represents a specific tool available on a specific MCP server.
|
|
754
|
+
* Provides methods to get details and execute the tool.
|
|
755
|
+
*/
|
|
756
|
+
declare class MCPTool extends BaseResource {
|
|
757
|
+
private serverId;
|
|
758
|
+
private toolId;
|
|
759
|
+
constructor(options: ClientOptions, serverId: string, toolId: string);
|
|
760
|
+
/**
|
|
761
|
+
* Retrieves details about this specific tool from the MCP server.
|
|
762
|
+
* @returns Promise containing the tool's information (name, description, schema).
|
|
763
|
+
*/
|
|
764
|
+
details(): Promise<McpToolInfo>;
|
|
765
|
+
/**
|
|
766
|
+
* Executes this specific tool on the MCP server.
|
|
767
|
+
* @param params - Parameters for tool execution, including data/args and optional runtimeContext.
|
|
768
|
+
* @returns Promise containing the result of the tool execution.
|
|
769
|
+
*/
|
|
770
|
+
execute(params: {
|
|
771
|
+
data?: any;
|
|
772
|
+
runtimeContext?: RuntimeContext;
|
|
472
773
|
}): Promise<any>;
|
|
473
774
|
}
|
|
474
775
|
|
|
@@ -479,6 +780,9 @@ declare class MastraClient extends BaseResource {
|
|
|
479
780
|
* @returns Promise containing map of agent IDs to agent details
|
|
480
781
|
*/
|
|
481
782
|
getAgents(): Promise<Record<string, GetAgentResponse>>;
|
|
783
|
+
getAGUI({ resourceId }: {
|
|
784
|
+
resourceId: string;
|
|
785
|
+
}): Promise<Record<string, AbstractAgent>>;
|
|
482
786
|
/**
|
|
483
787
|
* Gets an agent instance by ID
|
|
484
788
|
* @param agentId - ID of the agent to retrieve
|
|
@@ -527,6 +831,17 @@ declare class MastraClient extends BaseResource {
|
|
|
527
831
|
* @returns Tool instance
|
|
528
832
|
*/
|
|
529
833
|
getTool(toolId: string): Tool;
|
|
834
|
+
/**
|
|
835
|
+
* Retrieves all available legacy workflows
|
|
836
|
+
* @returns Promise containing map of legacy workflow IDs to legacy workflow details
|
|
837
|
+
*/
|
|
838
|
+
getLegacyWorkflows(): Promise<Record<string, GetLegacyWorkflowResponse>>;
|
|
839
|
+
/**
|
|
840
|
+
* Gets a legacy workflow instance by ID
|
|
841
|
+
* @param workflowId - ID of the legacy workflow to retrieve
|
|
842
|
+
* @returns Legacy Workflow instance
|
|
843
|
+
*/
|
|
844
|
+
getLegacyWorkflow(workflowId: string): LegacyWorkflow;
|
|
530
845
|
/**
|
|
531
846
|
* Retrieves all available workflows
|
|
532
847
|
* @returns Promise containing map of workflow IDs to workflow details
|
|
@@ -580,6 +895,44 @@ declare class MastraClient extends BaseResource {
|
|
|
580
895
|
* @returns Network instance
|
|
581
896
|
*/
|
|
582
897
|
getNetwork(networkId: string): Network;
|
|
898
|
+
/**
|
|
899
|
+
* Retrieves a list of available MCP servers.
|
|
900
|
+
* @param params - Optional parameters for pagination (limit, offset).
|
|
901
|
+
* @returns Promise containing the list of MCP servers and pagination info.
|
|
902
|
+
*/
|
|
903
|
+
getMcpServers(params?: {
|
|
904
|
+
limit?: number;
|
|
905
|
+
offset?: number;
|
|
906
|
+
}): Promise<McpServerListResponse>;
|
|
907
|
+
/**
|
|
908
|
+
* Retrieves detailed information for a specific MCP server.
|
|
909
|
+
* @param serverId - The ID of the MCP server to retrieve.
|
|
910
|
+
* @param params - Optional parameters, e.g., specific version.
|
|
911
|
+
* @returns Promise containing the detailed MCP server information.
|
|
912
|
+
*/
|
|
913
|
+
getMcpServerDetails(serverId: string, params?: {
|
|
914
|
+
version?: string;
|
|
915
|
+
}): Promise<ServerDetailInfo>;
|
|
916
|
+
/**
|
|
917
|
+
* Retrieves a list of tools for a specific MCP server.
|
|
918
|
+
* @param serverId - The ID of the MCP server.
|
|
919
|
+
* @returns Promise containing the list of tools.
|
|
920
|
+
*/
|
|
921
|
+
getMcpServerTools(serverId: string): Promise<McpServerToolListResponse>;
|
|
922
|
+
/**
|
|
923
|
+
* Gets an MCPTool resource instance for a specific tool on an MCP server.
|
|
924
|
+
* This instance can then be used to fetch details or execute the tool.
|
|
925
|
+
* @param serverId - The ID of the MCP server.
|
|
926
|
+
* @param toolId - The ID of the tool.
|
|
927
|
+
* @returns MCPTool instance.
|
|
928
|
+
*/
|
|
929
|
+
getMcpServerTool(serverId: string, toolId: string): MCPTool;
|
|
930
|
+
/**
|
|
931
|
+
* Gets an A2A client for interacting with an agent via the A2A protocol
|
|
932
|
+
* @param agentId - ID of the agent to interact with
|
|
933
|
+
* @returns A2A client instance
|
|
934
|
+
*/
|
|
935
|
+
getA2A(agentId: string): A2A;
|
|
583
936
|
}
|
|
584
937
|
|
|
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 };
|
|
938
|
+
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, 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 WorkflowRunResult, type WorkflowWatchResult };
|