@mastra/server 0.0.0-extend-clickhouse-20250418135620 → 0.0.0-feat-tool-input-validation-20250731232758

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 (102) hide show
  1. package/LICENSE.md +11 -42
  2. package/README.md +48 -135
  3. package/dist/_tsup-dts-rollup.d.cts +763 -76
  4. package/dist/_tsup-dts-rollup.d.ts +763 -76
  5. package/dist/{chunk-FV45V6WC.cjs → chunk-2KZFMI6P.cjs} +1 -7
  6. package/dist/chunk-2SLFAFTR.cjs +148 -0
  7. package/dist/chunk-36BLNJHS.js +2039 -0
  8. package/dist/chunk-424T5F2J.cjs +157 -0
  9. package/dist/chunk-4D66QEKC.js +81 -0
  10. package/dist/chunk-6KP2OBYA.cjs +544 -0
  11. package/dist/chunk-6T5JUKOQ.js +149 -0
  12. package/dist/chunk-75ZPJI57.cjs +9 -0
  13. package/dist/{chunk-M56ECCHK.cjs → chunk-7TP2LX5L.cjs} +20 -19
  14. package/dist/{chunk-QN4KF3BH.cjs → chunk-CCGRCYWJ.cjs} +2 -2
  15. package/dist/{chunk-YANVFOYA.js → chunk-CRCR3ZUK.js} +56 -34
  16. package/dist/{chunk-7IWQE76Z.cjs → chunk-G7KH752Y.cjs} +16 -10
  17. package/dist/chunk-GHC4YV6R.js +504 -0
  18. package/dist/chunk-HISYIDYH.cjs +2042 -0
  19. package/dist/{chunk-HABV7TZK.cjs → chunk-HRSAZUIK.cjs} +28 -26
  20. package/dist/chunk-I5JKUCGE.cjs +308 -0
  21. package/dist/{chunk-3RVHWGWO.js → chunk-KHZKYUNR.js} +36 -19
  22. package/dist/{chunk-TRDNDNGQ.js → chunk-LCM566I4.js} +2 -7
  23. package/dist/chunk-LF7P5PLR.js +14 -0
  24. package/dist/chunk-MLKGABMK.js +7 -0
  25. package/dist/chunk-PIAJQ75M.js +539 -0
  26. package/dist/chunk-PZQDCRPV.cjs +16 -0
  27. package/dist/chunk-QGX47B5D.cjs +86 -0
  28. package/dist/{chunk-WTHDCRMY.js → chunk-RG473F6Y.js} +12 -6
  29. package/dist/chunk-RHSWAXKB.cjs +118 -0
  30. package/dist/{chunk-L7XE5QTW.js → chunk-RSEO4XPX.js} +1 -1
  31. package/dist/chunk-SDPGVWQJ.cjs +512 -0
  32. package/dist/chunk-T7HAZC2E.js +527 -0
  33. package/dist/chunk-UCV4247U.cjs +332 -0
  34. package/dist/chunk-UEVYOKAH.cjs +555 -0
  35. package/dist/chunk-VTTN2FW3.js +299 -0
  36. package/dist/{chunk-XISBMH56.js → chunk-WBRFIHSF.js} +11 -9
  37. package/dist/{chunk-4JINXASC.js → chunk-WNVFNNWN.js} +5 -4
  38. package/dist/{chunk-4B7OUZXW.js → chunk-ZYAFP2AV.js} +83 -68
  39. package/dist/server/handlers/a2a.cjs +30 -0
  40. package/dist/server/handlers/a2a.d.cts +6 -0
  41. package/dist/server/handlers/a2a.d.ts +6 -0
  42. package/dist/server/handlers/a2a.js +1 -0
  43. package/dist/server/handlers/agents.cjs +11 -7
  44. package/dist/server/handlers/agents.d.cts +1 -0
  45. package/dist/server/handlers/agents.d.ts +1 -0
  46. package/dist/server/handlers/agents.js +1 -1
  47. package/dist/server/handlers/error.cjs +2 -2
  48. package/dist/server/handlers/error.js +1 -1
  49. package/dist/server/handlers/legacyWorkflows.cjs +46 -0
  50. package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
  51. package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
  52. package/dist/server/handlers/legacyWorkflows.js +1 -0
  53. package/dist/server/handlers/logs.cjs +4 -4
  54. package/dist/server/handlers/logs.js +1 -1
  55. package/dist/server/handlers/memory.cjs +33 -9
  56. package/dist/server/handlers/memory.d.cts +6 -0
  57. package/dist/server/handlers/memory.d.ts +6 -0
  58. package/dist/server/handlers/memory.js +1 -1
  59. package/dist/server/handlers/network.cjs +5 -5
  60. package/dist/server/handlers/network.js +1 -1
  61. package/dist/server/handlers/scores.cjs +30 -0
  62. package/dist/server/handlers/scores.d.cts +6 -0
  63. package/dist/server/handlers/scores.d.ts +6 -0
  64. package/dist/server/handlers/scores.js +1 -0
  65. package/dist/server/handlers/telemetry.cjs +3 -3
  66. package/dist/server/handlers/telemetry.js +1 -1
  67. package/dist/server/handlers/tools.cjs +5 -5
  68. package/dist/server/handlers/tools.js +1 -1
  69. package/dist/server/handlers/utils.cjs +2 -2
  70. package/dist/server/handlers/utils.js +1 -1
  71. package/dist/server/handlers/vNextNetwork.cjs +218 -0
  72. package/dist/server/handlers/vNextNetwork.d.cts +6 -0
  73. package/dist/server/handlers/vNextNetwork.d.ts +6 -0
  74. package/dist/server/handlers/vNextNetwork.js +211 -0
  75. package/dist/server/handlers/vector.cjs +7 -7
  76. package/dist/server/handlers/vector.js +1 -1
  77. package/dist/server/handlers/voice.cjs +8 -4
  78. package/dist/server/handlers/voice.d.cts +1 -0
  79. package/dist/server/handlers/voice.d.ts +1 -0
  80. package/dist/server/handlers/voice.js +1 -1
  81. package/dist/server/handlers/workflows.cjs +33 -13
  82. package/dist/server/handlers/workflows.d.cts +7 -2
  83. package/dist/server/handlers/workflows.d.ts +7 -2
  84. package/dist/server/handlers/workflows.js +1 -1
  85. package/dist/server/handlers.cjs +40 -25
  86. package/dist/server/handlers.d.cts +4 -1
  87. package/dist/server/handlers.d.ts +4 -1
  88. package/dist/server/handlers.js +12 -9
  89. package/package.json +17 -15
  90. package/dist/chunk-2FJURXCL.cjs +0 -213
  91. package/dist/chunk-3AHQ5RGN.js +0 -11
  92. package/dist/chunk-3EJZQ6TQ.js +0 -49
  93. package/dist/chunk-4WJ5GHRG.cjs +0 -164
  94. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  95. package/dist/chunk-A7DF4ETD.cjs +0 -100
  96. package/dist/chunk-JLDXUWK7.cjs +0 -126
  97. package/dist/chunk-OMN3UI6X.js +0 -5576
  98. package/dist/chunk-RBQASTUP.js +0 -203
  99. package/dist/chunk-RNU4JMLM.cjs +0 -317
  100. package/dist/chunk-SKBVVI24.cjs +0 -54
  101. package/dist/chunk-TFFNX7FI.js +0 -156
  102. package/dist/chunk-ZLBRQFDD.cjs +0 -13
