@mastra/client-js 0.0.0-separate-trace-data-from-component-20250501141108 → 0.0.0-support-d1-client-20250701191943

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>>;
@@ -58,19 +80,30 @@ interface GetWorkflowResponse {
58
80
  stepSubscriberGraph: Record<string, StepGraph>;
59
81
  workflowId?: string;
60
82
  }
83
+ interface GetWorkflowRunsParams {
84
+ fromDate?: Date;
85
+ toDate?: Date;
86
+ limit?: number;
87
+ offset?: number;
88
+ resourceId?: string;
89
+ }
90
+ type GetLegacyWorkflowRunsResponse = LegacyWorkflowRuns;
61
91
  type GetWorkflowRunsResponse = WorkflowRuns;
62
- type WorkflowRunResult = {
92
+ type GetWorkflowRunByIdResponse = WorkflowRun;
93
+ type GetWorkflowRunExecutionResultResponse = WatchEvent['payload']['workflowState'];
94
+ type LegacyWorkflowRunResult = {
63
95
  activePaths: Record<string, {
64
96
  status: string;
65
97
  suspendPayload?: any;
66
98
  stepPath: string[];
67
99
  }>;
68
- results: WorkflowRunResult$1<any, any, any>['results'];
100
+ results: LegacyWorkflowRunResult$1<any, any, any>['results'];
69
101
  timestamp: number;
70
102
  runId: string;
71
103
  };
72
- interface GetVNextWorkflowResponse {
104
+ interface GetWorkflowResponse {
73
105
  name: string;
106
+ description?: string;
74
107
  steps: {
75
108
  [key: string]: {
76
109
  id: string;
@@ -81,14 +114,25 @@ interface GetVNextWorkflowResponse {
81
114
  suspendSchema: string;
82
115
  };
83
116
  };
84
- 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'];
85
129
  inputSchema: string;
86
130
  outputSchema: string;
87
131
  }
88
- type VNextWorkflowWatchResult = WatchEvent & {
132
+ type WorkflowWatchResult = WatchEvent & {
89
133
  runId: string;
90
134
  };
91
- type VNextWorkflowRunResult = WorkflowResult<any, any>;
135
+ type WorkflowRunResult = WorkflowResult<any, any>;
92
136
  interface UpsertVectorParams {
93
137
  indexName: string;
94
138
  vectors: number[][];
@@ -116,40 +160,79 @@ interface GetVectorIndexResponse {
116
160
  count: number;
117
161
  }
118
162
  interface SaveMessageToMemoryParams {
119
- messages: MessageType[];
163
+ messages: MastraMessageV1[];
120
164
  agentId: string;
121
165
  }
122
- type SaveMessageToMemoryResponse = MessageType[];
166
+ interface SaveNetworkMessageToMemoryParams {
167
+ messages: MastraMessageV1[];
168
+ networkId: string;
169
+ }
170
+ type SaveMessageToMemoryResponse = MastraMessageV1[];
123
171
  interface CreateMemoryThreadParams {
124
- title: string;
125
- metadata: Record<string, any>;
172
+ title?: string;
173
+ metadata?: Record<string, any>;
126
174
  resourceId: string;
127
- threadId: string;
175
+ threadId?: string;
128
176
  agentId: string;
129
177
  }
178
+ interface CreateNetworkMemoryThreadParams {
179
+ title?: string;
180
+ metadata?: Record<string, any>;
181
+ resourceId: string;
182
+ threadId?: string;
183
+ networkId: string;
184
+ }
130
185
  type CreateMemoryThreadResponse = StorageThreadType;
131
186
  interface GetMemoryThreadParams {
132
187
  resourceId: string;
133
188
  agentId: string;
134
189
  }
190
+ interface GetNetworkMemoryThreadParams {
191
+ resourceId: string;
192
+ networkId: string;
193
+ }
135
194
  type GetMemoryThreadResponse = StorageThreadType[];
136
195
  interface UpdateMemoryThreadParams {
137
196
  title: string;
138
197
  metadata: Record<string, any>;
139
198
  resourceId: string;
140
199
  }
200
+ interface GetMemoryThreadMessagesParams {
201
+ /**
202
+ * Limit the number of messages to retrieve (default: 40)
203
+ */
204
+ limit?: number;
205
+ }
141
206
  interface GetMemoryThreadMessagesResponse {
142
207
  messages: CoreMessage[];
143
208
  uiMessages: AiMessageType[];
144
209
  }
145
210
  interface GetLogsParams {
146
211
  transportId: string;
212
+ fromDate?: Date;
213
+ toDate?: Date;
214
+ logLevel?: LogLevel;
215
+ filters?: Record<string, string>;
216
+ page?: number;
217
+ perPage?: number;
147
218
  }
148
219
  interface GetLogParams {
149
220
  runId: string;
150
221
  transportId: string;
222
+ fromDate?: Date;
223
+ toDate?: Date;
224
+ logLevel?: LogLevel;
225
+ filters?: Record<string, string>;
226
+ page?: number;
227
+ perPage?: number;
151
228
  }
152
- type GetLogsResponse = BaseLogMessage[];
229
+ type GetLogsResponse = {
230
+ logs: BaseLogMessage[];
231
+ total: number;
232
+ page: number;
233
+ perPage: number;
234
+ hasMore: boolean;
235
+ };
153
236
  type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
154
237
  type SpanStatus = {
155
238
  code: number;
@@ -197,8 +280,11 @@ interface GetTelemetryParams {
197
280
  page?: number;
198
281
  perPage?: number;
199
282
  attribute?: Record<string, string>;
283
+ fromDate?: Date;
284
+ toDate?: Date;
200
285
  }
201
286
  interface GetNetworkResponse {
287
+ id: string;
202
288
  name: string;
203
289
  instructions: string;
204
290
  agents: Array<{
@@ -212,6 +298,69 @@ interface GetNetworkResponse {
212
298
  };
213
299
  state?: Record<string, any>;
214
300
  }
301
+ interface GetVNextNetworkResponse {
302
+ id: string;
303
+ name: string;
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<{
315
+ name: string;
316
+ description: string;
317
+ inputSchema: string | undefined;
318
+ outputSchema: string | undefined;
319
+ }>;
320
+ tools: Array<{
321
+ id: string;
322
+ description: string;
323
+ }>;
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
+ }
215
364
 
216
365
  declare class BaseResource {
217
366
  readonly options: ClientOptions;
@@ -244,7 +393,9 @@ declare class AgentVoice extends BaseResource {
244
393
  * @param options - Optional provider-specific options
245
394
  * @returns Promise containing the transcribed text
246
395
  */
247
- listen(audio: Blob, options?: Record<string, any>): Promise<Response>;
396
+ listen(audio: Blob, options?: Record<string, any>): Promise<{
397
+ text: string;
398
+ }>;
248
399
  /**
249
400
  * Get available speakers for the agent's voice provider
250
401
  * @returns Promise containing list of available speakers
@@ -253,6 +404,13 @@ declare class AgentVoice extends BaseResource {
253
404
  voiceId: string;
254
405
  [key: string]: any;
255
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
+ }>;
256
414
  }
257
415
  declare class Agent extends BaseResource {
258
416
  private agentId;
@@ -268,7 +426,19 @@ declare class Agent extends BaseResource {
268
426
  * @param params - Generation parameters including prompt
269
427
  * @returns Promise containing the generated response
270
428
  */
271
- 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;
272
442
  /**
273
443
  * Streams a response from the agent
274
444
  * @param params - Stream parameters including prompt
@@ -277,12 +447,26 @@ declare class Agent extends BaseResource {
277
447
  stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
278
448
  processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
279
449
  }>;
450
+ /**
451
+ * Processes the stream response and handles tool calls
452
+ */
453
+ private processStreamResponse;
280
454
  /**
281
455
  * Gets details about a specific tool available to the agent
282
456
  * @param toolId - ID of the tool to retrieve
283
457
  * @returns Promise containing tool details
284
458
  */
285
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>;
286
470
  /**
287
471
  * Retrieves evaluation results for the agent
288
472
  * @returns Promise containing agent evaluations
@@ -343,9 +527,10 @@ declare class MemoryThread extends BaseResource {
343
527
  }>;
344
528
  /**
345
529
  * Retrieves messages associated with the thread
530
+ * @param params - Optional parameters including limit for number of messages to retrieve
346
531
  * @returns Promise containing thread messages and UI messages
347
532
  */
348
- getMessages(): Promise<GetMemoryThreadMessagesResponse>;
533
+ getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
349
534
  }
350
535
 
351
536
  declare class Vector extends BaseResource {
@@ -394,28 +579,22 @@ declare class Vector extends BaseResource {
394
579
  query(params: QueryVectorParams): Promise<QueryVectorResponse>;
395
580
  }
396
581
 
397
- declare class Workflow extends BaseResource {
582
+ declare class LegacyWorkflow extends BaseResource {
398
583
  private workflowId;
399
584
  constructor(options: ClientOptions, workflowId: string);
400
585
  /**
401
- * Retrieves details about the workflow
402
- * @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
403
588
  */
404
- details(): Promise<GetWorkflowResponse>;
589
+ details(): Promise<GetLegacyWorkflowResponse>;
405
590
  /**
406
- * Retrieves all runs for a workflow
407
- * @returns Promise containing workflow runs array
591
+ * Retrieves all runs for a legacy workflow
592
+ * @param params - Parameters for filtering runs
593
+ * @returns Promise containing legacy workflow runs array
408
594
  */
409
- runs(): Promise<GetWorkflowRunsResponse>;
595
+ runs(params?: GetWorkflowRunsParams): Promise<GetLegacyWorkflowRunsResponse>;
410
596
  /**
411
- * @deprecated Use `startAsync` instead
412
- * Executes the workflow with the provided parameters
413
- * @param params - Parameters required for workflow execution
414
- * @returns Promise containing the workflow execution results
415
- */
416
- execute(params: Record<string, any>): Promise<WorkflowRunResult>;
417
- /**
418
- * Creates a new workflow run
597
+ * Creates a new legacy workflow run
419
598
  * @returns Promise containing the generated run ID
420
599
  */
421
600
  createRun(params?: {
@@ -424,7 +603,7 @@ declare class Workflow extends BaseResource {
424
603
  runId: string;
425
604
  }>;
426
605
  /**
427
- * 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
428
607
  * @param params - Object containing the runId and triggerData
429
608
  * @returns Promise containing success message
430
609
  */
@@ -435,11 +614,11 @@ declare class Workflow extends BaseResource {
435
614
  message: string;
436
615
  }>;
437
616
  /**
438
- * 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
439
618
  * @param stepId - ID of the step to resume
440
- * @param runId - ID of the workflow run
441
- * @param context - Context to resume the workflow with
442
- * @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
443
622
  */
444
623
  resume({ stepId, runId, context, }: {
445
624
  stepId: string;
@@ -456,9 +635,9 @@ declare class Workflow extends BaseResource {
456
635
  startAsync(params: {
457
636
  runId?: string;
458
637
  triggerData: Record<string, any>;
459
- }): Promise<WorkflowRunResult>;
638
+ }): Promise<LegacyWorkflowRunResult>;
460
639
  /**
461
- * 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
462
641
  * @param params - Object containing the runId, stepId, and context
463
642
  * @returns Promise containing the workflow resume results
464
643
  */
@@ -466,7 +645,7 @@ declare class Workflow extends BaseResource {
466
645
  runId: string;
467
646
  stepId: string;
468
647
  context: Record<string, any>;
469
- }): Promise<WorkflowRunResult>;
648
+ }): Promise<LegacyWorkflowRunResult>;
470
649
  /**
471
650
  * Creates an async generator that processes a readable stream and yields records
472
651
  * separated by the Record Separator character (\x1E)
@@ -476,13 +655,13 @@ declare class Workflow extends BaseResource {
476
655
  */
477
656
  private streamProcessor;
478
657
  /**
479
- * Watches workflow transitions in real-time
658
+ * Watches legacy workflow transitions in real-time
480
659
  * @param runId - Optional run ID to filter the watch stream
481
- * @returns AsyncGenerator that yields parsed records from the workflow watch stream
660
+ * @returns AsyncGenerator that yields parsed records from the legacy workflow watch stream
482
661
  */
483
662
  watch({ runId }: {
484
663
  runId?: string;
485
- }, onRecord: (record: WorkflowRunResult) => void): Promise<void>;
664
+ }, onRecord: (record: LegacyWorkflowRunResult) => void): Promise<void>;
486
665
  }
487
666
 
488
667
  declare class Tool extends BaseResource {
@@ -501,14 +680,15 @@ declare class Tool extends BaseResource {
501
680
  execute(params: {
502
681
  data: any;
503
682
  runId?: string;
683
+ runtimeContext?: RuntimeContext | Record<string, any>;
504
684
  }): Promise<any>;
505
685
  }
506
686
 
507
- declare class VNextWorkflow extends BaseResource {
687
+ declare class Workflow extends BaseResource {
508
688
  private workflowId;
509
689
  constructor(options: ClientOptions, workflowId: string);
510
690
  /**
511
- * 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
512
692
  * separated by the Record Separator character (\x1E)
513
693
  *
514
694
  * @param stream - The readable stream to process
@@ -516,17 +696,38 @@ declare class VNextWorkflow extends BaseResource {
516
696
  */
517
697
  private streamProcessor;
518
698
  /**
519
- * Retrieves details about the vNext workflow
520
- * @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
521
701
  */
522
- details(): Promise<GetVNextWorkflowResponse>;
702
+ details(): Promise<GetWorkflowResponse>;
523
703
  /**
524
- * Retrieves all runs for a vNext workflow
525
- * @returns Promise containing vNext workflow runs array
704
+ * Retrieves all runs for a workflow
705
+ * @param params - Parameters for filtering runs
706
+ * @returns Promise containing workflow runs array
707
+ */
708
+ runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
709
+ /**
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
526
713
  */
527
- runs(): Promise<GetWorkflowRunsResponse>;
714
+ runById(runId: string): Promise<GetWorkflowRunByIdResponse>;
528
715
  /**
529
- * Creates a new vNext workflow run
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
+ * Creates a new workflow run
530
731
  * @param params - Optional object containing the optional runId
531
732
  * @returns Promise containing the runId of the created run
532
733
  */
@@ -536,59 +737,212 @@ declare class VNextWorkflow extends BaseResource {
536
737
  runId: string;
537
738
  }>;
538
739
  /**
539
- * Starts a vNext workflow run synchronously without waiting for the workflow to complete
740
+ * Starts a workflow run synchronously without waiting for the workflow to complete
540
741
  * @param params - Object containing the runId, inputData and runtimeContext
541
742
  * @returns Promise containing success message
542
743
  */
543
744
  start(params: {
544
745
  runId: string;
545
746
  inputData: Record<string, any>;
546
- runtimeContext?: RuntimeContext;
747
+ runtimeContext?: RuntimeContext | Record<string, any>;
547
748
  }): Promise<{
548
749
  message: string;
549
750
  }>;
550
751
  /**
551
- * Resumes a suspended vNext workflow step synchronously without waiting for the vNext workflow to complete
752
+ * Resumes a suspended workflow step synchronously without waiting for the workflow to complete
552
753
  * @param params - Object containing the runId, step, resumeData and runtimeContext
553
754
  * @returns Promise containing success message
554
755
  */
555
- resume({ step, runId, resumeData, runtimeContext, }: {
756
+ resume({ step, runId, resumeData, ...rest }: {
556
757
  step: string | string[];
557
758
  runId: string;
558
759
  resumeData?: Record<string, any>;
559
- runtimeContext?: RuntimeContext;
760
+ runtimeContext?: RuntimeContext | Record<string, any>;
560
761
  }): Promise<{
561
762
  message: string;
562
763
  }>;
563
764
  /**
564
- * Starts a vNext workflow run asynchronously and returns a promise that resolves when the vNext workflow is complete
765
+ * Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
565
766
  * @param params - Object containing the optional runId, inputData and runtimeContext
566
- * @returns Promise containing the vNext workflow execution results
767
+ * @returns Promise containing the workflow execution results
567
768
  */
568
769
  startAsync(params: {
770
+ runId?: string;
771
+ inputData: Record<string, any>;
772
+ runtimeContext?: RuntimeContext | Record<string, any>;
773
+ }): Promise<WorkflowRunResult>;
774
+ /**
775
+ * Starts a workflow run and returns a stream
776
+ * @param params - Object containing the optional runId, inputData and runtimeContext
777
+ * @returns Promise containing the workflow execution results
778
+ */
779
+ stream(params: {
569
780
  runId?: string;
570
781
  inputData: Record<string, any>;
571
782
  runtimeContext?: RuntimeContext;
572
- }): Promise<VNextWorkflowRunResult>;
783
+ }): Promise<stream_web.ReadableStream<{
784
+ type: string;
785
+ payload: any;
786
+ }>>;
573
787
  /**
574
- * Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
788
+ * Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
575
789
  * @param params - Object containing the runId, step, resumeData and runtimeContext
576
- * @returns Promise containing the vNext workflow resume results
790
+ * @returns Promise containing the workflow resume results
577
791
  */
578
792
  resumeAsync(params: {
579
793
  runId: string;
580
794
  step: string | string[];
581
795
  resumeData?: Record<string, any>;
582
- runtimeContext?: RuntimeContext;
583
- }): Promise<VNextWorkflowRunResult>;
796
+ runtimeContext?: RuntimeContext | Record<string, any>;
797
+ }): Promise<WorkflowRunResult>;
584
798
  /**
585
- * Watches vNext workflow transitions in real-time
799
+ * Watches workflow transitions in real-time
586
800
  * @param runId - Optional run ID to filter the watch stream
587
- * @returns AsyncGenerator that yields parsed records from the vNext workflow watch stream
801
+ * @returns AsyncGenerator that yields parsed records from the workflow watch stream
588
802
  */
589
803
  watch({ runId }: {
590
804
  runId?: string;
591
- }, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
805
+ }, onRecord: (record: WorkflowWatchResult) => void): Promise<void>;
806
+ /**
807
+ * Creates a new ReadableStream from an iterable or async iterable of objects,
808
+ * serializing each as JSON and separating them with the record separator (\x1E).
809
+ *
810
+ * @param records - An iterable or async iterable of objects to stream
811
+ * @returns A ReadableStream emitting the records as JSON strings separated by the record separator
812
+ */
813
+ static createRecordStream(records: Iterable<any> | AsyncIterable<any>): ReadableStream;
814
+ }
815
+
816
+ /**
817
+ * Class for interacting with an agent via the A2A protocol
818
+ */
819
+ declare class A2A extends BaseResource {
820
+ private agentId;
821
+ constructor(options: ClientOptions, agentId: string);
822
+ /**
823
+ * Get the agent card with metadata about the agent
824
+ * @returns Promise containing the agent card information
825
+ */
826
+ getCard(): Promise<AgentCard>;
827
+ /**
828
+ * Send a message to the agent and get a response
829
+ * @param params - Parameters for the task
830
+ * @returns Promise containing the task response
831
+ */
832
+ sendMessage(params: TaskSendParams): Promise<{
833
+ task: Task;
834
+ }>;
835
+ /**
836
+ * Get the status and result of a task
837
+ * @param params - Parameters for querying the task
838
+ * @returns Promise containing the task response
839
+ */
840
+ getTask(params: TaskQueryParams): Promise<Task>;
841
+ /**
842
+ * Cancel a running task
843
+ * @param params - Parameters identifying the task to cancel
844
+ * @returns Promise containing the task response
845
+ */
846
+ cancelTask(params: TaskIdParams): Promise<{
847
+ task: Task;
848
+ }>;
849
+ /**
850
+ * Send a message and subscribe to streaming updates (not fully implemented)
851
+ * @param params - Parameters for the task
852
+ * @returns Promise containing the task response
853
+ */
854
+ sendAndSubscribe(params: TaskSendParams): Promise<Response>;
855
+ }
856
+
857
+ /**
858
+ * Represents a specific tool available on a specific MCP server.
859
+ * Provides methods to get details and execute the tool.
860
+ */
861
+ declare class MCPTool extends BaseResource {
862
+ private serverId;
863
+ private toolId;
864
+ constructor(options: ClientOptions, serverId: string, toolId: string);
865
+ /**
866
+ * Retrieves details about this specific tool from the MCP server.
867
+ * @returns Promise containing the tool's information (name, description, schema).
868
+ */
869
+ details(): Promise<McpToolInfo>;
870
+ /**
871
+ * Executes this specific tool on the MCP server.
872
+ * @param params - Parameters for tool execution, including data/args and optional runtimeContext.
873
+ * @returns Promise containing the result of the tool execution.
874
+ */
875
+ execute(params: {
876
+ data?: any;
877
+ runtimeContext?: RuntimeContext;
878
+ }): Promise<any>;
879
+ }
880
+
881
+ declare class VNextNetwork extends BaseResource {
882
+ private networkId;
883
+ constructor(options: ClientOptions, networkId: string);
884
+ /**
885
+ * Retrieves details about the network
886
+ * @returns Promise containing vNext network details
887
+ */
888
+ details(): Promise<GetVNextNetworkResponse>;
889
+ /**
890
+ * Generates a response from the v-next network
891
+ * @param params - Generation parameters including message
892
+ * @returns Promise containing the generated response
893
+ */
894
+ generate(params: GenerateOrStreamVNextNetworkParams): Promise<GenerateVNextNetworkResponse>;
895
+ /**
896
+ * Generates a response from the v-next network using multiple primitives
897
+ * @param params - Generation parameters including message
898
+ * @returns Promise containing the generated response
899
+ */
900
+ loop(params: {
901
+ message: string;
902
+ }): Promise<LoopVNextNetworkResponse>;
903
+ private streamProcessor;
904
+ /**
905
+ * Streams a response from the v-next network
906
+ * @param params - Stream parameters including message
907
+ * @returns Promise containing the results
908
+ */
909
+ stream(params: GenerateOrStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
910
+ /**
911
+ * Streams a response from the v-next network loop
912
+ * @param params - Stream parameters including message
913
+ * @returns Promise containing the results
914
+ */
915
+ loopStream(params: LoopStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
916
+ }
917
+
918
+ declare class NetworkMemoryThread extends BaseResource {
919
+ private threadId;
920
+ private networkId;
921
+ constructor(options: ClientOptions, threadId: string, networkId: string);
922
+ /**
923
+ * Retrieves the memory thread details
924
+ * @returns Promise containing thread details including title and metadata
925
+ */
926
+ get(): Promise<StorageThreadType>;
927
+ /**
928
+ * Updates the memory thread properties
929
+ * @param params - Update parameters including title and metadata
930
+ * @returns Promise containing updated thread details
931
+ */
932
+ update(params: UpdateMemoryThreadParams): Promise<StorageThreadType>;
933
+ /**
934
+ * Deletes the memory thread
935
+ * @returns Promise containing deletion result
936
+ */
937
+ delete(): Promise<{
938
+ result: string;
939
+ }>;
940
+ /**
941
+ * Retrieves messages associated with the thread
942
+ * @param params - Optional parameters including limit for number of messages to retrieve
943
+ * @returns Promise containing thread messages and UI messages
944
+ */
945
+ getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
592
946
  }
593
947
 
594
948
  declare class MastraClient extends BaseResource {
@@ -598,6 +952,9 @@ declare class MastraClient extends BaseResource {
598
952
  * @returns Promise containing map of agent IDs to agent details
599
953
  */
600
954
  getAgents(): Promise<Record<string, GetAgentResponse>>;
955
+ getAGUI({ resourceId }: {
956
+ resourceId: string;
957
+ }): Promise<Record<string, AbstractAgent>>;
601
958
  /**
602
959
  * Gets an agent instance by ID
603
960
  * @param agentId - ID of the agent to retrieve
@@ -635,6 +992,37 @@ declare class MastraClient extends BaseResource {
635
992
  getMemoryStatus(agentId: string): Promise<{
636
993
  result: boolean;
637
994
  }>;
995
+ /**
996
+ * Retrieves memory threads for a resource
997
+ * @param params - Parameters containing the resource ID
998
+ * @returns Promise containing array of memory threads
999
+ */
1000
+ getNetworkMemoryThreads(params: GetNetworkMemoryThreadParams): Promise<GetMemoryThreadResponse>;
1001
+ /**
1002
+ * Creates a new memory thread
1003
+ * @param params - Parameters for creating the memory thread
1004
+ * @returns Promise containing the created memory thread
1005
+ */
1006
+ createNetworkMemoryThread(params: CreateNetworkMemoryThreadParams): Promise<CreateMemoryThreadResponse>;
1007
+ /**
1008
+ * Gets a memory thread instance by ID
1009
+ * @param threadId - ID of the memory thread to retrieve
1010
+ * @returns MemoryThread instance
1011
+ */
1012
+ getNetworkMemoryThread(threadId: string, networkId: string): NetworkMemoryThread;
1013
+ /**
1014
+ * Saves messages to memory
1015
+ * @param params - Parameters containing messages to save
1016
+ * @returns Promise containing the saved messages
1017
+ */
1018
+ saveNetworkMessageToMemory(params: SaveNetworkMessageToMemoryParams): Promise<SaveMessageToMemoryResponse>;
1019
+ /**
1020
+ * Gets the status of the memory system
1021
+ * @returns Promise containing memory system status
1022
+ */
1023
+ getNetworkMemoryStatus(networkId: string): Promise<{
1024
+ result: boolean;
1025
+ }>;
638
1026
  /**
639
1027
  * Retrieves all available tools
640
1028
  * @returns Promise containing map of tool IDs to tool details
@@ -646,6 +1034,17 @@ declare class MastraClient extends BaseResource {
646
1034
  * @returns Tool instance
647
1035
  */
648
1036
  getTool(toolId: string): Tool;
1037
+ /**
1038
+ * Retrieves all available legacy workflows
1039
+ * @returns Promise containing map of legacy workflow IDs to legacy workflow details
1040
+ */
1041
+ getLegacyWorkflows(): Promise<Record<string, GetLegacyWorkflowResponse>>;
1042
+ /**
1043
+ * Gets a legacy workflow instance by ID
1044
+ * @param workflowId - ID of the legacy workflow to retrieve
1045
+ * @returns Legacy Workflow instance
1046
+ */
1047
+ getLegacyWorkflow(workflowId: string): LegacyWorkflow;
649
1048
  /**
650
1049
  * Retrieves all available workflows
651
1050
  * @returns Promise containing map of workflow IDs to workflow details
@@ -657,17 +1056,6 @@ declare class MastraClient extends BaseResource {
657
1056
  * @returns Workflow instance
658
1057
  */
659
1058
  getWorkflow(workflowId: string): Workflow;
660
- /**
661
- * Retrieves all available vNext workflows
662
- * @returns Promise containing map of vNext workflow IDs to vNext workflow details
663
- */
664
- getVNextWorkflows(): Promise<Record<string, GetVNextWorkflowResponse>>;
665
- /**
666
- * Gets a vNext workflow instance by ID
667
- * @param workflowId - ID of the vNext workflow to retrieve
668
- * @returns vNext Workflow instance
669
- */
670
- getVNextWorkflow(workflowId: string): VNextWorkflow;
671
1059
  /**
672
1060
  * Gets a vector instance by name
673
1061
  * @param vectorName - Name of the vector to retrieve
@@ -703,13 +1091,62 @@ declare class MastraClient extends BaseResource {
703
1091
  * Retrieves all available networks
704
1092
  * @returns Promise containing map of network IDs to network details
705
1093
  */
706
- getNetworks(): Promise<Record<string, GetNetworkResponse>>;
1094
+ getNetworks(): Promise<Array<GetNetworkResponse>>;
1095
+ /**
1096
+ * Retrieves all available vNext networks
1097
+ * @returns Promise containing map of vNext network IDs to vNext network details
1098
+ */
1099
+ getVNextNetworks(): Promise<Array<GetVNextNetworkResponse>>;
707
1100
  /**
708
1101
  * Gets a network instance by ID
709
1102
  * @param networkId - ID of the network to retrieve
710
1103
  * @returns Network instance
711
1104
  */
712
1105
  getNetwork(networkId: string): Network;
1106
+ /**
1107
+ * Gets a vNext network instance by ID
1108
+ * @param networkId - ID of the vNext network to retrieve
1109
+ * @returns vNext Network instance
1110
+ */
1111
+ getVNextNetwork(networkId: string): VNextNetwork;
1112
+ /**
1113
+ * Retrieves a list of available MCP servers.
1114
+ * @param params - Optional parameters for pagination (limit, offset).
1115
+ * @returns Promise containing the list of MCP servers and pagination info.
1116
+ */
1117
+ getMcpServers(params?: {
1118
+ limit?: number;
1119
+ offset?: number;
1120
+ }): Promise<McpServerListResponse>;
1121
+ /**
1122
+ * Retrieves detailed information for a specific MCP server.
1123
+ * @param serverId - The ID of the MCP server to retrieve.
1124
+ * @param params - Optional parameters, e.g., specific version.
1125
+ * @returns Promise containing the detailed MCP server information.
1126
+ */
1127
+ getMcpServerDetails(serverId: string, params?: {
1128
+ version?: string;
1129
+ }): Promise<ServerDetailInfo>;
1130
+ /**
1131
+ * Retrieves a list of tools for a specific MCP server.
1132
+ * @param serverId - The ID of the MCP server.
1133
+ * @returns Promise containing the list of tools.
1134
+ */
1135
+ getMcpServerTools(serverId: string): Promise<McpServerToolListResponse>;
1136
+ /**
1137
+ * Gets an MCPTool resource instance for a specific tool on an MCP server.
1138
+ * This instance can then be used to fetch details or execute the tool.
1139
+ * @param serverId - The ID of the MCP server.
1140
+ * @param toolId - The ID of the tool.
1141
+ * @returns MCPTool instance.
1142
+ */
1143
+ getMcpServerTool(serverId: string, toolId: string): MCPTool;
1144
+ /**
1145
+ * Gets an A2A client for interacting with an agent via the A2A protocol
1146
+ * @param agentId - ID of the agent to interact with
1147
+ * @returns A2A client instance
1148
+ */
1149
+ getA2A(agentId: string): A2A;
713
1150
  }
714
1151
 
715
- 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 GetVNextWorkflowResponse, type GetVectorIndexResponse, type GetWorkflowResponse, 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 };
1152
+ 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 };