@mastra/server 0.0.0-message-ordering-20250415215612 → 0.0.0-message-list-update-20250715150321

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 (93) hide show
  1. package/LICENSE.md +11 -42
  2. package/README.md +48 -135
  3. package/dist/_tsup-dts-rollup.d.cts +604 -70
  4. package/dist/_tsup-dts-rollup.d.ts +604 -70
  5. package/dist/{chunk-FV45V6WC.cjs → chunk-2KZFMI6P.cjs} +1 -7
  6. package/dist/chunk-2SLFAFTR.cjs +148 -0
  7. package/dist/chunk-3CNDE7QY.cjs +308 -0
  8. package/dist/chunk-4D66QEKC.js +81 -0
  9. package/dist/{chunk-OPP7H5TW.js → chunk-5PQQ42EZ.js} +83 -68
  10. package/dist/chunk-75ZPJI57.cjs +9 -0
  11. package/dist/{chunk-M56ECCHK.cjs → chunk-7TP2LX5L.cjs} +20 -19
  12. package/dist/chunk-B2PAS2IB.cjs +514 -0
  13. package/dist/chunk-BK4XT6EG.js +270 -0
  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-PDC4ZBQW.cjs → chunk-FRVBFMO2.cjs} +28 -26
  17. package/dist/{chunk-CWSDZEZG.cjs → chunk-G7KH752Y.cjs} +18 -12
  18. package/dist/chunk-GHC4YV6R.js +504 -0
  19. package/dist/chunk-H7DMHBKY.js +498 -0
  20. package/dist/chunk-JMLYCXMK.cjs +332 -0
  21. package/dist/{chunk-3RVHWGWO.js → chunk-KHZKYUNR.js} +36 -19
  22. package/dist/{chunk-RBQASTUP.js → chunk-KOHWJYJT.js} +120 -27
  23. package/dist/{chunk-TRDNDNGQ.js → chunk-LCM566I4.js} +2 -7
  24. package/dist/chunk-LF7P5PLR.js +14 -0
  25. package/dist/chunk-LI436ITD.cjs +2042 -0
  26. package/dist/{chunk-UV4WTEH4.js → chunk-LRCAAFUA.js} +11 -9
  27. package/dist/chunk-LZ3VJXSO.cjs +278 -0
  28. package/dist/chunk-MEGCYGBU.js +2039 -0
  29. package/dist/chunk-MLKGABMK.js +7 -0
  30. package/dist/chunk-PZQDCRPV.cjs +16 -0
  31. package/dist/chunk-QGX47B5D.cjs +86 -0
  32. package/dist/{chunk-DVPP5S6I.js → chunk-RG473F6Y.js} +14 -8
  33. package/dist/chunk-RHSWAXKB.cjs +118 -0
  34. package/dist/{chunk-L7XE5QTW.js → chunk-RSEO4XPX.js} +1 -1
  35. package/dist/chunk-SDPGVWQJ.cjs +512 -0
  36. package/dist/{chunk-4JINXASC.js → chunk-WNVFNNWN.js} +5 -4
  37. package/dist/server/handlers/a2a.cjs +30 -0
  38. package/dist/server/handlers/a2a.d.cts +6 -0
  39. package/dist/server/handlers/a2a.d.ts +6 -0
  40. package/dist/server/handlers/a2a.js +1 -0
  41. package/dist/server/handlers/agents.cjs +7 -7
  42. package/dist/server/handlers/agents.js +1 -1
  43. package/dist/server/handlers/error.cjs +2 -2
  44. package/dist/server/handlers/error.js +1 -1
  45. package/dist/server/handlers/legacyWorkflows.cjs +46 -0
  46. package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
  47. package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
  48. package/dist/server/handlers/legacyWorkflows.js +1 -0
  49. package/dist/server/handlers/logs.cjs +4 -4
  50. package/dist/server/handlers/logs.js +1 -1
  51. package/dist/server/handlers/memory.cjs +17 -9
  52. package/dist/server/handlers/memory.d.cts +2 -0
  53. package/dist/server/handlers/memory.d.ts +2 -0
  54. package/dist/server/handlers/memory.js +1 -1
  55. package/dist/server/handlers/network.cjs +5 -5
  56. package/dist/server/handlers/network.js +1 -1
  57. package/dist/server/handlers/telemetry.cjs +3 -3
  58. package/dist/server/handlers/telemetry.js +1 -1
  59. package/dist/server/handlers/tools.cjs +5 -5
  60. package/dist/server/handlers/tools.js +1 -1
  61. package/dist/server/handlers/utils.cjs +2 -2
  62. package/dist/server/handlers/utils.js +1 -1
  63. package/dist/server/handlers/vNextNetwork.cjs +218 -0
  64. package/dist/server/handlers/vNextNetwork.d.cts +6 -0
  65. package/dist/server/handlers/vNextNetwork.d.ts +6 -0
  66. package/dist/server/handlers/vNextNetwork.js +211 -0
  67. package/dist/server/handlers/vector.cjs +7 -7
  68. package/dist/server/handlers/vector.js +1 -1
  69. package/dist/server/handlers/voice.cjs +8 -4
  70. package/dist/server/handlers/voice.d.cts +1 -0
  71. package/dist/server/handlers/voice.d.ts +1 -0
  72. package/dist/server/handlers/voice.js +1 -1
  73. package/dist/server/handlers/workflows.cjs +29 -13
  74. package/dist/server/handlers/workflows.d.cts +6 -2
  75. package/dist/server/handlers/workflows.d.ts +6 -2
  76. package/dist/server/handlers/workflows.js +1 -1
  77. package/dist/server/handlers.cjs +33 -23
  78. package/dist/server/handlers.d.cts +2 -0
  79. package/dist/server/handlers.d.ts +2 -0
  80. package/dist/server/handlers.js +11 -9
  81. package/package.json +15 -14
  82. package/dist/chunk-2FJURXCL.cjs +0 -213
  83. package/dist/chunk-3AHQ5RGN.js +0 -11
  84. package/dist/chunk-3EJZQ6TQ.js +0 -49
  85. package/dist/chunk-67WTHYAV.js +0 -156
  86. package/dist/chunk-A7DF4ETD.cjs +0 -100
  87. package/dist/chunk-B64YROKU.cjs +0 -317
  88. package/dist/chunk-JLDXUWK7.cjs +0 -126
  89. package/dist/chunk-QH6XWSXP.cjs +0 -5579
  90. package/dist/chunk-SKBVVI24.cjs +0 -54
  91. package/dist/chunk-VK6FX47H.js +0 -5576
  92. package/dist/chunk-Z46X3YCB.cjs +0 -164
  93. package/dist/chunk-ZLBRQFDD.cjs +0 -13
