@mastra/server 0.0.0-switch-to-core-20250424015131 → 0.0.0-taofeeqInngest-20250603090617

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/README.md +48 -135
  2. package/dist/_tsup-dts-rollup.d.cts +316 -43
  3. package/dist/_tsup-dts-rollup.d.ts +316 -43
  4. package/dist/{chunk-4JINXASC.js → chunk-55DOQLP6.js} +5 -4
  5. package/dist/{chunk-QN4KF3BH.cjs → chunk-57CJTIPW.cjs} +2 -2
  6. package/dist/{chunk-ZLBRQFDD.cjs → chunk-64U3UDTH.cjs} +2 -2
  7. package/dist/chunk-75ZPJI57.cjs +9 -0
  8. package/dist/chunk-A3KDUGS7.cjs +239 -0
  9. package/dist/{chunk-7IWQE76Z.cjs → chunk-B4MQFJ7G.cjs} +16 -10
  10. package/dist/{chunk-WTHDCRMY.js → chunk-BFOA2QQY.js} +12 -6
  11. package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
  12. package/dist/{chunk-RE6YL32K.js → chunk-C7564HUT.js} +52 -30
  13. package/dist/{chunk-55HTWX4C.cjs → chunk-CMMOIUFC.cjs} +40 -19
  14. package/dist/{chunk-Q6SHQECN.js → chunk-CP55EVBK.js} +24 -4
  15. package/dist/{chunk-RBQASTUP.js → chunk-DJJIUEL2.js} +13 -5
  16. package/dist/{chunk-3EJZQ6TQ.js → chunk-DQLE3DVM.js} +5 -5
  17. package/dist/chunk-GHC4YV6R.js +504 -0
  18. package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
  19. package/dist/chunk-J3PKLB3A.js +231 -0
  20. package/dist/chunk-KUNQFY2W.js +365 -0
  21. package/dist/chunk-LIVAK2DM.js +2001 -0
  22. package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
  23. package/dist/chunk-MLKGABMK.js +7 -0
  24. package/dist/chunk-MMO2HDM6.cjs +378 -0
  25. package/dist/{chunk-SKBVVI24.cjs → chunk-NEOOQUKW.cjs} +11 -11
  26. package/dist/{chunk-TRDNDNGQ.js → chunk-NYN7KFXL.js} +1 -7
  27. package/dist/{chunk-FV45V6WC.cjs → chunk-OCWPVYNI.cjs} +0 -7
  28. package/dist/chunk-SDPGVWQJ.cjs +512 -0
  29. package/dist/{chunk-5JNVY6DU.js → chunk-TJKLBTFB.js} +20 -8
  30. package/dist/{chunk-FPIWDH5Y.cjs → chunk-VPNDC2DI.cjs} +62 -40
  31. package/dist/{chunk-LFOBHRFO.js → chunk-W7VCKPAD.js} +68 -53
  32. package/dist/{chunk-2FJURXCL.cjs → chunk-Y7UWRW5X.cjs} +43 -35
  33. package/dist/chunk-YIOVBYZH.cjs +332 -0
  34. package/dist/chunk-YWLUOY3D.cjs +2004 -0
  35. package/dist/{chunk-D3G23FP3.cjs → chunk-ZE5AAC4I.cjs} +37 -25
  36. package/dist/server/handlers/a2a.cjs +30 -0
  37. package/dist/server/handlers/a2a.d.cts +6 -0
  38. package/dist/server/handlers/a2a.d.ts +6 -0
  39. package/dist/server/handlers/a2a.js +1 -0
  40. package/dist/server/handlers/agents.cjs +7 -7
  41. package/dist/server/handlers/agents.js +1 -1
  42. package/dist/server/handlers/error.cjs +2 -2
  43. package/dist/server/handlers/error.js +1 -1
  44. package/dist/server/handlers/legacyWorkflows.cjs +46 -0
  45. package/dist/server/handlers/legacyWorkflows.d.cts +10 -0
  46. package/dist/server/handlers/legacyWorkflows.d.ts +10 -0
  47. package/dist/server/handlers/legacyWorkflows.js +1 -0
  48. package/dist/server/handlers/logs.cjs +4 -4
  49. package/dist/server/handlers/logs.js +1 -1
  50. package/dist/server/handlers/memory.cjs +9 -9
  51. package/dist/server/handlers/memory.js +1 -1
  52. package/dist/server/handlers/network.cjs +5 -5
  53. package/dist/server/handlers/network.js +1 -1
  54. package/dist/server/handlers/telemetry.cjs +3 -3
  55. package/dist/server/handlers/telemetry.js +1 -1
  56. package/dist/server/handlers/tools.cjs +5 -5
  57. package/dist/server/handlers/tools.js +1 -1
  58. package/dist/server/handlers/utils.cjs +2 -2
  59. package/dist/server/handlers/utils.js +1 -1
  60. package/dist/server/handlers/vector.cjs +7 -7
  61. package/dist/server/handlers/vector.js +1 -1
  62. package/dist/server/handlers/voice.cjs +8 -4
  63. package/dist/server/handlers/voice.d.cts +1 -0
  64. package/dist/server/handlers/voice.d.ts +1 -0
  65. package/dist/server/handlers/voice.js +1 -1
  66. package/dist/server/handlers/workflows.cjs +17 -13
  67. package/dist/server/handlers/workflows.d.cts +3 -2
  68. package/dist/server/handlers/workflows.d.ts +3 -2
  69. package/dist/server/handlers/workflows.js +1 -1
  70. package/dist/server/handlers.cjs +33 -23
  71. package/dist/server/handlers.d.cts +2 -0
  72. package/dist/server/handlers.d.ts +2 -0
  73. package/dist/server/handlers.js +11 -9
  74. package/package.json +8 -6
  75. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  76. package/dist/chunk-HCOPJZ4A.cjs +0 -164
  77. package/dist/chunk-OMN3UI6X.js +0 -5576
  78. package/dist/chunk-R4J7XQYU.js +0 -156
  79. package/dist/chunk-TZK63M5N.cjs +0 -317
