@mastra/server 0.0.0-fix-memory-xxhash-20250409202110 → 0.0.0-fix-message-embedding-20250506021742

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 (44) hide show
  1. package/{LICENSE → LICENSE.md} +3 -1
  2. package/dist/_tsup-dts-rollup.d.cts +138 -34
  3. package/dist/_tsup-dts-rollup.d.ts +138 -34
  4. package/dist/{chunk-2JQC6JWP.js → chunk-3EJZQ6TQ.js} +4 -1
  5. package/dist/{chunk-ILW7XYNJ.js → chunk-3XTEV33Q.js} +33 -12
  6. package/dist/{chunk-GV52BII2.cjs → chunk-4BIX6GMY.cjs} +63 -34
  7. package/dist/{chunk-A7DF4ETD.cjs → chunk-55HTWX4C.cjs} +2 -9
  8. package/dist/{chunk-YNSGUC2O.js → chunk-5JNVY6DU.js} +8 -4
  9. package/dist/{chunk-QH6XWSXP.cjs → chunk-5SWCVTNL.cjs} +38 -38
  10. package/dist/{chunk-5JOF627H.cjs → chunk-5YGDYMRB.cjs} +54 -30
  11. package/dist/{chunk-CWSDZEZG.cjs → chunk-AMVOS7YB.cjs} +6 -4
  12. package/dist/{chunk-DVPP5S6I.js → chunk-BPL2CBLV.js} +6 -4
  13. package/dist/{chunk-X37I6GZT.cjs → chunk-CHFORQ7J.cjs} +39 -18
  14. package/dist/{chunk-4C3EPMMF.cjs → chunk-D3G23FP3.cjs} +12 -8
  15. package/dist/chunk-FOXHTOQZ.cjs +324 -0
  16. package/dist/chunk-IQTNZSFP.js +312 -0
  17. package/dist/{chunk-VK6FX47H.js → chunk-OMN3UI6X.js} +38 -38
  18. package/dist/{chunk-3RVHWGWO.js → chunk-Q6SHQECN.js} +2 -9
  19. package/dist/{chunk-2YONKUWB.js → chunk-QJ3AHN64.js} +54 -30
  20. package/dist/{chunk-VB7KH62D.cjs → chunk-SKBVVI24.cjs} +4 -1
  21. package/dist/{chunk-BMA2ORRT.js → chunk-Y3SV5XK4.js} +61 -32
  22. package/dist/server/handlers/agents.cjs +7 -7
  23. package/dist/server/handlers/agents.js +1 -1
  24. package/dist/server/handlers/logs.cjs +4 -4
  25. package/dist/server/handlers/logs.js +1 -1
  26. package/dist/server/handlers/network.cjs +5 -5
  27. package/dist/server/handlers/network.js +1 -1
  28. package/dist/server/handlers/telemetry.cjs +3 -3
  29. package/dist/server/handlers/telemetry.js +1 -1
  30. package/dist/server/handlers/tools.cjs +5 -5
  31. package/dist/server/handlers/tools.js +1 -1
  32. package/dist/server/handlers/vNextWorkflows.cjs +46 -0
  33. package/dist/server/handlers/vNextWorkflows.d.cts +10 -0
  34. package/dist/server/handlers/vNextWorkflows.d.ts +10 -0
  35. package/dist/server/handlers/vNextWorkflows.js +1 -0
  36. package/dist/server/handlers/voice.cjs +4 -4
  37. package/dist/server/handlers/voice.js +1 -1
  38. package/dist/server/handlers/workflows.cjs +11 -11
  39. package/dist/server/handlers/workflows.js +1 -1
  40. package/dist/server/handlers.cjs +19 -14
  41. package/dist/server/handlers.d.cts +1 -0
  42. package/dist/server/handlers.d.ts +1 -0
  43. package/dist/server/handlers.js +8 -7
  44. package/package.json +6 -6
@@ -1,4 +1,6 @@
1
- Elastic License 2.0 (ELv2)
1
+ # Elastic License 2.0 (ELv2)
2
+
3
+ Copyright (c) 2025 Mastra AI, Inc.
2
4
 
3
5
  **Acceptance**
