@mastra/client-js 0.0.0-cloud-transporter-20250513033346 → 0.0.0-cloudflare-deployer-dont-install-deps-20250714111754

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,12 +1,15 @@
1
1
  import { AbstractAgent } from '@ag-ui/client';
2
- import { processDataStream } from '@ai-sdk/ui-utils';
3
- import { StepAction, StepGraph, CoreMessage, AiMessageType, StorageThreadType, MessageType, WorkflowRuns, WorkflowRunResult as WorkflowRunResult$1, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
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';
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';
8
- import { RuntimeContext } from '@mastra/core/di';
9
- import { RuntimeContext as RuntimeContext$1 } from '@mastra/core/runtime-context';
7
+ import { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
8
+ import { LogLevel, BaseLogMessage } from '@mastra/core/logger';
9
+ import { RuntimeContext } from '@mastra/core/runtime-context';
10
+ import { Workflow as Workflow$1, WatchEvent, WorkflowResult } from '@mastra/core/workflows';
11
+ import { StepAction, StepGraph, LegacyWorkflowRunResult as LegacyWorkflowRunResult$1 } from '@mastra/core/workflows/legacy';
12
+ import * as stream_web from 'stream/web';
10
13
  import { AgentCard, TaskSendParams, Task, TaskQueryParams, TaskIdParams } from '@mastra/core/a2a';
11
14
 
12
15
  interface ClientOptions {
@@ -20,14 +23,20 @@ interface ClientOptions {
20
23
  maxBackoffMs?: number;
21
24
  /** Custom headers to include with requests */
22
25
  headers?: Record<string, string>;
26
+ /** Abort signal for request */
27
+ abortSignal?: AbortSignal;
23
28
  }
24
29
  interface RequestOptions {
25
30
  method?: string;
26
31
  headers?: Record<string, string>;
27
32
  body?: any;
28
33
  stream?: boolean;
29
- signal?: AbortSignal;
30
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
+ };
31
40
  interface GetAgentResponse {
32
41
  name: string;
33
42
  instructions: string;
@@ -35,13 +44,23 @@ interface GetAgentResponse {
35
44
  workflows: Record<string, GetWorkflowResponse>;
36
45
  provider: string;
37
46
  modelId: string;
47
+ defaultGenerateOptions: WithoutMethods<AgentGenerateOptions>;
48
+ defaultStreamOptions: WithoutMethods<AgentStreamOptions>;
38
49
  }
39
50
  type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
40
51
  messages: string | string[] | CoreMessage[] | AiMessageType[];
41
- } & Partial<Omit<AgentGenerateOptions<T>, 'experimental_generateMessageId'>>;
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'>>;
42
57
  type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
43
58
  messages: string | string[] | CoreMessage[] | AiMessageType[];
44
- } & Omit<AgentStreamOptions<T>, 'onFinish' | 'onStepFinish' | 'telemetry' | 'experimental_generateMessageId'>;
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'>>;
45
64
  interface GetEvalsByAgentIdResponse extends GetAgentResponse {
46
65
  evals: any[];
47
66
  instructions: string;
@@ -54,7 +73,7 @@ interface GetToolResponse {
54
73
  inputSchema: string;
55
74
  outputSchema: string;
56
75
  }
57
- interface GetWorkflowResponse {
76
+ interface GetLegacyWorkflowResponse {
58
77
  name: string;
59
78
  triggerSchema: string;
60
79
  steps: Record<string, StepAction<any, any, any, any>>;
@@ -69,19 +88,23 @@ interface GetWorkflowRunsParams {
69
88
  offset?: number;
70
89
  resourceId?: string;
71
90
  }
91
+ type GetLegacyWorkflowRunsResponse = LegacyWorkflowRuns;
72
92
  type GetWorkflowRunsResponse = WorkflowRuns;
73
- type WorkflowRunResult = {
93
+ type GetWorkflowRunByIdResponse = WorkflowRun;
94
+ type GetWorkflowRunExecutionResultResponse = WatchEvent['payload']['workflowState'];
95
+ type LegacyWorkflowRunResult = {
74
96
  activePaths: Record<string, {
75
97
  status: string;
76
98
  suspendPayload?: any;
77
99
  stepPath: string[];
78
100
  }>;
79
- results: WorkflowRunResult$1<any, any, any>['results'];
101
+ results: LegacyWorkflowRunResult$1<any, any, any>['results'];
80
102
  timestamp: number;
81
103
  runId: string;
82
104
  };
83
- interface GetVNextWorkflowResponse {
105
+ interface GetWorkflowResponse {
84
106
  name: string;
107
+ description?: string;
85
108
  steps: {
86
109
  [key: string]: {
87
110
  id: string;
@@ -92,14 +115,25 @@ interface GetVNextWorkflowResponse {
92
115
  suspendSchema: string;
93
116
  };
94
117
  };
95
- 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'];
96
130
  inputSchema: string;
97
131
  outputSchema: string;
98
132
  }
99
- type VNextWorkflowWatchResult = WatchEvent & {
133
+ type WorkflowWatchResult = WatchEvent & {
100
134
  runId: string;
101
135
  };
102
- type VNextWorkflowRunResult = WorkflowResult<any, any>;
136
+ type WorkflowRunResult = WorkflowResult<any, any>;
103
137
  interface UpsertVectorParams {
104
138
  indexName: string;
105
139
  vectors: number[][];
@@ -127,22 +161,37 @@ interface GetVectorIndexResponse {
127
161
  count: number;
128
162
  }
129
163
  interface SaveMessageToMemoryParams {
130
- messages: MessageType[];
164
+ messages: MastraMessageV1[];
131
165
  agentId: string;
132
166
  }
133
- type SaveMessageToMemoryResponse = MessageType[];
167
+ interface SaveNetworkMessageToMemoryParams {
168
+ messages: MastraMessageV1[];
169
+ networkId: string;
170
+ }
171
+ type SaveMessageToMemoryResponse = MastraMessageV1[];
134
172
  interface CreateMemoryThreadParams {
135
- title: string;
136
- metadata: Record<string, any>;
173
+ title?: string;
174
+ metadata?: Record<string, any>;
137
175
  resourceId: string;
138
- threadId: string;
176
+ threadId?: string;
139
177
  agentId: string;
140
178
  }
179
+ interface CreateNetworkMemoryThreadParams {
180
+ title?: string;
181
+ metadata?: Record<string, any>;
182
+ resourceId: string;
183
+ threadId?: string;
184
+ networkId: string;
185
+ }
141
186
  type CreateMemoryThreadResponse = StorageThreadType;
142
187
  interface GetMemoryThreadParams {
143
188
  resourceId: string;
144
189
  agentId: string;
145
190
  }
191
+ interface GetNetworkMemoryThreadParams {
192
+ resourceId: string;
193
+ networkId: string;
194
+ }
146
195
  type GetMemoryThreadResponse = StorageThreadType[];
147
196
  interface UpdateMemoryThreadParams {
148
197
  title: string;
@@ -161,12 +210,30 @@ interface GetMemoryThreadMessagesResponse {
161
210
  }
162
211
  interface GetLogsParams {
163
212
  transportId: string;
213
+ fromDate?: Date;
214
+ toDate?: Date;
215
+ logLevel?: LogLevel;
216
+ filters?: Record<string, string>;
217
+ page?: number;
218
+ perPage?: number;
164
219
  }
165
220
  interface GetLogParams {
166
221
  runId: string;
167
222
  transportId: string;
223
+ fromDate?: Date;
224
+ toDate?: Date;
225
+ logLevel?: LogLevel;
226
+ filters?: Record<string, string>;
227
+ page?: number;
228
+ perPage?: number;
168
229
  }
169
- type GetLogsResponse = BaseLogMessage[];
230
+ type GetLogsResponse = {
231
+ logs: BaseLogMessage[];
232
+ total: number;
233
+ page: number;
234
+ perPage: number;
235
+ hasMore: boolean;
236
+ };
170
237
  type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
171
238
  type SpanStatus = {
172
239
  code: number;
@@ -218,6 +285,7 @@ interface GetTelemetryParams {
218
285
  toDate?: Date;
219
286
  }
220
287
  interface GetNetworkResponse {
288
+ id: string;
221
289
  name: string;
222
290
  instructions: string;
223
291
  agents: Array<{
@@ -231,6 +299,71 @@ interface GetNetworkResponse {
231
299
  };
232
300
  state?: Record<string, any>;
233
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
+ }
234
367
 
235
368
  declare class BaseResource {
236
369
  readonly options: ClientOptions;
@@ -274,6 +407,13 @@ declare class AgentVoice extends BaseResource {
274
407
  voiceId: string;
275
408
  [key: string]: any;
276
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
+ }>;
277
417
  }
278
418
  declare class Agent extends BaseResource {
279
419
  private agentId;
@@ -289,14 +429,31 @@ declare class Agent extends BaseResource {
289
429
  * @param params - Generation parameters including prompt
290
430
  * @returns Promise containing the generated response
291
431
  */
292
- 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;
293
449
  /**
294
450
  * Streams a response from the agent
295
451
  * @param params - Stream parameters including prompt
296
- * @returns Promise containing the enhanced Response object with processDataStream method
452
+ * @returns Promise containing the enhanced Response object with processDataStream and processTextStream methods
297
453
  */
298
454
  stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
299
455
  processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
456
+ processTextStream: (options?: Omit<Parameters<typeof processTextStream>[0], 'stream'>) => Promise<void>;
300
457
  }>;
301
458
  /**
302
459
  * Gets details about a specific tool available to the agent
@@ -426,29 +583,22 @@ declare class Vector extends BaseResource {
426
583
  query(params: QueryVectorParams): Promise<QueryVectorResponse>;
427
584
  }
428
585
 
429
- declare class Workflow extends BaseResource {
586
+ declare class LegacyWorkflow extends BaseResource {
430
587
  private workflowId;
431
588
  constructor(options: ClientOptions, workflowId: string);
432
589
  /**
433
- * Retrieves details about the workflow
434
- * @returns Promise containing workflow details including steps and graphs
590
+ * Retrieves details about the legacy workflow
591
+ * @returns Promise containing legacy workflow details including steps and graphs
435
592
  */
436
- details(): Promise<GetWorkflowResponse>;
593
+ details(): Promise<GetLegacyWorkflowResponse>;
437
594
  /**
438
- * Retrieves all runs for a workflow
595
+ * Retrieves all runs for a legacy workflow
439
596
  * @param params - Parameters for filtering runs
440
- * @returns Promise containing workflow runs array
441
- */
442
- runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
443
- /**
444
- * @deprecated Use `startAsync` instead
445
- * Executes the workflow with the provided parameters
446
- * @param params - Parameters required for workflow execution
447
- * @returns Promise containing the workflow execution results
597
+ * @returns Promise containing legacy workflow runs array
448
598
  */
449
- execute(params: Record<string, any>): Promise<WorkflowRunResult>;
599
+ runs(params?: GetWorkflowRunsParams): Promise<GetLegacyWorkflowRunsResponse>;
450
600
  /**
451
- * Creates a new workflow run
601
+ * Creates a new legacy workflow run
452
602
  * @returns Promise containing the generated run ID
453
603
  */
454
604
  createRun(params?: {
@@ -457,7 +607,7 @@ declare class Workflow extends BaseResource {
457
607
  runId: string;
458
608
  }>;
459
609
  /**
460
- * 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
461
611
  * @param params - Object containing the runId and triggerData
462
612
  * @returns Promise containing success message
463
613
  */
@@ -468,11 +618,11 @@ declare class Workflow extends BaseResource {
468
618
  message: string;
469
619
  }>;
470
620
  /**
471
- * 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
472
622
  * @param stepId - ID of the step to resume
473
- * @param runId - ID of the workflow run
474
- * @param context - Context to resume the workflow with
475
- * @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
476
626
  */
477
627
  resume({ stepId, runId, context, }: {
478
628
  stepId: string;
@@ -489,9 +639,9 @@ declare class Workflow extends BaseResource {
489
639
  startAsync(params: {
490
640
  runId?: string;
491
641
  triggerData: Record<string, any>;
492
- }): Promise<WorkflowRunResult>;
642
+ }): Promise<LegacyWorkflowRunResult>;
493
643
  /**
494
- * 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
495
645
  * @param params - Object containing the runId, stepId, and context
496
646
  * @returns Promise containing the workflow resume results
497
647
  */
@@ -499,7 +649,7 @@ declare class Workflow extends BaseResource {
499
649
  runId: string;
500
650
  stepId: string;
501
651
  context: Record<string, any>;
502
- }): Promise<WorkflowRunResult>;
652
+ }): Promise<LegacyWorkflowRunResult>;
503
653
  /**
504
654
  * Creates an async generator that processes a readable stream and yields records
505
655
  * separated by the Record Separator character (\x1E)
@@ -509,13 +659,13 @@ declare class Workflow extends BaseResource {
509
659
  */
510
660
  private streamProcessor;
511
661
  /**
512
- * Watches workflow transitions in real-time
662
+ * Watches legacy workflow transitions in real-time
513
663
  * @param runId - Optional run ID to filter the watch stream
514
- * @returns AsyncGenerator that yields parsed records from the workflow watch stream
664
+ * @returns AsyncGenerator that yields parsed records from the legacy workflow watch stream
515
665
  */
516
666
  watch({ runId }: {
517
667
  runId?: string;
518
- }, onRecord: (record: WorkflowRunResult) => void): Promise<void>;
668
+ }, onRecord: (record: LegacyWorkflowRunResult) => void): Promise<void>;
519
669
  }
520
670
 
521
671
  declare class Tool extends BaseResource {
@@ -534,15 +684,15 @@ declare class Tool extends BaseResource {
534
684
  execute(params: {
535
685
  data: any;
536
686
  runId?: string;
537
- runtimeContext?: RuntimeContext;
687
+ runtimeContext?: RuntimeContext | Record<string, any>;
538
688
  }): Promise<any>;
539
689
  }
540
690
 
541
- declare class VNextWorkflow extends BaseResource {
691
+ declare class Workflow extends BaseResource {
542
692
  private workflowId;
543
693
  constructor(options: ClientOptions, workflowId: string);
544
694
  /**
545
- * 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
546
696
  * separated by the Record Separator character (\x1E)
547
697
  *
548
698
  * @param stream - The readable stream to process
@@ -550,18 +700,50 @@ declare class VNextWorkflow extends BaseResource {
550
700
  */
551
701
  private streamProcessor;
552
702
  /**
553
- * Retrieves details about the vNext workflow
554
- * @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
555
705
  */
556
- details(): Promise<GetVNextWorkflowResponse>;
706
+ details(): Promise<GetWorkflowResponse>;
557
707
  /**
558
- * Retrieves all runs for a vNext workflow
708
+ * Retrieves all runs for a workflow
559
709
  * @param params - Parameters for filtering runs
560
- * @returns Promise containing vNext workflow runs array
710
+ * @returns Promise containing workflow runs array
561
711
  */
562
712
  runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
563
713
  /**
564
- * Creates a new vNext workflow run
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
+ }>;
733
+ /**
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
737
+ */
738
+ sendRunEvent(params: {
739
+ runId: string;
740
+ event: string;
741
+ data: unknown;
742
+ }): Promise<{
743
+ message: string;
744
+ }>;
745
+ /**
746
+ * Creates a new workflow run
565
747
  * @param params - Optional object containing the optional runId
566
748
  * @returns Promise containing the runId of the created run
567
749
  */
@@ -571,19 +753,19 @@ declare class VNextWorkflow extends BaseResource {
571
753
  runId: string;
572
754
  }>;
573
755
  /**
574
- * 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
575
757
  * @param params - Object containing the runId, inputData and runtimeContext
576
758
  * @returns Promise containing success message
577
759
  */
578
760
  start(params: {
579
761
  runId: string;
580
762
  inputData: Record<string, any>;
581
- runtimeContext?: RuntimeContext$1;
763
+ runtimeContext?: RuntimeContext | Record<string, any>;
582
764
  }): Promise<{
583
765
  message: string;
584
766
  }>;
585
767
  /**
586
- * 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
587
769
  * @param params - Object containing the runId, step, resumeData and runtimeContext
588
770
  * @returns Promise containing success message
589
771
  */
@@ -591,39 +773,60 @@ declare class VNextWorkflow extends BaseResource {
591
773
  step: string | string[];
592
774
  runId: string;
593
775
  resumeData?: Record<string, any>;
594
- runtimeContext?: RuntimeContext$1;
776
+ runtimeContext?: RuntimeContext | Record<string, any>;
595
777
  }): Promise<{
596
778
  message: string;
597
779
  }>;
598
780
  /**
599
- * 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
600
782
  * @param params - Object containing the optional runId, inputData and runtimeContext
601
- * @returns Promise containing the vNext workflow execution results
783
+ * @returns Promise containing the workflow execution results
602
784
  */
603
785
  startAsync(params: {
604
786
  runId?: string;
605
787
  inputData: Record<string, any>;
606
- runtimeContext?: RuntimeContext$1;
607
- }): Promise<VNextWorkflowRunResult>;
788
+ runtimeContext?: RuntimeContext | Record<string, any>;
789
+ }): Promise<WorkflowRunResult>;
608
790
  /**
609
- * Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
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: {
796
+ runId?: string;
797
+ inputData: Record<string, any>;
798
+ runtimeContext?: RuntimeContext;
799
+ }): Promise<stream_web.ReadableStream<{
800
+ type: string;
801
+ payload: any;
802
+ }>>;
803
+ /**
804
+ * Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
610
805
  * @param params - Object containing the runId, step, resumeData and runtimeContext
611
- * @returns Promise containing the vNext workflow resume results
806
+ * @returns Promise containing the workflow resume results
612
807
  */
613
808
  resumeAsync(params: {
614
809
  runId: string;
615
810
  step: string | string[];
616
811
  resumeData?: Record<string, any>;
617
- runtimeContext?: RuntimeContext$1;
618
- }): Promise<VNextWorkflowRunResult>;
812
+ runtimeContext?: RuntimeContext | Record<string, any>;
813
+ }): Promise<WorkflowRunResult>;
619
814
  /**
620
- * Watches vNext workflow transitions in real-time
815
+ * Watches workflow transitions in real-time
621
816
  * @param runId - Optional run ID to filter the watch stream
622
- * @returns AsyncGenerator that yields parsed records from the vNext workflow watch stream
817
+ * @returns AsyncGenerator that yields parsed records from the workflow watch stream
623
818
  */
624
819
  watch({ runId }: {
625
820
  runId?: string;
626
- }, 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;
627
830
  }
628
831
 
629
832
  /**
@@ -667,6 +870,98 @@ declare class A2A extends BaseResource {
667
870
  sendAndSubscribe(params: TaskSendParams): Promise<Response>;
668
871
  }
669
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>;
963
+ }
964
+
670
965
  declare class MastraClient extends BaseResource {
671
966
  constructor(options: ClientOptions);
672
967
  /**
@@ -714,6 +1009,37 @@ declare class MastraClient extends BaseResource {
714
1009
  getMemoryStatus(agentId: string): Promise<{
715
1010
  result: boolean;
716
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
+ }>;
717
1043
  /**
718
1044
  * Retrieves all available tools
719
1045
  * @returns Promise containing map of tool IDs to tool details
@@ -725,6 +1051,17 @@ declare class MastraClient extends BaseResource {
725
1051
  * @returns Tool instance
726
1052
  */
727
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;
728
1065
  /**
729
1066
  * Retrieves all available workflows
730
1067
  * @returns Promise containing map of workflow IDs to workflow details
@@ -736,17 +1073,6 @@ declare class MastraClient extends BaseResource {
736
1073
  * @returns Workflow instance
737
1074
  */
738
1075
  getWorkflow(workflowId: string): Workflow;
739
- /**
740
- * Retrieves all available vNext workflows
741
- * @returns Promise containing map of vNext workflow IDs to vNext workflow details
742
- */
743
- getVNextWorkflows(): Promise<Record<string, GetVNextWorkflowResponse>>;
744
- /**
745
- * Gets a vNext workflow instance by ID
746
- * @param workflowId - ID of the vNext workflow to retrieve
747
- * @returns vNext Workflow instance
748
- */
749
- getVNextWorkflow(workflowId: string): VNextWorkflow;
750
1076
  /**
751
1077
  * Gets a vector instance by name
752
1078
  * @param vectorName - Name of the vector to retrieve
@@ -782,19 +1108,87 @@ declare class MastraClient extends BaseResource {
782
1108
  * Retrieves all available networks
783
1109
  * @returns Promise containing map of network IDs to network details
784
1110
  */
785
- 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>>;
786
1117
  /**
787
1118
  * Gets a network instance by ID
788
1119
  * @param networkId - ID of the network to retrieve
789
1120
  * @returns Network instance
790
1121
  */
791
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;
792
1161
  /**
793
1162
  * Gets an A2A client for interacting with an agent via the A2A protocol
794
1163
  * @param agentId - ID of the agent to interact with
795
1164
  * @returns A2A client instance
796
1165
  */
797
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>;
798
1192
  }
799
1193
 
800
- export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, 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 };
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 };