@mastra/server 0.0.1-alpha.6 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/{LICENSE → LICENSE.md} +3 -1
  2. package/README.md +48 -135
  3. package/dist/_tsup-dts-rollup.d.cts +305 -52
  4. package/dist/_tsup-dts-rollup.d.ts +305 -52
  5. package/dist/{chunk-4JINXASC.js → chunk-55DOQLP6.js} +5 -4
  6. package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
  7. package/dist/chunk-5SN4U5AC.cjs +508 -0
  8. package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
  9. package/dist/chunk-6B4OMWT6.cjs +343 -0
  10. package/dist/chunk-75ZPJI57.cjs +9 -0
  11. package/dist/{chunk-VB7KH62D.cjs → chunk-7DLZLWJV.cjs} +16 -12
  12. package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
  13. package/dist/{chunk-2YONKUWB.js → chunk-C7564HUT.js} +58 -33
  14. package/dist/chunk-D4IRYCUI.cjs +235 -0
  15. package/dist/{chunk-RBQASTUP.js → chunk-DJJIUEL2.js} +13 -5
  16. package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
  17. package/dist/{chunk-3RVHWGWO.js → chunk-HFWCEP5S.js} +6 -12
  18. package/dist/chunk-LIVAK2DM.js +2001 -0
  19. package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
  20. package/dist/{chunk-CWSDZEZG.cjs → chunk-MHKNLNAN.cjs} +15 -12
  21. package/dist/chunk-MLKGABMK.js +7 -0
  22. package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
  23. package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
  24. package/dist/{chunk-DVPP5S6I.js → chunk-OR3CIE2H.js} +9 -6
  25. package/dist/chunk-P6SCPDYW.js +500 -0
  26. package/dist/chunk-QY36IPTP.js +331 -0
  27. package/dist/{chunk-YNSGUC2O.js → chunk-TJKLBTFB.js} +23 -7
  28. package/dist/chunk-VPNDC2DI.cjs +148 -0
  29. package/dist/{chunk-ILW7XYNJ.js → chunk-W7VCKPAD.js} +84 -60
  30. package/dist/{chunk-2JQC6JWP.js → chunk-WFBJJNCK.js} +10 -6
  31. package/dist/chunk-WUC6LSTW.js +227 -0
  32. package/dist/{chunk-2FJURXCL.cjs → chunk-Y7UWRW5X.cjs} +43 -35
  33. package/dist/{chunk-A7DF4ETD.cjs → chunk-YBVOQN4M.cjs} +22 -28
  34. package/dist/chunk-YIOVBYZH.cjs +332 -0
  35. package/dist/chunk-YWLUOY3D.cjs +2004 -0
  36. package/dist/{chunk-4C3EPMMF.cjs → chunk-ZE5AAC4I.cjs} +40 -24
  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 +9 -9
  52. package/dist/server/handlers/memory.js +1 -1
  53. package/dist/server/handlers/network.cjs +5 -5
  54. package/dist/server/handlers/network.js +1 -1
  55. package/dist/server/handlers/telemetry.cjs +3 -3
  56. package/dist/server/handlers/telemetry.js +1 -1
  57. package/dist/server/handlers/tools.cjs +5 -5
  58. package/dist/server/handlers/tools.js +1 -1
  59. package/dist/server/handlers/utils.cjs +2 -2
  60. package/dist/server/handlers/utils.js +1 -1
  61. package/dist/server/handlers/vector.cjs +7 -7
  62. package/dist/server/handlers/vector.js +1 -1
  63. package/dist/server/handlers/voice.cjs +4 -4
  64. package/dist/server/handlers/voice.js +1 -1
  65. package/dist/server/handlers/workflows.cjs +13 -13
  66. package/dist/server/handlers/workflows.d.cts +2 -2
  67. package/dist/server/handlers/workflows.d.ts +2 -2
  68. package/dist/server/handlers/workflows.js +1 -1
  69. package/dist/server/handlers.cjs +33 -23
  70. package/dist/server/handlers.d.cts +2 -0
  71. package/dist/server/handlers.d.ts +2 -0
  72. package/dist/server/handlers.js +11 -9
  73. package/package.json +9 -7
  74. package/dist/chunk-5JOF627H.cjs +0 -123
  75. package/dist/chunk-BMA2ORRT.js +0 -152
  76. package/dist/chunk-GV52BII2.cjs +0 -160
  77. package/dist/chunk-QH6XWSXP.cjs +0 -5579
  78. package/dist/chunk-VK6FX47H.js +0 -5576
  79. package/dist/chunk-X37I6GZT.cjs +0 -308
