@mastra/server 2.0.5-alpha.0 → 2.1.0-alpha.1

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.
@@ -8,24 +8,26 @@ import type { CoreMessage as CoreMessage_2 } from '@mastra/core/llm';
8
8
  import { EvalRow } from '@mastra/core/storage';
9
9
  import { GenerateObjectResult } from 'ai';
10
10
  import { GenerateTextResult } from 'ai';
11
+ import type { IMastraLogger } from '@mastra/core/logger';
11
12
  import type { JSONRPCError } from '@mastra/core/a2a';
12
13
  import { JSONRPCResponse } from '@mastra/core/a2a';
13
- import type { Logger } from '@mastra/core/logger';
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';
14
18
  import type { Mastra } from '@mastra/core/mastra';
15
19
  import type { MastraMemory } from '@mastra/core/memory';
16
20
  import { Message } from 'ai';
17
21
  import type { Message as Message_2 } from '@mastra/core/a2a';
18
22
  import { MessageType } from '@mastra/core/memory';
19
- import { NewStep } from '@mastra/core/workflows/vNext';
20
- import type { NewWorkflow } from '@mastra/core/workflows/vNext';
21
23
  import type { QueryResult } from '@mastra/core/vector';
22
24
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
23
25
  import { RuntimeContext } from '@mastra/core/runtime-context';
24
26
  import { RuntimeContext as RuntimeContext_2 } from '@mastra/core/di';
25
- import type { SerializedStepFlowEntry } from '@mastra/core/workflows/vNext';
27
+ import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
26
28
  import { Step } from '@mastra/core/workflows';
27
- import { StepExecutionContext } from '@mastra/core/workflows';
28
- import { StepGraph } from '@mastra/core/workflows';
29
+ import { StepExecutionContext } from '@mastra/core/workflows/legacy';
30
+ import { StepGraph } from '@mastra/core/workflows/legacy';
29
31
  import { StorageThreadType } from '@mastra/core/memory';
30
32
  import { Task } from '@mastra/core/a2a';
31
33
  import { TaskAndHistory } from '@mastra/core/a2a';
@@ -36,11 +38,9 @@ import type { TaskSendParams } from '@mastra/core/a2a';
36
38
  import type { TaskStatus } from '@mastra/core/a2a';
37
39
  import type { ToolAction } from '@mastra/core/tools';
38
40
  import type { VercelTool } from '@mastra/core/tools';
39
- import type { VNextWorkflowRuns } from '@mastra/core/storage';
40
41
  import type { Workflow } from '@mastra/core/workflows';
41
- import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
42
- import { WorkflowResult } from '@mastra/core/workflows/vNext';
43
- import { WorkflowRunResult } from '@mastra/core/workflows';
42
+ import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows/legacy';
43
+ import { WorkflowResult } from '@mastra/core/workflows';
44
44
  import type { WorkflowRuns } from '@mastra/core/storage';
45
45
  import { ZodType } from 'zod';
46
46
  import { ZodTypeDef } from 'zod';
@@ -96,7 +96,7 @@ declare interface CreateIndexRequest {
96
96
  metric?: 'cosine' | 'euclidean' | 'dotproduct';
97
97
  }
98
98
 
99
- export declare function createRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
99
+ export declare function createLegacyWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
100
100
  runId: string;
101
101
  }>;
102
102
 
@@ -115,7 +115,7 @@ export declare function createThreadHandler({ mastra, agentId, body, }: Pick<Mem
115
115
  };
116
116
  }): Promise<StorageThreadType>;
117
117
 
