@mastra/server 0.12.0-alpha.5 → 0.12.1-alpha.0

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 (200) hide show
  1. package/dist/{chunk-I5JKUCGE.cjs → chunk-2XIJW7SV.cjs} +26 -24
  2. package/dist/chunk-2XIJW7SV.cjs.map +1 -0
  3. package/dist/{chunk-2SLFAFTR.cjs → chunk-4CEZIJWJ.cjs} +16 -14
  4. package/dist/chunk-4CEZIJWJ.cjs.map +1 -0
  5. package/dist/{chunk-4D66QEKC.js → chunk-4MQU6AJN.js} +5 -3
  6. package/dist/chunk-4MQU6AJN.js.map +1 -0
  7. package/dist/{chunk-CCGRCYWJ.cjs → chunk-4QSNRCOT.cjs} +4 -2
  8. package/dist/chunk-4QSNRCOT.cjs.map +1 -0
  9. package/dist/{chunk-RHSWAXKB.cjs → chunk-4US5W7PH.cjs} +26 -24
  10. package/dist/chunk-4US5W7PH.cjs.map +1 -0
  11. package/dist/{chunk-36BLNJHS.js → chunk-7FHF55WA.js} +2 -0
  12. package/dist/chunk-7FHF55WA.js.map +1 -0
  13. package/dist/{chunk-2KZFMI6P.cjs → chunk-7NADHFD2.cjs} +2 -0
  14. package/dist/chunk-7NADHFD2.cjs.map +1 -0
  15. package/dist/{chunk-QGX47B5D.cjs → chunk-BED2O446.cjs} +11 -9
  16. package/dist/chunk-BED2O446.cjs.map +1 -0
  17. package/dist/{chunk-T7HAZC2E.js → chunk-BUOJL3MN.js} +6 -4
  18. package/dist/chunk-BUOJL3MN.js.map +1 -0
  19. package/dist/{chunk-LF7P5PLR.js → chunk-CY4TP3FK.js} +3 -1
  20. package/dist/chunk-CY4TP3FK.js.map +1 -0
  21. package/dist/{chunk-WNVFNNWN.js → chunk-G7NVCO5M.js} +5 -3
  22. package/dist/chunk-G7NVCO5M.js.map +1 -0
  23. package/dist/{chunk-SDPGVWQJ.cjs → chunk-GASWM5HJ.cjs} +4 -2
  24. package/dist/chunk-GASWM5HJ.cjs.map +1 -0
  25. package/dist/{chunk-KHZKYUNR.js → chunk-HWHKM67I.js} +6 -4
  26. package/dist/chunk-HWHKM67I.js.map +1 -0
  27. package/dist/{chunk-PIAJQ75M.js → chunk-HXIOPAHT.js} +6 -4
  28. package/dist/chunk-HXIOPAHT.js.map +1 -0
  29. package/dist/{chunk-G7KH752Y.cjs → chunk-ILCWPBYQ.cjs} +9 -7
  30. package/dist/chunk-ILCWPBYQ.cjs.map +1 -0
  31. package/dist/{chunk-UCV4247U.cjs → chunk-JGVY3KWV.cjs} +47 -45
  32. package/dist/chunk-JGVY3KWV.cjs.map +1 -0
  33. package/dist/{chunk-HISYIDYH.cjs → chunk-LRUH33B4.cjs} +2 -0
  34. package/dist/chunk-LRUH33B4.cjs.map +1 -0
  35. package/dist/{chunk-LCM566I4.js → chunk-MMROOK5J.js} +2 -0
  36. package/dist/chunk-MMROOK5J.js.map +1 -0
  37. package/dist/{chunk-7TP2LX5L.cjs → chunk-NCS2OXX6.cjs} +20 -18
  38. package/dist/chunk-NCS2OXX6.cjs.map +1 -0
  39. package/dist/{chunk-HRSAZUIK.cjs → chunk-O4I563YW.cjs} +24 -22
  40. package/dist/chunk-O4I563YW.cjs.map +1 -0
  41. package/dist/{chunk-RSEO4XPX.js → chunk-OW4FX5TS.js} +3 -1
  42. package/dist/chunk-OW4FX5TS.js.map +1 -0
  43. package/dist/{chunk-MLKGABMK.js → chunk-PZ5AY32C.js} +2 -0
  44. package/dist/chunk-PZ5AY32C.js.map +1 -0
  45. package/dist/{chunk-75ZPJI57.cjs → chunk-Q7SFCCGT.cjs} +2 -0
  46. package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
  47. package/dist/{chunk-PZQDCRPV.cjs → chunk-RE4RPXT2.cjs} +4 -2
  48. package/dist/chunk-RE4RPXT2.cjs.map +1 -0
  49. package/dist/{chunk-6KP2OBYA.cjs → chunk-S37KCGOR.cjs} +88 -86
  50. package/dist/chunk-S37KCGOR.cjs.map +1 -0
  51. package/dist/{chunk-RG473F6Y.js → chunk-SQ7KKIH3.js} +5 -3
  52. package/dist/chunk-SQ7KKIH3.js.map +1 -0
  53. package/dist/{chunk-GHC4YV6R.js → chunk-TRWPUPGD.js} +3 -1
  54. package/dist/chunk-TRWPUPGD.js.map +1 -0
  55. package/dist/{chunk-6T5JUKOQ.js → chunk-TXAQU2XN.js} +4 -2
  56. package/dist/chunk-TXAQU2XN.js.map +1 -0
  57. package/dist/{chunk-ZYAFP2AV.js → chunk-UVOSITKU.js} +6 -4
  58. package/dist/chunk-UVOSITKU.js.map +1 -0
  59. package/dist/{chunk-424T5F2J.cjs → chunk-VIGPWTDA.cjs} +9 -7
  60. package/dist/chunk-VIGPWTDA.cjs.map +1 -0
  61. package/dist/{chunk-VTTN2FW3.js → chunk-VOY6MGKA.js} +7 -5
  62. package/dist/chunk-VOY6MGKA.js.map +1 -0
  63. package/dist/{chunk-UEVYOKAH.cjs → chunk-X5SDJOY6.cjs} +60 -58
  64. package/dist/chunk-X5SDJOY6.cjs.map +1 -0
  65. package/dist/{chunk-CRCR3ZUK.js → chunk-Y3J45CVZ.js} +6 -4
  66. package/dist/chunk-Y3J45CVZ.js.map +1 -0
  67. package/dist/{chunk-WBRFIHSF.js → chunk-YS66MFDY.js} +7 -5
  68. package/dist/chunk-YS66MFDY.js.map +1 -0
  69. package/dist/index.cjs +2 -0
  70. package/dist/index.cjs.map +1 -0
  71. package/dist/index.d.ts +1 -0
  72. package/dist/index.d.ts.map +1 -0
  73. package/dist/index.js +2 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/server/a2a/protocol.d.ts +8 -0
  76. package/dist/server/a2a/protocol.d.ts.map +1 -0
  77. package/dist/server/a2a/store.d.ts +14 -0
  78. package/dist/server/a2a/store.d.ts.map +1 -0
  79. package/dist/server/a2a/tasks.d.ts +20 -0
  80. package/dist/server/a2a/tasks.d.ts.map +1 -0
  81. package/dist/server/handlers/a2a.cjs +9 -7
  82. package/dist/server/handlers/a2a.cjs.map +1 -0
  83. package/dist/server/handlers/a2a.d.ts +66 -6
  84. package/dist/server/handlers/a2a.d.ts.map +1 -0
  85. package/dist/server/handlers/a2a.js +3 -1
  86. package/dist/server/handlers/a2a.js.map +1 -0
  87. package/dist/server/handlers/agents.cjs +10 -8
  88. package/dist/server/handlers/agents.cjs.map +1 -0
  89. package/dist/server/handlers/agents.d.ts +81 -7
  90. package/dist/server/handlers/agents.d.ts.map +1 -0
  91. package/dist/server/handlers/agents.js +3 -1
  92. package/dist/server/handlers/agents.js.map +1 -0
  93. package/dist/server/handlers/error.cjs +4 -2
  94. package/dist/server/handlers/error.cjs.map +1 -0
  95. package/dist/server/handlers/error.d.ts +2 -1
  96. package/dist/server/handlers/error.d.ts.map +1 -0
  97. package/dist/server/handlers/error.js +3 -1
  98. package/dist/server/handlers/error.js.map +1 -0
  99. package/dist/server/handlers/legacyWorkflows.cjs +13 -11
  100. package/dist/server/handlers/legacyWorkflows.cjs.map +1 -0
  101. package/dist/server/handlers/legacyWorkflows.d.ts +59 -10
  102. package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -0
  103. package/dist/server/handlers/legacyWorkflows.js +3 -1
  104. package/dist/server/handlers/legacyWorkflows.js.map +1 -0
  105. package/dist/server/handlers/logs.cjs +6 -4
  106. package/dist/server/handlers/logs.cjs.map +1 -0
  107. package/dist/server/handlers/logs.d.ts +34 -3
  108. package/dist/server/handlers/logs.d.ts.map +1 -0
  109. package/dist/server/handlers/logs.js +3 -1
  110. package/dist/server/handlers/logs.js.map +1 -0
  111. package/dist/server/handlers/memory.cjs +17 -15
  112. package/dist/server/handlers/memory.cjs.map +1 -0
  113. package/dist/server/handlers/memory.d.ts +113 -14
  114. package/dist/server/handlers/memory.d.ts.map +1 -0
  115. package/dist/server/handlers/memory.js +3 -1
  116. package/dist/server/handlers/memory.js.map +1 -0
  117. package/dist/server/handlers/network.cjs +7 -5
  118. package/dist/server/handlers/network.cjs.map +1 -0
  119. package/dist/server/handlers/network.d.ts +50 -4
  120. package/dist/server/handlers/network.d.ts.map +1 -0
  121. package/dist/server/handlers/network.js +3 -1
  122. package/dist/server/handlers/network.js.map +1 -0
  123. package/dist/server/handlers/scores.cjs +9 -7
  124. package/dist/server/handlers/scores.cjs.map +1 -0
  125. package/dist/server/handlers/scores.d.ts +49 -6
  126. package/dist/server/handlers/scores.d.ts.map +1 -0
  127. package/dist/server/handlers/scores.js +3 -1
  128. package/dist/server/handlers/scores.js.map +1 -0
  129. package/dist/server/handlers/telemetry.cjs +5 -3
  130. package/dist/server/handlers/telemetry.cjs.map +1 -0
  131. package/dist/server/handlers/telemetry.d.ts +32 -2
  132. package/dist/server/handlers/telemetry.d.ts.map +1 -0
  133. package/dist/server/handlers/telemetry.js +3 -1
  134. package/dist/server/handlers/telemetry.js.map +1 -0
  135. package/dist/server/handlers/tools.cjs +7 -5
  136. package/dist/server/handlers/tools.cjs.map +1 -0
  137. package/dist/server/handlers/tools.d.ts +21 -4
  138. package/dist/server/handlers/tools.d.ts.map +1 -0
  139. package/dist/server/handlers/tools.js +3 -1
  140. package/dist/server/handlers/tools.js.map +1 -0
  141. package/dist/server/handlers/utils.cjs +4 -2
  142. package/dist/server/handlers/utils.cjs.map +1 -0
  143. package/dist/server/handlers/utils.d.ts +2 -1
  144. package/dist/server/handlers/utils.d.ts.map +1 -0
  145. package/dist/server/handlers/utils.js +3 -1
  146. package/dist/server/handlers/utils.js.map +1 -0
  147. package/dist/server/handlers/vNextNetwork.cjs +25 -23
  148. package/dist/server/handlers/vNextNetwork.cjs.map +1 -0
  149. package/dist/server/handlers/vNextNetwork.d.ts +179 -6
  150. package/dist/server/handlers/vNextNetwork.d.ts.map +1 -0
  151. package/dist/server/handlers/vNextNetwork.js +6 -4
  152. package/dist/server/handlers/vNextNetwork.js.map +1 -0
  153. package/dist/server/handlers/vector.cjs +9 -7
  154. package/dist/server/handlers/vector.cjs.map +1 -0
  155. package/dist/server/handlers/vector.d.ts +51 -6
  156. package/dist/server/handlers/vector.d.ts.map +1 -0
  157. package/dist/server/handlers/vector.js +3 -1
  158. package/dist/server/handlers/vector.js.map +1 -0
  159. package/dist/server/handlers/voice.cjs +7 -5
  160. package/dist/server/handlers/voice.cjs.map +1 -0
  161. package/dist/server/handlers/voice.d.ts +39 -4
  162. package/dist/server/handlers/voice.d.ts.map +1 -0
  163. package/dist/server/handlers/voice.js +3 -1
  164. package/dist/server/handlers/voice.js.map +1 -0
  165. package/dist/server/handlers/workflows.cjs +18 -16
  166. package/dist/server/handlers/workflows.cjs.map +1 -0
  167. package/dist/server/handlers/workflows.d.ts +88 -15
  168. package/dist/server/handlers/workflows.d.ts.map +1 -0
  169. package/dist/server/handlers/workflows.js +3 -1
  170. package/dist/server/handlers/workflows.js.map +1 -0
  171. package/dist/server/handlers.cjs +26 -24
  172. package/dist/server/handlers.cjs.map +1 -0
  173. package/dist/server/handlers.d.ts +13 -12
  174. package/dist/server/handlers.d.ts.map +1 -0
  175. package/dist/server/handlers.js +14 -12
  176. package/dist/server/handlers.js.map +1 -0
  177. package/dist/server/http-exception.d.ts +87 -0
  178. package/dist/server/http-exception.d.ts.map +1 -0
  179. package/dist/server/types.d.ts +10 -0
  180. package/dist/server/types.d.ts.map +1 -0
  181. package/package.json +5 -5
  182. package/dist/_tsup-dts-rollup.d.cts +0 -1260
  183. package/dist/_tsup-dts-rollup.d.ts +0 -1260
  184. package/dist/index.d.cts +0 -1
  185. package/dist/server/handlers/a2a.d.cts +0 -6
  186. package/dist/server/handlers/agents.d.cts +0 -7
  187. package/dist/server/handlers/error.d.cts +0 -1
  188. package/dist/server/handlers/legacyWorkflows.d.cts +0 -10
  189. package/dist/server/handlers/logs.d.cts +0 -3
  190. package/dist/server/handlers/memory.d.cts +0 -14
  191. package/dist/server/handlers/network.d.cts +0 -4
  192. package/dist/server/handlers/scores.d.cts +0 -6
  193. package/dist/server/handlers/telemetry.d.cts +0 -2
  194. package/dist/server/handlers/tools.d.cts +0 -4
  195. package/dist/server/handlers/utils.d.cts +0 -1
  196. package/dist/server/handlers/vNextNetwork.d.cts +0 -6
  197. package/dist/server/handlers/vector.d.cts +0 -6
  198. package/dist/server/handlers/voice.d.cts +0 -4
  199. package/dist/server/handlers/workflows.d.cts +0 -15
  200. package/dist/server/handlers.d.cts +0 -12
