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