@mastra/client-js 0.0.0-tool-call-parts-20250630193309 → 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/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
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, WorkflowRun, 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
7
  import { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
@@ -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 {
@@ -52,14 +53,14 @@ type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> =
52
53
  experimental_output?: T;
53
54
  runtimeContext?: RuntimeContext | Record<string, any>;
54
55
  clientTools?: ToolsInput;
55
- } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
56
+ } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
56
57
  type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
57
58
  messages: string | string[] | CoreMessage[] | AiMessageType[];
58
59
  output?: T;
59
60
  experimental_output?: T;
60
61
  runtimeContext?: RuntimeContext | Record<string, any>;
61
62
  clientTools?: ToolsInput;
62
- } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
63
+ } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
63
64
  interface GetEvalsByAgentIdResponse extends GetAgentResponse {
64
65
  evals: any[];
65
66
  instructions: string;
@@ -114,6 +115,17 @@ interface GetWorkflowResponse {
114
115
  suspendSchema: string;
115
116
  };
116
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
+ };
117
129
  stepGraph: Workflow$1['serializedStepGraph'];
118
130
  inputSchema: string;
119
131
  outputSchema: string;
@@ -192,10 +204,14 @@ interface GetMemoryThreadMessagesParams {
192
204
  */
193
205
  limit?: number;
194
206
  }
207
+ type GetMemoryThreadMessagesPaginatedParams = Omit<StorageGetMessagesArg, 'threadConfig' | 'threadId'>;
195
208
  interface GetMemoryThreadMessagesResponse {
196
209
  messages: CoreMessage[];
197
210
  uiMessages: AiMessageType[];
198
211
  }
212
+ type GetMemoryThreadMessagesPaginatedResponse = PaginationInfo & {
213
+ messages: MastraMessageV1[] | MastraMessageV2[];
214
+ };
199
215
  interface GetLogsParams {
200
216
  transportId: string;
201
217
  fromDate?: Date;
@@ -321,17 +337,29 @@ interface GenerateOrStreamVNextNetworkParams {
321
337
  message: string;
322
338
  threadId?: string;
323
339
  resourceId?: string;
340
+ runtimeContext?: RuntimeContext | Record<string, any>;
324
341
  }
325
342
  interface LoopStreamVNextNetworkParams {
326
343
  message: string;
327
344
  threadId?: string;
328
345
  resourceId?: string;
329
346
  maxIterations?: number;
347
+ runtimeContext?: RuntimeContext | Record<string, any>;
330
348
  }
331
349
  interface LoopVNextNetworkResponse {
332
350
  status: 'success';
333
351
  result: {
334
- text: string;
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;
335
363
  };
336
364
  steps: WorkflowResult<any, any>['steps'];
337
365
  }
@@ -428,18 +456,19 @@ declare class Agent extends BaseResource {
428
456
  experimental_output: T;
429
457
  }): Promise<GenerateReturn<T>>;
430
458
  private processChatResponse;
459
+ /**
460
+ * Processes the stream response and handles tool calls
461
+ */
462
+ private processStreamResponse;
431
463
  /**
432
464
  * Streams a response from the agent
433
465
  * @param params - Stream parameters including prompt
434
- * @returns Promise containing the enhanced Response object with processDataStream method
466
+ * @returns Promise containing the enhanced Response object with processDataStream and processTextStream methods
435
467
  */
436
468
  stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
437
469
  processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
470
+ processTextStream: (options?: Omit<Parameters<typeof processTextStream>[0], 'stream'>) => Promise<void>;
438
471
  }>;
439
- /**
440
- * Processes the stream response and handles tool calls
441
- */
442
- private processStreamResponse;
443
472
  /**
444
473
  * Gets details about a specific tool available to the agent
445
474
  * @param toolId - ID of the tool to retrieve
@@ -520,6 +549,12 @@ declare class MemoryThread extends BaseResource {
520
549
  * @returns Promise containing thread messages and UI messages
521
550
  */
522
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>;
523
558
  }
524
559
 