4
6
  By using the software, you agree to all of the terms and conditions below.
@@ -1,27 +1,34 @@
1
1
  import type { Agent } from '@mastra/core/agent';
2
2
  import type { AgentNetwork } from '@mastra/core/network';
3
- import { BaseLogMessage } from '@mastra/core';
3
+ import type { BaseLogMessage } from '@mastra/core/logger';
4
4
  import { CoreMessage } from 'ai';
5
- import { EvalRow } from '@mastra/core';
5
+ import { EvalRow } from '@mastra/core/storage';
6
6
  import { GenerateObjectResult } from 'ai';
7
7
  import { GenerateTextResult } from 'ai';
8
8
  import type { Mastra } from '@mastra/core/mastra';
9
- import type { Mastra as Mastra_2 } from '@mastra/core';
10
9
  import type { MastraMemory } from '@mastra/core/memory';
11
10
  import { Message } from 'ai';
12
- import { MessageType } from '@mastra/core';
11
+ import { MessageType } from '@mastra/core/memory';
12
+ import { NewStep } from '@mastra/core/workflows/vNext';
13
+ import type { NewWorkflow } from '@mastra/core/workflows/vNext';
13
14
  import type { QueryResult } from '@mastra/core/vector';
14
15
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
15
- import { Step } from '@mastra/core';
16
- import { StepExecutionContext } from '@mastra/core';
17
- import { StepGraph } from '@mastra/core';
18
- import { StorageThreadType } from '@mastra/core';
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';
19
+ import { Step } from '@mastra/core/workflows';
20
+ import { StepExecutionContext } from '@mastra/core/workflows';
21
+ import { StepGraph } from '@mastra/core/workflows';
22
+ import { StorageThreadType } from '@mastra/core/memory';
19
23
  import type { ToolAction } from '@mastra/core/tools';
20
24
  import type { VercelTool } from '@mastra/core/tools';
21
25
  import type { Workflow } from '@mastra/core/workflows';
22
- import { WorkflowContext as WorkflowContext_2 } from '@mastra/core';
23
- import { WorkflowRunResult } from '@mastra/core';
24
- import { WorkflowRuns } from '@mastra/core';
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';
29
+ import type { WorkflowRuns } from '@mastra/core/storage';
30
+ import { ZodType } from 'zod';
31
+ import { ZodTypeDef } from 'zod';
25
32
 
26
33
  export declare namespace agents {
27
34
  export {
@@ -67,6 +74,10 @@ export declare function createThreadHandler({ mastra, agentId, body, }: Pick<Mem
67
74
  };
68
75
  }): Promise<StorageThreadType>;
69
76
 
77
+ export declare function createVNextWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
78
+ runId: string;
79
+ }>;
80
+
70
81
  export declare function deleteIndex({ mastra, vectorName, indexName, }: Pick<VectorContext, 'mastra' | 'vectorName'> & {
71
82
  indexName?: string;
72
83
  }): Promise<{
@@ -87,23 +98,27 @@ export declare function describeIndex({ mastra, vectorName, indexName, }: Pick<V
87
98
  metric: string | undefined;
88
99
  }>;
89
100
 
90
- export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
101
+ export declare function executeAgentToolHandler({ mastra, agentId, toolId, data, runtimeContext, }: Pick<ToolsContext, 'mastra' | 'toolId'> & {
91
102
  agentId?: string;
92
103
  data: any;
104
+ runtimeContext: RuntimeContext;
93
105
  }): Promise<any>;
94
106
 
95
- export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
107
+ export declare function executeToolHandler(tools: ToolsContext['tools']): ({ mastra, runId, toolId, data, runtimeContext, }: Pick<ToolsContext, "mastra" | "toolId" | "runId"> & {
96
108
  data?: unknown;
109
+ runtimeContext: RuntimeContext;
97
110
  }) => Promise<any>;
98
111
 
99
- export declare function generateHandler({ mastra, agentId, body, }: Context & {
112
+ export declare function generateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
113
+ runtimeContext: RuntimeContext;
100
114
  agentId: string;
101
115
  body: GetBody<'generate'> & {
102
116
  resourceid?: string;
103
117
  };
104
118
  }): Promise<GenerateTextResult<any, any>>;
105
119
 
106
- export declare function generateHandler_alias_1({ mastra, networkId, body, }: NetworkContext & {
120
+ export declare function generateHandler_alias_1({ mastra, runtimeContext, networkId, body, }: NetworkContext & {
121
+ runtimeContext: RuntimeContext;
107
122
  body: {
108
123
  messages?: Parameters<AgentNetwork['generate']>[0];
109
124
  } & Parameters<AgentNetwork['generate']>[1];
@@ -117,11 +132,10 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
117
132
  text?: string;
118
133
  speakerId?: string;
119
134
  };
120
- }): Promise<{
121
- audioData: Buffer<ArrayBuffer>;
122
- }>;
135
+ }): Promise<NodeJS.ReadableStream>;
123
136
 
