@mastra/client-js 0.0.0-vector-sources-20250516175436 → 0.0.0-vector-extension-schema-20250922130418

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 (77) hide show
  1. package/CHANGELOG.md +1743 -2
  2. package/LICENSE.md +11 -42
  3. package/README.md +8 -9
  4. package/dist/client.d.ts +290 -0
  5. package/dist/client.d.ts.map +1 -0
  6. package/dist/example.d.ts +2 -0
  7. package/dist/example.d.ts.map +1 -0
  8. package/dist/index.cjs +2622 -504
  9. package/dist/index.cjs.map +1 -0
  10. package/dist/index.d.ts +5 -883
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +2623 -507
  13. package/dist/index.js.map +1 -0
  14. package/dist/resources/a2a.d.ts +41 -0
  15. package/dist/resources/a2a.d.ts.map +1 -0
  16. package/dist/resources/agent-builder.d.ts +160 -0
  17. package/dist/resources/agent-builder.d.ts.map +1 -0
  18. package/dist/resources/agent.d.ts +175 -0
  19. package/dist/resources/agent.d.ts.map +1 -0
  20. package/dist/resources/base.d.ts +13 -0
  21. package/dist/resources/base.d.ts.map +1 -0
  22. package/dist/resources/index.d.ts +12 -0
  23. package/dist/resources/index.d.ts.map +1 -0
  24. package/dist/resources/legacy-workflow.d.ts +90 -0
  25. package/dist/resources/legacy-workflow.d.ts.map +1 -0
  26. package/dist/resources/mcp-tool.d.ts +28 -0
  27. package/dist/resources/mcp-tool.d.ts.map +1 -0
  28. package/dist/resources/memory-thread.d.ts +53 -0
  29. package/dist/resources/memory-thread.d.ts.map +1 -0
  30. package/dist/resources/network-memory-thread.d.ts +47 -0
  31. package/dist/resources/network-memory-thread.d.ts.map +1 -0
  32. package/dist/resources/observability.d.ts +19 -0
  33. package/dist/resources/observability.d.ts.map +1 -0
  34. package/dist/resources/tool.d.ts +24 -0
  35. package/dist/resources/tool.d.ts.map +1 -0
  36. package/dist/resources/vNextNetwork.d.ts +43 -0
  37. package/dist/resources/vNextNetwork.d.ts.map +1 -0
  38. package/dist/resources/vector.d.ts +51 -0
  39. package/dist/resources/vector.d.ts.map +1 -0
  40. package/dist/resources/workflow.d.ts +254 -0
  41. package/dist/resources/workflow.d.ts.map +1 -0
  42. package/dist/tools.d.ts +22 -0
  43. package/dist/tools.d.ts.map +1 -0
  44. package/dist/types.d.ts +464 -0
  45. package/dist/types.d.ts.map +1 -0
  46. package/dist/utils/index.d.ts +5 -0
  47. package/dist/utils/index.d.ts.map +1 -0
  48. package/dist/utils/process-client-tools.d.ts +3 -0
  49. package/dist/utils/process-client-tools.d.ts.map +1 -0
  50. package/dist/utils/process-mastra-stream.d.ts +11 -0
  51. package/dist/utils/process-mastra-stream.d.ts.map +1 -0
  52. package/dist/utils/zod-to-json-schema.d.ts +3 -0
  53. package/dist/utils/zod-to-json-schema.d.ts.map +1 -0
  54. package/package.json +37 -20
  55. package/dist/index.d.cts +0 -883
  56. package/eslint.config.js +0 -6
  57. package/src/adapters/agui.test.ts +0 -180
  58. package/src/adapters/agui.ts +0 -239
  59. package/src/client.ts +0 -335
  60. package/src/example.ts +0 -64
  61. package/src/index.test.ts +0 -830
  62. package/src/index.ts +0 -2
  63. package/src/resources/a2a.ts +0 -88
  64. package/src/resources/agent.ts +0 -196
  65. package/src/resources/base.ts +0 -70
  66. package/src/resources/index.ts +0 -10
  67. package/src/resources/mcp-tool.ts +0 -48
  68. package/src/resources/memory-thread.ts +0 -63
  69. package/src/resources/network.ts +0 -86
  70. package/src/resources/tool.ts +0 -44
  71. package/src/resources/vector.ts +0 -83
  72. package/src/resources/vnext-workflow.ts +0 -261
  73. package/src/resources/workflow.ts +0 -251
  74. package/src/types.ts +0 -308
  75. package/src/utils/zod-to-json-schema.ts +0 -10
  76. package/tsconfig.json +0 -5
  77. package/vitest.config.js +0 -8