@@ -1,27 +1,61 @@
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
6
  import { CoreMessage } from 'ai';
7
+ import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
5
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
19
  import type { MastraMemory } from '@mastra/core/memory';
10
- import { Message } from 'ai';
11
- import { MessageType } from '@mastra/core/memory';
20
+ import { MastraMessageV1 } from '@mastra/core/memory';
21
+ import type { Message } from '@mastra/core/a2a';
12
22
  import type { QueryResult } from '@mastra/core/vector';
13
23
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
14
- import type { RuntimeContext } from '@mastra/core/runtime-context';
24
+ import { RuntimeContext } from '@mastra/core/runtime-context';
25
+ import { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
26
+ import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
15
27
  import { Step } from '@mastra/core/workflows';
16
- import { StepExecutionContext } from '@mastra/core/workflows';
17
- import { StepGraph } from '@mastra/core/workflows';
28
+ import { StepExecutionContext } from '@mastra/core/workflows/legacy';
29
+ import { StepGraph } from '@mastra/core/workflows/legacy';
18
30
  import { StorageThreadType } from '@mastra/core/memory';
31
+ import { Task } from '@mastra/core/a2a';
32
+ import { TaskAndHistory } from '@mastra/core/a2a';
33
+ import type { TaskContext } from '@mastra/core/a2a';
34
+ import type { TaskIdParams } from '@mastra/core/a2a';
35
+ import type { TaskQueryParams } from '@mastra/core/a2a';
36
+ import type { TaskSendParams } from '@mastra/core/a2a';
37
+ import type { TaskStatus } from '@mastra/core/a2a';
19
38
  import type { ToolAction } from '@mastra/core/tools';
39
+ import { UIMessage } from 'ai';
20
40
  import type { VercelTool } from '@mastra/core/tools';
41
+ import { WatchEvent } from '@mastra/core/workflows';
21
42
  import type { Workflow } from '@mastra/core/workflows';
22
- import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
23
- import { WorkflowRunResult } from '@mastra/core/workflows';
43
+ import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
44
+ import { WorkflowResult } from '@mastra/core/workflows';
24
45
  import type { WorkflowRuns } from '@mastra/core/storage';
46
+ import { ZodType } from 'zod';
47
+ import { ZodTypeDef } from 'zod';
48
+
49
+ export declare namespace a2a {
50
+ export {
51
+ getAgentCardByIdHandler,
52
+ handleTaskSend,
53
+ handleTaskGet,
54
+ handleTaskSendSubscribe,
55
+ handleTaskCancel,
56
+ getAgentExecutionHandler
57
+ }
58
+ }
25
59
 
26
60
  export declare namespace agents {
27
61
  export {
@@ -39,12 +73,18 @@ export declare interface ApiError extends Error {
39
73
  status?: number;
40
74
  }
41
75
 
76
+ export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
77
+
42
78
  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
79
 
44
80
  export declare interface Context {
45
81
  mastra: Mastra;
46
82
  }
47
83
 
84
+ export declare function convertToCoreMessage(message: Message): CoreMessage_2;
85
+
86
+ export declare function createErrorResponse(id: number | string | null, error: JSONRPCError<unknown>): JSONRPCResponse<null, unknown>;
87
+
48
88
  export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
49
89
  index: CreateIndexRequest;
50
90
  }): Promise<{
@@ -57,16 +97,29 @@ declare interface CreateIndexRequest {
57
97
  metric?: 'cosine' | 'euclidean' | 'dotproduct';
58
98
  }
59
99
 
60
- export declare function createRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
100
+ export declare function createLegacyWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
61
101
  runId: string;
62
102
  }>;
63
103
 
104
+ export declare function createSuccessResponse<T>(id: number | string | null, result: T): JSONRPCResponse<T>;
105
+
106
+ export declare function createTaskContext({ task, userMessage, history, activeCancellations, }: {
107
+ task: Task;
108
+ userMessage: Message;
109
+ history: Message[];
110
+ activeCancellations: Set<string>;
111
+ }): TaskContext;
112
+
64
113
  export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
65
114
  body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
66
115
  resourceId?: string;
67
116
  };
