@mastra/server 0.0.0-expose-more-playground-ui-20250502141824 → 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 (106) hide show
  1. package/LICENSE.md +11 -42
  2. package/README.md +48 -135
  3. package/dist/_tsup-dts-rollup.d.cts +715 -109
  4. package/dist/_tsup-dts-rollup.d.ts +715 -109
  5. package/dist/{chunk-FV45V6WC.cjs → chunk-2KZFMI6P.cjs} +1 -7
  6. package/dist/{chunk-5YGDYMRB.cjs → chunk-2SLFAFTR.cjs} +14 -13
  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-QJ3AHN64.js → chunk-CRCR3ZUK.js} +4 -3
  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-D3G23FP3.cjs → chunk-HRSAZUIK.cjs} +24 -22
  20. package/dist/chunk-I5JKUCGE.cjs +308 -0
  21. package/dist/{chunk-Q6SHQECN.js → chunk-KHZKYUNR.js} +34 -10
  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-Y3SV5XK4.js → chunk-VTTN2FW3.js} +136 -18
  36. package/dist/{chunk-5JNVY6DU.js → chunk-WBRFIHSF.js} +7 -5
  37. package/dist/{chunk-4JINXASC.js → chunk-WNVFNNWN.js} +5 -4
  38. package/dist/{chunk-M3YJLWTU.js → chunk-ZYAFP2AV.js} +68 -57
  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 +39 -29
  86. package/dist/server/handlers.d.cts +4 -2
  87. package/dist/server/handlers.d.ts +4 -2
  88. package/dist/server/handlers.js +12 -10
  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-4BIX6GMY.cjs +0 -189
  94. package/dist/chunk-55HTWX4C.cjs +0 -93
  95. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  96. package/dist/chunk-AELYAUEE.cjs +0 -316
  97. package/dist/chunk-EVCC233P.cjs +0 -321
  98. package/dist/chunk-JPB6RPGB.js +0 -304
  99. package/dist/chunk-OMN3UI6X.js +0 -5576
  100. package/dist/chunk-RBQASTUP.js +0 -203
  101. package/dist/chunk-SKBVVI24.cjs +0 -54
  102. package/dist/chunk-ZLBRQFDD.cjs +0 -13
  103. package/dist/server/handlers/vNextWorkflows.cjs +0 -46
  104. package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
  105. package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
  106. package/dist/server/handlers/vNextWorkflows.js +0 -1
@@ -1,35 +1,86 @@
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 { Artifact } from '@mastra/core/a2a';
5
+ import { BaseLogMessage } from '@mastra/core/logger';
4
6
  import { CoreMessage } from 'ai';
5
- import { EvalRow } from '@mastra/core/storage';
6
- import { GenerateObjectResult } from 'ai';
7
- 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';
8
20
  import type { Mastra } from '@mastra/core/mastra';
21
+ import type { MastraError } from '@mastra/core/error';
9
22
  import type { MastraMemory } from '@mastra/core/memory';
10
- import { Message } from 'ai';
11
- import { MessageType } from '@mastra/core/memory';
12
- import { NewStep } from '@mastra/core/workflows/vNext';
13
- import type { NewWorkflow } from '@mastra/core/workflows/vNext';
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';
14
30
  import type { QueryResult } from '@mastra/core/vector';
15
31
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
16
- import type { RuntimeContext } from '@mastra/core/runtime-context';
32
+ import { ReadableStream as ReadableStream_3 } from 'stream/web';
33
+ import { RuntimeContext } from '@mastra/core/runtime-context';
17
34
  import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
18
- import { SerializedStepFlowEntry } from '@mastra/core/workflows/vNext';
19
- import { Step } from '@mastra/core/workflows';
20
- import { StepExecutionContext } from '@mastra/core/workflows';
21
- import { StepGraph } from '@mastra/core/workflows';
22
- import { StorageThreadType } from '@mastra/core/memory';
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';
23
53
  import type { ToolAction } from '@mastra/core/tools';
54
+ import { Trace } from '@mastra/core';
55
+ import { UIMessageWithMetadata } from '@mastra/core/agent';
24
56
  import type { VercelTool } from '@mastra/core/tools';
57
+ import type { WatchEvent } from '@mastra/core/workflows';
25
58
  import type { Workflow } from '@mastra/core/workflows';
