@mastra/server 0.0.0-message-ordering-20250415215612 → 0.0.0-new-scorer-api-20250801075530

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 (211) hide show
  1. package/LICENSE.md +11 -42
  2. package/README.md +48 -135
  3. package/dist/chunk-2XIJW7SV.cjs +310 -0
  4. package/dist/chunk-2XIJW7SV.cjs.map +1 -0
  5. package/dist/chunk-4CEZIJWJ.cjs +150 -0
  6. package/dist/chunk-4CEZIJWJ.cjs.map +1 -0
  7. package/dist/chunk-4MQU6AJN.js +83 -0
  8. package/dist/chunk-4MQU6AJN.js.map +1 -0
  9. package/dist/{chunk-QN4KF3BH.cjs → chunk-4QSNRCOT.cjs} +4 -2
  10. package/dist/chunk-4QSNRCOT.cjs.map +1 -0
  11. package/dist/chunk-4US5W7PH.cjs +120 -0
  12. package/dist/chunk-4US5W7PH.cjs.map +1 -0
  13. package/dist/chunk-7FHF55WA.js +2041 -0
  14. package/dist/chunk-7FHF55WA.js.map +1 -0
  15. package/dist/{chunk-FV45V6WC.cjs → chunk-7NADHFD2.cjs} +3 -7
  16. package/dist/chunk-7NADHFD2.cjs.map +1 -0
  17. package/dist/chunk-BED2O446.cjs +88 -0
  18. package/dist/chunk-BED2O446.cjs.map +1 -0
  19. package/dist/chunk-BUOJL3MN.js +529 -0
  20. package/dist/chunk-BUOJL3MN.js.map +1 -0
  21. package/dist/chunk-CY4TP3FK.js +16 -0
  22. package/dist/chunk-CY4TP3FK.js.map +1 -0
  23. package/dist/{chunk-4JINXASC.js → chunk-G7NVCO5M.js} +7 -4
  24. package/dist/chunk-G7NVCO5M.js.map +1 -0
  25. package/dist/chunk-GASWM5HJ.cjs +514 -0
  26. package/dist/chunk-GASWM5HJ.cjs.map +1 -0
  27. package/dist/{chunk-3RVHWGWO.js → chunk-HWHKM67I.js} +38 -19
  28. package/dist/chunk-HWHKM67I.js.map +1 -0
  29. package/dist/chunk-HXIOPAHT.js +541 -0
  30. package/dist/chunk-HXIOPAHT.js.map +1 -0
  31. package/dist/{chunk-CWSDZEZG.cjs → chunk-ILCWPBYQ.cjs} +20 -12
  32. package/dist/chunk-ILCWPBYQ.cjs.map +1 -0
  33. package/dist/chunk-JGVY3KWV.cjs +334 -0
  34. package/dist/chunk-JGVY3KWV.cjs.map +1 -0
  35. package/dist/chunk-LRUH33B4.cjs +2044 -0
  36. package/dist/chunk-LRUH33B4.cjs.map +1 -0
  37. package/dist/{chunk-TRDNDNGQ.js → chunk-MMROOK5J.js} +4 -7
  38. package/dist/chunk-MMROOK5J.js.map +1 -0
  39. package/dist/{chunk-M56ECCHK.cjs → chunk-NCS2OXX6.cjs} +22 -19
  40. package/dist/chunk-NCS2OXX6.cjs.map +1 -0
  41. package/dist/{chunk-PDC4ZBQW.cjs → chunk-O4I563YW.cjs} +30 -26
  42. package/dist/chunk-O4I563YW.cjs.map +1 -0
  43. package/dist/{chunk-L7XE5QTW.js → chunk-OW4FX5TS.js} +3 -1
  44. package/dist/chunk-OW4FX5TS.js.map +1 -0
  45. package/dist/chunk-PZ5AY32C.js +9 -0
  46. package/dist/chunk-PZ5AY32C.js.map +1 -0
  47. package/dist/chunk-Q7SFCCGT.cjs +11 -0
  48. package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
  49. package/dist/chunk-RE4RPXT2.cjs +18 -0
  50. package/dist/chunk-RE4RPXT2.cjs.map +1 -0
  51. package/dist/chunk-S37KCGOR.cjs +546 -0
  52. package/dist/chunk-S37KCGOR.cjs.map +1 -0
  53. package/dist/{chunk-DVPP5S6I.js → chunk-SQ7KKIH3.js} +16 -8
  54. package/dist/chunk-SQ7KKIH3.js.map +1 -0
  55. package/dist/chunk-TRWPUPGD.js +506 -0
  56. package/dist/chunk-TRWPUPGD.js.map +1 -0
  57. package/dist/chunk-TXAQU2XN.js +151 -0
  58. package/dist/chunk-TXAQU2XN.js.map +1 -0
  59. package/dist/{chunk-OPP7H5TW.js → chunk-UVOSITKU.js} +85 -68
  60. package/dist/chunk-UVOSITKU.js.map +1 -0
  61. package/dist/chunk-VIGPWTDA.cjs +159 -0
  62. package/dist/chunk-VIGPWTDA.cjs.map +1 -0
  63. package/dist/chunk-VOY6MGKA.js +301 -0
  64. package/dist/chunk-VOY6MGKA.js.map +1 -0
  65. package/dist/chunk-X5SDJOY6.cjs +557 -0
  66. package/dist/chunk-X5SDJOY6.cjs.map +1 -0
  67. package/dist/{chunk-YANVFOYA.js → chunk-Y3J45CVZ.js} +58 -34
  68. package/dist/chunk-Y3J45CVZ.js.map +1 -0
  69. package/dist/{chunk-UV4WTEH4.js → chunk-YS66MFDY.js} +13 -9
  70. package/dist/chunk-YS66MFDY.js.map +1 -0
  71. package/dist/index.cjs +2 -0
  72. package/dist/index.cjs.map +1 -0
  73. package/dist/index.d.ts +1 -0
  74. package/dist/index.d.ts.map +1 -0
  75. package/dist/index.js +2 -0
  76. package/dist/index.js.map +1 -0
  77. package/dist/server/a2a/protocol.d.ts +8 -0
  78. package/dist/server/a2a/protocol.d.ts.map +1 -0
  79. package/dist/server/a2a/store.d.ts +14 -0
  80. package/dist/server/a2a/store.d.ts.map +1 -0
  81. package/dist/server/a2a/tasks.d.ts +20 -0
  82. package/dist/server/a2a/tasks.d.ts.map +1 -0
  83. package/dist/server/handlers/a2a.cjs +32 -0
  84. package/dist/server/handlers/a2a.cjs.map +1 -0
  85. package/dist/server/handlers/a2a.d.ts +66 -0
  86. package/dist/server/handlers/a2a.d.ts.map +1 -0
  87. package/dist/server/handlers/a2a.js +3 -0
  88. package/dist/server/handlers/a2a.js.map +1 -0
  89. package/dist/server/handlers/agents.cjs +13 -7
  90. package/dist/server/handlers/agents.cjs.map +1 -0
  91. package/dist/server/handlers/agents.d.ts +81 -6
  92. package/dist/server/handlers/agents.d.ts.map +1 -0
  93. package/dist/server/handlers/agents.js +3 -1
  94. package/dist/server/handlers/agents.js.map +1 -0
  95. package/dist/server/handlers/error.cjs +4 -2
  96. package/dist/server/handlers/error.cjs.map +1 -0
  97. package/dist/server/handlers/error.d.ts +2 -1
  98. package/dist/server/handlers/error.d.ts.map +1 -0
  99. package/dist/server/handlers/error.js +3 -1
  100. package/dist/server/handlers/error.js.map +1 -0
  101. package/dist/server/handlers/legacyWorkflows.cjs +48 -0
  102. package/dist/server/handlers/legacyWorkflows.cjs.map +1 -0
  103. package/dist/server/handlers/legacyWorkflows.d.ts +59 -0
  104. package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -0
  105. package/dist/server/handlers/legacyWorkflows.js +3 -0
  106. package/dist/server/handlers/legacyWorkflows.js.map +1 -0
  107. package/dist/server/handlers/logs.cjs +6 -4
  108. package/dist/server/handlers/logs.cjs.map +1 -0
  109. package/dist/server/handlers/logs.d.ts +34 -3
  110. package/dist/server/handlers/logs.d.ts.map +1 -0
  111. package/dist/server/handlers/logs.js +3 -1
  112. package/dist/server/handlers/logs.js.map +1 -0
  113. package/dist/server/handlers/memory.cjs +35 -9
  114. package/dist/server/handlers/memory.cjs.map +1 -0
  115. package/dist/server/handlers/memory.d.ts +113 -8
  116. package/dist/server/handlers/memory.d.ts.map +1 -0
  117. package/dist/server/handlers/memory.js +3 -1
  118. package/dist/server/handlers/memory.js.map +1 -0
  119. package/dist/server/handlers/network.cjs +7 -5
  120. package/dist/server/handlers/network.cjs.map +1 -0
  121. package/dist/server/handlers/network.d.ts +50 -4
  122. package/dist/server/handlers/network.d.ts.map +1 -0
  123. package/dist/server/handlers/network.js +3 -1
  124. package/dist/server/handlers/network.js.map +1 -0
  125. package/dist/server/handlers/scores.cjs +32 -0
  126. package/dist/server/handlers/scores.cjs.map +1 -0
  127. package/dist/server/handlers/scores.d.ts +49 -0
  128. package/dist/server/handlers/scores.d.ts.map +1 -0
  129. package/dist/server/handlers/scores.js +3 -0
  130. package/dist/server/handlers/scores.js.map +1 -0
  131. package/dist/server/handlers/telemetry.cjs +5 -3
  132. package/dist/server/handlers/telemetry.cjs.map +1 -0
  133. package/dist/server/handlers/telemetry.d.ts +32 -2
  134. package/dist/server/handlers/telemetry.d.ts.map +1 -0
  135. package/dist/server/handlers/telemetry.js +3 -1
  136. package/dist/server/handlers/telemetry.js.map +1 -0
  137. package/dist/server/handlers/tools.cjs +7 -5
  138. package/dist/server/handlers/tools.cjs.map +1 -0
  139. package/dist/server/handlers/tools.d.ts +21 -4
  140. package/dist/server/handlers/tools.d.ts.map +1 -0
  141. package/dist/server/handlers/tools.js +3 -1
  142. package/dist/server/handlers/tools.js.map +1 -0
  143. package/dist/server/handlers/utils.cjs +4 -2
  144. package/dist/server/handlers/utils.cjs.map +1 -0
  145. package/dist/server/handlers/utils.d.ts +2 -1
  146. package/dist/server/handlers/utils.d.ts.map +1 -0
  147. package/dist/server/handlers/utils.js +3 -1
  148. package/dist/server/handlers/utils.js.map +1 -0
  149. package/dist/server/handlers/vNextNetwork.cjs +220 -0
  150. package/dist/server/handlers/vNextNetwork.cjs.map +1 -0
  151. package/dist/server/handlers/vNextNetwork.d.ts +179 -0
  152. package/dist/server/handlers/vNextNetwork.d.ts.map +1 -0
  153. package/dist/server/handlers/vNextNetwork.js +213 -0
  154. package/dist/server/handlers/vNextNetwork.js.map +1 -0
  155. package/dist/server/handlers/vector.cjs +9 -7
  156. package/dist/server/handlers/vector.cjs.map +1 -0
  157. package/dist/server/handlers/vector.d.ts +51 -6
  158. package/dist/server/handlers/vector.d.ts.map +1 -0
  159. package/dist/server/handlers/vector.js +3 -1
  160. package/dist/server/handlers/vector.js.map +1 -0
  161. package/dist/server/handlers/voice.cjs +10 -4
  162. package/dist/server/handlers/voice.cjs.map +1 -0
  163. package/dist/server/handlers/voice.d.ts +39 -3
  164. package/dist/server/handlers/voice.d.ts.map +1 -0
  165. package/dist/server/handlers/voice.js +3 -1
  166. package/dist/server/handlers/voice.js.map +1 -0
  167. package/dist/server/handlers/workflows.cjs +35 -13
  168. package/dist/server/handlers/workflows.cjs.map +1 -0
  169. package/dist/server/handlers/workflows.d.ts +88 -10
  170. package/dist/server/handlers/workflows.d.ts.map +1 -0
  171. package/dist/server/handlers/workflows.js +3 -1
  172. package/dist/server/handlers/workflows.js.map +1 -0
  173. package/dist/server/handlers.cjs +42 -25
  174. package/dist/server/handlers.cjs.map +1 -0
  175. package/dist/server/handlers.d.ts +13 -9
  176. package/dist/server/handlers.d.ts.map +1 -0
  177. package/dist/server/handlers.js +14 -9
  178. package/dist/server/handlers.js.map +1 -0
  179. package/dist/server/http-exception.d.ts +87 -0
  180. package/dist/server/http-exception.d.ts.map +1 -0
  181. package/dist/server/types.d.ts +10 -0
  182. package/dist/server/types.d.ts.map +1 -0
  183. package/package.json +17 -15
  184. package/dist/_tsup-dts-rollup.d.cts +0 -573
  185. package/dist/_tsup-dts-rollup.d.ts +0 -573
  186. package/dist/chunk-2FJURXCL.cjs +0 -213
  187. package/dist/chunk-3AHQ5RGN.js +0 -11
  188. package/dist/chunk-3EJZQ6TQ.js +0 -49
  189. package/dist/chunk-67WTHYAV.js +0 -156
  190. package/dist/chunk-A7DF4ETD.cjs +0 -100
  191. package/dist/chunk-B64YROKU.cjs +0 -317
  192. package/dist/chunk-JLDXUWK7.cjs +0 -126
  193. package/dist/chunk-QH6XWSXP.cjs +0 -5579
  194. package/dist/chunk-RBQASTUP.js +0 -203
  195. package/dist/chunk-SKBVVI24.cjs +0 -54
  196. package/dist/chunk-VK6FX47H.js +0 -5576
  197. package/dist/chunk-Z46X3YCB.cjs +0 -164
  198. package/dist/chunk-ZLBRQFDD.cjs +0 -13
  199. package/dist/index.d.cts +0 -1
  200. package/dist/server/handlers/agents.d.cts +0 -6
  201. package/dist/server/handlers/error.d.cts +0 -1
  202. package/dist/server/handlers/logs.d.cts +0 -3
  203. package/dist/server/handlers/memory.d.cts +0 -8
  204. package/dist/server/handlers/network.d.cts +0 -4
  205. package/dist/server/handlers/telemetry.d.cts +0 -2
  206. package/dist/server/handlers/tools.d.cts +0 -4
  207. package/dist/server/handlers/utils.d.cts +0 -1
  208. package/dist/server/handlers/vector.d.cts +0 -6
  209. package/dist/server/handlers/voice.d.cts +0 -3
  210. package/dist/server/handlers/workflows.d.cts +0 -10
  211. package/dist/server/handlers.d.cts +0 -9
