@mastra/client-js 0.0.0-fix-message-embedding-20250506021742 → 0.0.0-fix-fetch-workflow-runs-20250624231457

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.ts CHANGED
@@ -1,11 +1,16 @@
1
1
  import { AbstractAgent } from '@ag-ui/client';
2
+ import { ServerInfo, MCPToolType, ServerDetailInfo } from '@mastra/core/mcp';
2
3
  import { processDataStream } from '@ai-sdk/ui-utils';
3
- 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';
4
5
  import { JSONSchema7 } from 'json-schema';
5
6
  import { ZodSchema } from 'zod';
6
- import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
7
- 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';
8
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';
9
14
 
10
15
  interface ClientOptions {
11
16
  /** Base URL for API requests */
@@ -26,19 +31,35 @@ interface RequestOptions {
26
31
  stream?: boolean;
27
32
  signal?: AbortSignal;
28
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
+ };
29
39
  interface GetAgentResponse {
30
40
  name: string;
31
41
  instructions: string;
32
42
  tools: Record<string, GetToolResponse>;
43
+ workflows: Record<string, GetWorkflowResponse>;
33
44
  provider: string;
34
45
  modelId: string;
46
+ defaultGenerateOptions: WithoutMethods<AgentGenerateOptions>;
47
+ defaultStreamOptions: WithoutMethods<AgentStreamOptions>;
35
48
  }
36
49
  type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
37
50
  messages: string | string[] | CoreMessage[] | AiMessageType[];
38
- } & 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'>>;
39
56
  type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
40
57
  messages: string | string[] | CoreMessage[] | AiMessageType[];
