@mastra/client-js 0.0.0-switch-to-core-20250424015131 → 0.0.0-tool-call-parts-20250630193309

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,8 +1,16 @@
1
- import { CoreMessage, AiMessageType, StorageThreadType, MessageType, StepAction, StepGraph, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
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, WorkflowRun, 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
- import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
7
+ import { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
8
+ import { LogLevel, BaseLogMessage } from '@mastra/core/logger';
9
+ import { RuntimeContext } from '@mastra/core/runtime-context';
10
+ import { Workflow as Workflow$1, 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';
6
14
 
7
15
  interface ClientOptions {
8
16
  /** Base URL for API requests */
@@ -23,21 +31,40 @@ interface RequestOptions {
23
31
  stream?: boolean;
24
32
  signal?: AbortSignal;
25
33
  }
34
+ type WithoutMethods<T> = {
35
+ [K in keyof T as T[K] extends (...args: any[]) => any ? never : T[K] extends {
36
+ (): any;
37
+ } ? never : T[K] extends undefined | ((...args: any[]) => any) ? never : K]: T[K];
38
+ };
26
39
  interface GetAgentResponse {
27
40
  name: string;
28
41
  instructions: string;
29
42
  tools: Record<string, GetToolResponse>;
43
+ workflows: Record<string, GetWorkflowResponse>;
30
44
  provider: string;
31
45
  modelId: string;
46
+ defaultGenerateOptions: WithoutMethods<AgentGenerateOptions>;
47
+ defaultStreamOptions: WithoutMethods<AgentStreamOptions>;
32
48
  }
33
49
  type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
34
50
  messages: string | string[] | CoreMessage[] | AiMessageType[];
35
- } & 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'>>;
36
56
  type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
37
57
  messages: string | string[] | CoreMessage[] | AiMessageType[];
38
- } & 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'>>;
39
63
  interface GetEvalsByAgentIdResponse extends GetAgentResponse {
40
64
  evals: any[];
65
+ instructions: string;
66
+ name: string;
67
+ id: string;
41
68
  }
42
69
  interface GetToolResponse {
43
70
  id: string;
@@ -45,7 +72,7 @@ interface GetToolResponse {
45
72
  inputSchema: string;
46
73
  outputSchema: string;
47
74
  }
48
- interface GetWorkflowResponse {
75
+ interface GetLegacyWorkflowResponse {
49
76
  name: string;
50
77
  triggerSchema: string;
51
78
  steps: Record<string, StepAction<any, any, any, any>>;
@@ -53,16 +80,48 @@ interface GetWorkflowResponse {
53
80
  stepSubscriberGraph: Record<string, StepGraph>;
54
81
  workflowId?: string;
55
82
  }
56
- type WorkflowRunResult = {
83
+ interface GetWorkflowRunsParams {
84
+ fromDate?: Date;
85
+ toDate?: Date;
86
+ limit?: number;
87
+ offset?: number;
88
+ resourceId?: string;
89
+ }
90
+ type GetLegacyWorkflowRunsResponse = LegacyWorkflowRuns;
91
+ type GetWorkflowRunsResponse = WorkflowRuns;
92
+ type GetWorkflowRunByIdResponse = WorkflowRun;
93
+ type GetWorkflowRunExecutionResultResponse = WatchEvent['payload']['workflowState'];
94
+ type LegacyWorkflowRunResult = {
57
95
  activePaths: Record<string, {
58
96
  status: string;
59
97
  suspendPayload?: any;
60
98
  stepPath: string[];
61
99
  }>;
62
- results: WorkflowRunResult$1<any, any, any>['results'];
100
+ results: LegacyWorkflowRunResult$1<any, any, any>['results'];
63
101
  timestamp: number;
64
102
  runId: string;
65
103
  };
104
+ interface GetWorkflowResponse {
105
+ name: string;
106
+ description?: string;
107
+ steps: {
108
+ [key: string]: {
109
+ id: string;
110
+ description: string;
111
+ inputSchema: string;
112
+ outputSchema: string;
113
+ resumeSchema: string;
114
+ suspendSchema: string;
115
+ };
116
+ };
117
+ stepGraph: Workflow$1['serializedStepGraph'];
118
+ inputSchema: string;
119
+ outputSchema: string;
120
+ }
121
+ type WorkflowWatchResult = WatchEvent & {
122
+ runId: string;
123
+ };
124
+ type WorkflowRunResult = WorkflowResult<any, any>;
66
125
  interface UpsertVectorParams {
67
126
  indexName: string;
68
127
  vectors: number[][];
@@ -90,40 +149,79 @@ interface GetVectorIndexResponse {
90
149
  count: number;
91
150
  }
92
151
  interface SaveMessageToMemoryParams {
93
- messages: MessageType[];
152
+ messages: MastraMessageV1[];
94
153
  agentId: string;
95
154
  }
96
- type SaveMessageToMemoryResponse = MessageType[];
155
+ interface SaveNetworkMessageToMemoryParams {
156
+ messages: MastraMessageV1[];
157
+ networkId: string;
158
+ }
159
+ type SaveMessageToMemoryResponse = MastraMessageV1[];
97
160
  interface CreateMemoryThreadParams {
98
- title: string;
99
- metadata: Record<string, any>;
161
+ title?: string;
162
+ metadata?: Record<string, any>;
100
163
  resourceId: string;
101
- threadId: string;
164
+ threadId?: string;
102
165
  agentId: string;
103
166
  }
167
+ interface CreateNetworkMemoryThreadParams {
168
+ title?: string;
169
+ metadata?: Record<string, any>;
170
+ resourceId: string;
171
+ threadId?: string;
172
+ networkId: string;
173
+ }
104
174
  type CreateMemoryThreadResponse = StorageThreadType;
105
175
  interface GetMemoryThreadParams {
106
176
  resourceId: string;
107
177
  agentId: string;
108
178
  }
179
+ interface GetNetworkMemoryThreadParams {
180
+ resourceId: string;
181
+ networkId: string;
182
+ }
109
183
  type GetMemoryThreadResponse = StorageThreadType[];
110
184
  interface UpdateMemoryThreadParams {
111
185
  title: string;
112
186
  metadata: Record<string, any>;
113
187
  resourceId: string;
114
188
  }
189
+ interface GetMemoryThreadMessagesParams {
190
+ /**
191
+ * Limit the number of messages to retrieve (default: 40)
192
+ */
193
+ limit?: number;
194
+ }
115
195
  interface GetMemoryThreadMessagesResponse {
116
196
  messages: CoreMessage[];
117
197
  uiMessages: AiMessageType[];
118
198
  }
119
199
  interface GetLogsParams {
120
200
  transportId: string;
201
+ fromDate?: Date;
202
+ toDate?: Date;
203
+ logLevel?: LogLevel;
204
+ filters?: Record<string, string>;
205
+ page?: number;
206
+ perPage?: number;
121
207
  }
122
208
  interface GetLogParams {
123
209
  runId: string;
124
210
  transportId: string;
211
+ fromDate?: Date;
212
+ toDate?: Date;
213
+ logLevel?: LogLevel;
214
+ filters?: Record<string, string>;
215
+ page?: number;
216
+ perPage?: number;
125
217
  }
126
- type GetLogsResponse = BaseLogMessage[];
218
+ type GetLogsResponse = {
219
+ logs: BaseLogMessage[];
220
+ total: number;
221
+ page: number;
222
+ perPage: number;
223
+ hasMore: boolean;
224
+ };
127
225
  type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
128
226
  type SpanStatus = {
129
227
  code: number;
@@ -171,8 +269,11 @@ interface GetTelemetryParams {
171
269
  page?: number;
172
270
  perPage?: number;
173
271
  attribute?: Record<string, string>;
272
+ fromDate?: Date;
273
+ toDate?: Date;
174
274
  }
175
275
  interface GetNetworkResponse {
276
+ id: string;
176
277
  name: string;
177
278
  instructions: string;
178
279
  agents: Array<{
@@ -186,6 +287,69 @@ interface GetNetworkResponse {
186
287
  };
187
288
  state?: Record<string, any>;
188
289
  }
290
+ interface GetVNextNetworkResponse {
291
+ id: string;
292
+ name: string;
293
+ instructions: string;
294
+ agents: Array<{
295
+ name: string;
296
+ provider: string;
297
+ modelId: string;
298
+ }>;
299
+ routingModel: {
300
+ provider: string;
301
+ modelId: string;
302
+ };
303
+ workflows: Array<{
304
+ name: string;
305
+ description: string;
306
+ inputSchema: string | undefined;
307
+ outputSchema: string | undefined;
308
+ }>;
309
+ tools: Array<{
310
+ id: string;
311
+ description: string;
312
+ }>;
313
+ }
314
+ interface GenerateVNextNetworkResponse {
315
+ task: string;
316
+ result: string;
317
+ resourceId: string;
318
+ resourceType: 'none' | 'tool' | 'agent' | 'workflow';
319
+ }
320
+ interface GenerateOrStreamVNextNetworkParams {
321
+ message: string;
322
+ threadId?: string;
323
+ resourceId?: string;
324
+ }
325
+ interface LoopStreamVNextNetworkParams {
326
+ message: string;
327
+ threadId?: string;
328
+ resourceId?: string;
329
+ maxIterations?: number;
330
+ }
331
+ interface LoopVNextNetworkResponse {
332
+ status: 'success';
333
+ result: {
334
+ text: string;
335
+ };
336
+ steps: WorkflowResult<any, any>['steps'];
337
+ }
338
+ interface McpServerListResponse {
339
+ servers: ServerInfo[];
340
+ next: string | null;
341
+ total_count: number;
342
+ }
343
+ interface McpToolInfo {
344
+ id: string;
345
+ name: string;
346
+ description?: string;
347
+ inputSchema: string;
348
+ toolType?: MCPToolType;
349
+ }
350
+ interface McpServerToolListResponse {
351
+ tools: McpToolInfo[];
352
+ }
189
353
 
190
354
  declare class BaseResource {
191
355
  readonly options: ClientOptions;
@@ -218,7 +382,9 @@ declare class AgentVoice extends BaseResource {
218
382
  * @param options - Optional provider-specific options
219
383
  * @returns Promise containing the transcribed text
220
384
  */
221
- listen(audio: Blob, options?: Record<string, any>): Promise<Response>;
385
+ listen(audio: Blob, options?: Record<string, any>): Promise<{
386
+ text: string;
387
+ }>;
222
388
  /**
223
389
  * Get available speakers for the agent's voice provider
224
390
  * @returns Promise containing list of available speakers
@@ -227,6 +393,13 @@ declare class AgentVoice extends BaseResource {
227
393
  voiceId: string;
228
394
  [key: string]: any;
229
395
  }>>;
396
+ /**
397
+ * Get the listener configuration for the agent's voice provider
398
+ * @returns Promise containing a check if the agent has listening capabilities
399
+ */
400
+ getListener(): Promise<{
401
+ enabled: boolean;
402
+ }>;
230
403
  }
231
404
  declare class Agent extends BaseResource {
232
405
  private agentId;
@@ -242,7 +415,19 @@ declare class Agent extends BaseResource {
242
415
  * @param params - Generation parameters including prompt
243
416
  * @returns Promise containing the generated response
244
417
  */
245
- generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T>): Promise<GenerateReturn<T>>;
418
+ generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
419
+ output?: never;
420
+ experimental_output?: never;
421
+ }): Promise<GenerateReturn<T>>;
422
+ generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
423
+ output: T;
424
+ experimental_output?: never;
425
+ }): Promise<GenerateReturn<T>>;
426
+ generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
427
+ output?: never;
428
+ experimental_output: T;
429
+ }): Promise<GenerateReturn<T>>;
430
+ private processChatResponse;
246
431
  /**
247
432
  * Streams a response from the agent
248
433
  * @param params - Stream parameters including prompt
@@ -251,12 +436,26 @@ declare class Agent extends BaseResource {
251
436
  stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
252
437
  processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
253
438
  }>;
439
+ /**
440
+ * Processes the stream response and handles tool calls
441
+ */
442
+ private processStreamResponse;
254
443
  /**
255
444
  * Gets details about a specific tool available to the agent
256
445
  * @param toolId - ID of the tool to retrieve
257
446
  * @returns Promise containing tool details
258
447
  */
259
448
  getTool(toolId: string): Promise<GetToolResponse>;
449
+ /**
450
+ * Executes a tool for the agent
451
+ * @param toolId - ID of the tool to execute
452
+ * @param params - Parameters required for tool execution
453
+ * @returns Promise containing the tool execution results
454
+ */
455
+ executeTool(toolId: string, params: {
456
+ data: any;
457
+ runtimeContext?: RuntimeContext;
458
+ }): Promise<any>;
260
459
  /**
261
460
  * Retrieves evaluation results for the agent
262
461
  * @returns Promise containing agent evaluations
@@ -317,9 +516,10 @@ declare class MemoryThread extends BaseResource {
317
516
  }>;
318
517
  /**
319
518
  * Retrieves messages associated with the thread
519
+ * @param params - Optional parameters including limit for number of messages to retrieve
320
520
  * @returns Promise containing thread messages and UI messages
321
521
  */
322
- getMessages(): Promise<GetMemoryThreadMessagesResponse>;
522
+ getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
323
523
  }
324
524
 
325
525
  declare class Vector extends BaseResource {
@@ -368,23 +568,22 @@ declare class Vector extends BaseResource {
368
568
  query(params: QueryVectorParams): Promise<QueryVectorResponse>;
369
569
  }
370
570
 
371
- declare class Workflow extends BaseResource {
571
+ declare class LegacyWorkflow extends BaseResource {
372
572
  private workflowId;
373
573
  constructor(options: ClientOptions, workflowId: string);
374
574
  /**
375
- * Retrieves details about the workflow
376
- * @returns Promise containing workflow details including steps and graphs
575
+ * Retrieves details about the legacy workflow
576
+ * @returns Promise containing legacy workflow details including steps and graphs
377
577
  */
378
- details(): Promise<GetWorkflowResponse>;
578
+ details(): Promise<GetLegacyWorkflowResponse>;
379
579
  /**
380
- * @deprecated Use `startAsync` instead
381
- * Executes the workflow with the provided parameters
382
- * @param params - Parameters required for workflow execution
383
- * @returns Promise containing the workflow execution results
580
+ * Retrieves all runs for a legacy workflow
581
+ * @param params - Parameters for filtering runs
582
+ * @returns Promise containing legacy workflow runs array
384
583
  */
385
- execute(params: Record<string, any>): Promise<WorkflowRunResult>;
584
+ runs(params?: GetWorkflowRunsParams): Promise<GetLegacyWorkflowRunsResponse>;
386
585
  /**
387
- * Creates a new workflow run
586
+ * Creates a new legacy workflow run
388
587
  * @returns Promise containing the generated run ID
389
588
  */
390
589
  createRun(params?: {
@@ -393,7 +592,7 @@ declare class Workflow extends BaseResource {
393
592
  runId: string;
394
593
  }>;
395
594
  /**
396
- * Starts a workflow run synchronously without waiting for the workflow to complete
595
+ * Starts a legacy workflow run synchronously without waiting for the workflow to complete
397
596
  * @param params - Object containing the runId and triggerData
398
597
  * @returns Promise containing success message
399
598
  */
@@ -404,11 +603,11 @@ declare class Workflow extends BaseResource {
404
603
  message: string;
405
604
  }>;
406
605
  /**
407
- * Resumes a suspended workflow step synchronously without waiting for the workflow to complete
606
+ * Resumes a suspended legacy workflow step synchronously without waiting for the workflow to complete
408
607
  * @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
608
+ * @param runId - ID of the legacy workflow run
609
+ * @param context - Context to resume the legacy workflow with
610
+ * @returns Promise containing the legacy workflow resume results
412
611
  */
413
612
  resume({ stepId, runId, context, }: {
414
613
  stepId: string;
@@ -425,9 +624,9 @@ declare class Workflow extends BaseResource {
425
624
  startAsync(params: {
426
625
  runId?: string;
427
626
  triggerData: Record<string, any>;
428
- }): Promise<WorkflowRunResult>;
627
+ }): Promise<LegacyWorkflowRunResult>;
429
628
  /**
430
- * Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
629
+ * Resumes a suspended legacy workflow step asynchronously and returns a promise that resolves when the workflow is complete
431
630
  * @param params - Object containing the runId, stepId, and context
432
631
  * @returns Promise containing the workflow resume results
433
632
  */
@@ -435,7 +634,7 @@ declare class Workflow extends BaseResource {
435
634
  runId: string;
436
635
  stepId: string;
437
636
  context: Record<string, any>;
438
- }): Promise<WorkflowRunResult>;
637
+ }): Promise<LegacyWorkflowRunResult>;
439
638
  /**
440
639
  * Creates an async generator that processes a readable stream and yields records
441
640
  * separated by the Record Separator character (\x1E)
@@ -445,13 +644,13 @@ declare class Workflow extends BaseResource {
445
644
  */
446
645
  private streamProcessor;
447
646
  /**
448
- * Watches workflow transitions in real-time
647
+ * Watches legacy workflow transitions in real-time
449
648
  * @param runId - Optional run ID to filter the watch stream
450
- * @returns AsyncGenerator that yields parsed records from the workflow watch stream
649
+ * @returns AsyncGenerator that yields parsed records from the legacy workflow watch stream
451
650
  */
452
651
  watch({ runId }: {
453
652
  runId?: string;
454
- }, onRecord: (record: WorkflowRunResult) => void): Promise<void>;
653
+ }, onRecord: (record: LegacyWorkflowRunResult) => void): Promise<void>;
455
654
  }
456
655
 
457
656
  declare class Tool extends BaseResource {
@@ -469,9 +668,264 @@ declare class Tool extends BaseResource {
469
668
  */
470
669
  execute(params: {
471
670
  data: any;
671
+ runId?: string;
672
+ runtimeContext?: RuntimeContext | Record<string, any>;
472
673
  }): Promise<any>;
473
674
  }
474
675
 
676
+ declare class Workflow extends BaseResource {
677
+ private workflowId;
678
+ constructor(options: ClientOptions, workflowId: string);
679
+ /**
680
+ * Creates an async generator that processes a readable stream and yields workflow records
681
+ * separated by the Record Separator character (\x1E)
682
+ *
683
+ * @param stream - The readable stream to process
684
+ * @returns An async generator that yields parsed records
685
+ */
686
+ private streamProcessor;
687
+ /**
688
+ * Retrieves details about the workflow
689
+ * @returns Promise containing workflow details including steps and graphs
690
+ */
691
+ details(): Promise<GetWorkflowResponse>;
692
+ /**
693
+ * Retrieves all runs for a workflow
694
+ * @param params - Parameters for filtering runs
695
+ * @returns Promise containing workflow runs array
696
+ */
697
+ runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
698
+ /**
699
+ * Retrieves a specific workflow run by its ID
700
+ * @param runId - The ID of the workflow run to retrieve
701
+ * @returns Promise containing the workflow run details
702
+ */
703
+ runById(runId: string): Promise<GetWorkflowRunByIdResponse>;
704
+ /**
705
+ * Retrieves the execution result for a specific workflow run by its ID
706
+ * @param runId - The ID of the workflow run to retrieve the execution result for
707
+ * @returns Promise containing the workflow run execution result
708
+ */
709
+ runExecutionResult(runId: string): Promise<GetWorkflowRunExecutionResultResponse>;
710
+ /**
711
+ * Creates a new workflow run
712
+ * @param params - Optional object containing the optional runId
713
+ * @returns Promise containing the runId of the created run
714
+ */
715
+ createRun(params?: {
716
+ runId?: string;
717
+ }): Promise<{
718
+ runId: string;
719
+ }>;
720
+ /**
721
+ * Starts a workflow run synchronously without waiting for the workflow to complete
722
+ * @param params - Object containing the runId, inputData and runtimeContext
723
+ * @returns Promise containing success message
724
+ */
725
+ start(params: {
726
+ runId: string;
727
+ inputData: Record<string, any>;
728
+ runtimeContext?: RuntimeContext | Record<string, any>;
729
+ }): Promise<{
730
+ message: string;
731
+ }>;
732
+ /**
733
+ * Resumes a suspended workflow step synchronously without waiting for the workflow to complete
734
+ * @param params - Object containing the runId, step, resumeData and runtimeContext
735
+ * @returns Promise containing success message
736
+ */
737
+ resume({ step, runId, resumeData, ...rest }: {
738
+ step: string | string[];
739
+ runId: string;
740
+ resumeData?: Record<string, any>;
741
+ runtimeContext?: RuntimeContext | Record<string, any>;
742
+ }): Promise<{
743
+ message: string;
744
+ }>;
745
+ /**
746
+ * Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
747
+ * @param params - Object containing the optional runId, inputData and runtimeContext
748
+ * @returns Promise containing the workflow execution results
749
+ */
750
+ startAsync(params: {
751
+ runId?: string;
752
+ inputData: Record<string, any>;
753
+ runtimeContext?: RuntimeContext | Record<string, any>;
754
+ }): Promise<WorkflowRunResult>;
755
+ /**
756
+ * Starts a workflow run and returns a stream
757
+ * @param params - Object containing the optional runId, inputData and runtimeContext
758
+ * @returns Promise containing the workflow execution results
759
+ */
760
+ stream(params: {
761
+ runId?: string;
762
+ inputData: Record<string, any>;
763
+ runtimeContext?: RuntimeContext;
764
+ }): Promise<stream_web.ReadableStream<{
765
+ type: string;
766
+ payload: any;
767
+ }>>;
768
+ /**
769
+ * Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
770
+ * @param params - Object containing the runId, step, resumeData and runtimeContext
771
+ * @returns Promise containing the workflow resume results
772
+ */
773
+ resumeAsync(params: {
774
+ runId: string;
775
+ step: string | string[];
776
+ resumeData?: Record<string, any>;
777
+ runtimeContext?: RuntimeContext | Record<string, any>;
778
+ }): Promise<WorkflowRunResult>;
779
+ /**
780
+ * Watches workflow transitions in real-time
781
+ * @param runId - Optional run ID to filter the watch stream
782
+ * @returns AsyncGenerator that yields parsed records from the workflow watch stream
783
+ */
784
+ watch({ runId }: {
785
+ runId?: string;
786
+ }, onRecord: (record: WorkflowWatchResult) => void): Promise<void>;
787
+ /**
788
+ * Creates a new ReadableStream from an iterable or async iterable of objects,
789
+ * serializing each as JSON and separating them with the record separator (\x1E).
790
+ *
791
+ * @param records - An iterable or async iterable of objects to stream
792
+ * @returns A ReadableStream emitting the records as JSON strings separated by the record separator
793
+ */
794
+ static createRecordStream(records: Iterable<any> | AsyncIterable<any>): ReadableStream;
795
+ }
796
+
797
+ /**
798
+ * Class for interacting with an agent via the A2A protocol
799
+ */
800
+ declare class A2A extends BaseResource {
801
+ private agentId;
802
+ constructor(options: ClientOptions, agentId: string);
803
+ /**
804
+ * Get the agent card with metadata about the agent
805
+ * @returns Promise containing the agent card information
806
+ */
807
+ getCard(): Promise<AgentCard>;
808
+ /**
809
+ * Send a message to the agent and get a response
810
+ * @param params - Parameters for the task
811
+ * @returns Promise containing the task response
812
+ */
813
+ sendMessage(params: TaskSendParams): Promise<{
814
+ task: Task;
815
+ }>;
816
+ /**
817
+ * Get the status and result of a task
818
+ * @param params - Parameters for querying the task
819
+ * @returns Promise containing the task response
820
+ */
821
+ getTask(params: TaskQueryParams): Promise<Task>;
822
+ /**
823
+ * Cancel a running task
824
+ * @param params - Parameters identifying the task to cancel
825
+ * @returns Promise containing the task response
826
+ */
827
+ cancelTask(params: TaskIdParams): Promise<{
828
+ task: Task;
829
+ }>;
830
+ /**
831
+ * Send a message and subscribe to streaming updates (not fully implemented)
832
+ * @param params - Parameters for the task
833
+ * @returns Promise containing the task response
834
+ */
835
+ sendAndSubscribe(params: TaskSendParams): Promise<Response>;
836
+ }
837
+
838
+ /**
839
+ * Represents a specific tool available on a specific MCP server.
840
+ * Provides methods to get details and execute the tool.
841
+ */
842
+ declare class MCPTool extends BaseResource {
843
+ private serverId;
844
+ private toolId;
845
+ constructor(options: ClientOptions, serverId: string, toolId: string);
846
+ /**
847
+ * Retrieves details about this specific tool from the MCP server.
848
+ * @returns Promise containing the tool's information (name, description, schema).
849
+ */
850
+ details(): Promise<McpToolInfo>;
851
+ /**
852
+ * Executes this specific tool on the MCP server.
853
+ * @param params - Parameters for tool execution, including data/args and optional runtimeContext.
854
+ * @returns Promise containing the result of the tool execution.
855
+ */
856
+ execute(params: {
857
+ data?: any;
858
+ runtimeContext?: RuntimeContext;
859
+ }): Promise<any>;
860
+ }
861
+
862
+ declare class VNextNetwork extends BaseResource {
863
+ private networkId;
864
+ constructor(options: ClientOptions, networkId: string);
865
+ /**
866
+ * Retrieves details about the network
867
+ * @returns Promise containing vNext network details
868
+ */
869
+ details(): Promise<GetVNextNetworkResponse>;
870
+ /**
871
+ * Generates a response from the v-next network
872
+ * @param params - Generation parameters including message
873
+ * @returns Promise containing the generated response
874
+ */
875
+ generate(params: GenerateOrStreamVNextNetworkParams): Promise<GenerateVNextNetworkResponse>;
876
+ /**
877
+ * Generates a response from the v-next network using multiple primitives
878
+ * @param params - Generation parameters including message
879
+ * @returns Promise containing the generated response
880
+ */
881
+ loop(params: {
882
+ message: string;
883
+ }): Promise<LoopVNextNetworkResponse>;
884
+ private streamProcessor;
885
+ /**
886
+ * Streams a response from the v-next network
887
+ * @param params - Stream parameters including message
888
+ * @returns Promise containing the results
889
+ */
890
+ stream(params: GenerateOrStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
891
+ /**
892
+ * Streams a response from the v-next network loop
893
+ * @param params - Stream parameters including message
894
+ * @returns Promise containing the results
895
+ */
896
+ loopStream(params: LoopStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
897
+ }
898
+
899
+ declare class NetworkMemoryThread extends BaseResource {
900
+ private threadId;
901
+ private networkId;
902
+ constructor(options: ClientOptions, threadId: string, networkId: string);
903
+ /**
904
+ * Retrieves the memory thread details
905
+ * @returns Promise containing thread details including title and metadata
906
+ */
907
+ get(): Promise<StorageThreadType>;
908
+ /**
909
+ * Updates the memory thread properties
910
+ * @param params - Update parameters including title and metadata
911
+ * @returns Promise containing updated thread details
912
+ */
913
+ update(params: UpdateMemoryThreadParams): Promise<StorageThreadType>;
914
+ /**
915
+ * Deletes the memory thread
916
+ * @returns Promise containing deletion result
917
+ */
918
+ delete(): Promise<{
919
+ result: string;
920
+ }>;
921
+ /**
922
+ * Retrieves messages associated with the thread
923
+ * @param params - Optional parameters including limit for number of messages to retrieve
924
+ * @returns Promise containing thread messages and UI messages
925
+ */
926
+ getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
927
+ }
928
+
475
929
  declare class MastraClient extends BaseResource {
476
930
  constructor(options: ClientOptions);
477
931
  /**
@@ -479,6 +933,9 @@ declare class MastraClient extends BaseResource {
479
933
  * @returns Promise containing map of agent IDs to agent details
480
934
  */
481
935
  getAgents(): Promise<Record<string, GetAgentResponse>>;
936
+ getAGUI({ resourceId }: {
937
+ resourceId: string;
938
+ }): Promise<Record<string, AbstractAgent>>;
482
939
  /**
483
940
  * Gets an agent instance by ID
484
941
  * @param agentId - ID of the agent to retrieve
@@ -516,6 +973,37 @@ declare class MastraClient extends BaseResource {
516
973
  getMemoryStatus(agentId: string): Promise<{
517
974
  result: boolean;
518
975
  }>;
976
+ /**
977
+ * Retrieves memory threads for a resource
978
+ * @param params - Parameters containing the resource ID
979
+ * @returns Promise containing array of memory threads
980
+ */
981
+ getNetworkMemoryThreads(params: GetNetworkMemoryThreadParams): Promise<GetMemoryThreadResponse>;
982
+ /**
983
+ * Creates a new memory thread
984
+ * @param params - Parameters for creating the memory thread
985
+ * @returns Promise containing the created memory thread
986
+ */
987
+ createNetworkMemoryThread(params: CreateNetworkMemoryThreadParams): Promise<CreateMemoryThreadResponse>;
988
+ /**
989
+ * Gets a memory thread instance by ID
990
+ * @param threadId - ID of the memory thread to retrieve
991
+ * @returns MemoryThread instance
992
+ */
993
+ getNetworkMemoryThread(threadId: string, networkId: string): NetworkMemoryThread;
994
+ /**
995
+ * Saves messages to memory
996
+ * @param params - Parameters containing messages to save
997
+ * @returns Promise containing the saved messages
998
+ */
999
+ saveNetworkMessageToMemory(params: SaveNetworkMessageToMemoryParams): Promise<SaveMessageToMemoryResponse>;
1000
+ /**
1001
+ * Gets the status of the memory system
1002
+ * @returns Promise containing memory system status
1003
+ */
1004
+ getNetworkMemoryStatus(networkId: string): Promise<{
1005
+ result: boolean;
1006
+ }>;
519
1007
  /**
520
1008
  * Retrieves all available tools
521
1009
  * @returns Promise containing map of tool IDs to tool details
@@ -527,6 +1015,17 @@ declare class MastraClient extends BaseResource {
527
1015
  * @returns Tool instance
528
1016
  */
529
1017
  getTool(toolId: string): Tool;
1018
+ /**
1019
+ * Retrieves all available legacy workflows
1020
+ * @returns Promise containing map of legacy workflow IDs to legacy workflow details
1021
+ */
1022
+ getLegacyWorkflows(): Promise<Record<string, GetLegacyWorkflowResponse>>;
1023
+ /**
1024
+ * Gets a legacy workflow instance by ID
1025
+ * @param workflowId - ID of the legacy workflow to retrieve
1026
+ * @returns Legacy Workflow instance
1027
+ */
1028
+ getLegacyWorkflow(workflowId: string): LegacyWorkflow;
530
1029
  /**
531
1030
  * Retrieves all available workflows
532
1031
  * @returns Promise containing map of workflow IDs to workflow details
@@ -573,13 +1072,62 @@ declare class MastraClient extends BaseResource {
573
1072
  * Retrieves all available networks
574
1073
  * @returns Promise containing map of network IDs to network details
575
1074
  */
576
- getNetworks(): Promise<Record<string, GetNetworkResponse>>;
1075
+ getNetworks(): Promise<Array<GetNetworkResponse>>;
1076
+ /**
1077
+ * Retrieves all available vNext networks
1078
+ * @returns Promise containing map of vNext network IDs to vNext network details
1079
+ */
1080
+ getVNextNetworks(): Promise<Array<GetVNextNetworkResponse>>;
577
1081
  /**
578
1082
  * Gets a network instance by ID
579
1083
  * @param networkId - ID of the network to retrieve
580
1084
  * @returns Network instance
581
1085
  */
582
1086
  getNetwork(networkId: string): Network;
1087
+ /**
1088
+ * Gets a vNext network instance by ID
1089
+ * @param networkId - ID of the vNext network to retrieve
1090
+ * @returns vNext Network instance
1091
+ */
1092
+ getVNextNetwork(networkId: string): VNextNetwork;
1093
+ /**
1094
+ * Retrieves a list of available MCP servers.
1095
+ * @param params - Optional parameters for pagination (limit, offset).
1096
+ * @returns Promise containing the list of MCP servers and pagination info.
1097
+ */
1098
+ getMcpServers(params?: {
1099
+ limit?: number;
1100
+ offset?: number;
1101
+ }): Promise<McpServerListResponse>;
1102
+ /**
1103
+ * Retrieves detailed information for a specific MCP server.
1104
+ * @param serverId - The ID of the MCP server to retrieve.
1105
+ * @param params - Optional parameters, e.g., specific version.
1106
+ * @returns Promise containing the detailed MCP server information.
1107
+ */
1108
+ getMcpServerDetails(serverId: string, params?: {
1109
+ version?: string;
1110
+ }): Promise<ServerDetailInfo>;
1111
+ /**
1112
+ * Retrieves a list of tools for a specific MCP server.
1113
+ * @param serverId - The ID of the MCP server.
1114
+ * @returns Promise containing the list of tools.
1115
+ */
1116
+ getMcpServerTools(serverId: string): Promise<McpServerToolListResponse>;
1117
+ /**
1118
+ * Gets an MCPTool resource instance for a specific tool on an MCP server.
1119
+ * This instance can then be used to fetch details or execute the tool.
1120
+ * @param serverId - The ID of the MCP server.
1121
+ * @param toolId - The ID of the tool.
1122
+ * @returns MCPTool instance.
1123
+ */
1124
+ getMcpServerTool(serverId: string, toolId: string): MCPTool;
1125
+ /**
1126
+ * Gets an A2A client for interacting with an agent via the A2A protocol
1127
+ * @param agentId - ID of the agent to interact with
1128
+ * @returns A2A client instance
1129
+ */
1130
+ getA2A(agentId: string): A2A;
583
1131
  }
584
1132
 
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 };
1133
+ 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 };