525
560
  declare class Vector extends BaseResource {
@@ -707,6 +742,26 @@ declare class Workflow extends BaseResource {
707
742
  * @returns Promise containing the workflow run execution result
708
743
  */
709
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
+ }>;
710
765
  /**
711
766
  * Creates a new workflow run
712
767
  * @param params - Optional object containing the optional runId
@@ -717,6 +772,16 @@ declare class Workflow extends BaseResource {
717
772
  }): Promise<{
718
773
  runId: string;
719
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
+ }>;
720
785
  /**
721
786
  * Starts a workflow run synchronously without waiting for the workflow to complete
722
787
  * @param params - Object containing the runId, inputData and runtimeContext
@@ -859,6 +924,36 @@ declare class MCPTool extends BaseResource {
859
924
  }): Promise<any>;
860
925
  }
861
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
+
862
957
  declare class VNextNetwork extends BaseResource {
863
958
  private networkId;
864
959
  constructor(options: ClientOptions, networkId: string);
@@ -880,6 +975,7 @@ declare class VNextNetwork extends BaseResource {
880
975
  */
881
976
  loop(params: {
882
977
  message: string;
978
+ runtimeContext?: RuntimeContext | Record<string, any>;
883
979
  }): Promise<LoopVNextNetworkResponse>;
884
980
  private streamProcessor;
885
981
  /**
@@ -896,36 +992,6 @@ declare class VNextNetwork extends BaseResource {
896
992
  loopStream(params: LoopStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
897
993
  }
898
994
 
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
-
929
995
  declare class MastraClient extends BaseResource {
930
996
  constructor(options: ClientOptions);
931
997
  /**
@@ -1128,6 +1194,31 @@ declare class MastraClient extends BaseResource {
1128
1194
  * @returns A2A client instance
1129
1195
  */
1130
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>;
1131
1222
  }
1132
1223
 
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 };
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 };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
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, WorkflowRun, 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
7
  import { AgentGenerateOptions, AgentStreamOptions, ToolsInput } from '@mastra/core/agent';
@@ -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 {
@@ -52,14 +53,14 @@ type GenerateParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> =
52
53
  experimental_output?: T;
53
54
  runtimeContext?: RuntimeContext | Record<string, any>;
54
55
  clientTools?: ToolsInput;
55
- } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
56
+ } & WithoutMethods<Omit<AgentGenerateOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
56
57
  type StreamParams<T extends JSONSchema7 | ZodSchema | undefined = undefined> = {
57
58
  messages: string | string[] | CoreMessage[] | AiMessageType[];
58
59
  output?: T;
59
60
  experimental_output?: T;
60
61
  runtimeContext?: RuntimeContext | Record<string, any>;
61
62
  clientTools?: ToolsInput;
62
- } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools'>>;
63
+ } & WithoutMethods<Omit<AgentStreamOptions<T>, 'output' | 'experimental_output' | 'runtimeContext' | 'clientTools' | 'abortSignal'>>;
63
64
  interface GetEvalsByAgentIdResponse extends GetAgentResponse {
64
65
  evals: any[];
65
66
  instructions: string;
@@ -114,6 +115,17 @@ interface GetWorkflowResponse {
114
115
  suspendSchema: string;
115
116
  };
116
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
+ };
117
129
  stepGraph: Workflow$1['serializedStepGraph'];
118
130
  inputSchema: string;
119
131
  outputSchema: string;
@@ -192,10 +204,14 @@ interface GetMemoryThreadMessagesParams {
192
204
  */
193
205
  limit?: number;
194
206
  }
207
+ type GetMemoryThreadMessagesPaginatedParams = Omit<StorageGetMessagesArg, 'threadConfig' | 'threadId'>;
195
208
  interface GetMemoryThreadMessagesResponse {
196
209
  messages: CoreMessage[];
197
210
  uiMessages: AiMessageType[];
198
211
  }
