@mastra/client-js 0.0.0-custom-instrumentation-20250626084921 → 0.0.0-declaration-maps-20250729202623

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