68
117
  }): Promise<StorageThreadType>;
69
118
 
119
+ export declare function createWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
120
+ runId: string;
121
+ }>;
122
+
70
123
  export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
71
124
  indexName?: string;
72
125
  }): Promise<{
@@ -87,15 +140,17 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
87
140
  metric: string | undefined;
88
141
  }>;
89
142
 
90
- export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
143
+ export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, runtimeContextFromRequest, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
91
144
  agentId?: string;
92
145
  data: any;
93
- runtimeContext: RuntimeContext;
146
+ runtimeContext: RuntimeContext_2;
147
+ runtimeContextFromRequest: Record<string, unknown>;
94
148
  }): Promise<any>;
95
149
 
96
- export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
150
+ export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, runtimeContextFromRequest, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
97
151
  data?: unknown;
98
- runtimeContext: RuntimeContext;
152
+ runtimeContext: RuntimeContext_2;
153
+ runtimeContextFromRequest: Record<string, unknown>;
99
154
  }) => Promise<any>;
100
155
 
101
156
  export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
@@ -103,6 +158,7 @@ export declare function generateHandler({ mastra, runtimeContext, agentId, body,
103
158
  agentId: string;
104
159
  body: GetBody<'generate'> & {
105
160
  resourceid?: string;
161
+ runtimeContext?: Record<string, unknown>;
106
162
  };
107
163
  }): Promise<GenerateTextResult<any, any>>;
108
164
 
@@ -123,17 +179,44 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
123
179
  };
124
180
  }): Promise<NodeJS.ReadableStream>;
125
181
 
