@mastra/client-js 0.0.0-generate-message-id-20250512171942 → 0.0.0-gl-test-20250917080133

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