@@ -1,27 +1,85 @@
1
1
  import type { Agent } from '@mastra/core/agent';
2
+ import type { AgentCard } from '@mastra/core/a2a';
2
3
  import type { AgentNetwork } from '@mastra/core/network';
3
- import type { BaseLogMessage } from '@mastra/core/logger';
4
- import type { Container } from '@mastra/core/di';
4
+ import type { Artifact } from '@mastra/core/a2a';
5
+ import { BaseLogMessage } from '@mastra/core/logger';
5
6
  import { CoreMessage } from 'ai';
6
- import { EvalRow } from '@mastra/core/storage';
7
- import { GenerateObjectResult } from 'ai';
8
- import { GenerateTextResult } 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';
9
20
  import type { Mastra } from '@mastra/core/mastra';
21
+ import type { MastraError } from '@mastra/core/error';
10
22
  import type { MastraMemory } from '@mastra/core/memory';
11
- import { Message } from 'ai';
12
- import { MessageType } 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';
13
30
  import type { QueryResult } from '@mastra/core/vector';
14
31
  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';
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';
19
53
  import type { ToolAction } from '@mastra/core/tools';
54
+ import { Trace } from '@mastra/core';
55
+ import { UIMessageWithMetadata } from '@mastra/core/agent';
20
56
  import type { VercelTool } from '@mastra/core/tools';