26
- import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
27
- import { WorkflowResult } from '@mastra/core/workflows/vNext';
28
- import { WorkflowRunResult } from '@mastra/core/workflows';
59
+ import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
60
+ import { WorkflowResult } from '@mastra/core';
29
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';
30
69
  import { ZodType } from 'zod';
70
+ import { ZodTypeAny } from 'zod';
31
71
  import { ZodTypeDef } from 'zod';
32
72
 
73
+ export declare namespace a2a {
74
+ export {
75
+ getAgentCardByIdHandler,
76
+ handleTaskSend,
77
+ handleTaskGet,
78
+ handleTaskSendSubscribe,
79
+ handleTaskCancel,
80
+ getAgentExecutionHandler
81
+ }
82
+ }
83
+
33
84
  export declare namespace agents {
34
85
  export {
35
86
  getAgentsHandler,
@@ -37,21 +88,32 @@ export declare namespace agents {
37
88
  getEvalsByAgentIdHandler,
38
89
  getLiveEvalsByAgentIdHandler,
39
90
  generateHandler,
40
- streamGenerateHandler
91
+ streamGenerateHandler,
92
+ streamVNextGenerateHandler
41
93
  }
42
94
  }
43
95
 
44
- export declare interface ApiError extends Error {
96
+ export declare interface ApiError extends MastraError {
45
97
  message: string;
46
98
  status?: number;
47
99
  }
48
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
+
49
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;
50
108
 
51
109
  export declare interface Context {
52
110
  mastra: Mastra;
53
111
  }
54
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
+
55
117
  export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
56
118
  index: CreateIndexRequest;
57
119
  }): Promise<{
@@ -64,17 +126,26 @@ declare interface CreateIndexRequest {
64
126
  metric?: 'cosine' | 'euclidean' | 'dotproduct';
65
127
  }
66
128
 
67
- 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<{
68
130
  runId: string;
69
131
  }>;
70
132
 
71
- 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'> & {
72
143
  body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
73
144
  resourceId?: string;
74
145
  };
75
146
  }): Promise<StorageThreadType>;
76
147
 
77
- export declare function createVNextWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
148
+ export declare function createWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
78
149
  runId: string;
79
150
  }>;
80
151
 
@@ -84,7 +155,22 @@ export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<Vec
84
155
  success: boolean;
85
156
  }>;
86
157
 
87
- 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<{
88
174
  result: string;
89
175
  }>;
90
176
 
@@ -101,28 +187,30 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
101
187
  export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
102
188
  agentId?: string;
103
189
  data: any;
104
- runtimeContext: RuntimeContext;
190
+ runtimeContext: RuntimeContext_2;
105
191
  }): Promise<any>;
106
192
 
107
193
  export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
108
194
  data?: unknown;
109
- runtimeContext: RuntimeContext;
195
+ runtimeContext: RuntimeContext_2;
110
196
  }) => Promise<any>;
111
197
 
112
- export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
198
+ export declare function generateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
113
199
  runtimeContext: RuntimeContext;
114
200
  agentId: string;
115
201
  body: GetBody<'generate'> & {
116
202
  resourceid?: string;
203
+ runtimeContext?: Record<string, unknown>;
117
204
  };
118
- }): Promise<GenerateTextResult<any, any>>;
205
+ abortSignal?: AbortSignal;
206
+ }): Promise<GenerateTextResult<any, undefined>>;
119
207
 
120
208
  export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
121
209
  runtimeContext: RuntimeContext;
122
210
  body: {
123
211
  messages?: Parameters<AgentNetwork['generate']>[0];
124
212
  } & Parameters<AgentNetwork['generate']>[1];
125
- }): Promise<GenerateObjectResult<any>>;
213
+ }): Promise<GenerateReturn<any, any, any>>;
126
214
 
