@mastra/server 0.0.0-transpile-packages-20250724123433 → 0.0.0-transpile-packages-20250730132657

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.
Files changed (39) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +72 -11
  2. package/dist/_tsup-dts-rollup.d.ts +72 -11
  3. package/dist/{chunk-MEGCYGBU.js → chunk-36BLNJHS.js} +37 -37
  4. package/dist/{chunk-CBFTEHOO.cjs → chunk-424T5F2J.cjs} +1 -1
  5. package/dist/{chunk-B2PAS2IB.cjs → chunk-6KP2OBYA.cjs} +47 -17
  6. package/dist/{chunk-VULESSU5.js → chunk-6T5JUKOQ.js} +1 -1
  7. package/dist/{chunk-LI436ITD.cjs → chunk-HISYIDYH.cjs} +37 -37
  8. package/dist/{chunk-FRVBFMO2.cjs → chunk-HRSAZUIK.cjs} +5 -5
  9. package/dist/{chunk-LZ3VJXSO.cjs → chunk-I5JKUCGE.cjs} +36 -6
  10. package/dist/{chunk-G4L7OMCA.js → chunk-R3I7AJVL.js} +190 -3
  11. package/dist/{chunk-H7DMHBKY.js → chunk-T7HAZC2E.js} +31 -2
  12. package/dist/{chunk-Z75RYULP.cjs → chunk-TTPJHP42.cjs} +191 -2
  13. package/dist/{chunk-JMLYCXMK.cjs → chunk-UCV4247U.cjs} +7 -7
  14. package/dist/{chunk-BK4XT6EG.js → chunk-VTTN2FW3.js} +32 -3
  15. package/dist/{chunk-LRCAAFUA.js → chunk-WBRFIHSF.js} +1 -1
  16. package/dist/{chunk-5PQQ42EZ.js → chunk-ZYAFP2AV.js} +1 -1
  17. package/dist/server/handlers/agents.cjs +11 -7
  18. package/dist/server/handlers/agents.d.cts +1 -0
  19. package/dist/server/handlers/agents.d.ts +1 -0
  20. package/dist/server/handlers/agents.js +1 -1
  21. package/dist/server/handlers/legacyWorkflows.cjs +11 -11
  22. package/dist/server/handlers/legacyWorkflows.js +1 -1
  23. package/dist/server/handlers/memory.cjs +20 -12
  24. package/dist/server/handlers/memory.d.cts +2 -0
  25. package/dist/server/handlers/memory.d.ts +2 -0
  26. package/dist/server/handlers/memory.js +1 -1
  27. package/dist/server/handlers/scores.cjs +7 -7
  28. package/dist/server/handlers/scores.js +1 -1
  29. package/dist/server/handlers/tools.cjs +5 -5
  30. package/dist/server/handlers/tools.js +1 -1
  31. package/dist/server/handlers/vNextNetwork.cjs +5 -5
  32. package/dist/server/handlers/vNextNetwork.js +1 -1
  33. package/dist/server/handlers/workflows.cjs +19 -15
  34. package/dist/server/handlers/workflows.d.cts +1 -0
  35. package/dist/server/handlers/workflows.d.ts +1 -0
  36. package/dist/server/handlers/workflows.js +1 -1
  37. package/dist/server/handlers.cjs +12 -12
  38. package/dist/server/handlers.js +6 -6
  39. package/package.json +5 -5
@@ -7,8 +7,8 @@ import { CoreMessage } from 'ai';
7
7
  import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
8
8
  import { DefaultEngineType } from '@mastra/core';
9
9
  import { EvalRow } from '@mastra/core';
10
- import { GenerateObjectResult } from 'ai';
11
- import { GenerateTextResult } from 'ai';
10
+ import type { GenerateReturn } from '@mastra/core/llm';
11
+ import { GenerateTextResult } from '@mastra/core';
12
12
  import type { IMastraLogger } from '@mastra/core/logger';
13
13
  import type { JSONRPCError } from '@mastra/core/a2a';
14
14
  import { JSONRPCResponse } from '@mastra/core/a2a';
@@ -23,6 +23,8 @@ import type { MastraMemory } from '@mastra/core/memory';
23
23
  import { MastraMessageV1 } from '@mastra/core';
