@mastra/client-js 0.10.17 → 0.10.18-alpha.0

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.
Files changed (58) hide show
  1. package/.turbo/turbo-build.log +2 -17
  2. package/CHANGELOG.md +12 -0
  3. package/dist/adapters/agui.d.ts +23 -0
  4. package/dist/adapters/agui.d.ts.map +1 -0
  5. package/dist/client.d.ts +265 -0
  6. package/dist/client.d.ts.map +1 -0
  7. package/dist/example.d.ts +2 -0
  8. package/dist/example.d.ts.map +1 -0
  9. package/dist/index.cjs +2 -0
  10. package/dist/index.cjs.map +1 -0
  11. package/dist/index.d.ts +4 -1328
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +2 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/resources/a2a.d.ts +44 -0
  16. package/dist/resources/a2a.d.ts.map +1 -0
  17. package/dist/resources/agent.d.ts +112 -0
  18. package/dist/resources/agent.d.ts.map +1 -0
  19. package/dist/resources/base.d.ts +13 -0
  20. package/dist/resources/base.d.ts.map +1 -0
  21. package/dist/resources/index.d.ts +11 -0
  22. package/dist/resources/index.d.ts.map +1 -0
  23. package/dist/resources/legacy-workflow.d.ts +87 -0
  24. package/dist/resources/legacy-workflow.d.ts.map +1 -0
  25. package/dist/resources/mcp-tool.d.ts +27 -0
  26. package/dist/resources/mcp-tool.d.ts.map +1 -0
  27. package/dist/resources/memory-thread.d.ts +53 -0
  28. package/dist/resources/memory-thread.d.ts.map +1 -0
  29. package/dist/resources/network-memory-thread.d.ts +47 -0
  30. package/dist/resources/network-memory-thread.d.ts.map +1 -0
  31. package/dist/resources/network.d.ts +30 -0
  32. package/dist/resources/network.d.ts.map +1 -0
  33. package/dist/resources/tool.d.ts +23 -0
  34. package/dist/resources/tool.d.ts.map +1 -0
  35. package/dist/resources/vNextNetwork.d.ts +42 -0
  36. package/dist/resources/vNextNetwork.d.ts.map +1 -0
  37. package/dist/resources/vector.d.ts +48 -0
  38. package/dist/resources/vector.d.ts.map +1 -0
  39. package/dist/resources/workflow.d.ts +154 -0
  40. package/dist/resources/workflow.d.ts.map +1 -0
  41. package/dist/types.d.ts +422 -0
  42. package/dist/types.d.ts.map +1 -0
  43. package/dist/utils/index.d.ts +3 -0
  44. package/dist/utils/index.d.ts.map +1 -0
  45. package/dist/utils/process-client-tools.d.ts +3 -0
  46. package/dist/utils/process-client-tools.d.ts.map +1 -0
  47. package/dist/utils/zod-to-json-schema.d.ts +105 -0
  48. package/dist/utils/zod-to-json-schema.d.ts.map +1 -0
  49. package/integration-tests/agui-adapter.test.ts +122 -0
  50. package/integration-tests/package.json +18 -0
  51. package/integration-tests/src/mastra/index.ts +35 -0
  52. package/integration-tests/vitest.config.ts +9 -0
  53. package/package.json +8 -5
  54. package/src/adapters/agui.test.ts +145 -3
  55. package/tsconfig.build.json +9 -0
  56. package/tsconfig.json +1 -1
  57. package/tsup.config.ts +22 -0
  58. package/dist/index.d.cts +0 -1328
