@mastra/server 0.0.0-separate-trace-data-from-component-20250501141108 → 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 (82) hide show
  1. package/README.md +48 -135
  2. package/dist/_tsup-dts-rollup.d.cts +282 -92
  3. package/dist/_tsup-dts-rollup.d.ts +282 -92
  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-4BIX6GMY.cjs → chunk-A3KDUGS7.cjs} +78 -28
  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-QJ3AHN64.js → chunk-C7564HUT.js} +4 -3
  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-Y3SV5XK4.js → chunk-J3PKLB3A.js} +60 -10
  20. package/dist/{chunk-JPB6RPGB.js → chunk-KUNQFY2W.js} +112 -51
  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-5YGDYMRB.cjs → chunk-VPNDC2DI.cjs} +14 -13
  31. package/dist/{chunk-M3YJLWTU.js → chunk-W7VCKPAD.js} +62 -51
  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 +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 +7 -5
  75. package/dist/chunk-5SWCVTNL.cjs +0 -5579
  76. package/dist/chunk-AELYAUEE.cjs +0 -316
  77. package/dist/chunk-EVCC233P.cjs +0 -321
  78. package/dist/chunk-OMN3UI6X.js +0 -5576
  79. package/dist/server/handlers/vNextWorkflows.cjs +0 -46
  80. package/dist/server/handlers/vNextWorkflows.d.cts +0 -10
  81. package/dist/server/handlers/vNextWorkflows.d.ts +0 -10
  82. package/dist/server/handlers/vNextWorkflows.js +0 -1
@@ -1,35 +1,62 @@
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';
12
- import { NewStep } from '@mastra/core/workflows/vNext';
13
- import type { NewWorkflow } from '@mastra/core/workflows/vNext';
20
+ import { MastraMessageV1 } from '@mastra/core/memory';
21
+ import type { Message } from '@mastra/core/a2a';
14
22
  import type { QueryResult } from '@mastra/core/vector';
15
23
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
16
- import type { RuntimeContext } from '@mastra/core/runtime-context';
17
- import type { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
18
- import { SerializedStepFlowEntry } from '@mastra/core/workflows/vNext';
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';
19
27
  import { Step } from '@mastra/core/workflows';
20
- import { StepExecutionContext } from '@mastra/core/workflows';
21
- import { StepGraph } from '@mastra/core/workflows';
28
+ import { StepExecutionContext } from '@mastra/core/workflows/legacy';
29
+ import { StepGraph } from '@mastra/core/workflows/legacy';
22
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';
23
38
  import type { ToolAction } from '@mastra/core/tools';
39
+ import { UIMessage } from 'ai';
24
40
  import type { VercelTool } from '@mastra/core/tools';
41
+ import { WatchEvent } from '@mastra/core/workflows';
25
42
  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';
43
+ import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
44
+ import { WorkflowResult } from '@mastra/core/workflows';
29
45
  import type { WorkflowRuns } from '@mastra/core/storage';
30
46
  import { ZodType } from 'zod';
31
47
  import { ZodTypeDef } from 'zod';
32
48
 
49
+ export declare namespace a2a {
50
+ export {
51
+ getAgentCardByIdHandler,
52
+ handleTaskSend,
53
+ handleTaskGet,
54
+ handleTaskSendSubscribe,
55
+ handleTaskCancel,
56
+ getAgentExecutionHandler
57
+ }
58
+ }
59
+
33
60
  export declare namespace agents {
34
61
  export {
35
62
  getAgentsHandler,
@@ -46,12 +73,18 @@ export declare interface ApiError extends Error {
46
73
  status?: number;
47
74
  }
48
75
 
76
+ export declare function applyUpdateToTaskAndHistory(current: TaskAndHistory, update: Omit<TaskStatus, 'timestamp'> | Artifact): TaskAndHistory;
77
+
49
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;
50
79
 
51
80
  export declare interface Context {
52
81
  mastra: Mastra;
53
82
  }
54
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
+
55
88
  export declare function createIndex({ mastra, vectorName, index, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
56
89
  index: CreateIndexRequest;
57
90
  }): Promise<{
@@ -64,17 +97,26 @@ declare interface CreateIndexRequest {
64
97
  metric?: 'cosine' | 'euclidean' | 'dotproduct';
65
98
  }
66
99
 
67
- 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<{
68
101
  runId: string;
69
102
  }>;
70
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
+
71
113
  export declare function createThreadHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
72
114
  body?: Omit<Parameters<MastraMemory['createThread']>[0], 'resourceId'> & {
73
115
  resourceId?: string;
74
116
  };
75
117
  }): Promise<StorageThreadType>;
76
118
 
77
- export declare function createVNextWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
119
+ export declare function createWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
78
120
  runId: string;
79
121
  }>;
80
122
 
@@ -98,15 +140,17 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
98
140
  metric: string | undefined;
99
141
  }>;