24
24
  import { MastraMessageV2 } from '@mastra/core';
25
25
  import type { MastraScorerEntry } from '@mastra/core/scores';
26
+ import { MastraWorkflowStream } from '@mastra/core';
27
+ import { MemoryConfig } from '@mastra/core';
26
28
  import type { Message } from '@mastra/core/a2a';
27
29
  import { PaginationInfo } from '@mastra/core';
28
30
  import type { QueryResult } from '@mastra/core/vector';
@@ -85,7 +87,8 @@ export declare namespace agents {
85
87
  getEvalsByAgentIdHandler,
86
88
  getLiveEvalsByAgentIdHandler,
87
89
  generateHandler,
88
- streamGenerateHandler
90
+ streamGenerateHandler,
91
+ streamVNextGenerateHandler
89
92
  }
90
93
  }
91
94
 
@@ -184,14 +187,14 @@ export declare function generateHandler({ mastra, runtimeContext, agentId, body,
184
187
  runtimeContext?: Record<string, unknown>;
185
188
  };
186
189
  abortSignal?: AbortSignal;
187
- }): Promise<GenerateTextResult<any, unknown>>;
190
+ }): Promise<GenerateTextResult<any, undefined>>;
188
191
 
189
192
  export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
190
193
  runtimeContext: RuntimeContext;
191
194
  body: {
192
195
  messages?: Parameters<AgentNetwork['generate']>[0];
193
196
  } & Parameters<AgentNetwork['generate']>[1];
194
- }): Promise<GenerateObjectResult<any>>;
197
+ }): Promise<GenerateReturn<any, any, any>>;
195
198
 
