@mastra/client-js 0.0.0-switch-to-core-20250424015131 → 0.0.0-taofeeqInngest-20250603090617
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 +493 -2
- package/dist/index.cjs +770 -48
- package/dist/index.d.cts +358 -36
- package/dist/index.d.ts +358 -36
- package/dist/index.js +766 -48
- package/package.json +10 -7
- package/src/adapters/agui.test.ts +180 -0
- package/src/adapters/agui.ts +239 -0
- package/src/client.ts +122 -2
- 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 +36 -36
- 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 +106 -16
- package/src/utils/index.ts +11 -0
- package/src/utils/zod-to-json-schema.ts +10 -0
package/dist/index.d.cts
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 { processDataStream } from '@ai-sdk/ui-utils';
|
|
5
7
|
import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
|
|
8
|
+
import { 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,38 @@ 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
|
+
} & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
|
|
36
55
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
37
56
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
38
|
-
|
|
57
|
+
output?: T;
|
|
58
|
+
experimental_output?: T;
|
|
59
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
60
|
+
} & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
|
|
39
61
|
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
40
62
|
evals: any[];
|
|
63
|
+
instructions: string;
|
|
64
|
+
name: string;
|
|
65
|
+
id: string;
|
|
41
66
|
}
|
|
42
67
|
interface GetToolResponse {
|
|
43
68
|
id: string;
|
|
@@ -45,7 +70,7 @@ interface GetToolResponse {
|
|
|
45
70
|
inputSchema: string;
|
|
46
71
|
outputSchema: string;
|
|
47
72
|
}
|
|
48
|
-
interface
|
|
73
|
+
interface GetLegacyWorkflowResponse {
|
|
49
74
|
name: string;
|
|
50
75
|
triggerSchema: string;
|
|
51
76
|
steps: Record<string, StepAction<any, any, any, any>>;
|
|
@@ -53,16 +78,46 @@ interface GetWorkflowResponse {
|
|
|
53
78
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
54
79
|
workflowId?: string;
|
|
55
80
|
}
|
|
56
|
-
|
|
81
|
+
interface GetWorkflowRunsParams {
|
|
82
|
+
fromDate?: Date;
|
|
83
|
+
toDate?: Date;
|
|
84
|
+
limit?: number;
|
|
85
|
+
offset?: number;
|
|
86
|
+
resourceId?: string;
|
|
87
|
+
}
|
|
88
|
+
type GetLegacyWorkflowRunsResponse = LegacyWorkflowRuns;
|
|
89
|
+
type GetWorkflowRunsResponse = WorkflowRuns;
|
|
90
|
+
type LegacyWorkflowRunResult = {
|
|
57
91
|
activePaths: Record<string, {
|
|
58
92
|
status: string;
|
|
59
93
|
suspendPayload?: any;
|
|
60
94
|
stepPath: string[];
|
|
61
95
|
}>;
|
|
62
|
-
results:
|
|
96
|
+
results: LegacyWorkflowRunResult$1<any, any, any>['results'];
|
|
63
97
|
timestamp: number;
|
|
64
98
|
runId: string;
|
|
65
99
|
};
|
|
100
|
+
interface GetWorkflowResponse {
|
|
101
|
+
name: string;
|
|
102
|
+
description?: string;
|
|
103
|
+
steps: {
|
|
104
|
+
[key: string]: {
|
|
105
|
+
id: string;
|
|
106
|
+
description: string;
|
|
107
|
+
inputSchema: string;
|
|
108
|
+
outputSchema: string;
|
|
109
|
+
resumeSchema: string;
|
|
110
|
+
suspendSchema: string;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
stepGraph: Workflow$1['serializedStepGraph'];
|
|
114
|
+
inputSchema: string;
|
|
115
|
+
outputSchema: string;
|
|
116
|
+
}
|
|
117
|
+
type WorkflowWatchResult = WatchEvent & {
|
|
118
|
+
runId: string;
|
|
119
|
+
};
|
|
120
|
+
type WorkflowRunResult = WorkflowResult<any, any>;
|
|
66
121
|
interface UpsertVectorParams {
|
|
67
122
|
indexName: string;
|
|
68
123
|
vectors: number[][];
|
|
@@ -90,15 +145,15 @@ interface GetVectorIndexResponse {
|
|
|
90
145
|
count: number;
|
|
91
146
|
}
|
|
92
147
|
interface SaveMessageToMemoryParams {
|
|
93
|
-
messages:
|
|
148
|
+
messages: MastraMessageV1[];
|
|
94
149
|
agentId: string;
|
|
95
150
|
}
|
|
96
|
-
type SaveMessageToMemoryResponse =
|
|
151
|
+
type SaveMessageToMemoryResponse = MastraMessageV1[];
|
|
97
152
|
interface CreateMemoryThreadParams {
|
|
98
|
-
title
|
|
99
|
-
metadata
|
|
153
|
+
title?: string;
|
|
154
|
+
metadata?: Record<string, any>;
|
|
100
155
|
resourceId: string;
|
|
101
|
-
threadId
|
|
156
|
+
threadId?: string;
|
|
102
157
|
agentId: string;
|
|
103
158
|
}
|
|
104
159
|
type CreateMemoryThreadResponse = StorageThreadType;
|
|
@@ -112,6 +167,12 @@ interface UpdateMemoryThreadParams {
|
|
|
112
167
|
metadata: Record<string, any>;
|
|
113
168
|
resourceId: string;
|
|
114
169
|
}
|
|
170
|
+
interface GetMemoryThreadMessagesParams {
|
|
171
|
+
/**
|
|
172
|
+
* Limit the number of messages to retrieve (default: 40)
|
|
173
|
+
*/
|
|
174
|
+
limit?: number;
|
|
175
|
+
}
|
|
115
176
|
interface GetMemoryThreadMessagesResponse {
|
|
116
177
|
messages: CoreMessage[];
|
|
117
178
|
uiMessages: AiMessageType[];
|
|
@@ -171,6 +232,8 @@ interface GetTelemetryParams {
|
|
|
171
232
|
page?: number;
|
|
172
233
|
perPage?: number;
|
|
173
234
|
attribute?: Record<string, string>;
|
|
235
|
+
fromDate?: Date;
|
|
236
|
+
toDate?: Date;
|
|
174
237
|
}
|
|
175
238
|
interface GetNetworkResponse {
|
|
176
239
|
name: string;
|
|
@@ -186,6 +249,21 @@ interface GetNetworkResponse {
|
|
|
186
249
|
};
|
|
187
250
|
state?: Record<string, any>;
|
|
188
251
|
}
|
|
252
|
+
interface McpServerListResponse {
|
|
253
|
+
servers: ServerInfo[];
|
|
254
|
+
next: string | null;
|
|
255
|
+
total_count: number;
|
|
256
|
+
}
|
|
257
|
+
interface McpToolInfo {
|
|
258
|
+
id: string;
|
|
259
|
+
name: string;
|
|
260
|
+
description?: string;
|
|
261
|
+
inputSchema: string;
|
|
262
|
+
toolType?: MCPToolType;
|
|
263
|
+
}
|
|
264
|
+
interface McpServerToolListResponse {
|
|
265
|
+
tools: McpToolInfo[];
|
|
266
|
+
}
|
|
189
267
|
|
|
190
268
|
declare class BaseResource {
|
|
191
269
|
readonly options: ClientOptions;
|
|
@@ -218,7 +296,9 @@ declare class AgentVoice extends BaseResource {
|
|
|
218
296
|
* @param options - Optional provider-specific options
|
|
219
297
|
* @returns Promise containing the transcribed text
|
|
220
298
|
*/
|
|
221
|
-
listen(audio: Blob, options?: Record<string, any>): Promise<
|
|
299
|
+
listen(audio: Blob, options?: Record<string, any>): Promise<{
|
|
300
|
+
text: string;
|
|
301
|
+
}>;
|
|
222
302
|
/**
|
|
223
303
|
* Get available speakers for the agent's voice provider
|
|
224
304
|
* @returns Promise containing list of available speakers
|
|
@@ -227,6 +307,13 @@ declare class AgentVoice extends BaseResource {
|
|
|
227
307
|
voiceId: string;
|
|
228
308
|
[key: string]: any;
|
|
229
309
|
}>>;
|
|
310
|
+
/**
|
|
311
|
+
* Get the listener configuration for the agent's voice provider
|
|
312
|
+
* @returns Promise containing a check if the agent has listening capabilities
|
|
313
|
+
*/
|
|
314
|
+
getListener(): Promise<{
|
|
315
|
+
enabled: boolean;
|
|
316
|
+
}>;
|
|
230
317
|
}
|
|
231
318
|
declare class Agent extends BaseResource {
|
|
232
319
|
private agentId;
|
|
@@ -257,6 +344,16 @@ declare class Agent extends BaseResource {
|
|
|
257
344
|
* @returns Promise containing tool details
|
|
258
345
|
*/
|
|
259
346
|
getTool(toolId: string): Promise<GetToolResponse>;
|
|
347
|
+
/**
|
|
348
|
+
* Executes a tool for the agent
|
|
349
|
+
* @param toolId - ID of the tool to execute
|
|
350
|
+
* @param params - Parameters required for tool execution
|
|
351
|
+
* @returns Promise containing the tool execution results
|
|
352
|
+
*/
|
|
353
|
+
executeTool(toolId: string, params: {
|
|
354
|
+
data: any;
|
|
355
|
+
runtimeContext?: RuntimeContext;
|
|
356
|
+
}): Promise<any>;
|
|
260
357
|
/**
|
|
261
358
|
* Retrieves evaluation results for the agent
|
|
262
359
|
* @returns Promise containing agent evaluations
|
|
@@ -317,9 +414,10 @@ declare class MemoryThread extends BaseResource {
|
|
|
317
414
|
}>;
|
|
318
415
|
/**
|
|
319
416
|
* Retrieves messages associated with the thread
|
|
417
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
320
418
|
* @returns Promise containing thread messages and UI messages
|
|
321
419
|
*/
|
|
322
|
-
getMessages(): Promise<GetMemoryThreadMessagesResponse>;
|
|
420
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
323
421
|
}
|
|
324
422
|
|
|
325
423
|
declare class Vector extends BaseResource {
|
|
@@ -368,23 +466,22 @@ declare class Vector extends BaseResource {
|
|
|
368
466
|
query(params: QueryVectorParams): Promise<QueryVectorResponse>;
|
|
369
467
|
}
|
|
370
468
|
|
|
371
|
-
declare class
|
|
469
|
+
declare class LegacyWorkflow extends BaseResource {
|
|
372
470
|
private workflowId;
|
|
373
471
|
constructor(options: ClientOptions, workflowId: string);
|
|
374
472
|
/**
|
|
375
|
-
* Retrieves details about the workflow
|
|
376
|
-
* @returns Promise containing workflow details including steps and graphs
|
|
473
|
+
* Retrieves details about the legacy workflow
|
|
474
|
+
* @returns Promise containing legacy workflow details including steps and graphs
|
|
377
475
|
*/
|
|
378
|
-
details(): Promise<
|
|
476
|
+
details(): Promise<GetLegacyWorkflowResponse>;
|
|
379
477
|
/**
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
* @
|
|
383
|
-
* @returns Promise containing the workflow execution results
|
|
478
|
+
* Retrieves all runs for a legacy workflow
|
|
479
|
+
* @param params - Parameters for filtering runs
|
|
480
|
+
* @returns Promise containing legacy workflow runs array
|
|
384
481
|
*/
|
|
385
|
-
|
|
482
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetLegacyWorkflowRunsResponse>;
|
|
386
483
|
/**
|
|
387
|
-
* Creates a new workflow run
|
|
484
|
+
* Creates a new legacy workflow run
|
|
388
485
|
* @returns Promise containing the generated run ID
|
|
389
486
|
*/
|
|
390
487
|
createRun(params?: {
|
|
@@ -393,7 +490,7 @@ declare class Workflow extends BaseResource {
|
|
|
393
490
|
runId: string;
|
|
394
491
|
}>;
|
|
395
492
|
/**
|
|
396
|
-
* Starts a workflow run synchronously without waiting for the workflow to complete
|
|
493
|
+
* Starts a legacy workflow run synchronously without waiting for the workflow to complete
|
|
397
494
|
* @param params - Object containing the runId and triggerData
|
|
398
495
|
* @returns Promise containing success message
|
|
399
496
|
*/
|
|
@@ -404,11 +501,11 @@ declare class Workflow extends BaseResource {
|
|
|
404
501
|
message: string;
|
|
405
502
|
}>;
|
|
406
503
|
/**
|
|
407
|
-
* Resumes a suspended workflow step synchronously without waiting for the workflow to complete
|
|
504
|
+
* Resumes a suspended legacy workflow step synchronously without waiting for the workflow to complete
|
|
408
505
|
* @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
|
|
506
|
+
* @param runId - ID of the legacy workflow run
|
|
507
|
+
* @param context - Context to resume the legacy workflow with
|
|
508
|
+
* @returns Promise containing the legacy workflow resume results
|
|
412
509
|
*/
|
|
413
510
|
resume({ stepId, runId, context, }: {
|
|
414
511
|
stepId: string;
|
|
@@ -425,9 +522,9 @@ declare class Workflow extends BaseResource {
|
|
|
425
522
|
startAsync(params: {
|
|
426
523
|
runId?: string;
|
|
427
524
|
triggerData: Record<string, any>;
|
|
428
|
-
}): Promise<
|
|
525
|
+
}): Promise<LegacyWorkflowRunResult>;
|
|
429
526
|
/**
|
|
430
|
-
* Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
527
|
+
* Resumes a suspended legacy workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
431
528
|
* @param params - Object containing the runId, stepId, and context
|
|
432
529
|
* @returns Promise containing the workflow resume results
|
|
433
530
|
*/
|
|
@@ -435,7 +532,7 @@ declare class Workflow extends BaseResource {
|
|
|
435
532
|
runId: string;
|
|
436
533
|
stepId: string;
|
|
437
534
|
context: Record<string, any>;
|
|
438
|
-
}): Promise<
|
|
535
|
+
}): Promise<LegacyWorkflowRunResult>;
|
|
439
536
|
/**
|
|
440
537
|
* Creates an async generator that processes a readable stream and yields records
|
|
441
538
|
* separated by the Record Separator character (\x1E)
|
|
@@ -445,13 +542,13 @@ declare class Workflow extends BaseResource {
|
|
|
445
542
|
*/
|
|
446
543
|
private streamProcessor;
|
|
447
544
|
/**
|
|
448
|
-
* Watches workflow transitions in real-time
|
|
545
|
+
* Watches legacy workflow transitions in real-time
|
|
449
546
|
* @param runId - Optional run ID to filter the watch stream
|
|
450
|
-
* @returns AsyncGenerator that yields parsed records from the workflow watch stream
|
|
547
|
+
* @returns AsyncGenerator that yields parsed records from the legacy workflow watch stream
|
|
451
548
|
*/
|
|
452
549
|
watch({ runId }: {
|
|
453
550
|
runId?: string;
|
|
454
|
-
}, onRecord: (record:
|
|
551
|
+
}, onRecord: (record: LegacyWorkflowRunResult) => void): Promise<void>;
|
|
455
552
|
}
|
|
456
553
|
|
|
457
554
|
declare class Tool extends BaseResource {
|
|
@@ -469,6 +566,179 @@ declare class Tool extends BaseResource {
|
|
|
469
566
|
*/
|
|
470
567
|
execute(params: {
|
|
471
568
|
data: any;
|
|
569
|
+
runId?: string;
|
|
570
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
571
|
+
}): Promise<any>;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
declare class Workflow extends BaseResource {
|
|
575
|
+
private workflowId;
|
|
576
|
+
constructor(options: ClientOptions, workflowId: string);
|
|
577
|
+
/**
|
|
578
|
+
* Creates an async generator that processes a readable stream and yields workflow records
|
|
579
|
+
* separated by the Record Separator character (\x1E)
|
|
580
|
+
*
|
|
581
|
+
* @param stream - The readable stream to process
|
|
582
|
+
* @returns An async generator that yields parsed records
|
|
583
|
+
*/
|
|
584
|
+
private streamProcessor;
|
|
585
|
+
/**
|
|
586
|
+
* Retrieves details about the workflow
|
|
587
|
+
* @returns Promise containing workflow details including steps and graphs
|
|
588
|
+
*/
|
|
589
|
+
details(): Promise<GetWorkflowResponse>;
|
|
590
|
+
/**
|
|
591
|
+
* Retrieves all runs for a workflow
|
|
592
|
+
* @param params - Parameters for filtering runs
|
|
593
|
+
* @returns Promise containing workflow runs array
|
|
594
|
+
*/
|
|
595
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
596
|
+
/**
|
|
597
|
+
* Creates a new workflow run
|
|
598
|
+
* @param params - Optional object containing the optional runId
|
|
599
|
+
* @returns Promise containing the runId of the created run
|
|
600
|
+
*/
|
|
601
|
+
createRun(params?: {
|
|
602
|
+
runId?: string;
|
|
603
|
+
}): Promise<{
|
|
604
|
+
runId: string;
|
|
605
|
+
}>;
|
|
606
|
+
/**
|
|
607
|
+
* Starts a workflow run synchronously without waiting for the workflow to complete
|
|
608
|
+
* @param params - Object containing the runId, inputData and runtimeContext
|
|
609
|
+
* @returns Promise containing success message
|
|
610
|
+
*/
|
|
611
|
+
start(params: {
|
|
612
|
+
runId: string;
|
|
613
|
+
inputData: Record<string, any>;
|
|
614
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
615
|
+
}): Promise<{
|
|
616
|
+
message: string;
|
|
617
|
+
}>;
|
|
618
|
+
/**
|
|
619
|
+
* Resumes a suspended workflow step synchronously without waiting for the workflow to complete
|
|
620
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
621
|
+
* @returns Promise containing success message
|
|
622
|
+
*/
|
|
623
|
+
resume({ step, runId, resumeData, ...rest }: {
|
|
624
|
+
step: string | string[];
|
|
625
|
+
runId: string;
|
|
626
|
+
resumeData?: Record<string, any>;
|
|
627
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
628
|
+
}): Promise<{
|
|
629
|
+
message: string;
|
|
630
|
+
}>;
|
|
631
|
+
/**
|
|
632
|
+
* Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
|
|
633
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
634
|
+
* @returns Promise containing the workflow execution results
|
|
635
|
+
*/
|
|
636
|
+
startAsync(params: {
|
|
637
|
+
runId?: string;
|
|
638
|
+
inputData: Record<string, any>;
|
|
639
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
640
|
+
}): Promise<WorkflowRunResult>;
|
|
641
|
+
/**
|
|
642
|
+
* Starts a vNext workflow run and returns a stream
|
|
643
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
644
|
+
* @returns Promise containing the vNext workflow execution results
|
|
645
|
+
*/
|
|
646
|
+
stream(params: {
|
|
647
|
+
runId?: string;
|
|
648
|
+
inputData: Record<string, any>;
|
|
649
|
+
runtimeContext?: RuntimeContext;
|
|
650
|
+
}): Promise<stream_web.ReadableStream<WorkflowWatchResult>>;
|
|
651
|
+
/**
|
|
652
|
+
* Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
653
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
654
|
+
* @returns Promise containing the workflow resume results
|
|
655
|
+
*/
|
|
656
|
+
resumeAsync(params: {
|
|
657
|
+
runId: string;
|
|
658
|
+
step: string | string[];
|
|
659
|
+
resumeData?: Record<string, any>;
|
|
660
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
661
|
+
}): Promise<WorkflowRunResult>;
|
|
662
|
+
/**
|
|
663
|
+
* Watches workflow transitions in real-time
|
|
664
|
+
* @param runId - Optional run ID to filter the watch stream
|
|
665
|
+
* @returns AsyncGenerator that yields parsed records from the workflow watch stream
|
|
666
|
+
*/
|
|
667
|
+
watch({ runId }: {
|
|
668
|
+
runId?: string;
|
|
669
|
+
}, onRecord: (record: WorkflowWatchResult) => void): Promise<void>;
|
|
670
|
+
/**
|
|
671
|
+
* Creates a new ReadableStream from an iterable or async iterable of objects,
|
|
672
|
+
* serializing each as JSON and separating them with the record separator (\x1E).
|
|
673
|
+
*
|
|
674
|
+
* @param records - An iterable or async iterable of objects to stream
|
|
675
|
+
* @returns A ReadableStream emitting the records as JSON strings separated by the record separator
|
|
676
|
+
*/
|
|
677
|
+
static createRecordStream(records: Iterable<any> | AsyncIterable<any>): ReadableStream;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* Class for interacting with an agent via the A2A protocol
|
|
682
|
+
*/
|
|
683
|
+
declare class A2A extends BaseResource {
|
|
684
|
+
private agentId;
|
|
685
|
+
constructor(options: ClientOptions, agentId: string);
|
|
686
|
+
/**
|
|
687
|
+
* Get the agent card with metadata about the agent
|
|
688
|
+
* @returns Promise containing the agent card information
|
|
689
|
+
*/
|
|
690
|
+
getCard(): Promise<AgentCard>;
|
|
691
|
+
/**
|
|
692
|
+
* Send a message to the agent and get a response
|
|
693
|
+
* @param params - Parameters for the task
|
|
694
|
+
* @returns Promise containing the task response
|
|
695
|
+
*/
|
|
696
|
+
sendMessage(params: TaskSendParams): Promise<{
|
|
697
|
+
task: Task;
|
|
698
|
+
}>;
|
|
699
|
+
/**
|
|
700
|
+
* Get the status and result of a task
|
|
701
|
+
* @param params - Parameters for querying the task
|
|
702
|
+
* @returns Promise containing the task response
|
|
703
|
+
*/
|
|
704
|
+
getTask(params: TaskQueryParams): Promise<Task>;
|
|
705
|
+
/**
|
|
706
|
+
* Cancel a running task
|
|
707
|
+
* @param params - Parameters identifying the task to cancel
|
|
708
|
+
* @returns Promise containing the task response
|
|
709
|
+
*/
|
|
710
|
+
cancelTask(params: TaskIdParams): Promise<{
|
|
711
|
+
task: Task;
|
|
712
|
+
}>;
|
|
713
|
+
/**
|
|
714
|
+
* Send a message and subscribe to streaming updates (not fully implemented)
|
|
715
|
+
* @param params - Parameters for the task
|
|
716
|
+
* @returns Promise containing the task response
|
|
717
|
+
*/
|
|
718
|
+
sendAndSubscribe(params: TaskSendParams): Promise<Response>;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Represents a specific tool available on a specific MCP server.
|
|
723
|
+
* Provides methods to get details and execute the tool.
|
|
724
|
+
*/
|
|
725
|
+
declare class MCPTool extends BaseResource {
|
|
726
|
+
private serverId;
|
|
727
|
+
private toolId;
|
|
728
|
+
constructor(options: ClientOptions, serverId: string, toolId: string);
|
|
729
|
+
/**
|
|
730
|
+
* Retrieves details about this specific tool from the MCP server.
|
|
731
|
+
* @returns Promise containing the tool's information (name, description, schema).
|
|
732
|
+
*/
|
|
733
|
+
details(): Promise<McpToolInfo>;
|
|
734
|
+
/**
|
|
735
|
+
* Executes this specific tool on the MCP server.
|
|
736
|
+
* @param params - Parameters for tool execution, including data/args and optional runtimeContext.
|
|
737
|
+
* @returns Promise containing the result of the tool execution.
|
|
738
|
+
*/
|
|
739
|
+
execute(params: {
|
|
740
|
+
data?: any;
|
|
741
|
+
runtimeContext?: RuntimeContext;
|
|
472
742
|
}): Promise<any>;
|
|
473
743
|
}
|
|
474
744
|
|
|
@@ -479,6 +749,9 @@ declare class MastraClient extends BaseResource {
|
|
|
479
749
|
* @returns Promise containing map of agent IDs to agent details
|
|
480
750
|
*/
|
|
481
751
|
getAgents(): Promise<Record<string, GetAgentResponse>>;
|
|
752
|
+
getAGUI({ resourceId }: {
|
|
753
|
+
resourceId: string;
|
|
754
|
+
}): Promise<Record<string, AbstractAgent>>;
|
|
482
755
|
/**
|
|
483
756
|
* Gets an agent instance by ID
|
|
484
757
|
* @param agentId - ID of the agent to retrieve
|
|
@@ -527,6 +800,17 @@ declare class MastraClient extends BaseResource {
|
|
|
527
800
|
* @returns Tool instance
|
|
528
801
|
*/
|
|
529
802
|
getTool(toolId: string): Tool;
|
|
803
|
+
/**
|
|
804
|
+
* Retrieves all available legacy workflows
|
|
805
|
+
* @returns Promise containing map of legacy workflow IDs to legacy workflow details
|
|
806
|
+
*/
|
|
807
|
+
getLegacyWorkflows(): Promise<Record<string, GetLegacyWorkflowResponse>>;
|
|
808
|
+
/**
|
|
809
|
+
* Gets a legacy workflow instance by ID
|
|
810
|
+
* @param workflowId - ID of the legacy workflow to retrieve
|
|
811
|
+
* @returns Legacy Workflow instance
|
|
812
|
+
*/
|
|
813
|
+
getLegacyWorkflow(workflowId: string): LegacyWorkflow;
|
|
530
814
|
/**
|
|
531
815
|
* Retrieves all available workflows
|
|
532
816
|
* @returns Promise containing map of workflow IDs to workflow details
|
|
@@ -580,6 +864,44 @@ declare class MastraClient extends BaseResource {
|
|
|
580
864
|
* @returns Network instance
|
|
581
865
|
*/
|
|
582
866
|
getNetwork(networkId: string): Network;
|
|
867
|
+
/**
|
|
868
|
+
* Retrieves a list of available MCP servers.
|
|
869
|
+
* @param params - Optional parameters for pagination (limit, offset).
|
|
870
|
+
* @returns Promise containing the list of MCP servers and pagination info.
|
|
871
|
+
*/
|
|
872
|
+
getMcpServers(params?: {
|
|
873
|
+
limit?: number;
|
|
874
|
+
offset?: number;
|
|
875
|
+
}): Promise<McpServerListResponse>;
|
|
876
|
+
/**
|
|
877
|
+
* Retrieves detailed information for a specific MCP server.
|
|
878
|
+
* @param serverId - The ID of the MCP server to retrieve.
|
|
879
|
+
* @param params - Optional parameters, e.g., specific version.
|
|
880
|
+
* @returns Promise containing the detailed MCP server information.
|
|
881
|
+
*/
|
|
882
|
+
getMcpServerDetails(serverId: string, params?: {
|
|
883
|
+
version?: string;
|
|
884
|
+
}): Promise<ServerDetailInfo>;
|
|
885
|
+
/**
|
|
886
|
+
* Retrieves a list of tools for a specific MCP server.
|
|
887
|
+
* @param serverId - The ID of the MCP server.
|
|
888
|
+
* @returns Promise containing the list of tools.
|
|
889
|
+
*/
|
|
890
|
+
getMcpServerTools(serverId: string): Promise<McpServerToolListResponse>;
|
|
891
|
+
/**
|
|
892
|
+
* Gets an MCPTool resource instance for a specific tool on an MCP server.
|
|
893
|
+
* This instance can then be used to fetch details or execute the tool.
|
|
894
|
+
* @param serverId - The ID of the MCP server.
|
|
895
|
+
* @param toolId - The ID of the tool.
|
|
896
|
+
* @returns MCPTool instance.
|
|
897
|
+
*/
|
|
898
|
+
getMcpServerTool(serverId: string, toolId: string): MCPTool;
|
|
899
|
+
/**
|
|
900
|
+
* Gets an A2A client for interacting with an agent via the A2A protocol
|
|
901
|
+
* @param agentId - ID of the agent to interact with
|
|
902
|
+
* @returns A2A client instance
|
|
903
|
+
*/
|
|
904
|
+
getA2A(agentId: string): A2A;
|
|
583
905
|
}
|
|
584
906
|
|
|
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 };
|
|
907
|
+
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 };
|