124
- export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
137
+ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
138
+ runtimeContext: RuntimeContext;
125
139
  agentId: string;
126
140
  }): Promise<{
127
141
  name: any;
@@ -131,7 +145,9 @@ export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
131
145
  modelId: string;
132
146
  }>;
133
147
 
134
- export declare function getAgentsHandler({ mastra }: Context): Promise<any>;
148
+ export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
149
+ runtimeContext: RuntimeContext;
150
+ }): Promise<any>;
135
151
 
136
152
  declare type GetBody<T extends keyof Agent & {
137
153
  [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
@@ -139,7 +155,8 @@ declare type GetBody<T extends keyof Agent & {
139
155
  messages: Parameters<Agent[T]>[0];
140
156
  } & Parameters<Agent[T]>[1];
141
157
 
142
- export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
158
+ export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
159
+ runtimeContext: RuntimeContext;
143
160
  agentId: string;
144
161
  }): Promise<{
145
162
  id: string;
@@ -148,7 +165,8 @@ export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context &
148
165
  evals: EvalRow[];
149
166
  }>;
150
167
 
151
- export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Context & {
168
+ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
169
+ runtimeContext: RuntimeContext;
152
170
  agentId: string;
153
171
  }): Promise<{
154
172
  id: string;
@@ -159,7 +177,7 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Contex
159
177
 
160
178
  export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<BaseLogMessage[] | undefined>;
161
179
 
162
- export declare function getLogsHandler({ mastra, transportId }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
180
+ export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
163
181
 
164
182
  export declare function getLogTransports({ mastra }: Pick<LogsContext, 'mastra'>): Promise<{
165
183
  transports: string[];
@@ -174,7 +192,7 @@ export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<
174
192
  uiMessages: Message[];
175
193
  }>;
176
194
 
177
- export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<NetworkContext, 'mastra' | 'networkId'>): Promise<{
195
+ export declare function getNetworkByIdHandler({ mastra, networkId, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'networkId' | 'runtimeContext'>): Promise<{
178
196
  id: string;
179
197
  name: string;
180
198
  instructions: string;
@@ -189,7 +207,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
189
207
  };
190
208
  }>;
191
209
 
192
- export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
210
+ export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
193
211
  id: string;
194
212
  name: string;
195
213
  instructions: string;
@@ -221,6 +239,26 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
221
239
 
222
240
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
223
241
 
242
+ export declare function getVNextWorkflowByIdHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<{
243
+ steps: any;
244
+ name: string | undefined;
245
+ stepGraph: SerializedStepFlowEntry[];
246
+ inputSchema: string | undefined;
247
+ outputSchema: string | undefined;
248
+ }>;
249
+
250
+ export declare function getVNextWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<NewWorkflow['getWorkflowRun']>>;
251
+
252
+ export declare function getVNextWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: VNextWorkflowContext & {
253
+ fromDate?: Date;
254
+ toDate?: Date;
255
+ limit?: number;
256
+ offset?: number;
257
+ resourceId?: string;
258
+ }): Promise<WorkflowRuns>;
259
+
260
+ export declare function getVNextWorkflowsHandler({ mastra }: VNextWorkflowContext): Promise<any>;
261
+
224
262
  export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
225
263
  stepGraph: StepGraph;
226
264
  stepSubscriberGraph: Record<string, StepGraph>;
@@ -233,7 +271,13 @@ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowC
233
271
 
234
272
  export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
235
273
 
236
- export declare function getWorkflowRunsHandler({ mastra, workflowId }: WorkflowContext): Promise<WorkflowRuns>;
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>;
237
281
 
238
282
  export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
239
283
 
@@ -346,6 +390,7 @@ export declare namespace network {
346
390
 
347
391
  declare interface NetworkContext extends Context {
348
392
  networkId?: string;
393
+ runtimeContext: RuntimeContext;
349
394
  }
350
395
 
351
396
  declare interface QueryRequest {
@@ -362,18 +407,38 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
362
407
 
363
408
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
364
409
 
365
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, }: WorkflowContext & {
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 & {
366
419
  body: {
367
420
  stepId: string;
368
421
  context: any;
369
422
  };
423
+ runtimeContext: RuntimeContext;
370
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>;
371
425
 
372
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, }: WorkflowContext & {
426
+ export declare function resumeVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
427
+ body: {
428
+ step: string | string[];
429
+ resumeData?: unknown;
430
+ };
431
+ runtimeContext?: RuntimeContext_2;
432
+ }): Promise<{
433
+ message: string;
434
+ }>;
435
+
436
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
373
437
  body: {
374
438
  stepId: string;
375
439
  context: any;
376
440
  };
441
+ runtimeContext: RuntimeContext;
377
442
  }): Promise<{
378
443
  message: string;
379
444
  }>;