196
199
  /**
197
200
  * Generate speech from text
@@ -342,6 +345,10 @@ export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>
342
345
  transports: string[];
343
346
  }>;
344
347
 
348
+ export declare function getMemoryConfigHandler({ mastra, agentId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'>): Promise<{
349
+ config: MemoryConfig;
350
+ }>;
351
+
345
352
  export declare function getMemoryStatusHandler({ mastra, agentId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'>): Promise<{
346
353
  result: boolean;
347
354
  }>;
@@ -728,18 +735,18 @@ export declare function loopStreamVNextNetworkHandler({ mastra, networkId, body,
728
735
  completionReason: ZodOptional<ZodString>;
729
736
  iteration: ZodNumber;
730
737
  }, "strip", ZodTypeAny, {
738
+ result: string;
731
739
  prompt: string;
732
740
  resourceId: string;
733
- result: string;
734
741
  task: string;
735
742
  resourceType: "none" | "tool" | "workflow" | "agent";
736
743
  iteration: number;
737
744
  isComplete?: boolean | undefined;
738
745
  completionReason?: string | undefined;
739
746
  }, {
747
+ result: string;
740
748
  prompt: string;
741
749
  resourceId: string;
742
- result: string;
743
750
  task: string;
744
751
  resourceType: "none" | "tool" | "workflow" | "agent";
745
752
  iteration: number;
@@ -756,9 +763,9 @@ export declare function loopVNextNetworkHandler({ mastra, networkId, body, runti
756
763
  }): Promise<{
757
764
  status: "success";
758
765
  result: {
766
+ result: string;
759
767
  prompt: string;
760
768
  resourceId: string;
761
- result: string;
762
769
  task: string;
763
770
  resourceType: "none" | "tool" | "workflow" | "agent";
764
771
  iteration: number;
@@ -776,6 +783,7 @@ export declare function loopVNextNetworkHandler({ mastra, networkId, body, runti
776
783
  export declare namespace memory {
777
784
  export {
778
785
  getMemoryStatusHandler,
786
+ getMemoryConfigHandler,
779
787
  getThreadsHandler,
780
788
  getThreadByIdHandler,
781
789
  saveMessagesHandler,
@@ -785,7 +793,8 @@ export declare namespace memory {
785
793
  getMessagesPaginatedHandler,
786
794
  getMessagesHandler,
787
795
  getWorkingMemoryHandler,
788
- updateWorkingMemoryHandler
796
+ updateWorkingMemoryHandler,
797
+ searchMemoryHandler
789
798
  }
790
799
  }
791
800
 
@@ -891,6 +900,43 @@ export declare namespace scores {
891
900
  }
892
901
  }
893
902
 
903
+ /**
904
+ * Handler to search messages in a thread.
905
+ * @param searchQuery - the text to search for
906
+ * @param resourceId - the resource id (user/org) to validate thread ownership
907
+ * @param threadId - the thread id to search within
908
+ * @param limit - maximum number of results to return (default: 20)
909
+ */
910
+ export declare function searchMemoryHandler({ mastra, agentId, searchQuery, resourceId, threadId, limit, networkId, runtimeContext, memoryConfig, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
911
+ searchQuery: string;
912
+ resourceId: string;
913
+ threadId?: string;
914
+ limit?: number;
915
+ memoryConfig?: any;
916
+ }): Promise<SearchResponse | ReturnType<typeof handleError>>;
917
+
918
+ declare interface SearchResponse {
919
+ results: SearchResult[];
920
+ count: number;
921
+ query: string;
922
+ searchScope?: string;
923
+ searchType?: string;
924
+ }
925
+
926
+ declare interface SearchResult {
927
+ id: string;
928
+ role: string;
929
+ content: any;
930
+ createdAt: Date;
931
+ threadId?: string;
932
+ threadTitle?: string;
933
+ score?: number;
934
+ context?: {
935
+ before?: SearchResult[];
936
+ after?: SearchResult[];
937
+ };
938
+ }
939
+
894
940
  export declare function sendWorkflowRunEventHandler({ mastra, workflowId, runId, event, data, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
895
941
  event: string;
896
942
  data: unknown;
@@ -995,9 +1041,9 @@ export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, b
995
1041
  threadResourceId: ZodOptional<ZodString>;
996
1042
  isOneOff: ZodBoolean;
997
1043
  }, "strip", ZodTypeAny, {
1044
+ result: string;
998
1045
  prompt: string;
999
1046
  resourceId: string;
1000
- result: string;
1001
1047
  task: string;
1002
1048
  resourceType: "none" | "tool" | "workflow" | "agent";
1003
1049
  iteration: number;
@@ -1007,9 +1053,9 @@ export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, b
1007
1053
  isComplete?: boolean | undefined;
1008
1054
  completionReason?: string | undefined;
1009
1055
  }, {
1056
+ result: string;
1010
1057
  prompt: string;
1011
1058
  resourceId: string;
1012
- result: string;
1013
1059
  task: string;
1014
1060
  resourceType: "none" | "tool" | "workflow" | "agent";
1015
1061
  iteration: number;
@@ -1021,6 +1067,20 @@ export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, b
1021
1067
  }>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
1022
1068
  }>;
1023
1069
 
1070
+ export declare function streamVNextGenerateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
1071
+ runtimeContext: RuntimeContext;
1072
+ agentId: string;
1073
+ body: GetBody<'streamVNext'> & {
1074
+ runtimeContext?: string;
1075
+ };
1076
+ abortSignal?: AbortSignal;
1077
+ }): ReturnType<Agent['streamVNext']>;
1078
+
1079
+ export declare function streamVNextWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
1080
+ inputData?: unknown;
1081
+ runtimeContext?: RuntimeContext_2;
1082
+ }): Promise<MastraWorkflowStream>;
1083
+
1024
1084
  export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
1025
1085
  inputData?: unknown;
1026
1086
  runtimeContext?: RuntimeContext_2;