126
- export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
182
+ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
183
+ runtimeContext: RuntimeContext;
127
184
  agentId: string;
128
185
  }): Promise<{
129
186
  name: any;
130
187
  instructions: string;
131
188
  tools: any;
189
+ workflows: {};
132
190
  provider: string;
133
191
  modelId: string;
192
+ defaultGenerateOptions: any;
193
+ defaultStreamOptions: any;
134
194
  }>;
135
195
 
136
- export declare function getAgentsHandler({ mastra }: Context): Promise<any>;
196
+ export declare function getAgentCardByIdHandler({ mastra, agentId, executionUrl, provider, version, runtimeContext, }: Context & {
197
+ runtimeContext: RuntimeContext;
198
+ agentId: keyof ReturnType<typeof mastra.getAgents>;
199
+ executionUrl?: string;
200
+ version?: string;
201
+ provider?: {
202
+ organization: string;
203
+ url: string;
204
+ };
205
+ }): Promise<AgentCard>;
206
+
207
+ export declare function getAgentExecutionHandler({ requestId, mastra, agentId, runtimeContext, method, params, taskStore, logger, }: Context & {
208
+ requestId: string;
209
+ runtimeContext: RuntimeContext;
210
+ agentId: string;
211
+ method: 'tasks/send' | 'tasks/sendSubscribe' | 'tasks/get' | 'tasks/cancel';
212
+ params: TaskSendParams | TaskQueryParams | TaskIdParams;
213
+ taskStore?: InMemoryTaskStore;
214
+ logger?: IMastraLogger;
215
+ }): Promise<any>;
216
+
217
+ export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
218
+ runtimeContext: RuntimeContext;
219
+ }): Promise<any>;
137
220
 
138
221
  declare type GetBody<T extends keyof Agent & {
139
222
  [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
@@ -141,7 +224,8 @@ declare type GetBody<T extends keyof Agent & {
141
224
  messages: Parameters<Agent[T]>[0];
142
225
  } & Parameters<Agent[T]>[1];
143
226
 
144
- export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
227
+ export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
228
+ runtimeContext: RuntimeContext;
145
229
  agentId: string;
146
230
  }): Promise<{
147
231
  id: string;
@@ -150,7 +234,37 @@ export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context &
150
234
  evals: EvalRow[];
151
235
  }>;
152
236
 
153
- export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Context & {
237
+ export declare function getLegacyWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
238
+ stepGraph: StepGraph;
239
+ stepSubscriberGraph: Record<string, StepGraph>;
240
+ serializedStepGraph: StepGraph;
241
+ serializedStepSubscriberGraph: Record<string, StepGraph>;
242
+ name: string;
243
+ triggerSchema: string | undefined;
244
+ steps: any;
245
+ }>;
246
+
247
+ export declare function getLegacyWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<LegacyWorkflow['getRun']>>;
248
+
249
+ export declare function getLegacyWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
250
+ fromDate?: Date;
251
+ toDate?: Date;
252
+ limit?: number;
253
+ offset?: number;
254
+ resourceId?: string;
255
+ }): Promise<LegacyWorkflowRuns>;
256
+
257
+ export declare function getLegacyWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
258
+
259
+ /**
260
+ * Get available listeners for an agent
261
+ */
262
+ export declare function getListenerHandler({ mastra, agentId }: VoiceContext): Promise<{
263
+ enabled: boolean;
264
+ }>;
265
+
266
+ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
267
+ runtimeContext: RuntimeContext;
154
268
  agentId: string;
155
269
  }): Promise<{
156
270
  id: string;
@@ -159,7 +273,7 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Contex
159
273
  evals: EvalRow[];
160
274
  }>;
161
275
 
162
- export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<BaseLogMessage[] | undefined>;
276
+ export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<any[]>;
163
277
 
164
278
  export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
165
279
 
@@ -171,12 +285,14 @@ export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryC
171
285
  result: boolean;
172
286
  }>;
173
287
 
174
- export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
288
+ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
289
+ limit?: number;
290
+ }): Promise<{
175
291
  messages: CoreMessage[];
176
- uiMessages: Message[];
292
+ uiMessages: UIMessage[];
177
293
  }>;
178
294
 
179
- export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<NetworkContext, 'mastra' | 'networkId'>): Promise<{
295
+ export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
180
296
  id: string;
181
297
  name: string;
182
298
  instructions: string;
@@ -191,7 +307,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
191
307
  };
192
308
  }>;
193
309
 
194
- export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
310
+ export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
195
311
  id: string;
196
312
  name: string;
197
313
  instructions: string;
@@ -223,24 +339,73 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
223
339
 
224
340
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
225
341
 
226
- export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
227
- stepGraph: StepGraph;
228
- stepSubscriberGraph: Record<string, StepGraph>;
229
- serializedStepGraph: StepGraph;
230
- serializedStepSubscriberGraph: Record<string, StepGraph>;
231
- name: string;
232
- triggerSchema: string | undefined;
233
- steps: any;
342
+ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
343
+ steps: SerializedStep[];
344
+ name: string | undefined;
345
+ description: string | undefined;
346
+ stepGraph: SerializedStepFlowEntry[];
347
+ inputSchema: string | undefined;
348
+ outputSchema: string | undefined;
234
349
  }>;
235
350
 
236
- export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
351
+ export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
237
352
 
238
- export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext): Promise<WorkflowRuns>;
353
+ export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext_3 & {
354
+ fromDate?: Date;
355
+ toDate?: Date;
356
+ limit?: number;
357
+ offset?: number;
358
+ resourceId?: string;
359
+ }): Promise<WorkflowRuns>;
239
360
 
240
- export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
361
+ export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
241
362
 
242
363
  export declare function handleError(error: unknown, defaultMessage: string): never;
243
364
 
365
+ export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
366
+ requestId: string;
367
+ taskStore: InMemoryTaskStore;
368
+ agentId: string;
369
+ taskId: string;
370
+ logger?: IMastraLogger;
371
+ }): Promise<JSONRPCResponse<Task, unknown>>;
372
+
373
+ export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }: {
374
+ requestId: string;
375
+ taskStore: InMemoryTaskStore;
376
+ agentId: string;
377
+ taskId: string;
378
+ }): Promise<JSONRPCResponse<TaskAndHistory, unknown>>;
379
+
380
+ export declare function handleTaskSend({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
381
+ requestId: string;
382
+ params: TaskSendParams;
383
+ taskStore: InMemoryTaskStore;
384
+ agent: Agent;
385
+ agentId: string;
386
+ logger?: IMastraLogger;
387
+ runtimeContext: RuntimeContext;
388
+ }): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
389
+
390
+ export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
391
+ requestId: string;
392
+ params: TaskSendParams;
393
+ taskStore: InMemoryTaskStore;
394
+ agent: Agent;
395
+ agentId: string;
396
+ logger?: IMastraLogger;
397
+ runtimeContext: RuntimeContext;
398
+ }): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
399
+ state: string;
400
+ message: {
401
+ role: string;
402
+ parts: {
403
+ type: string;
404
+ text: string;
405
+ }[];
406
+ };
407
+ }, unknown>, void, unknown>;
408
+
244
409
  /**
245
410
  * `HTTPException` must be used when a fatal error such as authentication failure occurs.
246
411
  *
@@ -302,8 +467,46 @@ declare type HTTPExceptionOptions = {
302
467
  */
303
468
  declare type InfoStatusCode = 100 | 101 | 102 | 103;
304
469
 
