@mastra/server 0.0.0-agui-20250501191909 → 0.0.0-cli-debug-20250611094457

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 (85) hide show
  1. package/README.md +48 -135
  2. package/dist/_tsup-dts-rollup.d.cts +297 -91
  3. package/dist/_tsup-dts-rollup.d.ts +297 -91
  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-Y3SV5XK4.js → chunk-6F2H7Y45.js} +86 -12
  8. package/dist/{chunk-2FJURXCL.cjs → chunk-6TJSHFCJ.cjs} +44 -36
  9. package/dist/chunk-75ZPJI57.cjs +9 -0
  10. package/dist/{chunk-JPB6RPGB.js → chunk-7IBZ4L35.js} +86 -46
  11. package/dist/{chunk-7IWQE76Z.cjs → chunk-B4MQFJ7G.cjs} +16 -10
  12. package/dist/{chunk-WTHDCRMY.js → chunk-BFOA2QQY.js} +12 -6
  13. package/dist/{chunk-M56ECCHK.cjs → chunk-BNEY4P4P.cjs} +20 -19
  14. package/dist/{chunk-QJ3AHN64.js → chunk-C7564HUT.js} +4 -3
  15. package/dist/{chunk-55HTWX4C.cjs → chunk-CMMOIUFC.cjs} +40 -19
  16. package/dist/{chunk-Q6SHQECN.js → chunk-CP55EVBK.js} +24 -4
  17. package/dist/chunk-GHC4YV6R.js +504 -0
  18. package/dist/{chunk-L7XE5QTW.js → chunk-H5PTF3Y4.js} +1 -1
  19. package/dist/{chunk-5JNVY6DU.js → chunk-HYP7B2TL.js} +7 -5
  20. package/dist/{chunk-RBQASTUP.js → chunk-I7KJZNX5.js} +14 -6
  21. package/dist/chunk-IMBY5XUG.cjs +86 -0
  22. package/dist/chunk-JEWNMAYQ.cjs +263 -0
  23. package/dist/chunk-JKF6PRPU.cjs +357 -0
  24. package/dist/{chunk-3AHQ5RGN.js → chunk-M5ABIP7D.js} +1 -1
  25. package/dist/chunk-MLKGABMK.js +7 -0
  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-QLG2PFHE.js +81 -0
  29. package/dist/chunk-SDPGVWQJ.cjs +512 -0
  30. package/dist/{chunk-M3YJLWTU.js → chunk-TEZOEGR4.js} +63 -52
  31. package/dist/{chunk-D3G23FP3.cjs → chunk-TJO277H7.cjs} +24 -22
  32. package/dist/chunk-UZ7FJ66C.cjs +332 -0
  33. package/dist/{chunk-5YGDYMRB.cjs → chunk-VPNDC2DI.cjs} +14 -13
  34. package/dist/chunk-WKWHYFX4.js +2001 -0
  35. package/dist/chunk-XUGQSVZ4.cjs +2004 -0
  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 +32 -27
  71. package/dist/server/handlers.d.cts +2 -1
  72. package/dist/server/handlers.d.ts +2 -1
  73. package/dist/server/handlers.js +11 -10
  74. package/package.json +12 -10
  75. package/dist/chunk-3EJZQ6TQ.js +0 -49
  76. package/dist/chunk-4BIX6GMY.cjs +0 -189
  77. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  78. package/dist/chunk-AELYAUEE.cjs +0 -316
  79. package/dist/chunk-EVCC233P.cjs +0 -321
  80. package/dist/chunk-OMN3UI6X.js +0 -5576
  81. package/dist/chunk-SKBVVI24.cjs +0 -54
  82. package/dist/server/handlers/vNextWorkflows.cjs +0 -46
  83. package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
  84. package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
  85. package/dist/server/handlers/vNextWorkflows.js +0 -1
@@ -1,35 +1,63 @@
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';
18
+ import type { LogLevel } from '@mastra/core/logger';
8
19
  import type { Mastra } from '@mastra/core/mastra';
9
20
  import type { MastraMemory } from '@mastra/core/memory';
10
- import { Message } from 'ai';
11
- import { MessageType } from '@mastra/core/memory';
12
- import { NewStep } from '@mastra/core/workflows/vNext';
13
- import type { NewWorkflow } from '@mastra/core/workflows/vNext';
21
+ import { MastraMessageV1 } from '@mastra/core/memory';
22
+ import type { Message } from '@mastra/core/a2a';
14
23
  import type { QueryResult } from '@mastra/core/vector';
15
24
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
16
- import type { RuntimeContext } from '@mastra/core/runtime-context';
25
+ import { RuntimeContext } from '@mastra/core/runtime-context';
17
26
  import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
18
- import { SerializedStepFlowEntry } from '@mastra/core/workflows/vNext';
27
+ import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
19
28
  import { Step } from '@mastra/core/workflows';
20
- import { StepExecutionContext } from '@mastra/core/workflows';
21
- import { StepGraph } from '@mastra/core/workflows';
29
+ import { StepExecutionContext } from '@mastra/core/workflows/legacy';
30
+ import { StepGraph } from '@mastra/core/workflows/legacy';
22
31
  import { StorageThreadType } from '@mastra/core/memory';
32
+ import { StreamEvent } from '@mastra/core/workflows';
33
+ import { Task } from '@mastra/core/a2a';
34
+ import { TaskAndHistory } from '@mastra/core/a2a';
35
+ import type { TaskContext } from '@mastra/core/a2a';
36
+ import type { TaskIdParams } from '@mastra/core/a2a';
37
+ import type { TaskQueryParams } from '@mastra/core/a2a';
38
+ import type { TaskSendParams } from '@mastra/core/a2a';
39
+ import type { TaskStatus } from '@mastra/core/a2a';
23
40
  import type { ToolAction } from '@mastra/core/tools';
41
+ import { UIMessage } from 'ai';
24
42
  import type { VercelTool } from '@mastra/core/tools';
25
43
  import type { Workflow } from '@mastra/core/workflows';
26
- import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
27
- import { WorkflowResult } from '@mastra/core/workflows/vNext';
28
- import { WorkflowRunResult } from '@mastra/core/workflows';
44
+ import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
45
+ import { WorkflowResult } from '@mastra/core/workflows';
29
46
  import type { WorkflowRuns } from '@mastra/core/storage';
30
47
  import { ZodType } from 'zod';
31
48
  import { ZodTypeDef } from 'zod';
32
49
 
50
+ export declare namespace a2a {
51
+ export {
52
+ getAgentCardByIdHandler,
53
+ handleTaskSend,
54
+ handleTaskGet,
55
+ handleTaskSendSubscribe,
56
+ handleTaskCancel,
57
+ getAgentExecutionHandler
58
+ }
59
+ }
60
+
33
61
  export declare namespace agents {
34
62
  export {
35
63
  getAgentsHandler,
@@ -46,12 +74,18 @@ export declare interface ApiError extends Error {
46
74
  status?: number;
47
75
  }
48
76
 
77
+ export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
78
+
49
79
  declare type ClientErrorStatusCode = 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451;
50
80
 
51
81
  export declare interface Context {
52
82
  mastra: Mastra;
53
83
  }
54
84
 
85
+ export declare function convertToCoreMessage(message: Message): CoreMessage_2;
86
+
87
+ export declare function createErrorResponse(id: number | string | null, error: JSONRPCError<unknown>): JSONRPCResponse<null, unknown>;
88
+
55
89
  export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
56
90
  index: CreateIndexRequest;
57
91
  }): Promise<{
@@ -64,17 +98,26 @@ declare interface CreateIndexRequest {
64
98
  metric?: 'cosine' | 'euclidean' | 'dotproduct';
65
99
  }
66
100
 
67
- export declare function createRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
101
+ export declare function createLegacyWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
68
102
  runId: string;
69
103
  }>;
70
104
 
105
+ export declare function createSuccessResponse<T>(id: number | string | null, result: T): JSONRPCResponse<T>;
106
+
107
+ export declare function createTaskContext({ task, userMessage, history, activeCancellations, }: {
108
+ task: Task;
109
+ userMessage: Message;
110
+ history: Message[];
111
+ activeCancellations: Set<string>;
112
+ }): TaskContext;
113
+
71
114
  export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
72
115
  body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
73
116
  resourceId?: string;
74
117
  };
75
118
  }): Promise<StorageThreadType>;
76
119
 
77
- export declare function createVNextWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
120
+ export declare function createWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
78
121
  runId: string;
79
122
  }>;
80
123
 
@@ -101,12 +144,12 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
101
144
  export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
102
145
  agentId?: string;
103
146
  data: any;
104
- runtimeContext: RuntimeContext;
147
+ runtimeContext: RuntimeContext_2;
105
148
  }): Promise<any>;
106
149
 
107
150
  export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
108
151
  data?: unknown;
109
- runtimeContext: RuntimeContext;
152
+ runtimeContext: RuntimeContext_2;
110
153
  }) => Promise<any>;
111
154
 
112
155
  export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
@@ -114,6 +157,7 @@ export declare function generateHandler({ mastra, runtimeContext, agentId, body,
114
157
  agentId: string;
115
158
  body: GetBody<'generate'> & {
116
159
  resourceid?: string;
160
+ runtimeContext?: Record<string, unknown>;
117
161
  };
118
162
  }): Promise<GenerateTextResult<any, any>>;
119
163
 
@@ -134,17 +178,42 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
134
178
  };
135
179
  }): Promise<NodeJS.ReadableStream>;
136
180
 
137
- export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
181
+ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, isPlayground, }: Context & {
182
+ isPlayground?: boolean;
138
183
  runtimeContext: RuntimeContext;
139
184
  agentId: string;
140
185
  }): Promise<{
141
186
  name: any;
142
187
  instructions: string;
143
188
  tools: any;
189
+ workflows: {};
144
190
  provider: string;
145
191
  modelId: string;
192
+ defaultGenerateOptions: any;
193
+ defaultStreamOptions: any;
146
194
  }>;
147
195
 
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
+
148
217
  export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
149
218
  runtimeContext: RuntimeContext;
150
219
  }): Promise<any>;
@@ -165,6 +234,35 @@ export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agent
165
234
  evals: EvalRow[];
166
235
  }>;
167
236
 
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
+
168
266
  export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
169
267
  runtimeContext: RuntimeContext;
170
268
  agentId: string;
@@ -175,9 +273,21 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, a
175
273
  evals: EvalRow[];
176
274
  }>;
177
275
 
178
- export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<BaseLogMessage[] | undefined>;
276
+ export declare function getLogsByRunIdHandler({ mastra, runId, transportId, params, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId' | 'params'>): Promise<{
277
+ logs: BaseLogMessage[];
278
+ total: number;
279
+ page: number;
280
+ perPage: number;
281
+ hasMore: boolean;
282
+ }>;
179
283
 
180
- export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
284
+ export declare function getLogsHandler({ mastra, transportId, params, }: Pick<LogsContext, 'mastra' | 'transportId' | 'params'>): Promise<{
285
+ logs: BaseLogMessage[];
286
+ total: number;
287
+ page: number;
288
+ perPage: number;
289
+ hasMore: boolean;
290
+ }>;
181
291
 
182
292
  export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
183
293
  transports: string[];
@@ -187,9 +297,11 @@ export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryC
187
297
  result: boolean;
188
298
  }>;
189
299
 
190
- export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'>): Promise<{
300
+ export declare function getMessagesHandler({ mastra, agentId, threadId, limit, }: Pick<MemoryContext, 'mastra' | 'agentId' | 'threadId'> & {
301
+ limit?: number;
302
+ }): Promise<{
191
303
  messages: CoreMessage[];
192
- uiMessages: Message[];
304
+ uiMessages: UIMessage[];
193
305
  }>;
194
306
 
195
307
  export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
@@ -239,37 +351,72 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
239
351
 
240
352
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
241
353
 
242
- export declare function getVNextWorkflowByIdHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<{
243
- steps: any;
354
+ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
355
+ steps: SerializedStep[];
244
356
  name: string | undefined;
357
+ description: string | undefined;
245
358
  stepGraph: SerializedStepFlowEntry[];
246
359
  inputSchema: string | undefined;
247
360
  outputSchema: string | undefined;
248
361
  }>;
249
362
 
250
- export declare function getVNextWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<NewWorkflow['getWorkflowRun']>>;
363
+ export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
251
364
 
252
- export declare function getVNextWorkflowRunsHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<WorkflowRuns>;
253
-
254
- export declare function getVNextWorkflowsHandler({ mastra }: VNextWorkflowContext): Promise<any>;
365
+ export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext_3 & {
366
+ fromDate?: Date;
367
+ toDate?: Date;
368
+ limit?: number;
369
+ offset?: number;
370
+ resourceId?: string;
371
+ }): Promise<WorkflowRuns>;
255
372
 
256
- export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
257
- stepGraph: StepGraph;
258
- stepSubscriberGraph: Record<string, StepGraph>;
259
- serializedStepGraph: StepGraph;
260
- serializedStepSubscriberGraph: Record<string, StepGraph>;
261
- name: string;
262
- triggerSchema: string | undefined;
263
- steps: any;
264
- }>;
373
+ export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
265
374
 
266
- export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
375
+ export declare function handleError(error: unknown, defaultMessage: string): never;
267
376
 
268
- export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext): Promise<WorkflowRuns>;
377
+ export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId, logger, }: {
378
+ requestId: string;
379
+ taskStore: InMemoryTaskStore;
380
+ agentId: string;
381
+ taskId: string;
382
+ logger?: IMastraLogger;
383
+ }): Promise<JSONRPCResponse<Task, unknown>>;
269
384
 
270
- export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
385
+ export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }: {
386
+ requestId: string;
387
+ taskStore: InMemoryTaskStore;
388
+ agentId: string;
389
+ taskId: string;
390
+ }): Promise<JSONRPCResponse<TaskAndHistory, unknown>>;
391
+
392
+ export declare function handleTaskSend({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
393
+ requestId: string;
394
+ params: TaskSendParams;
395
+ taskStore: InMemoryTaskStore;
396
+ agent: Agent;
397
+ agentId: string;
398
+ logger?: IMastraLogger;
399
+ runtimeContext: RuntimeContext;
400
+ }): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
271
401
 
272
- export declare function handleError(error: unknown, defaultMessage: string): never;
402
+ export declare function handleTaskSendSubscribe({ requestId, params, taskStore, agent, agentId, logger, runtimeContext, }: {
403
+ requestId: string;
404
+ params: TaskSendParams;
405
+ taskStore: InMemoryTaskStore;
406
+ agent: Agent;
407
+ agentId: string;
408
+ logger?: IMastraLogger;
409
+ runtimeContext: RuntimeContext;
410
+ }): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
411
+ state: string;
412
+ message: {
413
+ role: string;
414
+ parts: {
415
+ type: string;
416
+ text: string;
417
+ }[];
418
+ };
419
+ }, unknown>, void, unknown>;
273
420
 
274
421
  /**
275
422
  * `HTTPException` must be used when a fatal error such as authentication failure occurs.
@@ -332,8 +479,46 @@ declare type HTTPExceptionOptions = {
332
479
  */
333
480
  declare type InfoStatusCode = 100 | 101 | 102 | 103;
334
481
 
482
+ export declare class InMemoryTaskStore {
483
+ private store;
484
+ activeCancellations: Set<string>;
485
+ load({ agentId, taskId }: {
486
+ agentId: string;
487
+ taskId: string;
488
+ }): Promise<TaskAndHistory | null>;
489
+ save({ agentId, data }: {
490
+ agentId: string;
491
+ data: TaskAndHistory;
492
+ }): Promise<void>;
493
+ }
494
+
495
+ export declare namespace legacyWorkflows {
496
+ export {
497
+ getLegacyWorkflowsHandler,
498
+ getLegacyWorkflowByIdHandler,
499
+ startAsyncLegacyWorkflowHandler,
500
+ getLegacyWorkflowRunHandler,
501
+ createLegacyWorkflowRunHandler,
502
+ startLegacyWorkflowRunHandler,
503
+ watchLegacyWorkflowHandler,
504
+ resumeAsyncLegacyWorkflowHandler,
505
+ resumeLegacyWorkflowHandler,
506
+ getLegacyWorkflowRunsHandler
507
+ }
508
+ }
509
+
335
510
  export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
336
511
 
512
+ export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore, message, sessionId, metadata, logger, }: {
513
+ agentId: string;
514
+ taskId: string;
515
+ taskStore: InMemoryTaskStore;
516
+ message: Message;
517
+ sessionId?: string | null;
518
+ metadata?: Record<string, unknown> | null;
519
+ logger?: IMastraLogger;
520
+ }): Promise<TaskAndHistory>;
521
+
337
522
  export declare namespace logs {
338
523
  export {
339
524
  getLogsHandler,
@@ -346,6 +531,14 @@ declare type LogsContext = {
346
531
  mastra: Mastra;
347
532
  transportId?: string;
348
533
  runId?: string;
534
+ params?: {
535
+ fromDate?: Date;
536
+ toDate?: Date;
537
+ logLevel?: LogLevel;
538
+ filters?: string | string[];
539
+ page?: number;
540
+ perPage?: number;
541
+ };
349
542
  };
350
543
 
351
544
  export declare namespace memory {
@@ -381,6 +574,8 @@ declare interface NetworkContext extends Context {
381
574
  runtimeContext: RuntimeContext;
382
575
  }
383
576
 
577
+ export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
578
+
384
579
  declare interface QueryRequest {
385
580
  indexName: string;
386
581
  queryVector: number[];
@@ -395,33 +590,23 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
395
590
 
396
591
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
397
592
 
398
- export declare function resumeAsyncVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
399
- body: {
400
- step: string | string[];
401
- resumeData?: unknown;
402
- };
403
- runtimeContext?: RuntimeContext_2;
404
- }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
405
-
406
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
593
+ export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
407
594
  body: {
408
595
  stepId: string;
409
596
  context: any;
410
597
  };
411
598
  runtimeContext: RuntimeContext;
412
- }): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
599
+ }): Promise<Omit<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
413
600
 
414
- export declare function resumeVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
601
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
415
602
  body: {
416
603
  step: string | string[];
417
604
  resumeData?: unknown;
418
605
  };
419
606
  runtimeContext?: RuntimeContext_2;
420
- }): Promise<{
421
- message: string;
422
- }>;
607
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
423
608
 
424
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
609
+ export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
425
610
  body: {
426
611
  stepId: string;
427
612
  context: any;
@@ -431,34 +616,53 @@ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body,
431
616
  message: string;
432
617
  }>;
433
618
 
619
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
620
+ body: {
621
+ step: string | string[];
622
+ resumeData?: unknown;
623
+ };
624
+ runtimeContext?: RuntimeContext_2;
625
+ }): Promise<{
626
+ message: string;
627
+ }>;
628
+
434
629
  export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
435
630
  body: {
436
631
  messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
437
632
  };
438
- }): Promise<MessageType[]>;
633
+ }): Promise<MastraMessageV1[]>;
439
634
 
440
- declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
635
+ declare type SerializedStep = {
636
+ id: string;
637
+ description: string;
638
+ inputSchema: string | undefined;
639
+ outputSchema: string | undefined;
640
+ resumeSchema: string | undefined;
641
+ suspendSchema: string | undefined;
642
+ };
441
643
 
442
- export declare function startAsyncVNextWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
443
- inputData?: unknown;
444
- runtimeContext?: RuntimeContext_2;
445
- }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
644
+ declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
446
645
 
447
- export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
646
+ export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
448
647
  triggerData?: unknown;
449
648
  runtimeContext: RuntimeContext;
450
- }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
649
+ }): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
451
650
 
452
- export declare function startVNextWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
651
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
453
652
  inputData?: unknown;
454
653
  runtimeContext?: RuntimeContext_2;
654
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
655
+
656
+ export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
657
+ triggerData?: unknown;
658
+ runtimeContext: RuntimeContext;
455
659
  }): Promise<{
456
660
  message: string;
457
661
  }>;
458
662
 
459
- export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
460
- triggerData?: unknown;
461
- runtimeContext: RuntimeContext;
663
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
664
+ inputData?: unknown;
665
+ runtimeContext?: RuntimeContext_2;
462
666
  }): Promise<{
463
667
  message: string;
464
668
  }>;
@@ -476,6 +680,10 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
476
680
  status: string;
477
681
  message: string;
478
682
  error: any;
683
+ } | {
684
+ status: string;
685
+ message: string;
686
+ traceCount?: undefined;
479
687
  } | {
480
688
  status: string;
481
689
  message: string;
@@ -487,6 +695,7 @@ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId,
487
695
  agentId: string;
488
696
  body: GetBody<'stream'> & {
489
697
  resourceid?: string;
698
+ runtimeContext?: string;
490
699
  };
491
700
  }): Promise<Response | undefined>;
492
701
 
@@ -497,6 +706,14 @@ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body,
497
706
  } & Parameters<AgentNetwork['stream']>[1];
498
707
  }): Promise<Response>;
499
708
 
709
+ export declare function streamWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
710
+ inputData?: unknown;
711
+ runtimeContext?: RuntimeContext_2;
712
+ }): {
713
+ stream: globalThis.ReadableStream<StreamEvent>;
714
+ getWorkflowState: () => Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
715
+ };
716
+
500
717
  declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
501
718
 
502
719
  export declare namespace telemetry {
@@ -513,6 +730,8 @@ declare interface TelemetryContext extends Context {
513
730
  page?: number;
514
731
  perPage?: number;
515
732
  attribute?: string | string[];
733
+ fromDate?: Date;
734
+ toDate?: Date;
516
735
  };
517
736
  }
518
737
 
@@ -595,31 +814,12 @@ declare interface VectorContext extends Context {
595
814
  vectorName?: string;
596
815
  }
597
816
 
598
- declare interface VNextWorkflowContext extends Context {
599
- workflowId?: string;
600
- runId?: string;
601
- }
602
-
603
- export declare namespace vNextWorkflows {
604
- export {
605
- getVNextWorkflowsHandler,
606
- getVNextWorkflowByIdHandler,
607
- getVNextWorkflowRunHandler,
608
- createVNextWorkflowRunHandler,
609
- startAsyncVNextWorkflowHandler,
610
- startVNextWorkflowRunHandler,
611
- watchVNextWorkflowHandler,
612
- resumeAsyncVNextWorkflowHandler,
613
- resumeVNextWorkflowHandler,
614
- getVNextWorkflowRunsHandler
615
- }
616
- }
617
-
618
817
  export declare namespace voice {
619
818
  export {
620
819
  getSpeakersHandler,
621
820
  generateSpeechHandler,
622
- transcribeSpeechHandler
821
+ transcribeSpeechHandler,
822
+ getListenerHandler
623
823
  }
624
824
  }
625
825
 
@@ -627,24 +827,30 @@ declare interface VoiceContext extends Context {
627
827
  agentId?: string;
628
828
  }
629
829
 
630
- export declare function watchVNextWorkflowHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
830
+ export declare function watchLegacyWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
631
831
 
632
- export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
832
+ export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
633
833
 
634
834
  declare interface WorkflowContext extends Context {
635
835
  workflowId?: string;
636
836
  runId?: string;
637
837
  }
638
838
 
839
+ declare interface WorkflowContext_3 extends Context {
840
+ workflowId?: string;
841
+ runId?: string;
842
+ }
843
+
639
844
  export declare namespace workflows {
640
845
  export {
641
846
  getWorkflowsHandler,
642
847
  getWorkflowByIdHandler,
848
+ getWorkflowRunByIdHandler,
849
+ createWorkflowRunHandler,
643
850
  startAsyncWorkflowHandler,
644
- getWorkflowRunHandler,
645
- createRunHandler,
646
851
  startWorkflowRunHandler,
647
852
  watchWorkflowHandler,
853
+ streamWorkflowHandler,
648
854
  resumeAsyncWorkflowHandler,
649
855
  resumeWorkflowHandler,
650
856
  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");