@@ -1,27 +1,60 @@
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 { BaseLogMessage } from '@mastra/core';
4
+ import type { Artifact } from '@mastra/core/a2a';
5
+ import type { BaseLogMessage } from '@mastra/core/logger';
4
6
  import { CoreMessage } from 'ai';
5
- import { EvalRow } from '@mastra/core';
7
+ import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
8
+ import { EvalRow } from '@mastra/core/storage';
6
9
  import { GenerateObjectResult } from 'ai';
7
10
  import { GenerateTextResult } from 'ai';
11
+ import type { IMastraLogger } from '@mastra/core/logger';
12
+ import type { JSONRPCError } from '@mastra/core/a2a';
13
+ import { JSONRPCResponse } from '@mastra/core/a2a';
14
+ import { LegacyStep } from '@mastra/core/workflows/legacy';
15
+ import type { LegacyWorkflow } from '@mastra/core/workflows/legacy';
16
+ import { LegacyWorkflowRunResult } from '@mastra/core/workflows/legacy';
17
+ import type { LegacyWorkflowRuns } from '@mastra/core/storage';
8
18
  import type { Mastra } from '@mastra/core/mastra';
9
- import type { Mastra as Mastra_2 } from '@mastra/core';
10
19
  import type { MastraMemory } from '@mastra/core/memory';
11
20
  import { Message } from 'ai';
12
- import { MessageType } from '@mastra/core';
21
+ import type { Message as Message_2 } from '@mastra/core/a2a';
22
+ import { MessageType } from '@mastra/core/memory';
13
23
  import type { QueryResult } from '@mastra/core/vector';
14
24
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
15
- import { Step } from '@mastra/core';
16
- import { StepExecutionContext } from '@mastra/core';
17
- import { StepGraph } from '@mastra/core';
18
- import { StorageThreadType } from '@mastra/core';
25
+ import { RuntimeContext } from '@mastra/core/runtime-context';
26
+ import { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
27
+ import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
28
+ import { Step } from '@mastra/core/workflows';
29
+ import { StepExecutionContext } from '@mastra/core/workflows/legacy';
30
+ import { StepGraph } from '@mastra/core/workflows/legacy';
31
+ import { StorageThreadType } from '@mastra/core/memory';
32
+ import { Task } from '@mastra/core/a2a';
33
+ import { TaskAndHistory } from '@mastra/core/a2a';
34
+ import type { TaskContext } from '@mastra/core/a2a';
35
+ import type { TaskIdParams } from '@mastra/core/a2a';
36
+ import type { TaskQueryParams } from '@mastra/core/a2a';
37
+ import type { TaskSendParams } from '@mastra/core/a2a';
38
+ import type { TaskStatus } from '@mastra/core/a2a';
19
39
  import type { ToolAction } from '@mastra/core/tools';
20
40
  import type { VercelTool } from '@mastra/core/tools';
21
41
  import type { Workflow } from '@mastra/core/workflows';
22
- import { WorkflowContext as WorkflowContext_2 } from '@mastra/core';
23
- import { WorkflowRunResult } from '@mastra/core';
24
- import { WorkflowRuns } from '@mastra/core';
42
+ import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
43
+ import { WorkflowResult } from '@mastra/core/workflows';
44
+ import type { WorkflowRuns } from '@mastra/core/storage';
45
+ import { ZodType } from 'zod';
46
+ import { ZodTypeDef } from 'zod';
47
+
48
+ export declare namespace a2a {
49
+ export {
50
+ getAgentCardByIdHandler,
51
+ handleTaskSend,
52
+ handleTaskGet,
53
+ handleTaskSendSubscribe,
54
+ handleTaskCancel,
55
+ getAgentExecutionHandler
56
+ }
57
+ }
25
58
 
26
59
  export declare namespace agents {
27
60
  export {
@@ -39,12 +72,18 @@ export declare interface ApiError extends Error {
39
72
  status?: number;
40
73
  }
41
74
 
75
+ export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
76
+
42
77
  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
78
 
44
79
  export declare interface Context {
45
80
  mastra: Mastra;
46
81
  }
47
82
 
83
+ export declare function convertToCoreMessage(message: Message_2): CoreMessage_2;
84
+
85
+ export declare function createErrorResponse(id: number | string | null, error: JSONRPCError<unknown>): JSONRPCResponse<null, unknown>;
86
+
48
87
  export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
49
88
  index: CreateIndexRequest;
50
89
  }): Promise<{
@@ -57,16 +96,29 @@ declare interface CreateIndexRequest {
57
96
  metric?: 'cosine' | 'euclidean' | 'dotproduct';
58
97
  }
59
98
 
60
- export declare function createRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
99
+ export declare function createLegacyWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
61
100
  runId: string;
62
101
  }>;
63
102
 
103
+ export declare function createSuccessResponse<T>(id: number | string | null, result: T): JSONRPCResponse<T>;
104
+
105
+ export declare function createTaskContext({ task, userMessage, history, activeCancellations, }: {
106
+ task: Task;
107
+ userMessage: Message_2;
108
+ history: Message_2[];
109
+ activeCancellations: Set<string>;
110
+ }): TaskContext;
111
+
64
112
  export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
65
113
  body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
66
114
  resourceId?: string;
67
115
  };
