@mastra/client-js 0.0.0-mcp-server-deploy-20250507160341 → 0.0.0-mcp-changeset-20250707162621

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/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, StepAction, StepGraph, WorkflowRuns, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
4
+ import { CoreMessage, AiMessageType, StorageThreadType, MastraMessageV1, LegacyWorkflowRuns, WorkflowRuns, WorkflowRun, QueryResult, GenerateReturn } from '@mastra/core';
3
5
  import { JSONSchema7 } from 'json-schema';
4
6
  import { ZodSchema } from 'zod';
5
- import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
6
- import { NewWorkflow, WorkflowResult, WatchEvent } from '@mastra/core/workflows/vNext';
7
+ import { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
8
+ import { LogLevel, BaseLogMessage } from '@mastra/core/logger';
7
9
  import { RuntimeContext } from '@mastra/core/runtime-context';
10
+ import { Workflow as Workflow$1, WatchEvent, WorkflowResult } 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,35 @@ 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
- } & Partial<AgentGenerateOptions<T>>;
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'>>;
38
56
  type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
39
57
  messages: string | string[] | CoreMessage[] | AiMessageType[];
40
- } & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry'>;
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'>>;
41
63
  interface GetEvalsByAgentIdResponse extends GetAgentResponse {
42
64
  evals: any[];
43
65
  instructions: string;
@@ -50,7 +72,7 @@ interface GetToolResponse {
50
72
  inputSchema: string;
51
73
  outputSchema: string;
52
74
  }
53
- interface GetWorkflowResponse {
75
+ interface GetLegacyWorkflowResponse {
54
76
  name: string;
55
77
  triggerSchema: string;
56
78
  steps: Record<string, StepAction<any, any, any, any>>;
@@ -65,19 +87,23 @@ interface GetWorkflowRunsParams {
65
87
  offset?: number;
66
88
  resourceId?: string;
67
89
  }
90
+ type GetLegacyWorkflowRunsResponse = LegacyWorkflowRuns;
68
91
  type GetWorkflowRunsResponse = WorkflowRuns;
69
- type WorkflowRunResult = {
92
+ type GetWorkflowRunByIdResponse = WorkflowRun;
93
+ type GetWorkflowRunExecutionResultResponse = WatchEvent['payload']['workflowState'];
94
+ type LegacyWorkflowRunResult = {
70
95
  activePaths: Record<string, {
71
96
  status: string;
72
97
  suspendPayload?: any;
73
98
  stepPath: string[];
74
99
  }>;
75
- results: WorkflowRunResult$1<any, any, any>['results'];
100
+ results: LegacyWorkflowRunResult$1<any, any, any>['results'];
76
101
  timestamp: number;
77
102
  runId: string;
78
103
  };
79
- interface GetVNextWorkflowResponse {
104
+ interface GetWorkflowResponse {
80
105
  name: string;
106
+ description?: string;
81
107
  steps: {
82
108
  [key: string]: {
83
109
  id: string;
@@ -88,14 +114,25 @@ interface GetVNextWorkflowResponse {
88
114
  suspendSchema: string;
89
115
  };
90
116
  };
91
- stepGraph: NewWorkflow['serializedStepGraph'];
117
+ allSteps: {
118
+ [key: string]: {
119
+ id: string;
120
+ description: string;
121
+ inputSchema: string;
122
+ outputSchema: string;
123
+ resumeSchema: string;
124
+ suspendSchema: string;
125
+ isWorkflow: boolean;
126
+ };
127
+ };
128
+ stepGraph: Workflow$1['serializedStepGraph'];
92
129
  inputSchema: string;
93
130
  outputSchema: string;
94
131
  }
95
- type VNextWorkflowWatchResult = WatchEvent & {
132
+ type WorkflowWatchResult = WatchEvent & {
96
133
  runId: string;
97
134
  };
98
- type VNextWorkflowRunResult = WorkflowResult<any, any>;
135
+ type WorkflowRunResult = WorkflowResult<any, any>;
99
136
  interface UpsertVectorParams {
100
137
  indexName: string;
101
138
  vectors: number[][];
@@ -123,40 +160,79 @@ interface GetVectorIndexResponse {
123
160
  count: number;
124
161
  }
125
162
  interface SaveMessageToMemoryParams {
126
- messages: MessageType[];
163
+ messages: MastraMessageV1[];
127
164
  agentId: string;
128
165
  }
129
- type SaveMessageToMemoryResponse = MessageType[];
166
+ interface SaveNetworkMessageToMemoryParams {
167
+ messages: MastraMessageV1[];
168
+ networkId: string;
169
+ }
170
+ type SaveMessageToMemoryResponse = MastraMessageV1[];
130
171
  interface CreateMemoryThreadParams {
131
- title: string;
132
- metadata: Record<string, any>;
172
+ title?: string;
173
+ metadata?: Record<string, any>;
133
174
  resourceId: string;
134
- threadId: string;
175
+ threadId?: string;
135
176
  agentId: string;
136
177
  }
178
+ interface CreateNetworkMemoryThreadParams {
179
+ title?: string;
180
+ metadata?: Record<string, any>;
181
+ resourceId: string;
182
+ threadId?: string;
183
+ networkId: string;
184
+ }
137
185
  type CreateMemoryThreadResponse = StorageThreadType;
138
186
  interface GetMemoryThreadParams {
139
187
  resourceId: string;
140
188
  agentId: string;
141
189
  }
190
+ interface GetNetworkMemoryThreadParams {
191
+ resourceId: string;
192
+ networkId: string;
193
+ }
142
194
  type GetMemoryThreadResponse = StorageThreadType[];
143
195
  interface UpdateMemoryThreadParams {
144
196
  title: string;
145
197
  metadata: Record<string, any>;
146
198
  resourceId: string;
147
199
  }
200
+ interface GetMemoryThreadMessagesParams {
201
+ /**
202
+ * Limit the number of messages to retrieve (default: 40)
203
+ */
204
+ limit?: number;
205
+ }
148
206
  interface GetMemoryThreadMessagesResponse {
149
207
  messages: CoreMessage[];
150
208
  uiMessages: AiMessageType[];
151
209
  }
152
210
  interface GetLogsParams {
153
211
  transportId: string;
212
+ fromDate?: Date;
213
+ toDate?: Date;
214
+ logLevel?: LogLevel;
215
+ filters?: Record<string, string>;
216
+ page?: number;
217
+ perPage?: number;
154
218
  }
155
219
  interface GetLogParams {
156
220
  runId: string;
157
221
  transportId: string;
222
+ fromDate?: Date;
223
+ toDate?: Date;
224
+ logLevel?: LogLevel;
225
+ filters?: Record<string, string>;
226
+ page?: number;
227
+ perPage?: number;
158
228
  }
159
- type GetLogsResponse = BaseLogMessage[];
229
+ type GetLogsResponse = {
230
+ logs: BaseLogMessage[];
231
+ total: number;
232
+ page: number;
233
+ perPage: number;
234
+ hasMore: boolean;
235
+ };
160
236
  type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
161
237
  type SpanStatus = {
162
238
  code: number;
@@ -208,6 +284,7 @@ interface GetTelemetryParams {
208
284
  toDate?: Date;
209
285
  }
210
286
  interface GetNetworkResponse {
287
+ id: string;
211
288
  name: string;
212
289
  instructions: string;
213
290
  agents: Array<{
@@ -221,16 +298,69 @@ interface GetNetworkResponse {
221
298
  };
222
299
  state?: Record<string, any>;
223
300
  }
224
- interface GetMCPServerResponse {
301
+ interface GetVNextNetworkResponse {
225
302
  id: string;
226
303
  name: string;
227
- description?: string;
228
- tools: Array<{
304
+ instructions: string;
305
+ agents: Array<{
306
+ name: string;
307
+ provider: string;
308
+ modelId: string;
309
+ }>;
310
+ routingModel: {
311
+ provider: string;
312
+ modelId: string;
313
+ };
314
+ workflows: Array<{
229
315
  name: string;
230
316
  description: string;
231
- parameters: Record<string, any>;
317
+ inputSchema: string | undefined;
318
+ outputSchema: string | undefined;
319
+ }>;
320
+ tools: Array<{
321
+ id: string;
322
+ description: string;
232
323
  }>;
233
324
  }
325
+ interface GenerateVNextNetworkResponse {
326
+ task: string;
327
+ result: string;
328
+ resourceId: string;
329
+ resourceType: 'none' | 'tool' | 'agent' | 'workflow';
330
+ }
331
+ interface GenerateOrStreamVNextNetworkParams {
332
+ message: string;
333
+ threadId?: string;
334
+ resourceId?: string;
335
+ }
336
+ interface LoopStreamVNextNetworkParams {
337
+ message: string;
338
+ threadId?: string;
339
+ resourceId?: string;
340
+ maxIterations?: number;
341
+ }
342
+ interface LoopVNextNetworkResponse {
343
+ status: 'success';
344
+ result: {
345
+ text: string;
346
+ };
347
+ steps: WorkflowResult<any, any>['steps'];
348
+ }
349
+ interface McpServerListResponse {
350
+ servers: ServerInfo[];
351
+ next: string | null;
352
+ total_count: number;
353
+ }
354
+ interface McpToolInfo {
355
+ id: string;
356
+ name: string;
357
+ description?: string;
358
+ inputSchema: string;
359
+ toolType?: MCPToolType;
360
+ }
361
+ interface McpServerToolListResponse {
362
+ tools: McpToolInfo[];
363
+ }
234
364
 
235
365
  declare class BaseResource {
236
366
  readonly options: ClientOptions;
@@ -263,7 +393,9 @@ declare class AgentVoice extends BaseResource {
263
393
  * @param options - Optional provider-specific options
264
394
  * @returns Promise containing the transcribed text
265
395
  */
266
- listen(audio: Blob, options?: Record<string, any>): Promise<Response>;
396
+ listen(audio: Blob, options?: Record<string, any>): Promise<{
397
+ text: string;
398
+ }>;
267
399
  /**
268
400
  * Get available speakers for the agent's voice provider
269
401
  * @returns Promise containing list of available speakers
@@ -272,6 +404,13 @@ declare class AgentVoice extends BaseResource {
272
404
  voiceId: string;
273
405
  [key: string]: any;
274
406
  }>>;
407
+ /**
408
+ * Get the listener configuration for the agent's voice provider
409
+ * @returns Promise containing a check if the agent has listening capabilities
410
+ */
411
+ getListener(): Promise<{
412
+ enabled: boolean;
413
+ }>;
275
414
  }
276
415
  declare class Agent extends BaseResource {
277
416
  private agentId;
@@ -287,7 +426,19 @@ declare class Agent extends BaseResource {
287
426
  * @param params - Generation parameters including prompt
288
427
  * @returns Promise containing the generated response
289
428
  */
290
- generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T>): Promise<GenerateReturn<T>>;
429
+ generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
430
+ output?: never;
431
+ experimental_output?: never;
432
+ }): Promise<GenerateReturn<T>>;
433
+ generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
434
+ output: T;
435
+ experimental_output?: never;
436
+ }): Promise<GenerateReturn<T>>;
437
+ generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
438
+ output?: never;
439
+ experimental_output: T;
440
+ }): Promise<GenerateReturn<T>>;
441
+ private processChatResponse;
291
442
  /**
292
443
  * Streams a response from the agent
293
444
  * @param params - Stream parameters including prompt
@@ -296,12 +447,26 @@ declare class Agent extends BaseResource {
296
447
  stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
297
448
  processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
298
449
  }>;
450
+ /**
451
+ * Processes the stream response and handles tool calls
452
+ */
453
+ private processStreamResponse;
299
454
  /**
300
455
  * Gets details about a specific tool available to the agent
301
456
  * @param toolId - ID of the tool to retrieve
302
457
  * @returns Promise containing tool details
303
458
  */
304
459
  getTool(toolId: string): Promise<GetToolResponse>;
460
+ /**
461
+ * Executes a tool for the agent
462
+ * @param toolId - ID of the tool to execute
463
+ * @param params - Parameters required for tool execution
464
+ * @returns Promise containing the tool execution results
465
+ */
466
+ executeTool(toolId: string, params: {
467
+ data: any;
468
+ runtimeContext?: RuntimeContext;
469
+ }): Promise<any>;
305
470
  /**
306
471
  * Retrieves evaluation results for the agent
307
472
  * @returns Promise containing agent evaluations
@@ -362,9 +527,10 @@ declare class MemoryThread extends BaseResource {
362
527
  }>;
363
528
  /**
364
529
  * Retrieves messages associated with the thread
530
+ * @param params - Optional parameters including limit for number of messages to retrieve
365
531
  * @returns Promise containing thread messages and UI messages
366
532
  */
367
- getMessages(): Promise<GetMemoryThreadMessagesResponse>;
533
+ getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
368
534
  }
369
535
 
370
536
  declare class Vector extends BaseResource {
@@ -413,29 +579,22 @@ declare class Vector extends BaseResource {
413
579
  query(params: QueryVectorParams): Promise<QueryVectorResponse>;
414
580
  }
415
581
 
416
- declare class Workflow extends BaseResource {
582
+ declare class LegacyWorkflow extends BaseResource {
417
583
  private workflowId;
418
584
  constructor(options: ClientOptions, workflowId: string);
419
585
  /**
420
- * Retrieves details about the workflow
421
- * @returns Promise containing workflow details including steps and graphs
586
+ * Retrieves details about the legacy workflow
587
+ * @returns Promise containing legacy workflow details including steps and graphs
422
588
  */
423
- details(): Promise<GetWorkflowResponse>;
589
+ details(): Promise<GetLegacyWorkflowResponse>;
424
590
  /**
425
- * Retrieves all runs for a workflow
591
+ * Retrieves all runs for a legacy workflow
426
592
  * @param params - Parameters for filtering runs
427
- * @returns Promise containing workflow runs array
428
- */
429
- runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
430
- /**
431
- * @deprecated Use `startAsync` instead
432
- * Executes the workflow with the provided parameters
433
- * @param params - Parameters required for workflow execution
434
- * @returns Promise containing the workflow execution results
593
+ * @returns Promise containing legacy workflow runs array
435
594
  */
436
- execute(params: Record<string, any>): Promise<WorkflowRunResult>;
595
+ runs(params?: GetWorkflowRunsParams): Promise<GetLegacyWorkflowRunsResponse>;
437
596
  /**
438
- * Creates a new workflow run
597
+ * Creates a new legacy workflow run
439
598
  * @returns Promise containing the generated run ID
440
599
  */
441
600
  createRun(params?: {
@@ -444,7 +603,7 @@ declare class Workflow extends BaseResource {
444
603
  runId: string;
445
604
  }>;
446
605
  /**
447
- * Starts a workflow run synchronously without waiting for the workflow to complete
606
+ * Starts a legacy workflow run synchronously without waiting for the workflow to complete
448
607
  * @param params - Object containing the runId and triggerData
449
608
  * @returns Promise containing success message
450
609
  */
@@ -455,11 +614,11 @@ declare class Workflow extends BaseResource {
455
614
  message: string;
456
615
  }>;
457
616
  /**
458
- * Resumes a suspended workflow step synchronously without waiting for the workflow to complete
617
+ * Resumes a suspended legacy workflow step synchronously without waiting for the workflow to complete
459
618
  * @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
619
+ * @param runId - ID of the legacy workflow run
620
+ * @param context - Context to resume the legacy workflow with
621
+ * @returns Promise containing the legacy workflow resume results
463
622
  */
464
623
  resume({ stepId, runId, context, }: {
465
624
  stepId: string;
@@ -476,9 +635,9 @@ declare class Workflow extends BaseResource {
476
635
  startAsync(params: {
477
636
  runId?: string;
478
637
  triggerData: Record<string, any>;
479
- }): Promise<WorkflowRunResult>;
638
+ }): Promise<LegacyWorkflowRunResult>;
480
639
  /**
481
- * Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
640
+ * Resumes a suspended legacy workflow step asynchronously and returns a promise that resolves when the workflow is complete
482
641
  * @param params - Object containing the runId, stepId, and context
483
642
  * @returns Promise containing the workflow resume results
484
643
  */
@@ -486,7 +645,7 @@ declare class Workflow extends BaseResource {
486
645
  runId: string;
487
646
  stepId: string;
488
647
  context: Record<string, any>;
489
- }): Promise<WorkflowRunResult>;
648
+ }): Promise<LegacyWorkflowRunResult>;
490
649
  /**
491
650
  * Creates an async generator that processes a readable stream and yields records
492
651
  * separated by the Record Separator character (\x1E)
@@ -496,13 +655,13 @@ declare class Workflow extends BaseResource {
496
655
  */
497
656
  private streamProcessor;
498
657
  /**
499
- * Watches workflow transitions in real-time
658
+ * Watches legacy workflow transitions in real-time
500
659
  * @param runId - Optional run ID to filter the watch stream
501
- * @returns AsyncGenerator that yields parsed records from the workflow watch stream
660
+ * @returns AsyncGenerator that yields parsed records from the legacy workflow watch stream
502
661
  */
503
662
  watch({ runId }: {
504
663
  runId?: string;
505
- }, onRecord: (record: WorkflowRunResult) => void): Promise<void>;
664
+ }, onRecord: (record: LegacyWorkflowRunResult) => void): Promise<void>;
506
665
  }
507
666
 
508
667
  declare class Tool extends BaseResource {
@@ -521,14 +680,15 @@ declare class Tool extends BaseResource {
521
680
  execute(params: {
522
681
  data: any;
523
682
  runId?: string;
683
+ runtimeContext?: RuntimeContext | Record<string, any>;
524
684
  }): Promise<any>;
525
685
  }
526
686
 
527
- declare class VNextWorkflow extends BaseResource {
687
+ declare class Workflow extends BaseResource {
528
688
  private workflowId;
529
689
  constructor(options: ClientOptions, workflowId: string);
530
690
  /**
531
- * Creates an async generator that processes a readable stream and yields vNext workflow records
691
+ * Creates an async generator that processes a readable stream and yields workflow records
532
692
  * separated by the Record Separator character (\x1E)
533
693
  *
534
694
  * @param stream - The readable stream to process
@@ -536,18 +696,50 @@ declare class VNextWorkflow extends BaseResource {
536
696
  */
537
697
  private streamProcessor;
538
698
  /**
539
- * Retrieves details about the vNext workflow
540
- * @returns Promise containing vNext workflow details including steps and graphs
699
+ * Retrieves details about the workflow
700
+ * @returns Promise containing workflow details including steps and graphs
541
701
  */
542
- details(): Promise<GetVNextWorkflowResponse>;
702
+ details(): Promise<GetWorkflowResponse>;
543
703
  /**
544
- * Retrieves all runs for a vNext workflow
704
+ * Retrieves all runs for a workflow
545
705
  * @param params - Parameters for filtering runs
546
- * @returns Promise containing vNext workflow runs array
706
+ * @returns Promise containing workflow runs array
547
707
  */
548
708
  runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
549
709
  /**
550
- * Creates a new vNext workflow run
710
+ * Retrieves a specific workflow run by its ID
711
+ * @param runId - The ID of the workflow run to retrieve
712
+ * @returns Promise containing the workflow run details
713
+ */
714
+ runById(runId: string): Promise<GetWorkflowRunByIdResponse>;
715
+ /**
716
+ * Retrieves the execution result for a specific workflow run by its ID
717
+ * @param runId - The ID of the workflow run to retrieve the execution result for
718
+ * @returns Promise containing the workflow run execution result
719
+ */
720
+ runExecutionResult(runId: string): Promise<GetWorkflowRunExecutionResultResponse>;
721
+ /**
722
+ * Cancels a specific workflow run by its ID
723
+ * @param runId - The ID of the workflow run to cancel
724
+ * @returns Promise containing a success message
725
+ */
726
+ cancelRun(runId: string): Promise<{
727
+ message: string;
728
+ }>;
729
+ /**
730
+ * Sends an event to a specific workflow run by its ID
731
+ * @param params - Object containing the runId, event and data
732
+ * @returns Promise containing a success message
733
+ */
734
+ sendRunEvent(params: {
735
+ runId: string;
736
+ event: string;
737
+ data: unknown;
738
+ }): Promise<{
739
+ message: string;
740
+ }>;
741
+ /**
742
+ * Creates a new workflow run
551
743
  * @param params - Optional object containing the optional runId
552
744
  * @returns Promise containing the runId of the created run
553
745
  */
@@ -557,72 +749,212 @@ declare class VNextWorkflow extends BaseResource {
557
749
  runId: string;
558
750
  }>;
559
751
  /**
560
- * Starts a vNext workflow run synchronously without waiting for the workflow to complete
752
+ * Starts a workflow run synchronously without waiting for the workflow to complete
561
753
  * @param params - Object containing the runId, inputData and runtimeContext
562
754
  * @returns Promise containing success message
563
755
  */
564
756
  start(params: {
565
757
  runId: string;
566
758
  inputData: Record<string, any>;
567
- runtimeContext?: RuntimeContext;
759
+ runtimeContext?: RuntimeContext | Record<string, any>;
568
760
  }): Promise<{
569
761
  message: string;
570
762
  }>;
571
763
  /**
572
- * Resumes a suspended vNext workflow step synchronously without waiting for the vNext workflow to complete
764
+ * Resumes a suspended workflow step synchronously without waiting for the workflow to complete
573
765
  * @param params - Object containing the runId, step, resumeData and runtimeContext
574
766
  * @returns Promise containing success message
575
767
  */
576
- resume({ step, runId, resumeData, runtimeContext, }: {
768
+ resume({ step, runId, resumeData, ...rest }: {
577
769
  step: string | string[];
578
770
  runId: string;
579
771
  resumeData?: Record<string, any>;
580
- runtimeContext?: RuntimeContext;
772
+ runtimeContext?: RuntimeContext | Record<string, any>;
581
773
  }): Promise<{
582
774
  message: string;
583
775
  }>;
584
776
  /**
585
- * Starts a vNext workflow run asynchronously and returns a promise that resolves when the vNext workflow is complete
777
+ * Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
586
778
  * @param params - Object containing the optional runId, inputData and runtimeContext
587
- * @returns Promise containing the vNext workflow execution results
779
+ * @returns Promise containing the workflow execution results
588
780
  */
589
781
  startAsync(params: {
782
+ runId?: string;
783
+ inputData: Record<string, any>;
784
+ runtimeContext?: RuntimeContext | Record<string, any>;
785
+ }): Promise<WorkflowRunResult>;
786
+ /**
787
+ * Starts a workflow run and returns a stream
788
+ * @param params - Object containing the optional runId, inputData and runtimeContext
789
+ * @returns Promise containing the workflow execution results
790
+ */
791
+ stream(params: {
590
792
  runId?: string;
591
793
  inputData: Record<string, any>;
592
794
  runtimeContext?: RuntimeContext;
593
- }): Promise<VNextWorkflowRunResult>;
795
+ }): Promise<stream_web.ReadableStream<{
796
+ type: string;
797
+ payload: any;
798
+ }>>;
594
799
  /**
595
- * Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
800
+ * Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
596
801
  * @param params - Object containing the runId, step, resumeData and runtimeContext
597
- * @returns Promise containing the vNext workflow resume results
802
+ * @returns Promise containing the workflow resume results
598
803
  */
599
804
  resumeAsync(params: {
600
805
  runId: string;
601
806
  step: string | string[];
602
807
  resumeData?: Record<string, any>;
603
- runtimeContext?: RuntimeContext;
604
- }): Promise<VNextWorkflowRunResult>;
808
+ runtimeContext?: RuntimeContext | Record<string, any>;
809
+ }): Promise<WorkflowRunResult>;
605
810
  /**
606
- * Watches vNext workflow transitions in real-time
811
+ * Watches workflow transitions in real-time
607
812
  * @param runId - Optional run ID to filter the watch stream
608
- * @returns AsyncGenerator that yields parsed records from the vNext workflow watch stream
813
+ * @returns AsyncGenerator that yields parsed records from the workflow watch stream
609
814
  */
610
815
  watch({ runId }: {
611
816
  runId?: string;
612
- }, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
817
+ }, onRecord: (record: WorkflowWatchResult) => void): Promise<void>;
818
+ /**
819
+ * Creates a new ReadableStream from an iterable or async iterable of objects,
820
+ * serializing each as JSON and separating them with the record separator (\x1E).
821
+ *
822
+ * @param records - An iterable or async iterable of objects to stream
823
+ * @returns A ReadableStream emitting the records as JSON strings separated by the record separator
824
+ */
825
+ static createRecordStream(records: Iterable<any> | AsyncIterable<any>): ReadableStream;
826
+ }
827
+
828
+ /**
829
+ * Class for interacting with an agent via the A2A protocol
830
+ */
831
+ declare class A2A extends BaseResource {
832
+ private agentId;
833
+ constructor(options: ClientOptions, agentId: string);
834
+ /**
835
+ * Get the agent card with metadata about the agent
836
+ * @returns Promise containing the agent card information
837
+ */
838
+ getCard(): Promise<AgentCard>;
839
+ /**
840
+ * Send a message to the agent and get a response
841
+ * @param params - Parameters for the task
842
+ * @returns Promise containing the task response
843
+ */
844
+ sendMessage(params: TaskSendParams): Promise<{
845
+ task: Task;
846
+ }>;
847
+ /**
848
+ * Get the status and result of a task
849
+ * @param params - Parameters for querying the task
850
+ * @returns Promise containing the task response
851
+ */
852
+ getTask(params: TaskQueryParams): Promise<Task>;
853
+ /**
854
+ * Cancel a running task
855
+ * @param params - Parameters identifying the task to cancel
856
+ * @returns Promise containing the task response
857
+ */
858
+ cancelTask(params: TaskIdParams): Promise<{
859
+ task: Task;
860
+ }>;
861
+ /**
862
+ * Send a message and subscribe to streaming updates (not fully implemented)
863
+ * @param params - Parameters for the task
864
+ * @returns Promise containing the task response
865
+ */
866
+ sendAndSubscribe(params: TaskSendParams): Promise<Response>;
613
867
  }
614
868
 
615
869
  /**
616
- * MCP Server resource for interacting with MCP servers
870
+ * Represents a specific tool available on a specific MCP server.
871
+ * Provides methods to get details and execute the tool.
617
872
  */
618
- declare class MCPServer extends BaseResource {
873
+ declare class MCPTool extends BaseResource {
619
874
  private serverId;
620
- constructor(options: ClientOptions, serverId: string);
875
+ private toolId;
876
+ constructor(options: ClientOptions, serverId: string, toolId: string);
877
+ /**
878
+ * Retrieves details about this specific tool from the MCP server.
879
+ * @returns Promise containing the tool's information (name, description, schema).
880
+ */
881
+ details(): Promise<McpToolInfo>;
882
+ /**
883
+ * Executes this specific tool on the MCP server.
884
+ * @param params - Parameters for tool execution, including data/args and optional runtimeContext.
885
+ * @returns Promise containing the result of the tool execution.
886
+ */
887
+ execute(params: {
888
+ data?: any;
889
+ runtimeContext?: RuntimeContext;
890
+ }): Promise<any>;
891
+ }
892
+
893
+ declare class VNextNetwork extends BaseResource {
894
+ private networkId;
895
+ constructor(options: ClientOptions, networkId: string);
896
+ /**
897
+ * Retrieves details about the network
898
+ * @returns Promise containing vNext network details
899
+ */
900
+ details(): Promise<GetVNextNetworkResponse>;
901
+ /**
902
+ * Generates a response from the v-next network
903
+ * @param params - Generation parameters including message
904
+ * @returns Promise containing the generated response
905
+ */
906
+ generate(params: GenerateOrStreamVNextNetworkParams): Promise<GenerateVNextNetworkResponse>;
907
+ /**
908
+ * Generates a response from the v-next network using multiple primitives
909
+ * @param params - Generation parameters including message
910
+ * @returns Promise containing the generated response
911
+ */
912
+ loop(params: {
913
+ message: string;
914
+ }): Promise<LoopVNextNetworkResponse>;
915
+ private streamProcessor;
916
+ /**
917
+ * Streams a response from the v-next network
918
+ * @param params - Stream parameters including message
919
+ * @returns Promise containing the results
920
+ */
921
+ stream(params: GenerateOrStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
621
922
  /**
622
- * Get details about the MCP server
623
- * @returns Promise containing server details
923
+ * Streams a response from the v-next network loop
924
+ * @param params - Stream parameters including message
925
+ * @returns Promise containing the results
624
926
  */
625
- details(): Promise<GetMCPServerResponse>;
927
+ loopStream(params: LoopStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
928
+ }
929
+
930
+ declare class NetworkMemoryThread extends BaseResource {
931
+ private threadId;
932
+ private networkId;
933
+ constructor(options: ClientOptions, threadId: string, networkId: string);
934
+ /**
935
+ * Retrieves the memory thread details
936
+ * @returns Promise containing thread details including title and metadata
937
+ */
938
+ get(): Promise<StorageThreadType>;
939
+ /**
940
+ * Updates the memory thread properties
941
+ * @param params - Update parameters including title and metadata
942
+ * @returns Promise containing updated thread details
943
+ */
944
+ update(params: UpdateMemoryThreadParams): Promise<StorageThreadType>;
945
+ /**
946
+ * Deletes the memory thread
947
+ * @returns Promise containing deletion result
948
+ */
949
+ delete(): Promise<{
950
+ result: string;
951
+ }>;
952
+ /**
953
+ * Retrieves messages associated with the thread
954
+ * @param params - Optional parameters including limit for number of messages to retrieve
955
+ * @returns Promise containing thread messages and UI messages
956
+ */
957
+ getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
626
958
  }
627
959
 
628
960
  declare class MastraClient extends BaseResource {
@@ -632,6 +964,9 @@ declare class MastraClient extends BaseResource {
632
964
  * @returns Promise containing map of agent IDs to agent details
633
965
  */
634
966
  getAgents(): Promise<Record<string, GetAgentResponse>>;
967
+ getAGUI({ resourceId }: {
968
+ resourceId: string;
969
+ }): Promise<Record<string, AbstractAgent>>;
635
970
  /**
636
971
  * Gets an agent instance by ID
637
972
  * @param agentId - ID of the agent to retrieve
@@ -669,6 +1004,37 @@ declare class MastraClient extends BaseResource {
669
1004
  getMemoryStatus(agentId: string): Promise<{
670
1005
  result: boolean;
671
1006
  }>;
1007
+ /**
1008
+ * Retrieves memory threads for a resource
1009
+ * @param params - Parameters containing the resource ID
1010
+ * @returns Promise containing array of memory threads
1011
+ */
1012
+ getNetworkMemoryThreads(params: GetNetworkMemoryThreadParams): Promise<GetMemoryThreadResponse>;
1013
+ /**
1014
+ * Creates a new memory thread
1015
+ * @param params - Parameters for creating the memory thread
1016
+ * @returns Promise containing the created memory thread
1017
+ */
1018
+ createNetworkMemoryThread(params: CreateNetworkMemoryThreadParams): Promise<CreateMemoryThreadResponse>;
1019
+ /**
1020
+ * Gets a memory thread instance by ID
1021
+ * @param threadId - ID of the memory thread to retrieve
1022
+ * @returns MemoryThread instance
1023
+ */
1024
+ getNetworkMemoryThread(threadId: string, networkId: string): NetworkMemoryThread;
1025
+ /**
1026
+ * Saves messages to memory
1027
+ * @param params - Parameters containing messages to save
1028
+ * @returns Promise containing the saved messages
1029
+ */
1030
+ saveNetworkMessageToMemory(params: SaveNetworkMessageToMemoryParams): Promise<SaveMessageToMemoryResponse>;
1031
+ /**
1032
+ * Gets the status of the memory system
1033
+ * @returns Promise containing memory system status
1034
+ */
1035
+ getNetworkMemoryStatus(networkId: string): Promise<{
1036
+ result: boolean;
1037
+ }>;
672
1038
  /**
673
1039
  * Retrieves all available tools
674
1040
  * @returns Promise containing map of tool IDs to tool details
@@ -680,6 +1046,17 @@ declare class MastraClient extends BaseResource {
680
1046
  * @returns Tool instance
681
1047
  */
682
1048
  getTool(toolId: string): Tool;
1049
+ /**
1050
+ * Retrieves all available legacy workflows
1051
+ * @returns Promise containing map of legacy workflow IDs to legacy workflow details
1052
+ */
1053
+ getLegacyWorkflows(): Promise<Record<string, GetLegacyWorkflowResponse>>;
1054
+ /**
1055
+ * Gets a legacy workflow instance by ID
1056
+ * @param workflowId - ID of the legacy workflow to retrieve
1057
+ * @returns Legacy Workflow instance
1058
+ */
1059
+ getLegacyWorkflow(workflowId: string): LegacyWorkflow;
683
1060
  /**
684
1061
  * Retrieves all available workflows
685
1062
  * @returns Promise containing map of workflow IDs to workflow details
@@ -691,17 +1068,6 @@ declare class MastraClient extends BaseResource {
691
1068
  * @returns Workflow instance
692
1069
  */
693
1070
  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
1071
  /**
706
1072
  * Gets a vector instance by name
707
1073
  * @param vectorName - Name of the vector to retrieve
@@ -737,7 +1103,12 @@ declare class MastraClient extends BaseResource {
737
1103
  * Retrieves all available networks
738
1104
  * @returns Promise containing map of network IDs to network details
739
1105
  */
740
- getNetworks(): Promise<Record<string, GetNetworkResponse>>;
1106
+ getNetworks(): Promise<Array<GetNetworkResponse>>;
1107
+ /**
1108
+ * Retrieves all available vNext networks
1109
+ * @returns Promise containing map of vNext network IDs to vNext network details
1110
+ */
1111
+ getVNextNetworks(): Promise<Array<GetVNextNetworkResponse>>;
741
1112
  /**
742
1113
  * Gets a network instance by ID
743
1114
  * @param networkId - ID of the network to retrieve
@@ -745,16 +1116,49 @@ declare class MastraClient extends BaseResource {
745
1116
  */
746
1117
  getNetwork(networkId: string): Network;
747
1118
  /**
748
- * Retrieves all available MCP servers
749
- * @returns Promise containing map of MCP server IDs to server details
1119
+ * Gets a vNext network instance by ID
1120
+ * @param networkId - ID of the vNext network to retrieve
1121
+ * @returns vNext Network instance
1122
+ */
1123
+ getVNextNetwork(networkId: string): VNextNetwork;
1124
+ /**
1125
+ * Retrieves a list of available MCP servers.
1126
+ * @param params - Optional parameters for pagination (limit, offset).
1127
+ * @returns Promise containing the list of MCP servers and pagination info.
1128
+ */
1129
+ getMcpServers(params?: {
1130
+ limit?: number;
1131
+ offset?: number;
1132
+ }): Promise<McpServerListResponse>;
1133
+ /**
1134
+ * Retrieves detailed information for a specific MCP server.
1135
+ * @param serverId - The ID of the MCP server to retrieve.
1136
+ * @param params - Optional parameters, e.g., specific version.
1137
+ * @returns Promise containing the detailed MCP server information.
1138
+ */
1139
+ getMcpServerDetails(serverId: string, params?: {
1140
+ version?: string;
1141
+ }): Promise<ServerDetailInfo>;
1142
+ /**
1143
+ * Retrieves a list of tools for a specific MCP server.
1144
+ * @param serverId - The ID of the MCP server.
1145
+ * @returns Promise containing the list of tools.
1146
+ */
1147
+ getMcpServerTools(serverId: string): Promise<McpServerToolListResponse>;
1148
+ /**
1149
+ * Gets an MCPTool resource instance for a specific tool on an MCP server.
1150
+ * This instance can then be used to fetch details or execute the tool.
1151
+ * @param serverId - The ID of the MCP server.
1152
+ * @param toolId - The ID of the tool.
1153
+ * @returns MCPTool instance.
750
1154
  */
751
- getMCPServers(): Promise<Record<string, GetMCPServerResponse>>;
1155
+ getMcpServerTool(serverId: string, toolId: string): MCPTool;
752
1156
  /**
753
- * Gets an MCP server instance by ID
754
- * @param serverId - ID of the MCP server to retrieve
755
- * @returns MCPServer instance
1157
+ * Gets an A2A client for interacting with an agent via the A2A protocol
1158
+ * @param agentId - ID of the agent to interact with
1159
+ * @returns A2A client instance
756
1160
  */
757
- getMCPServer(serverId: string): MCPServer;
1161
+ getA2A(agentId: string): A2A;
758
1162
  }
759
1163
 
760
- export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMCPServerResponse, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
1164
+ export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type CreateNetworkMemoryThreadParams, type GenerateOrStreamVNextNetworkParams, type GenerateParams, type GenerateVNextNetworkResponse, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkMemoryThreadParams, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextNetworkResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunByIdResponse, type GetWorkflowRunExecutionResultResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, type LoopStreamVNextNetworkParams, type LoopVNextNetworkResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type SaveNetworkMessageToMemoryParams, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };