@mastra/client-js 0.0.0-mcp-server-deploy-20250507160341 → 0.0.0-memory-system-message-error-20250813233316

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