@mastra/server 0.0.0-switch-to-core-20250424015131 → 0.0.0-trigger-playground-ui-package-20250506151043

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.
@@ -9,9 +9,13 @@ import type { Mastra } from '@mastra/core/mastra';
9
9
  import type { MastraMemory } from '@mastra/core/memory';
10
10
  import { Message } from 'ai';
11
11
  import { MessageType } from '@mastra/core/memory';
12
+ import { NewStep } from '@mastra/core/workflows/vNext';
13
+ import type { NewWorkflow } from '@mastra/core/workflows/vNext';
12
14
  import type { QueryResult } from '@mastra/core/vector';
13
15
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
14
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';
15
19
  import { Step } from '@mastra/core/workflows';
16
20
  import { StepExecutionContext } from '@mastra/core/workflows';
17
21
  import { StepGraph } from '@mastra/core/workflows';
@@ -20,8 +24,11 @@ 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
26
  import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
27
+ import { WorkflowResult } from '@mastra/core/workflows/vNext';
23
28
  import { WorkflowRunResult } from '@mastra/core/workflows';
24
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<{
@@ -123,7 +134,8 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
123
134
  };
124
135
  }): Promise<NodeJS.ReadableStream>;
125
136
 
126
- export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
137
+ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
138
+ runtimeContext: RuntimeContext;
127
139
  agentId: string;
128
140
  }): Promise<{
129
141
  name: any;
@@ -133,7 +145,9 @@ export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
133
145
  modelId: string;
134
146
  }>;
135
147
 
136
- export declare function getAgentsHandler({ mastra }: Context): Promise<any>;
148
+ export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
149
+ runtimeContext: RuntimeContext;
150
+ }): Promise<any>;
137
151
 
138
152
  declare type GetBody<T extends keyof Agent & {
139
153
  [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
@@ -141,7 +155,8 @@ declare type GetBody<T extends keyof Agent & {
141
155
  messages: Parameters<Agent[T]>[0];
142
156
  } & Parameters<Agent[T]>[1];
143
157
 
144
- export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
158
+ export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
159
+ runtimeContext: RuntimeContext;
145
160
  agentId: string;
146
161
  }): Promise<{
147
162
  id: string;
@@ -150,7 +165,8 @@ export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context &
150
165
  evals: EvalRow[];
151
166
  }>;
152
167
 
153
- export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Context & {
168
+ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
169
+ runtimeContext: RuntimeContext;
154
170
  agentId: string;
155
171
  }): Promise<{
156
172
  id: string;
@@ -176,7 +192,7 @@ export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<
176
192
  uiMessages: Message[];
177
193
  }>;
178
194
 
179
- 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<{
180
196
  id: string;
181
197
  name: string;
182
198
  instructions: string;
@@ -191,7 +207,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
191
207
  };
192
208
  }>;
193
209
 
194
- export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
210
+ export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
195
211
  id: string;
196
212
  name: string;
197
213
  instructions: string;
@@ -223,6 +239,26 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
223
239
 
224
240
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
225
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 getVNextWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<NewWorkflow['getWorkflowRunById']>>;
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
+
226
262
  export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
227
263
  stepGraph: StepGraph;
228
264
  stepSubscriberGraph: Record<string, StepGraph>;
@@ -235,7 +271,13 @@ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowC
235
271
 
236
272
  export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
237
273
 
238
- 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>;
239
281
 
240
282
  export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
241
283
 