@@ -1,1260 +0,0 @@
1
- import type { Agent } from '@mastra/core/agent';
2
- import type { AgentCard } from '@mastra/core/a2a';
3
- import type { AgentNetwork } from '@mastra/core/network';
4
- import type { Artifact } from '@mastra/core/a2a';
5
- import { BaseLogMessage } from '@mastra/core/logger';
6
- import { CoreMessage } from 'ai';
7
- import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
8
- import { DefaultEngineType } from '@mastra/core';
9
- import { EvalRow } from '@mastra/core';
10
- import type { GenerateReturn } from '@mastra/core/llm';
11
- import { GenerateTextResult } from '@mastra/core';
12
- import type { IMastraLogger } from '@mastra/core/logger';
13
- import type { JSONRPCError } from '@mastra/core/a2a';
14
- import { JSONRPCResponse } from '@mastra/core/a2a';
15
- import { LegacyStep } from '@mastra/core/workflows/legacy';
16
- import type { LegacyWorkflow } from '@mastra/core/workflows/legacy';
17
- import { LegacyWorkflowRunResult } from '@mastra/core/workflows/legacy';
18
- import type { LegacyWorkflowRuns } from '@mastra/core/storage';
19
- import type { LogLevel } from '@mastra/core/logger';
20
- import type { Mastra } from '@mastra/core/mastra';
21
- import type { MastraError } from '@mastra/core/error';
22
- import type { MastraMemory } from '@mastra/core/memory';
23
- import { MastraMessageV1 } from '@mastra/core';
24
- import { MastraMessageV2 } from '@mastra/core';
25
- import type { MastraScorerEntry } from '@mastra/core/scores';
26
- import { MastraWorkflowStream } from '@mastra/core';
27
- import { MemoryConfig } from '@mastra/core';
28
- import type { Message } from '@mastra/core/a2a';
29
- import { PaginationInfo } from '@mastra/core';
30
- import type { QueryResult } from '@mastra/core/vector';
31
- import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
32
- import { ReadableStream as ReadableStream_3 } from 'stream/web';
33
- import { RuntimeContext } from '@mastra/core/runtime-context';
34
- import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
35
- import type { ScoreRowData } from '@mastra/core/scores';
36
- import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
37
- import { Step } from '@mastra/core';
38
- import { StepExecutionContext } from '@mastra/core/workflows/legacy';
39
- import { StepGraph } from '@mastra/core/workflows/legacy';
40
- import { StepResult } from '@mastra/core';
41
- import type { StorageGetMessagesArg } from '@mastra/core';
42
- import type { StoragePagination } from '@mastra/core/storage';
43
- import { StorageThreadType } from '@mastra/core';
44
- import { StreamEvent } from '@mastra/core';
45
- import { Task } from '@mastra/core/a2a';
46
- import { TaskAndHistory } from '@mastra/core/a2a';
47
- import type { TaskContext } from '@mastra/core/a2a';
48
- import type { TaskIdParams } from '@mastra/core/a2a';
49
- import type { TaskQueryParams } from '@mastra/core/a2a';
50
- import type { TaskSendParams } from '@mastra/core/a2a';
51
- import type { TaskStatus } from '@mastra/core/a2a';
52
- import type { ThreadSortOptions } from '@mastra/core/storage';
53
- import type { ToolAction } from '@mastra/core/tools';
54
- import { Trace } from '@mastra/core';
55
- import { UIMessageWithMetadata } from '@mastra/core/agent';
56
- import type { VercelTool } from '@mastra/core/tools';
57
- import type { WatchEvent } from '@mastra/core/workflows';
58
- import type { Workflow } from '@mastra/core/workflows';
59
- import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
60
- import { WorkflowResult } from '@mastra/core';
61
- import type { WorkflowRuns } from '@mastra/core/storage';
62
- import { WorkingMemoryTemplate } from '@mastra/core';
63
- import { ZodBoolean } from 'zod';
64
- import { ZodEnum } from 'zod';
65
- import { ZodNumber } from 'zod';
66
- import { ZodObject } from 'zod';
67
- import { ZodOptional } from 'zod';
68
- import { ZodString } from 'zod';
69
- import { ZodType } from 'zod';
70
- import { ZodTypeAny } from 'zod';
71
- import { ZodTypeDef } from 'zod';
72
-
73
- export declare namespace a2a {
74
- export {
75
- getAgentCardByIdHandler,
76
- handleTaskSend,
77
- handleTaskGet,
78
- handleTaskSendSubscribe,
79
- handleTaskCancel,
80
- getAgentExecutionHandler
81
- }
82
- }
83
-
84
- export declare namespace agents {
85
- export {
86
- getAgentsHandler,
87
- getAgentByIdHandler,
88
- getEvalsByAgentIdHandler,
89
- getLiveEvalsByAgentIdHandler,
90
- generateHandler,
91
- streamGenerateHandler,
92
- streamVNextGenerateHandler
93
- }
94
- }
95
-
96
- export declare interface ApiError extends MastraError {
97
- message: string;
98
- status?: number;
99
- }
100
-
101
- export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
102
-
103
- export declare function cancelWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
104
- message: string;
105
- }>;
106
-
107
- declare type ClientErrorStatusCode = 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451;
108
-
109
- export declare interface Context {
110
- mastra: Mastra;
111
- }
112
-
113
- export declare function convertToCoreMessage(message: Message): CoreMessage_2;
114
-
115
- export declare function createErrorResponse(id: number | string | null, error: JSONRPCError<unknown>): JSONRPCResponse<null, unknown>;
116
-
117
- export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
118
- index: CreateIndexRequest;
119
- }): Promise<{
120
- success: boolean;
121
- }>;
122
-
123
- declare interface CreateIndexRequest {
124
- indexName: string;
125
- dimension: number;
126
- metric?: 'cosine' | 'euclidean' | 'dotproduct';
127
- }
128
-
129
- export declare function createLegacyWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
130
- runId: string;
131
- }>;
132
-
133
- export declare function createSuccessResponse<T>(id: number | string | null, result: T): JSONRPCResponse<T>;
134
-
135
- export declare function createTaskContext({ task, userMessage, history, activeCancellations, }: {
136
- task: Task;
137
- userMessage: Message;
138
- history: Message[];
139
- activeCancellations: Set<string>;
140
- }): TaskContext;
141
-
142
- export declare function createThreadHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
143
- body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
144
- resourceId?: string;
145
- };
146
- }): Promise<StorageThreadType>;
147
-
148
- export declare function createWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
149
- runId: string;
150
- }>;
151
-
152
- export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
153
- indexName?: string;
154
- }): Promise<{
155
- success: boolean;
156
- }>;
157
-
158
- /**
159
- * Handler to delete one or more messages.
160
- * @param messageIds - Can be a single ID, array of IDs, or objects with ID property
161
- */
162
- export declare function deleteMessagesHandler({ mastra, agentId, messageIds, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
163
- messageIds: string | string[] | {
164
- id: string;
165
- } | {
166
- id: string;
167
- }[];
168
- }): Promise<{
169
- success: boolean;
170
- message: string;
171
- }>;
172
-
173
- export declare function deleteThreadHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<{
174
- result: string;
175
- }>;
176
-
177
- declare type DeprecatedStatusCode = 305 | 306;
178
-
179
- export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
180
- indexName?: string;
181
- }): Promise<{
182
- dimension: number;
183
- count: number;
184
- metric: string | undefined;
185
- }>;
186
-
187
- export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
188
- agentId?: string;
189
- data: any;
190
- runtimeContext: RuntimeContext_2;
191
- }): Promise<any>;
192
-
193
- export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
194
- data?: unknown;
195
- runtimeContext: RuntimeContext_2;
196
- }) => Promise<any>;
197
-
198
- export declare function generateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
199
- runtimeContext: RuntimeContext;
200
- agentId: string;
201
- body: GetBody<'generate'> & {
202
- resourceid?: string;
203
- runtimeContext?: Record<string, unknown>;
204
- };
205
- abortSignal?: AbortSignal;
206
- }): Promise<GenerateTextResult<any, undefined>>;
207
-
208
- export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
209
- runtimeContext: RuntimeContext;
210
- body: {
211
- messages?: Parameters<AgentNetwork['generate']>[0];
212
- } & Parameters<AgentNetwork['generate']>[1];
213
- }): Promise<GenerateReturn<any, any, any>>;
214
-
215
- /**
216
- * Generate speech from text
217
- */
218
- export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceContext & {
219
- body?: {
220
- text?: string;
221
- speakerId?: string;
222
- };
223
- }): Promise<NodeJS.ReadableStream>;
224
-
225
- export declare function generateVNextNetworkHandler({ mastra, runtimeContext, networkId, body, }: NetworkContext_2 & {
226
- runtimeContext: RuntimeContext;
227
- body: {
228
- message: string;
229
- threadId?: string;
230
- resourceId?: string;
231
- };
232
- }): Promise<{
233
- task: string;
234
- result: string;
235
- resourceId: string;
236
- resourceType: "none" | "tool" | "workflow" | "agent";
237
- }>;
238
-
239
- export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, isPlayground, }: Context & {
240
- isPlayground?: boolean;
241
- runtimeContext: RuntimeContext;
242
- agentId: string;
243
- }): Promise<{
244
- name: any;
245
- instructions: string;
246
- tools: any;
247
- workflows: {};
248
- provider: string;
249
- modelId: string;
250
- defaultGenerateOptions: any;
251
- defaultStreamOptions: any;
252
- }>;
253
-
254
- export declare function getAgentCardByIdHandler({ mastra, agentId, executionUrl, provider, version, runtimeContext, }: Context & {
255
- runtimeContext: RuntimeContext;
256
- agentId: keyof ReturnType<typeof mastra.getAgents>;
257
- executionUrl?: string;
258
- version?: string;
259
- provider?: {
260
- organization: string;
261
- url: string;
262
- };
263
- }): Promise<AgentCard>;
264
-
265
- export declare function getAgentExecutionHandler({ requestId, mastra, agentId, runtimeContext, method, params, taskStore, logger, }: Context & {
266
- requestId: string;
267
- runtimeContext: RuntimeContext;
268
- agentId: string;
269
- method: 'tasks/send' | 'tasks/sendSubscribe' | 'tasks/get' | 'tasks/cancel';
270
- params: TaskSendParams | TaskQueryParams | TaskIdParams;
271
- taskStore?: InMemoryTaskStore;
272
- logger?: IMastraLogger;
273
- }): Promise<any>;
274
-
275
- export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
276
- runtimeContext: RuntimeContext;
277
- }): Promise<Record<string, Omit<{
278
- id: string;
279
- name: any;
280
- instructions: string;
281
- tools: any;
282
- workflows: {};
283
- provider: string;
284
- modelId: string;
285
- defaultGenerateOptions: any;
286
- defaultStreamOptions: any;
287
- }, "id">>>;
288
-
289
- declare type GetBody<T extends keyof Agent & {
290
- [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
291
- }[keyof Agent]> = {
292
- messages: Parameters<Agent[T]>[0];
293
- } & Parameters<Agent[T]>[1];
294
-
295
- export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
296
- runtimeContext: RuntimeContext;
297
- agentId: string;
298
- }): Promise<{
299
- id: string;
300
- name: any;
301
- instructions: string;
302
- evals: EvalRow[];
303
- }>;
304
-
305
- export declare function getLegacyWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
306
- stepGraph: StepGraph;
307
- stepSubscriberGraph: Record<string, StepGraph>;
308
- serializedStepGraph: StepGraph;
309
- serializedStepSubscriberGraph: Record<string, StepGraph>;
310
- name: string;
311
- triggerSchema: string | undefined;
312
- steps: any;
313
- }>;
314
-
315
- export declare function getLegacyWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<LegacyWorkflow['getRun']>>;
316
-
317
- export declare function getLegacyWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
318
- fromDate?: Date;
319
- toDate?: Date;
320
- limit?: number;
321
- offset?: number;
322
- resourceId?: string;
323
- }): Promise<LegacyWorkflowRuns>;
324
-
325
- export declare function getLegacyWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
326
-
327
- /**
328
- * Get available listeners for an agent
329
- */
330
- export declare function getListenerHandler({ mastra, agentId }: VoiceContext): Promise<{
331
- enabled: boolean;
332
- }>;
333
-
334
- export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
335
- runtimeContext: RuntimeContext;
336
- agentId: string;
337
- }): Promise<{
338
- id: string;
339
- name: any;
340
- instructions: string;
341
- evals: EvalRow[];
342
- }>;
343
-
344
- export declare function getLogsByRunIdHandler({ mastra, runId, transportId, params, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId' | 'params'>): Promise<{
345
- logs: BaseLogMessage[];
346
- total: number;
347
- page: number;
348
- perPage: number;
349
- hasMore: boolean;
350
- }>;
351
-
352
- export declare function getLogsHandler({ mastra, transportId, params, }: Pick<LogsContext, 'mastra' | 'transportId' | 'params'>): Promise<{
353
- logs: BaseLogMessage[];
354
- total: number;
355
- page: number;
356
- perPage: number;
357
- hasMore: boolean;
358
- }>;
359
-
360
- export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
361
- transports: string[];
362
- }>;
363
-
364
- export declare function getMemoryConfigHandler({ mastra, agentId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'>): Promise<{
365
- config: MemoryConfig;
366
- }>;
367
-
368
- export declare function getMemoryStatusHandler({ mastra, agentId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'>): Promise<{
369
- result: boolean;
370
- }>;
371
-
372
- export declare function getMessagesHandler({ mastra, agentId, threadId, limit, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
373
- limit?: number;
374
- }): Promise<{
375
- messages: CoreMessage[];
376
- uiMessages: UIMessageWithMetadata[];
377
- }>;
378
-
379
- export declare function getMessagesPaginatedHandler({ mastra, threadId, resourceId, selectBy, format, }: StorageGetMessagesArg & Pick<MemoryContext, 'mastra'>): Promise<PaginationInfo & {
380
- messages: MastraMessageV1[] | MastraMessageV2[];
381
- }>;
382
-
383
- export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
384
- id: string;
385
- name: string;
386
- instructions: string;
387
- agents: {
388
- name: string;
389
- provider: string;
390
- modelId: string;
391
- }[];
392
- routingModel: {
393
- provider: string;
394
- modelId: string;
395
- };
396
- }>;
397
-
398
- export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
399
- id: string;
400
- name: string;
401
- instructions: string;
402
- agents: {
403
- name: string;
404
- provider: string;
405
- modelId: string;
406
- }[];
407
- routingModel: {
408
- provider: string;
409
- modelId: string;
410
- };
411
- }[]>;
412
-
413
- export declare function getScorerHandler({ mastra, scorerId, runtimeContext, }: Context & {
414
- scorerId: string;
415
- runtimeContext: RuntimeContext;
416
- }): Promise<(MastraScorerEntry & {
417
- agentIds: string[];
418
- workflowIds: string[];
419
- }) | null>;
420
-
421
- export declare function getScorersHandler({ mastra, runtimeContext }: Context & {
422
- runtimeContext: RuntimeContext;
423
- }): Promise<{
424
- [k: string]: MastraScorerEntry & {
425
- agentIds: string[];
426
- workflowIds: string[];
427
- };
428
- }>;
429
-
430
- export declare function getScoresByEntityIdHandler({ mastra, entityId, entityType, pagination, }: Context & {
431
- entityId: string;
432
- entityType: string;
433
- pagination: StoragePagination;
434
- }): Promise<never[] | {
435
- pagination: PaginationInfo;
436
- scores: ScoreRowData[];
437
- }>;
438
-
439
- export declare function getScoresByRunIdHandler({ mastra, runId, pagination, }: Context & {
440
- runId: string;
441
- pagination: StoragePagination;
442
- }): Promise<never[] | {
443
- pagination: PaginationInfo;
444
- scores: ScoreRowData[];
445
- }>;
446
-
447
- export declare function getScoresByScorerIdHandler({ mastra, scorerId, pagination, entityId, entityType, }: Context & {
448
- scorerId: string;
449
- pagination: StoragePagination;
450
- entityId?: string;
451
- entityType?: string;
452
- }): Promise<never[] | {
453
- pagination: PaginationInfo;
454
- scores: ScoreRowData[];
455
- }>;
456
-
457
- /**
458
- * Get available speakers for an agent
459
- */
460
- export declare function getSpeakersHandler({ mastra, agentId }: VoiceContext): Promise<{
461
- voiceId: string;
462
- }[]>;
463
-
464
- export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<Trace[]>;
465
-
466
- export declare function getThreadByIdHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType>;
467
-
468
- export declare function getThreadsHandler({ mastra, agentId, resourceId, networkId, runtimeContext, orderBy, sortDirection, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId' | 'networkId' | 'runtimeContext'> & ThreadSortOptions): Promise<StorageThreadType[]>;
469
-
470
- export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext, 'tools' | 'toolId'>): Promise<any>;
471
-
472
- export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
473
-
474
- export declare function getVNextNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
475
- id: string;
476
- name: string;
477
- instructions: string;
478
- agents: {
479
- name: string;
480
- provider: string;
481
- modelId: string;
482
- }[];
483
- workflows: {
484
- name: string | undefined;
485
- description: string | undefined;
486
- inputSchema: string | undefined;
487
- outputSchema: string | undefined;
488
- }[];
489
- tools: {
490
- id: string;
491
- description: string;
492
- }[];
493
- routingModel: {
494
- provider: string;
495
- modelId: string;
496
- };
497
- }>;
498
-
499
- export declare function getVNextNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'runtimeContext'>): Promise<{
500
- id: string;
501
- name: string;
502
- instructions: string;
503
- tools: {
504
- id: string;
505
- description: string;
506
- }[];
507
- agents: {
508
- name: string;
509
- provider: string;
510
- modelId: string;
511
- }[];
512
- workflows: {
513
- name: string | undefined;
514
- description: string | undefined;
515
- inputSchema: string | undefined;
516
- outputSchema: string | undefined;
517
- }[];
518
- routingModel: {
519
- provider: string;
520
- modelId: string;
521
- };
522
- }[]>;
523
-
524
- export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
525
- steps: Record<string, SerializedStep>;
526
- allSteps: Record<string, SerializedStep>;
527
- name: string | undefined;
528
- description: string | undefined;
529
- stepGraph: SerializedStepFlowEntry[];
530
- inputSchema: string | undefined;
531
- outputSchema: string | undefined;
532
- }>;
533
-
534
- export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
535
-
536
- export declare function getWorkflowRunExecutionResultHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<WatchEvent['payload']['workflowState']>;
537
-
538
- export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext_3 & {
539
- fromDate?: Date;
540
- toDate?: Date;
541
- limit?: number;
542
- offset?: number;
543
- resourceId?: string;
544
- }): Promise<WorkflowRuns>;
545
-
546
- export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
547
-
548
- /**
549
- * Handler to get the working memory for a thread (optionally resource-scoped).
550
- * @returns workingMemory - the working memory for the thread
551
- * @returns source - thread or resource
552
- */
553
- export declare function getWorkingMemoryHandler({ mastra, agentId, threadId, resourceId, networkId, runtimeContext, memoryConfig, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
554
- resourceId?: Parameters<MastraMemory['getWorkingMemory']>[0]['resourceId'];
555
- memoryConfig?: Parameters<MastraMemory['getWorkingMemory']>[0]['memoryConfig'];
556
- }): Promise<{
557
- workingMemory: string | null;
558
- source: string;
559
- workingMemoryTemplate: WorkingMemoryTemplate | null;
560
- threadExists: boolean;
561
- }>;
562
-
563
- export declare function handleError(error: unknown, defaultMessage: string): never;
564
-
565
- export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
566
- requestId: string;
567
- taskStore: InMemoryTaskStore;
568
- agentId: string;
569
- taskId: string;
570
- logger?: IMastraLogger;
571
- }): Promise<JSONRPCResponse<Task, unknown>>;
572
-
573
- export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }: {
574
- requestId: string;
575
- taskStore: InMemoryTaskStore;
576
- agentId: string;
577
- taskId: string;
578
- }): Promise<JSONRPCResponse<TaskAndHistory, unknown>>;
579
-
580
- export declare function handleTaskSend({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
581
- requestId: string;
582
- params: TaskSendParams;
583
- taskStore: InMemoryTaskStore;
584
- agent: Agent;
585
- agentId: string;
586
- logger?: IMastraLogger;
587
- runtimeContext: RuntimeContext;
588
- }): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
589
-
590
- export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
591
- requestId: string;
592
- params: TaskSendParams;
593
- taskStore: InMemoryTaskStore;
594
- agent: Agent;
595
- agentId: string;
596
- logger?: IMastraLogger;
597
- runtimeContext: RuntimeContext;
598
- }): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
599
- state: string;
600
- message: {
601
- role: string;
602
- parts: {
603
- type: string;
604
- text: string;
605
- }[];
606
- };
607
- }, unknown>, void, unknown>;
608
-
609
- /**
610
- * `HTTPException` must be used when a fatal error such as authentication failure occurs.
611
- *
612
- * @see {@link https://hono.dev/docs/api/exception}
613
- *
614
- * @param {StatusCode} status - status code of HTTPException
615
- * @param {HTTPExceptionOptions} options - options of HTTPException
616
- * @param {HTTPExceptionOptions["res"]} options.res - response of options of HTTPException
617
- * @param {HTTPExceptionOptions["message"]} options.message - message of options of HTTPException
618
- * @param {HTTPExceptionOptions["cause"]} options.cause - cause of options of HTTPException
619
- *
620
- * @example
621
- * ```ts
622
- * import { HTTPException } from 'hono/http-exception'
623
- *
624
- * // ...
625
- *
626
- * app.post('/auth', async (c, next) => {
627
- * // authentication
628
- * if (authorized === false) {
629
- * throw new HTTPException(401, { message: 'Custom error message' })
630
- * }
631
- * await next()
632
- * })
633
- * ```
634
- */
635
- export declare class HTTPException extends Error {
636
- readonly res?: Response;
637
- readonly status: StatusCode;
638
- /**
639
- * Creates an instance of `HTTPException`.
640
- * @param status - HTTP status code for the exception. Defaults to 500.
641
- * @param options - Additional options for the exception.
642
- */
643
- constructor(status?: StatusCode, options?: HTTPExceptionOptions);
644
- /**
645
- * Returns the response object associated with the exception.
646
- * If a response object is not provided, a new response is created with the error message and status code.
647
- * @returns The response object.
648
- */
649
- getResponse(): Response;
650
- }
651
-
652
- /**
653
- * Options for creating an `HTTPException`.
654
- * @property res - Optional response object to use.
655
- * @property message - Optional custom error message.
656
- * @property cause - Optional cause of the error.
657
- * @property stack - Optional stack trace for the error.
658
- */
659
- declare type HTTPExceptionOptions = {
660
- res?: Response;
661
- message?: string;
662
- cause?: unknown;
663
- stack?: string;
664
- };
665
-
666
- /**
667
- * @module
668
- * This module provides the `HTTPException` class.
669
- */
670
- declare type InfoStatusCode = 100 | 101 | 102 | 103;
671
-
672
- export declare class InMemoryTaskStore {
673
- private store;
674
- activeCancellations: Set<string>;
675
- load({ agentId, taskId }: {
676
- agentId: string;
677
- taskId: string;
678
- }): Promise<TaskAndHistory | null>;
679
- save({ agentId, data }: {
680
- agentId: string;
681
- data: TaskAndHistory;
682
- }): Promise<void>;
683
- }
684
-
685
- export declare namespace legacyWorkflows {
686
- export {
687
- getLegacyWorkflowsHandler,
688
- getLegacyWorkflowByIdHandler,
689
- startAsyncLegacyWorkflowHandler,
690
- getLegacyWorkflowRunHandler,
691
- createLegacyWorkflowRunHandler,
692
- startLegacyWorkflowRunHandler,
693
- watchLegacyWorkflowHandler,
694
- resumeAsyncLegacyWorkflowHandler,
695
- resumeLegacyWorkflowHandler,
696
- getLegacyWorkflowRunsHandler
697
- }
698
- }
699
-
700
- export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
701
-
702
- export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore, message, sessionId, metadata, logger, }: {
703
- agentId: string;
704
- taskId: string;
705
- taskStore: InMemoryTaskStore;
706
- message: Message;
707
- sessionId?: string | null;
708
- metadata?: Record<string, unknown> | null;
709
- logger?: IMastraLogger;
710
- }): Promise<TaskAndHistory>;
711
-
712
- export declare namespace logs {
713
- export {
714
- getLogsHandler,
715
- getLogsByRunIdHandler,
716
- getLogTransports
717
- }
718
- }
719
-
720
- declare type LogsContext = {
721
- mastra: Mastra;
722
- transportId?: string;
723
- runId?: string;
724
- params?: {
725
- fromDate?: Date;
726
- toDate?: Date;
727
- logLevel?: LogLevel;
728
- filters?: string | string[];
729
- page?: number;
730
- perPage?: number;
731
- };
732
- };
733
-
734
- export declare function loopStreamVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
735
- runtimeContext: RuntimeContext;
736
- body: {
737
- message: string;
738
- threadId?: string;
739
- resourceId?: string;
740
- maxIterations?: number;
741
- };
742
- }): Promise<{
743
- stream: ReadableStream_3<StreamEvent>;
744
- getWorkflowState: () => Promise<WorkflowResult<ZodObject< {
745
- task: ZodString;
746
- resourceId: ZodString;
747
- resourceType: ZodEnum<["agent", "workflow", "none", "tool", "none"]>;
748
- prompt: ZodString;
749
- result: ZodString;
750
- isComplete: ZodOptional<ZodBoolean>;
751
- completionReason: ZodOptional<ZodString>;
752
- iteration: ZodNumber;
753
- }, "strip", ZodTypeAny, {
754
- resourceId: string;
755
- result: string;
756
- prompt: string;
757
- task: string;
758
- resourceType: "none" | "tool" | "workflow" | "agent";
759
- iteration: number;
760
- isComplete?: boolean | undefined;
761
- completionReason?: string | undefined;
762
- }, {
763
- resourceId: string;
764
- result: string;
765
- prompt: string;
766
- task: string;
767
- resourceType: "none" | "tool" | "workflow" | "agent";
768
- iteration: number;
769
- isComplete?: boolean | undefined;
770
- completionReason?: string | undefined;
771
- }>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
772
- }>;
773
-
774
- export declare function loopVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
775
- runtimeContext: RuntimeContext;
776
- body: {
777
- message: string;
778
- };
779
- }): Promise<{
780
- status: "success";
781
- result: {
782
- resourceId: string;
783
- result: string;
784
- prompt: string;
785
- task: string;
786
- resourceType: "none" | "tool" | "workflow" | "agent";
787
- iteration: number;
788
- isOneOff: boolean;
789
- threadId?: string | undefined;
790
- threadResourceId?: string | undefined;
791
- isComplete?: boolean | undefined;
792
- completionReason?: string | undefined;
793
- };
794
- steps: {
795
- [x: string]: StepResult<any, any, any, any> | StepResult<unknown, unknown, unknown, unknown>;
796
- };
797
- }>;
798
-
799
- export declare namespace memory {
800
- export {
801
- getMemoryStatusHandler,
802
- getMemoryConfigHandler,
803
- getThreadsHandler,
804
- getThreadByIdHandler,
805
- saveMessagesHandler,
806
- createThreadHandler,
807
- updateThreadHandler,
808
- deleteThreadHandler,
809
- getMessagesPaginatedHandler,
810
- getMessagesHandler,
811
- getWorkingMemoryHandler,
812
- updateWorkingMemoryHandler,
813
- deleteMessagesHandler,
814
- searchMemoryHandler
815
- }
816
- }
817
-
818
- declare interface MemoryContext extends Context {
819
- agentId?: string;
820
- resourceId?: string;
821
- threadId?: string;
822
- networkId?: string;
823
- runtimeContext?: RuntimeContext_2;
824
- }
825
-
826
- export declare namespace network {
827
- export {
828
- getNetworksHandler,
829
- getNetworkByIdHandler,
830
- generateHandler_alias_1 as generateHandler,
831
- streamGenerateHandler_alias_1 as streamGenerateHandler
832
- }
833
- }
834
-
835
- declare interface NetworkContext extends Context {
836
- networkId?: string;
837
- runtimeContext: RuntimeContext;
838
- }
839
-
840
- declare interface NetworkContext_2 extends Context {
841
- networkId?: string;
842
- runtimeContext: RuntimeContext;
843
- }
844
-
845
- export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
846
-
847
- declare interface QueryRequest {
848
- indexName: string;
849
- queryVector: number[];
850
- topK?: number;
851
- filter?: Record<string, any>;
852
- includeVector?: boolean;
853
- }
854
-
855
- export declare function queryVectors({ mastra, vectorName, query, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
856
- query: QueryRequest;
857
- }): Promise<QueryResult[]>;
858
-
859
- declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
860
-
861
- export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
862
- body: {
863
- stepId: string;
864
- context: any;
865
- };
866
- runtimeContext: RuntimeContext;
867
- }): Promise<Omit<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
868
-
869
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
870
- body: {
871
- step: string | string[];
872
- resumeData?: unknown;
873
- };
874
- runtimeContext?: RuntimeContext_2;
875
- }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
876
-
877
- export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
878
- body: {
879
- stepId: string;
880
- context: any;
881
- };
882
- runtimeContext: RuntimeContext;
883
- }): Promise<{
884
- message: string;
885
- }>;
886
-
887
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
888
- body: {
889
- step: string | string[];
890
- resumeData?: unknown;
891
- };
892
- runtimeContext?: RuntimeContext_2;
893
- }): Promise<{
894
- message: string;
895
- }>;
896
-
897
- export declare function saveMessagesHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
898
- body: {
899
- messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
900
- };
901
- }): Promise<MastraMessageV1[]>;
902
-
903
- export declare function saveScoreHandler({ mastra, score }: Context & {
904
- score: ScoreRowData;
905
- }): Promise<never[] | {
906
- score: ScoreRowData;
907
- }>;
908
-
909
- export declare namespace scores {
910
- export {
911
- getScorersHandler,
912
- getScorerHandler,
913
- getScoresByRunIdHandler,
914
- getScoresByScorerIdHandler,
915
- getScoresByEntityIdHandler,
916
- saveScoreHandler
917
- }
918
- }
919
-
920
- export declare function searchMemoryHandler({ mastra, agentId, searchQuery, resourceId, threadId, limit, networkId, runtimeContext, memoryConfig, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
921
- searchQuery: string;
922
- resourceId: string;
923
- threadId?: string;
924
- limit?: number;
925
- memoryConfig?: any;
926
- }): Promise<SearchResponse | ReturnType<typeof handleError>>;
927
-
928
- declare interface SearchResponse {
929
- results: SearchResult[];
930
- count: number;
931
- query: string;
932
- searchScope?: string;
933
- searchType?: string;
934
- }
935
-
936
- declare interface SearchResult {
937
- id: string;
938
- role: string;
939
- content: any;
940
- createdAt: Date;
941
- threadId?: string;
942
- threadTitle?: string;
943
- score?: number;
944
- context?: {
945
- before?: SearchResult[];
946
- after?: SearchResult[];
947
- };
948
- }
949
-
950
- export declare function sendWorkflowRunEventHandler({ mastra, workflowId, runId, event, data, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
951
- event: string;
952
- data: unknown;
953
- }): Promise<{
954
- message: string;
955
- }>;
956
-
957
- declare type SerializedStep = {
958
- id: string;
959
- description: string;
960
- inputSchema: string | undefined;
961
- outputSchema: string | undefined;
962
- resumeSchema: string | undefined;
963
- suspendSchema: string | undefined;
964
- };
965
-
966
- declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
967
-
968
- export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
969
- triggerData?: unknown;
970
- runtimeContext: RuntimeContext;
971
- }): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
972
-
973
- export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
974
- inputData?: unknown;
975
- runtimeContext?: RuntimeContext_2;
976
- }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
977
-
978
- export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
979
- triggerData?: unknown;
980
- runtimeContext: RuntimeContext;
981
- }): Promise<{
982
- message: string;
983
- }>;
984
-
985
- export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
986
- inputData?: unknown;
987
- runtimeContext?: RuntimeContext_2;
988
- }): Promise<{
989
- message: string;
990
- }>;
991
-
992
- /**
993
- * If you want to use an unofficial status, use `UnofficialStatusCode`.
994
- */
995
- export declare type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | UnofficialStatusCode;
996
-
997
- export declare function storeTelemetryHandler({ mastra, body }: Context & {
998
- body: {
999
- resourceSpans: any[];
1000
- };
1001
- }): Promise<{
1002
- status: string;
1003
- message: string;
1004
- error: any;
1005
- } | {
1006
- status: string;
1007
- message: string;
1008
- traceCount?: undefined;
1009
- } | {
1010
- status: string;
1011
- message: string;
1012
- traceCount: number;
1013
- }>;
1014
-
1015
- export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
1016
- runtimeContext: RuntimeContext;
1017
- agentId: string;
1018
- body: GetBody<'stream'> & {
1019
- resourceid?: string;
1020
- runtimeContext?: string;
1021
- };
1022
- abortSignal?: AbortSignal;
1023
- }): Promise<Response | undefined>;
1024
-
1025
- export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
1026
- runtimeContext: RuntimeContext;
1027
- body: {
1028
- messages?: Parameters<AgentNetwork['stream']>[0];
1029
- } & Parameters<AgentNetwork['stream']>[1];
1030
- }): Promise<Response>;
1031
-
1032
- export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
1033
- runtimeContext: RuntimeContext;
1034
- body: {
1035
- message: string;
1036
- threadId?: string;
1037
- resourceId?: string;
1038
- };
1039
- }): Promise<{
1040
- stream: ReadableStream_3<StreamEvent>;
1041
- getWorkflowState: () => Promise<WorkflowResult<ZodObject< {
1042
- task: ZodString;
1043
- resourceId: ZodString;
1044
- resourceType: ZodEnum<["agent", "workflow", "none", "tool", "none"]>;
1045
- prompt: ZodString;
1046
- result: ZodString;
1047
- isComplete: ZodOptional<ZodBoolean>;
1048
- completionReason: ZodOptional<ZodString>;
1049
- iteration: ZodNumber;
1050
- threadId: ZodOptional<ZodString>;
1051
- threadResourceId: ZodOptional<ZodString>;
1052
- isOneOff: ZodBoolean;
1053
- }, "strip", ZodTypeAny, {
1054
- resourceId: string;
1055
- result: string;
1056
- prompt: string;
1057
- task: string;
1058
- resourceType: "none" | "tool" | "workflow" | "agent";
1059
- iteration: number;
1060
- isOneOff: boolean;
1061
- threadId?: string | undefined;
1062
- threadResourceId?: string | undefined;
1063
- isComplete?: boolean | undefined;
1064
- completionReason?: string | undefined;
1065
- }, {
1066
- resourceId: string;
1067
- result: string;
1068
- prompt: string;
1069
- task: string;
1070
- resourceType: "none" | "tool" | "workflow" | "agent";
1071
- iteration: number;
1072
- isOneOff: boolean;
1073
- threadId?: string | undefined;
1074
- threadResourceId?: string | undefined;
1075
- isComplete?: boolean | undefined;
1076
- completionReason?: string | undefined;
1077
- }>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
1078
- }>;
1079
-
1080
- export declare function streamVNextGenerateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
1081
- runtimeContext: RuntimeContext;
1082
- agentId: string;
1083
- body: GetBody<'streamVNext'> & {
1084
- runtimeContext?: string;
1085
- };
1086
- abortSignal?: AbortSignal;
1087
- }): ReturnType<Agent['streamVNext']>;
1088
-
1089
- export declare function streamVNextWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
1090
- inputData?: unknown;
1091
- runtimeContext?: RuntimeContext_2;
1092
- }): Promise<MastraWorkflowStream>;
1093
-
1094
- export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
1095
- inputData?: unknown;
1096
- runtimeContext?: RuntimeContext_2;
1097
- }): Promise<{
1098
- stream: ReadableStream_2<StreamEvent>;
1099
- getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
1100
- }>;
1101
-
1102
- declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
1103
-
1104
- export declare namespace telemetry {
1105
- export {
1106
- getTelemetryHandler,
1107
- storeTelemetryHandler
1108
- }
1109
- }
1110
-
1111
- declare interface TelemetryContext extends Context {
1112
- body?: {
1113
- name?: string;
1114
- scope?: string;
1115
- page?: number;
1116
- perPage?: number;
1117
- attribute?: string | string[];
1118
- fromDate?: Date;
1119
- toDate?: Date;
1120
- };
1121
- }
1122
-
1123
- export declare namespace tools {
1124
- export {
1125
- getToolsHandler,
1126
- getToolByIdHandler,
1127
- executeToolHandler,
1128
- executeAgentToolHandler
1129
- }
1130
- }
1131
-
1132
- declare interface ToolsContext extends Context {
1133
- tools?: Record<string, ToolAction | VercelTool>;
1134
- toolId?: string;
1135
- runId?: string;
1136
- }
1137
-
1138
- /**
1139
- * Transcribe speech to text
1140
- */
1141
- export declare function transcribeSpeechHandler({ mastra, agentId, body, }: VoiceContext & {
1142
- body?: {
1143
- audioData?: Buffer;
1144
- options?: Parameters<NonNullable<Agent['voice']>['listen']>[1];
1145
- };
1146
- }): Promise<{
1147
- text: string | void | NodeJS.ReadableStream;
1148
- }>;
1149
-
1150
- /**
1151
- * @deprecated
1152
- * Use `UnofficialStatusCode` instead.
1153
- */
1154
- export declare type UnOfficalStatusCode = UnofficialStatusCode;
1155
-
1156
- /**
1157
- * `UnofficialStatusCode` can be used to specify an unofficial status code.
1158
- * @example
1159
- *
1160
- * ```ts
1161
- * app.get('/unknown', (c) => {
1162
- * return c.text("Unknown Error", 520 as UnofficialStatusCode)
1163
- * })
1164
- * ```
1165
- */
1166
- export declare type UnofficialStatusCode = -1;
1167
-
1168
- export declare function updateThreadHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
1169
- body?: Parameters<MastraMemory['saveThread']>[0]['thread'];
1170
- }): Promise<StorageThreadType>;
1171
-
1172
- /**
1173
- * Handler to update the working memory for a thread (optionally resource-scoped).
1174
- * @param threadId - the thread id
1175
- * @param body - the body containing the working memory to update and the resource id (optional)
1176
- */
1177
- export declare function updateWorkingMemoryHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
1178
- body: Omit<Parameters<MastraMemory['updateWorkingMemory']>[0], 'threadId'>;
1179
- }): Promise<{
1180
- success: boolean;
1181
- }>;
1182
-
1183
- declare interface UpsertRequest {
1184
- indexName: string;
1185
- vectors: number[][];
1186
- metadata?: Record<string, any>[];
1187
- ids?: string[];
1188
- }
1189
-
1190
- export declare function upsertVectors({ mastra, vectorName, index }: VectorContext & {
1191
- index: UpsertRequest;
1192
- }): Promise<{
1193
- ids: string[];
1194
- }>;
1195
-
1196
- export declare function validateBody(body: Record<string, unknown>): void;
1197
-
1198
- export declare namespace vector {
1199
- export {
1200
- upsertVectors,
1201
- createIndex,
1202
- queryVectors,
1203
- listIndexes,
1204
- describeIndex,
1205
- deleteIndex
1206
- }
1207
- }
1208
-
1209
- declare interface VectorContext extends Context {
1210
- vectorName?: string;
1211
- }
1212
-
1213
- export declare namespace voice {
1214
- export {
1215
- getSpeakersHandler,
1216
- generateSpeechHandler,
1217
- transcribeSpeechHandler,
1218
- getListenerHandler
1219
- }
1220
- }
1221
-
1222
- declare interface VoiceContext extends Context {
1223
- agentId?: string;
1224
- }
1225
-
1226
- export declare function watchLegacyWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
1227
-
1228
- export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
1229
-
1230
- declare interface WorkflowContext extends Context {
1231
- workflowId?: string;
1232
- runId?: string;
1233
- }
1234
-
1235
- declare interface WorkflowContext_3 extends Context {
1236
- workflowId?: string;
1237
- runId?: string;
1238
- }
1239
-
1240
- export declare namespace workflows {
1241
- export {
1242
- getWorkflowsHandler,
1243
- getWorkflowByIdHandler,
1244
- getWorkflowRunByIdHandler,
1245
- getWorkflowRunExecutionResultHandler,
1246
- createWorkflowRunHandler,
1247
- startAsyncWorkflowHandler,
1248
- startWorkflowRunHandler,
1249
- watchWorkflowHandler,
1250
- streamWorkflowHandler,
1251
- streamVNextWorkflowHandler,
1252
- resumeAsyncWorkflowHandler,
1253
- resumeWorkflowHandler,
1254
- getWorkflowRunsHandler,
1255
- cancelWorkflowRunHandler,
1256
- sendWorkflowRunEventHandler
1257
- }
1258
- }
1259
-
1260
- export { }