470
+ export declare class InMemoryTaskStore {
471
+ private store;
472
+ activeCancellations: Set<string>;
473
+ load({ agentId, taskId }: {
474
+ agentId: string;
475
+ taskId: string;
476
+ }): Promise<TaskAndHistory | null>;
477
+ save({ agentId, data }: {
478
+ agentId: string;
479
+ data: TaskAndHistory;
480
+ }): Promise<void>;
481
+ }
482
+
483
+ export declare namespace legacyWorkflows {
484
+ export {
485
+ getLegacyWorkflowsHandler,
486
+ getLegacyWorkflowByIdHandler,
487
+ startAsyncLegacyWorkflowHandler,
488
+ getLegacyWorkflowRunHandler,
489
+ createLegacyWorkflowRunHandler,
490
+ startLegacyWorkflowRunHandler,
491
+ watchLegacyWorkflowHandler,
492
+ resumeAsyncLegacyWorkflowHandler,
493
+ resumeLegacyWorkflowHandler,
494
+ getLegacyWorkflowRunsHandler
495
+ }
496
+ }
497
+
305
498
  export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
306
499
 
500
+ export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore, message, sessionId, metadata, logger, }: {
501
+ agentId: string;
502
+ taskId: string;
503
+ taskStore: InMemoryTaskStore;
504
+ message: Message;
505
+ sessionId?: string | null;
506
+ metadata?: Record<string, unknown> | null;
507
+ logger?: IMastraLogger;
508
+ }): Promise<TaskAndHistory>;
509
+
307
510
  export declare namespace logs {
308
511
  export {
309
512
  getLogsHandler,
@@ -348,8 +551,11 @@ export declare namespace network {
348
551
 
349
552
  declare interface NetworkContext extends Context {
350
553
  networkId?: string;
554
+ runtimeContext: RuntimeContext;
351
555
  }
352
556
 
557
+ export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
558
+
353
559
  declare interface QueryRequest {
354
560
  indexName: string;
355
561
  queryVector: number[];
@@ -364,15 +570,24 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
364
570
 
365
571
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
366
572
 
367
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
573
+ export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
368
574
  body: {
369
575
  stepId: string;
370
576
  context: any;
371
577
  };
372
578
  runtimeContext: RuntimeContext;
373
- }): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
579
+ }): Promise<Omit<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
580
+
581
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, runtimeContextFromRequest, }: WorkflowContext_3 & {
582
+ body: {
583
+ step: string | string[];
584
+ resumeData?: unknown;
585
+ };
586
+ runtimeContext?: RuntimeContext_2;
587
+ runtimeContextFromRequest?: Record<string, unknown>;
588
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
374
589
 
375
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
590
+ export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
376
591
  body: {
377
592
  stepId: string;
378
593
  context: any;
@@ -382,26 +597,59 @@ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body,
382
597
  message: string;
383
598
  }>;
384
599
 
600
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
601
+ body: {
602
+ step: string | string[];
603
+ resumeData?: unknown;
604
+ };
605
+ runtimeContext?: RuntimeContext_2;
606
+ }): Promise<{
607
+ message: string;
608
+ }>;
609
+
385
610
  export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
386
611
  body: {
387
612
  messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
388
613
  };
389
- }): Promise<MessageType[]>;
614
+ }): Promise<MastraMessageV1[]>;
615
+
616
+ declare type SerializedStep = {
617
+ id: string;
618
+ description: string;
619
+ inputSchema: string | undefined;
620
+ outputSchema: string | undefined;
621
+ resumeSchema: string | undefined;
622
+ suspendSchema: string | undefined;
623
+ };
390
624
 
391
625
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
392
626
 
393
- export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
627
+ export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
394
628
  triggerData?: unknown;
395
629
  runtimeContext: RuntimeContext;
396
- }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
630
+ }): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
397
631
 
398
- export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
632
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
633
+ inputData?: unknown;
634
+ runtimeContext?: RuntimeContext_2;
635
+ runtimeContextFromRequest?: Record<string, unknown>;
636
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
637
+
638
+ export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
399
639
  triggerData?: unknown;
400
640
  runtimeContext: RuntimeContext;
401
641
  }): Promise<{
402
642
  message: string;
403
643
  }>;
404
644
 
