@mastra/client-js 0.0.0-taofeeqInngest-20250603090617 → 0.0.0-transpile-packages-20250724123433
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/.turbo/turbo-build.log +9 -9
- package/CHANGELOG.md +575 -2
- package/LICENSE.md +11 -42
- package/README.md +2 -1
- package/dist/index.cjs +903 -33
- package/dist/index.d.cts +333 -16
- package/dist/index.d.ts +333 -16
- package/dist/index.js +904 -34
- package/package.json +22 -17
- package/src/client.ts +195 -3
- package/src/example.ts +46 -15
- package/src/index.test.ts +53 -5
- package/src/resources/agent.ts +613 -18
- package/src/resources/base.ts +4 -0
- package/src/resources/memory-thread.ts +18 -0
- package/src/resources/network-memory-thread.ts +63 -0
- package/src/resources/network.ts +2 -3
- package/src/resources/vNextNetwork.ts +194 -0
- package/src/resources/workflow.ts +66 -9
- package/src/types.ts +139 -6
- package/src/utils/process-client-tools.ts +32 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { AbstractAgent } from '@ag-ui/client';
|
|
2
2
|
import { ServerInfo, MCPToolType, ServerDetailInfo } from '@mastra/core/mcp';
|
|
3
|
-
import { processDataStream } from '@ai-sdk/ui-utils';
|
|
4
|
-
import { CoreMessage, AiMessageType, StorageThreadType, MastraMessageV1, LegacyWorkflowRuns, WorkflowRuns, QueryResult, GenerateReturn } from '@mastra/core';
|
|
3
|
+
import { processDataStream, processTextStream } from '@ai-sdk/ui-utils';
|
|
4
|
+
import { CoreMessage, AiMessageType, StorageThreadType, StorageGetMessagesArg, PaginationInfo, MastraMessageV1, MastraMessageV2, LegacyWorkflowRuns, WorkflowRuns, WorkflowRun, QueryResult, GenerateReturn } from '@mastra/core';
|
|
5
5
|
import { JSONSchema7 } from 'json-schema';
|
|
6
6
|
import { ZodSchema } from 'zod';
|
|
7
|
-
import { AgentGenerateOptions, AgentStreamOptions } from '@mastra/core/agent';
|
|
8
|
-
import { BaseLogMessage } from '@mastra/core/logger';
|
|
7
|
+
import { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
|
|
8
|
+
import { LogLevel, BaseLogMessage } from '@mastra/core/logger';
|
|
9
9
|
import { RuntimeContext } from '@mastra/core/runtime-context';
|
|
10
|
-
import { Workflow as Workflow$1,
|
|
10
|
+
import { Workflow as Workflow$1, WatchEvent, WorkflowResult } from '@mastra/core/workflows';
|
|
11
11
|
import { StepAction, StepGraph, LegacyWorkflowRunResult as LegacyWorkflowRunResult$1 } from '@mastra/core/workflows/legacy';
|
|
12
12
|
import * as stream_web from 'stream/web';
|
|
13
13
|
import { AgentCard, TaskSendParams, Task, TaskQueryParams, TaskIdParams } from '@mastra/core/a2a';
|
|
@@ -23,13 +23,14 @@ interface ClientOptions {
|
|
|
23
23
|
maxBackoffMs?: number;
|
|
24
24
|
/** Custom headers to include with requests */
|
|
25
25
|
headers?: Record<string, string>;
|
|
26
|
+
/** Abort signal for request */
|
|
27
|
+
abortSignal?: AbortSignal;
|
|
26
28
|
}
|
|
27
29
|
interface RequestOptions {
|
|
28
30
|
method?: string;
|
|
29
31
|
headers?: Record<string, string>;
|
|
30
32
|
body?: any;
|
|
31
33
|
stream?: boolean;
|
|
32
|
-
signal?: AbortSignal;
|
|
33
34
|
}
|
|
34
35
|
type WithoutMethods<T> = {
|
|
35
36
|
[K in keyof T as T[K] extends (...args: any[]) => any ? never : T[K] extends {
|
|
@@ -51,13 +52,15 @@ type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> =
|
|
|
51
52
|
output?: T;
|
|
52
53
|
experimental_output?: T;
|
|
53
54
|
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
54
|
-
|
|
55
|
+
clientTools?: ToolsInput;
|
|
56
|
+
} & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
|
|
55
57
|
type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
|
|
56
58
|
messages: string | string[] | CoreMessage[] | AiMessageType[];
|
|
57
59
|
output?: T;
|
|
58
60
|
experimental_output?: T;
|
|
59
61
|
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
60
|
-
|
|
62
|
+
clientTools?: ToolsInput;
|
|
63
|
+
} & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
|
|
61
64
|
interface GetEvalsByAgentIdResponse extends GetAgentResponse {
|
|
62
65
|
evals: any[];
|
|
63
66
|
instructions: string;
|
|
@@ -87,6 +90,8 @@ interface GetWorkflowRunsParams {
|
|
|
87
90
|
}
|
|
88
91
|
type GetLegacyWorkflowRunsResponse = LegacyWorkflowRuns;
|
|
89
92
|
type GetWorkflowRunsResponse = WorkflowRuns;
|
|
93
|
+
type GetWorkflowRunByIdResponse = WorkflowRun;
|
|
94
|
+
type GetWorkflowRunExecutionResultResponse = WatchEvent['payload']['workflowState'];
|
|
90
95
|
type LegacyWorkflowRunResult = {
|
|
91
96
|
activePaths: Record<string, {
|
|
92
97
|
status: string;
|
|
@@ -110,6 +115,17 @@ interface GetWorkflowResponse {
|
|
|
110
115
|
suspendSchema: string;
|
|
111
116
|
};
|
|
112
117
|
};
|
|
118
|
+
allSteps: {
|
|
119
|
+
[key: string]: {
|
|
120
|
+
id: string;
|
|
121
|
+
description: string;
|
|
122
|
+
inputSchema: string;
|
|
123
|
+
outputSchema: string;
|
|
124
|
+
resumeSchema: string;
|
|
125
|
+
suspendSchema: string;
|
|
126
|
+
isWorkflow: boolean;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
113
129
|
stepGraph: Workflow$1['serializedStepGraph'];
|
|
114
130
|
inputSchema: string;
|
|
115
131
|
outputSchema: string;
|
|
@@ -148,6 +164,10 @@ interface SaveMessageToMemoryParams {
|
|
|
148
164
|
messages: MastraMessageV1[];
|
|
149
165
|
agentId: string;
|
|
150
166
|
}
|
|
167
|
+
interface SaveNetworkMessageToMemoryParams {
|
|
168
|
+
messages: MastraMessageV1[];
|
|
169
|
+
networkId: string;
|
|
170
|
+
}
|
|
151
171
|
type SaveMessageToMemoryResponse = MastraMessageV1[];
|
|
152
172
|
interface CreateMemoryThreadParams {
|
|
153
173
|
title?: string;
|
|
@@ -156,11 +176,22 @@ interface CreateMemoryThreadParams {
|
|
|
156
176
|
threadId?: string;
|
|
157
177
|
agentId: string;
|
|
158
178
|
}
|
|
179
|
+
interface CreateNetworkMemoryThreadParams {
|
|
180
|
+
title?: string;
|
|
181
|
+
metadata?: Record<string, any>;
|
|
182
|
+
resourceId: string;
|
|
183
|
+
threadId?: string;
|
|
184
|
+
networkId: string;
|
|
185
|
+
}
|
|
159
186
|
type CreateMemoryThreadResponse = StorageThreadType;
|
|
160
187
|
interface GetMemoryThreadParams {
|
|
161
188
|
resourceId: string;
|
|
162
189
|
agentId: string;
|
|
163
190
|
}
|
|
191
|
+
interface GetNetworkMemoryThreadParams {
|
|
192
|
+
resourceId: string;
|
|
193
|
+
networkId: string;
|
|
194
|
+
}
|
|
164
195
|
type GetMemoryThreadResponse = StorageThreadType[];
|
|
165
196
|
interface UpdateMemoryThreadParams {
|
|
166
197
|
title: string;
|
|
@@ -173,18 +204,40 @@ interface GetMemoryThreadMessagesParams {
|
|
|
173
204
|
*/
|
|
174
205
|
limit?: number;
|
|
175
206
|
}
|
|
207
|
+
type GetMemoryThreadMessagesPaginatedParams = Omit<StorageGetMessagesArg, 'threadConfig' | 'threadId'>;
|
|
176
208
|
interface GetMemoryThreadMessagesResponse {
|
|
177
209
|
messages: CoreMessage[];
|
|
178
210
|
uiMessages: AiMessageType[];
|
|
179
211
|
}
|
|
212
|
+
type GetMemoryThreadMessagesPaginatedResponse = PaginationInfo & {
|
|
213
|
+
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
214
|
+
};
|
|
180
215
|
interface GetLogsParams {
|
|
181
216
|
transportId: string;
|
|
217
|
+
fromDate?: Date;
|
|
218
|
+
toDate?: Date;
|
|
219
|
+
logLevel?: LogLevel;
|
|
220
|
+
filters?: Record<string, string>;
|
|
221
|
+
page?: number;
|
|
222
|
+
perPage?: number;
|
|
182
223
|
}
|
|
183
224
|
interface GetLogParams {
|
|
184
225
|
runId: string;
|
|
185
226
|
transportId: string;
|
|
227
|
+
fromDate?: Date;
|
|
228
|
+
toDate?: Date;
|
|
229
|
+
logLevel?: LogLevel;
|
|
230
|
+
filters?: Record<string, string>;
|
|
231
|
+
page?: number;
|
|
232
|
+
perPage?: number;
|
|
186
233
|
}
|
|
187
|
-
type GetLogsResponse =
|
|
234
|
+
type GetLogsResponse = {
|
|
235
|
+
logs: BaseLogMessage[];
|
|
236
|
+
total: number;
|
|
237
|
+
page: number;
|
|
238
|
+
perPage: number;
|
|
239
|
+
hasMore: boolean;
|
|
240
|
+
};
|
|
188
241
|
type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
|
|
189
242
|
type SpanStatus = {
|
|
190
243
|
code: number;
|
|
@@ -236,6 +289,7 @@ interface GetTelemetryParams {
|
|
|
236
289
|
toDate?: Date;
|
|
237
290
|
}
|
|
238
291
|
interface GetNetworkResponse {
|
|
292
|
+
id: string;
|
|
239
293
|
name: string;
|
|
240
294
|
instructions: string;
|
|
241
295
|
agents: Array<{
|
|
@@ -249,6 +303,66 @@ interface GetNetworkResponse {
|
|
|
249
303
|
};
|
|
250
304
|
state?: Record<string, any>;
|
|
251
305
|
}
|
|
306
|
+
interface GetVNextNetworkResponse {
|
|
307
|
+
id: string;
|
|
308
|
+
name: string;
|
|
309
|
+
instructions: string;
|
|
310
|
+
agents: Array<{
|
|
311
|
+
name: string;
|
|
312
|
+
provider: string;
|
|
313
|
+
modelId: string;
|
|
314
|
+
}>;
|
|
315
|
+
routingModel: {
|
|
316
|
+
provider: string;
|
|
317
|
+
modelId: string;
|
|
318
|
+
};
|
|
319
|
+
workflows: Array<{
|
|
320
|
+
name: string;
|
|
321
|
+
description: string;
|
|
322
|
+
inputSchema: string | undefined;
|
|
323
|
+
outputSchema: string | undefined;
|
|
324
|
+
}>;
|
|
325
|
+
tools: Array<{
|
|
326
|
+
id: string;
|
|
327
|
+
description: string;
|
|
328
|
+
}>;
|
|
329
|
+
}
|
|
330
|
+
interface GenerateVNextNetworkResponse {
|
|
331
|
+
task: string;
|
|
332
|
+
result: string;
|
|
333
|
+
resourceId: string;
|
|
334
|
+
resourceType: 'none' | 'tool' | 'agent' | 'workflow';
|
|
335
|
+
}
|
|
336
|
+
interface GenerateOrStreamVNextNetworkParams {
|
|
337
|
+
message: string;
|
|
338
|
+
threadId?: string;
|
|
339
|
+
resourceId?: string;
|
|
340
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
341
|
+
}
|
|
342
|
+
interface LoopStreamVNextNetworkParams {
|
|
343
|
+
message: string;
|
|
344
|
+
threadId?: string;
|
|
345
|
+
resourceId?: string;
|
|
346
|
+
maxIterations?: number;
|
|
347
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
348
|
+
}
|
|
349
|
+
interface LoopVNextNetworkResponse {
|
|
350
|
+
status: 'success';
|
|
351
|
+
result: {
|
|
352
|
+
task: string;
|
|
353
|
+
resourceId: string;
|
|
354
|
+
resourceType: 'agent' | 'workflow' | 'none' | 'tool';
|
|
355
|
+
result: string;
|
|
356
|
+
iteration: number;
|
|
357
|
+
isOneOff: boolean;
|
|
358
|
+
prompt: string;
|
|
359
|
+
threadId?: string | undefined;
|
|
360
|
+
threadResourceId?: string | undefined;
|
|
361
|
+
isComplete?: boolean | undefined;
|
|
362
|
+
completionReason?: string | undefined;
|
|
363
|
+
};
|
|
364
|
+
steps: WorkflowResult<any, any>['steps'];
|
|
365
|
+
}
|
|
252
366
|
interface McpServerListResponse {
|
|
253
367
|
servers: ServerInfo[];
|
|
254
368
|
next: string | null;
|
|
@@ -329,14 +443,31 @@ declare class Agent extends BaseResource {
|
|
|
329
443
|
* @param params - Generation parameters including prompt
|
|
330
444
|
* @returns Promise containing the generated response
|
|
331
445
|
*/
|
|
332
|
-
generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T>
|
|
446
|
+
generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
|
|
447
|
+
output?: never;
|
|
448
|
+
experimental_output?: never;
|
|
449
|
+
}): Promise<GenerateReturn<T>>;
|
|
450
|
+
generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
|
|
451
|
+
output: T;
|
|
452
|
+
experimental_output?: never;
|
|
453
|
+
}): Promise<GenerateReturn<T>>;
|
|
454
|
+
generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
|
|
455
|
+
output?: never;
|
|
456
|
+
experimental_output: T;
|
|
457
|
+
}): Promise<GenerateReturn<T>>;
|
|
458
|
+
private processChatResponse;
|
|
459
|
+
/**
|
|
460
|
+
* Processes the stream response and handles tool calls
|
|
461
|
+
*/
|
|
462
|
+
private processStreamResponse;
|
|
333
463
|
/**
|
|
334
464
|
* Streams a response from the agent
|
|
335
465
|
* @param params - Stream parameters including prompt
|
|
336
|
-
* @returns Promise containing the enhanced Response object with processDataStream
|
|
466
|
+
* @returns Promise containing the enhanced Response object with processDataStream and processTextStream methods
|
|
337
467
|
*/
|
|
338
468
|
stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
|
|
339
469
|
processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
|
|
470
|
+
processTextStream: (options?: Omit<Parameters<typeof processTextStream>[0], 'stream'>) => Promise<void>;
|
|
340
471
|
}>;
|
|
341
472
|
/**
|
|
342
473
|
* Gets details about a specific tool available to the agent
|
|
@@ -418,6 +549,12 @@ declare class MemoryThread extends BaseResource {
|
|
|
418
549
|
* @returns Promise containing thread messages and UI messages
|
|
419
550
|
*/
|
|
420
551
|
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
552
|
+
/**
|
|
553
|
+
* Retrieves paginated messages associated with the thread with advanced filtering and selection options
|
|
554
|
+
* @param params - Pagination parameters including selectBy criteria, page, perPage, date ranges, and message inclusion options
|
|
555
|
+
* @returns Promise containing paginated thread messages with pagination metadata (total, page, perPage, hasMore)
|
|
556
|
+
*/
|
|
557
|
+
getMessagesPaginated({ selectBy, ...rest }: GetMemoryThreadMessagesPaginatedParams): Promise<GetMemoryThreadMessagesPaginatedResponse>;
|
|
421
558
|
}
|
|
422
559
|
|
|
423
560
|
declare class Vector extends BaseResource {
|
|
@@ -593,6 +730,38 @@ declare class Workflow extends BaseResource {
|
|
|
593
730
|
* @returns Promise containing workflow runs array
|
|
594
731
|
*/
|
|
595
732
|
runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
|
|
733
|
+
/**
|
|
734
|
+
* Retrieves a specific workflow run by its ID
|
|
735
|
+
* @param runId - The ID of the workflow run to retrieve
|
|
736
|
+
* @returns Promise containing the workflow run details
|
|
737
|
+
*/
|
|
738
|
+
runById(runId: string): Promise<GetWorkflowRunByIdResponse>;
|
|
739
|
+
/**
|
|
740
|
+
* Retrieves the execution result for a specific workflow run by its ID
|
|
741
|
+
* @param runId - The ID of the workflow run to retrieve the execution result for
|
|
742
|
+
* @returns Promise containing the workflow run execution result
|
|
743
|
+
*/
|
|
744
|
+
runExecutionResult(runId: string): Promise<GetWorkflowRunExecutionResultResponse>;
|
|
745
|
+
/**
|
|
746
|
+
* Cancels a specific workflow run by its ID
|
|
747
|
+
* @param runId - The ID of the workflow run to cancel
|
|
748
|
+
* @returns Promise containing a success message
|
|
749
|
+
*/
|
|
750
|
+
cancelRun(runId: string): Promise<{
|
|
751
|
+
message: string;
|
|
752
|
+
}>;
|
|
753
|
+
/**
|
|
754
|
+
* Sends an event to a specific workflow run by its ID
|
|
755
|
+
* @param params - Object containing the runId, event and data
|
|
756
|
+
* @returns Promise containing a success message
|
|
757
|
+
*/
|
|
758
|
+
sendRunEvent(params: {
|
|
759
|
+
runId: string;
|
|
760
|
+
event: string;
|
|
761
|
+
data: unknown;
|
|
762
|
+
}): Promise<{
|
|
763
|
+
message: string;
|
|
764
|
+
}>;
|
|
596
765
|
/**
|
|
597
766
|
* Creates a new workflow run
|
|
598
767
|
* @param params - Optional object containing the optional runId
|
|
@@ -603,6 +772,16 @@ declare class Workflow extends BaseResource {
|
|
|
603
772
|
}): Promise<{
|
|
604
773
|
runId: string;
|
|
605
774
|
}>;
|
|
775
|
+
/**
|
|
776
|
+
* Creates a new workflow run (alias for createRun)
|
|
777
|
+
* @param params - Optional object containing the optional runId
|
|
778
|
+
* @returns Promise containing the runId of the created run
|
|
779
|
+
*/
|
|
780
|
+
createRunAsync(params?: {
|
|
781
|
+
runId?: string;
|
|
782
|
+
}): Promise<{
|
|
783
|
+
runId: string;
|
|
784
|
+
}>;
|
|
606
785
|
/**
|
|
607
786
|
* Starts a workflow run synchronously without waiting for the workflow to complete
|
|
608
787
|
* @param params - Object containing the runId, inputData and runtimeContext
|
|
@@ -639,15 +818,18 @@ declare class Workflow extends BaseResource {
|
|
|
639
818
|
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
640
819
|
}): Promise<WorkflowRunResult>;
|
|
641
820
|
/**
|
|
642
|
-
* Starts a
|
|
821
|
+
* Starts a workflow run and returns a stream
|
|
643
822
|
* @param params - Object containing the optional runId, inputData and runtimeContext
|
|
644
|
-
* @returns Promise containing the
|
|
823
|
+
* @returns Promise containing the workflow execution results
|
|
645
824
|
*/
|
|
646
825
|
stream(params: {
|
|
647
826
|
runId?: string;
|
|
648
827
|
inputData: Record<string, any>;
|
|
649
828
|
runtimeContext?: RuntimeContext;
|
|
650
|
-
}): Promise<stream_web.ReadableStream<
|
|
829
|
+
}): Promise<stream_web.ReadableStream<{
|
|
830
|
+
type: string;
|
|
831
|
+
payload: any;
|
|
832
|
+
}>>;
|
|
651
833
|
/**
|
|
652
834
|
* Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
|
|
653
835
|
* @param params - Object containing the runId, step, resumeData and runtimeContext
|
|
@@ -742,6 +924,74 @@ declare class MCPTool extends BaseResource {
|
|
|
742
924
|
}): Promise<any>;
|
|
743
925
|
}
|
|
744
926
|
|
|
927
|
+
declare class NetworkMemoryThread extends BaseResource {
|
|
928
|
+
private threadId;
|
|
929
|
+
private networkId;
|
|
930
|
+
constructor(options: ClientOptions, threadId: string, networkId: string);
|
|
931
|
+
/**
|
|
932
|
+
* Retrieves the memory thread details
|
|
933
|
+
* @returns Promise containing thread details including title and metadata
|
|
934
|
+
*/
|
|
935
|
+
get(): Promise<StorageThreadType>;
|
|
936
|
+
/**
|
|
937
|
+
* Updates the memory thread properties
|
|
938
|
+
* @param params - Update parameters including title and metadata
|
|
939
|
+
* @returns Promise containing updated thread details
|
|
940
|
+
*/
|
|
941
|
+
update(params: UpdateMemoryThreadParams): Promise<StorageThreadType>;
|
|
942
|
+
/**
|
|
943
|
+
* Deletes the memory thread
|
|
944
|
+
* @returns Promise containing deletion result
|
|
945
|
+
*/
|
|
946
|
+
delete(): Promise<{
|
|
947
|
+
result: string;
|
|
948
|
+
}>;
|
|
949
|
+
/**
|
|
950
|
+
* Retrieves messages associated with the thread
|
|
951
|
+
* @param params - Optional parameters including limit for number of messages to retrieve
|
|
952
|
+
* @returns Promise containing thread messages and UI messages
|
|
953
|
+
*/
|
|
954
|
+
getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
declare class VNextNetwork extends BaseResource {
|
|
958
|
+
private networkId;
|
|
959
|
+
constructor(options: ClientOptions, networkId: string);
|
|
960
|
+
/**
|
|
961
|
+
* Retrieves details about the network
|
|
962
|
+
* @returns Promise containing vNext network details
|
|
963
|
+
*/
|
|
964
|
+
details(): Promise<GetVNextNetworkResponse>;
|
|
965
|
+
/**
|
|
966
|
+
* Generates a response from the v-next network
|
|
967
|
+
* @param params - Generation parameters including message
|
|
968
|
+
* @returns Promise containing the generated response
|
|
969
|
+
*/
|
|
970
|
+
generate(params: GenerateOrStreamVNextNetworkParams): Promise<GenerateVNextNetworkResponse>;
|
|
971
|
+
/**
|
|
972
|
+
* Generates a response from the v-next network using multiple primitives
|
|
973
|
+
* @param params - Generation parameters including message
|
|
974
|
+
* @returns Promise containing the generated response
|
|
975
|
+
*/
|
|
976
|
+
loop(params: {
|
|
977
|
+
message: string;
|
|
978
|
+
runtimeContext?: RuntimeContext | Record<string, any>;
|
|
979
|
+
}): Promise<LoopVNextNetworkResponse>;
|
|
980
|
+
private streamProcessor;
|
|
981
|
+
/**
|
|
982
|
+
* Streams a response from the v-next network
|
|
983
|
+
* @param params - Stream parameters including message
|
|
984
|
+
* @returns Promise containing the results
|
|
985
|
+
*/
|
|
986
|
+
stream(params: GenerateOrStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
|
|
987
|
+
/**
|
|
988
|
+
* Streams a response from the v-next network loop
|
|
989
|
+
* @param params - Stream parameters including message
|
|
990
|
+
* @returns Promise containing the results
|
|
991
|
+
*/
|
|
992
|
+
loopStream(params: LoopStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
|
|
993
|
+
}
|
|
994
|
+
|
|
745
995
|
declare class MastraClient extends BaseResource {
|
|
746
996
|
constructor(options: ClientOptions);
|
|
747
997
|
/**
|
|
@@ -789,6 +1039,37 @@ declare class MastraClient extends BaseResource {
|
|
|
789
1039
|
getMemoryStatus(agentId: string): Promise<{
|
|
790
1040
|
result: boolean;
|
|
791
1041
|
}>;
|
|
1042
|
+
/**
|
|
1043
|
+
* Retrieves memory threads for a resource
|
|
1044
|
+
* @param params - Parameters containing the resource ID
|
|
1045
|
+
* @returns Promise containing array of memory threads
|
|
1046
|
+
*/
|
|
1047
|
+
getNetworkMemoryThreads(params: GetNetworkMemoryThreadParams): Promise<GetMemoryThreadResponse>;
|
|
1048
|
+
/**
|
|
1049
|
+
* Creates a new memory thread
|
|
1050
|
+
* @param params - Parameters for creating the memory thread
|
|
1051
|
+
* @returns Promise containing the created memory thread
|
|
1052
|
+
*/
|
|
1053
|
+
createNetworkMemoryThread(params: CreateNetworkMemoryThreadParams): Promise<CreateMemoryThreadResponse>;
|
|
1054
|
+
/**
|
|
1055
|
+
* Gets a memory thread instance by ID
|
|
1056
|
+
* @param threadId - ID of the memory thread to retrieve
|
|
1057
|
+
* @returns MemoryThread instance
|
|
1058
|
+
*/
|
|
1059
|
+
getNetworkMemoryThread(threadId: string, networkId: string): NetworkMemoryThread;
|
|
1060
|
+
/**
|
|
1061
|
+
* Saves messages to memory
|
|
1062
|
+
* @param params - Parameters containing messages to save
|
|
1063
|
+
* @returns Promise containing the saved messages
|
|
1064
|
+
*/
|
|
1065
|
+
saveNetworkMessageToMemory(params: SaveNetworkMessageToMemoryParams): Promise<SaveMessageToMemoryResponse>;
|
|
1066
|
+
/**
|
|
1067
|
+
* Gets the status of the memory system
|
|
1068
|
+
* @returns Promise containing memory system status
|
|
1069
|
+
*/
|
|
1070
|
+
getNetworkMemoryStatus(networkId: string): Promise<{
|
|
1071
|
+
result: boolean;
|
|
1072
|
+
}>;
|
|
792
1073
|
/**
|
|
793
1074
|
* Retrieves all available tools
|
|
794
1075
|
* @returns Promise containing map of tool IDs to tool details
|
|
@@ -857,13 +1138,24 @@ declare class MastraClient extends BaseResource {
|
|
|
857
1138
|
* Retrieves all available networks
|
|
858
1139
|
* @returns Promise containing map of network IDs to network details
|
|
859
1140
|
*/
|
|
860
|
-
getNetworks(): Promise<
|
|
1141
|
+
getNetworks(): Promise<Array<GetNetworkResponse>>;
|
|
1142
|
+
/**
|
|
1143
|
+
* Retrieves all available vNext networks
|
|
1144
|
+
* @returns Promise containing map of vNext network IDs to vNext network details
|
|
1145
|
+
*/
|
|
1146
|
+
getVNextNetworks(): Promise<Array<GetVNextNetworkResponse>>;
|
|
861
1147
|
/**
|
|
862
1148
|
* Gets a network instance by ID
|
|
863
1149
|
* @param networkId - ID of the network to retrieve
|
|
864
1150
|
* @returns Network instance
|
|
865
1151
|
*/
|
|
866
1152
|
getNetwork(networkId: string): Network;
|
|
1153
|
+
/**
|
|
1154
|
+
* Gets a vNext network instance by ID
|
|
1155
|
+
* @param networkId - ID of the vNext network to retrieve
|
|
1156
|
+
* @returns vNext Network instance
|
|
1157
|
+
*/
|
|
1158
|
+
getVNextNetwork(networkId: string): VNextNetwork;
|
|
867
1159
|
/**
|
|
868
1160
|
* Retrieves a list of available MCP servers.
|
|
869
1161
|
* @param params - Optional parameters for pagination (limit, offset).
|
|
@@ -902,6 +1194,31 @@ declare class MastraClient extends BaseResource {
|
|
|
902
1194
|
* @returns A2A client instance
|
|
903
1195
|
*/
|
|
904
1196
|
getA2A(agentId: string): A2A;
|
|
1197
|
+
/**
|
|
1198
|
+
* Retrieves the working memory for a specific thread (optionally resource-scoped).
|
|
1199
|
+
* @param agentId - ID of the agent.
|
|
1200
|
+
* @param threadId - ID of the thread.
|
|
1201
|
+
* @param resourceId - Optional ID of the resource.
|
|
1202
|
+
* @returns Working memory for the specified thread or resource.
|
|
1203
|
+
*/
|
|
1204
|
+
getWorkingMemory({ agentId, threadId, resourceId, }: {
|
|
1205
|
+
agentId: string;
|
|
1206
|
+
threadId: string;
|
|
1207
|
+
resourceId?: string;
|
|
1208
|
+
}): Promise<unknown>;
|
|
1209
|
+
/**
|
|
1210
|
+
* Updates the working memory for a specific thread (optionally resource-scoped).
|
|
1211
|
+
* @param agentId - ID of the agent.
|
|
1212
|
+
* @param threadId - ID of the thread.
|
|
1213
|
+
* @param workingMemory - The new working memory content.
|
|
1214
|
+
* @param resourceId - Optional ID of the resource.
|
|
1215
|
+
*/
|
|
1216
|
+
updateWorkingMemory({ agentId, threadId, workingMemory, resourceId, }: {
|
|
1217
|
+
agentId: string;
|
|
1218
|
+
threadId: string;
|
|
1219
|
+
workingMemory: string;
|
|
1220
|
+
resourceId?: string;
|
|
1221
|
+
}): Promise<unknown>;
|
|
905
1222
|
}
|
|
906
1223
|
|
|
907
|
-
export { type ClientOptions, type CreateIndexParams, type CreateMemoryThreadParams, type CreateMemoryThreadResponse, type GenerateParams, type GetAgentResponse, type GetEvalsByAgentIdResponse, type GetLegacyWorkflowResponse, type GetLegacyWorkflowRunsResponse, type GetLogParams, type GetLogsParams, type GetLogsResponse, type GetMemoryThreadMessagesParams, type GetMemoryThreadMessagesResponse, type GetMemoryThreadParams, type GetMemoryThreadResponse, type GetNetworkResponse, type GetTelemetryParams, type GetTelemetryResponse, type GetToolResponse, type GetVectorIndexResponse, type GetWorkflowResponse, type GetWorkflowRunsParams, type GetWorkflowRunsResponse, type LegacyWorkflowRunResult, MastraClient, type McpServerListResponse, type McpServerToolListResponse, type McpToolInfo, type QueryVectorParams, type QueryVectorResponse, type RequestFunction, type RequestOptions, type SaveMessageToMemoryParams, type SaveMessageToMemoryResponse, type StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
|
|
1224
|
+
export { type ClientOptions, 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 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 StreamParams, type UpdateMemoryThreadParams, type UpsertVectorParams, type WorkflowRunResult, type WorkflowWatchResult };
|