127
215
  /**
128
216
  * Generate speech from text
@@ -134,21 +222,70 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
134
222
  };
135
223
  }): Promise<NodeJS.ReadableStream>;
136
224
 
137
- export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
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;
138
241
  runtimeContext: RuntimeContext;
139
242
  agentId: string;
140
243
  }): Promise<{
141
244
  name: any;
142
245
  instructions: string;
143
246
  tools: any;
247
+ workflows: {};
144
248
  provider: string;
145
249
  modelId: string;
250
+ defaultGenerateOptions: any;
251
+ defaultStreamOptions: any;
146
252
  }>;
147
253
 
148
- export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
254
+ export declare function getAgentCardByIdHandler({ mastra, agentId, executionUrl, provider, version, runtimeContext, }: Context & {
149
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;
150
273
  }): Promise<any>;
151
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
+
152
289
  declare type GetBody<T extends keyof Agent & {
153
290
  [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
154
291
  }[keyof Agent]> = {
@@ -165,6 +302,35 @@ export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agent
165
302
  evals: EvalRow[];
166
303
  }>;
167
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
+
168
334
  export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
169
335
  runtimeContext: RuntimeContext;
170
336
  agentId: string;
@@ -175,21 +341,43 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, a
175
341
  evals: EvalRow[];
176
342
  }>;
177
343
 
178
- 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
+ }>;
179
351
 
180
- 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
+ }>;
181
359
 
182
360
  export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
183
361
  transports: string[];
184
362
  }>;
185
363
 
186
- 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<{
187
369
  result: boolean;
188
370
  }>;
189
371
 
190
- 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<{
191
375
  messages: CoreMessage[];
192
- uiMessages: Message[];
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[];
193
381
  }>;
194
382
 
195
383
  export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
@@ -222,6 +410,50 @@ export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<Net
222
410
  };
223
411
  }[]>;
224
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
+
225
457
  /**
226
458
  * Get available speakers for an agent
227
459
  */
@@ -229,47 +461,150 @@ export declare function getSpeakersHandler({ mastra, agentId }: VoiceContext): P
229
461
  voiceId: string;
230
462
  }[]>;
231
463
 
232
- export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<any[]>;
464
+ export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<Trace[]>;
233
465
 
234
- 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>;
235
467
 
236
- 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[]>;
237
469
 
238
470
  export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext, 'tools' | 'toolId'>): Promise<any>;
239
471
 
240
472
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
241
473
 
242
- export declare function getVNextWorkflowByIdHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<{
243
- steps: any;
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>;
244
527
  name: string | undefined;
528
+ description: string | undefined;
245
529
  stepGraph: SerializedStepFlowEntry[];
246
530
  inputSchema: string | undefined;
247
531
  outputSchema: string | undefined;
248
532
  }>;
249
533
 
250
- export declare function getVNextWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<NewWorkflow['getWorkflowRun']>>;
534
+ export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
251
535
 
252
- export declare function getVNextWorkflowRunsHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<WorkflowRuns>;
536
+ export declare function getWorkflowRunExecutionResultHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<WatchEvent['payload']['workflowState']>;
253
537
 
254
- export declare function getVNextWorkflowsHandler({ mastra }: VNextWorkflowContext): 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>;
255
545
 
256
- export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
257
- stepGraph: StepGraph;
258
- stepSubscriberGraph: Record<string, StepGraph>;
259
- serializedStepGraph: StepGraph;
260
- serializedStepSubscriberGraph: Record<string, StepGraph>;
261
- name: string;
262
- triggerSchema: string | undefined;
263
- steps: any;
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;
264
561
  }>;
265
562
 
266
- export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
563
+ export declare function handleError(error: unknown, defaultMessage: string): never;
267
564
 
268
- export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext): Promise<WorkflowRuns>;
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>>;
269
572
 
270
- export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
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>>;
271
589
 
272
- export declare function handleError(error: unknown, defaultMessage: string): never;
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>;
273
608
 
274
609
  /**
275
610
  * `HTTPException` must be used when a fatal error such as authentication failure occurs.
@@ -319,11 +654,13 @@ export declare class HTTPException extends Error {
319
654
  * @property res - Optional response object to use.
320
655
  * @property message - Optional custom error message.
321
656
  * @property cause - Optional cause of the error.
657
+ * @property stack - Optional stack trace for the error.
322
658
  */
323
659
  declare type HTTPExceptionOptions = {
324
660
  res?: Response;
325
661
  message?: string;
326
662
  cause?: unknown;
663
+ stack?: string;
327
664
  };
328
665
 
329
666
  /**
@@ -332,8 +669,46 @@ declare type HTTPExceptionOptions = {
332
669
  */
333
670
  declare type InfoStatusCode = 100 | 101 | 102 | 103;
334
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
+
335
700
  export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
