@mastra/client-js 0.0.0-trigger-playground-ui-package-20250506151043 → 0.0.0-update-scorers-api-20250801170445

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