68
116
  }): Promise<StorageThreadType>;
69
117
 
118
+ export declare function createWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
119
+ runId: string;
120
+ }>;
121
+
70
122
  export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
71
123
  indexName?: string;
72
124
  }): Promise<{
@@ -87,23 +139,30 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
87
139
  metric: string | undefined;
88
140
  }>;
89
141
 
90
- export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
142
+ export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, runtimeContextFromRequest, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
91
143
  agentId?: string;
92
144
  data: any;
145
+ runtimeContext: RuntimeContext_2;
146
+ runtimeContextFromRequest: Record<string, unknown>;
93
147
  }): Promise<any>;
94
148
 
95
- export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
149
+ export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, runtimeContextFromRequest, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
96
150
  data?: unknown;
151
+ runtimeContext: RuntimeContext_2;
152
+ runtimeContextFromRequest: Record<string, unknown>;
97
153
  }) => Promise<any>;
98
154
 
99
- export declare function generateHandler({ mastra, agentId, body, }: Context & {
155
+ export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
156
+ runtimeContext: RuntimeContext;
100
157
  agentId: string;
101
158
  body: GetBody<'generate'> & {
102
159
  resourceid?: string;
160
+ runtimeContext?: Record<string, unknown>;
103
161
  };
104
162
  }): Promise<GenerateTextResult<any, any>>;
105
163
 
106
- export declare function generateHandler_alias_1({ mastra, networkId, body, }: NetworkContext & {
164
+ export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
165
+ runtimeContext: RuntimeContext;
107
166
  body: {
108
167
  messages?: Parameters<AgentNetwork['generate']>[0];
109
168
  } & Parameters<AgentNetwork['generate']>[1];
@@ -117,21 +176,44 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
117
176
  text?: string;
118
177
  speakerId?: string;
119
178
  };
120
- }): Promise<{
121
- audioData: Buffer<ArrayBuffer>;
122
- }>;
179
+ }): Promise<NodeJS.ReadableStream>;
123
180
 
124
- export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
181
+ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
182
+ runtimeContext: RuntimeContext;
125
183
  agentId: string;
