@mastra/client-js 0.0.0-extend-clickhouse-20250418135620 → 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 +1308 -2
- package/LICENSE.md +11 -42
- package/README.md +2 -1
- package/dist/index.cjs +1773 -86
- package/dist/index.d.cts +789 -46
- package/dist/index.d.ts +789 -46
- package/dist/index.js +1773 -90
- package/package.json +26 -15
- package/src/adapters/agui.test.ts +180 -0
- package/src/adapters/agui.ts +239 -0
- package/src/client.ts +414 -14
- package/src/example.ts +59 -29
- package/src/index.test.ts +526 -10
- package/src/index.ts +1 -0
- package/src/resources/a2a.ts +88 -0
- package/src/resources/agent.ts +629 -49
- package/src/resources/base.ts +8 -2
- package/src/resources/index.ts +4 -1
- package/src/resources/legacy-workflow.ts +242 -0
- package/src/resources/mcp-tool.ts +48 -0
- package/src/resources/memory-thread.test.ts +285 -0
- package/src/resources/memory-thread.ts +44 -5
- package/src/resources/network-memory-thread.test.ts +269 -0
- package/src/resources/network-memory-thread.ts +81 -0
- package/src/resources/network.ts +11 -17
- package/src/resources/tool.ts +16 -3
- package/src/resources/vNextNetwork.ts +194 -0
- package/src/resources/workflow.ts +289 -94
- package/src/types.ts +300 -22
- 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,8 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AbstractAgent } from '@ag-ui/client';
|
|
2
|
+
import { ServerInfo, MCPToolType, ServerDetailInfo } from '@mastra/core/mcp';
|
|
3
|
+
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
4
|
+
import { GenerateReturn } from '@mastra/core/llm';
|
|
2
5
|
import { JSONSchema7 } from 'json-schema';
|
|
3
6
|
import { ZodSchema } from 'zod';
|
|
4
|
-
import {
|
|
5
|
-
import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
|
|
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';
|
|
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';
|
|
6
17
|
|
|
7
18
|
interface ClientOptions {
|
|
8
19
|
/** Base URL for API requests */
|
|
@@ -15,29 +26,49 @@ interface ClientOptions {
|
|
|
15
26
|
maxBackoffMs?: number;
|
|
16
27
|
/** Custom headers to include with requests */
|
|
17
28
|
headers?: Record<string, string>;
|
|
29
|
+
/** Abort signal for request */
|
|
30
|
+
abortSignal?: AbortSignal;
|
|
18
31
|
}
|
|
19
32
|
interface RequestOptions {
|
|
20
33
|
method?: string;
|
|
21
34
|
headers?: Record<string, string>;
|
|
22
35
|
body?: any;
|
|
23
36
|
stream?: boolean;
|
|
24
|
-
signal?: AbortSignal;
|
|
25
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
|
+
};
|
|
26
43
|
interface GetAgentResponse {
|
|
27
44
|
name: string;
|
|
28
45
|
instructions: string;
|
|
29
46
|
tools: Record<string, GetToolResponse>;
|
|
47
|
+
workflows: Record<string, GetWorkflowResponse>;
|
|
30
48
|
provider: string;
|
|
31
49
|
modelId: string;
|
|
50
|
+
defaultGenerateOptions: WithoutMethods<AgentGenerateOptions>;
|
|
51
|
+
defaultStreamOptions: WithoutMethods<AgentStreamOptions>;
|
|
32
52
|
}
|
|
33
53
|
type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
34
|
-
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
35
|
-
|
|
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'>>;
|
|
36
60
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
37
|
-
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
38
|
-
|
|
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'>>;
|
|
39
67
|
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
40
68
|
evals: any[];
|
|
69
|
+
instructions: string;
|
|
70
|
+
name: string;
|
|
71
|
+
id: string;
|
|
41
72
|
}
|
|
42
73
|
interface GetToolResponse {
|
|
43
74
|
id: string;
|
|
@@ -45,7 +76,7 @@ interface GetToolResponse {
|
|
|
45
76
|
inputSchema: string;
|
|
46
77
|
outputSchema: string;
|
|
47
78
|
}
|
|
48
|
-
interface
|
|
79
|
+
interface GetLegacyWorkflowResponse {
|
|
49
80
|
name: string;
|
|
50
81
|
triggerSchema: string;
|
|
51
82
|
steps: Record<string, StepAction<any, any, any, any>>;
|
|
@@ -53,16 +84,59 @@ interface GetWorkflowResponse {
|
|
|
53
84
|
stepSubscriberGraph: Record<string, StepGraph>;
|
|
54
85
|
workflowId?: string;
|
|
55
86
|
}
|
|
56
|
-
|
|
87
|
+
interface GetWorkflowRunsParams {
|
|
88
|
+
fromDate?: Date;
|
|
89
|
+
toDate?: Date;
|
|
90
|
+
limit?: number;
|
|
91
|
+
offset?: number;
|
|
92
|
+
resourceId?: string;
|
|
93
|
+
}
|
|
94
|
+
type GetLegacyWorkflowRunsResponse = LegacyWorkflowRuns;
|
|
95
|
+
type GetWorkflowRunsResponse = WorkflowRuns;
|
|
96
|
+
type GetWorkflowRunByIdResponse = WorkflowRun;
|
|
97
|
+
type GetWorkflowRunExecutionResultResponse = WatchEvent['payload']['workflowState'];
|
|
98
|
+
type LegacyWorkflowRunResult = {
|
|
57
99
|
activePaths: Record<string, {
|
|
58
100
|
status: string;
|
|
59
101
|
suspendPayload?: any;
|
|
60
102
|
stepPath: string[];
|
|
61
103
|
}>;
|
|
62
|
-
results:
|
|
104
|
+
results: LegacyWorkflowRunResult$1<any, any, any>['results'];
|
|
63
105
|
timestamp: number;
|
|
64
106
|
runId: string;
|
|
65
107
|
};
|
|
108
|
+
interface GetWorkflowResponse {
|
|
109
|
+
name: string;
|
|
110
|
+
description?: string;
|
|
111
|
+
steps: {
|
|
112
|
+
[key: string]: {
|
|
113
|
+
id: string;
|
|
114
|
+
description: string;
|
|
115
|
+
inputSchema: string;
|
|
116
|
+
outputSchema: string;
|
|
117
|
+
resumeSchema: string;
|
|
118
|
+
suspendSchema: string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
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'];
|
|
133
|
+
inputSchema: string;
|
|
134
|
+
outputSchema: string;
|
|
135
|
+
}
|
|
136
|
+
type WorkflowWatchResult = WatchEvent & {
|
|
137
|
+
runId: string;
|
|
138
|
+
};
|
|
139
|
+
type WorkflowRunResult = WorkflowResult<any, any>;
|
|
66
140
|
interface UpsertVectorParams {
|
|
67
141
|
indexName: string;
|
|
68
142
|
vectors: number[][];
|
|
@@ -90,40 +164,83 @@ interface GetVectorIndexResponse {
|
|
|
90
164
|
count: number;
|
|
91
165
|
}
|
|
92
166
|
interface SaveMessageToMemoryParams {
|
|
93
|
-
messages:
|
|
167
|
+
messages: (MastraMessageV1 | MastraMessageV2)[];
|
|
94
168
|
agentId: string;
|
|
95
169
|
}
|
|
96
|
-
|
|
170
|
+
interface SaveNetworkMessageToMemoryParams {
|
|
171
|
+
messages: (MastraMessageV1 | MastraMessageV2)[];
|
|
172
|
+
networkId: string;
|
|
173
|
+
}
|
|
174
|
+
type SaveMessageToMemoryResponse = (MastraMessageV1 | MastraMessageV2)[];
|
|
97
175
|
interface CreateMemoryThreadParams {
|
|
98
|
-
title
|
|
99
|
-
metadata
|
|
100
|
-
|
|
101
|
-
threadId
|
|
176
|
+
title?: string;
|
|
177
|
+
metadata?: Record<string, any>;
|
|
178
|
+
resourceId: string;
|
|
179
|
+
threadId?: string;
|
|
102
180
|
agentId: string;
|
|
103
181
|
}
|
|
182
|
+
interface CreateNetworkMemoryThreadParams {
|
|
183
|
+
title?: string;
|
|
184
|
+
metadata?: Record<string, any>;
|
|
185
|
+
resourceId: string;
|
|
186
|
+
threadId?: string;
|
|
187
|
+
networkId: string;
|
|
188
|
+
}
|
|
104
189
|
type CreateMemoryThreadResponse = StorageThreadType;
|
|
105
190
|
interface GetMemoryThreadParams {
|
|
106
191
|
resourceId: string;
|
|
107
192
|
agentId: string;
|
|
108
193
|
}
|
|
194
|
+
interface GetNetworkMemoryThreadParams {
|
|
195
|
+
resourceId: string;
|
|
196
|
+
networkId: string;
|
|
197
|
+
}
|
|
109
198
|
type GetMemoryThreadResponse = StorageThreadType[];
|
|
110
199
|
interface UpdateMemoryThreadParams {
|
|
111
200
|
title: string;
|
|
112
201
|
metadata: Record<string, any>;
|
|
113
|
-
|
|
202
|
+
resourceId: string;
|
|
114
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'>;
|
|
115
211
|
interface GetMemoryThreadMessagesResponse {
|
|
116
212
|
messages: CoreMessage[];
|
|
117
213
|
uiMessages: AiMessageType[];
|
|
118
214
|
}
|
|
215
|
+
type GetMemoryThreadMessagesPaginatedResponse = PaginationInfo & {
|
|
216
|
+
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
217
|
+
};
|
|
119
218
|
interface GetLogsParams {
|
|
120
219
|
transportId: string;
|
|
220
|
+
fromDate?: Date;
|
|
221
|
+
toDate?: Date;
|
|
222
|
+
logLevel?: LogLevel;
|
|
223
|
+
filters?: Record<string, string>;
|
|
224
|
+
page?: number;
|
|
225
|
+
perPage?: number;
|
|
121
226
|
}
|
|
122
227
|
interface GetLogParams {
|
|
123
228
|
runId: string;
|
|
124
229
|
transportId: string;
|
|
230
|
+
fromDate?: Date;
|
|
231
|
+
toDate?: Date;
|
|
232
|
+
logLevel?: LogLevel;
|
|
233
|
+
filters?: Record<string, string>;
|
|
234
|
+
page?: number;
|
|
235
|
+
perPage?: number;
|
|
125
236
|
}
|
|
126
|
-
type GetLogsResponse =
|
|
237
|
+
type GetLogsResponse = {
|
|
238
|
+
logs: BaseLogMessage[];
|
|
239
|
+
total: number;
|
|
240
|
+
page: number;
|
|
241
|
+
perPage: number;
|
|
242
|
+
hasMore: boolean;
|
|
243
|
+
};
|
|
127
244
|
type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
|
|
128
245
|
type SpanStatus = {
|
|
129
246
|
code: number;
|
|
@@ -171,8 +288,11 @@ interface GetTelemetryParams {
|
|
|
171
288
|
page?: number;
|
|
172
289
|
perPage?: number;
|
|
173
290
|
attribute?: Record<string, string>;
|
|
291
|
+
fromDate?: Date;
|
|
292
|
+
toDate?: Date;
|
|
174
293
|
}
|
|
175
294
|
interface GetNetworkResponse {
|
|
295
|
+
id: string;
|
|
176
296
|
name: string;
|
|
177
297
|
instructions: string;
|
|
178
298
|
agents: Array<{
|
|
@@ -186,6 +306,125 @@ interface GetNetworkResponse {
|
|
|
186
306
|
};
|
|
187
307
|
state?: Record<string, any>;
|
|
188
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
|
+
}
|
|
189
428
|
|
|
190
429
|
declare class BaseResource {
|
|
191
430
|
readonly options: ClientOptions;
|
|
@@ -218,7 +457,9 @@ declare class AgentVoice extends BaseResource {
|
|
|
218
457
|
* @param options - Optional provider-specific options
|
|
219
458
|
* @returns Promise containing the transcribed text
|
|
220
459
|
*/
|
|
221
|
-
listen(audio: Blob, options?: Record<string, any>): Promise<
|
|
460
|
+
listen(audio: Blob, options?: Record<string, any>): Promise<{
|
|
461
|
+
text: string;
|
|
462
|
+
}>;
|
|
222
463
|
/**
|
|
223
464
|
* Get available speakers for the agent's voice provider
|
|
224
465
|
* @returns Promise containing list of available speakers
|
|
@@ -227,6 +468,13 @@ declare class AgentVoice extends BaseResource {
|
|
|
227
468
|
voiceId: string;
|
|
228
469
|
[key: string]: any;
|
|
229
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
|
+
}>;
|
|
230
478
|
}
|
|
231
479
|
declare class Agent extends BaseResource {
|
|
232
480
|
private agentId;
|
|
@@ -242,7 +490,19 @@ declare class Agent extends BaseResource {
|
|
|
242
490
|
* @param params - Generation parameters including prompt
|
|
243
491
|
* @returns Promise containing the generated response
|
|
244
492
|
*/
|
|
245
|
-
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;
|
|
246
506
|
/**
|
|
247
507
|
* Streams a response from the agent
|
|
248
508
|
* @param params - Stream parameters including prompt
|
|
@@ -251,12 +511,26 @@ declare class Agent extends BaseResource {
|
|
|
251
511
|
stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
|
|
252
512
|
processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
|
|
253
513
|
}>;
|
|
514
|
+
/**
|
|
515
|
+
* Processes the stream response and handles tool calls
|
|
516
|
+
*/
|
|
517
|
+
private processStreamResponse;
|
|
254
518
|
/**
|
|
255
519
|
* Gets details about a specific tool available to the agent
|
|
256
520
|
* @param toolId - ID of the tool to retrieve
|
|
257
521
|
* @returns Promise containing tool details
|
|
258
522
|
*/
|
|
259
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>;
|
|
260
534
|
/**
|
|
261
535
|
* Retrieves evaluation results for the agent
|
|
262
536
|
* @returns Promise containing agent evaluations
|
|
@@ -282,7 +556,7 @@ declare class Network extends BaseResource {
|
|
|
282
556
|
* @param params - Generation parameters including prompt
|
|
283
557
|
* @returns Promise containing the generated response
|
|
284
558
|
*/
|
|
285
|
-
generate<
|
|
559
|
+
generate<Output extends JSONSchema7 | ZodSchema | undefined = undefined, StructuredOutput extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<Output>): Promise<GenerateReturn$1<any, Output, StructuredOutput>>;
|
|
286
560
|
/**
|
|
287
561
|
* Streams a response from the agent
|
|
288
562
|
* @param params - Stream parameters including prompt
|
|
@@ -317,9 +591,30 @@ declare class MemoryThread extends BaseResource {
|
|
|
317
591
|
}>;
|
|
318
592
|
/**
|
|
319
593
|
* Retrieves messages associated with the thread
|
|
594
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
320
595
|
* @returns Promise containing thread messages and UI messages
|
|
321
596
|
*/
|
|
322
|
-
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
|
+
}>;
|
|
323
618
|
}
|
|
324
619
|
|
|
325
620
|
declare class Vector extends BaseResource {
|
|
@@ -368,23 +663,22 @@ declare class Vector extends BaseResource {
|
|
|
368
663
|
query(params: QueryVectorParams): Promise<QueryVectorResponse>;
|
|
369
664
|
}
|
|
370
665
|
|
|
371
|
-
declare class
|
|
666
|
+
declare class LegacyWorkflow extends BaseResource {
|
|
372
667
|
private workflowId;
|
|
373
668
|
constructor(options: ClientOptions, workflowId: string);
|
|
374
669
|
/**
|
|
375
|
-
* Retrieves details about the workflow
|
|
376
|
-
* @returns Promise containing workflow details including steps and graphs
|
|
670
|
+
* Retrieves details about the legacy workflow
|
|
671
|
+
* @returns Promise containing legacy workflow details including steps and graphs
|
|
377
672
|
*/
|
|
378
|
-
details(): Promise<
|
|
673
|
+
details(): Promise<GetLegacyWorkflowResponse>;
|
|
379
674
|
/**
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
* @
|
|
383
|
-
* @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
|
|
384
678
|
*/
|
|
385
|
-
|
|
679
|
+
runs(params?: GetWorkflowRunsParams): Promise<GetLegacyWorkflowRunsResponse>;
|
|
386
680
|
/**
|
|
387
|
-
* Creates a new workflow run
|
|
681
|
+
* Creates a new legacy workflow run
|
|
388
682
|
* @returns Promise containing the generated run ID
|
|
389
683
|
*/
|
|
390
684
|
createRun(params?: {
|
|
@@ -393,7 +687,7 @@ declare class Workflow extends BaseResource {
|
|
|
393
687
|
runId: string;
|
|
394
688
|
}>;
|
|
395
689
|
/**
|
|
396
|
-
* 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
|
|
397
691
|
* @param params - Object containing the runId and triggerData
|
|
398
692
|
* @returns Promise containing success message
|
|
399
693
|
*/
|
|
@@ -404,11 +698,11 @@ declare class Workflow extends BaseResource {
|
|
|
404
698
|
message: string;
|
|
405
699
|
}>;
|
|
406
700
|
/**
|
|
407
|
-
* 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
|
|
408
702
|
* @param stepId - ID of the step to resume
|
|
409
|
-
* @param runId - ID of the workflow run
|
|
410
|
-
* @param context - Context to resume the workflow with
|
|
411
|
-
* @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
|
|
412
706
|
*/
|
|
413
707
|
resume({ stepId, runId, context, }: {
|
|
414
708
|
stepId: string;
|
|
@@ -425,9 +719,9 @@ declare class Workflow extends BaseResource {
|
|
|
425
719
|
startAsync(params: {
|
|
426
720
|
runId?: string;
|
|
427
721
|
triggerData: Record<string, any>;
|
|
428
|
-
}): Promise<
|
|
722
|
+
}): Promise<LegacyWorkflowRunResult>;
|
|
429
723
|
/**
|
|
430
|
-
* 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
|
|
431
725
|
* @param params - Object containing the runId, stepId, and context
|
|
432
726
|
* @returns Promise containing the workflow resume results
|
|
433
727
|
*/
|
|
@@ -435,7 +729,7 @@ declare class Workflow extends BaseResource {
|
|
|
435
729
|
runId: string;
|
|
436
730
|
stepId: string;
|
|
437
731
|
context: Record<string, any>;
|
|
438
|
-
}): Promise<
|
|
732
|
+
}): Promise<LegacyWorkflowRunResult>;
|
|
439
733
|
/**
|
|
440
734
|
* Creates an async generator that processes a readable stream and yields records
|
|
441
735
|
* separated by the Record Separator character (\x1E)
|
|
@@ -445,13 +739,13 @@ declare class Workflow extends BaseResource {
|
|
|
445
739
|
*/
|
|
446
740
|
private streamProcessor;
|
|
447
741
|
/**
|
|
448
|
-
* Watches workflow transitions in real-time
|
|
742
|
+
* Watches legacy workflow transitions in real-time
|
|
449
743
|
* @param runId - Optional run ID to filter the watch stream
|
|
450
|
-
* @returns AsyncGenerator that yields parsed records from the workflow watch stream
|
|
744
|
+
* @returns AsyncGenerator that yields parsed records from the legacy workflow watch stream
|
|
451
745
|
*/
|
|
452
746
|
watch({ runId }: {
|
|
453
747
|
runId?: string;
|
|
454
|
-
}, onRecord: (record:
|
|
748
|
+
}, onRecord: (record: LegacyWorkflowRunResult) => void): Promise<void>;
|
|
455
749
|
}
|
|
456
750
|
|
|
457
751
|
declare class Tool extends BaseResource {
|
|
@@ -469,9 +763,309 @@ declare class Tool extends BaseResource {
|
|
|
469
763
|
*/
|
|
470
764
|
execute(params: {
|
|
471
765
|
data: any;
|
|
766
|
+
runId?: string;
|
|
767
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
472
768
|
}): Promise<any>;
|
|
473
769
|
}
|
|
474
770
|
|
|
771
|
+
declare class Workflow extends BaseResource {
|
|
772
|
+
private workflowId;
|
|
773
|
+
constructor(options: ClientOptions, workflowId: string);
|
|
774
|
+
/**
|
|
775
|
+
* Creates an async generator that processes a readable stream and yields workflow records
|
|
776
|
+
* separated by the Record Separator character (\x1E)
|
|
777
|
+
*
|
|
778
|
+
* @param stream - The readable stream to process
|
|
779
|
+
* @returns An async generator that yields parsed records
|
|
780
|
+
*/
|
|
781
|
+
private streamProcessor;
|
|
782
|
+
/**
|
|
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
|
|
797
|
+
*/
|
|
798
|
+
runById(runId: string): Promise<GetWorkflowRunByIdResponse>;
|
|
799
|
+
/**
|
|
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
|
|
803
|
+
*/
|
|
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
|
+
}>;
|
|
825
|
+
/**
|
|
826
|
+
* Creates a new workflow run
|
|
827
|
+
* @param params - Optional object containing the optional runId
|
|
828
|
+
* @returns Promise containing the runId of the created run
|
|
829
|
+
*/
|
|
830
|
+
createRun(params?: {
|
|
831
|
+
runId?: string;
|
|
832
|
+
}): Promise<{
|
|
833
|
+
runId: string;
|
|
834
|
+
}>;
|
|
835
|
+
/**
|
|
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
|
|
847
|
+
* @param params - Object containing the runId, inputData and runtimeContext
|
|
848
|
+
* @returns Promise containing success message
|
|
849
|
+
*/
|
|
850
|
+
start(params: {
|
|
851
|
+
runId: string;
|
|
852
|
+
inputData: Record<string, any>;
|
|
853
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
854
|
+
}): Promise<{
|
|
855
|
+
message: string;
|
|
856
|
+
}>;
|
|
857
|
+
/**
|
|
858
|
+
* Resumes a suspended workflow step synchronously without waiting for the workflow to complete
|
|
859
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
860
|
+
* @returns Promise containing success message
|
|
861
|
+
*/
|
|
862
|
+
resume({ step, runId, resumeData, ...rest }: {
|
|
863
|
+
step: string | string[];
|
|
864
|
+
runId: string;
|
|
865
|
+
resumeData?: Record<string, any>;
|
|
866
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
867
|
+
}): Promise<{
|
|
868
|
+
message: string;
|
|
869
|
+
}>;
|
|
870
|
+
/**
|
|
871
|
+
* Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
|
|
872
|
+
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
873
|
+
* @returns Promise containing the workflow execution results
|
|
874
|
+
*/
|
|
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: {
|
|
886
|
+
runId?: string;
|
|
887
|
+
inputData: Record<string, any>;
|
|
888
|
+
runtimeContext?: RuntimeContext;
|
|
889
|
+
}): Promise<stream_web.ReadableStream<{
|
|
890
|
+
type: string;
|
|
891
|
+
payload: any;
|
|
892
|
+
}>>;
|
|
893
|
+
/**
|
|
894
|
+
* Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
895
|
+
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
896
|
+
* @returns Promise containing the workflow resume results
|
|
897
|
+
*/
|
|
898
|
+
resumeAsync(params: {
|
|
899
|
+
runId: string;
|
|
900
|
+
step: string | string[];
|
|
901
|
+
resumeData?: Record<string, any>;
|
|
902
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
903
|
+
}): Promise<WorkflowRunResult>;
|
|
904
|
+
/**
|
|
905
|
+
* Watches workflow transitions in real-time
|
|
906
|
+
* @param runId - Optional run ID to filter the watch stream
|
|
907
|
+
* @returns AsyncGenerator that yields parsed records from the workflow watch stream
|
|
908
|
+
*/
|
|
909
|
+
watch({ runId }: {
|
|
910
|
+
runId?: string;
|
|
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>;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
475
1069
|
declare class MastraClient extends BaseResource {
|
|
476
1070
|
constructor(options: ClientOptions);
|
|
477
1071
|
/**
|
|
@@ -479,6 +1073,9 @@ declare class MastraClient extends BaseResource {
|
|
|
479
1073
|
* @returns Promise containing map of agent IDs to agent details
|
|
480
1074
|
*/
|
|
481
1075
|
getAgents(): Promise<Record<string, GetAgentResponse>>;
|
|
1076
|
+
getAGUI({ resourceId }: {
|
|
1077
|
+
resourceId: string;
|
|
1078
|
+
}): Promise<Record<string, AbstractAgent>>;
|
|
482
1079
|
/**
|
|
483
1080
|
* Gets an agent instance by ID
|
|
484
1081
|
* @param agentId - ID of the agent to retrieve
|
|
@@ -516,6 +1113,37 @@ declare class MastraClient extends BaseResource {
|
|
|
516
1113
|
getMemoryStatus(agentId: string): Promise<{
|
|
517
1114
|
result: boolean;
|
|
518
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
|
+
}>;
|
|
519
1147
|
/**
|
|
520
1148
|
* Retrieves all available tools
|
|
521
1149
|
* @returns Promise containing map of tool IDs to tool details
|
|
@@ -527,6 +1155,17 @@ declare class MastraClient extends BaseResource {
|
|
|
527
1155
|
* @returns Tool instance
|
|
528
1156
|
*/
|
|
529
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;
|
|
530
1169
|
/**
|
|
531
1170
|
* Retrieves all available workflows
|
|
532
1171
|
* @returns Promise containing map of workflow IDs to workflow details
|
|
@@ -573,13 +1212,117 @@ declare class MastraClient extends BaseResource {
|
|
|
573
1212
|
* Retrieves all available networks
|
|
574
1213
|
* @returns Promise containing map of network IDs to network details
|
|
575
1214
|
*/
|
|
576
|
-
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>>;
|
|
577
1221
|
/**
|
|
578
1222
|
* Gets a network instance by ID
|
|
579
1223
|
* @param networkId - ID of the network to retrieve
|
|
580
1224
|
* @returns Network instance
|
|
581
1225
|
*/
|
|
582
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>;
|
|
583
1326
|
}
|
|
584
1327
|
|
|
585
|
-
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 GetVectorIndexResponse, type GetWorkflowResponse, MastraClient, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult };
|
|
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 };
|