118
- export declare function createVNextWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<{
118
+ export declare function createWorkflowRunHandler({ mastra, workflowId, runId: prevRunId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<{
119
119
  runId: string;
120
120
  }>;
121
121
 
@@ -208,7 +208,7 @@ export declare function getAgentExecutionHandler({ requestId, mastra, agentId, r
208
208
  method: 'tasks/send' | 'tasks/sendSubscribe' | 'tasks/get' | 'tasks/cancel';
209
209
  params: TaskSendParams | TaskQueryParams | TaskIdParams;
210
210
  taskStore?: InMemoryTaskStore;
211
- logger?: Logger;
211
+ logger?: IMastraLogger;
212
212
  }): Promise<any>;
213
213
 
214
214
  export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
@@ -231,6 +231,28 @@ export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agent
231
231
  evals: EvalRow[];
232
232
  }>;
233
233
 
234
+ export declare function getLegacyWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
235
+ stepGraph: StepGraph;
236
+ stepSubscriberGraph: Record<string, StepGraph>;
237
+ serializedStepGraph: StepGraph;
238
+ serializedStepSubscriberGraph: Record<string, StepGraph>;
239
+ name: string;
240
+ triggerSchema: string | undefined;
241
+ steps: any;
242
+ }>;
243
+
244
+ export declare function getLegacyWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<LegacyWorkflow['getRun']>>;
245
+
246
+ export declare function getLegacyWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
247
+ fromDate?: Date;
248
+ toDate?: Date;
249
+ limit?: number;
250
+ offset?: number;
251
+ resourceId?: string;
252
+ }): Promise<LegacyWorkflowRuns>;
253
+
254
+ export declare function getLegacyWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
255
+
234
256
  export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
235
257
  runtimeContext: RuntimeContext;
236
258
  agentId: string;
@@ -241,7 +263,7 @@ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, a
241
263
  evals: EvalRow[];
242
264
  }>;
243
265
 
244
- export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<BaseLogMessage[] | undefined>;
266
+ export declare function getLogsByRunIdHandler({ mastra, runId, transportId, }: Pick<LogsContext, 'mastra' | 'runId' | 'transportId'>): Promise<any[]>;
245
267
 
246
268
  export declare function getLogsHandler({ mastra, transportId, }: Pick<LogsContext, 'mastra' | 'transportId'>): Promise<BaseLogMessage[]>;
247
269
 
@@ -307,39 +329,18 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
307
329
 
308
330
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
309
331
 
310
- export declare function getVNextWorkflowByIdHandler({ mastra, workflowId }: VNextWorkflowContext): Promise<{
332
+ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext_3): Promise<{
311
333
  steps: SerializedStep[];
312
334
  name: string | undefined;
335
+ description: string | undefined;
313
336
  stepGraph: SerializedStepFlowEntry[];
314
337
  inputSchema: string | undefined;
315
338
  outputSchema: string | undefined;
316
339
  }>;
317
340
 
318
- export declare function getVNextWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<NewWorkflow['getWorkflowRunById']>>;
319
-
320
- export declare function getVNextWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: VNextWorkflowContext & {
321
- fromDate?: Date;
322
- toDate?: Date;
323
- limit?: number;
324
- offset?: number;
325
- resourceId?: string;
326
- }): Promise<VNextWorkflowRuns>;
327
-
328
- export declare function getVNextWorkflowsHandler({ mastra }: VNextWorkflowContext): Promise<any>;
329
-
330
- export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
331
- stepGraph: StepGraph;
332
- stepSubscriberGraph: Record<string, StepGraph>;
333
- serializedStepGraph: StepGraph;
334
- serializedStepSubscriberGraph: Record<string, StepGraph>;
335
- name: string;
336
- triggerSchema: string | undefined;
337
- steps: any;
338
- }>;
339
-
340
- export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
341
+ export declare function getWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getWorkflowRunById']>>;
341
342
 