126
184
  }): Promise<{
127
185
  name: any;
128
186
  instructions: string;
129
187
  tools: any;
188
+ workflows: {};
130
189
  provider: string;
131
190
  modelId: string;
132
191
  }>;
133
192
 
134
- export declare function getAgentsHandler({ mastra }: Context): Promise<any>;
193
+ export declare function getAgentCardByIdHandler({ mastra, agentId, executionUrl, provider, version, runtimeContext, }: Context & {
194
+ runtimeContext: RuntimeContext;
195
+ agentId: keyof ReturnType<typeof mastra.getAgents>;
196
+ executionUrl?: string;
197
+ version?: string;
198
+ provider?: {
199
+ organization: string;
200
+ url: string;
201
+ };
202
+ }): Promise<AgentCard>;
203
+
204
+ export declare function getAgentExecutionHandler({ requestId, mastra, agentId, runtimeContext, method, params, taskStore, logger, }: Context & {
205
+ requestId: string;
206
+ runtimeContext: RuntimeContext;
207
+ agentId: string;
208
+ method: 'tasks/send' | 'tasks/sendSubscribe' | 'tasks/get' | 'tasks/cancel';
209
+ params: TaskSendParams | TaskQueryParams | TaskIdParams;
210
+ taskStore?: InMemoryTaskStore;
211
+ logger?: IMastraLogger;
212
+ }): Promise<any>;
213
+
214
+ export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
215
+ runtimeContext: RuntimeContext;
216
+ }): Promise<any>;
135
217
 
136
218
  declare type GetBody<T extends keyof Agent & {
137
219
  [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
@@ -139,7 +221,8 @@ declare type GetBody<T extends keyof Agent & {
139
221
  messages: Parameters<Agent[T]>[0];
140
222
  } & Parameters<Agent[T]>[1];
141
223
 
142
- export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
224
+ export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
225
+ runtimeContext: RuntimeContext;
143
226
  agentId: string;
144
227
  }): Promise<{
145
228
  id: string;
@@ -148,7 +231,30 @@ export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context &
148
231
  evals: EvalRow[];
149
232
  }>;
150
233
 
151
- export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Context & {
234
+ export declare function getLegacyWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
235
+ stepGraph: StepGraph;
236
+ stepSubscriberGraph: Record<string, StepGraph>;
237
+ serializedStepGraph: StepGraph;
238
+ serializedStepSubscriberGraph: Record<string, StepGraph>;
239
+ name: string;
240
+ triggerSchema: string | undefined;
241
+ steps: any;
242
+ }>;
243
+
244
+ export declare function getLegacyWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<LegacyWorkflow['getRun']>>;
245
+
246
+ export declare function getLegacyWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
247
+ fromDate?: Date;
248
+ toDate?: Date;
249
+ limit?: number;
250
+ offset?: number;
251
+ resourceId?: string;
252
+ }): Promise<LegacyWorkflowRuns>;
253
+
254
+ export declare function getLegacyWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
255
+
256
+ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
257
+ runtimeContext: RuntimeContext;
152
258
  agentId: string;
153
259
  }): Promise<{
154
260
  id: string;
@@ -157,9 +263,9 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Contex
157
263
  evals: EvalRow[];
158
264
  }>;
159
265
 
160
- export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<BaseLogMessage[] | undefined>;
266
+ export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<any[]>;
161
267
 
162
- export declare function getLogsHandler({ mastra, transportId }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
268
+ export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
163
269
 
164
270
  export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
165
271
  transports: string[];
@@ -169,12 +275,14 @@ export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryC
169
275
  result: boolean;
170
276
  }>;
171
277
 
172
- export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
278
+ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
279
+ limit?: number;
280
+ }): Promise<{
173
281
  messages: CoreMessage[];
174
282
  uiMessages: Message[];
175
283
  }>;
176
284
 
177
- export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<NetworkContext, 'mastra' | 'networkId'>): Promise<{
285
+ export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
178
286
  id: string;
179
287
  name: string;
180
288
  instructions: string;
@@ -189,7 +297,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
189
297
  };
190
298
  }>;
191
299
 