645
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
646
+ inputData?: unknown;
647
+ runtimeContext?: RuntimeContext_2;
648
+ runtimeContextFromRequest?: Record<string, unknown>;
649
+ }): Promise<{
650
+ message: string;
651
+ }>;
652
+
405
653
  /**
406
654
  * If you want to use an unofficial status, use `UnofficialStatusCode`.
407
655
  */
@@ -415,6 +663,10 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
415
663
  status: string;
416
664
  message: string;
417
665
  error: any;
666
+ } | {
667
+ status: string;
668
+ message: string;
669
+ traceCount?: undefined;
418
670
  } | {
419
671
  status: string;
420
672
  message: string;
@@ -426,6 +678,7 @@ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId,
426
678
  agentId: string;
427
679
  body: GetBody<'stream'> & {
428
680
  resourceid?: string;
681
+ runtimeContext?: string;
429
682
  };
430
683
  }): Promise<Response | undefined>;
431
684
 
@@ -436,6 +689,15 @@ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body,
436
689
  } & Parameters<AgentNetwork['stream']>[1];
437
690
  }): Promise<Response>;
438
691
 
692
+ export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
693
+ inputData?: unknown;
694
+ runtimeContext?: RuntimeContext_2;
695
+ runtimeContextFromRequest?: Record<string, unknown>;
696
+ }): {
697
+ stream: globalThis.ReadableStream<WatchEvent>;
698
+ getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
699
+ };
700
+
439
701
  declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
440
702
 
441
703
  export declare namespace telemetry {
@@ -452,6 +714,8 @@ declare interface TelemetryContext extends Context {
452
714
  page?: number;
453
715
  perPage?: number;
454
716
  attribute?: string | string[];
717
+ fromDate?: Date;
718
+ toDate?: Date;
455
719
  };
456
720
  }
457
721
 
@@ -538,7 +802,8 @@ export declare namespace voice {
538
802
  export {
539
803
  getSpeakersHandler,
540
804
  generateSpeechHandler,
541
- transcribeSpeechHandler
805
+ transcribeSpeechHandler,
806
+ getListenerHandler
542
807
  }
543
808
  }
544
809
 
@@ -546,22 +811,30 @@ declare interface VoiceContext extends Context {
546
811
  agentId?: string;
547
812
  }
548
813
 
549
- export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
814
+ export declare function watchLegacyWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
815
+
816
+ export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
550
817
 
551
818
  declare interface WorkflowContext extends Context {
552
819
  workflowId?: string;
553
820
  runId?: string;
554
821
  }
555
822
 
823
+ declare interface WorkflowContext_3 extends Context {
824
+ workflowId?: string;
825
+ runId?: string;
826
+ }
827
+
556
828
  export declare namespace workflows {
557
829
  export {
558
830
  getWorkflowsHandler,
559
831
  getWorkflowByIdHandler,
832
+ getWorkflowRunByIdHandler,
833
+ createWorkflowRunHandler,
560
834
  startAsyncWorkflowHandler,
561
- getWorkflowRunHandler,
562
- createRunHandler,
563
835
  startWorkflowRunHandler,
564
836
  watchWorkflowHandler,
837
+ streamWorkflowHandler,
565
838
  resumeAsyncWorkflowHandler,
566
839
  resumeWorkflowHandler,
567
840
  getWorkflowRunsHandler
@@ -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
 
@@ -1,11 +1,11 @@
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/error.ts
6
6
  function handleError(error, defaultMessage) {
7
7
  const apiError = error;
8
- throw new chunkFV45V6WC_cjs.HTTPException(apiError.status || 500, {
8
+ throw new chunkOCWPVYNI_cjs.HTTPException(apiError.status || 500, {
9
9
  message: apiError.message || defaultMessage
10
10
  });
11
11
  }
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __export = (target, all) => {
5
+ for (var name in all)
6
+ __defProp(target, name, { get: all[name], enumerable: true });
7
+ };
8
+
9
+ exports.__export = __export;