342
- export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext & {
343
+ export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, toDate, limit, offset, resourceId, }: WorkflowContext_3 & {
343
344
  fromDate?: Date;
344
345
  toDate?: Date;
345
346
  limit?: number;
@@ -347,7 +348,7 @@ export declare function getWorkflowRunsHandler({ mastra, workflowId, fromDate, t
347
348
  resourceId?: string;
348
349
  }): Promise<WorkflowRuns>;
349
350
 
350
- export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
351
+ export declare function getWorkflowsHandler({ mastra }: WorkflowContext_3): Promise<any>;
351
352
 
352
353
  export declare function handleError(error: unknown, defaultMessage: string): never;
353
354
 
@@ -356,7 +357,7 @@ export declare function handleTaskCancel({ requestId, taskStore, agentId, taskId
356
357
  taskStore: InMemoryTaskStore;
357
358
  agentId: string;
358
359
  taskId: string;
359
- logger?: Logger;
360
+ logger?: IMastraLogger;
360
361
  }): Promise<JSONRPCResponse<Task, unknown>>;
361
362
 
362
363
  export declare function handleTaskGet({ requestId, taskStore, agentId, taskId, }: {
@@ -371,7 +372,7 @@ export declare function handleTaskSend({ requestId, params, taskStore, agent, lo
371
372
  params: TaskSendParams;
372
373
  taskStore: InMemoryTaskStore;
373
374
  agent: Agent;
374
- logger?: Logger;
375
+ logger?: IMastraLogger;
375
376
  runtimeContext: RuntimeContext;
376
377
  }): Promise<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown>>;
377
378
 
@@ -380,7 +381,7 @@ export declare function handleTaskSendSubscribe({ requestId, params, taskStore,
380
381
  params: TaskSendParams;
381
382
  taskStore: InMemoryTaskStore;
382
383
  agent: Agent;
383
- logger?: Logger;
384
+ logger?: IMastraLogger;
384
385
  runtimeContext: RuntimeContext;
385
386
  }): AsyncGenerator<JSONRPCResponse<null, unknown> | JSONRPCResponse<Task, unknown> | JSONRPCResponse< {
386
387
  state: string;
@@ -467,6 +468,21 @@ export declare class InMemoryTaskStore {
467
468
  }): Promise<void>;
468
469
  }
469
470
 
471
+ export declare namespace legacyWorkflows {
472
+ export {
473
+ getLegacyWorkflowsHandler,
474
+ getLegacyWorkflowByIdHandler,
475
+ startAsyncLegacyWorkflowHandler,
476
+ getLegacyWorkflowRunHandler,
477
+ createLegacyWorkflowRunHandler,
478
+ startLegacyWorkflowRunHandler,
479
+ watchLegacyWorkflowHandler,
480
+ resumeAsyncLegacyWorkflowHandler,
481
+ resumeLegacyWorkflowHandler,
482
+ getLegacyWorkflowRunsHandler
483
+ }
484
+ }
485
+
470
486
  export declare function listIndexes({ mastra, vectorName }: Pick<VectorContext, 'mastra' | 'vectorName'>): Promise<string[]>;
471
487
 
472
488
  export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore, message, sessionId, metadata, logger, }: {
@@ -476,7 +492,7 @@ export declare function loadOrCreateTaskAndHistory({ agentId, taskId, taskStore,
476
492
  message: Message_2;
477
493
  sessionId?: string | null;
478
494
  metadata?: Record<string, unknown> | null;
479
- logger?: Logger;
495
+ logger?: IMastraLogger;
480
496
  }): Promise<TaskAndHistory>;
481
497
 
482
498
  export declare namespace logs {
@@ -526,7 +542,7 @@ declare interface NetworkContext extends Context {
526
542
  runtimeContext: RuntimeContext;
527
543
  }
528
544
 
529
- export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: Logger): JSONRPCResponse<null, unknown>;
545
+ export declare function normalizeError(error: any, reqId: number | string | null, taskId?: string, logger?: IMastraLogger): JSONRPCResponse<null, unknown>;
530
546
 
531
547
  declare interface QueryRequest {
532
548
  indexName: string;
@@ -542,39 +558,39 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
542
558
 
543
559
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
544
560
 
545
- export declare function resumeAsyncVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, runtimeContextFromRequest, }: VNextWorkflowContext & {
561
+ export declare function resumeAsyncLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
562
+ body: {
563
+ stepId: string;
564
+ context: any;
565
+ };
566
+ runtimeContext: RuntimeContext;
567
+ }): Promise<Omit<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
568
+
569
+ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, runtimeContextFromRequest, }: WorkflowContext_3 & {
546
570
  body: {
547
571
  step: string | string[];
548
572
  resumeData?: unknown;
549
573
  };
550
574
  runtimeContext?: RuntimeContext_2;
551
575
  runtimeContextFromRequest?: Record<string, unknown>;
552
- }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
576
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
553
577
 
554
- export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
578
+ export declare function resumeLegacyWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
555
579
  body: {
556
580
  stepId: string;
557
581
  context: any;
558
582
  };
559
583
  runtimeContext: RuntimeContext;
560
- }): Promise<Omit<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>, "runId"> | undefined>;
561
-
562
- export declare function resumeVNextWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: VNextWorkflowContext & {
563
- body: {
564
- step: string | string[];
565
- resumeData?: unknown;
566
- };
567
- runtimeContext?: RuntimeContext_2;
568
584
  }): Promise<{
569
585
  message: string;
570
586
  }>;