192
- export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
300
+ export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
193
301
  id: string;
194
302
  name: string;
195
303
  instructions: string;
@@ -221,24 +329,71 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
221
329
 
222
330
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
223
331
 
224
- export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
225
- stepGraph: StepGraph;
226
- stepSubscriberGraph: Record<string, StepGraph>;
227
- serializedStepGraph: StepGraph;
228
- serializedStepSubscriberGraph: Record<string, StepGraph>;
229
- name: string;
230
- triggerSchema: string | undefined;
231
- steps: any;
332
+ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
333
+ steps: SerializedStep[];
334
+ name: string | undefined;
335
+ description: string | undefined;
336
+ stepGraph: SerializedStepFlowEntry[];
337
+ inputSchema: string | undefined;
338
+ outputSchema: string | undefined;
232
339
  }>;
233
340
 
234
- export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
341
+ export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
235
342
 
236
- export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext): Promise<WorkflowRuns>;
343
+ export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext_3 & {
344
+ fromDate?: Date;
345
+ toDate?: Date;
346
+ limit?: number;
347
+ offset?: number;
348
+ resourceId?: string;
349
+ }): Promise<WorkflowRuns>;
237
350
 
238
- export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
351
+ export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
239
352
 
240
353
  export declare function handleError(error: unknown, defaultMessage: string): never;
241
354
 
355
+ export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
356
+ requestId: string;
357
+ taskStore: InMemoryTaskStore;
358
+ agentId: string;
359
+ taskId: string;
360
+ logger?: IMastraLogger;
361
+ }): Promise<JSONRPCResponse<Task, unknown>>;
362
+
363
+ export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }: {
364
+ requestId: string;
365
+ taskStore: InMemoryTaskStore;
366
+ agentId: string;
367
+ taskId: string;
368
+ }): Promise<JSONRPCResponse<TaskAndHistory, unknown>>;
369
+
370
+ export declare function handleTaskSend({ requestId, params, taskStore, agent, logger, runtimeContext, }: {
371
+ requestId: string;
372
+ params: TaskSendParams;
373
+ taskStore: InMemoryTaskStore;
374
+ agent: Agent;
375
+ logger?: IMastraLogger;
376
+ runtimeContext: RuntimeContext;
377
+ }): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
378
+
379
+ export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, logger, runtimeContext, }: {
380
+ requestId: string;
381
+ params: TaskSendParams;
382
+ taskStore: InMemoryTaskStore;
383
+ agent: Agent;
384
+ logger?: IMastraLogger;
385
+ runtimeContext: RuntimeContext;
386
+ }): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
387
+ state: string;
388
+ message: {
389
+ role: string;
390
+ parts: {
391
+ type: string;
392
+ text: string;
393
+ }[];
394
+ };
395
+ }, unknown>, void, unknown>;
396
+
242
397
  /**
243
398
  * `HTTPException` must be used when a fatal error such as authentication failure occurs.
244
399
  *
@@ -300,8 +455,46 @@ declare type HTTPExceptionOptions = {
300
455
  */
301
456
  declare type InfoStatusCode = 100 | 101 | 102 | 103;
302
457
 
458
+ export declare class InMemoryTaskStore {
459
+ private store;
460
+ activeCancellations: Set<string>;
461
+ load({ agentId, taskId }: {
462
+ agentId: string;
463
+ taskId: string;
464
+ }): Promise<TaskAndHistory | null>;
465
+ save({ agentId, data }: {
466
+ agentId: string;
467
+ data: TaskAndHistory;
468
+ }): Promise<void>;
469
+ }
470
+
471
+ export declare namespace legacyWorkflows {
472
+ export {
473
+ getLegacyWorkflowsHandler,
474
+ getLegacyWorkflowByIdHandler,
475
+ startAsyncLegacyWorkflowHandler,
476
+ getLegacyWorkflowRunHandler,
477
+ createLegacyWorkflowRunHandler,
478
+ startLegacyWorkflowRunHandler,
479
+ watchLegacyWorkflowHandler,
480
+ resumeAsyncLegacyWorkflowHandler,
481
+ resumeLegacyWorkflowHandler,
482
+ getLegacyWorkflowRunsHandler
483
+ }
484
+ }
485
+
303
486
  export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