@@ -1,573 +0,0 @@
1
- import type { Agent } from '@mastra/core/agent';
2
- import type { AgentNetwork } from '@mastra/core/network';
3
- import type { BaseLogMessage } from '@mastra/core/logger';
4
- import type { Container } from '@mastra/core/di';
5
- import { CoreMessage } from 'ai';
6
- import { EvalRow } from '@mastra/core/storage';
7
- import { GenerateObjectResult } from 'ai';
8
- import { GenerateTextResult } from 'ai';
9
- import type { Mastra } from '@mastra/core/mastra';
10
- import type { MastraMemory } from '@mastra/core/memory';
11
- import { Message } from 'ai';
12
- import { MessageType } from '@mastra/core/memory';
13
- import type { QueryResult } from '@mastra/core/vector';
14
- import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
15
- import { Step } from '@mastra/core/workflows';
16
- import { StepExecutionContext } from '@mastra/core/workflows';
17
- import { StepGraph } from '@mastra/core/workflows';
18
- import { StorageThreadType } from '@mastra/core/memory';
19
- import type { ToolAction } from '@mastra/core/tools';
20
- import type { VercelTool } from '@mastra/core/tools';
21
- import type { Workflow } from '@mastra/core/workflows';
22
- import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
23
- import { WorkflowRunResult } from '@mastra/core/workflows';
24
- import type { WorkflowRuns } from '@mastra/core/storage';
25
-
26
- export declare namespace agents {
27
- export {
28
- getAgentsHandler,
29
- getAgentByIdHandler,
30
- getEvalsByAgentIdHandler,
31
- getLiveEvalsByAgentIdHandler,
32
- generateHandler,
33
- streamGenerateHandler
34
- }
35
- }
36
-
37
- export declare interface ApiError extends Error {
38
- message: string;
39
- status?: number;
40
- }
41
-
42
- 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;
43
-
44
- export declare interface Context {
45
- mastra: Mastra;
46
- }
47
-
48
- export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
49
- index: CreateIndexRequest;
50
- }): Promise<{
51
- success: boolean;
52
- }>;
53
-
54
- declare interface CreateIndexRequest {
55
- indexName: string;
56
- dimension: number;
57
- metric?: 'cosine' | 'euclidean' | 'dotproduct';
58
- }
59
-
60
- export declare function createRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
61
- runId: string;
62
- }>;
63
-
64
- export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
65
- body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
66
- resourceId?: string;
67
- };
68
- }): Promise<StorageThreadType>;
69
-
70
- export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
71
- indexName?: string;
72
- }): Promise<{
73
- success: boolean;
74
- }>;
75
-
76
- export declare function deleteThreadHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
77
- result: string;
78
- }>;
79
-
80
- declare type DeprecatedStatusCode = 305 | 306;
81
-
82
- export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
83
- indexName?: string;
84
- }): Promise<{
85
- dimension: number;
86
- count: number;
87
- metric: string | undefined;
88
- }>;
89
-
90
- export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, container, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
91
- agentId?: string;
92
- data: any;
93
- container: Container;
94
- }): Promise<any>;
95
-
96
- export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, container, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
97
- data?: unknown;
98
- container: Container;
99
- }) => Promise<any>;
100
-
101
- export declare function generateHandler({ mastra, container, agentId, body, }: Context & {
102
- container: Container;
103
- agentId: string;
104
- body: GetBody<'generate'> & {
105
- resourceid?: string;
106
- };
107
- }): Promise<GenerateTextResult<any, any>>;
108
-
109
- export declare function generateHandler_alias_1({ mastra, container, networkId, body, }: NetworkContext & {
110
- container: Container;
111
- body: {
112
- messages?: Parameters<AgentNetwork['generate']>[0];
113
- } & Parameters<AgentNetwork['generate']>[1];
114
- }): Promise<GenerateObjectResult<any>>;
115
-
116
- /**
117
- * Generate speech from text
118
- */
119
- export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceContext & {
120
- body?: {
121
- text?: string;
122
- speakerId?: string;
123
- };
124
- }): Promise<{
125
- audioData: Buffer<ArrayBuffer>;
126
- }>;
127
-
128
- export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
129
- agentId: string;
130
- }): Promise<{
131
- name: any;
132
- instructions: string;
133
- tools: any;
134
- provider: string;
135
- modelId: string;
136
- }>;
137
-
138
- export declare function getAgentsHandler({ mastra }: Context): Promise<any>;
139
-
140
- declare type GetBody<T extends keyof Agent & {
141
- [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
142
- }[keyof Agent]> = {
143
- messages: Parameters<Agent[T]>[0];
144
- } & Parameters<Agent[T]>[1];
145
-
146
- export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
147
- agentId: string;
148
- }): Promise<{
149
- id: string;
150
- name: any;
151
- instructions: string;
152
- evals: EvalRow[];
153
- }>;
154
-
155
- export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Context & {
156
- agentId: string;
157
- }): Promise<{
158
- id: string;
159
- name: any;
160
- instructions: string;
161
- evals: EvalRow[];
162
- }>;
163
-
164
- export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<BaseLogMessage[] | undefined>;
165
-
166
- export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
167
-
168
- export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
169
- transports: string[];
170
- }>;
171
-
172
- export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryContext, 'mastra' | 'agentId'>): Promise<{
173
- result: boolean;
174
- }>;
175
-
176
- export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
177
- messages: CoreMessage[];
178
- uiMessages: Message[];
179
- }>;
180
-
181
- export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<NetworkContext, 'mastra' | 'networkId'>): Promise<{
182
- id: string;
183
- name: string;
184
- instructions: string;
185
- agents: {
186
- name: string;
187
- provider: string;
188
- modelId: string;
189
- }[];
190
- routingModel: {
191
- provider: string;
192
- modelId: string;
193
- };
194
- }>;
195
-
196
- export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
197
- id: string;
198
- name: string;
199
- instructions: string;
200
- agents: {
201
- name: string;
202
- provider: string;
203
- modelId: string;
204
- }[];
205
- routingModel: {
206
- provider: string;
207
- modelId: string;
208
- };
209
- }[]>;
210
-
211
- /**
212
- * Get available speakers for an agent
213
- */
214
- export declare function getSpeakersHandler({ mastra, agentId }: VoiceContext): Promise<{
215
- voiceId: string;
216
- }[]>;
217
-
218
- export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<any[]>;
219
-
220
- export declare function getThreadByIdHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<StorageThreadType>;
221
-
222
- export declare function getThreadsHandler({ mastra, agentId, resourceId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId'>): Promise<StorageThreadType[]>;
223
-
224
- export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext, 'tools' | 'toolId'>): Promise<any>;
225
-
226
- export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
227
-
228
- export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
229
- stepGraph: StepGraph;
230
- stepSubscriberGraph: Record<string, StepGraph>;
231
- serializedStepGraph: StepGraph;
232
- serializedStepSubscriberGraph: Record<string, StepGraph>;
233
- name: string;
234
- triggerSchema: string | undefined;
235
- steps: any;
236
- }>;
237
-
238
- export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
239
-
240
- export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext): Promise<WorkflowRuns>;
241
-
242
- export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
243
-
244
- export declare function handleError(error: unknown, defaultMessage: string): never;
245
-
246
- /**
247
- * `HTTPException` must be used when a fatal error such as authentication failure occurs.
248
- *
249
- * @see {@link https://hono.dev/docs/api/exception}
250
- *
251
- * @param {StatusCode} status - status code of HTTPException
252
- * @param {HTTPExceptionOptions} options - options of HTTPException
253
- * @param {HTTPExceptionOptions["res"]} options.res - response of options of HTTPException
254
- * @param {HTTPExceptionOptions["message"]} options.message - message of options of HTTPException
255
- * @param {HTTPExceptionOptions["cause"]} options.cause - cause of options of HTTPException
256
- *
257
- * @example
258
- * ```ts
259
- * import { HTTPException } from 'hono/http-exception'
260
- *
261
- * // ...
262
- *
263
- * app.post('/auth', async (c, next) => {
264
- * // authentication
265
- * if (authorized === false) {
266
- * throw new HTTPException(401, { message: 'Custom error message' })
267
- * }
268
- * await next()
269
- * })
270
- * ```
271
- */
272
- export declare class HTTPException extends Error {
273
- readonly res?: Response;
274
- readonly status: StatusCode;
275
- /**
276
- * Creates an instance of `HTTPException`.
277
- * @param status - HTTP status code for the exception. Defaults to 500.
278
- * @param options - Additional options for the exception.
279
- */
280
- constructor(status?: StatusCode, options?: HTTPExceptionOptions);
281
- /**
282
- * Returns the response object associated with the exception.
283
- * If a response object is not provided, a new response is created with the error message and status code.
284
- * @returns The response object.
285
- */
286
- getResponse(): Response;
287
- }
288
-
289
- /**
290
- * Options for creating an `HTTPException`.
291
- * @property res - Optional response object to use.
292
- * @property message - Optional custom error message.
293
- * @property cause - Optional cause of the error.
294
- */
295
- declare type HTTPExceptionOptions = {
296
- res?: Response;
297
- message?: string;
298
- cause?: unknown;
299
- };
300
-
301
- /**
302
- * @module
303
- * This module provides the `HTTPException` class.
304
- */
305
- declare type InfoStatusCode = 100 | 101 | 102 | 103;
306
-
307
- export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
308
-
309
- export declare namespace logs {
310
- export {
311
- getLogsHandler,
312
- getLogsByRunIdHandler,
313
- getLogTransports
314
- }
315
- }
316
-
317
- declare type LogsContext = {
318
- mastra: Mastra;
319
- transportId?: string;
320
- runId?: string;
321
- };
322
-
323
- export declare namespace memory {
324
- export {
325
- getMemoryStatusHandler,
326
- getThreadsHandler,
327
- getThreadByIdHandler,
328
- saveMessagesHandler,
329
- createThreadHandler,
330
- updateThreadHandler,
331
- deleteThreadHandler,
332
- getMessagesHandler
333
- }
334
- }
335
-
336
- declare interface MemoryContext extends Context {
337
- agentId?: string;
338
- resourceId?: string;
339
- threadId?: string;
340
- }
341
-
342
- export declare namespace network {
343
- export {
344
- getNetworksHandler,
345
- getNetworkByIdHandler,
346
- generateHandler_alias_1 as generateHandler,
347
- streamGenerateHandler_alias_1 as streamGenerateHandler
348
- }
349
- }
350
-
351
- declare interface NetworkContext extends Context {
352
- networkId?: string;
353
- }
354
-
355
- declare interface QueryRequest {
356
- indexName: string;
357
- queryVector: number[];
358
- topK?: number;
359
- filter?: Record<string, any>;
360
- includeVector?: boolean;
361
- }
362
-
363
- export declare function queryVectors({ mastra, vectorName, query, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
364
- query: QueryRequest;
365
- }): Promise<QueryResult[]>;
366
-
367
- declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
368
-
369
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
370
- body: {
371
- stepId: string;
372
- context: any;
373
- };
374
- container: Container;
375
- }): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
376
-
377
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
378
- body: {
379
- stepId: string;
380
- context: any;
381
- };
382
- container: Container;
383
- }): Promise<{
384
- message: string;
385
- }>;
386
-
387
- export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
388
- body: {
389
- messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
390
- };
391
- }): Promise<MessageType[]>;
392
-
393
- declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
394
-
395
- export declare function startAsyncWorkflowHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
396
- triggerData?: unknown;
397
- container: Container;
398
- }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
399
-
400
- export declare function startWorkflowRunHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
401
- triggerData?: unknown;
402
- container: Container;
403
- }): Promise<{
404
- message: string;
405
- }>;
406
-
407
- /**
408
- * If you want to use an unofficial status, use `UnofficialStatusCode`.
409
- */
410
- export declare type StatusCode = InfoStatusCode | SuccessStatusCode | RedirectStatusCode | ClientErrorStatusCode | ServerErrorStatusCode | UnofficialStatusCode;
411
-
412
- export declare function storeTelemetryHandler({ mastra, body }: Context & {
413
- body: {
414
- resourceSpans: any[];
415
- };
416
- }): Promise<{
417
- status: string;
418
- message: string;
419
- error: any;
420
- } | {
421
- status: string;
422
- message: string;
423
- traceCount: number;
424
- }>;
425
-
426
- export declare function streamGenerateHandler({ mastra, container, agentId, body, }: Context & {
427
- container: Container;
428
- agentId: string;
429
- body: GetBody<'stream'> & {
430
- resourceid?: string;
431
- };
432
- }): Promise<Response | undefined>;
433
-
434
- export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, container, }: NetworkContext & {
435
- container: Container;
436
- body: {
437
- messages?: Parameters<AgentNetwork['stream']>[0];
438
- } & Parameters<AgentNetwork['stream']>[1];
439
- }): Promise<Response>;
440
-
441
- declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
442
-
443
- export declare namespace telemetry {
444
- export {
445
- getTelemetryHandler,
446
- storeTelemetryHandler
447
- }
448
- }
449
-
450
- declare interface TelemetryContext extends Context {
451
- body?: {
452
- name?: string;
453
- scope?: string;
454
- page?: number;
455
- perPage?: number;
456
- attribute?: string | string[];
457
- };
458
- }
459
-
460
- export declare namespace tools {
461
- export {
462
- getToolsHandler,
463
- getToolByIdHandler,
464
- executeToolHandler,
465
- executeAgentToolHandler
466
- }
467
- }
468
-
469
- declare interface ToolsContext extends Context {
470
- tools?: Record<string, ToolAction | VercelTool>;
471
- toolId?: string;
472
- runId?: string;
473
- }
474
-
475
- /**
476
- * Transcribe speech to text
477
- */
478
- export declare function transcribeSpeechHandler({ mastra, agentId, body, }: VoiceContext & {
479
- body?: {
480
- audioData?: Buffer;
481
- options?: Parameters<NonNullable<Agent['voice']>['listen']>[1];
482
- };
483
- }): Promise<{
484
- text: string | void | NodeJS.ReadableStream;
485
- }>;
486
-
487
- /**
488
- * @deprecated
489
- * Use `UnofficialStatusCode` instead.
490
- */
491
- export declare type UnOfficalStatusCode = UnofficialStatusCode;
492
-
493
- /**
494
- * `UnofficialStatusCode` can be used to specify an unofficial status code.
495
- * @example
496
- *
497
- * ```ts
498
- * app.get('/unknown', (c) => {
499
- * return c.text("Unknown Error", 520 as UnofficialStatusCode)
500
- * })
501
- * ```
502
- */
503
- export declare type UnofficialStatusCode = -1;
504
-
505
- export declare function updateThreadHandler({ mastra, agentId, threadId, body, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
506
- body?: Parameters<MastraMemory['saveThread']>[0]['thread'];
507
- }): Promise<StorageThreadType>;
508
-
509
- declare interface UpsertRequest {
510
- indexName: string;
511
- vectors: number[][];
512
- metadata?: Record<string, any>[];
513
- ids?: string[];
514
- }
515
-
516
- export declare function upsertVectors({ mastra, vectorName, index }: VectorContext & {
517
- index: UpsertRequest;
518
- }): Promise<{
519
- ids: string[];
520
- }>;
521
-
522
- export declare function validateBody(body: Record<string, unknown>): void;
523
-
524
- export declare namespace vector {
525
- export {
526
- upsertVectors,
527
- createIndex,
528
- queryVectors,
529
- listIndexes,
530
- describeIndex,
531
- deleteIndex
532
- }
533
- }
534
-
535
- declare interface VectorContext extends Context {
536
- vectorName?: string;
537
- }
538
-
539
- export declare namespace voice {
540
- export {
541
- getSpeakersHandler,
542
- generateSpeechHandler,
543
- transcribeSpeechHandler
544
- }
545
- }
546
-
547
- declare interface VoiceContext extends Context {
548
- agentId?: string;
549
- }
550
-
551
- export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
552
-
553
- declare interface WorkflowContext extends Context {
554
- workflowId?: string;
555
- runId?: string;
556
- }
557
-
558
- export declare namespace workflows {
559
- export {
560
- getWorkflowsHandler,
561
- getWorkflowByIdHandler,
562
- startAsyncWorkflowHandler,
563
- getWorkflowRunHandler,
564
- createRunHandler,
565
- startWorkflowRunHandler,
566
- watchWorkflowHandler,
567
- resumeAsyncWorkflowHandler,
568
- resumeWorkflowHandler,
569
- getWorkflowRunsHandler
570
- }
571
- }
572
-
573
- export { }