100
142
 
101
- 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'> & {
102
144
  agentId?: string;
103
145
  data: any;
104
- runtimeContext: RuntimeContext;
146
+ runtimeContext: RuntimeContext_2;
147
+ runtimeContextFromRequest: Record<string, unknown>;
105
148
  }): Promise<any>;
106
149
 
107
- 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"> & {
108
151
  data?: unknown;
109
- runtimeContext: RuntimeContext;
152
+ runtimeContext: RuntimeContext_2;
153
+ runtimeContextFromRequest: Record<string, unknown>;
110
154
  }) => Promise<any>;
111
155
 
112
156
  export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
@@ -114,6 +158,7 @@ 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
163
  }): Promise<GenerateTextResult<any, any>>;
119
164
 
@@ -141,10 +186,34 @@ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }
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,7 +273,7 @@ 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, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<any[]>;
179
277
 
180
278
  export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
181
279
 
@@ -187,9 +285,11 @@ export declare function getMemoryStatusHandler({ mastra, agentId }: Pick<MemoryC
187
285
  result: boolean;
188
286
  }>;
189
287
 
190
- 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<{
191
291
  messages: CoreMessage[];
192
- uiMessages: Message[];
292
+ uiMessages: UIMessage[];
193
293
  }>;
194
294
 
195
295
  export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
@@ -239,37 +339,72 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
239
339
 
240
340
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
241
341
 
242
- export declare function getVNextWorkflowByIdHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<{
243
- steps: any;
342
+ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
343
+ steps: SerializedStep[];
244
344
  name: string | undefined;
345
+ description: string | undefined;
245
346
  stepGraph: SerializedStepFlowEntry[];
246
347
  inputSchema: string | undefined;
247
348
  outputSchema: string | undefined;
248
349
  }>;
249
350
 
250
- export declare function getVNextWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<NewWorkflow['getWorkflowRun']>>;
351
+ export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
251
352
 
252
- export declare function getVNextWorkflowRunsHandler({ mastra, workflowId }: VNextWorkflowContext): 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>;
253
360
 
254
- export declare function getVNextWorkflowsHandler({ mastra }: VNextWorkflowContext): Promise<any>;
361
+ export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
255
362
 
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
- }>;
265
-
266
- export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
363
+ export declare function handleError(error: unknown, defaultMessage: string): never;
267
364
 
268
- export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext): Promise<WorkflowRuns>;
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>>;
269
372
 
270
- export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
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>>;
271
389
 
272
- export declare function handleError(error: unknown, defaultMessage: string): never;
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>;
273
408
 
274
409
  /**
275
410
  * `HTTPException` must be used when a fatal error such as authentication failure occurs.
@@ -332,8 +467,46 @@ declare type HTTPExceptionOptions = {
332
467
  */
333
468
  declare type InfoStatusCode = 100 | 101 | 102 | 103;
334
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
+
335
498
  export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
336
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
+
337
510
  export declare namespace logs {
338
511
  export {
339
512
  getLogsHandler,
@@ -381,6 +554,8 @@ declare interface NetworkContext extends Context {
381
554
  runtimeContext: RuntimeContext;
382
555
  }
383
556
 
557
+ export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
558
+
384
559
  declare interface QueryRequest {
385
560
  indexName: string;
386
561
  queryVector: number[];
@@ -395,33 +570,24 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
395
570
 
396
571
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
397
572
 
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 & {
573
+ export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
407
574
  body: {
408
575
  stepId: string;
409
576
  context: any;
410
577
  };
411
578
  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>;
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>;
413
580
 
414
- export declare function resumeVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
581
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, runtimeContextFromRequest, }: WorkflowContext_3 & {
415
582
  body: {
416
583
  step: string | string[];
417
584
  resumeData?: unknown;
418
585
  };
419
586
  runtimeContext?: RuntimeContext_2;
420
- }): Promise<{
421
- message: string;
422
- }>;
587
+ runtimeContextFromRequest?: Record<string, unknown>;
588
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
423
589
 
424
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
590
+ export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
425
591
  body: {
426
592
  stepId: string;
427
593
  context: any;
@@ -431,34 +597,55 @@ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body,
431
597
  message: string;
432
598
  }>;
433
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
+
434
610
  export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<MemoryContext, 'mastra' | 'agentId'> & {
435
611
  body: {
436
612
  messages: Parameters<MastraMemory['saveMessages']>[0]['messages'];
437
613
  };
438
- }): Promise<MessageType[]>;
614
+ }): Promise<MastraMessageV1[]>;
439
615
 