304
487
 
488
+ export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore, message, sessionId, metadata, logger, }: {
489
+ agentId: string;
490
+ taskId: string;
491
+ taskStore: InMemoryTaskStore;
492
+ message: Message_2;
493
+ sessionId?: string | null;
494
+ metadata?: Record<string, unknown> | null;
495
+ logger?: IMastraLogger;
496
+ }): Promise<TaskAndHistory>;
497
+
305
498
  export declare namespace logs {
306
499
  export {
307
500
  getLogsHandler,
@@ -346,8 +539,11 @@ export declare namespace network {
346
539
 
347
540
  declare interface NetworkContext extends Context {
348
541
  networkId?: string;
542
+ runtimeContext: RuntimeContext;
349
543
  }
350
544
 
545
+ export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
546
+
351
547
  declare interface QueryRequest {
352
548
  indexName: string;
353
549
  queryVector: number[];
@@ -362,18 +558,39 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
362
558
 
363
559
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
364
560
 
365
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, }: WorkflowContext & {
561
+ export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
366
562
  body: {
367
563
  stepId: string;
368
564
  context: any;
369
565
  };
370
- }): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
566
+ runtimeContext: RuntimeContext;
567
+ }): Promise<Omit<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
568
+
569
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, runtimeContextFromRequest, }: WorkflowContext_3 & {
570
+ body: {
571
+ step: string | string[];
572
+ resumeData?: unknown;
573
+ };
574
+ runtimeContext?: RuntimeContext_2;
575
+ runtimeContextFromRequest?: Record<string, unknown>;
576
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
371
577
 
372
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, }: WorkflowContext & {
578
+ export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
373
579
  body: {
374
580
  stepId: string;
375
581
  context: any;
376
582
  };
583
+ runtimeContext: RuntimeContext;
584
+ }): Promise<{
585
+ message: string;
586
+ }>;
587
+
588
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
589
+ body: {
590
+ step: string | string[];
591
+ resumeData?: unknown;
592
+ };
593
+ runtimeContext?: RuntimeContext_2;
377
594
  }): Promise<{
378
595
  message: string;
379
596
  }>;
@@ -384,14 +601,39 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
384
601
  };
385
602
  }): Promise<MessageType[]>;
386
603
 
604
+ declare type SerializedStep = {
605
+ id: string;
606
+ description: string;
607
+ inputSchema: string | undefined;
608
+ outputSchema: string | undefined;
609
+ resumeSchema: string | undefined;
610
+ suspendSchema: string | undefined;
611
+ };
612
+
387
613
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
388
614
 
389
- export declare function startAsyncWorkflowHandler({ mastra, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
615
+ export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
390
616
  triggerData?: unknown;
391
- }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
617
+ runtimeContext: RuntimeContext;
618
+ }): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
619
+
620
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
621
+ inputData?: unknown;
622
+ runtimeContext?: RuntimeContext_2;
623
+ runtimeContextFromRequest?: Record<string, unknown>;
624
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
392
625
 
393
- export declare function startWorkflowRunHandler({ mastra, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
626
+ export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
394
627
  triggerData?: unknown;
628
+ runtimeContext: RuntimeContext;
629
+ }): Promise<{
630
+ message: string;
631
+ }>;
632
+
633
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
634
+ inputData?: unknown;
635
+ runtimeContext?: RuntimeContext_2;
636
+ runtimeContextFromRequest?: Record<string, unknown>;
395
637
  }): Promise<{
396
638
  message: string;
397
639
  }>;
@@ -415,14 +657,17 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
415
657
  traceCount: number;
416
658
  }>;
417
659
 
418
- export declare function streamGenerateHandler({ mastra, agentId, body, }: Context & {
660
+ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
661
+ runtimeContext: RuntimeContext;
419
662
  agentId: string;
420
663
  body: GetBody<'stream'> & {
421
664
  resourceid?: string;
665
+ runtimeContext?: string;
422
666
  };
423
667
  }): Promise<Response | undefined>;