@@ -1,27 +1,75 @@
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';
4
+ import type { Artifact } from '@mastra/core/a2a';
3
5
  import type { BaseLogMessage } from '@mastra/core/logger';
4
- import type { Container } from '@mastra/core/di';
5
6
  import { CoreMessage } from 'ai';
6
- import { EvalRow } from '@mastra/core/storage';
7
+ import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
8
+ import { DefaultEngineType } from '@mastra/core';
9
+ import { EvalRow } from '@mastra/core';
7
10
  import { GenerateObjectResult } from 'ai';
8
11
  import { GenerateTextResult } from 'ai';
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 type { Message } from '@mastra/core/a2a';
13
25
  import type { QueryResult } from '@mastra/core/vector';
14
26
  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';
27
+ import { ReadableStream as ReadableStream_3 } from 'stream/web';
28
+ import { RuntimeContext } from '@mastra/core/runtime-context';
29
+ import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
30
+ import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
31
+ import { Step } from '@mastra/core';
32
+ import { StepExecutionContext } from '@mastra/core/workflows/legacy';
33
+ import { StepGraph } from '@mastra/core/workflows/legacy';
34
+ import { StepResult } from '@mastra/core';
35
+ import { StorageThreadType } from '@mastra/core';
36
+ import { StreamEvent } from '@mastra/core';
37
+ import { Task } from '@mastra/core/a2a';
38
+ import { TaskAndHistory } from '@mastra/core/a2a';
39
+ import type { TaskContext } from '@mastra/core/a2a';
40
+ import type { TaskIdParams } from '@mastra/core/a2a';
41
+ import type { TaskQueryParams } from '@mastra/core/a2a';
42
+ import type { TaskSendParams } from '@mastra/core/a2a';
43
+ import type { TaskStatus } from '@mastra/core/a2a';
19
44
  import type { ToolAction } from '@mastra/core/tools';
45
+ import { UIMessage } from 'ai';
20
46
  import type { VercelTool } from '@mastra/core/tools';
47
+ import type { WatchEvent } from '@mastra/core/workflows';
21
48
  import type { Workflow } from '@mastra/core/workflows';
22
- import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
23
- import { WorkflowRunResult } from '@mastra/core/workflows';
49
+ import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
50
+ import { WorkflowResult } from '@mastra/core';
24
51
  import type { WorkflowRuns } from '@mastra/core/storage';
52
+ import { WorkingMemoryTemplate } from '@mastra/core';
53
+ import { ZodBoolean } from 'zod';
54
+ import { ZodEnum } from 'zod';
55
+ import { ZodNumber } from 'zod';
56
+ import { ZodObject } from 'zod';
57
+ import { ZodOptional } from 'zod';
58
+ import { ZodString } from 'zod';
59
+ import { ZodType } from 'zod';
60
+ import { ZodTypeAny } from 'zod';
61
+ import { ZodTypeDef } from 'zod';
62
+
63
+ export declare namespace a2a {
64
+ export {
65
+ getAgentCardByIdHandler,
66
+ handleTaskSend,
67
+ handleTaskGet,
68
+ handleTaskSendSubscribe,
69
+ handleTaskCancel,
70
+ getAgentExecutionHandler
71
+ }
72
+ }
25
73
 