57
+ import type { WatchEvent } from '@mastra/core/workflows';
21
58
  import type { Workflow } from '@mastra/core/workflows';
22
- import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
23
- import { WorkflowRunResult } from '@mastra/core/workflows';
59
+ import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
60
+ import { WorkflowResult } from '@mastra/core';
24
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
+ }
25
83
 
26
84
  export declare namespace agents {
27
85
  export {
@@ -30,21 +88,32 @@ export declare namespace agents {
30
88
  getEvalsByAgentIdHandler,
31
89
  getLiveEvalsByAgentIdHandler,
32
90
  generateHandler,
33
- streamGenerateHandler
91
+ streamGenerateHandler,
92
+ streamVNextGenerateHandler
34
93
  }
35
94
  }
36
95
 
37
- export declare interface ApiError extends Error {
96
+ export declare interface ApiError extends MastraError {
38
97
  message: string;
39
98
  status?: number;
40
99
  }
41
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
+
42
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;
43
108
 
44
109
  export declare interface Context {
45
110
  mastra: Mastra;
46
111
  }
47
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
+
48
117
  export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
49
118
  index: CreateIndexRequest;
50
119
  }): Promise<{
@@ -57,23 +126,51 @@ declare interface CreateIndexRequest {
57
126
  metric?: 'cosine' | 'euclidean' | 'dotproduct';
58
127
  }
59
128
 
60
- export declare function createRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
129
+ export declare function createLegacyWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
61
130
  runId: string;
62
131
  }>;
63
132
 
64
- export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
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'> & {
65
143
  body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
66
144
  resourceId?: string;
67
145
  };
68
146
  }): Promise<StorageThreadType>;
69
147
 
148
+ export declare function createWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
149
+ runId: string;
150
+ }>;
151
+
70
152
  export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
71
153
  indexName?: string;
72
154
  }): Promise<{
73
155
  success: boolean;
74
156
  }>;
75
157
 
76
- export declare function deleteThreadHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
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<{
77
174
  result: string;
78
175
  }>;
79
176
 
@@ -87,31 +184,33 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
87
184
  metric: string | undefined;
88
185
  }>;
89
186
 
90
- export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, container, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
187
+ export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
91
188
  agentId?: string;
92
189
  data: any;
93
- container: Container;
190
+ runtimeContext: RuntimeContext_2;
94
191
  }): Promise<any>;
95
192
 
96
- export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, container, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
193
+ export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
97
194
  data?: unknown;
98
- container: Container;
195
+ runtimeContext: RuntimeContext_2;
99
196
  }) => Promise<any>;
100
197
 
101
- export declare function generateHandler({ mastra, container, agentId, body, }: Context & {
102
- container: Container;
198
+ export declare function generateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
199
+ runtimeContext: RuntimeContext;
103
200
  agentId: string;
104
201
  body: GetBody<'generate'> & {
105
202
  resourceid?: string;
203
+ runtimeContext?: Record<string, unknown>;
106
204
  };
107
- }): Promise<GenerateTextResult<any, any>>;
205
+ abortSignal?: AbortSignal;
206
+ }): Promise<GenerateTextResult<any, undefined>>;
108
207
 
109
- export declare function generateHandler_alias_1({ mastra, container, networkId, body, }: NetworkContext & {
110
- container: Container;
208
+ export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
209
+ runtimeContext: RuntimeContext;
111
210
  body: {
112
211
  messages?: Parameters<AgentNetwork['generate']>[0];
113
212
  } & Parameters<AgentNetwork['generate']>[1];
114
- }): Promise<GenerateObjectResult<any>>;
213
+ }): Promise<GenerateReturn<any, any, any>>;
115
214
 