@@ -348,6 +390,7 @@ export declare namespace network {
348
390
 
349
391
  declare interface NetworkContext extends Context {
350
392
  networkId?: string;
393
+ runtimeContext: RuntimeContext;
351
394
  }
352
395
 
353
396
  declare interface QueryRequest {
@@ -364,6 +407,14 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
364
407
 
365
408
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
366
409
 
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
+
367
418
  export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
368
419
  body: {
369
420
  stepId: string;
@@ -372,6 +423,16 @@ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId,
372
423
  runtimeContext: RuntimeContext;
373
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>;
374
425
 
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
+
375
436
  export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
376
437
  body: {
377
438
  stepId: string;
@@ -390,11 +451,23 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
390
451
 
391
452
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
392
453
 
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
+
393
459
  export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
394
460
  triggerData?: unknown;
395
461
  runtimeContext: RuntimeContext;
396
462
  }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
397
463
 
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
+
398
471
  export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
399
472
  triggerData?: unknown;
400
473
  runtimeContext: RuntimeContext;
@@ -452,6 +525,8 @@ declare interface TelemetryContext extends Context {
452
525
  page?: number;
453
526
  perPage?: number;
454
527
  attribute?: string | string[];
528
+ fromDate?: Date;
529
+ toDate?: Date;
455
530
  };
456
531
  }
457
532
 
@@ -534,6 +609,26 @@ declare interface VectorContext extends Context {
534
609
  vectorName?: string;
535
610
  }
536
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
+ getVNextWorkflowRunByIdHandler,
622
+ createVNextWorkflowRunHandler,
623
+ startAsyncVNextWorkflowHandler,
624
+ startVNextWorkflowRunHandler,
625
+ watchVNextWorkflowHandler,
626
+ resumeAsyncVNextWorkflowHandler,
627
+ resumeVNextWorkflowHandler,
628
+ getVNextWorkflowRunsHandler
629
+ }
630
+ }
631
+
537
632
  export declare namespace voice {
538
633
  export {
539
634
  getSpeakersHandler,
@@ -546,6 +641,8 @@ declare interface VoiceContext extends Context {
546
641
  agentId?: string;
547
642
  }
548
643
 
644
+ export declare function watchVNextWorkflowHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
645
+
549
646
  export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
550
647
 
551
648
  declare interface WorkflowContext extends Context {
@@ -9,9 +9,13 @@ import type { Mastra } from '@mastra/core/mastra';
9
9
  import type { MastraMemory } from '@mastra/core/memory';
10
10
  import { Message } from 'ai';
11
11
  import { MessageType } from '@mastra/core/memory';
12
+ import { NewStep } from '@mastra/core/workflows/vNext';
13
+ import type { NewWorkflow } from '@mastra/core/workflows/vNext';
12
14
  import type { QueryResult } from '@mastra/core/vector';
13
15
  import { ReadableStream as ReadableStream_2 } from 'node:stream/web';
14
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';
15
19
  import { Step } from '@mastra/core/workflows';
16
20
  import { StepExecutionContext } from '@mastra/core/workflows';
17
21
  import { StepGraph } from '@mastra/core/workflows';
@@ -20,8 +24,11 @@ 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
26
  import { WorkflowContext as WorkflowContext_2 } from '@mastra/core/workflows';
27
+ import { WorkflowResult } from '@mastra/core/workflows/vNext';
23
28
  import { WorkflowRunResult } from '@mastra/core/workflows';
24
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<{
@@ -123,7 +134,8 @@ export declare function generateSpeechHandler({ mastra, agentId, body, }: VoiceC
123
134
  };
124
135
  }): Promise<NodeJS.ReadableStream>;
125
136
 
126
- export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
137
+ export declare function getAgentByIdHandler({ mastra, runtimeContext, agentId, }: Context & {
138
+ runtimeContext: RuntimeContext;
127
139
  agentId: string;
128
140
  }): Promise<{
129
141
  name: any;
@@ -133,7 +145,9 @@ export declare function getAgentByIdHandler({ mastra, agentId }: Context & {
133
145
  modelId: string;
134
146
  }>;
135
147
 
136
- export declare function getAgentsHandler({ mastra }: Context): Promise<any>;
148
+ export declare function getAgentsHandler({ mastra, runtimeContext }: Context & {
149
+ runtimeContext: RuntimeContext;
150
+ }): Promise<any>;
137
151
 
138
152
  declare type GetBody<T extends keyof Agent & {
139
153
  [K in keyof Agent]: Agent[K] extends (...args: any) => any ? K : never;
@@ -141,7 +155,8 @@ declare type GetBody<T extends keyof Agent & {
141
155
  messages: Parameters<Agent[T]>[0];
142
156
  } & Parameters<Agent[T]>[1];
143
157
 
144
- export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context & {
158
+ export declare function getEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
159
+ runtimeContext: RuntimeContext;
145
160
  agentId: string;
146
161
  }): Promise<{
147
162
  id: string;
@@ -150,7 +165,8 @@ export declare function getEvalsByAgentIdHandler({ mastra, agentId }: Context &
150
165
  evals: EvalRow[];
151
166
  }>;
152
167
 
153
- export declare function getLiveEvalsByAgentIdHandler({ mastra, agentId }: Context & {
168
+ export declare function getLiveEvalsByAgentIdHandler({ mastra, runtimeContext, agentId, }: Context & {
169
+ runtimeContext: RuntimeContext;
154
170
  agentId: string;
155
171
  }): Promise<{
156
172
  id: string;
@@ -176,7 +192,7 @@ export declare function getMessagesHandler({ mastra, agentId, threadId, }: Pick<
176
192
  uiMessages: Message[];
177
193
  }>;
178
194
 
179
- 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<{
180
196
  id: string;
181
197
  name: string;
182
198
  instructions: string;
@@ -191,7 +207,7 @@ export declare function getNetworkByIdHandler({ mastra, networkId }: Pick<Networ
191
207
  };
192
208
  }>;
193
209
 
194
- export declare function getNetworksHandler({ mastra }: Pick<NetworkContext, 'mastra'>): Promise<{
210
+ export declare function getNetworksHandler({ mastra, runtimeContext, }: Pick<NetworkContext, 'mastra' | 'runtimeContext'>): Promise<{
195
211
  id: string;
196
212
  name: string;
197
213
  instructions: string;
@@ -223,6 +239,26 @@ export declare function getToolByIdHandler({ tools, toolId }: Pick<ToolsContext,
223
239
 
224
240
  export declare function getToolsHandler({ tools }: Pick<ToolsContext, 'tools'>): Promise<Record<string, any>>;
225
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 getVNextWorkflowRunByIdHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<NewWorkflow['getWorkflowRunById']>>;
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
+
226
262
  export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowContext): Promise<{
227
263
  stepGraph: StepGraph;
228
264
  stepSubscriberGraph: Record<string, StepGraph>;
@@ -235,7 +271,13 @@ export declare function getWorkflowByIdHandler({ mastra, workflowId }: WorkflowC
235
271
 
236
272
  export declare function getWorkflowRunHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReturnType<Workflow['getRun']>>;
237
273
 
238
- 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>;
239
281
 
240
282
  export declare function getWorkflowsHandler({ mastra }: WorkflowContext): Promise<any>;
241
283
 
@@ -348,6 +390,7 @@ export declare namespace network {
348
390
 
349
391
  declare interface NetworkContext extends Context {
350
392
  networkId?: string;
393
+ runtimeContext: RuntimeContext;
351
394
  }
352
395
 
353
396
  declare interface QueryRequest {
@@ -364,6 +407,14 @@ export declare function queryVectors({ mastra, vectorName, query, }: Pick<Vector
364
407
 
365
408
  declare type RedirectStatusCode = 300 | 301 | 302 | 303 | 304 | DeprecatedStatusCode | 307 | 308;
366
409
 
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
+
367
418
  export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
368
419
  body: {
369
420
  stepId: string;
@@ -372,6 +423,16 @@ export declare function resumeAsyncWorkflowHandler({ mastra, workflowId, runId,
372
423
  runtimeContext: RuntimeContext;
373
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>;
374
425
 
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
+
375
436
  export declare function resumeWorkflowHandler({ mastra, workflowId, runId, body, runtimeContext, }: WorkflowContext & {
376
437
  body: {
377
438
  stepId: string;
@@ -390,11 +451,23 @@ export declare function saveMessagesHandler({ mastra, agentId, body, }: Pick<Mem
390
451
 
391
452
  declare type ServerErrorStatusCode = 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
392
453
 
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
+
393
459
  export declare function startAsyncWorkflowHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
394
460
  triggerData?: unknown;
395
461
  runtimeContext: RuntimeContext;
396
462
  }): Promise<WorkflowRunResult<any, Step<string, any, any, StepExecutionContext<any, WorkflowContext_2<any, Step<string, any, any, any>[], Record<string, any>>>>[], any>>;
397
463
 
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
+
398
471
  export declare function startWorkflowRunHandler({ mastra, runtimeContext, workflowId, runId, triggerData, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'> & {
399
472
  triggerData?: unknown;
400
473
  runtimeContext: RuntimeContext;
@@ -452,6 +525,8 @@ declare interface TelemetryContext extends Context {
452
525
  page?: number;
453
526
  perPage?: number;
454
527
  attribute?: string | string[];
528
+ fromDate?: Date;
529
+ toDate?: Date;
455
530
  };
456
531
  }
457
532
 
@@ -534,6 +609,26 @@ declare interface VectorContext extends Context {
534
609
  vectorName?: string;
535
610
  }
536
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
+ getVNextWorkflowRunByIdHandler,
622
+ createVNextWorkflowRunHandler,
623
+ startAsyncVNextWorkflowHandler,
624
+ startVNextWorkflowRunHandler,
625
+ watchVNextWorkflowHandler,
626
+ resumeAsyncVNextWorkflowHandler,
627
+ resumeVNextWorkflowHandler,
628
+ getVNextWorkflowRunsHandler
629
+ }
630
+ }
631
+
537
632
  export declare namespace voice {
538
633
  export {
539
634
  getSpeakersHandler,
@@ -546,6 +641,8 @@ declare interface VoiceContext extends Context {
546
641
  agentId?: string;
547
642
  }
548
643
 
644
+ export declare function watchVNextWorkflowHandler({ mastra, workflowId, runId, }: Pick<VNextWorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
645
+
549
646
  export declare function watchWorkflowHandler({ mastra, workflowId, runId, }: Pick<WorkflowContext, 'mastra' | 'workflowId' | 'runId'>): Promise<ReadableStream_2<string>>;
550
647
 
551
648
  declare interface WorkflowContext extends Context {
@@ -32,7 +32,9 @@ async function getWorkflowsHandler({ mastra }) {
32
32
  steps: Object.entries(workflow.steps).reduce((acc2, [key2, step]) => {
33
33
  const _step = step;
34
34
  acc2[key2] = {
35
- ..._step,
35
+ id: _step.id,
36
+ description: _step.description,
37
+ workflowId: _step.workflowId,
36
38
  inputSchema: _step.inputSchema ? stringify(esm_default(_step.inputSchema)) : void 0,
37
39
  outputSchema: _step.outputSchema ? stringify(esm_default(_step.outputSchema)) : void 0
38
40
  };
@@ -65,7 +67,9 @@ async function getWorkflowByIdHandler({ mastra, workflowId }) {
65
67
  steps: Object.entries(workflow.steps).reduce((acc, [key, step]) => {
66
68
  const _step = step;
67
69
  acc[key] = {
68
- ..._step,
70
+ id: _step.id,
71
+ description: _step.description,
72
+ workflowId: _step.workflowId,
69
73
  inputSchema: _step.inputSchema ? stringify(esm_default(_step.inputSchema)) : void 0,
70
74
  outputSchema: _step.outputSchema ? stringify(esm_default(_step.outputSchema)) : void 0
71
75
  };
@@ -286,13 +290,21 @@ async function resumeWorkflowHandler({
286
290
  return handleError(error, "Error resuming workflow");
287
291
  }
288
292
  }
289
- async function getWorkflowRunsHandler({ mastra, workflowId }) {
293
+ async function getWorkflowRunsHandler({
294
+ mastra,
295
+ workflowId,
296
+ fromDate,
297
+ toDate,
298
+ limit,
299
+ offset,
300
+ resourceId
301
+ }) {
290
302
  try {
291
303
  if (!workflowId) {
292
304
  throw new HTTPException(400, { message: "Workflow ID is required" });
293
305
  }
294
306
  const workflow = mastra.getWorkflow(workflowId);
295
- const workflowRuns = await workflow.getWorkflowRuns() || {
307
+ const workflowRuns = await workflow.getWorkflowRuns({ fromDate, toDate, limit, offset, resourceId }) || {
296
308
  runs: [],
297
309
  total: 0
298
310
  };
@@ -15,27 +15,35 @@ chunkFV45V6WC_cjs.__export(agents_exports, {
15
15
  getLiveEvalsByAgentIdHandler: () => getLiveEvalsByAgentIdHandler,
16
16
  streamGenerateHandler: () => streamGenerateHandler
17
17
  });
18
- async function getAgentsHandler({ mastra }) {
18
+ async function getAgentsHandler({ mastra, runtimeContext }) {
19
19
  try {
20
20
  const agents = mastra.getAgents();
21
- const serializedAgents = Object.entries(agents).reduce((acc, [_id, _agent]) => {
22
- const agent = _agent;
23
- const serializedAgentTools = Object.entries(agent?.tools || {}).reduce((acc2, [key, tool]) => {
24
- const _tool = tool;
25
- acc2[key] = {
26
- ..._tool,
27
- inputSchema: _tool.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_tool.inputSchema)) : void 0,
28
- outputSchema: _tool.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_tool.outputSchema)) : void 0
21
+ const serializedAgentsMap = await Promise.all(
22
+ Object.entries(agents).map(async ([id, agent]) => {
23
+ const instructions = await agent.getInstructions({ runtimeContext });
24
+ const tools = await agent.getTools({ runtimeContext });
25
+ const llm = await agent.getLLM({ runtimeContext });
26
+ const serializedAgentTools = Object.entries(tools || {}).reduce((acc, [key, tool]) => {
27
+ const _tool = tool;
28
+ acc[key] = {
29
+ ..._tool,
30
+ inputSchema: _tool.inputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_tool.inputSchema)) : void 0,
31
+ outputSchema: _tool.outputSchema ? chunk5SWCVTNL_cjs.stringify(chunk5SWCVTNL_cjs.esm_default(_tool.outputSchema)) : void 0
32
+ };
33
+ return acc;
34
+ }, {});
35
+ return {
36
+ id,
37
+ name: agent.name,
38
+ instructions,
39
+ tools: serializedAgentTools,
40
+ provider: llm?.getProvider(),
41
+ modelId: llm?.getModelId()
29
42
  };
30
- return acc2;
31
- }, {});
32
- acc[_id] = {
33
- name: agent.name,
34
- instructions: agent.instructions,
35
- tools: serializedAgentTools,
36
- provider: agent.llm?.getProvider(),
37
- modelId: agent.llm?.getModelId()
38
- };
43
+ })
44
+ );
45
+ const serializedAgents = serializedAgentsMap.reduce((acc, { id, ...rest }) => {
46
+ acc[id] = rest;
39
47
  return acc;
40
48
  }, {});
41
49
  return serializedAgents;
@@ -43,13 +51,18 @@ async function getAgentsHandler({ mastra }) {
43
51
  return chunkZLBRQFDD_cjs.handleError(error, "Error getting agents");
44
52
  }
45
53
  }
46
- async function getAgentByIdHandler({ mastra, agentId }) {
54
+ async function getAgentByIdHandler({
55
+ mastra,
56
+ runtimeContext,
57
+ agentId
58
+ }) {
47
59
  try {
48
60
  const agent = mastra.getAgent(agentId);
49
61
  if (!agent) {
50
62
  throw new chunkFV45V6WC_cjs.HTTPException(404, { message: "Agent not found" });
51
63
  }
52
- const serializedAgentTools = Object.entries(agent?.tools || {}).reduce((acc, [key, tool]) => {
64
+ const tools = await agent.getTools({ runtimeContext });
65
+ const serializedAgentTools = Object.entries(tools || {}).reduce((acc, [key, tool]) => {
53
66
  const _tool = tool;
54
67
  acc[key] = {
55
68
  ..._tool,
@@ -58,39 +71,51 @@ async function getAgentByIdHandler({ mastra, agentId }) {
58
71
  };
59
72
  return acc;
60
73
  }, {});
74
+ const instructions = await agent.getInstructions({ runtimeContext });
75
+ const llm = await agent.getLLM({ runtimeContext });
61
76
  return {
62
77
  name: agent.name,
63
- instructions: agent.instructions,
78
+ instructions,
64
79
  tools: serializedAgentTools,
65
- provider: agent.llm?.getProvider(),
66
- modelId: agent.llm?.getModelId()
80
+ provider: llm?.getProvider(),
81
+ modelId: llm?.getModelId()
67
82
  };
68
83
  } catch (error) {
69
84
  return chunkZLBRQFDD_cjs.handleError(error, "Error getting agent");
70
85
  }
71
86
  }
72
- async function getEvalsByAgentIdHandler({ mastra, agentId }) {
87
+ async function getEvalsByAgentIdHandler({
88
+ mastra,
89
+ runtimeContext,
90
+ agentId
91
+ }) {
73
92
  try {
74
93
  const agent = mastra.getAgent(agentId);
75
94
  const evals = await mastra.getStorage()?.getEvalsByAgentName?.(agent.name, "test") || [];
95
+ const instructions = await agent.getInstructions({ runtimeContext });
76
96
  return {
77
97
  id: agentId,
78
98
  name: agent.name,
79
- instructions: agent.instructions,
99
+ instructions,
80
100
  evals
81
101
  };
82
102
  } catch (error) {
83
103
  return chunkZLBRQFDD_cjs.handleError(error, "Error getting test evals");
84
104
  }
85
105
  }
86
- async function getLiveEvalsByAgentIdHandler({ mastra, agentId }) {
106
+ async function getLiveEvalsByAgentIdHandler({
107
+ mastra,
108
+ runtimeContext,
109
+ agentId
110
+ }) {
87
111
  try {
88
112
  const agent = mastra.getAgent(agentId);
89
113
  const evals = await mastra.getStorage()?.getEvalsByAgentName?.(agent.name, "live") || [];
114
+ const instructions = await agent.getInstructions({ runtimeContext });
90
115
  return {
91
116
  id: agentId,
92
117
  name: agent.name,
93
- instructions: agent.instructions,
118
+ instructions,
94
119
  evals
95
120
  };
96
121
  } catch (error) {