26
74
  export declare namespace agents {
27
75
  export {
@@ -34,17 +82,27 @@ export declare namespace agents {
34
82
  }
35
83
  }
36
84
 
37
- export declare interface ApiError extends Error {
85
+ export declare interface ApiError extends MastraError {
38
86
  message: string;
39
87
  status?: number;
40
88
  }
41
89
 
90
+ export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
91
+
92
+ export declare function cancelWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
93
+ message: string;
94
+ }>;
95
+
42
96
  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
97
 
44
98
  export declare interface Context {
45
99
  mastra: Mastra;
46
100
  }
47
101
 
102
+ export declare function convertToCoreMessage(message: Message): CoreMessage_2;
103
+
104
+ export declare function createErrorResponse(id: number | string | null, error: JSONRPCError<unknown>): JSONRPCResponse<null, unknown>;
105
+
48
106
  export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
49
107
  index: CreateIndexRequest;
50
108
  }): Promise<{
@@ -57,23 +115,36 @@ declare interface CreateIndexRequest {
57
115
  metric?: 'cosine' | 'euclidean' | 'dotproduct';
58
116
  }
59
117
 
60
- export declare function createRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
118
+ export declare function createLegacyWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
61
119
  runId: string;
62
120
  }>;
63
121
 
64
- export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
122
+ export declare function createSuccessResponse<T>(id: number | string | null, result: T): JSONRPCResponse<T>;
123
+
124
+ export declare function createTaskContext({ task, userMessage, history, activeCancellations, }: {
125
+ task: Task;
126
+ userMessage: Message;
127
+ history: Message[];
128
+ activeCancellations: Set<string>;
129
+ }): TaskContext;
130
+
131
+ export declare function createThreadHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
65
132
  body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
66
133
  resourceId?: string;
67
134
  };
68
135
  }): Promise<StorageThreadType>;
69
136
 
137
+ export declare function createWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
138
+ runId: string;
139
+ }>;
140
+
70
141
  export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
71
142
  indexName?: string;
72
143
  }): Promise<{
73
144
  success: boolean;
74
145
  }>;
75
146
 
76
- export declare function deleteThreadHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
147
+ export declare function deleteThreadHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<{
77
148
  result: string;
78
149
  }>;
79
150
 
@@ -87,27 +158,29 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
87
158
  metric: string | undefined;
88
159
  }>;
89
160
 
90
- export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, container, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
161
+ export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
91
162
  agentId?: string;
92
163
  data: any;
93
- container: Container;
164
+ runtimeContext: RuntimeContext_2;
94
165
  }): Promise<any>;
95
166
 
96
- export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, container, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
167
+ export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
97
168
  data?: unknown;
98
- container: Container;
169
+ runtimeContext: RuntimeContext_2;
99
170
  }) => Promise<any>;
100
171
 
101
- export declare function generateHandler({ mastra, container, agentId, body, }: Context & {
102
- container: Container;
172
+ export declare function generateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
173
+ runtimeContext: RuntimeContext;
103
174
  agentId: string;
104
175
  body: GetBody<'generate'> & {
105
176
  resourceid?: string;
177
+ runtimeContext?: Record<string, unknown>;
106
178
  };
107
- }): Promise<GenerateTextResult<any, any>>;
179
+ abortSignal?: AbortSignal;
180
+ }): Promise<GenerateTextResult<any, unknown>>;
108
181
 
109
- export declare function generateHandler_alias_1({ mastra, container, networkId, body, }: NetworkContext & {
110
- container: Container;
182
+ export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
183
+ runtimeContext: RuntimeContext;
111
184
  body: {
112
185
  messages?: Parameters<AgentNetwork['generate']>[0];
113
186
  } & Parameters<AgentNetwork['generate']>[1];
@@ -121,21 +194,71 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
121
194
  text?: string;
122
195
  speakerId?: string;
123
196
  };
197
+ }): Promise<NodeJS.ReadableStream>;
198
+
199
+ export declare function generateVNextNetworkHandler({ mastra, runtimeContext, networkId, body, }: NetworkContext_2 & {
200
+ runtimeContext: RuntimeContext;
201
+ body: {
202
+ message: string;
203
+ threadId?: string;
204
+ resourceId?: string;
205
+ };
124
206
  }): Promise<{
125
- audioData: Buffer<ArrayBuffer>;
207
+ task: string;
208
+ result: string;
209
+ resourceId: string;
210
+ resourceType: "none" | "tool" | "workflow" | "agent";
126
211
  }>;
127
212
 
128
- export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
213
+ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, isPlayground, }: Context & {
214
+ isPlayground?: boolean;
215
+ runtimeContext: RuntimeContext;
129
216
  agentId: string;
130
217
  }): Promise<{
131
218
  name: any;
132
219
  instructions: string;
133
220
  tools: any;
221
+ workflows: {};
134
222
  provider: string;
135
223
  modelId: string;
224
+ defaultGenerateOptions: any;
225
+ defaultStreamOptions: any;
136
226
  }>;
137
227
 