336
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
+
337
712
  export declare namespace logs {
338
713
  export {
339
714
  getLogsHandler,
@@ -346,18 +721,97 @@ declare type LogsContext = {
346
721
  mastra: Mastra;
347
722
  transportId?: string;
348
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
+ };
349
732
  };
350
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
+
351
799
  export declare namespace memory {
352
800
  export {
353
801
  getMemoryStatusHandler,
802
+ getMemoryConfigHandler,
354
803
  getThreadsHandler,
355
804
  getThreadByIdHandler,
356
805
  saveMessagesHandler,
357
806
  createThreadHandler,
358
807
  updateThreadHandler,
359
808
  deleteThreadHandler,
360
- getMessagesHandler
809
+ getMessagesPaginatedHandler,
810
+ getMessagesHandler,
811
+ getWorkingMemoryHandler,
812
+ updateWorkingMemoryHandler,
813
+ deleteMessagesHandler,
814
+ searchMemoryHandler
361
815
  }
362
816
  }
363
817
 
@@ -365,6 +819,8 @@ declare interface MemoryContext extends Context {
365
819
  agentId?: string;
366
820
  resourceId?: string;
367
821
  threadId?: string;
822
+ networkId?: string;
823
+ runtimeContext?: RuntimeContext_2;
368
824
  }
369
825
 
370
826
  export declare namespace network {
@@ -381,6 +837,13 @@ declare interface NetworkContext extends Context {
381
837
  runtimeContext: RuntimeContext;
382
838
  }
383
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
+
384
847
  declare interface QueryRequest {
385
848
  indexName: string;
386
849
  queryVector: number[];
@@ -395,23 +858,33 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
395
858
 
396
859
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
397
860
 
398
- export declare function resumeAsyncVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
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 & {
399
870
  body: {
400
871
  step: string | string[];
401
872
  resumeData?: unknown;
402
873
  };
403
874
  runtimeContext?: RuntimeContext_2;
404
- }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
875
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
405
876
 
406
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
877
+ export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
407
878
  body: {
408
879
  stepId: string;
409
880
  context: any;
410
881
  };
411
882
  runtimeContext: RuntimeContext;
412
- }): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
883
+ }): Promise<{
884
+ message: string;
885
+ }>;
413
886
 
414
- export declare function resumeVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
887
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
415
888
  body: {
416
889
  step: string | string[];
417
890
  resumeData?: unknown;
@@ -421,44 +894,97 @@ export declare function resumeVNextWorkflowHandler({ mastra, workflowId, runId,
421
894
  message: string;
422
895
  }>;
423
896
 
424
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
897
+ export declare function saveMessagesHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
425
898
  body: {
426
- stepId: string;
427
- context: any;
899
+ messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
428
900
  };
429
- runtimeContext: RuntimeContext;
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;
430
953
  }): Promise<{
431
954
  message: string;
432
955
  }>;
433
956
 
434
- export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
435
- body: {
436
- messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
437
- };
438
- }): Promise<MessageType[]>;
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
+ };
439
965
 
440
966
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
441
967
 
442
- export declare function startAsyncVNextWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
443
- inputData?: unknown;
444
- runtimeContext?: RuntimeContext_2;
445
- }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
446
-
447
- export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
968
+ export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
448
969
  triggerData?: unknown;
449
970
  runtimeContext: RuntimeContext;
450
- }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
971
+ }): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
451
972
 
452
- export declare function startVNextWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
973
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
453
974
  inputData?: unknown;
454
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;
455
981
  }): Promise<{
456
982
  message: string;
457
983
  }>;
458
984
 
459
- export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
460
- triggerData?: unknown;
461
- runtimeContext: RuntimeContext;
985
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
986
+ inputData?: unknown;
987
+ runtimeContext?: RuntimeContext_2;
462
988
  }): Promise<{
463
989
  message: string;
464
990
  }>;
@@ -476,18 +1002,24 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
476
1002
  status: string;
477
1003
  message: string;
478
1004
  error: any;
1005
+ } | {
1006
+ status: string;
1007
+ message: string;
1008
+ traceCount?: undefined;
479
1009
  } | {
480
1010
  status: string;
481
1011
  message: string;
482
1012
  traceCount: number;
483
1013
  }>;
484
1014
 
485
- export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
1015
+ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
486
1016
  runtimeContext: RuntimeContext;