571
587
 
572
- export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
588
+ export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext_3 & {
573
589
  body: {
574
- stepId: string;
575
- context: any;
590
+ step: string | string[];
591
+ resumeData?: unknown;
576
592
  };
577
- runtimeContext: RuntimeContext;
593
+ runtimeContext?: RuntimeContext_2;
578
594
  }): Promise<{
579
595
  message: string;
580
596
  }>;
@@ -596,28 +612,28 @@ declare type SerializedStep = {
596
612
 
597
613
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
598
614
 
599
- export declare function startAsyncVNextWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
600
- inputData?: unknown;
601
- runtimeContext?: RuntimeContext_2;
602
- runtimeContextFromRequest?: Record<string, unknown>;
603
- }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, NewStep<string, any, any, any, any>[]>>;
604
-
605
- export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
615
+ export declare function startAsyncLegacyWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
606
616
  triggerData?: unknown;
607
617
  runtimeContext: RuntimeContext;
608
- }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
618
+ }): Promise<LegacyWorkflowRunResult<any, LegacyStep<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, LegacyStep<string, any, any, any>[], Record<string, any>>>>[], any>>;
609
619
 
610
- export declare function startVNextWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
620
+ export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
611
621
  inputData?: unknown;
612
622
  runtimeContext?: RuntimeContext_2;
613
623
  runtimeContextFromRequest?: Record<string, unknown>;
624
+ }): Promise<WorkflowResult<ZodType<any, ZodTypeDef, any>, Step<string, any, any, any, any>[]>>;
625
+
626
+ export declare function startLegacyWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
627
+ triggerData?: unknown;
628
+ runtimeContext: RuntimeContext;
614
629
  }): Promise<{
615
630
  message: string;
616
631
  }>;
617
632
 
618
- export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
619
- triggerData?: unknown;
620
- runtimeContext: RuntimeContext;
633
+ export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, inputData, runtimeContextFromRequest, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'> & {
634
+ inputData?: unknown;
635
+ runtimeContext?: RuntimeContext_2;
636
+ runtimeContextFromRequest?: Record<string, unknown>;
621
637
  }): Promise<{
622
638
  message: string;
623
639
  }>;
@@ -757,26 +773,6 @@ declare interface VectorContext extends Context {
757
773
  vectorName?: string;
758
774
  }
759
775
 
760
- declare interface VNextWorkflowContext extends Context {
761
- workflowId?: string;
762
- runId?: string;
763
- }
764
-
765
- export declare namespace vNextWorkflows {
766
- export {
767
- getVNextWorkflowsHandler,
768
- getVNextWorkflowByIdHandler,
769
- getVNextWorkflowRunByIdHandler,
770
- createVNextWorkflowRunHandler,
771
- startAsyncVNextWorkflowHandler,
772
- startVNextWorkflowRunHandler,
773
- watchVNextWorkflowHandler,
774
- resumeAsyncVNextWorkflowHandler,
775
- resumeVNextWorkflowHandler,
776
- getVNextWorkflowRunsHandler
777
- }
778
- }
779
-
780
776
  export declare namespace voice {
781
777
  export {
782
778
  getSpeakersHandler,
@@ -789,22 +785,27 @@ declare interface VoiceContext extends Context {
789
785
  agentId?: string;
790
786
  }
791
787
 
792
- export declare function watchVNextWorkflowHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
788
+ export declare function watchLegacyWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
793
789
 
794
- export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
790
+ export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext_3, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
795
791
 
796
792
  declare interface WorkflowContext extends Context {
797
793
  workflowId?: string;
798
794
  runId?: string;
799
795
  }
800
796
 
797
+ declare interface WorkflowContext_3 extends Context {
798
+ workflowId?: string;
799
+ runId?: string;
800
+ }
801
+
801
802
  export declare namespace workflows {
802
803
  export {
803
804
  getWorkflowsHandler,
804
805
  getWorkflowByIdHandler,
806
+ getWorkflowRunByIdHandler,
807
+ createWorkflowRunHandler,
805
808
  startAsyncWorkflowHandler,
806
- getWorkflowRunHandler,
807
- createRunHandler,
808
809
  startWorkflowRunHandler,
809
810
  watchWorkflowHandler,
810
811
  resumeAsyncWorkflowHandler,