138
- export declare function getAgentsHandler({ mastra }: Context): Promise<any>;
228
+ export declare function getAgentCardByIdHandler({ mastra, agentId, executionUrl, provider, version, runtimeContext, }: Context & {
229
+ runtimeContext: RuntimeContext;
230
+ agentId: keyof ReturnType<typeof mastra.getAgents>;
231
+ executionUrl?: string;
232
+ version?: string;
233
+ provider?: {
234
+ organization: string;
235
+ url: string;
236
+ };
237
+ }): Promise<AgentCard>;
238
+
239
+ export declare function getAgentExecutionHandler({ requestId, mastra, agentId, runtimeContext, method, params, taskStore, logger, }: Context & {
240
+ requestId: string;
241
+ runtimeContext: RuntimeContext;
242
+ agentId: string;
243
+ method: 'tasks/send' | 'tasks/sendSubscribe' | 'tasks/get' | 'tasks/cancel';
244
+ params: TaskSendParams | TaskQueryParams | TaskIdParams;
245
+ taskStore?: InMemoryTaskStore;
246
+ logger?: IMastraLogger;
247
+ }): Promise<any>;
248
+
249
+ export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
250
+ runtimeContext: RuntimeContext;
251
+ }): Promise<Record<string, Omit<{
252
+ id: string;
253
+ name: any;
254
+ instructions: string;
255
+ tools: any;
256
+ workflows: {};
257
+ provider: string;
258
+ modelId: string;
259
+ defaultGenerateOptions: any;
260
+ defaultStreamOptions: any;
261
+ }, "id">>>;
139
262
 
140
263
  declare type GetBody<T extends keyof Agent & {
141
264
  [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
@@ -143,7 +266,8 @@ declare type GetBody<T extends keyof Agent & {
143
266
  messages: Parameters<Agent[T]>[0];
144
267
  } & Parameters<Agent[T]>[1];
145
268
 
146
- export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
269
+ export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
270
+ runtimeContext: RuntimeContext;
147
271
  agentId: string;
148
272
  }): Promise<{
149
273
  id: string;
@@ -152,7 +276,37 @@ export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context &
152
276
  evals: EvalRow[];
153
277
  }>;
154
278
 
155
- export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Context & {
279
+ export declare function getLegacyWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
280
+ stepGraph: StepGraph;
281
+ stepSubscriberGraph: Record<string, StepGraph>;
282
+ serializedStepGraph: StepGraph;
283
+ serializedStepSubscriberGraph: Record<string, StepGraph>;
284
+ name: string;
285
+ triggerSchema: string | undefined;
286
+ steps: any;
287
+ }>;
288
+
289
+ export declare function getLegacyWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<LegacyWorkflow['getRun']>>;
290
+
291
+ export declare function getLegacyWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
292
+ fromDate?: Date;
293
+ toDate?: Date;
294
+ limit?: number;
295
+ offset?: number;
296
+ resourceId?: string;
297
+ }): Promise<LegacyWorkflowRuns>;
298
+
299
+ export declare function getLegacyWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
300
+
301
+ /**
302
+ * Get available listeners for an agent
303
+ */
304
+ export declare function getListenerHandler({ mastra, agentId }: VoiceContext): Promise<{
305
+ enabled: boolean;
306
+ }>;
307
+
308
+ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
309
+ runtimeContext: RuntimeContext;
156
310
  agentId: string;
157
311
  }): Promise<{
158
312
  id: string;
@@ -161,24 +315,38 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Contex
161
315
  evals: EvalRow[];
162
316
  }>;
163
317
 
164
- export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<BaseLogMessage[] | undefined>;
318
+ export declare function getLogsByRunIdHandler({ mastra, runId, transportId, params, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId' | 'params'>): Promise<{
319
+ logs: BaseLogMessage[];
320
+ total: number;
321
+ page: number;
322
+ perPage: number;
323
+ hasMore: boolean;
324
+ }>;
165
325
 
166
- export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
326
+ export declare function getLogsHandler({ mastra, transportId, params, }: Pick<LogsContext, 'mastra' | 'transportId' | 'params'>): Promise<{
327
+ logs: BaseLogMessage[];
328
+ total: number;
329
+ page: number;
330
+ perPage: number;
331
+ hasMore: boolean;
332
+ }>;
167
333
 
168
334
  export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
169
335
  transports: string[];
170
336
  }>;
171
337
 
172
- export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryContext, 'mastra' | 'agentId'>): Promise<{
338
+ export declare function getMemoryStatusHandler({ mastra, agentId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'>): Promise<{
173
339
  result: boolean;
174
340
  }>;
175
341
 
176
- export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
342
+ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
343
+ limit?: number;
344
+ }): Promise<{
177
345
  messages: CoreMessage[];
178
- uiMessages: Message[];
346
+ uiMessages: UIMessage[];
179
347
  }>;
180
348
 
181
- export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<NetworkContext, 'mastra' | 'networkId'>): Promise<{
349
+ export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
182
350
  id: string;
183
351
  name: string;
184
352
  instructions: string;
@@ -193,7 +361,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
193
361
  };
194
362
  }>;
195
363
 
196
- export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
364
+ export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
197
365
  id: string;
198
366
  name: string;
199
367
  instructions: string;
@@ -217,32 +385,149 @@ export declare function getSpeakersHandler({ mastra, agentId }: VoiceContext): P
217
385
 
218
386
  export declare function getTelemetryHandler({ mastra, body }: TelemetryContext): Promise<any[]>;
219
387
 
