@mastra/client-js 0.0.0-taofeeqInngest-20250603090617 → 0.0.0-tool-call-parts-20250630193309

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/dist/index.d.cts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { AbstractAgent } from '@ag-ui/client';
2
2
  import { ServerInfo, MCPToolType, ServerDetailInfo } from '@mastra/core/mcp';
3
3
  import { processDataStream } from '@ai-sdk/ui-utils';
4
- import { CoreMessage, AiMessageType, StorageThreadType, MastraMessageV1, LegacyWorkflowRuns, WorkflowRuns, QueryResult, GenerateReturn } from '@mastra/core';
4
+ import { CoreMessage, AiMessageType, StorageThreadType, MastraMessageV1, 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, WorkflowResult, WatchEvent } from '@mastra/core/workflows';
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';
@@ -51,13 +51,15 @@ type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> =
51
51
  output?: T;
52
52
  experimental_output?: T;
53
53
  runtimeContext?: RuntimeContext | Record<string, any>;
54
- } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
54
+ clientTools?: ToolsInput;
55
+ } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
55
56
  type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
56
57
  messages: string | string[] | CoreMessage[] | AiMessageType[];
57
58
  output?: T;
58
59
  experimental_output?: T;
59
60
  runtimeContext?: RuntimeContext | Record<string, any>;