440
- declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
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
+ };
441
624
 
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>[]>>;
625
+ declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
446
626
 
447
- 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'> & {
448
628
  triggerData?: unknown;
449
629
  runtimeContext: RuntimeContext;
450
- }): 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>>;
451
631
 
452
- export declare function startVNextWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
632
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
453
633
  inputData?: unknown;
454
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'> & {
639
+ triggerData?: unknown;
640
+ runtimeContext: RuntimeContext;
455
641
  }): Promise<{
456
642
  message: string;
457
643
  }>;
458
644
 
459
- export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
460
- triggerData?: unknown;
461
- runtimeContext: RuntimeContext;
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>;
462
649
  }): Promise<{
463
650
  message: string;
464
651
  }>;
@@ -476,6 +663,10 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
476
663
  status: string;
477
664
  message: string;
478
665
  error: any;
666
+ } | {
667
+ status: string;
668
+ message: string;
669
+ traceCount?: undefined;
479
670
  } | {
480
671
  status: string;
481
672
  message: string;
@@ -487,6 +678,7 @@ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId,
487
678
  agentId: string;
488
679
  body: GetBody<'stream'> & {
489
680
  resourceid?: string;
681
+ runtimeContext?: string;
490
682
  };
491
683
  }): Promise<Response | undefined>;
492
684
 
@@ -497,6 +689,15 @@ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body,
497
689
  } & Parameters<AgentNetwork['stream']>[1];
498
690
  }): Promise<Response>;
499
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
+
500
701
  declare type SuccessStatusCode = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226;
501
702
 
502
703
  export declare namespace telemetry {
@@ -513,6 +714,8 @@ declare interface TelemetryContext extends Context {
513
714
  page?: number;
514
715
  perPage?: number;
515
716
  attribute?: string | string[];
717
+ fromDate?: Date;
718
+ toDate?: Date;
516
719
  };
517
720
  }
518
721
 
@@ -595,31 +798,12 @@ declare interface VectorContext extends Context {
595
798
  vectorName?: string;
596
799
  }
597
800
 
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
801
  export declare namespace voice {
619
802
  export {
620
803
  getSpeakersHandler,
621
804
  generateSpeechHandler,
622
- transcribeSpeechHandler
805
+ transcribeSpeechHandler,
806
+ getListenerHandler
623
807
  }
624
808
  }
625
809
 
@@ -627,24 +811,30 @@ declare interface VoiceContext extends Context {
627
811
  agentId?: string;
628
812
  }
629
813
 
630
- export declare function watchVNextWorkflowHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
814
+ export declare function watchLegacyWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
631
815
 
632
- export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
816
+ export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
633
817
 
634
818
  declare interface WorkflowContext extends Context {
635
819
  workflowId?: string;
636
820
  runId?: string;
637
821
  }
638
822
 
823
+ declare interface WorkflowContext_3 extends Context {
824
+ workflowId?: string;
825
+ runId?: string;
826
+ }
827
+
639
828
  export declare namespace workflows {
640
829
  export {
641
830
  getWorkflowsHandler,
642
831
  getWorkflowByIdHandler,
832
+ getWorkflowRunByIdHandler,
833
+ createWorkflowRunHandler,
643
834
  startAsyncWorkflowHandler,
644
- getWorkflowRunHandler,
645
- createRunHandler,
646
835
  startWorkflowRunHandler,
647
836
  watchWorkflowHandler,
837
+ streamWorkflowHandler,
648
838
  resumeAsyncWorkflowHandler,
649
839
  resumeWorkflowHandler,
650
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
  }