@mastra/client-js 0.0.0-mcp-server-deploy-20250507160341 → 0.0.0-pass-headers-for-create-mastra-client-20250529190531
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 +317 -2
- package/dist/index.cjs +560 -112
- package/dist/index.d.cts +236 -96
- package/dist/index.d.ts +236 -96
- package/dist/index.js +556 -112
- package/package.json +9 -6
- package/src/adapters/agui.test.ts +180 -0
- package/src/adapters/agui.ts +239 -0
- package/src/client.ts +98 -30
- package/src/example.ts +29 -30
- package/src/index.test.ts +121 -1
- package/src/resources/a2a.ts +88 -0
- package/src/resources/agent.ts +27 -34
- package/src/resources/base.ts +1 -1
- package/src/resources/index.ts +4 -3
- package/src/resources/{vnext-workflow.ts → legacy-workflow.ts} +124 -139
- package/src/resources/mcp-tool.ts +48 -0
- package/src/resources/memory-thread.ts +13 -3
- package/src/resources/network.ts +5 -11
- package/src/resources/tool.ts +9 -2
- package/src/resources/workflow.ts +202 -100
- package/src/types.ts +65 -24
- package/src/utils/index.ts +11 -0
- package/src/utils/zod-to-json-schema.ts +10 -0
- package/src/resources/mcp.ts +0 -22
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import { AbstractAgent } from '@ag-ui/client';
|
|
2
|
+
import { ServerInfo, MCPToolType, ServerDetailInfo } from '@mastra/core/mcp';
|
|
1
3
|
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
2
|
-
import { CoreMessage, AiMessageType, StorageThreadType, MessageType,
|
|
4
|
+
import { CoreMessage, AiMessageType, StorageThreadType, MessageType, LegacyWorkflowRuns, WorkflowRuns, QueryResult, GenerateReturn } from '@mastra/core';
|
|
3
5
|
import { JSONSchema7 } from 'json-schema';
|
|
4
6
|
import { ZodSchema } from 'zod';
|
|
5
7
|
import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
|
|
6
|
-
import {
|
|
8
|
+
import { BaseLogMessage } from '@mastra/core/logger';
|
|
7
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';
|
|
8
14
|
|
|
9
15
|
interface ClientOptions {
|
|
10
16
|
/** Base URL for API requests */
|
|
@@ -25,19 +31,33 @@ interface RequestOptions {
|
|
|
25
31
|
stream?: boolean;
|
|
26
32
|
signal?: AbortSignal;
|
|
27
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
|
+
};
|
|
28
39
|
interface GetAgentResponse {
|
|
29
40
|
name: string;
|
|
30
41
|
instructions: string;
|
|
31
42
|
tools: Record<string, GetToolResponse>;
|
|
43
|
+
workflows: Record<string, GetWorkflowResponse>;
|
|
32
44
|
provider: string;
|
|
33
45
|
modelId: string;
|
|
46
|
+
defaultGenerateOptions: WithoutMethods<AgentGenerateOptions>;
|
|
47
|
+
defaultStreamOptions: WithoutMethods<AgentStreamOptions>;
|
|
34
48
|
}
|
|
35
49
|
type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
36
50
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
37
|
-
|
|
51
|
+
output?: T;
|
|
52
|
+
experimental_output?: T;
|
|
53
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
54
|
+
} & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
|
|
38
55
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
39
56
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
40
|
-
|
|
57
|
+
output?: T;
|
|
58
|
+
experimental_output?: T;
|
|
59
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
60
|
+
} & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
|
|
41
61
|
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
42
62
|
evals: any[];
|
|
43
63
|
instructions: string;
|
|
@@ -50,7 +70,7 @@ interface GetToolResponse {
|
|
|
50
70
|
inputSchema: string;
|
|
51
71
|
outputSchema: string;
|
|
52
72
|
}
|
|
53
|
-
interface
|
|
73
|
+
interface GetLegacyWorkflowResponse {
|
|
54
74
|
name: string;
|
|
55
75
|
triggerSchema: string;
|
|
56
76
|
steps: Record<string, StepAction<any, any, any, any>>;
|
|
@@ -65,19 +85,21 @@ interface GetWorkflowRunsParams {
|
|
|
65
85
|
offset?: number;
|
|
66
86
|
resourceId?: string;
|
|
67
87
|
}
|
|
88
|
+
type GetLegacyWorkflowRunsResponse = LegacyWorkflowRuns;
|
|
68
89
|
type GetWorkflowRunsResponse = WorkflowRuns;
|
|
69
|
-
type
|
|
90
|
+
type LegacyWorkflowRunResult = {
|
|
70
91
|
activePaths: Record<string, {
|
|
71
92
|
status: string;
|
|
72
93
|
suspendPayload?: any;
|
|
73
94
|
stepPath: string[];
|
|
74
95
|
}>;
|
|
75
|
-
results:
|
|
96
|
+
results: LegacyWorkflowRunResult$1<any, any, any>['results'];
|
|
76
97
|
timestamp: number;
|
|
77
98
|
runId: string;
|
|
78
99
|
};
|
|
79
|
-
interface
|
|
100
|
+
interface GetWorkflowResponse {
|
|
80
101
|
name: string;
|
|
102
|
+
description?: string;
|
|
81
103
|
steps: {
|
|
82
104
|
[key: string]: {
|
|
83
105
|
id: string;
|
|
@@ -88,14 +110,14 @@ interface GetVNextWorkflowResponse {
|
|
|
88
110
|
suspendSchema: string;
|
|
89
111
|
};
|
|
90
112
|
};
|
|
91
|
-
stepGraph:
|
|
113
|
+
stepGraph: Workflow$1['serializedStepGraph'];
|
|
92
114
|
inputSchema: string;
|
|
93
115
|
outputSchema: string;
|
|
94
116
|
}
|
|
95
|
-
type
|
|
117
|
+
type WorkflowWatchResult = WatchEvent & {
|
|
96
118
|
runId: string;
|
|
97
119
|
};
|
|
98
|
-
type
|
|
120
|
+
type WorkflowRunResult = WorkflowResult<any, any>;
|
|
99
121
|
interface UpsertVectorParams {
|
|
100
122
|
indexName: string;
|
|
101
123
|
vectors: number[][];
|
|
@@ -128,10 +150,10 @@ interface SaveMessageToMemoryParams {
|
|
|
128
150
|
}
|
|
129
151
|
type SaveMessageToMemoryResponse = MessageType[];
|
|
130
152
|
interface CreateMemoryThreadParams {
|
|
131
|
-
title
|
|
132
|
-
metadata
|
|
153
|
+
title?: string;
|
|
154
|
+
metadata?: Record<string, any>;
|
|
133
155
|
resourceId: string;
|
|
134
|
-
threadId
|
|
156
|
+
threadId?: string;
|
|
135
157
|
agentId: string;
|
|
136
158
|
}
|
|
137
159
|
type CreateMemoryThreadResponse = StorageThreadType;
|
|
@@ -145,6 +167,12 @@ interface UpdateMemoryThreadParams {
|
|
|
145
167
|
metadata: Record<string, any>;
|
|
146
168
|
resourceId: string;
|
|
147
169
|
}
|
|
170
|
+
interface GetMemoryThreadMessagesParams {
|
|
171
|
+
/**
|
|
172
|
+
* Limit the number of messages to retrieve (default: 40)
|
|
173
|
+
*/
|
|
174
|
+
limit?: number;
|
|
175
|
+
}
|
|
148
176
|
interface GetMemoryThreadMessagesResponse {
|
|
149
177
|
messages: CoreMessage[];
|
|
150
178
|
uiMessages: AiMessageType[];
|
|
@@ -221,15 +249,20 @@ interface GetNetworkResponse {
|
|
|
221
249
|
};
|
|
222
250
|
state?: Record<string, any>;
|
|
223
251
|
}
|
|
224
|
-
interface
|
|
252
|
+
interface McpServerListResponse {
|
|
253
|
+
servers: ServerInfo[];
|
|
254
|
+
next: string | null;
|
|
255
|
+
total_count: number;
|
|
256
|
+
}
|
|
257
|
+
interface McpToolInfo {
|
|
225
258
|
id: string;
|
|
226
259
|
name: string;
|
|
227
260
|
description?: string;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
261
|
+
inputSchema: string;
|
|
262
|
+
toolType?: MCPToolType;
|
|
263
|
+
}
|
|
264
|
+
interface McpServerToolListResponse {
|
|
265
|
+
tools: McpToolInfo[];
|
|
233
266
|
}
|
|
234
267
|
|
|
235
268
|
declare class BaseResource {
|
|
@@ -263,7 +296,9 @@ declare class AgentVoice extends BaseResource {
|
|
|
263
296
|
* @param options - Optional provider-specific options
|
|
264
297
|
* @returns Promise containing the transcribed text
|
|
265
298
|
*/
|
|
266
|
-
listen(audio: Blob, options?: Record<string, any>): Promise<
|
|
299
|
+
listen(audio: Blob, options?: Record<string, any>): Promise<{
|
|
300
|
+
text: string;
|
|
301
|
+
}>;
|
|
267
302
|
/**
|
|
268
303
|
* Get available speakers for the agent's voice provider
|
|
269
304
|
* @returns Promise containing list of available speakers
|
|
@@ -302,6 +337,16 @@ declare class Agent extends BaseResource {
|
|
|
302
337
|
* @returns Promise containing tool details
|
|
303
338
|
*/
|
|
304
339
|
getTool(toolId: string): Promise<GetToolResponse>;
|
|
340
|
+
/**
|
|
341
|
+
* Executes a tool for the agent
|
|
342
|
+
* @param toolId - ID of the tool to execute
|
|
343
|
+
* @param params - Parameters required for tool execution
|
|
344
|
+
* @returns Promise containing the tool execution results
|
|
345
|
+
*/
|
|
346
|
+
executeTool(toolId: string, params: {
|
|
347
|
+
data: any;
|
|
348
|
+
runtimeContext?: RuntimeContext;
|
|
349
|
+
}): Promise<any>;
|
|
305
350
|
/**
|
|
306
351
|
* Retrieves evaluation results for the agent
|
|
307
352
|
* @returns Promise containing agent evaluations
|
|
@@ -362,9 +407,10 @@ declare class MemoryThread extends BaseResource {
|
|
|
362
407
|
}>;
|
|
363
408
|
/**
|
|
364
409
|
* Retrieves messages associated with the thread
|
|
410
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
365
411
|
* @returns Promise containing thread messages and UI messages
|
|
366
412
|
*/
|
|
367
|
-
getMessages(): Promise<GetMemoryThreadMessagesResponse>;
|
|
413
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
368
414
|
}
|
|
369
415
|
|
|
370
416
|
declare class Vector extends BaseResource {
|
|
@@ -413,29 +459,22 @@ declare class Vector extends BaseResource {
|
|
|
413
459
|
query(params: QueryVectorParams): Promise<QueryVectorResponse>;
|
|
414
460
|
}
|
|
415
461
|
|
|
416
|
-
declare class
|
|
462
|
+
declare class LegacyWorkflow extends BaseResource {
|
|
417
463
|
private workflowId;
|
|
418
464
|
constructor(options: ClientOptions, workflowId: string);
|
|
419
465
|
/**
|
|
420
|
-
* Retrieves details about the workflow
|
|
421
|
-
* @returns Promise containing workflow details including steps and graphs
|
|
466
|
+
* Retrieves details about the legacy workflow
|
|
467
|
+
* @returns Promise containing legacy workflow details including steps and graphs
|
|
422
468
|
*/
|
|
423
|
-
details(): Promise<
|
|
469
|
+
details(): Promise<GetLegacyWorkflowResponse>;
|
|
424
470
|
/**
|
|
425
|
-
* Retrieves all runs for a workflow
|
|
471
|
+
* Retrieves all runs for a legacy workflow
|
|
426
472
|
* @param params - Parameters for filtering runs
|
|
427
|
-
* @returns Promise containing workflow runs array
|
|
473
|
+
* @returns Promise containing legacy workflow runs array
|
|
428
474
|
*/
|
|
429
|
-
runs(params?: GetWorkflowRunsParams): Promise<
|
|
475
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetLegacyWorkflowRunsResponse>;
|
|
430
476
|
/**
|
|
431
|
-
*
|
|
432
|
-
* Executes the workflow with the provided parameters
|
|
433
|
-
* @param params - Parameters required for workflow execution
|
|
434
|
-
* @returns Promise containing the workflow execution results
|
|
435
|
-
*/
|
|
436
|
-
execute(params: Record<string, any>): Promise<WorkflowRunResult>;
|
|
437
|
-
/**
|
|
438
|
-
* Creates a new workflow run
|
|
477
|
+
* Creates a new legacy workflow run
|
|
439
478
|
* @returns Promise containing the generated run ID
|
|
440
479
|
*/
|
|
441
480
|
createRun(params?: {
|
|
@@ -444,7 +483,7 @@ declare class Workflow extends BaseResource {
|
|
|
444
483
|
runId: string;
|
|
445
484
|
}>;
|
|
446
485
|
/**
|
|
447
|
-
* Starts a workflow run synchronously without waiting for the workflow to complete
|
|
486
|
+
* Starts a legacy workflow run synchronously without waiting for the workflow to complete
|
|
448
487
|
* @param params - Object containing the runId and triggerData
|
|
449
488
|
* @returns Promise containing success message
|
|
450
489
|
*/
|
|
@@ -455,11 +494,11 @@ declare class Workflow extends BaseResource {
|
|
|
455
494
|
message: string;
|
|
456
495
|
}>;
|
|
457
496
|
/**
|
|
458
|
-
* Resumes a suspended workflow step synchronously without waiting for the workflow to complete
|
|
497
|
+
* Resumes a suspended legacy workflow step synchronously without waiting for the workflow to complete
|
|
459
498
|
* @param stepId - ID of the step to resume
|
|
460
|
-
* @param runId - ID of the workflow run
|
|
461
|
-
* @param context - Context to resume the workflow with
|
|
462
|
-
* @returns Promise containing the workflow resume results
|
|
499
|
+
* @param runId - ID of the legacy workflow run
|
|
500
|
+
* @param context - Context to resume the legacy workflow with
|
|
501
|
+
* @returns Promise containing the legacy workflow resume results
|
|
463
502
|
*/
|
|
464
503
|
resume({ stepId, runId, context, }: {
|
|
465
504
|
stepId: string;
|
|
@@ -476,9 +515,9 @@ declare class Workflow extends BaseResource {
|
|
|
476
515
|
startAsync(params: {
|
|
477
516
|
runId?: string;
|
|
478
517
|
triggerData: Record<string, any>;
|
|
479
|
-
}): Promise<
|
|
518
|
+
}): Promise<LegacyWorkflowRunResult>;
|
|
480
519
|
/**
|
|
481
|
-
* Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
520
|
+
* Resumes a suspended legacy workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
482
521
|
* @param params - Object containing the runId, stepId, and context
|
|
483
522
|
* @returns Promise containing the workflow resume results
|
|
484
523
|
*/
|
|
@@ -486,7 +525,7 @@ declare class Workflow extends BaseResource {
|
|
|
486
525
|
runId: string;
|
|
487
526
|
stepId: string;
|
|
488
527
|
context: Record<string, any>;
|
|
489
|
-
}): Promise<
|
|
528
|
+
}): Promise<LegacyWorkflowRunResult>;
|
|
490
529
|
/**
|
|
491
530
|
* Creates an async generator that processes a readable stream and yields records
|
|
492
531
|
* separated by the Record Separator character (\x1E)
|
|
@@ -496,13 +535,13 @@ declare class Workflow extends BaseResource {
|
|
|
496
535
|
*/
|
|
497
536
|
private streamProcessor;
|
|
498
537
|
/**
|
|
499
|
-
* Watches workflow transitions in real-time
|
|
538
|
+
* Watches legacy workflow transitions in real-time
|
|
500
539
|
* @param runId - Optional run ID to filter the watch stream
|
|
501
|
-
* @returns AsyncGenerator that yields parsed records from the workflow watch stream
|
|
540
|
+
* @returns AsyncGenerator that yields parsed records from the legacy workflow watch stream
|
|
502
541
|
*/
|
|
503
542
|
watch({ runId }: {
|
|
504
543
|
runId?: string;
|
|
505
|
-
}, onRecord: (record:
|
|
544
|
+
}, onRecord: (record: LegacyWorkflowRunResult) => void): Promise<void>;
|
|
506
545
|
}
|
|
507
546
|
|
|
508
547
|
declare class Tool extends BaseResource {
|
|
@@ -521,14 +560,15 @@ declare class Tool extends BaseResource {
|
|
|
521
560
|
execute(params: {
|
|
522
561
|
data: any;
|
|
523
562
|
runId?: string;
|
|
563
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
524
564
|
}): Promise<any>;
|
|
525
565
|
}
|
|
526
566
|
|
|
527
|
-
declare class
|
|
567
|
+
declare class Workflow extends BaseResource {
|
|
528
568
|
private workflowId;
|
|
529
569
|
constructor(options: ClientOptions, workflowId: string);
|
|
530
570
|
/**
|
|
531
|
-
* Creates an async generator that processes a readable stream and yields
|
|
571
|
+
* Creates an async generator that processes a readable stream and yields workflow records
|
|
532
572
|
* separated by the Record Separator character (\x1E)
|
|
533
573
|
*
|
|
534
574
|
* @param stream - The readable stream to process
|
|
@@ -536,18 +576,18 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
536
576
|
*/
|
|
537
577
|
private streamProcessor;
|
|
538
578
|
/**
|
|
539
|
-
* Retrieves details about the
|
|
540
|
-
* @returns Promise containing
|
|
579
|
+
* Retrieves details about the workflow
|
|
580
|
+
* @returns Promise containing workflow details including steps and graphs
|
|
541
581
|
*/
|
|
542
|
-
details(): Promise<
|
|
582
|
+
details(): Promise<GetWorkflowResponse>;
|
|
543
583
|
/**
|
|
544
|
-
* Retrieves all runs for a
|
|
584
|
+
* Retrieves all runs for a workflow
|
|
545
585
|
* @param params - Parameters for filtering runs
|
|
546
|
-
* @returns Promise containing
|
|
586
|
+
* @returns Promise containing workflow runs array
|
|
547
587
|
*/
|
|
548
588
|
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
549
589
|
/**
|
|
550
|
-
* Creates a new
|
|
590
|
+
* Creates a new workflow run
|
|
551
591
|
* @param params - Optional object containing the optional runId
|
|
552
592
|
* @returns Promise containing the runId of the created run
|
|
553
593
|
*/
|
|
@@ -557,72 +597,142 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
557
597
|
runId: string;
|
|
558
598
|
}>;
|
|
559
599
|
/**
|
|
560
|
-
* Starts a
|
|
600
|
+
* Starts a workflow run synchronously without waiting for the workflow to complete
|
|
561
601
|
* @param params - Object containing the runId, inputData and runtimeContext
|
|
562
602
|
* @returns Promise containing success message
|
|
563
603
|
*/
|
|
564
604
|
start(params: {
|
|
565
605
|
runId: string;
|
|
566
606
|
inputData: Record<string, any>;
|
|
567
|
-
runtimeContext?: RuntimeContext
|
|
607
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
568
608
|
}): Promise<{
|
|
569
609
|
message: string;
|
|
570
610
|
}>;
|
|
571
611
|
/**
|
|
572
|
-
* Resumes a suspended
|
|
612
|
+
* Resumes a suspended workflow step synchronously without waiting for the workflow to complete
|
|
573
613
|
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
574
614
|
* @returns Promise containing success message
|
|
575
615
|
*/
|
|
576
|
-
resume({ step, runId, resumeData,
|
|
616
|
+
resume({ step, runId, resumeData, ...rest }: {
|
|
577
617
|
step: string | string[];
|
|
578
618
|
runId: string;
|
|
579
619
|
resumeData?: Record<string, any>;
|
|
580
|
-
runtimeContext?: RuntimeContext
|
|
620
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
581
621
|
}): Promise<{
|
|
582
622
|
message: string;
|
|
583
623
|
}>;
|
|
584
624
|
/**
|
|
585
|
-
* Starts a
|
|
625
|
+
* Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
|
|
586
626
|
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
587
|
-
* @returns Promise containing the
|
|
627
|
+
* @returns Promise containing the workflow execution results
|
|
588
628
|
*/
|
|
589
629
|
startAsync(params: {
|
|
630
|
+
runId?: string;
|
|
631
|
+
inputData: Record<string, any>;
|
|
632
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
633
|
+
}): Promise<WorkflowRunResult>;
|
|
634
|
+
/**
|
|
635
|
+
* Starts a vNext workflow run and returns a stream
|
|
636
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
637
|
+
* @returns Promise containing the vNext workflow execution results
|
|
638
|
+
*/
|
|
639
|
+
stream(params: {
|
|
590
640
|
runId?: string;
|
|
591
641
|
inputData: Record<string, any>;
|
|
592
642
|
runtimeContext?: RuntimeContext;
|
|
593
|
-
}): Promise<
|
|
643
|
+
}): Promise<stream_web.ReadableStream<WorkflowWatchResult>>;
|
|
594
644
|
/**
|
|
595
|
-
* Resumes a suspended
|
|
645
|
+
* Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
596
646
|
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
597
|
-
* @returns Promise containing the
|
|
647
|
+
* @returns Promise containing the workflow resume results
|
|
598
648
|
*/
|
|
599
649
|
resumeAsync(params: {
|
|
600
650
|
runId: string;
|
|
601
651
|
step: string | string[];
|
|
602
652
|
resumeData?: Record<string, any>;
|
|
603
|
-
runtimeContext?: RuntimeContext
|
|
604
|
-
}): Promise<
|
|
653
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
654
|
+
}): Promise<WorkflowRunResult>;
|
|
605
655
|
/**
|
|
606
|
-
* Watches
|
|
656
|
+
* Watches workflow transitions in real-time
|
|
607
657
|
* @param runId - Optional run ID to filter the watch stream
|
|
608
|
-
* @returns AsyncGenerator that yields parsed records from the
|
|
658
|
+
* @returns AsyncGenerator that yields parsed records from the workflow watch stream
|
|
609
659
|
*/
|
|
610
660
|
watch({ runId }: {
|
|
611
661
|
runId?: string;
|
|
612
|
-
}, onRecord: (record:
|
|
662
|
+
}, onRecord: (record: WorkflowWatchResult) => void): Promise<void>;
|
|
663
|
+
/**
|
|
664
|
+
* Creates a new ReadableStream from an iterable or async iterable of objects,
|
|
665
|
+
* serializing each as JSON and separating them with the record separator (\x1E).
|
|
666
|
+
*
|
|
667
|
+
* @param records - An iterable or async iterable of objects to stream
|
|
668
|
+
* @returns A ReadableStream emitting the records as JSON strings separated by the record separator
|
|
669
|
+
*/
|
|
670
|
+
static createRecordStream(records: Iterable<any> | AsyncIterable<any>): ReadableStream;
|
|
613
671
|
}
|
|
614
672
|
|
|
615
673
|
/**
|
|
616
|
-
*
|
|
674
|
+
* Class for interacting with an agent via the A2A protocol
|
|
617
675
|
*/
|
|
618
|
-
declare class
|
|
676
|
+
declare class A2A extends BaseResource {
|
|
677
|
+
private agentId;
|
|
678
|
+
constructor(options: ClientOptions, agentId: string);
|
|
679
|
+
/**
|
|
680
|
+
* Get the agent card with metadata about the agent
|
|
681
|
+
* @returns Promise containing the agent card information
|
|
682
|
+
*/
|
|
683
|
+
getCard(): Promise<AgentCard>;
|
|
684
|
+
/**
|
|
685
|
+
* Send a message to the agent and get a response
|
|
686
|
+
* @param params - Parameters for the task
|
|
687
|
+
* @returns Promise containing the task response
|
|
688
|
+
*/
|
|
689
|
+
sendMessage(params: TaskSendParams): Promise<{
|
|
690
|
+
task: Task;
|
|
691
|
+
}>;
|
|
692
|
+
/**
|
|
693
|
+
* Get the status and result of a task
|
|
694
|
+
* @param params - Parameters for querying the task
|
|
695
|
+
* @returns Promise containing the task response
|
|
696
|
+
*/
|
|
697
|
+
getTask(params: TaskQueryParams): Promise<Task>;
|
|
698
|
+
/**
|
|
699
|
+
* Cancel a running task
|
|
700
|
+
* @param params - Parameters identifying the task to cancel
|
|
701
|
+
* @returns Promise containing the task response
|
|
702
|
+
*/
|
|
703
|
+
cancelTask(params: TaskIdParams): Promise<{
|
|
704
|
+
task: Task;
|
|
705
|
+
}>;
|
|
706
|
+
/**
|
|
707
|
+
* Send a message and subscribe to streaming updates (not fully implemented)
|
|
708
|
+
* @param params - Parameters for the task
|
|
709
|
+
* @returns Promise containing the task response
|
|
710
|
+
*/
|
|
711
|
+
sendAndSubscribe(params: TaskSendParams): Promise<Response>;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Represents a specific tool available on a specific MCP server.
|
|
716
|
+
* Provides methods to get details and execute the tool.
|
|
717
|
+
*/
|
|
718
|
+
declare class MCPTool extends BaseResource {
|
|
619
719
|
private serverId;
|
|
620
|
-
|
|
720
|
+
private toolId;
|
|
721
|
+
constructor(options: ClientOptions, serverId: string, toolId: string);
|
|
722
|
+
/**
|
|
723
|
+
* Retrieves details about this specific tool from the MCP server.
|
|
724
|
+
* @returns Promise containing the tool's information (name, description, schema).
|
|
725
|
+
*/
|
|
726
|
+
details(): Promise<McpToolInfo>;
|
|
621
727
|
/**
|
|
622
|
-
*
|
|
623
|
-
* @
|
|
728
|
+
* Executes this specific tool on the MCP server.
|
|
729
|
+
* @param params - Parameters for tool execution, including data/args and optional runtimeContext.
|
|
730
|
+
* @returns Promise containing the result of the tool execution.
|
|
624
731
|
*/
|
|
625
|
-
|
|
732
|
+
execute(params: {
|
|
733
|
+
data?: any;
|
|
734
|
+
runtimeContext?: RuntimeContext;
|
|
735
|
+
}): Promise<any>;
|
|
626
736
|
}
|
|
627
737
|
|
|
628
738
|
declare class MastraClient extends BaseResource {
|
|
@@ -632,6 +742,9 @@ declare class MastraClient extends BaseResource {
|
|
|
632
742
|
* @returns Promise containing map of agent IDs to agent details
|
|
633
743
|
*/
|
|
634
744
|
getAgents(): Promise<Record<string, GetAgentResponse>>;
|
|
745
|
+
getAGUI({ resourceId }: {
|
|
746
|
+
resourceId: string;
|
|
747
|
+
}): Promise<Record<string, AbstractAgent>>;
|
|
635
748
|
/**
|
|
636
749
|
* Gets an agent instance by ID
|
|
637
750
|
* @param agentId - ID of the agent to retrieve
|
|
@@ -680,6 +793,17 @@ declare class MastraClient extends BaseResource {
|
|
|
680
793
|
* @returns Tool instance
|
|
681
794
|
*/
|
|
682
795
|
getTool(toolId: string): Tool;
|
|
796
|
+
/**
|
|
797
|
+
* Retrieves all available legacy workflows
|
|
798
|
+
* @returns Promise containing map of legacy workflow IDs to legacy workflow details
|
|
799
|
+
*/
|
|
800
|
+
getLegacyWorkflows(): Promise<Record<string, GetLegacyWorkflowResponse>>;
|
|
801
|
+
/**
|
|
802
|
+
* Gets a legacy workflow instance by ID
|
|
803
|
+
* @param workflowId - ID of the legacy workflow to retrieve
|
|
804
|
+
* @returns Legacy Workflow instance
|
|
805
|
+
*/
|
|
806
|
+
getLegacyWorkflow(workflowId: string): LegacyWorkflow;
|
|
683
807
|
/**
|
|
684
808
|
* Retrieves all available workflows
|
|
685
809
|
* @returns Promise containing map of workflow IDs to workflow details
|
|
@@ -691,17 +815,6 @@ declare class MastraClient extends BaseResource {
|
|
|
691
815
|
* @returns Workflow instance
|
|
692
816
|
*/
|
|
693
817
|
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;
|
|
705
818
|
/**
|
|
706
819
|
* Gets a vector instance by name
|
|
707
820
|
* @param vectorName - Name of the vector to retrieve
|
|
@@ -745,16 +858,43 @@ declare class MastraClient extends BaseResource {
|
|
|
745
858
|
*/
|
|
746
859
|
getNetwork(networkId: string): Network;
|
|
747
860
|
/**
|
|
748
|
-
* Retrieves
|
|
749
|
-
* @
|
|
861
|
+
* Retrieves a list of available MCP servers.
|
|
862
|
+
* @param params - Optional parameters for pagination (limit, offset).
|
|
863
|
+
* @returns Promise containing the list of MCP servers and pagination info.
|
|
864
|
+
*/
|
|
865
|
+
getMcpServers(params?: {
|
|
866
|
+
limit?: number;
|
|
867
|
+
offset?: number;
|
|
868
|
+
}): Promise<McpServerListResponse>;
|
|
869
|
+
/**
|
|
870
|
+
* Retrieves detailed information for a specific MCP server.
|
|
871
|
+
* @param serverId - The ID of the MCP server to retrieve.
|
|
872
|
+
* @param params - Optional parameters, e.g., specific version.
|
|
873
|
+
* @returns Promise containing the detailed MCP server information.
|
|
874
|
+
*/
|
|
875
|
+
getMcpServerDetails(serverId: string, params?: {
|
|
876
|
+
version?: string;
|
|
877
|
+
}): Promise<ServerDetailInfo>;
|
|
878
|
+
/**
|
|
879
|
+
* Retrieves a list of tools for a specific MCP server.
|
|
880
|
+
* @param serverId - The ID of the MCP server.
|
|
881
|
+
* @returns Promise containing the list of tools.
|
|
882
|
+
*/
|
|
883
|
+
getMcpServerTools(serverId: string): Promise<McpServerToolListResponse>;
|
|
884
|
+
/**
|
|
885
|
+
* Gets an MCPTool resource instance for a specific tool on an MCP server.
|
|
886
|
+
* This instance can then be used to fetch details or execute the tool.
|
|
887
|
+
* @param serverId - The ID of the MCP server.
|
|
888
|
+
* @param toolId - The ID of the tool.
|
|
889
|
+
* @returns MCPTool instance.
|
|
750
890
|
*/
|
|
751
|
-
|
|
891
|
+
getMcpServerTool(serverId: string, toolId: string): MCPTool;
|
|
752
892
|
/**
|
|
753
|
-
* Gets an
|
|
754
|
-
* @param
|
|
755
|
-
* @returns
|
|
893
|
+
* Gets an A2A client for interacting with an agent via the A2A protocol
|
|
894
|
+
* @param agentId - ID of the agent to interact with
|
|
895
|
+
* @returns A2A client instance
|
|
756
896
|
*/
|
|
757
|
-
|
|
897
|
+
getA2A(agentId: string): A2A;
|
|
758
898
|
}
|
|
759
899
|
|
|
760
|
-
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type
|
|
900
|
+
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 };
|