424
668
 
425
- export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, }: NetworkContext & {
669
+ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
670
+ runtimeContext: RuntimeContext;
426
671
  body: {
427
672
  messages?: Parameters<AgentNetwork['stream']>[0];
428
673
  } & Parameters<AgentNetwork['stream']>[1];
@@ -444,6 +689,8 @@ declare interface TelemetryContext extends Context {
444
689
  page?: number;
445
690
  perPage?: number;
446
691
  attribute?: string | string[];
692
+ fromDate?: Date;
693
+ toDate?: Date;
447
694
  };
448
695
  }
449
696
 
@@ -538,10 +785,16 @@ declare interface VoiceContext extends Context {
538
785
  agentId?: string;
539
786
  }
540
787
 
541
- export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
788
+ export declare function watchLegacyWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
789
+
790
+ export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
791
+
792
+ declare interface WorkflowContext extends Context {
793
+ workflowId?: string;
794
+ runId?: string;
795
+ }
542
796
 
543
- declare interface WorkflowContext {
544
- mastra: Mastra_2;
797
+ declare interface WorkflowContext_3 extends Context {
545
798
  workflowId?: string;
546
799
  runId?: string;
547
800
  }
@@ -550,9 +803,9 @@ export declare namespace workflows {
550
803
  export {
551
804
  getWorkflowsHandler,
552
805
  getWorkflowByIdHandler,
806
+ getWorkflowRunByIdHandler,
807
+ createWorkflowRunHandler,
553
808
  startAsyncWorkflowHandler,
554
- getWorkflowRunHandler,
555
- createRunHandler,
556
809
  startWorkflowRunHandler,
557
810
  watchWorkflowHandler,
558
811
  resumeAsyncWorkflowHandler,
@@ -1,5 +1,6 @@
1
- import { handleError } from './chunk-3AHQ5RGN.js';
2
- import { __export, HTTPException } from './chunk-TRDNDNGQ.js';
1
+ import { handleError } from './chunk-M5ABIP7D.js';
2
+ import { HTTPException } from './chunk-NYN7KFXL.js';
3
+ import { __export } from './chunk-MLKGABMK.js';
3
4
 
4
5
  // src/server/handlers/vector.ts
5
6
  var vector_exports = {};
@@ -90,7 +91,7 @@ async function describeIndex({
90
91
  throw new HTTPException(400, { message: "Index name is required" });
91
92
  }
92
93
  const vector = getVector(mastra, vectorName);
93
- const stats = await vector.describeIndex(indexName);
94
+ const stats = await vector.describeIndex({ indexName });
94
95
  return {
95
96
  dimension: stats.dimension,
96
97
  count: stats.count,
@@ -110,7 +111,7 @@ async function deleteIndex({
110
111
  throw new HTTPException(400, { message: "Index name is required" });
111
112
  }
112
113
  const vector = getVector(mastra, vectorName);
113
- await vector.deleteIndex(indexName);
114
+ await vector.deleteIndex({ indexName });
114
115
  return { success: true };
115
116
  } catch (error) {
116
117
  return handleError(error, "Error deleting index");
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkFV45V6WC_cjs = require('./chunk-FV45V6WC.cjs');
3
+ var chunkOCWPVYNI_cjs = require('./chunk-OCWPVYNI.cjs');
4
4
 
5
5
  // src/server/handlers/utils.ts
6
6
  function validateBody(body) {
@@ -11,7 +11,7 @@ function validateBody(body) {
11
11
  return acc;
12
12
  }, {});
13
13
  if (Object.keys(errorResponse).length > 0) {
14
- throw new chunkFV45V6WC_cjs.HTTPException(400, { message: Object.values(errorResponse)[0] });
14
+ throw new chunkOCWPVYNI_cjs.HTTPException(400, { message: Object.values(errorResponse)[0] });
15
15
  }
16
16
  }
17
17