@mastra/client-js 0.0.0-cli-debug-2-20250611100354 → 0.0.0-cloud-deployer-for-core-0.19.1-20251001164939

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