116
215
  /**
117
216
  * Generate speech from text
@@ -121,21 +220,71 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
121
220
  text?: string;
122
221
  speakerId?: string;
123
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
+ };
124
232
  }): Promise<{
125
- audioData: Buffer<ArrayBuffer>;
233
+ task: string;
234
+ result: string;
235
+ resourceId: string;
236
+ resourceType: "none" | "tool" | "workflow" | "agent";
126
237
  }>;
127
238
 
128
- export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
239
+ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, isPlayground, }: Context & {
240
+ isPlayground?: boolean;
241
+ runtimeContext: RuntimeContext;
129
242
  agentId: string;
130
243
  }): Promise<{
131
244
  name: any;
132
245
  instructions: string;
133
246
  tools: any;
247
+ workflows: {};
134
248
  provider: string;
135
249
  modelId: string;
250
+ defaultGenerateOptions: any;
251
+ defaultStreamOptions: any;
136
252
  }>;
137
253
 
138
- export declare function getAgentsHandler({ mastra }: Context): Promise<any>;
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">>>;
139
288
 
140
289
  declare type GetBody<T extends keyof Agent & {
141
290
  [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
@@ -143,7 +292,8 @@ declare type GetBody<T extends keyof Agent & {
143
292
  messages: Parameters<Agent[T]>[0];
144
293
  } & Parameters<Agent[T]>[1];
145
294
 
146
- export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
295
+ export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
296
+ runtimeContext: RuntimeContext;
147
297
  agentId: string;
148
298
  }): Promise<{
149
299
  id: string;
@@ -152,7 +302,37 @@ export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context &
152
302
  evals: EvalRow[];
153
303
  }>;
154
304
 
155
- export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Context & {
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;
156
336
  agentId: string;
157
337
  }): Promise<{
158
338
  id: string;
@@ -161,24 +341,46 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Contex
161
341
  evals: EvalRow[];
162
342
  }>;
163
343
 
164
- export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<BaseLogMessage[] | undefined>;
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
+ }>;
165
351
 
166
- export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
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
+ }>;
167
359
 
168
360
  export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
169
361
  transports: string[];
170
362
  }>;
171
363
 
172
- export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryContext, 'mastra' | 'agentId'>): Promise<{
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<{
173
369
  result: boolean;
174
370
  }>;
175
371
 
176
- export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
372
+ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
373
+ limit?: number;
374
+ }): Promise<{
177
375
  messages: CoreMessage[];
178
- uiMessages: Message[];
376
+ uiMessages: UIMessageWithMetadata[];
179
377
  }>;
180
378
 
181
- export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<NetworkContext, 'mastra' | 'networkId'>): Promise<{
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<{
182
384
  id: string;
183
385
  name: string;
184
386
  instructions: string;
@@ -193,7 +395,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
193
395
  };
194
396
  }>;
195
397
 
196
- export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
398
+ export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
197
399
  id: string;
198
400
  name: string;
199
401
  instructions: string;
@@ -208,6 +410,50 @@ export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mas
208
410
  };
209
411
  }[]>;
210
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
+
211
457
  /**
212
458
  * Get available speakers for an agent
213
459
  */
@@ -215,34 +461,151 @@ export declare function getSpeakersHandler({ mastra, agentId }: VoiceContext): P
215
461
  voiceId: string;
216
462
  }[]>;
217
463
 
218
- export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<any[]>;
464
+ export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<Trace[]>;
219
465
 
220
- export declare function getThreadByIdHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<StorageThreadType>;
466
+ export declare function getThreadByIdHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType>;
221
467
 
222
- export declare function getThreadsHandler({ mastra, agentId, resourceId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId'>): Promise<StorageThreadType[]>;
468
+ export declare function getThreadsHandler({ mastra, agentId, resourceId, networkId, runtimeContext, orderBy, sortDirection, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId' | 'networkId' | 'runtimeContext'> & ThreadSortOptions): Promise<StorageThreadType[]>;
223
469
 
224
470
  export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext, 'tools' | 'toolId'>): Promise<any>;
225
471
 
226
472
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
227
473
 
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>;
474
+ export declare function getVNextNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
475
+ id: string;
233
476
  name: string;
234
- triggerSchema: string | undefined;
235
- steps: any;
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;
236
532
  }>;
237
533
 
238
- export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
534
+ export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
239
535
 
240
- export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext): Promise<WorkflowRuns>;
536
+ export declare function getWorkflowRunExecutionResultHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<WatchEvent['payload']['workflowState']>;
241
537
 
242
- export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
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
+ }>;
243
562
 
