@mastra/server 0.0.0-fix-message-embedding-20250506021742 → 0.0.0-fix-generate-title-20250616171351

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