487
1017
  agentId: string;
488
1018
  body: GetBody<'stream'> & {
489
1019
  resourceid?: string;
1020
+ runtimeContext?: string;
490
1021
  };
1022
+ abortSignal?: AbortSignal;
491
1023
  }): Promise<Response | undefined>;
492
1024
 
493
1025
  export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
@@ -497,6 +1029,76 @@ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body,
497
1029
  } & Parameters<AgentNetwork['stream']>[1];
498
1030
  }): Promise<Response>;
499
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
+
500
1102
  declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
501
1103
 
502
1104
  export declare namespace telemetry {
@@ -513,6 +1115,8 @@ declare interface TelemetryContext extends Context {
513
1115
  page?: number;
514
1116
  perPage?: number;
515
1117
  attribute?: string | string[];
1118
+ fromDate?: Date;
1119
+ toDate?: Date;
516
1120
  };
517
1121
  }
518
1122
 
@@ -561,10 +1165,21 @@ export declare type UnOfficalStatusCode = UnofficialStatusCode;
561
1165
  */
562
1166
  export declare type UnofficialStatusCode = -1;
563
1167
 
564
- 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'> & {
565
1169
  body?: Parameters<MastraMemory['saveThread']>[0]['thread'];
566
1170
  }): Promise<StorageThreadType>;
567
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
+
568
1183
  declare interface UpsertRequest {
569
1184
  indexName: string;
570
1185
  vectors: number[][];
@@ -595,31 +1210,12 @@ declare interface VectorContext extends Context {
595
1210
  vectorName?: string;
596
1211
  }
597
1212
 
598
- declare interface VNextWorkflowContext extends Context {
599
- workflowId?: string;
600
- runId?: string;
601
- }
602
-
603
- export declare namespace vNextWorkflows {
604
- export {
605
- getVNextWorkflowsHandler,
606
- getVNextWorkflowByIdHandler,
607
- getVNextWorkflowRunHandler,
608
- createVNextWorkflowRunHandler,
609
- startAsyncVNextWorkflowHandler,
610
- startVNextWorkflowRunHandler,
611
- watchVNextWorkflowHandler,
612
- resumeAsyncVNextWorkflowHandler,
613
- resumeVNextWorkflowHandler,
614
- getVNextWorkflowRunsHandler
615
- }
616
- }
617
-
618
1213
  export declare namespace voice {
619
1214
  export {
620
1215
  getSpeakersHandler,
621
1216
  generateSpeechHandler,
622
- transcribeSpeechHandler
1217
+ transcribeSpeechHandler,
1218
+ getListenerHandler
623
1219
  }
624
1220
  }
625
1221
 
@@ -627,27 +1223,37 @@ declare interface VoiceContext extends Context {
627
1223
  agentId?: string;
628
1224
  }
629
1225
 
630
- export declare function watchVNextWorkflowHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
1226
+ export declare function watchLegacyWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
631
1227
 
632
- export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
1228
+ export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
633
1229
 
634
1230
  declare interface WorkflowContext extends Context {
635
1231
  workflowId?: string;
636
1232
  runId?: string;
637
1233
  }
638
1234
 
1235
+ declare interface WorkflowContext_3 extends Context {
1236
+ workflowId?: string;
1237
+ runId?: string;
1238
+ }
1239
+
639
1240
  export declare namespace workflows {
640
1241
  export {
641
1242
  getWorkflowsHandler,
642
1243
  getWorkflowByIdHandler,
1244
+ getWorkflowRunByIdHandler,
1245
+ getWorkflowRunExecutionResultHandler,
1246
+ createWorkflowRunHandler,
643
1247
  startAsyncWorkflowHandler,
644
- getWorkflowRunHandler,
645
- createRunHandler,
646
1248
  startWorkflowRunHandler,
647
1249
  watchWorkflowHandler,
1250
+ streamWorkflowHandler,
1251
+ streamVNextWorkflowHandler,
648
1252
  resumeAsyncWorkflowHandler,
649
1253
  resumeWorkflowHandler,
650
- getWorkflowRunsHandler
1254
+ getWorkflowRunsHandler,
1255
+ cancelWorkflowRunHandler,
1256
+ sendWorkflowRunEventHandler
651
1257
  }
652
1258
  }
653
1259