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