244
563
  export declare function handleError(error: unknown, defaultMessage: string): never;
245
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
+
246
609
  /**
247
610
  * `HTTPException` must be used when a fatal error such as authentication failure occurs.
248
611
  *
@@ -291,11 +654,13 @@ export declare class HTTPException extends Error {
291
654
  * @property res - Optional response object to use.
292
655
  * @property message - Optional custom error message.
293
656
  * @property cause - Optional cause of the error.
657
+ * @property stack - Optional stack trace for the error.
294
658
  */
295
659
  declare type HTTPExceptionOptions = {
296
660
  res?: Response;
297
661
  message?: string;
298
662
  cause?: unknown;
663
+ stack?: string;
299
664
  };
300
665
 
301
666
  /**
@@ -304,8 +669,46 @@ declare type HTTPExceptionOptions = {
304
669
  */
305
670
  declare type InfoStatusCode = 100 | 101 | 102 | 103;
306
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
+
307
700
  export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
308
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
+
309
712
  export declare namespace logs {
310
713
  export {
311
714
  getLogsHandler,
@@ -318,18 +721,97 @@ declare type LogsContext = {
318
721
  mastra: Mastra;
319
722
  transportId?: string;
320
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
+ };
321
732
  };
322
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
+
323
799
  export declare namespace memory {
324
800
  export {
325
801
  getMemoryStatusHandler,
802
+ getMemoryConfigHandler,
326
803
  getThreadsHandler,
327
804
  getThreadByIdHandler,
328
805
  saveMessagesHandler,
329
806
  createThreadHandler,
330
807
  updateThreadHandler,
331
808
  deleteThreadHandler,
332
- getMessagesHandler
809
+ getMessagesPaginatedHandler,
810
+ getMessagesHandler,
811
+ getWorkingMemoryHandler,
812
+ updateWorkingMemoryHandler,
813
+ deleteMessagesHandler,
814
+ searchMemoryHandler
333
815
  }
334
816
  }
335
817
 
@@ -337,6 +819,8 @@ declare interface MemoryContext extends Context {
337
819
  agentId?: string;
338
820
  resourceId?: string;
339
821
  threadId?: string;
822
+ networkId?: string;
823
+ runtimeContext?: RuntimeContext_2;
340
824
  }
341
825
 
342
826
  export declare namespace network {
@@ -350,8 +834,16 @@ export declare namespace network {
350
834
 
351
835
  declare interface NetworkContext extends Context {
352
836
  networkId?: string;
837
+ runtimeContext: RuntimeContext;
838
+ }
839
+
840
+ declare interface NetworkContext_2 extends Context {
841
+ networkId?: string;
842
+ runtimeContext: RuntimeContext;
353
843
  }
354
844
 
845
+ export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
846
+
355
847
  declare interface QueryRequest {
356
848
  indexName: string;
357
849
  queryVector: number[];
@@ -366,40 +858,133 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
366
858
 
367
859
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
368
860
 
369
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
861
+ export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
370
862
  body: {
371
863
  stepId: string;
372
864
  context: any;
373
865
  };
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>;
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>;
376
868
 
377
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
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 & {
378
878
  body: {
379
879
  stepId: string;
380
880
  context: any;
381
881
  };
382
- container: Container;
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;
383
893
  }): Promise<{
384
894
  message: string;
385
895
  }>;
386
896
 
387
- export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
897
+ export declare function saveMessagesHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
388
898
  body: {
389
899
  messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
390
900
  };
391
- }): Promise<MessageType[]>;
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
+ };
392
965
 
393
966
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
394
967
 
395
- export declare function startAsyncWorkflowHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
968
+ export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
396
969
  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>>;
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>>;
399
972
 
400
- export declare function startWorkflowRunHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
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'> & {
401
979
  triggerData?: unknown;