@@ -1178,6 +1238,7 @@ export declare namespace workflows {
1178
1238
  startWorkflowRunHandler,
1179
1239
  watchWorkflowHandler,
1180
1240
  streamWorkflowHandler,
1241
+ streamVNextWorkflowHandler,
1181
1242
  resumeAsyncWorkflowHandler,
1182
1243
  resumeWorkflowHandler,
1183
1244
  getWorkflowRunsHandler,
@@ -7,8 +7,8 @@ import { CoreMessage } from 'ai';
7
7
  import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
8
8
  import { DefaultEngineType } from '@mastra/core';
9
9
  import { EvalRow } from '@mastra/core';
10
- import { GenerateObjectResult } from 'ai';
11
- import { GenerateTextResult } from 'ai';
10
+ import type { GenerateReturn } from '@mastra/core/llm';
11
+ import { GenerateTextResult } from '@mastra/core';
12
12
  import type { IMastraLogger } from '@mastra/core/logger';
13
13
  import type { JSONRPCError } from '@mastra/core/a2a';
14
14
  import { JSONRPCResponse } from '@mastra/core/a2a';
@@ -23,6 +23,8 @@ import type { MastraMemory } from '@mastra/core/memory';
23
23
  import { MastraMessageV1 } from '@mastra/core';
24
24
  import { MastraMessageV2 } from '@mastra/core';
25
25
  import type { MastraScorerEntry } from '@mastra/core/scores';
26
+ import { MastraWorkflowStream } from '@mastra/core';
27
+ import { MemoryConfig } from '@mastra/core';
26
28
  import type { Message } from '@mastra/core/a2a';
27
29
  import { PaginationInfo } from '@mastra/core';
28
30
  import type { QueryResult } from '@mastra/core/vector';
@@ -85,7 +87,8 @@ export declare namespace agents {
85
87
  getEvalsByAgentIdHandler,
86
88
  getLiveEvalsByAgentIdHandler,
87
89
  generateHandler,
88
- streamGenerateHandler
90
+ streamGenerateHandler,
91
+ streamVNextGenerateHandler
89
92
  }
90
93
  }
91
94
 
@@ -184,14 +187,14 @@ export declare function generateHandler({ mastra, runtimeContext, agentId, body,
184
187
  runtimeContext?: Record<string, unknown>;
185
188
  };
186
189
  abortSignal?: AbortSignal;
187
- }): Promise<GenerateTextResult<any, unknown>>;
190
+ }): Promise<GenerateTextResult<any, undefined>>;
188
191
 
189
192
  export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
190
193
  runtimeContext: RuntimeContext;
191
194
  body: {
192
195
  messages?: Parameters<AgentNetwork['generate']>[0];
193
196
  } & Parameters<AgentNetwork['generate']>[1];
194
- }): Promise<GenerateObjectResult<any>>;
197
+ }): Promise<GenerateReturn<any, any, any>>;
195
198
 