package/dist/index.d.cts DELETED
@@ -1,883 +0,0 @@
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, VNextWorkflowRuns, QueryResult, BaseLogMessage, GenerateReturn } from '@mastra/core';
4
- import { JSONSchema7 } from 'json-schema';
5
- import { ZodSchema } from 'zod';
6
- import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
7
- import { RuntimeContext } from '@mastra/core/runtime-context';
8
- import { ServerInfo, ServerDetailInfo } from '@mastra/core/mcp';
9
- import { NewWorkflow, WorkflowResult, WatchEvent } from '@mastra/core/workflows/vNext';
10
- import { RuntimeContext as RuntimeContext$1 } from '@mastra/core/di';
11
- import { AgentCard, TaskSendParams, Task, TaskQueryParams, TaskIdParams } from '@mastra/core/a2a';
12
-
13
- interface ClientOptions {
14
- /** Base URL for API requests */
15
- baseUrl: string;
16
- /** Number of retry attempts for failed requests */
17
- retries?: number;
18
- /** Initial backoff time in milliseconds between retries */
19
- backoffMs?: number;
20
- /** Maximum backoff time in milliseconds between retries */
21
- maxBackoffMs?: number;
22
- /** Custom headers to include with requests */
23
- headers?: Record<string, string>;
24
- }
25
- interface RequestOptions {
26
- method?: string;
27
- headers?: Record<string, string>;
28
- body?: any;
29
- stream?: boolean;
30
- signal?: AbortSignal;
31
- }
32
- type WithoutMethods<T> = {
33
- [K in keyof T as T[K] extends (...args: any[]) => any ? never : T[K] extends {
34
- (): any;
35
- } ? never : T[K] extends undefined | ((...args: any[]) => any) ? never : K]: T[K];
36
- };
37
- interface GetAgentResponse {
38
- name: string;
39
- instructions: string;
40
- tools: Record<string, GetToolResponse>;
41
- workflows: Record<string, GetWorkflowResponse>;
42
- provider: string;
43
- modelId: string;
44
- }
45
- type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
46
- messages: string | string[] | CoreMessage[] | AiMessageType[];
47
- output?: T;
48
- experimental_output?: T;
49
- runtimeContext?: RuntimeContext;
50
- } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
51
- type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
52
- messages: string | string[] | CoreMessage[] | AiMessageType[];
53
- output?: T;
54
- experimental_output?: T;
55
- runtimeContext?: RuntimeContext;
56
- } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
57
- interface GetEvalsByAgentIdResponse extends GetAgentResponse {
58
- evals: any[];
59
- instructions: string;
60
- name: string;
61
- id: string;
62
- }
63
- interface GetToolResponse {
64
- id: string;
65
- description: string;
66
- inputSchema: string;
67
- outputSchema: string;
68
- }
69
- interface GetWorkflowResponse {
70
- name: string;
71
- triggerSchema: string;
72
- steps: Record<string, StepAction<any, any, any, any>>;
73
- stepGraph: StepGraph;
74
- stepSubscriberGraph: Record<string, StepGraph>;
75
- workflowId?: string;
76
- }
77
- interface GetWorkflowRunsParams {
78
- fromDate?: Date;
79
- toDate?: Date;
80
- limit?: number;
81
- offset?: number;
82
- resourceId?: string;
83
- }
84
- type GetWorkflowRunsResponse = WorkflowRuns;
85
- type GetVNextWorkflowRunsResponse = VNextWorkflowRuns;
86
- type WorkflowRunResult = {
87
- activePaths: Record<string, {
88
- status: string;
89
- suspendPayload?: any;
90
- stepPath: string[];
91
- }>;
92
- results: WorkflowRunResult$1<any, any, any>['results'];
93
- timestamp: number;
94
- runId: string;
95
- };
96
- interface GetVNextWorkflowResponse {
97
- name: string;
98
- steps: {
99
- [key: string]: {
100
- id: string;
101
- description: string;
102
- inputSchema: string;
103
- outputSchema: string;
104
- resumeSchema: string;
105
- suspendSchema: string;
106
- };
107
- };
108
- stepGraph: NewWorkflow['serializedStepGraph'];
109
- inputSchema: string;
110
- outputSchema: string;
111
- }
112
- type VNextWorkflowWatchResult = WatchEvent & {
113
- runId: string;
114
- };
115
- type VNextWorkflowRunResult = WorkflowResult<any, any>;
116
- interface UpsertVectorParams {
117
- indexName: string;
118
- vectors: number[][];
119
- metadata?: Record<string, any>[];
120
- ids?: string[];
121
- }
122
- interface CreateIndexParams {
123
- indexName: string;
124
- dimension: number;
125
- metric?: 'cosine' | 'euclidean' | 'dotproduct';
126
- }
127
- interface QueryVectorParams {
128
- indexName: string;
129
- queryVector: number[];
130
- topK?: number;
131
- filter?: Record<string, any>;
132
- includeVector?: boolean;
133
- }
134
- interface QueryVectorResponse {
135
- results: QueryResult[];
136
- }
137
- interface GetVectorIndexResponse {
138
- dimension: number;
139
- metric: 'cosine' | 'euclidean' | 'dotproduct';
140
- count: number;
141
- }
142
- interface SaveMessageToMemoryParams {
143
- messages: MessageType[];
144
- agentId: string;
145
- }
146
- type SaveMessageToMemoryResponse = MessageType[];
147
- interface CreateMemoryThreadParams {
148
- title: string;
149
- metadata: Record<string, any>;
150
- resourceId: string;
151
- threadId: string;
152
- agentId: string;
153
- }
154
- type CreateMemoryThreadResponse = StorageThreadType;
155
- interface GetMemoryThreadParams {
156
- resourceId: string;
157
- agentId: string;
158
- }
159
- type GetMemoryThreadResponse = StorageThreadType[];
160
- interface UpdateMemoryThreadParams {
161
- title: string;
162
- metadata: Record<string, any>;
163
- resourceId: string;
164
- }
165
- interface GetMemoryThreadMessagesParams {
166
- /**
167
- * Limit the number of messages to retrieve (default: 40)
168
- */
169
- limit?: number;
170
- }
171
- interface GetMemoryThreadMessagesResponse {
172
- messages: CoreMessage[];
173
- uiMessages: AiMessageType[];
174
- }
175
- interface GetLogsParams {
176
- transportId: string;
177
- }
178
- interface GetLogParams {
179
- runId: string;
180
- transportId: string;
181
- }
182
- type GetLogsResponse = BaseLogMessage[];
183
- type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
184
- type SpanStatus = {
185
- code: number;
186
- };
187
- type SpanOther = {
188
- droppedAttributesCount: number;
189
- droppedEventsCount: number;
190
- droppedLinksCount: number;
191
- };
192
- type SpanEventAttributes = {
193
- key: string;
194
- value: {
195
- [key: string]: string | number | boolean | null;
196
- };
197
- };
198
- type SpanEvent = {
199
- attributes: SpanEventAttributes[];
200
- name: string;
201
- timeUnixNano: string;
202
- droppedAttributesCount: number;
203
- };
204
- type Span = {
205
- id: string;
206
- parentSpanId: string | null;
207
- traceId: string;
208
- name: string;
209
- scope: string;
210
- kind: number;
211
- status: SpanStatus;
212
- events: SpanEvent[];
213
- links: any[];
214
- attributes: Record<string, string | number | boolean | null>;
215
- startTime: number;
216
- endTime: number;
217
- duration: number;
218
- other: SpanOther;
219
- createdAt: string;
220
- };
221
- interface GetTelemetryResponse {
222
- traces: Span[];
223
- }
224
- interface GetTelemetryParams {
225
- name?: string;
226
- scope?: string;
227
- page?: number;
228
- perPage?: number;
229
- attribute?: Record<string, string>;
230
- fromDate?: Date;
231
- toDate?: Date;
232
- }
233
- interface GetNetworkResponse {
234
- name: string;
235
- instructions: string;
236
- agents: Array<{
237
- name: string;
238
- provider: string;
239
- modelId: string;
240
- }>;
241
- routingModel: {
242
- provider: string;
243
- modelId: string;
244
- };
245
- state?: Record<string, any>;
246
- }
247
- interface McpServerListResponse {
248
- servers: ServerInfo[];
249
- next: string | null;
250
- total_count: number;
251
- }
252
- interface McpToolInfo {
253
- id: string;
254
- name: string;
255
- description?: string;
256
- inputSchema: string;
257
- }
258
- interface McpServerToolListResponse {
259
- tools: McpToolInfo[];
260
- }
261
-
262
- declare class BaseResource {
263
- readonly options: ClientOptions;
264
- constructor(options: ClientOptions);
265
- /**
266
- * Makes an HTTP request to the API with retries and exponential backoff
267
- * @param path - The API endpoint path
268
- * @param options - Optional request configuration
269
- * @returns Promise containing the response data
270
- */
271
- request<T>(path: string, options?: RequestOptions): Promise<T>;
272
- }
273
-
274
- declare class AgentVoice extends BaseResource {
275
- private agentId;
276
- constructor(options: ClientOptions, agentId: string);
277
- /**
278
- * Convert text to speech using the agent's voice provider
279
- * @param text - Text to convert to speech
280
- * @param options - Optional provider-specific options for speech generation
281
- * @returns Promise containing the audio data
282
- */
283
- speak(text: string, options?: {
284
- speaker?: string;
285
- [key: string]: any;
286
- }): Promise<Response>;
287
- /**
288
- * Convert speech to text using the agent's voice provider
289
- * @param audio - Audio data to transcribe
290
- * @param options - Optional provider-specific options
291
- * @returns Promise containing the transcribed text
292
- */
293
- listen(audio: Blob, options?: Record<string, any>): Promise<{
294
- text: string;
295
- }>;
296
- /**
297
- * Get available speakers for the agent's voice provider
298
- * @returns Promise containing list of available speakers
299
- */
300
- getSpeakers(): Promise<Array<{
301
- voiceId: string;
302
- [key: string]: any;
303
- }>>;
304
- }
305
- declare class Agent extends BaseResource {
306
- private agentId;
307
- readonly voice: AgentVoice;
308
- constructor(options: ClientOptions, agentId: string);
309
- /**
310
- * Retrieves details about the agent
311
- * @returns Promise containing agent details including model and instructions
312
- */
313
- details(): Promise<GetAgentResponse>;
314
- /**
315
- * Generates a response from the agent
316
- * @param params - Generation parameters including prompt
317
- * @returns Promise containing the generated response
318
- */
319
- generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T>): Promise<GenerateReturn<T>>;
320
- /**
321
- * Streams a response from the agent
322
- * @param params - Stream parameters including prompt
323
- * @returns Promise containing the enhanced Response object with processDataStream method
324
- */
325
- stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
326
- processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
327
- }>;
328
- /**
329
- * Gets details about a specific tool available to the agent
330
- * @param toolId - ID of the tool to retrieve
331
- * @returns Promise containing tool details
332
- */
333
- getTool(toolId: string): Promise<GetToolResponse>;
334
- /**
335
- * Executes a tool for the agent
336
- * @param toolId - ID of the tool to execute
337
- * @param params - Parameters required for tool execution
338
- * @returns Promise containing the tool execution results
339
- */
340
- executeTool(toolId: string, params: {
341
- data: any;
342
- runtimeContext?: RuntimeContext$1;
343
- }): Promise<any>;
344
- /**
345
- * Retrieves evaluation results for the agent
346
- * @returns Promise containing agent evaluations
347
- */
348
- evals(): Promise<GetEvalsByAgentIdResponse>;
349
- /**
350
- * Retrieves live evaluation results for the agent
351
- * @returns Promise containing live agent evaluations
352
- */
353
- liveEvals(): Promise<GetEvalsByAgentIdResponse>;
354
- }
355
-
356
- declare class Network extends BaseResource {
357
- private networkId;
358
- constructor(options: ClientOptions, networkId: string);
359
- /**
360
- * Retrieves details about the network
361
- * @returns Promise containing network details
362
- */
363
- details(): Promise<GetNetworkResponse>;
364
- /**
365
- * Generates a response from the agent
366
- * @param params - Generation parameters including prompt
367
- * @returns Promise containing the generated response
368
- */
369
- generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T>): Promise<GenerateReturn<T>>;
370
- /**
371
- * Streams a response from the agent
372
- * @param params - Stream parameters including prompt
373
- * @returns Promise containing the enhanced Response object with processDataStream method
374
- */
375
- stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
376
- processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
377
- }>;
378
- }
379
-
380
- declare class MemoryThread extends BaseResource {
381
- private threadId;
382
- private agentId;
383
- constructor(options: ClientOptions, threadId: string, agentId: string);
384
- /**
385
- * Retrieves the memory thread details
386
- * @returns Promise containing thread details including title and metadata
387
- */
388
- get(): Promise<StorageThreadType>;
389
- /**
390
- * Updates the memory thread properties
391
- * @param params - Update parameters including title and metadata
392
- * @returns Promise containing updated thread details
393
- */
394
- update(params: UpdateMemoryThreadParams): Promise<StorageThreadType>;
395
- /**
396
- * Deletes the memory thread
397
- * @returns Promise containing deletion result
398
- */
399
- delete(): Promise<{
400
- result: string;
401
- }>;
402
- /**
403
- * Retrieves messages associated with the thread
404
- * @param params - Optional parameters including limit for number of messages to retrieve
405
- * @returns Promise containing thread messages and UI messages
406
- */
407
- getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
408
- }
409
-
410
- declare class Vector extends BaseResource {
411
- private vectorName;
412
- constructor(options: ClientOptions, vectorName: string);
413
- /**
414
- * Retrieves details about a specific vector index
415
- * @param indexName - Name of the index to get details for
416
- * @returns Promise containing vector index details
417
- */
418
- details(indexName: string): Promise<GetVectorIndexResponse>;
419
- /**
420
- * Deletes a vector index
421
- * @param indexName - Name of the index to delete
422
- * @returns Promise indicating deletion success
423
- */
424
- delete(indexName: string): Promise<{
425
- success: boolean;
426
- }>;
427
- /**
428
- * Retrieves a list of all available indexes
429
- * @returns Promise containing array of index names
430
- */
431
- getIndexes(): Promise<{
432
- indexes: string[];
433
- }>;
434
- /**
435
- * Creates a new vector index
436
- * @param params - Parameters for index creation including dimension and metric
437
- * @returns Promise indicating creation success
438
- */
439
- createIndex(params: CreateIndexParams): Promise<{
440
- success: boolean;
441
- }>;
442
- /**
443
- * Upserts vectors into an index
444
- * @param params - Parameters containing vectors, metadata, and optional IDs
445
- * @returns Promise containing array of vector IDs
446
- */
447
- upsert(params: UpsertVectorParams): Promise<string[]>;
448
- /**
449
- * Queries vectors in an index
450
- * @param params - Query parameters including query vector and search options
451
- * @returns Promise containing query results
452
- */
453
- query(params: QueryVectorParams): Promise<QueryVectorResponse>;
454
- }
455
-
456
- declare class Workflow extends BaseResource {
457
- private workflowId;
458
- constructor(options: ClientOptions, workflowId: string);
459
- /**
460
- * Retrieves details about the workflow
461
- * @returns Promise containing workflow details including steps and graphs
462
- */
463
- details(): Promise<GetWorkflowResponse>;
464
- /**
465
- * Retrieves all runs for a workflow
466
- * @param params - Parameters for filtering runs
467
- * @returns Promise containing workflow runs array
468
- */
469
- runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
470
- /**
471
- * @deprecated Use `startAsync` instead
472
- * Executes the workflow with the provided parameters
473
- * @param params - Parameters required for workflow execution
474
- * @returns Promise containing the workflow execution results
475
- */
476
- execute(params: Record<string, any>): Promise<WorkflowRunResult>;
477
- /**
478
- * Creates a new workflow run
479
- * @returns Promise containing the generated run ID
480
- */
481
- createRun(params?: {
482
- runId?: string;
483
- }): Promise<{
484
- runId: string;
485
- }>;
486
- /**
487
- * Starts a workflow run synchronously without waiting for the workflow to complete
488
- * @param params - Object containing the runId and triggerData
489
- * @returns Promise containing success message
490
- */
491
- start(params: {
492
- runId: string;
493
- triggerData: Record<string, any>;
494
- }): Promise<{
495
- message: string;
496
- }>;
497
- /**
498
- * Resumes a suspended workflow step synchronously without waiting for the workflow to complete
499
- * @param stepId - ID of the step to resume
500
- * @param runId - ID of the workflow run
501
- * @param context - Context to resume the workflow with
502
- * @returns Promise containing the workflow resume results
503
- */
504
- resume({ stepId, runId, context, }: {
505
- stepId: string;
506
- runId: string;
507
- context: Record<string, any>;
508
- }): Promise<{
509
- message: string;
510
- }>;
511
- /**
512
- * Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
513
- * @param params - Object containing the optional runId and triggerData
514
- * @returns Promise containing the workflow execution results
515
- */
516
- startAsync(params: {
517
- runId?: string;
518
- triggerData: Record<string, any>;
519
- }): Promise<WorkflowRunResult>;
520
- /**
521
- * Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
522
- * @param params - Object containing the runId, stepId, and context
523
- * @returns Promise containing the workflow resume results
524
- */
525
- resumeAsync(params: {
526
- runId: string;
527
- stepId: string;
528
- context: Record<string, any>;
529
- }): Promise<WorkflowRunResult>;
530
- /**
531
- * Creates an async generator that processes a readable stream and yields records
532
- * separated by the Record Separator character (\x1E)
533
- *
534
- * @param stream - The readable stream to process
535
- * @returns An async generator that yields parsed records
536
- */
537
- private streamProcessor;
538
- /**
539
- * Watches workflow transitions in real-time
540
- * @param runId - Optional run ID to filter the watch stream
541
- * @returns AsyncGenerator that yields parsed records from the workflow watch stream
542
- */
543
- watch({ runId }: {
544
- runId?: string;
545
- }, onRecord: (record: WorkflowRunResult) => void): Promise<void>;
546
- }
547
-
548
- declare class Tool extends BaseResource {
549
- private toolId;
550
- constructor(options: ClientOptions, toolId: string);
551
- /**
552
- * Retrieves details about the tool
553
- * @returns Promise containing tool details including description and schemas
554
- */
555
- details(): Promise<GetToolResponse>;
556
- /**
557
- * Executes the tool with the provided parameters
558
- * @param params - Parameters required for tool execution
559
- * @returns Promise containing the tool execution results
560
- */
561
- execute(params: {
562
- data: any;
563
- runId?: string;
564
- runtimeContext?: RuntimeContext$1;
565
- }): Promise<any>;
566
- }
567
-
568
- declare class VNextWorkflow extends BaseResource {
569
- private workflowId;
570
- constructor(options: ClientOptions, workflowId: string);
571
- /**
572
- * Creates an async generator that processes a readable stream and yields vNext workflow records
573
- * separated by the Record Separator character (\x1E)
574
- *
575
- * @param stream - The readable stream to process
576
- * @returns An async generator that yields parsed records
577
- */
578
- private streamProcessor;
579
- /**
580
- * Retrieves details about the vNext workflow
581
- * @returns Promise containing vNext workflow details including steps and graphs
582
- */
583
- details(): Promise<GetVNextWorkflowResponse>;
584
- /**
585
- * Retrieves all runs for a vNext workflow
586
- * @param params - Parameters for filtering runs
587
- * @returns Promise containing vNext workflow runs array
588
- */
589
- runs(params?: GetWorkflowRunsParams): Promise<GetVNextWorkflowRunsResponse>;
590
- /**
591
- * Creates a new vNext workflow run
592
- * @param params - Optional object containing the optional runId
593
- * @returns Promise containing the runId of the created run
594
- */
595
- createRun(params?: {
596
- runId?: string;
597
- }): Promise<{
598
- runId: string;
599
- }>;
600
- /**
601
- * Starts a vNext workflow run synchronously without waiting for the workflow to complete
602
- * @param params - Object containing the runId, inputData and runtimeContext
603
- * @returns Promise containing success message
604
- */
605
- start(params: {
606
- runId: string;
607
- inputData: Record<string, any>;
608
- runtimeContext?: RuntimeContext;
609
- }): Promise<{
610
- message: string;
611
- }>;
612
- /**
613
- * Resumes a suspended vNext workflow step synchronously without waiting for the vNext workflow to complete
614
- * @param params - Object containing the runId, step, resumeData and runtimeContext
615
- * @returns Promise containing success message
616
- */
617
- resume({ step, runId, resumeData, ...rest }: {
618
- step: string | string[];
619
- runId: string;
620
- resumeData?: Record<string, any>;
621
- runtimeContext?: RuntimeContext;
622
- }): Promise<{
623
- message: string;
624
- }>;
625
- /**
626
- * Starts a vNext workflow run asynchronously and returns a promise that resolves when the vNext workflow is complete
627
- * @param params - Object containing the optional runId, inputData and runtimeContext
628
- * @returns Promise containing the vNext workflow execution results
629
- */
630
- startAsync(params: {
631
- runId?: string;
632
- inputData: Record<string, any>;
633
- runtimeContext?: RuntimeContext;
634
- }): Promise<VNextWorkflowRunResult>;
635
- /**
636
- * Resumes a suspended vNext workflow step asynchronously and returns a promise that resolves when the vNext workflow is complete
637
- * @param params - Object containing the runId, step, resumeData and runtimeContext
638
- * @returns Promise containing the vNext workflow resume results
639
- */
640
- resumeAsync(params: {
641
- runId: string;
642
- step: string | string[];
643
- resumeData?: Record<string, any>;
644
- runtimeContext?: RuntimeContext;
645
- }): Promise<VNextWorkflowRunResult>;
646
- /**
647
- * Watches vNext workflow transitions in real-time
648
- * @param runId - Optional run ID to filter the watch stream
649
- * @returns AsyncGenerator that yields parsed records from the vNext workflow watch stream
650
- */
651
- watch({ runId }: {
652
- runId?: string;
653
- }, onRecord: (record: VNextWorkflowWatchResult) => void): Promise<void>;
654
- }
655
-
656
- /**
657
- * Class for interacting with an agent via the A2A protocol
658
- */
659
- declare class A2A extends BaseResource {
660
- private agentId;
661
- constructor(options: ClientOptions, agentId: string);
662
- /**
663
- * Get the agent card with metadata about the agent
664
- * @returns Promise containing the agent card information
665
- */
666
- getCard(): Promise<AgentCard>;
667
- /**
668
- * Send a message to the agent and get a response
669
- * @param params - Parameters for the task
670
- * @returns Promise containing the task response
671
- */
672
- sendMessage(params: TaskSendParams): Promise<{
673
- task: Task;
674
- }>;
675
- /**
676
- * Get the status and result of a task
677
- * @param params - Parameters for querying the task
678
- * @returns Promise containing the task response
679
- */
680
- getTask(params: TaskQueryParams): Promise<Task>;
681
- /**
682
- * Cancel a running task
683
- * @param params - Parameters identifying the task to cancel
684
- * @returns Promise containing the task response
685
- */
686
- cancelTask(params: TaskIdParams): Promise<{
687
- task: Task;
688
- }>;
689
- /**
690
- * Send a message and subscribe to streaming updates (not fully implemented)
691
- * @param params - Parameters for the task
692
- * @returns Promise containing the task response
693
- */
694
- sendAndSubscribe(params: TaskSendParams): Promise<Response>;
695
- }
696
-
697
- /**
698
- * Represents a specific tool available on a specific MCP server.
699
- * Provides methods to get details and execute the tool.
700
- */
701
- declare class MCPTool extends BaseResource {
702
- private serverId;
703
- private toolId;
704
- constructor(options: ClientOptions, serverId: string, toolId: string);
705
- /**
706
- * Retrieves details about this specific tool from the MCP server.
707
- * @returns Promise containing the tool's information (name, description, schema).
708
- */
709
- details(): Promise<McpToolInfo>;
710
- /**
711
- * Executes this specific tool on the MCP server.
712
- * @param params - Parameters for tool execution, including data/args and optional runtimeContext.
713
- * @returns Promise containing the result of the tool execution.
714
- */
715
- execute(params: {
716
- data?: any;
717
- runtimeContext?: RuntimeContext;
718
- }): Promise<any>;
719
- }
720
-
721
- declare class MastraClient extends BaseResource {
722
- constructor(options: ClientOptions);
723
- /**
724
- * Retrieves all available agents
725
- * @returns Promise containing map of agent IDs to agent details
726
- */
727
- getAgents(): Promise<Record<string, GetAgentResponse>>;
728
- getAGUI({ resourceId }: {
729
- resourceId: string;
730
- }): Promise<Record<string, AbstractAgent>>;
731
- /**
732
- * Gets an agent instance by ID
733
- * @param agentId - ID of the agent to retrieve
734
- * @returns Agent instance
735
- */
736
- getAgent(agentId: string): Agent;
737
- /**
738
- * Retrieves memory threads for a resource
739
- * @param params - Parameters containing the resource ID
740
- * @returns Promise containing array of memory threads
741
- */
742
- getMemoryThreads(params: GetMemoryThreadParams): Promise<GetMemoryThreadResponse>;
743
- /**
744
- * Creates a new memory thread
745
- * @param params - Parameters for creating the memory thread
746
- * @returns Promise containing the created memory thread
747
- */
748
- createMemoryThread(params: CreateMemoryThreadParams): Promise<CreateMemoryThreadResponse>;
749
- /**
750
- * Gets a memory thread instance by ID
751
- * @param threadId - ID of the memory thread to retrieve
752
- * @returns MemoryThread instance
753
- */
754
- getMemoryThread(threadId: string, agentId: string): MemoryThread;
755
- /**
756
- * Saves messages to memory
757
- * @param params - Parameters containing messages to save
758
- * @returns Promise containing the saved messages
759
- */
760
- saveMessageToMemory(params: SaveMessageToMemoryParams): Promise<SaveMessageToMemoryResponse>;
761
- /**
762
- * Gets the status of the memory system
763
- * @returns Promise containing memory system status
764
- */
765
- getMemoryStatus(agentId: string): Promise<{
766
- result: boolean;
767
- }>;
768
- /**
769
- * Retrieves all available tools
770
- * @returns Promise containing map of tool IDs to tool details
771
- */
772
- getTools(): Promise<Record<string, GetToolResponse>>;
773
- /**
774
- * Gets a tool instance by ID
775
- * @param toolId - ID of the tool to retrieve
776
- * @returns Tool instance
777
- */
778
- getTool(toolId: string): Tool;
779
- /**
780
- * Retrieves all available workflows
781
- * @returns Promise containing map of workflow IDs to workflow details
782
- */
783
- getWorkflows(): Promise<Record<string, GetWorkflowResponse>>;
784
- /**
785
- * Gets a workflow instance by ID
786
- * @param workflowId - ID of the workflow to retrieve
787
- * @returns Workflow instance
788
- */
789
- getWorkflow(workflowId: string): Workflow;
790
- /**
791
- * Retrieves all available vNext workflows
792
- * @returns Promise containing map of vNext workflow IDs to vNext workflow details
793
- */
794
- getVNextWorkflows(): Promise<Record<string, GetVNextWorkflowResponse>>;
795
- /**
796
- * Gets a vNext workflow instance by ID
797
- * @param workflowId - ID of the vNext workflow to retrieve
798
- * @returns vNext Workflow instance
799
- */
800
- getVNextWorkflow(workflowId: string): VNextWorkflow;
801
- /**
802
- * Gets a vector instance by name
803
- * @param vectorName - Name of the vector to retrieve
804
- * @returns Vector instance
805
- */
806
- getVector(vectorName: string): Vector;
807
- /**
808
- * Retrieves logs
809
- * @param params - Parameters for filtering logs
810
- * @returns Promise containing array of log messages
811
- */
812
- getLogs(params: GetLogsParams): Promise<GetLogsResponse>;
813
- /**
814
- * Gets logs for a specific run
815
- * @param params - Parameters containing run ID to retrieve
816
- * @returns Promise containing array of log messages
817
- */
818
- getLogForRun(params: GetLogParams): Promise<GetLogsResponse>;
819
- /**
820
- * List of all log transports
821
- * @returns Promise containing list of log transports
822
- */
823
- getLogTransports(): Promise<{
824
- transports: string[];
825
- }>;
826
- /**
827
- * List of all traces (paged)
828
- * @param params - Parameters for filtering traces
829
- * @returns Promise containing telemetry data
830
- */
831
- getTelemetry(params?: GetTelemetryParams): Promise<GetTelemetryResponse>;
832
- /**
833
- * Retrieves all available networks
834
- * @returns Promise containing map of network IDs to network details
835
- */
836
- getNetworks(): Promise<Record<string, GetNetworkResponse>>;
837
- /**
838
- * Gets a network instance by ID
839
- * @param networkId - ID of the network to retrieve
840
- * @returns Network instance
841
- */
842
- getNetwork(networkId: string): Network;
843
- /**
844
- * Retrieves a list of available MCP servers.
845
- * @param params - Optional parameters for pagination (limit, offset).
846
- * @returns Promise containing the list of MCP servers and pagination info.
847
- */
848
- getMcpServers(params?: {
849
- limit?: number;
850
- offset?: number;
851
- }): Promise<McpServerListResponse>;
852
- /**
853
- * Retrieves detailed information for a specific MCP server.
854
- * @param serverId - The ID of the MCP server to retrieve.
855
- * @param params - Optional parameters, e.g., specific version.
856
- * @returns Promise containing the detailed MCP server information.
857
- */
858
- getMcpServerDetails(serverId: string, params?: {
859
- version?: string;
860
- }): Promise<ServerDetailInfo>;
861
- /**
862
- * Retrieves a list of tools for a specific MCP server.
863
- * @param serverId - The ID of the MCP server.
864
- * @returns Promise containing the list of tools.
865
- */
866
- getMcpServerTools(serverId: string): Promise<McpServerToolListResponse>;
867
- /**
868
- * Gets an MCPTool resource instance for a specific tool on an MCP server.
869
- * This instance can then be used to fetch details or execute the tool.
870
- * @param serverId - The ID of the MCP server.
871
- * @param toolId - The ID of the tool.
872
- * @returns MCPTool instance.
873
- */
874
- getMcpServerTool(serverId: string, toolId: string): MCPTool;
875
- /**
876
- * Gets an A2A client for interacting with an agent via the A2A protocol
877
- * @param agentId - ID of the agent to interact with
878
- * @returns A2A client instance
879
- */
880
- getA2A(agentId: string): A2A;
881
- }
882
-
883
- 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 GetVNextWorkflowRunsResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type VNextWorkflowRunResult, type VNextWorkflowWatchResult, type WorkflowRunResult };