@@ -386,12 +451,26 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
386
451
 
387
452
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
388
453
 
389
- export declare function startAsyncWorkflowHandler({ mastra, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
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>[]>>;
458
+
459
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
390
460
  triggerData?: unknown;
461
+ runtimeContext: RuntimeContext;
391
462
  }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
392
463
 
393
- export declare function startWorkflowRunHandler({ mastra, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
464
+ export declare function startVNextWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
465
+ inputData?: unknown;
466
+ runtimeContext?: RuntimeContext_2;
467
+ }): Promise<{
468
+ message: string;
469
+ }>;
470
+
471
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
394
472
  triggerData?: unknown;
473
+ runtimeContext: RuntimeContext;
395
474
  }): Promise<{
396
475
  message: string;
397
476
  }>;
@@ -415,14 +494,16 @@ export declare function storeTelemetryHandler({ mastra, body }: Context & {
415
494
  traceCount: number;
416
495
  }>;
417
496
 
418
- export declare function streamGenerateHandler({ mastra, agentId, body, }: Context & {
497
+ export declare function streamGenerateHandler({ mastra, runtimeContext, agentId, body, }: Context & {
498
+ runtimeContext: RuntimeContext;
419
499
  agentId: string;
420
500
  body: GetBody<'stream'> & {
421
501
  resourceid?: string;
422
502
  };
423
503
  }): Promise<Response | undefined>;
424
504
 
425
- export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, }: NetworkContext & {
505
+ export declare function streamGenerateHandler_alias_1({ mastra, networkId, body, runtimeContext, }: NetworkContext & {
506
+ runtimeContext: RuntimeContext;
426
507
  body: {
427
508
  messages?: Parameters<AgentNetwork['stream']>[0];
428
509
  } & Parameters<AgentNetwork['stream']>[1];
@@ -444,6 +525,8 @@ declare interface TelemetryContext extends Context {
444
525
  page?: number;
445
526
  perPage?: number;
446
527
  attribute?: string | string[];
528
+ fromDate?: Date;
529
+ toDate?: Date;
447
530
  };
448
531
  }
449
532
 
@@ -526,6 +609,26 @@ declare interface VectorContext extends Context {
526
609
  vectorName?: string;
527
610
  }
528
611
 
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
+
529
632
  export declare namespace voice {
530
633
  export {
531
634
  getSpeakersHandler,
@@ -538,10 +641,11 @@ declare interface VoiceContext extends Context {
538
641
  agentId?: string;
539
642
  }
540
643
 
644
+ export declare function watchVNextWorkflowHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
645
+
541
646
  export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
542
647
 
543
- declare interface WorkflowContext {
544
- mastra: Mastra_2;
648
+ declare interface WorkflowContext extends Context {
545
649
  workflowId?: string;
546
650
  runId?: string;
547
651
  }