220
- export declare function getThreadByIdHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<StorageThreadType>;
388
+ export declare function getThreadByIdHandler({ mastra, agentId, threadId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType>;
221
389
 
222
- export declare function getThreadsHandler({ mastra, agentId, resourceId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId'>): Promise<StorageThreadType[]>;
390
+ export declare function getThreadsHandler({ mastra, agentId, resourceId, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'resourceId' | 'networkId' | 'runtimeContext'>): Promise<StorageThreadType[]>;
223
391
 
224
392
  export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext, 'tools' | 'toolId'>): Promise<any>;
225
393
 
226
394
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
227
395
 
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>;
396
+ export declare function getVNextNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
397
+ id: string;
233
398
  name: string;
234
- triggerSchema: string | undefined;
235
- steps: any;
399
+ instructions: string;
400
+ agents: {
401
+ name: string;
402
+ provider: string;
403
+ modelId: string;
404
+ }[];
405
+ workflows: {
406
+ name: string | undefined;
407
+ description: string | undefined;
408
+ inputSchema: string | undefined;
409
+ outputSchema: string | undefined;
410
+ }[];
411
+ tools: {
412
+ id: string;
413
+ description: string;
414
+ }[];
415
+ routingModel: {
416
+ provider: string;
417
+ modelId: string;
418
+ };
419
+ }>;
420
+
421
+ export declare function getVNextNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext_2, 'mastra' | 'runtimeContext'>): Promise<{
422
+ id: string;
423
+ name: string;
424
+ instructions: string;
425
+ tools: {
426
+ id: string;
427
+ description: string;
428
+ }[];
429
+ agents: {
430
+ name: string;
431
+ provider: string;
432
+ modelId: string;
433
+ }[];
434
+ workflows: {
435
+ name: string | undefined;
436
+ description: string | undefined;
437
+ inputSchema: string | undefined;
438
+ outputSchema: string | undefined;
439
+ }[];
440
+ routingModel: {
441
+ provider: string;
442
+ modelId: string;
443
+ };
444
+ }[]>;
445
+
446
+ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
447
+ steps: Record<string, SerializedStep>;
448
+ allSteps: Record<string, SerializedStep>;
449
+ name: string | undefined;
450
+ description: string | undefined;
451
+ stepGraph: SerializedStepFlowEntry[];
452
+ inputSchema: string | undefined;
453
+ outputSchema: string | undefined;
236
454
  }>;
237
455
 
238
- export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
456
+ export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
457
+
458
+ export declare function getWorkflowRunExecutionResultHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<WatchEvent['payload']['workflowState']>;
459
+
460
+ export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext_3 & {
461
+ fromDate?: Date;
462
+ toDate?: Date;
463
+ limit?: number;
464
+ offset?: number;
465
+ resourceId?: string;
466
+ }): Promise<WorkflowRuns>;
239
467
 
240
- export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext): Promise<WorkflowRuns>;
468
+ export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
241
469
 
242
- export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
470
+ /**
471
+ * Handler to get the working memory for a thread (optionally resource-scoped).
472
+ * @returns workingMemory - the working memory for the thread
473
+ * @returns source - thread or resource
474
+ */
475
+ export declare function getWorkingMemoryHandler({ mastra, agentId, threadId, resourceId, networkId, runtimeContext, memoryConfig, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
476
+ resourceId?: Parameters<MastraMemory['getWorkingMemory']>[0]['resourceId'];
477
+ memoryConfig?: Parameters<MastraMemory['getWorkingMemory']>[0]['memoryConfig'];
478
+ }): Promise<{
479
+ workingMemory: string | null;
480
+ source: string;
481
+ workingMemoryTemplate: WorkingMemoryTemplate | null;
482
+ threadExists: boolean;
483
+ }>;
243
484
 
244
485
  export declare function handleError(error: unknown, defaultMessage: string): never;
245
486
 
487
+ export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
488
+ requestId: string;
489
+ taskStore: InMemoryTaskStore;
490
+ agentId: string;
491
+ taskId: string;
492
+ logger?: IMastraLogger;
493
+ }): Promise<JSONRPCResponse<Task, unknown>>;
494
+
495
+ export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }: {
496
+ requestId: string;
497
+ taskStore: InMemoryTaskStore;
498
+ agentId: string;
499
+ taskId: string;
500
+ }): Promise<JSONRPCResponse<TaskAndHistory, unknown>>;
501
+
502
+ export declare function handleTaskSend({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
503
+ requestId: string;
504
+ params: TaskSendParams;
505
+ taskStore: InMemoryTaskStore;
506
+ agent: Agent;
507
+ agentId: string;
508
+ logger?: IMastraLogger;
509
+ runtimeContext: RuntimeContext;
510
+ }): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
511
+
512
+ export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
513
+ requestId: string;
514
+ params: TaskSendParams;
515
+ taskStore: InMemoryTaskStore;
516
+ agent: Agent;
517
+ agentId: string;
518
+ logger?: IMastraLogger;
519
+ runtimeContext: RuntimeContext;
520
+ }): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
521
+ state: string;
522
+ message: {
523
+ role: string;
524
+ parts: {
525
+ type: string;
526
+ text: string;
527
+ }[];
528
+ };
529
+ }, unknown>, void, unknown>;
530
+
246
531
  /**
247
532
  * `HTTPException` must be used when a fatal error such as authentication failure occurs.
248
533
  *
@@ -291,11 +576,13 @@ export declare class HTTPException extends Error {
291
576
  * @property res - Optional response object to use.
292
577
  * @property message - Optional custom error message.
293
578
  * @property cause - Optional cause of the error.
579
+ * @property stack - Optional stack trace for the error.
294
580
  */