212
+ type GetMemoryThreadMessagesPaginatedResponse = PaginationInfo & {
213
+ messages: MastraMessageV1[] | MastraMessageV2[];
214
+ };
199
215
  interface GetLogsParams {
200
216
  transportId: string;
201
217
  fromDate?: Date;
@@ -321,17 +337,29 @@ interface GenerateOrStreamVNextNetworkParams {
321
337
  message: string;
322
338
  threadId?: string;
323
339
  resourceId?: string;
340
+ runtimeContext?: RuntimeContext | Record<string, any>;
324
341
  }
325
342
  interface LoopStreamVNextNetworkParams {
326
343
  message: string;
327
344
  threadId?: string;
328
345
  resourceId?: string;
329
346
  maxIterations?: number;
347
+ runtimeContext?: RuntimeContext | Record<string, any>;
330
348
  }
331
349
  interface LoopVNextNetworkResponse {
332
350
  status: 'success';
333
351
  result: {
334
- text: string;
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;
335
363
  };
336
364
  steps: WorkflowResult<any, any>['steps'];
337
365
  }
@@ -428,18 +456,19 @@ declare class Agent extends BaseResource {
428
456
  experimental_output: T;
429
457
  }): Promise<GenerateReturn<T>>;
430
458
  private processChatResponse;
459
+ /**
460
+ * Processes the stream response and handles tool calls
461
+ */
462
+ private processStreamResponse;
431
463
  /**
432
464
  * Streams a response from the agent
433
465
  * @param params - Stream parameters including prompt
434
- * @returns Promise containing the enhanced Response object with processDataStream method
466
+ * @returns Promise containing the enhanced Response object with processDataStream and processTextStream methods
435
467
  */
436
468
  stream<T extends JSONSchema7 | ZodSchema | undefined = undefined>(params: StreamParams<T>): Promise<Response & {
437
469
  processDataStream: (options?: Omit<Parameters<typeof processDataStream>[0], 'stream'>) => Promise<void>;
470
+ processTextStream: (options?: Omit<Parameters<typeof processTextStream>[0], 'stream'>) => Promise<void>;
438
471
  }>;
439
- /**
440
- * Processes the stream response and handles tool calls
441
- */
442
- private processStreamResponse;
443
472
  /**
444
473
  * Gets details about a specific tool available to the agent
445
474
  * @param toolId - ID of the tool to retrieve
@@ -520,6 +549,12 @@ declare class MemoryThread extends BaseResource {
520
549
  * @returns Promise containing thread messages and UI messages
521
550
  */
522
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>;
523
558
  }
524
559
 
525
560
  declare class Vector extends BaseResource {
@@ -707,6 +742,26 @@ declare class Workflow extends BaseResource {
707
742
  * @returns Promise containing the workflow run execution result
708
743
  */
709
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
+ }>;
710
765
  /**
711
766
  * Creates a new workflow run
712
767
  * @param params - Optional object containing the optional runId
@@ -717,6 +772,16 @@ declare class Workflow extends BaseResource {
717
772
  }): Promise<{
718
773
  runId: string;
719
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
+ }>;
720
785
  /**
721
786
  * Starts a workflow run synchronously without waiting for the workflow to complete
722
787
  * @param params - Object containing the runId, inputData and runtimeContext
@@ -859,6 +924,36 @@ declare class MCPTool extends BaseResource {
859
924
  }): Promise<any>;
860
925
  }
861
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
+
862
957
  declare class VNextNetwork extends BaseResource {
863
958
  private networkId;
864
959
  constructor(options: ClientOptions, networkId: string);
@@ -880,6 +975,7 @@ declare class VNextNetwork extends BaseResource {
880
975
  */
881
976
  loop(params: {
882
977
  message: string;
978
+ runtimeContext?: RuntimeContext | Record<string, any>;
883
979
  }): Promise<LoopVNextNetworkResponse>;
884
980
  private streamProcessor;
885
981
  /**
@@ -896,36 +992,6 @@ declare class VNextNetwork extends BaseResource {
896
992
  loopStream(params: LoopStreamVNextNetworkParams, onRecord: (record: WatchEvent) => void): Promise<void>;
897
993
  }
898
994
 
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
-
929
995
  declare class MastraClient extends BaseResource {
930
996
  constructor(options: ClientOptions);
931
997
  /**
@@ -1128,6 +1194,31 @@ declare class MastraClient extends BaseResource {
1128
1194
  * @returns A2A client instance
1129
1195
  */
1130
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>;
1131
1222
  }
1132
1223
 
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 };
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 };