41
- } & 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'>>;
42
63
  interface GetEvalsByAgentIdResponse extends GetAgentResponse {
43
64
  evals: any[];
44
65
  instructions: string;
@@ -51,7 +72,7 @@ interface GetToolResponse {
51
72
  inputSchema: string;
52
73
  outputSchema: string;
53
74
  }
54
- interface GetWorkflowResponse {
75
+ interface GetLegacyWorkflowResponse {
55
76
  name: string;
56
77
  triggerSchema: string;
57
78
  steps: Record<string, StepAction<any, any, any, any>>;
@@ -66,19 +87,23 @@ interface GetWorkflowRunsParams {
66
87
  offset?: number;
67
88
  resourceId?: string;
68
89
  }
90
+ type GetLegacyWorkflowRunsResponse = LegacyWorkflowRuns;
69
91
  type GetWorkflowRunsResponse = WorkflowRuns;
70
- type WorkflowRunResult = {
92
+ type GetWorkflowRunByIdResponse = WorkflowRun;
93
+ type GetWorkflowRunExecutionResultResponse = WatchEvent['payload']['workflowState'];
94
+ type LegacyWorkflowRunResult = {
71
95
  activePaths: Record<string, {
72
96
  status: string;
73
97
  suspendPayload?: any;
74
98
  stepPath: string[];
75
99
  }>;
76
- results: WorkflowRunResult$1<any, any, any>['results'];
100
+ results: LegacyWorkflowRunResult$1<any, any, any>['results'];
77
101
  timestamp: number;
78
102
  runId: string;
79
103
  };
80
- interface GetVNextWorkflowResponse {
104
+ interface GetWorkflowResponse {
81
105
  name: string;
106
+ description?: string;
82
107
  steps: {
83
108
  [key: string]: {
84
109
  id: string;
@@ -89,14 +114,14 @@ interface GetVNextWorkflowResponse {
89
114
  suspendSchema: string;
90
115
  };
91
116
  };
92
- stepGraph: NewWorkflow['serializedStepGraph'];
117
+ stepGraph: Workflow$1['serializedStepGraph'];
93
118
  inputSchema: string;
94
119
  outputSchema: string;
95
120
  }
96
- type VNextWorkflowWatchResult = WatchEvent & {
121
+ type WorkflowWatchResult = WatchEvent & {
97
122
  runId: string;
98
123
  };
99
- type VNextWorkflowRunResult = WorkflowResult<any, any>;
124
+ type WorkflowRunResult = WorkflowResult<any, any>;
100
125
  interface UpsertVectorParams {
101
126
  indexName: string;
102
127
  vectors: number[][];
@@ -124,40 +149,79 @@ interface GetVectorIndexResponse {
124
149
  count: number;
125
150
  }
126
151
  interface SaveMessageToMemoryParams {
127
- messages: MessageType[];
152
+ messages: MastraMessageV1[];
128
153
  agentId: string;
129
154
  }
130
- type SaveMessageToMemoryResponse = MessageType[];
155
+ interface SaveNetworkMessageToMemoryParams {
156
+ messages: MastraMessageV1[];
157
+ networkId: string;
158
+ }
159
+ type SaveMessageToMemoryResponse = MastraMessageV1[];
131
160
  interface CreateMemoryThreadParams {
132
- title: string;
133
- metadata: Record<string, any>;
161
+ title?: string;
162
+ metadata?: Record<string, any>;
134
163
  resourceId: string;
135
- threadId: string;
164
+ threadId?: string;
136
165
  agentId: string;
137
166
  }
167
+ interface CreateNetworkMemoryThreadParams {
168
+ title?: string;
169
+ metadata?: Record<string, any>;
170
+ resourceId: string;
171
+ threadId?: string;
172
+ networkId: string;
173
+ }
138
174
  type CreateMemoryThreadResponse = StorageThreadType;
139
175
  interface GetMemoryThreadParams {
140
176
  resourceId: string;
141
177
  agentId: string;
142
178
  }
179
+ interface GetNetworkMemoryThreadParams {
180
+ resourceId: string;
181
+ networkId: string;
182
+ }
143
183
  type GetMemoryThreadResponse = StorageThreadType[];
144
184
  interface UpdateMemoryThreadParams {
145
185
  title: string;
146
186
  metadata: Record<string, any>;
147
187
  resourceId: string;
148
188
  }
189
+ interface GetMemoryThreadMessagesParams {
190
+ /**
191
+ * Limit the number of messages to retrieve (default: 40)
192
+ */
193
+ limit?: number;
194
+ }
149
195
  interface GetMemoryThreadMessagesResponse {
150
196
  messages: CoreMessage[];
151
197
  uiMessages: AiMessageType[];
152
198
  }
153
199
  interface GetLogsParams {
154
200
  transportId: string;
201
+ fromDate?: Date;
202
+ toDate?: Date;
203
+ logLevel?: LogLevel;
204
+ filters?: Record<string, string>;
205
+ page?: number;
206
+ perPage?: number;
155
207
  }
156
208
  interface GetLogParams {
157
209
  runId: string;
158
210
  transportId: string;
211
+ fromDate?: Date;
212
+ toDate?: Date;
213
+ logLevel?: LogLevel;
214
+ filters?: Record<string, string>;
215
+ page?: number;
216
+ perPage?: number;
159
217
  }
160
- type GetLogsResponse = BaseLogMessage[];
218
+ type GetLogsResponse = {
219
+ logs: BaseLogMessage[];
220
+ total: number;
221
+ page: number;
222
+ perPage: number;
223
+ hasMore: boolean;
224
+ };
161
225
  type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
162
226
  type SpanStatus = {
163
227
  code: number;
@@ -209,6 +273,7 @@ interface GetTelemetryParams {
209
273
  toDate?: Date;
210
274
  }
211
275
  interface GetNetworkResponse {
276
+ id: string;
212
277
  name: string;
213
278
  instructions: string;
214
279
  agents: Array<{
@@ -222,6 +287,59 @@ interface GetNetworkResponse {
222
287
  };
223
288
  state?: Record<string, any>;
224
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
+ }
310
+ interface GenerateVNextNetworkResponse {
311
+ task: string;
312
+ result: string;
313
+ resourceId: string;
314
+ resourceType: 'none' | 'tool' | 'agent' | 'workflow';
315
+ }
316
+ interface GenerateOrStreamVNextNetworkParams {
317
+ message: string;
318
+ threadId?: string;
319
+ resourceId?: string;
320
+ }
321
+ interface LoopVNextNetworkResponse {
322
+ status: 'success';
323
+ result: {
324
+ text: string;
325
+ };
326
+ steps: WorkflowResult<any, any>['steps'];
327
+ }
328
+ interface McpServerListResponse {
329
+ servers: ServerInfo[];
330
+ next: string | null;
331
+ total_count: number;
332
+ }
333
+ interface McpToolInfo {
334
+ id: string;
335
+ name: string;
336
+ description?: string;
337
+ inputSchema: string;
338
+ toolType?: MCPToolType;
339
+ }
340
+ interface McpServerToolListResponse {
341
+ tools: McpToolInfo[];
342
+ }
225
343
 
226
344
  declare class BaseResource {
227
345
  readonly options: ClientOptions;
@@ -254,7 +372,9 @@ declare class AgentVoice extends BaseResource {
254
372
  * @param options - Optional provider-specific options
255
373
  * @returns Promise containing the transcribed text
256
374
  */
257
- listen(audio: Blob, options?: Record<string, any>): Promise<Response>;
375
+ listen(audio: Blob, options?: Record<string, any>): Promise<{
376
+ text: string;
377
+ }>;
258
378
  /**
259
379
  * Get available speakers for the agent's voice provider
260
380
  * @returns Promise containing list of available speakers
@@ -263,6 +383,13 @@ declare class AgentVoice extends BaseResource {
263
383
  voiceId: string;
264
384
  [key: string]: any;
265
385
  }>>;
386
+ /**
387
+ * Get the listener configuration for the agent's voice provider
388
+ * @returns Promise containing a check if the agent has listening capabilities
389
+ */
390
+ getListener(): Promise<{
391
+ enabled: boolean;
392
+ }>;
266
393
  }
267
394
  declare class Agent extends BaseResource {
268
395
  private agentId;
@@ -278,7 +405,19 @@ declare class Agent extends BaseResource {
278
405
  * @param params - Generation parameters including prompt
279
406
  * @returns Promise containing the generated response
280
407
  */
281
- generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T>): Promise<GenerateReturn<T>>;
408
+ generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
409
+ output?: never;
410
+ experimental_output?: never;
411
+ }): Promise<GenerateReturn<T>>;
412
+ generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
413
+ output: T;
414
+ experimental_output?: never;
415
+ }): Promise<GenerateReturn<T>>;
416
+ generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
417
+ output?: never;
418
+ experimental_output: T;
419
+ }): Promise<GenerateReturn<T>>;
420
+ private processChatResponse;
282
421
  /**
283
422
  * Streams a response from the agent
284
423
  * @param params - Stream parameters including prompt
@@ -287,12 +426,26 @@ declare class Agent extends BaseResource {
287
426
  stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
288
427
  processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
289
428
  }>;
429
+ /**
430
+ * Processes the stream response and handles tool calls
431
+ */
432
+ private processStreamResponse;
290
433
  /**
291
434
  * Gets details about a specific tool available to the agent
292
435
  * @param toolId - ID of the tool to retrieve
293
436
  * @returns Promise containing tool details
294
437
  */
295
438
  getTool(toolId: string): Promise<GetToolResponse>;
439
+ /**
440
+ * Executes a tool for the agent
441
+ * @param toolId - ID of the tool to execute
442
+ * @param params - Parameters required for tool execution
443
+ * @returns Promise containing the tool execution results
444
+ */
445
+ executeTool(toolId: string, params: {
446
+ data: any;
447
+ runtimeContext?: RuntimeContext;
448
+ }): Promise<any>;
296
449
  /**
297
450
  * Retrieves evaluation results for the agent
298
451
  * @returns Promise containing agent evaluations
@@ -353,9 +506,10 @@ declare class MemoryThread extends BaseResource {
353
506
  }>;
354
507
  /**
355
508
  * Retrieves messages associated with the thread
509
+ * @param params - Optional parameters including limit for number of messages to retrieve
356
510
  * @returns Promise containing thread messages and UI messages
357
511
  */
358
- getMessages(): Promise<GetMemoryThreadMessagesResponse>;
512
+ getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
359
513
  }
360
514
 
361
515
  declare class Vector extends BaseResource {
@@ -404,29 +558,22 @@ declare class Vector extends BaseResource {
404
558
  query(params: QueryVectorParams): Promise<QueryVectorResponse>;
405
559
  }
406
560
 
407
- declare class Workflow extends BaseResource {
561
+ declare class LegacyWorkflow extends BaseResource {
408
562
  private workflowId;
409
563
  constructor(options: ClientOptions, workflowId: string);
410
564
  /**
411
- * Retrieves details about the workflow
412
- * @returns Promise containing workflow details including steps and graphs
565
+ * Retrieves details about the legacy workflow
566
+ * @returns Promise containing legacy workflow details including steps and graphs
413
567
  */
414
- details(): Promise<GetWorkflowResponse>;
568
+ details(): Promise<GetLegacyWorkflowResponse>;
415
569
  /**
416
- * Retrieves all runs for a workflow
570
+ * Retrieves all runs for a legacy workflow
417
571
  * @param params - Parameters for filtering runs
418
- * @returns Promise containing workflow runs array
572
+ * @returns Promise containing legacy workflow runs array
419
573
  */
420
- runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
574
+ runs(params?: GetWorkflowRunsParams): Promise<GetLegacyWorkflowRunsResponse>;
421
575
  /**
422
- * @deprecated Use `startAsync` instead
423
- * Executes the workflow with the provided parameters
424
- * @param params - Parameters required for workflow execution
425
- * @returns Promise containing the workflow execution results
426
- */
427
- execute(params: Record<string, any>): Promise<WorkflowRunResult>;
428
- /**
429
- * Creates a new workflow run
576
+ * Creates a new legacy workflow run
430
577
  * @returns Promise containing the generated run ID
431
578
  */
432
579
  createRun(params?: {
@@ -435,7 +582,7 @@ declare class Workflow extends BaseResource {
435
582
  runId: string;
436
583
  }>;
437
584
  /**
438
- * Starts a workflow run synchronously without waiting for the workflow to complete
585
+ * Starts a legacy workflow run synchronously without waiting for the workflow to complete
439
586
  * @param params - Object containing the runId and triggerData
440
587
  * @returns Promise containing success message
441
588
  */
@@ -446,11 +593,11 @@ declare class Workflow extends BaseResource {
446
593
  message: string;
447
594
  }>;
448
595
  /**
449
- * Resumes a suspended workflow step synchronously without waiting for the workflow to complete
596
+ * Resumes a suspended legacy workflow step synchronously without waiting for the workflow to complete
450
597
  * @param stepId - ID of the step to resume
451
- * @param runId - ID of the workflow run
452
- * @param context - Context to resume the workflow with
453
- * @returns Promise containing the workflow resume results
598
+ * @param runId - ID of the legacy workflow run
599
+ * @param context - Context to resume the legacy workflow with
600
+ * @returns Promise containing the legacy workflow resume results
454
601
  */
455
602
  resume({ stepId, runId, context, }: {
456
603
  stepId: string;
@@ -467,9 +614,9 @@ declare class Workflow extends BaseResource {
467
614
  startAsync(params: {
468
615
  runId?: string;
469
616
  triggerData: Record<string, any>;
470
- }): Promise<WorkflowRunResult>;
617
+ }): Promise<LegacyWorkflowRunResult>;
471
618
  /**
472
- * Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
619
+ * Resumes a suspended legacy workflow step asynchronously and returns a promise that resolves when the workflow is complete
473
620
  * @param params - Object containing the runId, stepId, and context
474
621
  * @returns Promise containing the workflow resume results
475
622
  */
@@ -477,7 +624,7 @@ declare class Workflow extends BaseResource {
477
624
  runId: string;
478
625
  stepId: string;
479
626
  context: Record<string, any>;
480
- }): Promise<WorkflowRunResult>;
627
+ }): Promise<LegacyWorkflowRunResult>;
481
628
  /**
482
629
  * Creates an async generator that processes a readable stream and yields records
483
630
  * separated by the Record Separator character (\x1E)
@@ -487,13 +634,13 @@ declare class Workflow extends BaseResource {
487
634
  */
488
635
  private streamProcessor;
489
636
  /**
490
- * Watches workflow transitions in real-time
637
+ * Watches legacy workflow transitions in real-time
491
638
  * @param runId - Optional run ID to filter the watch stream
492
- * @returns AsyncGenerator that yields parsed records from the workflow watch stream
639
+ * @returns AsyncGenerator that yields parsed records from the legacy workflow watch stream
493
640
  */
494
641
  watch({ runId }: {
495
642
  runId?: string;
496
- }, onRecord: (record: WorkflowRunResult) => void): Promise<void>;
643
+ }, onRecord: (record: LegacyWorkflowRunResult) => void): Promise<void>;
497
644
  }
498
645
 
499
646
  declare class Tool extends BaseResource {
@@ -512,14 +659,15 @@ declare class Tool extends BaseResource {
512
659
  execute(params: {
513
660
  data: any;
514
661
  runId?: string;
662
+ runtimeContext?: RuntimeContext | Record<string, any>;
515
663
  }): Promise<any>;
516
664
  }
517
665
 
518
- declare class VNextWorkflow extends BaseResource {
666
+ declare class Workflow extends BaseResource {
519
667
  private workflowId;
520
668
  constructor(options: ClientOptions, workflowId: string);
521
669
  /**
522
- * Creates an async generator that processes a readable stream and yields vNext workflow records
670
+ * Creates an async generator that processes a readable stream and yields workflow records
523
671
  * separated by the Record Separator character (\x1E)
524
672
  *
525
673
  * @param stream - The readable stream to process
@@ -527,18 +675,30 @@ declare class VNextWorkflow extends BaseResource {
527
675
  */
528
676
  private streamProcessor;
529
677
  /**
530
- * Retrieves details about the vNext workflow
531
- * @returns Promise containing vNext workflow details including steps and graphs
678
+ * Retrieves details about the workflow
679
+ * @returns Promise containing workflow details including steps and graphs
532
680
  */
533
- details(): Promise<GetVNextWorkflowResponse>;
681
+ details(): Promise<GetWorkflowResponse>;
534
682
  /**
535
- * Retrieves all runs for a vNext workflow
683
+ * Retrieves all runs for a workflow
536
684
  * @param params - Parameters for filtering runs
537
- * @returns Promise containing vNext workflow runs array
685
+ * @returns Promise containing workflow runs array
538
686
  */
539
687
  runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
540
688
  /**
541
- * Creates a new vNext workflow run
689
+ * Retrieves a specific workflow run by its ID
690
+ * @param runId - The ID of the workflow run to retrieve
691
+ * @returns Promise containing the workflow run details
692
+ */
693
+ runById(runId: string): Promise<GetWorkflowRunByIdResponse>;
694
+ /**
695
+ * Retrieves the execution result for a specific workflow run by its ID
696
+ * @param runId - The ID of the workflow run to retrieve the execution result for
697
+ * @returns Promise containing the workflow run execution result
698
+ */
699
+ runExecutionResult(runId: string): Promise<GetWorkflowRunExecutionResultResponse>;
700
+ /**
701
+ * Creates a new workflow run
542
702
  * @param params - Optional object containing the optional runId
543
703
  * @returns Promise containing the runId of the created run
544
704
  */
@@ -548,59 +708,203 @@ declare class VNextWorkflow extends BaseResource {
548
708
  runId: string;
549
709
  }>;
550
710
  /**
551
- * Starts a vNext workflow run synchronously without waiting for the workflow to complete
711
+ * Starts a workflow run synchronously without waiting for the workflow to complete
552
712
  * @param params - Object containing the runId, inputData and runtimeContext
553
713
  * @returns Promise containing success message
554
714
  */
555
715
  start(params: {
556
716
  runId: string;
557
717
  inputData: Record<string, any>;
558
- runtimeContext?: RuntimeContext;
718
+ runtimeContext?: RuntimeContext | Record<string, any>;
559
719
  }): Promise<{
560
720
  message: string;
561
721
  }>;
562
722
  /**
563
- * Resumes a suspended vNext workflow step synchronously without waiting for the vNext workflow to complete
723
+ * Resumes a suspended workflow step synchronously without waiting for the workflow to complete
564
724
  * @param params - Object containing the runId, step, resumeData and runtimeContext
565
725
  * @returns Promise containing success message
566
726
  */
567
- resume({ step, runId, resumeData, runtimeContext, }: {
727
+ resume({ step, runId, resumeData, ...rest }: {
568
728
  step: string | string[];
569
729
  runId: string;
570
730
  resumeData?: Record<string, any>;
571
- runtimeContext?: RuntimeContext;
731
+ runtimeContext?: RuntimeContext | Record<string, any>;
572
732
  }): Promise<{
573
733
  message: string;
574
734
  }>;
575
735
  /**
576
- * Starts a vNext workflow run asynchronously and returns a promise that resolves when the vNext workflow is complete
736
+ * Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
577
737
  * @param params - Object containing the optional runId, inputData and runtimeContext
578
- * @returns Promise containing the vNext workflow execution results
738
+ * @returns Promise containing the workflow execution results
579
739
  */
580
740
  startAsync(params: {
741
+ runId?: string;
742
+ inputData: Record<string, any>;
743
+ runtimeContext?: RuntimeContext | Record<string, any>;
744
+ }): Promise<WorkflowRunResult>;
745
+ /**
746
+ * Starts a workflow run and returns a stream
747
+ * @param params - Object containing the optional runId, inputData and runtimeContext
748
+ * @returns Promise containing the workflow execution results
749
+ */
750
+ stream(params: {
581
751
  runId?: string;
582
752
  inputData: Record<string, any>;
583
753
  runtimeContext?: RuntimeContext;
584
- }): Promise<VNextWorkflowRunResult>;
754
+ }): Promise<stream_web.ReadableStream<WorkflowWatchResult>>;
585
755
  /**
586
- * Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
756
+ * Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
587
757
  * @param params - Object containing the runId, step, resumeData and runtimeContext
588
- * @returns Promise containing the vNext workflow resume results
758
+ * @returns Promise containing the workflow resume results
589
759
  */
590
760
  resumeAsync(params: {
591
761
  runId: string;
592
762
  step: string | string[];
593
763
  resumeData?: Record<string, any>;
594
- runtimeContext?: RuntimeContext;
595
- }): Promise<VNextWorkflowRunResult>;
764
+ runtimeContext?: RuntimeContext | Record<string, any>;
765
+ }): Promise<WorkflowRunResult>;
596
766
  /**
597
- * Watches vNext workflow transitions in real-time
767
+ * Watches workflow transitions in real-time
598
768
  * @param runId - Optional run ID to filter the watch stream
599
- * @returns AsyncGenerator that yields parsed records from the vNext workflow watch stream
769
+ * @returns AsyncGenerator that yields parsed records from the workflow watch stream
600
770
  */
601
771
  watch({ runId }: {
602
772
  runId?: string;
603
- }, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
773
+ }, onRecord: (record: WorkflowWatchResult) => void): Promise<void>;
774
+ /**
775
+ * Creates a new ReadableStream from an iterable or async iterable of objects,
776
+ * serializing each as JSON and separating them with the record separator (\x1E).
777
+ *
778
+ * @param records - An iterable or async iterable of objects to stream
779
+ * @returns A ReadableStream emitting the records as JSON strings separated by the record separator
780
+ */
781
+ static createRecordStream(records: Iterable<any> | AsyncIterable<any>): ReadableStream;
782
+ }
783
+
784
+ /**
785
+ * Class for interacting with an agent via the A2A protocol
786
+ */
787
+ declare class A2A extends BaseResource {
788
+ private agentId;
789
+ constructor(options: ClientOptions, agentId: string);
790
+ /**
791
+ * Get the agent card with metadata about the agent
792
+ * @returns Promise containing the agent card information
793
+ */
794
+ getCard(): Promise<AgentCard>;
795
+ /**
796
+ * Send a message to the agent and get a response
797
+ * @param params - Parameters for the task
798
+ * @returns Promise containing the task response
799
+ */
800
+ sendMessage(params: TaskSendParams): Promise<{
801
+ task: Task;
802
+ }>;
803
+ /**
804
+ * Get the status and result of a task
805
+ * @param params - Parameters for querying the task
806
+ * @returns Promise containing the task response
807
+ */
808
+ getTask(params: TaskQueryParams): Promise<Task>;
809
+ /**
810
+ * Cancel a running task
811
+ * @param params - Parameters identifying the task to cancel
812
+ * @returns Promise containing the task response
813
+ */
814
+ cancelTask(params: TaskIdParams): Promise<{
815
+ task: Task;
816
+ }>;
817
+ /**
818
+ * Send a message and subscribe to streaming updates (not fully implemented)
819
+ * @param params - Parameters for the task
820
+ * @returns Promise containing the task response
821
+ */
822
+ sendAndSubscribe(params: TaskSendParams): Promise<Response>;
823
+ }
824
+
825
+ /**
826
+ * Represents a specific tool available on a specific MCP server.
827
+ * Provides methods to get details and execute the tool.
828
+ */
829
+ declare class MCPTool extends BaseResource {
830
+ private serverId;
831
+ private toolId;
832
+ constructor(options: ClientOptions, serverId: string, toolId: string);
833
+ /**
834
+ * Retrieves details about this specific tool from the MCP server.
835
+ * @returns Promise containing the tool's information (name, description, schema).
836
+ */
837
+ details(): Promise<McpToolInfo>;
838
+ /**
839
+ * Executes this specific tool on the MCP server.
840
+ * @param params - Parameters for tool execution, including data/args and optional runtimeContext.
841
+ * @returns Promise containing the result of the tool execution.
842
+ */
843
+ execute(params: {
844
+ data?: any;
845
+ runtimeContext?: RuntimeContext;
846
+ }): Promise<any>;
847
+ }
848
+
849
+ declare class VNextNetwork extends BaseResource {
850
+ private networkId;
851
+ constructor(options: ClientOptions, networkId: string);
852
+ /**
853
+ * Retrieves details about the network
854
+ * @returns Promise containing vNext network details
855
+ */
856
+ details(): Promise<GetVNextNetworkResponse>;
857
+ /**
858
+ * Generates a response from the v-next network
859
+ * @param params - Generation parameters including message
860
+ * @returns Promise containing the generated response
861
+ */
862
+ generate(params: GenerateOrStreamVNextNetworkParams): Promise<GenerateVNextNetworkResponse>;
863
+ /**
864
+ * Generates a response from the v-next network using multiple primitives
865
+ * @param params - Generation parameters including message
866
+ * @returns Promise containing the generated response
867
+ */
868
+ loop(params: {
869
+ message: string;
870
+ }): Promise<LoopVNextNetworkResponse>;
871
+ private streamProcessor;
872
+ /**
873
+ * Streams a response from the v-next network
874
+ * @param params - Stream parameters including message
875
+ * @returns Promise containing the results
876
+ */
877
+ stream(params: GenerateOrStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
878
+ }
879
+
880
+ declare class NetworkMemoryThread extends BaseResource {
881
+ private threadId;
882
+ private networkId;
883
+ constructor(options: ClientOptions, threadId: string, networkId: string);
884
+ /**
885
+ * Retrieves the memory thread details
886
+ * @returns Promise containing thread details including title and metadata
887
+ */
888
+ get(): Promise<StorageThreadType>;
889
+ /**
890
+ * Updates the memory thread properties
891
+ * @param params - Update parameters including title and metadata
892
+ * @returns Promise containing updated thread details
893
+ */
894
+ update(params: UpdateMemoryThreadParams): Promise<StorageThreadType>;
895
+ /**
896
+ * Deletes the memory thread
897
+ * @returns Promise containing deletion result
898
+ */
899
+ delete(): Promise<{
900
+ result: string;
901
+ }>;
902
+ /**
903
+ * Retrieves messages associated with the thread
904
+ * @param params - Optional parameters including limit for number of messages to retrieve
905
+ * @returns Promise containing thread messages and UI messages
906
+ */
907
+ getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
604
908
  }
605
909
 
606
910
  declare class MastraClient extends BaseResource {
@@ -650,6 +954,37 @@ declare class MastraClient extends BaseResource {
650
954
  getMemoryStatus(agentId: string): Promise<{
651
955
  result: boolean;
652
956
  }>;
957
+ /**
958
+ * Retrieves memory threads for a resource
959
+ * @param params - Parameters containing the resource ID
960
+ * @returns Promise containing array of memory threads
961
+ */
962
+ getNetworkMemoryThreads(params: GetNetworkMemoryThreadParams): Promise<GetMemoryThreadResponse>;
963
+ /**
964
+ * Creates a new memory thread
965
+ * @param params - Parameters for creating the memory thread
966
+ * @returns Promise containing the created memory thread
967
+ */
968
+ createNetworkMemoryThread(params: CreateNetworkMemoryThreadParams): Promise<CreateMemoryThreadResponse>;
969
+ /**
970
+ * Gets a memory thread instance by ID
971
+ * @param threadId - ID of the memory thread to retrieve
972
+ * @returns MemoryThread instance
973
+ */
974
+ getNetworkMemoryThread(threadId: string, networkId: string): NetworkMemoryThread;
975
+ /**
976
+ * Saves messages to memory
977
+ * @param params - Parameters containing messages to save
978
+ * @returns Promise containing the saved messages
979
+ */
980
+ saveNetworkMessageToMemory(params: SaveNetworkMessageToMemoryParams): Promise<SaveMessageToMemoryResponse>;
981
+ /**
982
+ * Gets the status of the memory system
983
+ * @returns Promise containing memory system status
984
+ */
985
+ getNetworkMemoryStatus(networkId: string): Promise<{
986
+ result: boolean;
987
+ }>;
653
988
  /**
654
989
  * Retrieves all available tools
655
990
  * @returns Promise containing map of tool IDs to tool details
@@ -661,6 +996,17 @@ declare class MastraClient extends BaseResource {
661
996
  * @returns Tool instance
662
997
  */
663
998
  getTool(toolId: string): Tool;
999
+ /**
1000
+ * Retrieves all available legacy workflows
1001
+ * @returns Promise containing map of legacy workflow IDs to legacy workflow details
1002
+ */
1003
+ getLegacyWorkflows(): Promise<Record<string, GetLegacyWorkflowResponse>>;
1004
+ /**
1005
+ * Gets a legacy workflow instance by ID
1006
+ * @param workflowId - ID of the legacy workflow to retrieve
1007
+ * @returns Legacy Workflow instance
1008
+ */
1009
+ getLegacyWorkflow(workflowId: string): LegacyWorkflow;
664
1010
  /**
665
1011
  * Retrieves all available workflows
666
1012
  * @returns Promise containing map of workflow IDs to workflow details
@@ -672,17 +1018,6 @@ declare class MastraClient extends BaseResource {
672
1018
  * @returns Workflow instance
673
1019
  */
674
1020
  getWorkflow(workflowId: string): Workflow;
675
- /**
676
- * Retrieves all available vNext workflows
677
- * @returns Promise containing map of vNext workflow IDs to vNext workflow details
678
- */
679
- getVNextWorkflows(): Promise<Record<string, GetVNextWorkflowResponse>>;
680
- /**
681
- * Gets a vNext workflow instance by ID
682
- * @param workflowId - ID of the vNext workflow to retrieve
683
- * @returns vNext Workflow instance
684
- */
685
- getVNextWorkflow(workflowId: string): VNextWorkflow;
686
1021
  /**
687
1022
  * Gets a vector instance by name
688
1023
  * @param vectorName - Name of the vector to retrieve
@@ -718,13 +1053,62 @@ declare class MastraClient extends BaseResource {
718
1053
  * Retrieves all available networks
719
1054
  * @returns Promise containing map of network IDs to network details
720
1055
  */
721
- getNetworks(): Promise<Record<string, GetNetworkResponse>>;
1056
+ getNetworks(): Promise<Array<GetNetworkResponse>>;
1057
+ /**
1058
+ * Retrieves all available vNext networks
1059
+ * @returns Promise containing map of vNext network IDs to vNext network details
1060
+ */
1061
+ getVNextNetworks(): Promise<Array<GetVNextNetworkResponse>>;
722
1062
  /**
723
1063
  * Gets a network instance by ID
724
1064
  * @param networkId - ID of the network to retrieve
725
1065
  * @returns Network instance
726
1066
  */
727
1067
  getNetwork(networkId: string): Network;
1068
+ /**
1069
+ * Gets a vNext network instance by ID
1070
+ * @param networkId - ID of the vNext network to retrieve
1071
+ * @returns vNext Network instance
1072
+ */
1073
+ getVNextNetwork(networkId: string): VNextNetwork;
1074
+ /**
1075
+ * Retrieves a list of available MCP servers.
1076
+ * @param params - Optional parameters for pagination (limit, offset).
1077
+ * @returns Promise containing the list of MCP servers and pagination info.
1078
+ */
1079
+ getMcpServers(params?: {
1080
+ limit?: number;
1081
+ offset?: number;
1082
+ }): Promise<McpServerListResponse>;
1083
+ /**
1084
+ * Retrieves detailed information for a specific MCP server.
1085
+ * @param serverId - The ID of the MCP server to retrieve.
1086
+ * @param params - Optional parameters, e.g., specific version.
1087
+ * @returns Promise containing the detailed MCP server information.
1088
+ */
1089
+ getMcpServerDetails(serverId: string, params?: {
1090
+ version?: string;
1091
+ }): Promise<ServerDetailInfo>;
1092
+ /**
1093
+ * Retrieves a list of tools for a specific MCP server.
1094
+ * @param serverId - The ID of the MCP server.
1095
+ * @returns Promise containing the list of tools.
1096
+ */
1097
+ getMcpServerTools(serverId: string): Promise<McpServerToolListResponse>;
1098
+ /**
1099
+ * Gets an MCPTool resource instance for a specific tool on an MCP server.
1100
+ * This instance can then be used to fetch details or execute the tool.
1101
+ * @param serverId - The ID of the MCP server.
1102
+ * @param toolId - The ID of the tool.
1103
+ * @returns MCPTool instance.
1104
+ */
1105
+ getMcpServerTool(serverId: string, toolId: string): MCPTool;
1106
+ /**
1107
+ * Gets an A2A client for interacting with an agent via the A2A protocol
1108
+ * @param agentId - ID of the agent to interact with
1109
+ * @returns A2A client instance
1110
+ */
1111
+ getA2A(agentId: string): A2A;
728
1112
  }
729
1113
 
730
- 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 GetWorkflowRunsParams, type GetWorkflowRunsResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };
1114
+ 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 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 };