295
581
  declare type HTTPExceptionOptions = {
296
582
  res?: Response;
297
583
  message?: string;
298
584
  cause?: unknown;
585
+ stack?: string;
299
586
  };
300
587
 
301
588
  /**
@@ -304,8 +591,46 @@ declare type HTTPExceptionOptions = {
304
591
  */
305
592
  declare type InfoStatusCode = 100 | 101 | 102 | 103;
306
593
 
594
+ export declare class InMemoryTaskStore {
595
+ private store;
596
+ activeCancellations: Set<string>;
597
+ load({ agentId, taskId }: {
598
+ agentId: string;
599
+ taskId: string;
600
+ }): Promise<TaskAndHistory | null>;
601
+ save({ agentId, data }: {
602
+ agentId: string;
603
+ data: TaskAndHistory;
604
+ }): Promise<void>;
605
+ }
606
+
607
+ export declare namespace legacyWorkflows {
608
+ export {
609
+ getLegacyWorkflowsHandler,
610
+ getLegacyWorkflowByIdHandler,
611
+ startAsyncLegacyWorkflowHandler,
612
+ getLegacyWorkflowRunHandler,
613
+ createLegacyWorkflowRunHandler,
614
+ startLegacyWorkflowRunHandler,
615
+ watchLegacyWorkflowHandler,
616
+ resumeAsyncLegacyWorkflowHandler,
617
+ resumeLegacyWorkflowHandler,
618
+ getLegacyWorkflowRunsHandler
619
+ }
620
+ }
621
+
307
622
  export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
308
623
 
624
+ export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore, message, sessionId, metadata, logger, }: {
625
+ agentId: string;
626
+ taskId: string;
627
+ taskStore: InMemoryTaskStore;
628
+ message: Message;
629
+ sessionId?: string | null;
630
+ metadata?: Record<string, unknown> | null;
631
+ logger?: IMastraLogger;
632
+ }): Promise<TaskAndHistory>;
633
+
309
634
  export declare namespace logs {
310
635
  export {
311
636
  getLogsHandler,
@@ -318,8 +643,72 @@ declare type LogsContext = {
318
643
  mastra: Mastra;
319
644
  transportId?: string;
320
645
  runId?: string;
646
+ params?: {
647
+ fromDate?: Date;
648
+ toDate?: Date;
649
+ logLevel?: LogLevel;
650
+ filters?: string | string[];
651
+ page?: number;
652
+ perPage?: number;
653
+ };
321
654
  };
322
655
 
656
+ export declare function loopStreamVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
657
+ runtimeContext: RuntimeContext;
658
+ body: {
659
+ message: string;
660
+ threadId?: string;
661
+ resourceId?: string;
662
+ maxIterations?: number;
663
+ };
664
+ }): Promise<{
665
+ stream: ReadableStream_3<StreamEvent>;
666
+ getWorkflowState: () => Promise<WorkflowResult<ZodObject< {
667
+ task: ZodString;
668
+ resourceId: ZodString;
669
+ resourceType: ZodEnum<["agent", "workflow", "none", "tool", "none"]>;
670
+ prompt: ZodString;
671
+ result: ZodString;
672
+ isComplete: ZodOptional<ZodBoolean>;
673
+ completionReason: ZodOptional<ZodString>;
674
+ iteration: ZodNumber;
675
+ }, "strip", ZodTypeAny, {
676
+ prompt: string;
677
+ resourceId: string;
678
+ result: string;
679
+ task: string;
680
+ resourceType: "none" | "tool" | "workflow" | "agent";
681
+ iteration: number;
682
+ isComplete?: boolean | undefined;
683
+ completionReason?: string | undefined;
684
+ }, {
685
+ prompt: string;
686
+ resourceId: string;
687
+ result: string;
688
+ task: string;
689
+ resourceType: "none" | "tool" | "workflow" | "agent";
690
+ iteration: number;
691
+ isComplete?: boolean | undefined;
692
+ completionReason?: string | undefined;
693
+ }>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
694
+ }>;
695
+
696
+ export declare function loopVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
697
+ runtimeContext: RuntimeContext;
698
+ body: {
699
+ message: string;
700
+ };
701
+ }): Promise<{
702
+ status: "success";
703
+ result: {
704
+ text: string;
705
+ iteration: number;
706
+ };
707
+ steps: {
708
+ [x: string]: StepResult<any, any, any, any> | StepResult<unknown, unknown, unknown, unknown>;
709
+ };
710
+ }>;
711
+
323
712
  export declare namespace memory {
324
713
  export {
325
714
  getMemoryStatusHandler,
@@ -329,7 +718,9 @@ export declare namespace memory {
329
718
  createThreadHandler,
330
719
  updateThreadHandler,
331
720
  deleteThreadHandler,
332
- getMessagesHandler
721
+ getMessagesHandler,
722
+ getWorkingMemoryHandler,
723
+ updateWorkingMemoryHandler
333
724
  }
334
725
  }
335
726
 
@@ -337,6 +728,8 @@ declare interface MemoryContext extends Context {
337
728
  agentId?: string;
338
729
  resourceId?: string;
339
730
  threadId?: string;
731
+ networkId?: string;
732
+ runtimeContext?: RuntimeContext_2;
340
733
  }
341
734
 
342
735
  export declare namespace network {
@@ -350,8 +743,16 @@ export declare namespace network {
350
743
 
351
744
  declare interface NetworkContext extends Context {
352
745
  networkId?: string;
746
+ runtimeContext: RuntimeContext;
353
747
  }
354
748
 
749
+ declare interface NetworkContext_2 extends Context {
750
+ networkId?: string;
751
+ runtimeContext: RuntimeContext;
752
+ }
753
+
754
+ export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
755
+
355
756
  declare interface QueryRequest {
356
757
  indexName: string;
357
758
  queryVector: number[];
@@ -366,40 +767,86 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
366
767
 
367
768
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
368
769
 
369
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
770
+ export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
370
771
  body: {
371
772
  stepId: string;
372
773
  context: any;
373
774
  };
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>;
775
+ runtimeContext: RuntimeContext;
776
+ }): 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
777
 
377
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, container, }: WorkflowContext & {
778
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
779
+ body: {
780
+ step: string | string[];
781
+ resumeData?: unknown;
782
+ };
783
+ runtimeContext?: RuntimeContext_2;
784
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
785
+
786
+ export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
378
787
  body: {
379
788
  stepId: string;
380
789
  context: any;
381
790
  };
382
- container: Container;
791
+ runtimeContext: RuntimeContext;
383
792
  }): Promise<{
384
793
  message: string;
385
794
  }>;
