@mastra/client-js 0.0.0-custom-instrumentation-20250708222033 → 0.0.0-declaration-maps-20250729224949

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