402
- container: Container;
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;
403
988
  }): Promise<{
404
989
  message: string;
405
990
  }>;
@@ -417,27 +1002,103 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
417
1002
  status: string;
418
1003
  message: string;
419
1004
  error: any;
1005
+ } | {
1006
+ status: string;
1007
+ message: string;
1008
+ traceCount?: undefined;
420
1009
  } | {
421
1010
  status: string;
422
1011
  message: string;
423
1012
  traceCount: number;
424
1013
  }>;
425
1014
 
426
- export declare function streamGenerateHandler({ mastra, container, agentId, body, }: Context & {
427
- container: Container;
1015
+ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
1016
+ runtimeContext: RuntimeContext;
428
1017
  agentId: string;
429
1018
  body: GetBody<'stream'> & {
430
1019
  resourceid?: string;
1020
+ runtimeContext?: string;
431
1021
  };
1022
+ abortSignal?: AbortSignal;
432
1023
  }): Promise<Response | undefined>;
433
1024
 
434
- export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, container, }: NetworkContext & {
435
- container: Container;
1025
+ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
1026
+ runtimeContext: RuntimeContext;
436
1027
  body: {
437
1028
  messages?: Parameters<AgentNetwork['stream']>[0];
438
1029
  } & Parameters<AgentNetwork['stream']>[1];
439
1030
  }): Promise<Response>;
440
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
+
441
1102
  declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
442
1103
 
443
1104
  export declare namespace telemetry {
@@ -454,6 +1115,8 @@ declare interface TelemetryContext extends Context {
454
1115
  page?: number;
455
1116
  perPage?: number;
456
1117
  attribute?: string | string[];
1118
+ fromDate?: Date;
1119
+ toDate?: Date;
457
1120
  };
458
1121
  }
459
1122
 
@@ -502,10 +1165,21 @@ export declare type UnOfficalStatusCode = UnofficialStatusCode;
502
1165
  */
503
1166
  export declare type UnofficialStatusCode = -1;
504
1167
 
505
- export declare function updateThreadHandler({ mastra, agentId, threadId, body, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
1168
+ export declare function updateThreadHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
506
1169
  body?: Parameters<MastraMemory['saveThread']>[0]['thread'];
507
1170
  }): Promise<StorageThreadType>;
508
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
+
509
1183
  declare interface UpsertRequest {
510
1184
  indexName: string;
511
1185
  vectors: number[][];
@@ -540,7 +1214,8 @@ export declare namespace voice {
540
1214
  export {
541
1215
  getSpeakersHandler,
542
1216
  generateSpeechHandler,
543
- transcribeSpeechHandler
1217
+ transcribeSpeechHandler,
1218
+ getListenerHandler
544
1219
  }
545
1220
  }
546
1221
 
@@ -548,25 +1223,37 @@ declare interface VoiceContext extends Context {
548
1223
  agentId?: string;
549
1224
  }
550
1225
 
551
- export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
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>>;
552
1229
 
553
1230
  declare interface WorkflowContext extends Context {
554
1231
  workflowId?: string;
555
1232
  runId?: string;
556
1233
  }
557
1234
 
1235
+ declare interface WorkflowContext_3 extends Context {
1236
+ workflowId?: string;
1237
+ runId?: string;
1238
+ }
1239
+
558
1240
  export declare namespace workflows {
559
1241
  export {
560
1242
  getWorkflowsHandler,
561
1243
  getWorkflowByIdHandler,
1244
+ getWorkflowRunByIdHandler,
1245
+ getWorkflowRunExecutionResultHandler,
1246
+ createWorkflowRunHandler,
562
1247
  startAsyncWorkflowHandler,
563
- getWorkflowRunHandler,
564
- createRunHandler,
565
1248
  startWorkflowRunHandler,
566
1249
  watchWorkflowHandler,
1250
+ streamWorkflowHandler,
1251
+ streamVNextWorkflowHandler,
567
1252
  resumeAsyncWorkflowHandler,
568
1253
  resumeWorkflowHandler,
569
- getWorkflowRunsHandler
1254
+ getWorkflowRunsHandler,
1255
+ cancelWorkflowRunHandler,
1256
+ sendWorkflowRunEventHandler
570
1257
  }
571
1258
  }
572
1259