196
199
  /**
197
200
  * Generate speech from text
@@ -342,6 +345,10 @@ export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>
342
345
  transports: string[];
343
346
  }>;
344
347
 
348
+ export declare function getMemoryConfigHandler({ mastra, agentId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'>): Promise<{
349
+ config: MemoryConfig;
350
+ }>;
351
+
345
352
  export declare function getMemoryStatusHandler({ mastra, agentId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'>): Promise<{
346
353
  result: boolean;
347
354
  }>;
@@ -728,18 +735,18 @@ export declare function loopStreamVNextNetworkHandler({ mastra, networkId, body,
728
735
  completionReason: ZodOptional<ZodString>;
729
736
  iteration: ZodNumber;
730
737
  }, "strip", ZodTypeAny, {
738
+ result: string;
731
739
  prompt: string;
732
740
  resourceId: string;
733
- result: string;
734
741
  task: string;
735
742
  resourceType: "none" | "tool" | "workflow" | "agent";
736
743
  iteration: number;
737
744
  isComplete?: boolean | undefined;
738
745
  completionReason?: string | undefined;
739
746
  }, {
747
+ result: string;
740
748
  prompt: string;
741
749
  resourceId: string;
742
- result: string;
743
750
  task: string;
744
751
  resourceType: "none" | "tool" | "workflow" | "agent";
745
752
  iteration: number;
@@ -756,9 +763,9 @@ export declare function loopVNextNetworkHandler({ mastra, networkId, body, runti
756
763
  }): Promise<{
757
764
  status: "success";
758
765
  result: {
766
+ result: string;
759
767
  prompt: string;
760
768
  resourceId: string;
761
- result: string;
762
769
  task: string;
763
770
  resourceType: "none" | "tool" | "workflow" | "agent";
764
771
  iteration: number;
@@ -776,6 +783,7 @@ export declare function loopVNextNetworkHandler({ mastra, networkId, body, runti
776
783
  export declare namespace memory {
777
784
  export {
778
785
  getMemoryStatusHandler,
786
+ getMemoryConfigHandler,
779
787
  getThreadsHandler,
780
788
  getThreadByIdHandler,
781
789
  saveMessagesHandler,
@@ -785,7 +793,8 @@ export declare namespace memory {
785
793
  getMessagesPaginatedHandler,
786
794
  getMessagesHandler,
787
795
  getWorkingMemoryHandler,
788
- updateWorkingMemoryHandler
796
+ updateWorkingMemoryHandler,
797
+ searchMemoryHandler
789
798
  }
790
799
  }
791
800
 
@@ -891,6 +900,43 @@ export declare namespace scores {
891
900
  }
892
901
  }
893
902
 
903
+ /**
904
+ * Handler to search messages in a thread.
905
+ * @param searchQuery - the text to search for
906
+ * @param resourceId - the resource id (user/org) to validate thread ownership
907
+ * @param threadId - the thread id to search within
908
+ * @param limit - maximum number of results to return (default: 20)
909
+ */
910
+ export declare function searchMemoryHandler({ mastra, agentId, searchQuery, resourceId, threadId, limit, networkId, runtimeContext, memoryConfig, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
911
+ searchQuery: string;
912
+ resourceId: string;
913
+ threadId?: string;
914
+ limit?: number;
915
+ memoryConfig?: any;
916
+ }): Promise<SearchResponse | ReturnType<typeof handleError>>;
917
+
918
+ declare interface SearchResponse {
919
+ results: SearchResult[];
920
+ count: number;
921
+ query: string;
922
+ searchScope?: string;
923
+ searchType?: string;
924
+ }
925
+
926
+ declare interface SearchResult {
927
+ id: string;
928
+ role: string;
929
+ content: any;
930
+ createdAt: Date;
931
+ threadId?: string;
932
+ threadTitle?: string;
933
+ score?: number;
934
+ context?: {
935
+ before?: SearchResult[];
936
+ after?: SearchResult[];
937
+ };
938
+ }
939
+
894
940
  export declare function sendWorkflowRunEventHandler({ mastra, workflowId, runId, event, data, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
895
941
  event: string;
896
942
  data: unknown;
@@ -995,9 +1041,9 @@ export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, b
995
1041
  threadResourceId: ZodOptional<ZodString>;
996
1042
  isOneOff: ZodBoolean;
997
1043
  }, "strip", ZodTypeAny, {
1044
+ result: string;
998
1045
  prompt: string;
999
1046
  resourceId: string;
1000
- result: string;
1001
1047
  task: string;
1002
1048
  resourceType: "none" | "tool" | "workflow" | "agent";
1003
1049
  iteration: number;
@@ -1007,9 +1053,9 @@ export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, b
1007
1053
  isComplete?: boolean | undefined;
1008
1054
  completionReason?: string | undefined;
1009
1055
  }, {
1056
+ result: string;
1010
1057
  prompt: string;
1011
1058
  resourceId: string;
1012
- result: string;
1013
1059
  task: string;
1014
1060
  resourceType: "none" | "tool" | "workflow" | "agent";
1015
1061
  iteration: number;
@@ -1021,6 +1067,20 @@ export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, b
1021
1067
  }>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
1022
1068
  }>;
1023
1069
 
1070
+ export declare function streamVNextGenerateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
1071
+ runtimeContext: RuntimeContext;
1072
+ agentId: string;
1073
+ body: GetBody<'streamVNext'> & {
1074
+ runtimeContext?: string;
1075
+ };
1076
+ abortSignal?: AbortSignal;
1077
+ }): ReturnType<Agent['streamVNext']>;
1078
+
1079
+ export declare function streamVNextWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
1080
+ inputData?: unknown;
1081
+ runtimeContext?: RuntimeContext_2;
1082
+ }): Promise<MastraWorkflowStream>;
1083
+
1024
1084
  export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
1025
1085
  inputData?: unknown;
1026
1086
  runtimeContext?: RuntimeContext_2;
@@ -1178,6 +1238,7 @@ export declare namespace workflows {
1178
1238
  startWorkflowRunHandler,
1179
1239
  watchWorkflowHandler,
1180
1240
  streamWorkflowHandler,
1241
+ streamVNextWorkflowHandler,
1181
1242
  resumeAsyncWorkflowHandler,
1182
1243
  resumeWorkflowHandler,
1183
1244
  getWorkflowRunsHandler,