60
- } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext'>>;
61
+ clientTools?: ToolsInput;
62
+ } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
61
63
  interface GetEvalsByAgentIdResponse extends GetAgentResponse {
62
64
  evals: any[];
63
65
  instructions: string;
@@ -87,6 +89,8 @@ interface GetWorkflowRunsParams {
87
89
  }
88
90
  type GetLegacyWorkflowRunsResponse = LegacyWorkflowRuns;
89
91
  type GetWorkflowRunsResponse = WorkflowRuns;
92
+ type GetWorkflowRunByIdResponse = WorkflowRun;
93
+ type GetWorkflowRunExecutionResultResponse = WatchEvent['payload']['workflowState'];
90
94
  type LegacyWorkflowRunResult = {
91
95
  activePaths: Record<string, {
92
96
  status: string;
@@ -148,6 +152,10 @@ interface SaveMessageToMemoryParams {
148
152
  messages: MastraMessageV1[];
149
153
  agentId: string;
150
154
  }
155
+ interface SaveNetworkMessageToMemoryParams {
156
+ messages: MastraMessageV1[];
157
+ networkId: string;
158
+ }
151
159
  type SaveMessageToMemoryResponse = MastraMessageV1[];
152
160
  interface CreateMemoryThreadParams {
153
161
  title?: string;
@@ -156,11 +164,22 @@ interface CreateMemoryThreadParams {
156
164
  threadId?: string;
157
165
  agentId: string;
158
166
  }
167
+ interface CreateNetworkMemoryThreadParams {
168
+ title?: string;
169
+ metadata?: Record<string, any>;
170
+ resourceId: string;
171
+ threadId?: string;
172
+ networkId: string;
173
+ }
159
174
  type CreateMemoryThreadResponse = StorageThreadType;
160
175
  interface GetMemoryThreadParams {
161
176
  resourceId: string;
162
177
  agentId: string;
163
178
  }
179
+ interface GetNetworkMemoryThreadParams {
180
+ resourceId: string;
181
+ networkId: string;
182
+ }
164
183
  type GetMemoryThreadResponse = StorageThreadType[];
165
184
  interface UpdateMemoryThreadParams {
166
185
  title: string;
@@ -179,12 +198,30 @@ interface GetMemoryThreadMessagesResponse {
179
198
  }
180
199
  interface GetLogsParams {
181
200
  transportId: string;
201
+ fromDate?: Date;
202
+ toDate?: Date;
203
+ logLevel?: LogLevel;
204
+ filters?: Record<string, string>;
205
+ page?: number;
206
+ perPage?: number;
182
207
  }
183
208
  interface GetLogParams {
184
209
  runId: string;
185
210
  transportId: string;
211
+ fromDate?: Date;
212
+ toDate?: Date;
213
+ logLevel?: LogLevel;
214
+ filters?: Record<string, string>;
215
+ page?: number;
216
+ perPage?: number;
186
217
  }
187
- type GetLogsResponse = BaseLogMessage[];
218
+ type GetLogsResponse = {
219
+ logs: BaseLogMessage[];
220
+ total: number;
221
+ page: number;
222
+ perPage: number;
223
+ hasMore: boolean;
224
+ };
188
225
  type RequestFunction = (path: string, options?: RequestOptions) => Promise<any>;
189
226
  type SpanStatus = {
190
227
  code: number;
@@ -236,6 +273,7 @@ interface GetTelemetryParams {
236
273
  toDate?: Date;
237
274
  }
238
275
  interface GetNetworkResponse {
276
+ id: string;
239
277
  name: string;
240
278
  instructions: string;
241
279
  agents: Array<{
@@ -249,6 +287,54 @@ interface GetNetworkResponse {
249
287
  };
250
288
  state?: Record<string, any>;
251
289
  }
290
+ interface GetVNextNetworkResponse {
291
+ id: string;
292
+ name: string;
293
+ instructions: string;
294
+ agents: Array<{
295
+ name: string;
296
+ provider: string;
297
+ modelId: string;
298
+ }>;
299
+ routingModel: {
300
+ provider: string;
301
+ modelId: string;
302
+ };
303
+ workflows: Array<{
304
+ name: string;
305
+ description: string;
306
+ inputSchema: string | undefined;
307
+ outputSchema: string | undefined;
308
+ }>;
309
+ tools: Array<{
310
+ id: string;
311
+ description: string;
312
+ }>;
313
+ }
314
+ interface GenerateVNextNetworkResponse {
315
+ task: string;
316
+ result: string;
317
+ resourceId: string;
318
+ resourceType: 'none' | 'tool' | 'agent' | 'workflow';
319
+ }
320
+ interface GenerateOrStreamVNextNetworkParams {
321
+ message: string;
322
+ threadId?: string;
323
+ resourceId?: string;
324
+ }
325
+ interface LoopStreamVNextNetworkParams {
326
+ message: string;
327
+ threadId?: string;
328
+ resourceId?: string;
329
+ maxIterations?: number;
330
+ }
331
+ interface LoopVNextNetworkResponse {
332
+ status: 'success';
333
+ result: {
334
+ text: string;
335
+ };
336
+ steps: WorkflowResult<any, any>['steps'];
337
+ }
252
338
  interface McpServerListResponse {
253
339
  servers: ServerInfo[];
254
340
  next: string | null;
@@ -329,7 +415,19 @@ declare class Agent extends BaseResource {
329
415
  * @param params - Generation parameters including prompt
330
416
  * @returns Promise containing the generated response
331
417
  */
332
- generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T>): Promise<GenerateReturn<T>>;
418
+ generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
419
+ output?: never;
420
+ experimental_output?: never;
421
+ }): Promise<GenerateReturn<T>>;
422
+ generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
423
+ output: T;
424
+ experimental_output?: never;
425
+ }): Promise<GenerateReturn<T>>;
426
+ generate<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: GenerateParams<T> & {
427
+ output?: never;
428
+ experimental_output: T;
429
+ }): Promise<GenerateReturn<T>>;
430
+ private processChatResponse;
333
431
  /**
334
432
  * Streams a response from the agent
335
433
  * @param params - Stream parameters including prompt
@@ -338,6 +436,10 @@ declare class Agent extends BaseResource {
338
436
  stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
339
437
  processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
340
438
  }>;
439
+ /**
440
+ * Processes the stream response and handles tool calls
441
+ */
442
+ private processStreamResponse;
341
443
  /**
342
444
  * Gets details about a specific tool available to the agent
343
445
  * @param toolId - ID of the tool to retrieve
@@ -593,6 +695,18 @@ declare class Workflow extends BaseResource {
593
695
  * @returns Promise containing workflow runs array
594
696
  */
595
697
  runs(params?: GetWorkflowRunsParams): Promise<GetWorkflowRunsResponse>;
698
+ /**
699
+ * Retrieves a specific workflow run by its ID
700
+ * @param runId - The ID of the workflow run to retrieve
701
+ * @returns Promise containing the workflow run details
702
+ */
703
+ runById(runId: string): Promise<GetWorkflowRunByIdResponse>;
704
+ /**
705
+ * Retrieves the execution result for a specific workflow run by its ID
706
+ * @param runId - The ID of the workflow run to retrieve the execution result for
707
+ * @returns Promise containing the workflow run execution result
708
+ */
709
+ runExecutionResult(runId: string): Promise<GetWorkflowRunExecutionResultResponse>;
596
710
  /**
597
711
  * Creates a new workflow run
598
712
  * @param params - Optional object containing the optional runId
@@ -639,15 +753,18 @@ declare class Workflow extends BaseResource {
639
753
  runtimeContext?: RuntimeContext | Record<string, any>;
640
754
  }): Promise<WorkflowRunResult>;
641
755
  /**
642
- * Starts a vNext workflow run and returns a stream
756
+ * Starts a workflow run and returns a stream
643
757
  * @param params - Object containing the optional runId, inputData and runtimeContext
644
- * @returns Promise containing the vNext workflow execution results
758
+ * @returns Promise containing the workflow execution results
645
759
  */
646
760
  stream(params: {
647
761
  runId?: string;
648
762
  inputData: Record<string, any>;
649
763
  runtimeContext?: RuntimeContext;
650
- }): Promise<stream_web.ReadableStream<WorkflowWatchResult>>;
764
+ }): Promise<stream_web.ReadableStream<{
765
+ type: string;
766
+ payload: any;
767
+ }>>;
651
768
  /**
652
769
  * Resumes a suspended workflow step asynchronously and returns a promise that resolves when the workflow is complete
653
770
  * @param params - Object containing the runId, step, resumeData and runtimeContext
@@ -742,6 +859,73 @@ declare class MCPTool extends BaseResource {
742
859
  }): Promise<any>;
743
860
  }
744
861
 
862
+ declare class VNextNetwork extends BaseResource {
863
+ private networkId;
864
+ constructor(options: ClientOptions, networkId: string);
865
+ /**
866
+ * Retrieves details about the network
867
+ * @returns Promise containing vNext network details
868
+ */
869
+ details(): Promise<GetVNextNetworkResponse>;
870
+ /**
871
+ * Generates a response from the v-next network
872
+ * @param params - Generation parameters including message
873
+ * @returns Promise containing the generated response
874
+ */
875
+ generate(params: GenerateOrStreamVNextNetworkParams): Promise<GenerateVNextNetworkResponse>;
876
+ /**
877
+ * Generates a response from the v-next network using multiple primitives
878
+ * @param params - Generation parameters including message
879
+ * @returns Promise containing the generated response
880
+ */
881
+ loop(params: {
882
+ message: string;
883
+ }): Promise<LoopVNextNetworkResponse>;
884
+ private streamProcessor;
885
+ /**
886
+ * Streams a response from the v-next network
887
+ * @param params - Stream parameters including message
888
+ * @returns Promise containing the results
889
+ */
890
+ stream(params: GenerateOrStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
891
+ /**
892
+ * Streams a response from the v-next network loop
893
+ * @param params - Stream parameters including message
894
+ * @returns Promise containing the results
895
+ */
896
+ loopStream(params: LoopStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
897
+ }
898
+
899
+ declare class NetworkMemoryThread extends BaseResource {
900
+ private threadId;
901
+ private networkId;
902
+ constructor(options: ClientOptions, threadId: string, networkId: string);
903
+ /**
904
+ * Retrieves the memory thread details
905
+ * @returns Promise containing thread details including title and metadata
906
+ */
907
+ get(): Promise<StorageThreadType>;
908
+ /**
909
+ * Updates the memory thread properties
910
+ * @param params - Update parameters including title and metadata
911
+ * @returns Promise containing updated thread details
912
+ */
913
+ update(params: UpdateMemoryThreadParams): Promise<StorageThreadType>;
914
+ /**
915
+ * Deletes the memory thread
916
+ * @returns Promise containing deletion result
917
+ */
918
+ delete(): Promise<{
919
+ result: string;
920
+ }>;
921
+ /**
922
+ * Retrieves messages associated with the thread
923
+ * @param params - Optional parameters including limit for number of messages to retrieve
924
+ * @returns Promise containing thread messages and UI messages
925
+ */
926
+ getMessages(params?: GetMemoryThreadMessagesParams): Promise<GetMemoryThreadMessagesResponse>;
927
+ }
928
+
745
929
  declare class MastraClient extends BaseResource {
746
930
  constructor(options: ClientOptions);
747
931
  /**
@@ -789,6 +973,37 @@ declare class MastraClient extends BaseResource {
789
973
  getMemoryStatus(agentId: string): Promise<{
790
974
  result: boolean;
791
975
  }>;
976
+ /**
977
+ * Retrieves memory threads for a resource
978
+ * @param params - Parameters containing the resource ID
979
+ * @returns Promise containing array of memory threads
980
+ */
981
+ getNetworkMemoryThreads(params: GetNetworkMemoryThreadParams): Promise<GetMemoryThreadResponse>;
982
+ /**
983
+ * Creates a new memory thread
984
+ * @param params - Parameters for creating the memory thread
985
+ * @returns Promise containing the created memory thread
986
+ */
987
+ createNetworkMemoryThread(params: CreateNetworkMemoryThreadParams): Promise<CreateMemoryThreadResponse>;
988
+ /**
989
+ * Gets a memory thread instance by ID
990
+ * @param threadId - ID of the memory thread to retrieve
991
+ * @returns MemoryThread instance
992
+ */
993
+ getNetworkMemoryThread(threadId: string, networkId: string): NetworkMemoryThread;
994
+ /**
995
+ * Saves messages to memory
996
+ * @param params - Parameters containing messages to save
997
+ * @returns Promise containing the saved messages
998
+ */
999
+ saveNetworkMessageToMemory(params: SaveNetworkMessageToMemoryParams): Promise<SaveMessageToMemoryResponse>;
1000
+ /**
1001
+ * Gets the status of the memory system
1002
+ * @returns Promise containing memory system status
1003
+ */
1004
+ getNetworkMemoryStatus(networkId: string): Promise<{
1005
+ result: boolean;
1006
+ }>;
792
1007
  /**
793
1008
  * Retrieves all available tools
794
1009
  * @returns Promise containing map of tool IDs to tool details
@@ -857,13 +1072,24 @@ declare class MastraClient extends BaseResource {
857
1072
  * Retrieves all available networks
858
1073
  * @returns Promise containing map of network IDs to network details
859
1074
  */
860
- getNetworks(): Promise<Record<string, GetNetworkResponse>>;
1075
+ getNetworks(): Promise<Array<GetNetworkResponse>>;
1076
+ /**
1077
+ * Retrieves all available vNext networks
1078
+ * @returns Promise containing map of vNext network IDs to vNext network details
1079
+ */
1080
+ getVNextNetworks(): Promise<Array<GetVNextNetworkResponse>>;
861
1081
  /**
862
1082
  * Gets a network instance by ID
863
1083
  * @param networkId - ID of the network to retrieve
864
1084
  * @returns Network instance
865
1085
  */
866
1086
  getNetwork(networkId: string): Network;
1087
+ /**
1088
+ * Gets a vNext network instance by ID
1089
+ * @param networkId - ID of the vNext network to retrieve
1090
+ * @returns vNext Network instance
1091
+ */
1092
+ getVNextNetwork(networkId: string): VNextNetwork;
867
1093
  /**
868
1094
  * Retrieves a list of available MCP servers.
869
1095
  * @param params - Optional parameters for pagination (limit, offset).
@@ -904,4 +1130,4 @@ declare class MastraClient extends BaseResource {
904
1130
  getA2A(agentId: string): A2A;
905
1131
  }
906
1132
 
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 };
1133
+ 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 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 };