package/dist/index.d.cts DELETED
@@ -1,1328 +0,0 @@
1
- import { AbstractAgent } from '@ag-ui/client';
2
- import { ServerInfo, MCPToolType, ServerDetailInfo } from '@mastra/core/mcp';
3
- import { processDataStream } from '@ai-sdk/ui-utils';
4
- import { GenerateReturn } from '@mastra/core/llm';
5
- import { JSONSchema7 } from 'json-schema';
6
- import { ZodSchema } from 'zod';
7
- import { CoreMessage, AiMessageType, StorageThreadType, StorageGetMessagesArg, PaginationInfo, MastraMessageV1, MastraMessageV2, LegacyWorkflowRuns, WorkflowRuns, WorkflowRun, QueryResult, GenerateReturn as GenerateReturn$1 } from '@mastra/core';
8
- import { AgentGenerateOptions, AgentStreamOptions, UIMessageWithMetadata, ToolsInput } from '@mastra/core/agent';
9
- export { UIMessageWithMetadata } from '@mastra/core/agent';
10
- import { LogLevel, BaseLogMessage } from '@mastra/core/logger';
11
- import { RuntimeContext } from '@mastra/core/runtime-context';
12
- import { MastraScorerEntry, ScoreRowData } from '@mastra/core/scores';
13
- import { Workflow as Workflow$1, WatchEvent, WorkflowResult } from '@mastra/core/workflows';
14
- import { StepAction, StepGraph, LegacyWorkflowRunResult as LegacyWorkflowRunResult$1 } from '@mastra/core/workflows/legacy';
15
- import * as stream_web from 'stream/web';
16
- import { AgentCard, TaskSendParams, Task, TaskQueryParams, TaskIdParams } from '@mastra/core/a2a';
17
-
18
- interface ClientOptions {
19
- /** Base URL for API requests */
20
- baseUrl: string;
21
- /** Number of retry attempts for failed requests */
22
- retries?: number;
23
- /** Initial backoff time in milliseconds between retries */
24
- backoffMs?: number;
25
- /** Maximum backoff time in milliseconds between retries */
26
- maxBackoffMs?: number;
27
- /** Custom headers to include with requests */
28
- headers?: Record<string, string>;
29
- /** Abort signal for request */
30
- abortSignal?: AbortSignal;
31
- }
32
- interface RequestOptions {
33
- method?: string;
34
- headers?: Record<string, string>;
35
- body?: any;
36
- stream?: boolean;
37
- }
38
- type WithoutMethods<T> = {
39
- [K in keyof T as T[K] extends (...args: any[]) => any ? never : T[K] extends {
40
- (): any;
41
- } ? never : T[K] extends undefined | ((...args: any[]) => any) ? never : K]: T[K];
42
- };
43
- interface GetAgentResponse {
44
- name: string;
45
- instructions: string;
46
- tools: Record<string, GetToolResponse>;
47
- workflows: Record<string, GetWorkflowResponse>;
48
- provider: string;
49
- modelId: string;
50
- defaultGenerateOptions: WithoutMethods<AgentGenerateOptions>;
51
- defaultStreamOptions: WithoutMethods<AgentStreamOptions>;
52
- }
53
- type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
54
- messages: string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[];
55
- output?: T;
56
- experimental_output?: T;
57
- runtimeContext?: RuntimeContext | Record<string, any>;
58
- clientTools?: ToolsInput;
59
- } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
60
- type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
61
- messages: string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[];
62
- output?: T;
63
- experimental_output?: T;
64
- runtimeContext?: RuntimeContext | Record<string, any>;
65
- clientTools?: ToolsInput;
66
- } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
67
- interface GetEvalsByAgentIdResponse extends GetAgentResponse {
68
- evals: any[];
69
- instructions: string;
70
- name: string;
71
- id: string;
72
- }
73
- interface GetToolResponse {
74
- id: string;
75
- description: string;
76
- inputSchema: string;
77
- outputSchema: string;
78
- }
79
- interface GetLegacyWorkflowResponse {
80
- name: string;
81
- triggerSchema: string;
82
- steps: Record<string, StepAction<any, any, any, any>>;
83
- stepGraph: StepGraph;
84
- stepSubscriberGraph: Record<string, StepGraph>;
85
- workflowId?: string;
86
- }
87
- interface GetWorkflowRunsParams {
88
- fromDate?: Date;
89
- toDate?: Date;
90
- limit?: number;
91
- offset?: number;
92
- resourceId?: string;
93
- }
94
- type GetLegacyWorkflowRunsResponse = LegacyWorkflowRuns;
95
- type GetWorkflowRunsResponse = WorkflowRuns;
96
- type GetWorkflowRunByIdResponse = WorkflowRun;
97
- type GetWorkflowRunExecutionResultResponse = WatchEvent['payload']['workflowState'];
98
- type LegacyWorkflowRunResult = {
99
- activePaths: Record<string, {
100
- status: string;
101
- suspendPayload?: any;
102
- stepPath: string[];
103
- }>;
104
- results: LegacyWorkflowRunResult$1<any, any, any>['results'];
105
- timestamp: number;
106
- runId: string;
107
- };
108
- interface GetWorkflowResponse {
109
- name: string;
110
- description?: string;
111
- steps: {
112
- [key: string]: {
113
- id: string;
114
- description: string;
115
- inputSchema: string;
116
- outputSchema: string;
117
- resumeSchema: string;
118
- suspendSchema: string;
119
- };
120
- };
121
- allSteps: {
122
- [key: string]: {
123
- id: string;
124
- description: string;
125
- inputSchema: string;
126
- outputSchema: string;
127
- resumeSchema: string;
128
- suspendSchema: string;
129
- isWorkflow: boolean;
130
- };
131
- };
132
- stepGraph: Workflow$1['serializedStepGraph'];
133
- inputSchema: string;
134
- outputSchema: string;
135
- }
136
- type WorkflowWatchResult = WatchEvent & {
137
- runId: string;
138
- };
139
- type WorkflowRunResult = WorkflowResult<any, any>;
140
- interface UpsertVectorParams {
141
- indexName: string;
142
- vectors: number[][];
143
- metadata?: Record<string, any>[];
144
- ids?: string[];
145
- }
146
- interface CreateIndexParams {
147
- indexName: string;
148
- dimension: number;
149
- metric?: 'cosine' | 'euclidean' | 'dotproduct';
150
- }
151
- interface QueryVectorParams {
152
- indexName: string;
153
- queryVector: number[];
154
- topK?: number;
155
- filter?: Record<string, any>;
156
- includeVector?: boolean;
157
- }
158
- interface QueryVectorResponse {
159
- results: QueryResult[];
160
- }
161
- interface GetVectorIndexResponse {
162
- dimension: number;
163
- metric: 'cosine' | 'euclidean' | 'dotproduct';
164
- count: number;
165
- }
166
- interface SaveMessageToMemoryParams {
167
- messages: (MastraMessageV1 | MastraMessageV2)[];
168
- agentId: string;
169
- }
170
- interface SaveNetworkMessageToMemoryParams {
171
- messages: (MastraMessageV1 | MastraMessageV2)[];
172
- networkId: string;
173
- }
174
- type SaveMessageToMemoryResponse = (MastraMessageV1 | MastraMessageV2)[];
175
- interface CreateMemoryThreadParams {
176
- title?: string;
177
- metadata?: Record<string, any>;
178
- resourceId: string;
179
- threadId?: string;
180
- agentId: string;
181
- }
182
- interface CreateNetworkMemoryThreadParams {
183
- title?: string;
184
- metadata?: Record<string, any>;
185
- resourceId: string;
186
- threadId?: string;
187
- networkId: string;
188
- }
189
- type CreateMemoryThreadResponse = StorageThreadType;
190
- interface GetMemoryThreadParams {
191
- resourceId: string;
192
- agentId: string;
193
- }
194
- interface GetNetworkMemoryThreadParams {
195
- resourceId: string;
196
- networkId: string;
197
- }
198
- type GetMemoryThreadResponse = StorageThreadType[];
199
- interface UpdateMemoryThreadParams {
200
- title: string;
201
- metadata: Record<string, any>;
202
- resourceId: string;
203
- }
204
- interface GetMemoryThreadMessagesParams {
205
- /**
206
- * Limit the number of messages to retrieve (default: 40)
207
- */
208
- limit?: number;
209
- }
210
- type GetMemoryThreadMessagesPaginatedParams = Omit<StorageGetMessagesArg, 'threadConfig' | 'threadId'>;
211
- interface GetMemoryThreadMessagesResponse {
212
- messages: CoreMessage[];
213
- uiMessages: AiMessageType[];
214
- }
215
- type GetMemoryThreadMessagesPaginatedResponse = PaginationInfo & {
216
- messages: MastraMessageV1[] | MastraMessageV2[];
217
- };
218
- interface GetLogsParams {
219
- transportId: string;
220
- fromDate?: Date;
221
- toDate?: Date;
222
- logLevel?: LogLevel;
223
- filters?: Record<string, string>;
224
- page?: number;
225
- perPage?: number;
226
- }
227
- interface GetLogParams {
228
- runId: string;
229
- transportId: string;
230
- fromDate?: Date;
231
- toDate?: Date;
232
- logLevel?: LogLevel;
233
- filters?: Record<string, string>;
234
- page?: number;
235
- perPage?: number;
236
- }
237
- type GetLogsResponse = {
238
- logs: BaseLogMessage[];
239
- total: number;
240
- page: number;
241
- perPage: number;
242
- hasMore: boolean;
243
- };
244
- type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
245
- type SpanStatus = {
246
- code: number;
247
- };
248
- type SpanOther = {
249
- droppedAttributesCount: number;
250
- droppedEventsCount: number;
251
- droppedLinksCount: number;
252
- };
253
- type SpanEventAttributes = {
254
- key: string;
255
- value: {
256
- [key: string]: string | number | boolean | null;
257
- };
258
- };
259
- type SpanEvent = {
260
- attributes: SpanEventAttributes[];
261
- name: string;
262
- timeUnixNano: string;
263
- droppedAttributesCount: number;
264
- };
265
- type Span = {
266
- id: string;
267
- parentSpanId: string | null;
268
- traceId: string;
269
- name: string;
270
- scope: string;
271
- kind: number;
272
- status: SpanStatus;
273
- events: SpanEvent[];
274
- links: any[];
275
- attributes: Record<string, string | number | boolean | null>;
276
- startTime: number;
277
- endTime: number;
278
- duration: number;
279
- other: SpanOther;
280
- createdAt: string;
281
- };
282
- interface GetTelemetryResponse {
283
- traces: Span[];
284
- }
285
- interface GetTelemetryParams {
286
- name?: string;
287
- scope?: string;
288
- page?: number;
289
- perPage?: number;
290
- attribute?: Record<string, string>;
291
- fromDate?: Date;
292
- toDate?: Date;
293
- }
294
- interface GetNetworkResponse {
295
- id: string;
296
- name: string;
297
- instructions: string;
298
- agents: Array<{
299
- name: string;
300
- provider: string;
301
- modelId: string;
302
- }>;
303
- routingModel: {
304
- provider: string;
305
- modelId: string;
306
- };
307
- state?: Record<string, any>;
308
- }
309
- interface GetVNextNetworkResponse {
310
- id: string;
311
- name: string;
312
- instructions: string;
313
- agents: Array<{
314
- name: string;
315
- provider: string;
316
- modelId: string;
317
- }>;
318
- routingModel: {
319
- provider: string;
320
- modelId: string;
321
- };
322
- workflows: Array<{
323
- name: string;
324
- description: string;
325
- inputSchema: string | undefined;
326
- outputSchema: string | undefined;
327
- }>;
328
- tools: Array<{
329
- id: string;
330
- description: string;
331
- }>;
332
- }
333
- interface GenerateVNextNetworkResponse {
334
- task: string;
335
- result: string;
336
- resourceId: string;
337
- resourceType: 'none' | 'tool' | 'agent' | 'workflow';
338
- }
339
- interface GenerateOrStreamVNextNetworkParams {
340
- message: string;
341
- threadId?: string;
342
- resourceId?: string;
343
- runtimeContext?: RuntimeContext | Record<string, any>;
344
- }
345
- interface LoopStreamVNextNetworkParams {
346
- message: string;
347
- threadId?: string;
348
- resourceId?: string;
349
- maxIterations?: number;
350
- runtimeContext?: RuntimeContext | Record<string, any>;
351
- }
352
- interface LoopVNextNetworkResponse {
353
- status: 'success';
354
- result: {
355
- task: string;
356
- resourceId: string;
357
- resourceType: 'agent' | 'workflow' | 'none' | 'tool';
358
- result: string;
359
- iteration: number;
360
- isOneOff: boolean;
361
- prompt: string;
362
- threadId?: string | undefined;
363
- threadResourceId?: string | undefined;
364
- isComplete?: boolean | undefined;
365
- completionReason?: string | undefined;
366
- };
367
- steps: WorkflowResult<any, any>['steps'];
368
- }
369
- interface McpServerListResponse {
370
- servers: ServerInfo[];
371
- next: string | null;
372
- total_count: number;
373
- }
374
- interface McpToolInfo {
375
- id: string;
376
- name: string;
377
- description?: string;
378
- inputSchema: string;
379
- toolType?: MCPToolType;
380
- }
381
- interface McpServerToolListResponse {
382
- tools: McpToolInfo[];
383
- }
384
- type ClientScoreRowData = Omit<ScoreRowData, 'createdAt' | 'updatedAt'> & {
385
- createdAt: string;
386
- updatedAt: string;
387
- };
388
- interface GetScoresByRunIdParams {
389
- runId: string;
390
- page?: number;
391
- perPage?: number;
392
- }
393
- interface GetScoresByScorerIdParams {
394
- scorerId: string;
395
- entityId?: string;
396
- entityType?: string;
397
- page?: number;
398
- perPage?: number;
399
- }
400
- interface GetScoresByEntityIdParams {
401
- entityId: string;
402
- entityType: string;
403
- page?: number;
404
- perPage?: number;
405
- }
406
- interface SaveScoreParams {
407
- score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>;
408
- }
409
- interface GetScoresResponse {
410
- pagination: {
411
- total: number;
412
- page: number;
413
- perPage: number;
414
- hasMore: boolean;
415
- };
416
- scores: ClientScoreRowData[];
417
- }
418
- interface SaveScoreResponse {
419
- score: ClientScoreRowData;
420
- }
421
- type GetScorerResponse = MastraScorerEntry & {
422
- agentIds: string[];
423
- workflowIds: string[];
424
- };
425
- interface GetScorersResponse {
426
- scorers: Array<GetScorerResponse>;
427
- }
428
-
429
- declare class BaseResource {
430
- readonly options: ClientOptions;
431
- constructor(options: ClientOptions);
432
- /**
433
- * Makes an HTTP request to the API with retries and exponential backoff
434
- * @param path - The API endpoint path
435
- * @param options - Optional request configuration
436
- * @returns Promise containing the response data
437
- */
438
- request<T>(path: string, options?: RequestOptions): Promise<T>;
439
- }
440
-
441
- declare class AgentVoice extends BaseResource {
442
- private agentId;
443
- constructor(options: ClientOptions, agentId: string);
444
- /**
445
- * Convert text to speech using the agent's voice provider
446
- * @param text - Text to convert to speech
447
- * @param options - Optional provider-specific options for speech generation
448
- * @returns Promise containing the audio data
449
- */
450
- speak(text: string, options?: {
451
- speaker?: string;
452
- [key: string]: any;
453
- }): Promise<Response>;
454
- /**
455
- * Convert speech to text using the agent's voice provider
456
- * @param audio - Audio data to transcribe
457
- * @param options - Optional provider-specific options
458
- * @returns Promise containing the transcribed text
459
- */
460
- listen(audio: Blob, options?: Record<string, any>): Promise<{
461
- text: string;
462
- }>;
463
- /**
464
- * Get available speakers for the agent's voice provider
465
- * @returns Promise containing list of available speakers
466
- */
467
- getSpeakers(): Promise<Array<{
468
- voiceId: string;
469
- [key: string]: any;
470
- }>>;
471
- /**
472
- * Get the listener configuration for the agent's voice provider
473
- * @returns Promise containing a check if the agent has listening capabilities
474
- */
475
- getListener(): Promise<{
476
- enabled: boolean;
477
- }>;
478
- }
479
- declare class Agent extends BaseResource {
480
- private agentId;
481
- readonly voice: AgentVoice;
482
- constructor(options: ClientOptions, agentId: string);
483
- /**
484
- * Retrieves details about the agent
485
- * @returns Promise containing agent details including model and instructions
486
- */
487
- details(): Promise<GetAgentResponse>;
488
- /**
489
- * Generates a response from the agent
490
- * @param params - Generation parameters including prompt
491
- * @returns Promise containing the generated response
492
- */
493
- generate(params: GenerateParams<undefined> & {
494
- output?: never;
495
- experimental_output?: never;
496
- }): Promise<GenerateReturn<any, undefined, undefined>>;
497
- generate<Output extends JSONSchema7 | ZodSchema>(params: GenerateParams<Output> & {
498
- output: Output;
499
- experimental_output?: never;
500
- }): Promise<GenerateReturn<any, Output, undefined>>;
501
- generate<StructuredOutput extends JSONSchema7 | ZodSchema>(params: GenerateParams<StructuredOutput> & {
502
- output?: never;
503
- experimental_output: StructuredOutput;
504
- }): Promise<GenerateReturn<any, undefined, StructuredOutput>>;
505
- private processChatResponse;
506
- /**
507
- * Streams a response from the agent
508
- * @param params - Stream parameters including prompt
509
- * @returns Promise containing the enhanced Response object with processDataStream method
510
- */
511
- stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
512
- processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
513
- }>;
514
- /**
515
- * Processes the stream response and handles tool calls
516
- */
517
- private processStreamResponse;
518
- /**
519
- * Gets details about a specific tool available to the agent
520
- * @param toolId - ID of the tool to retrieve
521
- * @returns Promise containing tool details
522
- */
523
- getTool(toolId: string): Promise<GetToolResponse>;
524
- /**
525
- * Executes a tool for the agent
526
- * @param toolId - ID of the tool to execute
527
- * @param params - Parameters required for tool execution
528
- * @returns Promise containing the tool execution results
529
- */
530
- executeTool(toolId: string, params: {
531
- data: any;
532
- runtimeContext?: RuntimeContext;
533
- }): Promise<any>;
534
- /**
535
- * Retrieves evaluation results for the agent
536
- * @returns Promise containing agent evaluations
537
- */
538
- evals(): Promise<GetEvalsByAgentIdResponse>;
539
- /**
540
- * Retrieves live evaluation results for the agent
541
- * @returns Promise containing live agent evaluations
542
- */
543
- liveEvals(): Promise<GetEvalsByAgentIdResponse>;
544
- }
545
-
546
- declare class Network extends BaseResource {
547
- private networkId;
548
- constructor(options: ClientOptions, networkId: string);
549
- /**
550
- * Retrieves details about the network
551
- * @returns Promise containing network details
552
- */
553
- details(): Promise<GetNetworkResponse>;
554
- /**
555
- * Generates a response from the agent
556
- * @param params - Generation parameters including prompt
557
- * @returns Promise containing the generated response
558
- */
559
- generate<Output extends JSONSchema7 | ZodSchema | undefined = undefined, StructuredOutput extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<Output>): Promise<GenerateReturn$1<any, Output, StructuredOutput>>;
560
- /**
561
- * Streams a response from the agent
562
- * @param params - Stream parameters including prompt
563
- * @returns Promise containing the enhanced Response object with processDataStream method
564
- */
565
- stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
566
- processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
567
- }>;
568
- }
569
-
570
- declare class MemoryThread extends BaseResource {
571
- private threadId;
572
- private agentId;
573
- constructor(options: ClientOptions, threadId: string, agentId: string);
574
- /**
575
- * Retrieves the memory thread details
576
- * @returns Promise containing thread details including title and metadata
577
- */
578
- get(): Promise<StorageThreadType>;
579
- /**
580
- * Updates the memory thread properties
581
- * @param params - Update parameters including title and metadata
582
- * @returns Promise containing updated thread details
583
- */
584
- update(params: UpdateMemoryThreadParams): Promise<StorageThreadType>;
585
- /**
586
- * Deletes the memory thread
587
- * @returns Promise containing deletion result
588
- */
589
- delete(): Promise<{
590
- result: string;
591
- }>;
592
- /**
593
- * Retrieves messages associated with the thread
594
- * @param params - Optional parameters including limit for number of messages to retrieve
595
- * @returns Promise containing thread messages and UI messages
596
- */
597
- getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
598
- /**
599
- * Retrieves paginated messages associated with the thread with advanced filtering and selection options
600
- * @param params - Pagination parameters including selectBy criteria, page, perPage, date ranges, and message inclusion options
601
- * @returns Promise containing paginated thread messages with pagination metadata (total, page, perPage, hasMore)
602
- */
603
- getMessagesPaginated({ selectBy, ...rest }: GetMemoryThreadMessagesPaginatedParams): Promise<GetMemoryThreadMessagesPaginatedResponse>;
604
- /**
605
- * Deletes one or more messages from the thread
606
- * @param messageIds - Can be a single message ID (string), array of message IDs,
607
- * message object with id property, or array of message objects
608
- * @returns Promise containing deletion result
609
- */
610
- deleteMessages(messageIds: string | string[] | {
611
- id: string;
612
- } | {
613
- id: string;
614
- }[]): Promise<{
615
- success: boolean;
616
- message: string;
617
- }>;
618
- }
619
-
620
- declare class Vector extends BaseResource {
621
- private vectorName;
622
- constructor(options: ClientOptions, vectorName: string);
623
- /**
624
- * Retrieves details about a specific vector index
625
- * @param indexName - Name of the index to get details for
626
- * @returns Promise containing vector index details
627
- */
628
- details(indexName: string): Promise<GetVectorIndexResponse>;
629
- /**
630
- * Deletes a vector index
631
- * @param indexName - Name of the index to delete
632
- * @returns Promise indicating deletion success
633
- */
634
- delete(indexName: string): Promise<{
635
- success: boolean;
636
- }>;
637
- /**
638
- * Retrieves a list of all available indexes
639
- * @returns Promise containing array of index names
640
- */
641
- getIndexes(): Promise<{
642
- indexes: string[];
643
- }>;
644
- /**
645
- * Creates a new vector index
646
- * @param params - Parameters for index creation including dimension and metric
647
- * @returns Promise indicating creation success
648
- */
649
- createIndex(params: CreateIndexParams): Promise<{
650
- success: boolean;
651
- }>;
652
- /**
653
- * Upserts vectors into an index
654
- * @param params - Parameters containing vectors, metadata, and optional IDs
655
- * @returns Promise containing array of vector IDs
656
- */
657
- upsert(params: UpsertVectorParams): Promise<string[]>;
658
- /**
659
- * Queries vectors in an index
660
- * @param params - Query parameters including query vector and search options
661
- * @returns Promise containing query results
662
- */
663
- query(params: QueryVectorParams): Promise<QueryVectorResponse>;
664
- }
665
-
666
- declare class LegacyWorkflow extends BaseResource {
667
- private workflowId;
668
- constructor(options: ClientOptions, workflowId: string);
669
- /**
670
- * Retrieves details about the legacy workflow
671
- * @returns Promise containing legacy workflow details including steps and graphs
672
- */
673
- details(): Promise<GetLegacyWorkflowResponse>;
674
- /**
675
- * Retrieves all runs for a legacy workflow
676
- * @param params - Parameters for filtering runs
677
- * @returns Promise containing legacy workflow runs array
678
- */
679
- runs(params?: GetWorkflowRunsParams): Promise<GetLegacyWorkflowRunsResponse>;
680
- /**
681
- * Creates a new legacy workflow run
682
- * @returns Promise containing the generated run ID
683
- */
684
- createRun(params?: {
685
- runId?: string;
686
- }): Promise<{
687
- runId: string;
688
- }>;
689
- /**
690
- * Starts a legacy workflow run synchronously without waiting for the workflow to complete
691
- * @param params - Object containing the runId and triggerData
692
- * @returns Promise containing success message
693
- */
694
- start(params: {
695
- runId: string;
696
- triggerData: Record<string, any>;
697
- }): Promise<{
698
- message: string;
699
- }>;
700
- /**
701
- * Resumes a suspended legacy workflow step synchronously without waiting for the workflow to complete
702
- * @param stepId - ID of the step to resume
703
- * @param runId - ID of the legacy workflow run
704
- * @param context - Context to resume the legacy workflow with
705
- * @returns Promise containing the legacy workflow resume results
706
- */
707
- resume({ stepId, runId, context, }: {
708
- stepId: string;
709
- runId: string;
710
- context: Record<string, any>;
711
- }): Promise<{
712
- message: string;
713
- }>;
714
- /**
715
- * Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
716
- * @param params - Object containing the optional runId and triggerData
717
- * @returns Promise containing the workflow execution results
718
- */
719
- startAsync(params: {
720
- runId?: string;
721
- triggerData: Record<string, any>;
722
- }): Promise<LegacyWorkflowRunResult>;
723
- /**
724
- * Resumes a suspended legacy workflow step asynchronously and returns a promise that resolves when the workflow is complete
725
- * @param params - Object containing the runId, stepId, and context
726
- * @returns Promise containing the workflow resume results
727
- */
728
- resumeAsync(params: {
729
- runId: string;
730
- stepId: string;
731
- context: Record<string, any>;
732
- }): Promise<LegacyWorkflowRunResult>;
733
- /**
734
- * Creates an async generator that processes a readable stream and yields records
735
- * separated by the Record Separator character (\x1E)
736
- *
737
- * @param stream - The readable stream to process
738
- * @returns An async generator that yields parsed records
739
- */
740
- private streamProcessor;
741
- /**
742
- * Watches legacy workflow transitions in real-time
743
- * @param runId - Optional run ID to filter the watch stream
744
- * @returns AsyncGenerator that yields parsed records from the legacy workflow watch stream
745
- */
746
- watch({ runId }: {
747
- runId?: string;
748
- }, onRecord: (record: LegacyWorkflowRunResult) => void): Promise<void>;
749
- }
750
-
751
- declare class Tool extends BaseResource {
752
- private toolId;
753
- constructor(options: ClientOptions, toolId: string);
754
- /**
755
- * Retrieves details about the tool
756
- * @returns Promise containing tool details including description and schemas
757
- */
758
- details(): Promise<GetToolResponse>;
759
- /**
760
- * Executes the tool with the provided parameters
761
- * @param params - Parameters required for tool execution
762
- * @returns Promise containing the tool execution results
763
- */
764
- execute(params: {
765
- data: any;
766
- runId?: string;
767
- runtimeContext?: RuntimeContext | Record<string, any>;
768
- }): Promise<any>;
769
- }
770
-
771
- declare class Workflow extends BaseResource {
772
- private workflowId;
773
- constructor(options: ClientOptions, workflowId: string);
774
- /**
775
- * Creates an async generator that processes a readable stream and yields workflow records
776
- * separated by the Record Separator character (\x1E)
777
- *
778
- * @param stream - The readable stream to process
779
- * @returns An async generator that yields parsed records
780
- */
781
- private streamProcessor;
782
- /**
783
- * Retrieves details about the workflow
784
- * @returns Promise containing workflow details including steps and graphs
785
- */
786
- details(): Promise<GetWorkflowResponse>;
787
- /**
788
- * Retrieves all runs for a workflow
789
- * @param params - Parameters for filtering runs
790
- * @returns Promise containing workflow runs array
791
- */
792
- runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
793
- /**
794
- * Retrieves a specific workflow run by its ID
795
- * @param runId - The ID of the workflow run to retrieve
796
- * @returns Promise containing the workflow run details
797
- */
798
- runById(runId: string): Promise<GetWorkflowRunByIdResponse>;
799
- /**
800
- * Retrieves the execution result for a specific workflow run by its ID
801
- * @param runId - The ID of the workflow run to retrieve the execution result for
802
- * @returns Promise containing the workflow run execution result
803
- */
804
- runExecutionResult(runId: string): Promise<GetWorkflowRunExecutionResultResponse>;
805
- /**
806
- * Cancels a specific workflow run by its ID
807
- * @param runId - The ID of the workflow run to cancel
808
- * @returns Promise containing a success message
809
- */
810
- cancelRun(runId: string): Promise<{
811
- message: string;
812
- }>;
813
- /**
814
- * Sends an event to a specific workflow run by its ID
815
- * @param params - Object containing the runId, event and data
816
- * @returns Promise containing a success message
817
- */
818
- sendRunEvent(params: {
819
- runId: string;
820
- event: string;
821
- data: unknown;
822
- }): Promise<{
823
- message: string;
824
- }>;
825
- /**
826
- * Creates a new workflow run
827
- * @param params - Optional object containing the optional runId
828
- * @returns Promise containing the runId of the created run
829
- */
830
- createRun(params?: {
831
- runId?: string;
832
- }): Promise<{
833
- runId: string;
834
- }>;
835
- /**
836
- * Creates a new workflow run (alias for createRun)
837
- * @param params - Optional object containing the optional runId
838
- * @returns Promise containing the runId of the created run
839
- */
840
- createRunAsync(params?: {
841
- runId?: string;
842
- }): Promise<{
843
- runId: string;
844
- }>;
845
- /**
846
- * Starts a workflow run synchronously without waiting for the workflow to complete
847
- * @param params - Object containing the runId, inputData and runtimeContext
848
- * @returns Promise containing success message
849
- */
850
- start(params: {
851
- runId: string;
852
- inputData: Record<string, any>;
853
- runtimeContext?: RuntimeContext | Record<string, any>;
854
- }): Promise<{
855
- message: string;
856
- }>;
857
- /**
858
- * Resumes a suspended workflow step synchronously without waiting for the workflow to complete
859
- * @param params - Object containing the runId, step, resumeData and runtimeContext
860
- * @returns Promise containing success message
861
- */
862
- resume({ step, runId, resumeData, ...rest }: {
863
- step: string | string[];
864
- runId: string;
865
- resumeData?: Record<string, any>;
866
- runtimeContext?: RuntimeContext | Record<string, any>;
867
- }): Promise<{
868
- message: string;
869
- }>;
870
- /**
871
- * Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
872
- * @param params - Object containing the optional runId, inputData and runtimeContext
873
- * @returns Promise containing the workflow execution results
874
- */
875
- startAsync(params: {
876
- runId?: string;
877
- inputData: Record<string, any>;
878
- runtimeContext?: RuntimeContext | Record<string, any>;
879
- }): Promise<WorkflowRunResult>;
880
- /**
881
- * Starts a workflow run and returns a stream
882
- * @param params - Object containing the optional runId, inputData and runtimeContext
883
- * @returns Promise containing the workflow execution results
884
- */
885
- stream(params: {
886
- runId?: string;
887
- inputData: Record<string, any>;
888
- runtimeContext?: RuntimeContext;
889
- }): Promise<stream_web.ReadableStream<{
890
- type: string;
891
- payload: any;
892
- }>>;
893
- /**
894
- * Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
895
- * @param params - Object containing the runId, step, resumeData and runtimeContext
896
- * @returns Promise containing the workflow resume results
897
- */
898
- resumeAsync(params: {
899
- runId: string;
900
- step: string | string[];
901
- resumeData?: Record<string, any>;
902
- runtimeContext?: RuntimeContext | Record<string, any>;
903
- }): Promise<WorkflowRunResult>;
904
- /**
905
- * Watches workflow transitions in real-time
906
- * @param runId - Optional run ID to filter the watch stream
907
- * @returns AsyncGenerator that yields parsed records from the workflow watch stream
908
- */
909
- watch({ runId }: {
910
- runId?: string;
911
- }, onRecord: (record: WorkflowWatchResult) => void): Promise<void>;
912
- /**
913
- * Creates a new ReadableStream from an iterable or async iterable of objects,
914
- * serializing each as JSON and separating them with the record separator (\x1E).
915
- *
916
- * @param records - An iterable or async iterable of objects to stream
917
- * @returns A ReadableStream emitting the records as JSON strings separated by the record separator
918
- */
919
- static createRecordStream(records: Iterable<any> | AsyncIterable<any>): ReadableStream;
920
- }
921
-
922
- /**
923
- * Class for interacting with an agent via the A2A protocol
924
- */
925
- declare class A2A extends BaseResource {
926
- private agentId;
927
- constructor(options: ClientOptions, agentId: string);
928
- /**
929
- * Get the agent card with metadata about the agent
930
- * @returns Promise containing the agent card information
931
- */
932
- getCard(): Promise<AgentCard>;
933
- /**
934
- * Send a message to the agent and get a response
935
- * @param params - Parameters for the task
936
- * @returns Promise containing the task response
937
- */
938
- sendMessage(params: TaskSendParams): Promise<{
939
- task: Task;
940
- }>;
941
- /**
942
- * Get the status and result of a task
943
- * @param params - Parameters for querying the task
944
- * @returns Promise containing the task response
945
- */
946
- getTask(params: TaskQueryParams): Promise<Task>;
947
- /**
948
- * Cancel a running task
949
- * @param params - Parameters identifying the task to cancel
950
- * @returns Promise containing the task response
951
- */
952
- cancelTask(params: TaskIdParams): Promise<{
953
- task: Task;
954
- }>;
955
- /**
956
- * Send a message and subscribe to streaming updates (not fully implemented)
957
- * @param params - Parameters for the task
958
- * @returns Promise containing the task response
959
- */
960
- sendAndSubscribe(params: TaskSendParams): Promise<Response>;
961
- }
962
-
963
- /**
964
- * Represents a specific tool available on a specific MCP server.
965
- * Provides methods to get details and execute the tool.
966
- */
967
- declare class MCPTool extends BaseResource {
968
- private serverId;
969
- private toolId;
970
- constructor(options: ClientOptions, serverId: string, toolId: string);
971
- /**
972
- * Retrieves details about this specific tool from the MCP server.
973
- * @returns Promise containing the tool's information (name, description, schema).
974
- */
975
- details(): Promise<McpToolInfo>;
976
- /**
977
- * Executes this specific tool on the MCP server.
978
- * @param params - Parameters for tool execution, including data/args and optional runtimeContext.
979
- * @returns Promise containing the result of the tool execution.
980
- */
981
- execute(params: {
982
- data?: any;
983
- runtimeContext?: RuntimeContext;
984
- }): Promise<any>;
985
- }
986
-
987
- declare class NetworkMemoryThread extends BaseResource {
988
- private threadId;
989
- private networkId;
990
- constructor(options: ClientOptions, threadId: string, networkId: string);
991
- /**
992
- * Retrieves the memory thread details
993
- * @returns Promise containing thread details including title and metadata
994
- */
995
- get(): Promise<StorageThreadType>;
996
- /**
997
- * Updates the memory thread properties
998
- * @param params - Update parameters including title and metadata
999
- * @returns Promise containing updated thread details
1000
- */
1001
- update(params: UpdateMemoryThreadParams): Promise<StorageThreadType>;
1002
- /**
1003
- * Deletes the memory thread
1004
- * @returns Promise containing deletion result
1005
- */
1006
- delete(): Promise<{
1007
- result: string;
1008
- }>;
1009
- /**
1010
- * Retrieves messages associated with the thread
1011
- * @param params - Optional parameters including limit for number of messages to retrieve
1012
- * @returns Promise containing thread messages and UI messages
1013
- */
1014
- getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
1015
- /**
1016
- * Deletes one or more messages from the thread
1017
- * @param messageIds - Can be a single message ID (string), array of message IDs,
1018
- * message object with id property, or array of message objects
1019
- * @returns Promise containing deletion result
1020
- */
1021
- deleteMessages(messageIds: string | string[] | {
1022
- id: string;
1023
- } | {
1024
- id: string;
1025
- }[]): Promise<{
1026
- success: boolean;
1027
- message: string;
1028
- }>;
1029
- }
1030
-
1031
- declare class VNextNetwork extends BaseResource {
1032
- private networkId;
1033
- constructor(options: ClientOptions, networkId: string);
1034
- /**
1035
- * Retrieves details about the network
1036
- * @returns Promise containing vNext network details
1037
- */
1038
- details(): Promise<GetVNextNetworkResponse>;
1039
- /**
1040
- * Generates a response from the v-next network
1041
- * @param params - Generation parameters including message
1042
- * @returns Promise containing the generated response
1043
- */
1044
- generate(params: GenerateOrStreamVNextNetworkParams): Promise<GenerateVNextNetworkResponse>;
1045
- /**
1046
- * Generates a response from the v-next network using multiple primitives
1047
- * @param params - Generation parameters including message
1048
- * @returns Promise containing the generated response
1049
- */
1050
- loop(params: {
1051
- message: string;
1052
- runtimeContext?: RuntimeContext | Record<string, any>;
1053
- }): Promise<LoopVNextNetworkResponse>;
1054
- private streamProcessor;
1055
- /**
1056
- * Streams a response from the v-next network
1057
- * @param params - Stream parameters including message
1058
- * @returns Promise containing the results
1059
- */
1060
- stream(params: GenerateOrStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
1061
- /**
1062
- * Streams a response from the v-next network loop
1063
- * @param params - Stream parameters including message
1064
- * @returns Promise containing the results
1065
- */
1066
- loopStream(params: LoopStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
1067
- }
1068
-
1069
- declare class MastraClient extends BaseResource {
1070
- constructor(options: ClientOptions);
1071
- /**
1072
- * Retrieves all available agents
1073
- * @returns Promise containing map of agent IDs to agent details
1074
- */
1075
- getAgents(): Promise<Record<string, GetAgentResponse>>;
1076
- getAGUI({ resourceId }: {
1077
- resourceId: string;
1078
- }): Promise<Record<string, AbstractAgent>>;
1079
- /**
1080
- * Gets an agent instance by ID
1081
- * @param agentId - ID of the agent to retrieve
1082
- * @returns Agent instance
1083
- */
1084
- getAgent(agentId: string): Agent;
1085
- /**
1086
- * Retrieves memory threads for a resource
1087
- * @param params - Parameters containing the resource ID
1088
- * @returns Promise containing array of memory threads
1089
- */
1090
- getMemoryThreads(params: GetMemoryThreadParams): Promise<GetMemoryThreadResponse>;
1091
- /**
1092
- * Creates a new memory thread
1093
- * @param params - Parameters for creating the memory thread
1094
- * @returns Promise containing the created memory thread
1095
- */
1096
- createMemoryThread(params: CreateMemoryThreadParams): Promise<CreateMemoryThreadResponse>;
1097
- /**
1098
- * Gets a memory thread instance by ID
1099
- * @param threadId - ID of the memory thread to retrieve
1100
- * @returns MemoryThread instance
1101
- */
1102
- getMemoryThread(threadId: string, agentId: string): MemoryThread;
1103
- /**
1104
- * Saves messages to memory
1105
- * @param params - Parameters containing messages to save
1106
- * @returns Promise containing the saved messages
1107
- */
1108
- saveMessageToMemory(params: SaveMessageToMemoryParams): Promise<SaveMessageToMemoryResponse>;
1109
- /**
1110
- * Gets the status of the memory system
1111
- * @returns Promise containing memory system status
1112
- */
1113
- getMemoryStatus(agentId: string): Promise<{
1114
- result: boolean;
1115
- }>;
1116
- /**
1117
- * Retrieves memory threads for a resource
1118
- * @param params - Parameters containing the resource ID
1119
- * @returns Promise containing array of memory threads
1120
- */
1121
- getNetworkMemoryThreads(params: GetNetworkMemoryThreadParams): Promise<GetMemoryThreadResponse>;
1122
- /**
1123
- * Creates a new memory thread
1124
- * @param params - Parameters for creating the memory thread
1125
- * @returns Promise containing the created memory thread
1126
- */
1127
- createNetworkMemoryThread(params: CreateNetworkMemoryThreadParams): Promise<CreateMemoryThreadResponse>;
1128
- /**
1129
- * Gets a memory thread instance by ID
1130
- * @param threadId - ID of the memory thread to retrieve
1131
- * @returns MemoryThread instance
1132
- */
1133
- getNetworkMemoryThread(threadId: string, networkId: string): NetworkMemoryThread;
1134
- /**
1135
- * Saves messages to memory
1136
- * @param params - Parameters containing messages to save
1137
- * @returns Promise containing the saved messages
1138
- */
1139
- saveNetworkMessageToMemory(params: SaveNetworkMessageToMemoryParams): Promise<SaveMessageToMemoryResponse>;
1140
- /**
1141
- * Gets the status of the memory system
1142
- * @returns Promise containing memory system status
1143
- */
1144
- getNetworkMemoryStatus(networkId: string): Promise<{
1145
- result: boolean;
1146
- }>;
1147
- /**
1148
- * Retrieves all available tools
1149
- * @returns Promise containing map of tool IDs to tool details
1150
- */
1151
- getTools(): Promise<Record<string, GetToolResponse>>;
1152
- /**
1153
- * Gets a tool instance by ID
1154
- * @param toolId - ID of the tool to retrieve
1155
- * @returns Tool instance
1156
- */
1157
- getTool(toolId: string): Tool;
1158
- /**
1159
- * Retrieves all available legacy workflows
1160
- * @returns Promise containing map of legacy workflow IDs to legacy workflow details
1161
- */
1162
- getLegacyWorkflows(): Promise<Record<string, GetLegacyWorkflowResponse>>;
1163
- /**
1164
- * Gets a legacy workflow instance by ID
1165
- * @param workflowId - ID of the legacy workflow to retrieve
1166
- * @returns Legacy Workflow instance
1167
- */
1168
- getLegacyWorkflow(workflowId: string): LegacyWorkflow;
1169
- /**
1170
- * Retrieves all available workflows
1171
- * @returns Promise containing map of workflow IDs to workflow details
1172
- */
1173
- getWorkflows(): Promise<Record<string, GetWorkflowResponse>>;
1174
- /**
1175
- * Gets a workflow instance by ID
1176
- * @param workflowId - ID of the workflow to retrieve
1177
- * @returns Workflow instance
1178
- */
1179
- getWorkflow(workflowId: string): Workflow;
1180
- /**
1181
- * Gets a vector instance by name
1182
- * @param vectorName - Name of the vector to retrieve
1183
- * @returns Vector instance
1184
- */
1185
- getVector(vectorName: string): Vector;
1186
- /**
1187
- * Retrieves logs
1188
- * @param params - Parameters for filtering logs
1189
- * @returns Promise containing array of log messages
1190
- */
1191
- getLogs(params: GetLogsParams): Promise<GetLogsResponse>;
1192
- /**
1193
- * Gets logs for a specific run
1194
- * @param params - Parameters containing run ID to retrieve
1195
- * @returns Promise containing array of log messages
1196
- */
1197
- getLogForRun(params: GetLogParams): Promise<GetLogsResponse>;
1198
- /**
1199
- * List of all log transports
1200
- * @returns Promise containing list of log transports
1201
- */
1202
- getLogTransports(): Promise<{
1203
- transports: string[];
1204
- }>;
1205
- /**
1206
- * List of all traces (paged)
1207
- * @param params - Parameters for filtering traces
1208
- * @returns Promise containing telemetry data
1209
- */
1210
- getTelemetry(params?: GetTelemetryParams): Promise<GetTelemetryResponse>;
1211
- /**
1212
- * Retrieves all available networks
1213
- * @returns Promise containing map of network IDs to network details
1214
- */
1215
- getNetworks(): Promise<Array<GetNetworkResponse>>;
1216
- /**
1217
- * Retrieves all available vNext networks
1218
- * @returns Promise containing map of vNext network IDs to vNext network details
1219
- */
1220
- getVNextNetworks(): Promise<Array<GetVNextNetworkResponse>>;
1221
- /**
1222
- * Gets a network instance by ID
1223
- * @param networkId - ID of the network to retrieve
1224
- * @returns Network instance
1225
- */
1226
- getNetwork(networkId: string): Network;
1227
- /**
1228
- * Gets a vNext network instance by ID
1229
- * @param networkId - ID of the vNext network to retrieve
1230
- * @returns vNext Network instance
1231
- */
1232
- getVNextNetwork(networkId: string): VNextNetwork;
1233
- /**
1234
- * Retrieves a list of available MCP servers.
1235
- * @param params - Optional parameters for pagination (limit, offset).
1236
- * @returns Promise containing the list of MCP servers and pagination info.
1237
- */
1238
- getMcpServers(params?: {
1239
- limit?: number;
1240
- offset?: number;
1241
- }): Promise<McpServerListResponse>;
1242
- /**
1243
- * Retrieves detailed information for a specific MCP server.
1244
- * @param serverId - The ID of the MCP server to retrieve.
1245
- * @param params - Optional parameters, e.g., specific version.
1246
- * @returns Promise containing the detailed MCP server information.
1247
- */
1248
- getMcpServerDetails(serverId: string, params?: {
1249
- version?: string;
1250
- }): Promise<ServerDetailInfo>;
1251
- /**
1252
- * Retrieves a list of tools for a specific MCP server.
1253
- * @param serverId - The ID of the MCP server.
1254
- * @returns Promise containing the list of tools.
1255
- */
1256
- getMcpServerTools(serverId: string): Promise<McpServerToolListResponse>;
1257
- /**
1258
- * Gets an MCPTool resource instance for a specific tool on an MCP server.
1259
- * This instance can then be used to fetch details or execute the tool.
1260
- * @param serverId - The ID of the MCP server.
1261
- * @param toolId - The ID of the tool.
1262
- * @returns MCPTool instance.
1263
- */
1264
- getMcpServerTool(serverId: string, toolId: string): MCPTool;
1265
- /**
1266
- * Gets an A2A client for interacting with an agent via the A2A protocol
1267
- * @param agentId - ID of the agent to interact with
1268
- * @returns A2A client instance
1269
- */
1270
- getA2A(agentId: string): A2A;
1271
- /**
1272
- * Retrieves the working memory for a specific thread (optionally resource-scoped).
1273
- * @param agentId - ID of the agent.
1274
- * @param threadId - ID of the thread.
1275
- * @param resourceId - Optional ID of the resource.
1276
- * @returns Working memory for the specified thread or resource.
1277
- */
1278
- getWorkingMemory({ agentId, threadId, resourceId, }: {
1279
- agentId: string;
1280
- threadId: string;
1281
- resourceId?: string;
1282
- }): Promise<unknown>;
1283
- /**
1284
- * Updates the working memory for a specific thread (optionally resource-scoped).
1285
- * @param agentId - ID of the agent.
1286
- * @param threadId - ID of the thread.
1287
- * @param workingMemory - The new working memory content.
1288
- * @param resourceId - Optional ID of the resource.
1289
- */
1290
- updateWorkingMemory({ agentId, threadId, workingMemory, resourceId, }: {
1291
- agentId: string;
1292
- threadId: string;
1293
- workingMemory: string;
1294
- resourceId?: string;
1295
- }): Promise<unknown>;
1296
- /**
1297
- * Retrieves all available scorers
1298
- * @returns Promise containing list of available scorers
1299
- */
1300
- getScorers(): Promise<Record<string, GetScorerResponse>>;
1301
- /**
1302
- * Retrieves a scorer by ID
1303
- * @param scorerId - ID of the scorer to retrieve
1304
- * @returns Promise containing the scorer
1305
- */
1306
- getScorer(scorerId: string): Promise<GetScorerResponse>;
1307
- getScoresByScorerId(params: GetScoresByScorerIdParams): Promise<GetScoresResponse>;
1308
- /**
1309
- * Retrieves scores by run ID
1310
- * @param params - Parameters containing run ID and pagination options
1311
- * @returns Promise containing scores and pagination info
1312
- */
1313
- getScoresByRunId(params: GetScoresByRunIdParams): Promise<GetScoresResponse>;
1314
- /**
1315
- * Retrieves scores by entity ID and type
1316
- * @param params - Parameters containing entity ID, type, and pagination options
1317
- * @returns Promise containing scores and pagination info
1318
- */
1319
- getScoresByEntityId(params: GetScoresByEntityIdParams): Promise<GetScoresResponse>;
1320
- /**
1321
- * Saves a score
1322
- * @param params - Parameters containing the score data to save
1323
- * @returns Promise containing the saved score
1324
- */
1325
- saveScore(params: SaveScoreParams): Promise<SaveScoreResponse>;
1326
- }
1327
-
1328
- export { type ClientOptions, type ClientScoreRowData, 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 GetMemoryThreadMessagesPaginatedParams, type GetMemoryThreadMessagesPaginatedResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkMemoryThreadParams, type GetNetworkResponse, type GetScorerResponse, type GetScorersResponse, type GetScoresByEntityIdParams, type GetScoresByRunIdParams, type GetScoresByScorerIdParams, type GetScoresResponse, 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 SaveScoreParams, type SaveScoreResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };