@mastra/client-js 0.0.0-separate-trace-data-from-component-20250501141108 → 0.0.0-share-agent-metadata-with-cloud-20250718123411

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