386
795
 
387
- export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
796
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
797
+ body: {
798
+ step: string | string[];
799
+ resumeData?: unknown;
800
+ };
801
+ runtimeContext?: RuntimeContext_2;
802
+ }): Promise<{
803
+ message: string;
804
+ }>;
805
+
806
+ export declare function saveMessagesHandler({ mastra, agentId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'networkId' | 'runtimeContext'> & {
388
807
  body: {
389
808
  messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
390
809
  };
391
- }): Promise<MessageType[]>;
810
+ }): Promise<MastraMessageV1[]>;
811
+
812
+ export declare function sendWorkflowRunEventHandler({ mastra, workflowId, runId, event, data, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
813
+ event: string;
814
+ data: unknown;
815
+ }): Promise<{
816
+ message: string;
817
+ }>;
818
+
819
+ declare type SerializedStep = {
820
+ id: string;
821
+ description: string;
822
+ inputSchema: string | undefined;
823
+ outputSchema: string | undefined;
824
+ resumeSchema: string | undefined;
825
+ suspendSchema: string | undefined;
826
+ };
392
827
 
393
828
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
394
829
 
395
- export declare function startAsyncWorkflowHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
830
+ export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
396
831
  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>>;
832
+ runtimeContext: RuntimeContext;
833
+ }): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
399
834
 
400
- export declare function startWorkflowRunHandler({ mastra, container, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
835
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
836
+ inputData?: unknown;
837
+ runtimeContext?: RuntimeContext_2;
838
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
839
+
840
+ export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
401
841
  triggerData?: unknown;
402
- container: Container;
842
+ runtimeContext: RuntimeContext;
843
+ }): Promise<{
844
+ message: string;
845
+ }>;
846
+
847
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
848
+ inputData?: unknown;
849
+ runtimeContext?: RuntimeContext_2;
403
850
  }): Promise<{
404
851
  message: string;
405
852
  }>;
@@ -417,27 +864,89 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
417
864
  status: string;
418
865
  message: string;
419
866
  error: any;
867
+ } | {
868
+ status: string;
869
+ message: string;
870
+ traceCount?: undefined;
420
871
  } | {
421
872
  status: string;
422
873
  message: string;
423
874
  traceCount: number;
424
875
  }>;
425
876
 
426
- export declare function streamGenerateHandler({ mastra, container, agentId, body, }: Context & {
427
- container: Container;
877
+ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, abortSignal, }: Context & {
878
+ runtimeContext: RuntimeContext;
428
879
  agentId: string;
429
880
  body: GetBody<'stream'> & {
430
881
  resourceid?: string;
882
+ runtimeContext?: string;
431
883
  };
884
+ abortSignal?: AbortSignal;
432
885
  }): Promise<Response | undefined>;
433
886
 
434
- export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, container, }: NetworkContext & {
435
- container: Container;
887
+ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
888
+ runtimeContext: RuntimeContext;
436
889
  body: {
437
890
  messages?: Parameters<AgentNetwork['stream']>[0];
438
891
  } & Parameters<AgentNetwork['stream']>[1];
439
892
  }): Promise<Response>;
440
893
 
