@mastra/client-js 0.0.0-expose-more-playground-ui-20250502141824 → 0.0.0-feat-tool-input-validation-20250731232758
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 +1127 -2
- package/LICENSE.md +11 -42
- package/README.md +2 -1
- package/dist/index.cjs +1632 -134
- package/dist/index.d.cts +701 -88
- package/dist/index.d.ts +701 -88
- package/dist/index.js +1631 -137
- package/package.json +24 -16
- package/src/adapters/agui.test.ts +180 -0
- package/src/adapters/agui.ts +239 -0
- package/src/client.ts +414 -23
- package/src/example.ts +59 -29
- package/src/index.test.ts +522 -6
- package/src/index.ts +1 -0
- package/src/resources/a2a.ts +88 -0
- package/src/resources/agent.ts +629 -48
- package/src/resources/base.ts +7 -1
- package/src/resources/index.ts +4 -2
- package/src/resources/{vnext-workflow.ts → legacy-workflow.ts} +140 -132
- package/src/resources/mcp-tool.ts +48 -0
- package/src/resources/memory-thread.test.ts +285 -0
- package/src/resources/memory-thread.ts +49 -3
- package/src/resources/network-memory-thread.test.ts +269 -0
- package/src/resources/network-memory-thread.ts +81 -0
- package/src/resources/network.ts +10 -16
- package/src/resources/tool.ts +9 -2
- package/src/resources/vNextNetwork.ts +194 -0
- package/src/resources/workflow.ts +282 -95
- package/src/types.ts +275 -25
- package/src/utils/index.ts +11 -0
- package/src/utils/process-client-tools.ts +32 -0
- package/src/utils/zod-to-json-schema.ts +10 -0
- package/src/v2-messages.test.ts +180 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
import { AbstractAgent } from '@ag-ui/client';
|
|
2
|
+
import { ServerInfo, MCPToolType, ServerDetailInfo } from '@mastra/core/mcp';
|
|
1
3
|
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
2
|
-
import {
|
|
4
|
+
import { GenerateReturn } from '@mastra/core/llm';
|
|
3
5
|
import { JSONSchema7 } from 'json-schema';
|
|
4
6
|
import { ZodSchema } from 'zod';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
+
import { CoreMessage, AiMessageType, StorageThreadType, StorageGetMessagesArg, PaginationInfo, MastraMessageV1, MastraMessageV2, LegacyWorkflowRuns, WorkflowRuns, WorkflowRun, QueryResult, GenerateReturn as GenerateReturn$1 } from '@mastra/core';
|
|
8
|
+
import { AgentGenerateOptions, AgentStreamOptions, UIMessageWithMetadata, ToolsInput } from '@mastra/core/agent';
|
|
9
|
+
export { UIMessageWithMetadata } from '@mastra/core/agent';
|
|
10
|
+
import { LogLevel, BaseLogMessage } from '@mastra/core/logger';
|
|
7
11
|
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
12
|
+
import { MastraScorerEntry, ScoreRowData } from '@mastra/core/scores';
|
|
13
|
+
import { Workflow as Workflow$1, WatchEvent, WorkflowResult } from '@mastra/core/workflows';
|
|
14
|
+
import { StepAction, StepGraph, LegacyWorkflowRunResult as LegacyWorkflowRunResult$1 } from '@mastra/core/workflows/legacy';
|
|
15
|
+
import * as stream_web from 'stream/web';
|
|
16
|
+
import { AgentCard, TaskSendParams, Task, TaskQueryParams, TaskIdParams } from '@mastra/core/a2a';
|
|
8
17
|
|
|
9
18
|
interface ClientOptions {
|
|
10
19
|
/** Base URL for API requests */
|
|
@@ -17,27 +26,44 @@ interface ClientOptions {
|
|
|
17
26
|
maxBackoffMs?: number;
|
|
18
27
|
/** Custom headers to include with requests */
|
|
19
28
|
headers?: Record<string, string>;
|
|
29
|
+
/** Abort signal for request */
|
|
30
|
+
abortSignal?: AbortSignal;
|
|
20
31
|
}
|
|
21
32
|
interface RequestOptions {
|
|
22
33
|
method?: string;
|
|
23
34
|
headers?: Record<string, string>;
|
|
24
35
|
body?: any;
|
|
25
36
|
stream?: boolean;
|
|
26
|
-
signal?: AbortSignal;
|
|
27
37
|
}
|
|
38
|
+
type WithoutMethods<T> = {
|
|
39
|
+
[K in keyof T as T[K] extends (...args: any[]) => any ? never : T[K] extends {
|
|
40
|
+
(): any;
|
|
41
|
+
} ? never : T[K] extends undefined | ((...args: any[]) => any) ? never : K]: T[K];
|
|
42
|
+
};
|
|
28
43
|
interface GetAgentResponse {
|
|
29
44
|
name: string;
|
|
30
45
|
instructions: string;
|
|
31
46
|
tools: Record<string, GetToolResponse>;
|
|
47
|
+
workflows: Record<string, GetWorkflowResponse>;
|
|
32
48
|
provider: string;
|
|
33
49
|
modelId: string;
|
|
50
|
+
defaultGenerateOptions: WithoutMethods<AgentGenerateOptions>;
|
|
51
|
+
defaultStreamOptions: WithoutMethods<AgentStreamOptions>;
|
|
34
52
|
}
|
|
35
53
|
type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
36
|
-
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
37
|
-
|
|
54
|
+
messages: string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[];
|
|
55
|
+
output?: T;
|
|
56
|
+
experimental_output?: T;
|
|
57
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
58
|
+
clientTools?: ToolsInput;
|
|
59
|
+
} & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
|
|
38
60
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
39
|
-
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
40
|
-
|
|
61
|
+
messages: string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[];
|
|
62
|
+
output?: T;
|
|
63
|
+
experimental_output?: T;
|
|
64
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
65
|
+
clientTools?: ToolsInput;
|
|
66
|
+
} & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
|
|
41
67
|
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
42
68
|
evals: any[];
|
|
43
69
|
instructions: string;
|
|
@@ -50,7 +76,7 @@ interface GetToolResponse {
|
|
|
50
76
|
inputSchema: string;
|
|
51
77
|
outputSchema: string;
|
|
52
78
|
}
|
|
53
|
-
interface
|
|
79
|
+
interface GetLegacyWorkflowResponse {
|
|
54
80
|
name: string;
|
|
55
81
|
triggerSchema: string;
|
|
56
82
|
steps: Record<string, StepAction<any, any, any, any>>;
|
|
@@ -58,19 +84,30 @@ interface GetWorkflowResponse {
|
|
|
58
84
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
59
85
|
workflowId?: string;
|
|
60
86
|
}
|
|
87
|
+
interface GetWorkflowRunsParams {
|
|
88
|
+
fromDate?: Date;
|
|
89
|
+
toDate?: Date;
|
|
90
|
+
limit?: number;
|
|
91
|
+
offset?: number;
|
|
92
|
+
resourceId?: string;
|
|
93
|
+
}
|
|
94
|
+
type GetLegacyWorkflowRunsResponse = LegacyWorkflowRuns;
|
|
61
95
|
type GetWorkflowRunsResponse = WorkflowRuns;
|
|
62
|
-
type
|
|
96
|
+
type GetWorkflowRunByIdResponse = WorkflowRun;
|
|
97
|
+
type GetWorkflowRunExecutionResultResponse = WatchEvent['payload']['workflowState'];
|
|
98
|
+
type LegacyWorkflowRunResult = {
|
|
63
99
|
activePaths: Record<string, {
|
|
64
100
|
status: string;
|
|
65
101
|
suspendPayload?: any;
|
|
66
102
|
stepPath: string[];
|
|
67
103
|
}>;
|
|
68
|
-
results:
|
|
104
|
+
results: LegacyWorkflowRunResult$1<any, any, any>['results'];
|
|
69
105
|
timestamp: number;
|
|
70
106
|
runId: string;
|
|
71
107
|
};
|
|
72
|
-
interface
|
|
108
|
+
interface GetWorkflowResponse {
|
|
73
109
|
name: string;
|
|
110
|
+
description?: string;
|
|
74
111
|
steps: {
|
|
75
112
|
[key: string]: {
|
|
76
113
|
id: string;
|
|
@@ -81,14 +118,25 @@ interface GetVNextWorkflowResponse {
|
|
|
81
118
|
suspendSchema: string;
|
|
82
119
|
};
|
|
83
120
|
};
|
|
84
|
-
|
|
121
|
+
allSteps: {
|
|
122
|
+
[key: string]: {
|
|
123
|
+
id: string;
|
|
124
|
+
description: string;
|
|
125
|
+
inputSchema: string;
|
|
126
|
+
outputSchema: string;
|
|
127
|
+
resumeSchema: string;
|
|
128
|
+
suspendSchema: string;
|
|
129
|
+
isWorkflow: boolean;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
stepGraph: Workflow$1['serializedStepGraph'];
|
|
85
133
|
inputSchema: string;
|
|
86
134
|
outputSchema: string;
|
|
87
135
|
}
|
|
88
|
-
type
|
|
136
|
+
type WorkflowWatchResult = WatchEvent & {
|
|
89
137
|
runId: string;
|
|
90
138
|
};
|
|
91
|
-
type
|
|
139
|
+
type WorkflowRunResult = WorkflowResult<any, any>;
|
|
92
140
|
interface UpsertVectorParams {
|
|
93
141
|
indexName: string;
|
|
94
142
|
vectors: number[][];
|
|
@@ -116,40 +164,83 @@ interface GetVectorIndexResponse {
|
|
|
116
164
|
count: number;
|
|
117
165
|
}
|
|
118
166
|
interface SaveMessageToMemoryParams {
|
|
119
|
-
messages:
|
|
167
|
+
messages: (MastraMessageV1 | MastraMessageV2)[];
|
|
120
168
|
agentId: string;
|
|
121
169
|
}
|
|
122
|
-
|
|
170
|
+
interface SaveNetworkMessageToMemoryParams {
|
|
171
|
+
messages: (MastraMessageV1 | MastraMessageV2)[];
|
|
172
|
+
networkId: string;
|
|
173
|
+
}
|
|
174
|
+
type SaveMessageToMemoryResponse = (MastraMessageV1 | MastraMessageV2)[];
|
|
123
175
|
interface CreateMemoryThreadParams {
|
|
124
|
-
title
|
|
125
|
-
metadata
|
|
176
|
+
title?: string;
|
|
177
|
+
metadata?: Record<string, any>;
|
|
126
178
|
resourceId: string;
|
|
127
|
-
threadId
|
|
179
|
+
threadId?: string;
|
|
128
180
|
agentId: string;
|
|
129
181
|
}
|
|
182
|
+
interface CreateNetworkMemoryThreadParams {
|
|
183
|
+
title?: string;
|
|
184
|
+
metadata?: Record<string, any>;
|
|
185
|
+
resourceId: string;
|
|
186
|
+
threadId?: string;
|
|
187
|
+
networkId: string;
|
|
188
|
+
}
|
|
130
189
|
type CreateMemoryThreadResponse = StorageThreadType;
|
|
131
190
|
interface GetMemoryThreadParams {
|
|
132
191
|
resourceId: string;
|
|
133
192
|
agentId: string;
|
|
134
193
|
}
|
|
194
|
+
interface GetNetworkMemoryThreadParams {
|
|
195
|
+
resourceId: string;
|
|
196
|
+
networkId: string;
|
|
197
|
+
}
|
|
135
198
|
type GetMemoryThreadResponse = StorageThreadType[];
|
|
136
199
|
interface UpdateMemoryThreadParams {
|
|
137
200
|
title: string;
|
|
138
201
|
metadata: Record<string, any>;
|
|
139
202
|
resourceId: string;
|
|
140
203
|
}
|
|
204
|
+
interface GetMemoryThreadMessagesParams {
|
|
205
|
+
/**
|
|
206
|
+
* Limit the number of messages to retrieve (default: 40)
|
|
207
|
+
*/
|
|
208
|
+
limit?: number;
|
|
209
|
+
}
|
|
210
|
+
type GetMemoryThreadMessagesPaginatedParams = Omit<StorageGetMessagesArg, 'threadConfig' | 'threadId'>;
|
|
141
211
|
interface GetMemoryThreadMessagesResponse {
|
|
142
212
|
messages: CoreMessage[];
|
|
143
213
|
uiMessages: AiMessageType[];
|
|
144
214
|
}
|
|
215
|
+
type GetMemoryThreadMessagesPaginatedResponse = PaginationInfo & {
|
|
216
|
+
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
217
|
+
};
|
|
145
218
|
interface GetLogsParams {
|
|
146
219
|
transportId: string;
|
|
220
|
+
fromDate?: Date;
|
|
221
|
+
toDate?: Date;
|
|
222
|
+
logLevel?: LogLevel;
|
|
223
|
+
filters?: Record<string, string>;
|
|
224
|
+
page?: number;
|
|
225
|
+
perPage?: number;
|
|
147
226
|
}
|
|
148
227
|
interface GetLogParams {
|
|
149
228
|
runId: string;
|
|
150
229
|
transportId: string;
|
|
230
|
+
fromDate?: Date;
|
|
231
|
+
toDate?: Date;
|
|
232
|
+
logLevel?: LogLevel;
|
|
233
|
+
filters?: Record<string, string>;
|
|
234
|
+
page?: number;
|
|
235
|
+
perPage?: number;
|
|
151
236
|
}
|
|
152
|
-
type GetLogsResponse =
|
|
237
|
+
type GetLogsResponse = {
|
|
238
|
+
logs: BaseLogMessage[];
|
|
239
|
+
total: number;
|
|
240
|
+
page: number;
|
|
241
|
+
perPage: number;
|
|
242
|
+
hasMore: boolean;
|
|
243
|
+
};
|
|
153
244
|
type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
|
|
154
245
|
type SpanStatus = {
|
|
155
246
|
code: number;
|
|
@@ -197,8 +288,11 @@ interface GetTelemetryParams {
|
|
|
197
288
|
page?: number;
|
|
198
289
|
perPage?: number;
|
|
199
290
|
attribute?: Record<string, string>;
|
|
291
|
+
fromDate?: Date;
|
|
292
|
+
toDate?: Date;
|
|
200
293
|
}
|
|
201
294
|
interface GetNetworkResponse {
|
|
295
|
+
id: string;
|
|
202
296
|
name: string;
|
|
203
297
|
instructions: string;
|
|
204
298
|
agents: Array<{
|
|
@@ -212,6 +306,125 @@ interface GetNetworkResponse {
|
|
|
212
306
|
};
|
|
213
307
|
state?: Record<string, any>;
|
|
214
308
|
}
|
|
309
|
+
interface GetVNextNetworkResponse {
|
|
310
|
+
id: string;
|
|
311
|
+
name: string;
|
|
312
|
+
instructions: string;
|
|
313
|
+
agents: Array<{
|
|
314
|
+
name: string;
|
|
315
|
+
provider: string;
|
|
316
|
+
modelId: string;
|
|
317
|
+
}>;
|
|
318
|
+
routingModel: {
|
|
319
|
+
provider: string;
|
|
320
|
+
modelId: string;
|
|
321
|
+
};
|
|
322
|
+
workflows: Array<{
|
|
323
|
+
name: string;
|
|
324
|
+
description: string;
|
|
325
|
+
inputSchema: string | undefined;
|
|
326
|
+
outputSchema: string | undefined;
|
|
327
|
+
}>;
|
|
328
|
+
tools: Array<{
|
|
329
|
+
id: string;
|
|
330
|
+
description: string;
|
|
331
|
+
}>;
|
|
332
|
+
}
|
|
333
|
+
interface GenerateVNextNetworkResponse {
|
|
334
|
+
task: string;
|
|
335
|
+
result: string;
|
|
336
|
+
resourceId: string;
|
|
337
|
+
resourceType: 'none' | 'tool' | 'agent' | 'workflow';
|
|
338
|
+
}
|
|
339
|
+
interface GenerateOrStreamVNextNetworkParams {
|
|
340
|
+
message: string;
|
|
341
|
+
threadId?: string;
|
|
342
|
+
resourceId?: string;
|
|
343
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
344
|
+
}
|
|
345
|
+
interface LoopStreamVNextNetworkParams {
|
|
346
|
+
message: string;
|
|
347
|
+
threadId?: string;
|
|
348
|
+
resourceId?: string;
|
|
349
|
+
maxIterations?: number;
|
|
350
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
351
|
+
}
|
|
352
|
+
interface LoopVNextNetworkResponse {
|
|
353
|
+
status: 'success';
|
|
354
|
+
result: {
|
|
355
|
+
task: string;
|
|
356
|
+
resourceId: string;
|
|
357
|
+
resourceType: 'agent' | 'workflow' | 'none' | 'tool';
|
|
358
|
+
result: string;
|
|
359
|
+
iteration: number;
|
|
360
|
+
isOneOff: boolean;
|
|
361
|
+
prompt: string;
|
|
362
|
+
threadId?: string | undefined;
|
|
363
|
+
threadResourceId?: string | undefined;
|
|
364
|
+
isComplete?: boolean | undefined;
|
|
365
|
+
completionReason?: string | undefined;
|
|
366
|
+
};
|
|
367
|
+
steps: WorkflowResult<any, any>['steps'];
|
|
368
|
+
}
|
|
369
|
+
interface McpServerListResponse {
|
|
370
|
+
servers: ServerInfo[];
|
|
371
|
+
next: string | null;
|
|
372
|
+
total_count: number;
|
|
373
|
+
}
|
|
374
|
+
interface McpToolInfo {
|
|
375
|
+
id: string;
|
|
376
|
+
name: string;
|
|
377
|
+
description?: string;
|
|
378
|
+
inputSchema: string;
|
|
379
|
+
toolType?: MCPToolType;
|
|
380
|
+
}
|
|
381
|
+
interface McpServerToolListResponse {
|
|
382
|
+
tools: McpToolInfo[];
|
|
383
|
+
}
|
|
384
|
+
type ClientScoreRowData = Omit<ScoreRowData, 'createdAt' | 'updatedAt'> & {
|
|
385
|
+
createdAt: string;
|
|
386
|
+
updatedAt: string;
|
|
387
|
+
};
|
|
388
|
+
interface GetScoresByRunIdParams {
|
|
389
|
+
runId: string;
|
|
390
|
+
page?: number;
|
|
391
|
+
perPage?: number;
|
|
392
|
+
}
|
|
393
|
+
interface GetScoresByScorerIdParams {
|
|
394
|
+
scorerId: string;
|
|
395
|
+
entityId?: string;
|
|
396
|
+
entityType?: string;
|
|
397
|
+
page?: number;
|
|
398
|
+
perPage?: number;
|
|
399
|
+
}
|
|
400
|
+
interface GetScoresByEntityIdParams {
|
|
401
|
+
entityId: string;
|
|
402
|
+
entityType: string;
|
|
403
|
+
page?: number;
|
|
404
|
+
perPage?: number;
|
|
405
|
+
}
|
|
406
|
+
interface SaveScoreParams {
|
|
407
|
+
score: Omit<ScoreRowData, 'id' | 'createdAt' | 'updatedAt'>;
|
|
408
|
+
}
|
|
409
|
+
interface GetScoresResponse {
|
|
410
|
+
pagination: {
|
|
411
|
+
total: number;
|
|
412
|
+
page: number;
|
|
413
|
+
perPage: number;
|
|
414
|
+
hasMore: boolean;
|
|
415
|
+
};
|
|
416
|
+
scores: ClientScoreRowData[];
|
|
417
|
+
}
|
|
418
|
+
interface SaveScoreResponse {
|
|
419
|
+
score: ClientScoreRowData;
|
|
420
|
+
}
|
|
421
|
+
type GetScorerResponse = MastraScorerEntry & {
|
|
422
|
+
agentIds: string[];
|
|
423
|
+
workflowIds: string[];
|
|
424
|
+
};
|
|
425
|
+
interface GetScorersResponse {
|
|
426
|
+
scorers: Array<GetScorerResponse>;
|
|
427
|
+
}
|
|
215
428
|
|
|
216
429
|
declare class BaseResource {
|
|
217
430
|
readonly options: ClientOptions;
|
|
@@ -244,7 +457,9 @@ declare class AgentVoice extends BaseResource {
|
|
|
244
457
|
* @param options - Optional provider-specific options
|
|
245
458
|
* @returns Promise containing the transcribed text
|
|
246
459
|
*/
|
|
247
|
-
listen(audio: Blob, options?: Record<string, any>): Promise<
|
|
460
|
+
listen(audio: Blob, options?: Record<string, any>): Promise<{
|
|
461
|
+
text: string;
|
|
462
|
+
}>;
|
|
248
463
|
/**
|
|
249
464
|
* Get available speakers for the agent's voice provider
|
|
250
465
|
* @returns Promise containing list of available speakers
|
|
@@ -253,6 +468,13 @@ declare class AgentVoice extends BaseResource {
|
|
|
253
468
|
voiceId: string;
|
|
254
469
|
[key: string]: any;
|
|
255
470
|
}>>;
|
|
471
|
+
/**
|
|
472
|
+
* Get the listener configuration for the agent's voice provider
|
|
473
|
+
* @returns Promise containing a check if the agent has listening capabilities
|
|
474
|
+
*/
|
|
475
|
+
getListener(): Promise<{
|
|
476
|
+
enabled: boolean;
|
|
477
|
+
}>;
|
|
256
478
|
}
|
|
257
479
|
declare class Agent extends BaseResource {
|
|
258
480
|
private agentId;
|
|
@@ -268,7 +490,19 @@ declare class Agent extends BaseResource {
|
|
|
268
490
|
* @param params - Generation parameters including prompt
|
|
269
491
|
* @returns Promise containing the generated response
|
|
270
492
|
*/
|
|
271
|
-
generate
|
|
493
|
+
generate(params: GenerateParams<undefined> & {
|
|
494
|
+
output?: never;
|
|
495
|
+
experimental_output?: never;
|
|
496
|
+
}): Promise<GenerateReturn<any, undefined, undefined>>;
|
|
497
|
+
generate<Output extends JSONSchema7 | ZodSchema>(params: GenerateParams<Output> & {
|
|
498
|
+
output: Output;
|
|
499
|
+
experimental_output?: never;
|
|
500
|
+
}): Promise<GenerateReturn<any, Output, undefined>>;
|
|
501
|
+
generate<StructuredOutput extends JSONSchema7 | ZodSchema>(params: GenerateParams<StructuredOutput> & {
|
|
502
|
+
output?: never;
|
|
503
|
+
experimental_output: StructuredOutput;
|
|
504
|
+
}): Promise<GenerateReturn<any, undefined, StructuredOutput>>;
|
|
505
|
+
private processChatResponse;
|
|
272
506
|
/**
|
|
273
507
|
* Streams a response from the agent
|
|
274
508
|
* @param params - Stream parameters including prompt
|
|
@@ -277,12 +511,26 @@ declare class Agent extends BaseResource {
|
|
|
277
511
|
stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
|
|
278
512
|
processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
|
|
279
513
|
}>;
|
|
514
|
+
/**
|
|
515
|
+
* Processes the stream response and handles tool calls
|
|
516
|
+
*/
|
|
517
|
+
private processStreamResponse;
|
|
280
518
|
/**
|
|
281
519
|
* Gets details about a specific tool available to the agent
|
|
282
520
|
* @param toolId - ID of the tool to retrieve
|
|
283
521
|
* @returns Promise containing tool details
|
|
284
522
|
*/
|
|
285
523
|
getTool(toolId: string): Promise<GetToolResponse>;
|
|
524
|
+
/**
|
|
525
|
+
* Executes a tool for the agent
|
|
526
|
+
* @param toolId - ID of the tool to execute
|
|
527
|
+
* @param params - Parameters required for tool execution
|
|
528
|
+
* @returns Promise containing the tool execution results
|
|
529
|
+
*/
|
|
530
|
+
executeTool(toolId: string, params: {
|
|
531
|
+
data: any;
|
|
532
|
+
runtimeContext?: RuntimeContext;
|
|
533
|
+
}): Promise<any>;
|
|
286
534
|
/**
|
|
287
535
|
* Retrieves evaluation results for the agent
|
|
288
536
|
* @returns Promise containing agent evaluations
|
|
@@ -308,7 +556,7 @@ declare class Network extends BaseResource {
|
|
|
308
556
|
* @param params - Generation parameters including prompt
|
|
309
557
|
* @returns Promise containing the generated response
|
|
310
558
|
*/
|
|
311
|
-
generate<
|
|
559
|
+
generate<Output extends JSONSchema7 | ZodSchema | undefined = undefined, StructuredOutput extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<Output>): Promise<GenerateReturn$1<any, Output, StructuredOutput>>;
|
|
312
560
|
/**
|
|
313
561
|
* Streams a response from the agent
|
|
314
562
|
* @param params - Stream parameters including prompt
|
|
@@ -343,9 +591,30 @@ declare class MemoryThread extends BaseResource {
|
|
|
343
591
|
}>;
|
|
344
592
|
/**
|
|
345
593
|
* Retrieves messages associated with the thread
|
|
594
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
346
595
|
* @returns Promise containing thread messages and UI messages
|
|
347
596
|
*/
|
|
348
|
-
getMessages(): Promise<GetMemoryThreadMessagesResponse>;
|
|
597
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
598
|
+
/**
|
|
599
|
+
* Retrieves paginated messages associated with the thread with advanced filtering and selection options
|
|
600
|
+
* @param params - Pagination parameters including selectBy criteria, page, perPage, date ranges, and message inclusion options
|
|
601
|
+
* @returns Promise containing paginated thread messages with pagination metadata (total, page, perPage, hasMore)
|
|
602
|
+
*/
|
|
603
|
+
getMessagesPaginated({ selectBy, ...rest }: GetMemoryThreadMessagesPaginatedParams): Promise<GetMemoryThreadMessagesPaginatedResponse>;
|
|
604
|
+
/**
|
|
605
|
+
* Deletes one or more messages from the thread
|
|
606
|
+
* @param messageIds - Can be a single message ID (string), array of message IDs,
|
|
607
|
+
* message object with id property, or array of message objects
|
|
608
|
+
* @returns Promise containing deletion result
|
|
609
|
+
*/
|
|
610
|
+
deleteMessages(messageIds: string | string[] | {
|
|
611
|
+
id: string;
|
|
612
|
+
} | {
|
|
613
|
+
id: string;
|
|
614
|
+
}[]): Promise<{
|
|
615
|
+
success: boolean;
|
|
616
|
+
message: string;
|
|
617
|
+
}>;
|
|
349
618
|
}
|
|
350
619
|
|
|
351
620
|
declare class Vector extends BaseResource {
|
|
@@ -394,28 +663,22 @@ declare class Vector extends BaseResource {
|
|
|
394
663
|
query(params: QueryVectorParams): Promise<QueryVectorResponse>;
|
|
395
664
|
}
|
|
396
665
|
|
|
397
|
-
declare class
|
|
666
|
+
declare class LegacyWorkflow extends BaseResource {
|
|
398
667
|
private workflowId;
|
|
399
668
|
constructor(options: ClientOptions, workflowId: string);
|
|
400
669
|
/**
|
|
401
|
-
* Retrieves details about the workflow
|
|
402
|
-
* @returns Promise containing workflow details including steps and graphs
|
|
403
|
-
*/
|
|
404
|
-
details(): Promise<GetWorkflowResponse>;
|
|
405
|
-
/**
|
|
406
|
-
* Retrieves all runs for a workflow
|
|
407
|
-
* @returns Promise containing workflow runs array
|
|
670
|
+
* Retrieves details about the legacy workflow
|
|
671
|
+
* @returns Promise containing legacy workflow details including steps and graphs
|
|
408
672
|
*/
|
|
409
|
-
|
|
673
|
+
details(): Promise<GetLegacyWorkflowResponse>;
|
|
410
674
|
/**
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
* @
|
|
414
|
-
* @returns Promise containing the workflow execution results
|
|
675
|
+
* Retrieves all runs for a legacy workflow
|
|
676
|
+
* @param params - Parameters for filtering runs
|
|
677
|
+
* @returns Promise containing legacy workflow runs array
|
|
415
678
|
*/
|
|
416
|
-
|
|
679
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetLegacyWorkflowRunsResponse>;
|
|
417
680
|
/**
|
|
418
|
-
* Creates a new workflow run
|
|
681
|
+
* Creates a new legacy workflow run
|
|
419
682
|
* @returns Promise containing the generated run ID
|
|
420
683
|
*/
|
|
421
684
|
createRun(params?: {
|
|
@@ -424,7 +687,7 @@ declare class Workflow extends BaseResource {
|
|
|
424
687
|
runId: string;
|
|
425
688
|
}>;
|
|
426
689
|
/**
|
|
427
|
-
* Starts a workflow run synchronously without waiting for the workflow to complete
|
|
690
|
+
* Starts a legacy workflow run synchronously without waiting for the workflow to complete
|
|
428
691
|
* @param params - Object containing the runId and triggerData
|
|
429
692
|
* @returns Promise containing success message
|
|
430
693
|
*/
|
|
@@ -435,11 +698,11 @@ declare class Workflow extends BaseResource {
|
|
|
435
698
|
message: string;
|
|
436
699
|
}>;
|
|
437
700
|
/**
|
|
438
|
-
* Resumes a suspended workflow step synchronously without waiting for the workflow to complete
|
|
701
|
+
* Resumes a suspended legacy workflow step synchronously without waiting for the workflow to complete
|
|
439
702
|
* @param stepId - ID of the step to resume
|
|
440
|
-
* @param runId - ID of the workflow run
|
|
441
|
-
* @param context - Context to resume the workflow with
|
|
442
|
-
* @returns Promise containing the workflow resume results
|
|
703
|
+
* @param runId - ID of the legacy workflow run
|
|
704
|
+
* @param context - Context to resume the legacy workflow with
|
|
705
|
+
* @returns Promise containing the legacy workflow resume results
|
|
443
706
|
*/
|
|
444
707
|
resume({ stepId, runId, context, }: {
|
|
445
708
|
stepId: string;
|
|
@@ -456,9 +719,9 @@ declare class Workflow extends BaseResource {
|
|
|
456
719
|
startAsync(params: {
|
|
457
720
|
runId?: string;
|
|
458
721
|
triggerData: Record<string, any>;
|
|
459
|
-
}): Promise<
|
|
722
|
+
}): Promise<LegacyWorkflowRunResult>;
|
|
460
723
|
/**
|
|
461
|
-
* Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
724
|
+
* Resumes a suspended legacy workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
462
725
|
* @param params - Object containing the runId, stepId, and context
|
|
463
726
|
* @returns Promise containing the workflow resume results
|
|
464
727
|
*/
|
|
@@ -466,7 +729,7 @@ declare class Workflow extends BaseResource {
|
|
|
466
729
|
runId: string;
|
|
467
730
|
stepId: string;
|
|
468
731
|
context: Record<string, any>;
|
|
469
|
-
}): Promise<
|
|
732
|
+
}): Promise<LegacyWorkflowRunResult>;
|
|
470
733
|
/**
|
|
471
734
|
* Creates an async generator that processes a readable stream and yields records
|
|
472
735
|
* separated by the Record Separator character (\x1E)
|
|
@@ -476,13 +739,13 @@ declare class Workflow extends BaseResource {
|
|
|
476
739
|
*/
|
|
477
740
|
private streamProcessor;
|
|
478
741
|
/**
|
|
479
|
-
* Watches workflow transitions in real-time
|
|
742
|
+
* Watches legacy workflow transitions in real-time
|
|
480
743
|
* @param runId - Optional run ID to filter the watch stream
|
|
481
|
-
* @returns AsyncGenerator that yields parsed records from the workflow watch stream
|
|
744
|
+
* @returns AsyncGenerator that yields parsed records from the legacy workflow watch stream
|
|
482
745
|
*/
|
|
483
746
|
watch({ runId }: {
|
|
484
747
|
runId?: string;
|
|
485
|
-
}, onRecord: (record:
|
|
748
|
+
}, onRecord: (record: LegacyWorkflowRunResult) => void): Promise<void>;
|
|
486
749
|
}
|
|
487
750
|
|
|
488
751
|
declare class Tool extends BaseResource {
|
|
@@ -501,14 +764,15 @@ declare class Tool extends BaseResource {
|
|
|
501
764
|
execute(params: {
|
|
502
765
|
data: any;
|
|
503
766
|
runId?: string;
|
|
767
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
504
768
|
}): Promise<any>;
|
|
505
769
|
}
|
|
506
770
|
|
|
507
|
-
declare class
|
|
771
|
+
declare class Workflow extends BaseResource {
|
|
508
772
|
private workflowId;
|
|
509
773
|
constructor(options: ClientOptions, workflowId: string);
|
|
510
774
|
/**
|
|
511
|
-
* Creates an async generator that processes a readable stream and yields
|
|
775
|
+
* Creates an async generator that processes a readable stream and yields workflow records
|
|
512
776
|
* separated by the Record Separator character (\x1E)
|
|
513
777
|
*
|
|
514
778
|
* @param stream - The readable stream to process
|
|
@@ -516,17 +780,50 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
516
780
|
*/
|
|
517
781
|
private streamProcessor;
|
|
518
782
|
/**
|
|
519
|
-
* Retrieves details about the
|
|
520
|
-
* @returns Promise containing
|
|
783
|
+
* Retrieves details about the workflow
|
|
784
|
+
* @returns Promise containing workflow details including steps and graphs
|
|
785
|
+
*/
|
|
786
|
+
details(): Promise<GetWorkflowResponse>;
|
|
787
|
+
/**
|
|
788
|
+
* Retrieves all runs for a workflow
|
|
789
|
+
* @param params - Parameters for filtering runs
|
|
790
|
+
* @returns Promise containing workflow runs array
|
|
791
|
+
*/
|
|
792
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
793
|
+
/**
|
|
794
|
+
* Retrieves a specific workflow run by its ID
|
|
795
|
+
* @param runId - The ID of the workflow run to retrieve
|
|
796
|
+
* @returns Promise containing the workflow run details
|
|
521
797
|
*/
|
|
522
|
-
|
|
798
|
+
runById(runId: string): Promise<GetWorkflowRunByIdResponse>;
|
|
523
799
|
/**
|
|
524
|
-
* Retrieves
|
|
525
|
-
* @
|
|
800
|
+
* Retrieves the execution result for a specific workflow run by its ID
|
|
801
|
+
* @param runId - The ID of the workflow run to retrieve the execution result for
|
|
802
|
+
* @returns Promise containing the workflow run execution result
|
|
526
803
|
*/
|
|
527
|
-
|
|
804
|
+
runExecutionResult(runId: string): Promise<GetWorkflowRunExecutionResultResponse>;
|
|
805
|
+
/**
|
|
806
|
+
* Cancels a specific workflow run by its ID
|
|
807
|
+
* @param runId - The ID of the workflow run to cancel
|
|
808
|
+
* @returns Promise containing a success message
|
|
809
|
+
*/
|
|
810
|
+
cancelRun(runId: string): Promise<{
|
|
811
|
+
message: string;
|
|
812
|
+
}>;
|
|
813
|
+
/**
|
|
814
|
+
* Sends an event to a specific workflow run by its ID
|
|
815
|
+
* @param params - Object containing the runId, event and data
|
|
816
|
+
* @returns Promise containing a success message
|
|
817
|
+
*/
|
|
818
|
+
sendRunEvent(params: {
|
|
819
|
+
runId: string;
|
|
820
|
+
event: string;
|
|
821
|
+
data: unknown;
|
|
822
|
+
}): Promise<{
|
|
823
|
+
message: string;
|
|
824
|
+
}>;
|
|
528
825
|
/**
|
|
529
|
-
* Creates a new
|
|
826
|
+
* Creates a new workflow run
|
|
530
827
|
* @param params - Optional object containing the optional runId
|
|
531
828
|
* @returns Promise containing the runId of the created run
|
|
532
829
|
*/
|
|
@@ -536,59 +833,237 @@ declare class VNextWorkflow extends BaseResource {
|
|
|
536
833
|
runId: string;
|
|
537
834
|
}>;
|
|
538
835
|
/**
|
|
539
|
-
*
|
|
836
|
+
* Creates a new workflow run (alias for createRun)
|
|
837
|
+
* @param params - Optional object containing the optional runId
|
|
838
|
+
* @returns Promise containing the runId of the created run
|
|
839
|
+
*/
|
|
840
|
+
createRunAsync(params?: {
|
|
841
|
+
runId?: string;
|
|
842
|
+
}): Promise<{
|
|
843
|
+
runId: string;
|
|
844
|
+
}>;
|
|
845
|
+
/**
|
|
846
|
+
* Starts a workflow run synchronously without waiting for the workflow to complete
|
|
540
847
|
* @param params - Object containing the runId, inputData and runtimeContext
|
|
541
848
|
* @returns Promise containing success message
|
|
542
849
|
*/
|
|
543
850
|
start(params: {
|
|
544
851
|
runId: string;
|
|
545
852
|
inputData: Record<string, any>;
|
|
546
|
-
runtimeContext?: RuntimeContext
|
|
853
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
547
854
|
}): Promise<{
|
|
548
855
|
message: string;
|
|
549
856
|
}>;
|
|
550
857
|
/**
|
|
551
|
-
* Resumes a suspended
|
|
858
|
+
* Resumes a suspended workflow step synchronously without waiting for the workflow to complete
|
|
552
859
|
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
553
860
|
* @returns Promise containing success message
|
|
554
861
|
*/
|
|
555
|
-
resume({ step, runId, resumeData,
|
|
862
|
+
resume({ step, runId, resumeData, ...rest }: {
|
|
556
863
|
step: string | string[];
|
|
557
864
|
runId: string;
|
|
558
865
|
resumeData?: Record<string, any>;
|
|
559
|
-
runtimeContext?: RuntimeContext
|
|
866
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
560
867
|
}): Promise<{
|
|
561
868
|
message: string;
|
|
562
869
|
}>;
|
|
563
870
|
/**
|
|
564
|
-
* Starts a
|
|
871
|
+
* Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
|
|
565
872
|
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
566
|
-
* @returns Promise containing the
|
|
873
|
+
* @returns Promise containing the workflow execution results
|
|
567
874
|
*/
|
|
568
875
|
startAsync(params: {
|
|
876
|
+
runId?: string;
|
|
877
|
+
inputData: Record<string, any>;
|
|
878
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
879
|
+
}): Promise<WorkflowRunResult>;
|
|
880
|
+
/**
|
|
881
|
+
* Starts a workflow run and returns a stream
|
|
882
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
883
|
+
* @returns Promise containing the workflow execution results
|
|
884
|
+
*/
|
|
885
|
+
stream(params: {
|
|
569
886
|
runId?: string;
|
|
570
887
|
inputData: Record<string, any>;
|
|
571
888
|
runtimeContext?: RuntimeContext;
|
|
572
|
-
}): Promise<
|
|
889
|
+
}): Promise<stream_web.ReadableStream<{
|
|
890
|
+
type: string;
|
|
891
|
+
payload: any;
|
|
892
|
+
}>>;
|
|
573
893
|
/**
|
|
574
|
-
* Resumes a suspended
|
|
894
|
+
* Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
575
895
|
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
576
|
-
* @returns Promise containing the
|
|
896
|
+
* @returns Promise containing the workflow resume results
|
|
577
897
|
*/
|
|
578
898
|
resumeAsync(params: {
|
|
579
899
|
runId: string;
|
|
580
900
|
step: string | string[];
|
|
581
901
|
resumeData?: Record<string, any>;
|
|
582
|
-
runtimeContext?: RuntimeContext
|
|
583
|
-
}): Promise<
|
|
902
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
903
|
+
}): Promise<WorkflowRunResult>;
|
|
584
904
|
/**
|
|
585
|
-
* Watches
|
|
905
|
+
* Watches workflow transitions in real-time
|
|
586
906
|
* @param runId - Optional run ID to filter the watch stream
|
|
587
|
-
* @returns AsyncGenerator that yields parsed records from the
|
|
907
|
+
* @returns AsyncGenerator that yields parsed records from the workflow watch stream
|
|
588
908
|
*/
|
|
589
909
|
watch({ runId }: {
|
|
590
910
|
runId?: string;
|
|
591
|
-
}, onRecord: (record:
|
|
911
|
+
}, onRecord: (record: WorkflowWatchResult) => void): Promise<void>;
|
|
912
|
+
/**
|
|
913
|
+
* Creates a new ReadableStream from an iterable or async iterable of objects,
|
|
914
|
+
* serializing each as JSON and separating them with the record separator (\x1E).
|
|
915
|
+
*
|
|
916
|
+
* @param records - An iterable or async iterable of objects to stream
|
|
917
|
+
* @returns A ReadableStream emitting the records as JSON strings separated by the record separator
|
|
918
|
+
*/
|
|
919
|
+
static createRecordStream(records: Iterable<any> | AsyncIterable<any>): ReadableStream;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* Class for interacting with an agent via the A2A protocol
|
|
924
|
+
*/
|
|
925
|
+
declare class A2A extends BaseResource {
|
|
926
|
+
private agentId;
|
|
927
|
+
constructor(options: ClientOptions, agentId: string);
|
|
928
|
+
/**
|
|
929
|
+
* Get the agent card with metadata about the agent
|
|
930
|
+
* @returns Promise containing the agent card information
|
|
931
|
+
*/
|
|
932
|
+
getCard(): Promise<AgentCard>;
|
|
933
|
+
/**
|
|
934
|
+
* Send a message to the agent and get a response
|
|
935
|
+
* @param params - Parameters for the task
|
|
936
|
+
* @returns Promise containing the task response
|
|
937
|
+
*/
|
|
938
|
+
sendMessage(params: TaskSendParams): Promise<{
|
|
939
|
+
task: Task;
|
|
940
|
+
}>;
|
|
941
|
+
/**
|
|
942
|
+
* Get the status and result of a task
|
|
943
|
+
* @param params - Parameters for querying the task
|
|
944
|
+
* @returns Promise containing the task response
|
|
945
|
+
*/
|
|
946
|
+
getTask(params: TaskQueryParams): Promise<Task>;
|
|
947
|
+
/**
|
|
948
|
+
* Cancel a running task
|
|
949
|
+
* @param params - Parameters identifying the task to cancel
|
|
950
|
+
* @returns Promise containing the task response
|
|
951
|
+
*/
|
|
952
|
+
cancelTask(params: TaskIdParams): Promise<{
|
|
953
|
+
task: Task;
|
|
954
|
+
}>;
|
|
955
|
+
/**
|
|
956
|
+
* Send a message and subscribe to streaming updates (not fully implemented)
|
|
957
|
+
* @param params - Parameters for the task
|
|
958
|
+
* @returns Promise containing the task response
|
|
959
|
+
*/
|
|
960
|
+
sendAndSubscribe(params: TaskSendParams): Promise<Response>;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* Represents a specific tool available on a specific MCP server.
|
|
965
|
+
* Provides methods to get details and execute the tool.
|
|
966
|
+
*/
|
|
967
|
+
declare class MCPTool extends BaseResource {
|
|
968
|
+
private serverId;
|
|
969
|
+
private toolId;
|
|
970
|
+
constructor(options: ClientOptions, serverId: string, toolId: string);
|
|
971
|
+
/**
|
|
972
|
+
* Retrieves details about this specific tool from the MCP server.
|
|
973
|
+
* @returns Promise containing the tool's information (name, description, schema).
|
|
974
|
+
*/
|
|
975
|
+
details(): Promise<McpToolInfo>;
|
|
976
|
+
/**
|
|
977
|
+
* Executes this specific tool on the MCP server.
|
|
978
|
+
* @param params - Parameters for tool execution, including data/args and optional runtimeContext.
|
|
979
|
+
* @returns Promise containing the result of the tool execution.
|
|
980
|
+
*/
|
|
981
|
+
execute(params: {
|
|
982
|
+
data?: any;
|
|
983
|
+
runtimeContext?: RuntimeContext;
|
|
984
|
+
}): Promise<any>;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
declare class NetworkMemoryThread extends BaseResource {
|
|
988
|
+
private threadId;
|
|
989
|
+
private networkId;
|
|
990
|
+
constructor(options: ClientOptions, threadId: string, networkId: string);
|
|
991
|
+
/**
|
|
992
|
+
* Retrieves the memory thread details
|
|
993
|
+
* @returns Promise containing thread details including title and metadata
|
|
994
|
+
*/
|
|
995
|
+
get(): Promise<StorageThreadType>;
|
|
996
|
+
/**
|
|
997
|
+
* Updates the memory thread properties
|
|
998
|
+
* @param params - Update parameters including title and metadata
|
|
999
|
+
* @returns Promise containing updated thread details
|
|
1000
|
+
*/
|
|
1001
|
+
update(params: UpdateMemoryThreadParams): Promise<StorageThreadType>;
|
|
1002
|
+
/**
|
|
1003
|
+
* Deletes the memory thread
|
|
1004
|
+
* @returns Promise containing deletion result
|
|
1005
|
+
*/
|
|
1006
|
+
delete(): Promise<{
|
|
1007
|
+
result: string;
|
|
1008
|
+
}>;
|
|
1009
|
+
/**
|
|
1010
|
+
* Retrieves messages associated with the thread
|
|
1011
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
1012
|
+
* @returns Promise containing thread messages and UI messages
|
|
1013
|
+
*/
|
|
1014
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
1015
|
+
/**
|
|
1016
|
+
* Deletes one or more messages from the thread
|
|
1017
|
+
* @param messageIds - Can be a single message ID (string), array of message IDs,
|
|
1018
|
+
* message object with id property, or array of message objects
|
|
1019
|
+
* @returns Promise containing deletion result
|
|
1020
|
+
*/
|
|
1021
|
+
deleteMessages(messageIds: string | string[] | {
|
|
1022
|
+
id: string;
|
|
1023
|
+
} | {
|
|
1024
|
+
id: string;
|
|
1025
|
+
}[]): Promise<{
|
|
1026
|
+
success: boolean;
|
|
1027
|
+
message: string;
|
|
1028
|
+
}>;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
declare class VNextNetwork extends BaseResource {
|
|
1032
|
+
private networkId;
|
|
1033
|
+
constructor(options: ClientOptions, networkId: string);
|
|
1034
|
+
/**
|
|
1035
|
+
* Retrieves details about the network
|
|
1036
|
+
* @returns Promise containing vNext network details
|
|
1037
|
+
*/
|
|
1038
|
+
details(): Promise<GetVNextNetworkResponse>;
|
|
1039
|
+
/**
|
|
1040
|
+
* Generates a response from the v-next network
|
|
1041
|
+
* @param params - Generation parameters including message
|
|
1042
|
+
* @returns Promise containing the generated response
|
|
1043
|
+
*/
|
|
1044
|
+
generate(params: GenerateOrStreamVNextNetworkParams): Promise<GenerateVNextNetworkResponse>;
|
|
1045
|
+
/**
|
|
1046
|
+
* Generates a response from the v-next network using multiple primitives
|
|
1047
|
+
* @param params - Generation parameters including message
|
|
1048
|
+
* @returns Promise containing the generated response
|
|
1049
|
+
*/
|
|
1050
|
+
loop(params: {
|
|
1051
|
+
message: string;
|
|
1052
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
1053
|
+
}): Promise<LoopVNextNetworkResponse>;
|
|
1054
|
+
private streamProcessor;
|
|
1055
|
+
/**
|
|
1056
|
+
* Streams a response from the v-next network
|
|
1057
|
+
* @param params - Stream parameters including message
|
|
1058
|
+
* @returns Promise containing the results
|
|
1059
|
+
*/
|
|
1060
|
+
stream(params: GenerateOrStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
|
|
1061
|
+
/**
|
|
1062
|
+
* Streams a response from the v-next network loop
|
|
1063
|
+
* @param params - Stream parameters including message
|
|
1064
|
+
* @returns Promise containing the results
|
|
1065
|
+
*/
|
|
1066
|
+
loopStream(params: LoopStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
|
|
592
1067
|
}
|
|
593
1068
|
|
|
594
1069
|
declare class MastraClient extends BaseResource {
|
|
@@ -598,6 +1073,9 @@ declare class MastraClient extends BaseResource {
|
|
|
598
1073
|
* @returns Promise containing map of agent IDs to agent details
|
|
599
1074
|
*/
|
|
600
1075
|
getAgents(): Promise<Record<string, GetAgentResponse>>;
|
|
1076
|
+
getAGUI({ resourceId }: {
|
|
1077
|
+
resourceId: string;
|
|
1078
|
+
}): Promise<Record<string, AbstractAgent>>;
|
|
601
1079
|
/**
|
|
602
1080
|
* Gets an agent instance by ID
|
|
603
1081
|
* @param agentId - ID of the agent to retrieve
|
|
@@ -635,6 +1113,37 @@ declare class MastraClient extends BaseResource {
|
|
|
635
1113
|
getMemoryStatus(agentId: string): Promise<{
|
|
636
1114
|
result: boolean;
|
|
637
1115
|
}>;
|
|
1116
|
+
/**
|
|
1117
|
+
* Retrieves memory threads for a resource
|
|
1118
|
+
* @param params - Parameters containing the resource ID
|
|
1119
|
+
* @returns Promise containing array of memory threads
|
|
1120
|
+
*/
|
|
1121
|
+
getNetworkMemoryThreads(params: GetNetworkMemoryThreadParams): Promise<GetMemoryThreadResponse>;
|
|
1122
|
+
/**
|
|
1123
|
+
* Creates a new memory thread
|
|
1124
|
+
* @param params - Parameters for creating the memory thread
|
|
1125
|
+
* @returns Promise containing the created memory thread
|
|
1126
|
+
*/
|
|
1127
|
+
createNetworkMemoryThread(params: CreateNetworkMemoryThreadParams): Promise<CreateMemoryThreadResponse>;
|
|
1128
|
+
/**
|
|
1129
|
+
* Gets a memory thread instance by ID
|
|
1130
|
+
* @param threadId - ID of the memory thread to retrieve
|
|
1131
|
+
* @returns MemoryThread instance
|
|
1132
|
+
*/
|
|
1133
|
+
getNetworkMemoryThread(threadId: string, networkId: string): NetworkMemoryThread;
|
|
1134
|
+
/**
|
|
1135
|
+
* Saves messages to memory
|
|
1136
|
+
* @param params - Parameters containing messages to save
|
|
1137
|
+
* @returns Promise containing the saved messages
|
|
1138
|
+
*/
|
|
1139
|
+
saveNetworkMessageToMemory(params: SaveNetworkMessageToMemoryParams): Promise<SaveMessageToMemoryResponse>;
|
|
1140
|
+
/**
|
|
1141
|
+
* Gets the status of the memory system
|
|
1142
|
+
* @returns Promise containing memory system status
|
|
1143
|
+
*/
|
|
1144
|
+
getNetworkMemoryStatus(networkId: string): Promise<{
|
|
1145
|
+
result: boolean;
|
|
1146
|
+
}>;
|
|
638
1147
|
/**
|
|
639
1148
|
* Retrieves all available tools
|
|
640
1149
|
* @returns Promise containing map of tool IDs to tool details
|
|
@@ -646,6 +1155,17 @@ declare class MastraClient extends BaseResource {
|
|
|
646
1155
|
* @returns Tool instance
|
|
647
1156
|
*/
|
|
648
1157
|
getTool(toolId: string): Tool;
|
|
1158
|
+
/**
|
|
1159
|
+
* Retrieves all available legacy workflows
|
|
1160
|
+
* @returns Promise containing map of legacy workflow IDs to legacy workflow details
|
|
1161
|
+
*/
|
|
1162
|
+
getLegacyWorkflows(): Promise<Record<string, GetLegacyWorkflowResponse>>;
|
|
1163
|
+
/**
|
|
1164
|
+
* Gets a legacy workflow instance by ID
|
|
1165
|
+
* @param workflowId - ID of the legacy workflow to retrieve
|
|
1166
|
+
* @returns Legacy Workflow instance
|
|
1167
|
+
*/
|
|
1168
|
+
getLegacyWorkflow(workflowId: string): LegacyWorkflow;
|
|
649
1169
|
/**
|
|
650
1170
|
* Retrieves all available workflows
|
|
651
1171
|
* @returns Promise containing map of workflow IDs to workflow details
|
|
@@ -657,17 +1177,6 @@ declare class MastraClient extends BaseResource {
|
|
|
657
1177
|
* @returns Workflow instance
|
|
658
1178
|
*/
|
|
659
1179
|
getWorkflow(workflowId: string): Workflow;
|
|
660
|
-
/**
|
|
661
|
-
* Retrieves all available vNext workflows
|
|
662
|
-
* @returns Promise containing map of vNext workflow IDs to vNext workflow details
|
|
663
|
-
*/
|
|
664
|
-
getVNextWorkflows(): Promise<Record<string, GetVNextWorkflowResponse>>;
|
|
665
|
-
/**
|
|
666
|
-
* Gets a vNext workflow instance by ID
|
|
667
|
-
* @param workflowId - ID of the vNext workflow to retrieve
|
|
668
|
-
* @returns vNext Workflow instance
|
|
669
|
-
*/
|
|
670
|
-
getVNextWorkflow(workflowId: string): VNextWorkflow;
|
|
671
1180
|
/**
|
|
672
1181
|
* Gets a vector instance by name
|
|
673
1182
|
* @param vectorName - Name of the vector to retrieve
|
|
@@ -703,13 +1212,117 @@ declare class MastraClient extends BaseResource {
|
|
|
703
1212
|
* Retrieves all available networks
|
|
704
1213
|
* @returns Promise containing map of network IDs to network details
|
|
705
1214
|
*/
|
|
706
|
-
getNetworks(): Promise<
|
|
1215
|
+
getNetworks(): Promise<Array<GetNetworkResponse>>;
|
|
1216
|
+
/**
|
|
1217
|
+
* Retrieves all available vNext networks
|
|
1218
|
+
* @returns Promise containing map of vNext network IDs to vNext network details
|
|
1219
|
+
*/
|
|
1220
|
+
getVNextNetworks(): Promise<Array<GetVNextNetworkResponse>>;
|
|
707
1221
|
/**
|
|
708
1222
|
* Gets a network instance by ID
|
|
709
1223
|
* @param networkId - ID of the network to retrieve
|
|
710
1224
|
* @returns Network instance
|
|
711
1225
|
*/
|
|
712
1226
|
getNetwork(networkId: string): Network;
|
|
1227
|
+
/**
|
|
1228
|
+
* Gets a vNext network instance by ID
|
|
1229
|
+
* @param networkId - ID of the vNext network to retrieve
|
|
1230
|
+
* @returns vNext Network instance
|
|
1231
|
+
*/
|
|
1232
|
+
getVNextNetwork(networkId: string): VNextNetwork;
|
|
1233
|
+
/**
|
|
1234
|
+
* Retrieves a list of available MCP servers.
|
|
1235
|
+
* @param params - Optional parameters for pagination (limit, offset).
|
|
1236
|
+
* @returns Promise containing the list of MCP servers and pagination info.
|
|
1237
|
+
*/
|
|
1238
|
+
getMcpServers(params?: {
|
|
1239
|
+
limit?: number;
|
|
1240
|
+
offset?: number;
|
|
1241
|
+
}): Promise<McpServerListResponse>;
|
|
1242
|
+
/**
|
|
1243
|
+
* Retrieves detailed information for a specific MCP server.
|
|
1244
|
+
* @param serverId - The ID of the MCP server to retrieve.
|
|
1245
|
+
* @param params - Optional parameters, e.g., specific version.
|
|
1246
|
+
* @returns Promise containing the detailed MCP server information.
|
|
1247
|
+
*/
|
|
1248
|
+
getMcpServerDetails(serverId: string, params?: {
|
|
1249
|
+
version?: string;
|
|
1250
|
+
}): Promise<ServerDetailInfo>;
|
|
1251
|
+
/**
|
|
1252
|
+
* Retrieves a list of tools for a specific MCP server.
|
|
1253
|
+
* @param serverId - The ID of the MCP server.
|
|
1254
|
+
* @returns Promise containing the list of tools.
|
|
1255
|
+
*/
|
|
1256
|
+
getMcpServerTools(serverId: string): Promise<McpServerToolListResponse>;
|
|
1257
|
+
/**
|
|
1258
|
+
* Gets an MCPTool resource instance for a specific tool on an MCP server.
|
|
1259
|
+
* This instance can then be used to fetch details or execute the tool.
|
|
1260
|
+
* @param serverId - The ID of the MCP server.
|
|
1261
|
+
* @param toolId - The ID of the tool.
|
|
1262
|
+
* @returns MCPTool instance.
|
|
1263
|
+
*/
|
|
1264
|
+
getMcpServerTool(serverId: string, toolId: string): MCPTool;
|
|
1265
|
+
/**
|
|
1266
|
+
* Gets an A2A client for interacting with an agent via the A2A protocol
|
|
1267
|
+
* @param agentId - ID of the agent to interact with
|
|
1268
|
+
* @returns A2A client instance
|
|
1269
|
+
*/
|
|
1270
|
+
getA2A(agentId: string): A2A;
|
|
1271
|
+
/**
|
|
1272
|
+
* Retrieves the working memory for a specific thread (optionally resource-scoped).
|
|
1273
|
+
* @param agentId - ID of the agent.
|
|
1274
|
+
* @param threadId - ID of the thread.
|
|
1275
|
+
* @param resourceId - Optional ID of the resource.
|
|
1276
|
+
* @returns Working memory for the specified thread or resource.
|
|
1277
|
+
*/
|
|
1278
|
+
getWorkingMemory({ agentId, threadId, resourceId, }: {
|
|
1279
|
+
agentId: string;
|
|
1280
|
+
threadId: string;
|
|
1281
|
+
resourceId?: string;
|
|
1282
|
+
}): Promise<unknown>;
|
|
1283
|
+
/**
|
|
1284
|
+
* Updates the working memory for a specific thread (optionally resource-scoped).
|
|
1285
|
+
* @param agentId - ID of the agent.
|
|
1286
|
+
* @param threadId - ID of the thread.
|
|
1287
|
+
* @param workingMemory - The new working memory content.
|
|
1288
|
+
* @param resourceId - Optional ID of the resource.
|
|
1289
|
+
*/
|
|
1290
|
+
updateWorkingMemory({ agentId, threadId, workingMemory, resourceId, }: {
|
|
1291
|
+
agentId: string;
|
|
1292
|
+
threadId: string;
|
|
1293
|
+
workingMemory: string;
|
|
1294
|
+
resourceId?: string;
|
|
1295
|
+
}): Promise<unknown>;
|
|
1296
|
+
/**
|
|
1297
|
+
* Retrieves all available scorers
|
|
1298
|
+
* @returns Promise containing list of available scorers
|
|
1299
|
+
*/
|
|
1300
|
+
getScorers(): Promise<Record<string, GetScorerResponse>>;
|
|
1301
|
+
/**
|
|
1302
|
+
* Retrieves a scorer by ID
|
|
1303
|
+
* @param scorerId - ID of the scorer to retrieve
|
|
1304
|
+
* @returns Promise containing the scorer
|
|
1305
|
+
*/
|
|
1306
|
+
getScorer(scorerId: string): Promise<GetScorerResponse>;
|
|
1307
|
+
getScoresByScorerId(params: GetScoresByScorerIdParams): Promise<GetScoresResponse>;
|
|
1308
|
+
/**
|
|
1309
|
+
* Retrieves scores by run ID
|
|
1310
|
+
* @param params - Parameters containing run ID and pagination options
|
|
1311
|
+
* @returns Promise containing scores and pagination info
|
|
1312
|
+
*/
|
|
1313
|
+
getScoresByRunId(params: GetScoresByRunIdParams): Promise<GetScoresResponse>;
|
|
1314
|
+
/**
|
|
1315
|
+
* Retrieves scores by entity ID and type
|
|
1316
|
+
* @param params - Parameters containing entity ID, type, and pagination options
|
|
1317
|
+
* @returns Promise containing scores and pagination info
|
|
1318
|
+
*/
|
|
1319
|
+
getScoresByEntityId(params: GetScoresByEntityIdParams): Promise<GetScoresResponse>;
|
|
1320
|
+
/**
|
|
1321
|
+
* Saves a score
|
|
1322
|
+
* @param params - Parameters containing the score data to save
|
|
1323
|
+
* @returns Promise containing the saved score
|
|
1324
|
+
*/
|
|
1325
|
+
saveScore(params: SaveScoreParams): Promise<SaveScoreResponse>;
|
|
713
1326
|
}
|
|
714
1327
|
|
|
715
|
-
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
|
|
1328
|
+
export { type ClientOptions, type ClientScoreRowData, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type CreateNetworkMemoryThreadParams, type GenerateOrStreamVNextNetworkParams, type GenerateParams, type GenerateVNextNetworkResponse, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesPaginatedParams, type GetMemoryThreadMessagesPaginatedResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkMemoryThreadParams, type GetNetworkResponse, type GetScorerResponse, type GetScorersResponse, type GetScoresByEntityIdParams, type GetScoresByRunIdParams, type GetScoresByScorerIdParams, type GetScoresResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVNextNetworkResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunByIdResponse, type GetWorkflowRunExecutionResultResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, type LoopStreamVNextNetworkParams, type LoopVNextNetworkResponse, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type SaveNetworkMessageToMemoryParams, type SaveScoreParams, type SaveScoreResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
|