894
+ export declare function streamGenerateVNextNetworkHandler({ mastra, networkId, body, runtimeContext, }: NetworkContext_2 & {
895
+ runtimeContext: RuntimeContext;
896
+ body: {
897
+ message: string;
898
+ threadId?: string;
899
+ resourceId?: string;
900
+ };
901
+ }): Promise<{
902
+ stream: ReadableStream_3<StreamEvent>;
903
+ getWorkflowState: () => Promise<WorkflowResult<ZodObject< {
904
+ task: ZodString;
905
+ resourceId: ZodString;
906
+ resourceType: ZodEnum<["agent", "workflow", "none", "tool", "none"]>;
907
+ prompt: ZodString;
908
+ result: ZodString;
909
+ isComplete: ZodOptional<ZodBoolean>;
910
+ completionReason: ZodOptional<ZodString>;
911
+ iteration: ZodNumber;
912
+ threadId: ZodOptional<ZodString>;
913
+ threadResourceId: ZodOptional<ZodString>;
914
+ isOneOff: ZodBoolean;
915
+ }, "strip", ZodTypeAny, {
916
+ prompt: string;
917
+ resourceId: string;
918
+ result: string;
919
+ task: string;
920
+ resourceType: "none" | "tool" | "workflow" | "agent";
921
+ iteration: number;
922
+ isOneOff: boolean;
923
+ threadId?: string | undefined;
924
+ threadResourceId?: string | undefined;
925
+ isComplete?: boolean | undefined;
926
+ completionReason?: string | undefined;
927
+ }, {
928
+ prompt: string;
929
+ resourceId: string;
930
+ result: string;
931
+ task: string;
932
+ resourceType: "none" | "tool" | "workflow" | "agent";
933
+ iteration: number;
934
+ isOneOff: boolean;
935
+ threadId?: string | undefined;
936
+ threadResourceId?: string | undefined;
937
+ isComplete?: boolean | undefined;
938
+ completionReason?: string | undefined;
939
+ }>, Step<string, any, any, any, any, DefaultEngineType>[]>>;
940
+ }>;
941
+
942
+ export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
943
+ inputData?: unknown;
944
+ runtimeContext?: RuntimeContext_2;
945
+ }): Promise<{
946
+ stream: ReadableStream_2<StreamEvent>;
947
+ getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any, any>[]>>;
948
+ }>;
949
+
441
950
  declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
442
951
 
443
952
  export declare namespace telemetry {
@@ -454,6 +963,8 @@ declare interface TelemetryContext extends Context {
454
963
  page?: number;
455
964
  perPage?: number;
456
965
  attribute?: string | string[];
966
+ fromDate?: Date;
967
+ toDate?: Date;
457
968
  };
458
969
  }
459
970
 
@@ -502,10 +1013,21 @@ export declare type UnOfficalStatusCode = UnofficialStatusCode;
502
1013
  */
503
1014
  export declare type UnofficialStatusCode = -1;
504
1015
 
505
- export declare function updateThreadHandler({ mastra, agentId, threadId, body, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
1016
+ export declare function updateThreadHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
506
1017
  body?: Parameters<MastraMemory['saveThread']>[0]['thread'];
507
1018
  }): Promise<StorageThreadType>;
508
1019
 
1020
+ /**
1021
+ * Handler to update the working memory for a thread (optionally resource-scoped).
1022
+ * @param threadId - the thread id
1023
+ * @param body - the body containing the working memory to update and the resource id (optional)
1024
+ */
1025
+ export declare function updateWorkingMemoryHandler({ mastra, agentId, threadId, body, networkId, runtimeContext, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId' | 'networkId' | 'runtimeContext'> & {
1026
+ body: Omit<Parameters<MastraMemory['updateWorkingMemory']>[0], 'threadId'>;
1027
+ }): Promise<{
1028
+ success: boolean;
1029
+ }>;
1030
+
509
1031
  declare interface UpsertRequest {
510
1032
  indexName: string;
511
1033
  vectors: number[][];
@@ -540,7 +1062,8 @@ export declare namespace voice {
540
1062
  export {
541
1063
  getSpeakersHandler,
542
1064
  generateSpeechHandler,
543
- transcribeSpeechHandler
1065
+ transcribeSpeechHandler,
1066
+ getListenerHandler
544
1067
  }
545
1068
  }
546
1069
 
@@ -548,25 +1071,36 @@ declare interface VoiceContext extends Context {
548
1071
  agentId?: string;
549
1072
  }
550
1073
 
551
- export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
1074
+ export declare function watchLegacyWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
1075
+
1076
+ export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
552
1077
 
553
1078
  declare interface WorkflowContext extends Context {
554
1079
  workflowId?: string;
555
1080
  runId?: string;
556
1081
  }
557
1082
 
1083
+ declare interface WorkflowContext_3 extends Context {
1084
+ workflowId?: string;
1085
+ runId?: string;
1086
+ }
1087
+
558
1088
  export declare namespace workflows {
559
1089
  export {
560
1090
  getWorkflowsHandler,
561
1091
  getWorkflowByIdHandler,
1092
+ getWorkflowRunByIdHandler,
1093
+ getWorkflowRunExecutionResultHandler,
1094
+ createWorkflowRunHandler,
562
1095
  startAsyncWorkflowHandler,
563
- getWorkflowRunHandler,
564
- createRunHandler,
565
1096
  startWorkflowRunHandler,
566
1097
  watchWorkflowHandler,
1098
+ streamWorkflowHandler,
567
1099
  resumeAsyncWorkflowHandler,
568
1100
  resumeWorkflowHandler,
569
- getWorkflowRunsHandler
1101
+ getWorkflowRunsHandler,
1102
+ cancelWorkflowRunHandler,
1103
+ sendWorkflowRunEventHandler
570
1104
  }
571
1105
  }
572
1106