@mastra/inngest 0.0.0-vnext-inngest-20250508122351 → 0.0.0-vnextAgentNetwork-20250527091247

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.
package/CHANGELOG.md CHANGED
@@ -1,12 +1,174 @@
1
1
  # @mastra/inngest
2
2
 
3
- ## 0.0.0-vnext-inngest-20250508122351
3
+ ## 0.0.0-vnextAgentNetwork-20250527091247
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - 200d0da: Return payload data, start time, end time, resume time and suspend time for each step in workflow state
8
+ Return error stack for failed workflow runs
9
+ - 5343f93: Move emitter to symbol to make private
10
+ - Updated dependencies [6d16390]
11
+ - Updated dependencies [1e4a421]
12
+ - Updated dependencies [200d0da]
13
+ - Updated dependencies [bf5f17b]
14
+ - Updated dependencies [5343f93]
15
+ - Updated dependencies [38aee50]
16
+ - Updated dependencies [5c41100]
17
+ - Updated dependencies [d6a759b]
18
+ - @mastra/core@0.0.0-vnextAgentNetwork-20250527091247
19
+
20
+ ## 0.10.0
21
+
22
+ ### Minor Changes
23
+
24
+ - 83da932: Move @mastra/core to peerdeps
25
+
26
+ ### Patch Changes
27
+
28
+ - b3a3d63: BREAKING: Make vnext workflow the default worklow, and old workflow legacy_workflow
29
+ - e4172d9: Update getWorkflowRuns type for inngest workflow
30
+ - Updated dependencies [b3a3d63]
31
+ - Updated dependencies [344f453]
32
+ - Updated dependencies [0a3ae6d]
33
+ - Updated dependencies [95911be]
34
+ - Updated dependencies [f53a6ac]
35
+ - Updated dependencies [5eb5a99]
36
+ - Updated dependencies [7e632c5]
37
+ - Updated dependencies [1e9fbfa]
38
+ - Updated dependencies [eabdcd9]
39
+ - Updated dependencies [90be034]
40
+ - Updated dependencies [99f050a]
41
+ - Updated dependencies [d0ee3c6]
42
+ - Updated dependencies [b2ae5aa]
43
+ - Updated dependencies [23f258c]
44
+ - Updated dependencies [a7292b0]
45
+ - Updated dependencies [0dcb9f0]
46
+ - Updated dependencies [2672a05]
47
+ - @mastra/core@0.10.0
48
+
49
+ ## 0.1.0-alpha.1
50
+
51
+ ### Minor Changes
52
+
53
+ - 83da932: Move @mastra/core to peerdeps
54
+
55
+ ### Patch Changes
56
+
57
+ - b3a3d63: BREAKING: Make vnext workflow the default worklow, and old workflow legacy_workflow
58
+ - Updated dependencies [b3a3d63]
59
+ - Updated dependencies [344f453]
60
+ - Updated dependencies [0a3ae6d]
61
+ - Updated dependencies [95911be]
62
+ - Updated dependencies [5eb5a99]
63
+ - Updated dependencies [7e632c5]
64
+ - Updated dependencies [1e9fbfa]
65
+ - Updated dependencies [b2ae5aa]
66
+ - Updated dependencies [a7292b0]
67
+ - Updated dependencies [0dcb9f0]
68
+ - @mastra/core@0.10.0-alpha.1
69
+
70
+ ## 0.0.4-alpha.0
71
+
72
+ ### Patch Changes
73
+
74
+ - e4172d9: Update getWorkflowRuns type for inngest workflow
75
+ - Updated dependencies [f53a6ac]
76
+ - Updated dependencies [eabdcd9]
77
+ - Updated dependencies [90be034]
78
+ - Updated dependencies [99f050a]
79
+ - Updated dependencies [d0ee3c6]
80
+ - Updated dependencies [23f258c]
81
+ - Updated dependencies [2672a05]
82
+ - @mastra/core@0.9.5-alpha.0
83
+
84
+ ## 0.0.3
85
+
86
+ ### Patch Changes
87
+
88
+ - Updated dependencies [396be50]
89
+ - Updated dependencies [ab80e7e]
90
+ - Updated dependencies [c3bd795]
91
+ - Updated dependencies [da082f8]
92
+ - Updated dependencies [a5810ce]
93
+ - Updated dependencies [3e9c131]
94
+ - Updated dependencies [3171b5b]
95
+ - Updated dependencies [973e5ac]
96
+ - Updated dependencies [daf942f]
97
+ - Updated dependencies [0b8b868]
98
+ - Updated dependencies [9e1eff5]
99
+ - Updated dependencies [6fa1ad1]
100
+ - Updated dependencies [c28d7a0]
101
+ - Updated dependencies [edf1e88]
102
+ - @mastra/core@0.9.4
103
+
104
+ ## 0.0.3-alpha.4
105
+
106
+ ### Patch Changes
107
+
108
+ - Updated dependencies [3e9c131]
109
+ - @mastra/core@0.9.4-alpha.4
110
+
111
+ ## 0.0.3-alpha.3
112
+
113
+ ### Patch Changes
114
+
115
+ - Updated dependencies [396be50]
116
+ - Updated dependencies [c3bd795]
117
+ - Updated dependencies [da082f8]
118
+ - Updated dependencies [a5810ce]
119
+ - @mastra/core@0.9.4-alpha.3
120
+
121
+ ## 0.0.3-alpha.2
122
+
123
+ ### Patch Changes
124
+
125
+ - Updated dependencies [3171b5b]
126
+ - Updated dependencies [973e5ac]
127
+ - Updated dependencies [9e1eff5]
128
+ - @mastra/core@0.9.4-alpha.2
129
+
130
+ ## 0.0.3-alpha.1
131
+
132
+ ### Patch Changes
133
+
134
+ - Updated dependencies [ab80e7e]
135
+ - Updated dependencies [6fa1ad1]
136
+ - Updated dependencies [c28d7a0]
137
+ - Updated dependencies [edf1e88]
138
+ - @mastra/core@0.9.4-alpha.1
139
+
140
+ ## 0.0.3-alpha.0
141
+
142
+ ### Patch Changes
143
+
144
+ - Updated dependencies [daf942f]
145
+ - Updated dependencies [0b8b868]
146
+ - @mastra/core@0.9.4-alpha.0
147
+
148
+ ## 0.0.2
149
+
150
+ ### Patch Changes
151
+
152
+ - e450778: vnext: Inngest playground fixes
153
+ - Updated dependencies [e450778]
154
+ - Updated dependencies [8902157]
155
+ - Updated dependencies [ca0dc88]
7
156
  - Updated dependencies [526c570]
157
+ - Updated dependencies [d7a6a33]
8
158
  - Updated dependencies [9cd1a46]
9
159
  - Updated dependencies [b5d2de0]
10
160
  - Updated dependencies [644f8ad]
11
161
  - Updated dependencies [70dbf51]
12
- - @mastra/core@0.0.0-vnext-inngest-20250508122351
162
+ - @mastra/core@0.9.3
163
+
164
+ ## 0.0.2-alpha.0
165
+
166
+ ### Patch Changes
167
+
168
+ - e450778: vnext: Inngest playground fixes
169
+ - Updated dependencies [e450778]
170
+ - Updated dependencies [8902157]
171
+ - Updated dependencies [ca0dc88]
172
+ - Updated dependencies [9cd1a46]
173
+ - Updated dependencies [70dbf51]
174
+ - @mastra/core@0.9.3-alpha.1
@@ -1,35 +1,37 @@
1
1
  import type { BaseContext } from 'inngest';
2
2
  import { ClientOptions } from 'inngest';
3
- import { cloneStep } from '@mastra/core/workflows/vNext';
4
- import { createStep } from '@mastra/core/workflows/vNext';
5
- import { DefaultExecutionEngine } from '@mastra/core/workflows/vNext';
6
- import type { ExecuteFunction } from '@mastra/core/workflows/vNext';
7
- import type { ExecutionContext } from '@mastra/core/workflows/vNext';
8
- import type { ExecutionEngine } from '@mastra/core/workflows/vNext';
9
- import type { ExecutionGraph } from '@mastra/core/workflows/vNext';
3
+ import { cloneStep } from '@mastra/core/workflows';
4
+ import { createStep } from '@mastra/core/workflows';
5
+ import { DefaultExecutionEngine } from '@mastra/core/workflows';
6
+ import type { ExecuteFunction } from '@mastra/core/workflows';
7
+ import type { ExecutionContext } from '@mastra/core/workflows';
8
+ import type { ExecutionEngine } from '@mastra/core/workflows';
9
+ import type { ExecutionGraph } from '@mastra/core/workflows';
10
10
  import { Handler } from 'inngest';
11
11
  import type { Inngest } from 'inngest';
12
12
  import { InngestFunction } from 'inngest';
13
13
  import { InngestMiddleware } from 'inngest';
14
14
  import type { Mastra } from '@mastra/core';
15
- import type { NewStep } from '@mastra/core/workflows/vNext';
16
- import { NewWorkflow } from '@mastra/core/workflows/vNext';
17
- import type { NewWorkflowConfig } from '@mastra/core/workflows/vNext';
18
- import { Run } from '@mastra/core/workflows/vNext';
15
+ import { Run } from '@mastra/core/workflows';
19
16
  import { RuntimeContext } from '@mastra/core/di';
20
17
  import { serve as serve_2 } from 'inngest/hono';
21
18
  import type { Span } from '@opentelemetry/api';
22
- import type { StepFlowEntry } from '@mastra/core/workflows/vNext';
23
- import type { StepResult } from '@mastra/core/workflows/vNext';
24
- import type { WorkflowResult } from '@mastra/core/workflows/vNext';
19
+ import type { Step } from '@mastra/core/workflows';
20
+ import type { StepFlowEntry } from '@mastra/core/workflows';
21
+ import type { StepResult } from '@mastra/core/workflows';
22
+ import { Workflow } from '@mastra/core/workflows';
23
+ import type { WorkflowConfig } from '@mastra/core/workflows';
24
+ import type { WorkflowResult } from '@mastra/core/workflows';
25
+ import type { WorkflowRun } from '@mastra/core';
26
+ import type { WorkflowRuns } from '@mastra/core';
25
27
  import type { z } from 'zod';
26
28
 
27
- declare function cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends NewStep<string, any, any, any, any>[] = NewStep<string, any, any, any, any>[]>(workflow: InngestWorkflow<TSteps, string, TInput, TOutput>, opts: {
29
+ declare function cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends Step<string, any, any, any, any>[] = Step<string, any, any, any, any>[]>(workflow: InngestWorkflow<TSteps, string, TInput, TOutput>, opts: {
28
30
  id: TWorkflowId;
29
31
  }): InngestWorkflow<TSteps, TWorkflowId, TInput, TOutput>;
30
32
 
31
33
  export declare function init(inngest: Inngest): {
32
- createWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TOutput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TSteps extends NewStep<string, any, any>[] = NewStep<string, any, any, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>[]>(params: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): InngestWorkflow<TSteps, TWorkflowId, TInput, TOutput, TInput>;
34
+ createWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TOutput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TSteps extends Step<string, any, any>[] = Step<string, any, any, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>[]>(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): InngestWorkflow<TSteps, TWorkflowId, TInput, TOutput, TInput>;
33
35
  createStep: typeof createStep;
34
36
  cloneStep: typeof cloneStep;
35
37
  cloneWorkflow: typeof cloneWorkflow;
@@ -41,12 +43,12 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
41
43
  constructor(mastra: Mastra, inngestStep: BaseContext<Inngest>['step'], inngestAttempts?: number);
42
44
  protected fmtReturnValue<TOutput>(executionSpan: Span | undefined, emitter: {
43
45
  emit: (event: string, data: any) => Promise<void>;
44
- }, stepResults: Record<string, StepResult<any>>, lastOutput: StepResult<any>, error?: Error | string): Promise<TOutput>;
46
+ }, stepResults: Record<string, StepResult<any, any, any, any>>, lastOutput: StepResult<any, any, any, any>, error?: Error | string): Promise<TOutput>;
45
47
  superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
46
48
  workflowId: string;
47
49
  runId: string;
48
- step: NewStep<string, any, any>;
49
- stepResults: Record<string, StepResult<any>>;
50
+ step: Step<string, any, any>;
51
+ stepResults: Record<string, StepResult<any, any, any, any>>;
50
52
  executionContext: ExecutionContext;
51
53
  resume?: {
52
54
  steps: string[];
@@ -57,10 +59,10 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
57
59
  emit: (event: string, data: any) => Promise<void>;
58
60
  };
59
61
  runtimeContext: RuntimeContext;
60
- }): Promise<StepResult<any>>;
62
+ }): Promise<StepResult<any, any, any, any>>;
61
63
  executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
62
- step: NewStep<string, any, any>;
63
- stepResults: Record<string, StepResult<any>>;
64
+ step: Step<string, any, any>;
65
+ stepResults: Record<string, StepResult<any, any, any, any>>;
64
66
  executionContext: {
65
67
  workflowId: string;
66
68
  runId: string;
@@ -81,11 +83,11 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
81
83
  emit: (event: string, data: any) => Promise<void>;
82
84
  };
83
85
  runtimeContext: RuntimeContext;
84
- }): Promise<StepResult<any>>;
86
+ }): Promise<StepResult<any, any, any, any>>;
85
87
  persistStepUpdate({ workflowId, runId, stepResults, executionContext, }: {
86
88
  workflowId: string;
87
89
  runId: string;
88
- stepResults: Record<string, StepResult<any>>;
90
+ stepResults: Record<string, StepResult<any, any, any, any>>;
89
91
  executionContext: ExecutionContext;
90
92
  }): Promise<void>;
91
93
  executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, resume, executionContext, emitter, runtimeContext, }: {
@@ -98,10 +100,10 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
98
100
  };
99
101
  prevStep: StepFlowEntry;
100
102
  prevOutput: any;
101
- stepResults: Record<string, StepResult<any>>;
103
+ stepResults: Record<string, StepResult<any, any, any, any>>;
102
104
  resume?: {
103
105
  steps: string[];
104
- stepResults: Record<string, StepResult<any>>;
106
+ stepResults: Record<string, StepResult<any, any, any, any>>;
105
107
  resumePayload: any;
106
108
  resumePath: number[];
107
109
  };
@@ -110,10 +112,10 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
110
112
  emit: (event: string, data: any) => Promise<void>;
111
113
  };
112
114
  runtimeContext: RuntimeContext;
113
- }): Promise<StepResult<any>>;
115
+ }): Promise<StepResult<any, any, any, any>>;
114
116
  }
115
117
 
116
- export declare class InngestRun<TSteps extends NewStep<string, any, any>[] = NewStep<string, any, any>[], TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>> extends Run<TSteps, TInput, TOutput> {
118
+ export declare class InngestRun<TSteps extends Step<string, any, any>[] = Step<string, any, any>[], TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>> extends Run<TSteps, TInput, TOutput> {
117
119
  #private;
118
120
  private inngest;
119
121
  constructor(params: {
@@ -136,17 +138,25 @@ export declare class InngestRun<TSteps extends NewStep<string, any, any>[] = New
136
138
  }): Promise<WorkflowResult<TOutput, TSteps>>;
137
139
  resume<TResumeSchema extends z.ZodType<any>>(params: {
138
140
  resumeData?: z.infer<TResumeSchema>;
139
- step: NewStep<string, any, any, TResumeSchema, any> | [...NewStep<string, any, any, any, any>[], NewStep<string, any, any, TResumeSchema, any>] | string | string[];
141
+ step: Step<string, any, any, TResumeSchema, any> | [...Step<string, any, any, any, any>[], Step<string, any, any, TResumeSchema, any>] | string | string[];
140
142
  runtimeContext?: RuntimeContext;
141
143
  }): Promise<WorkflowResult<TOutput, TSteps>>;
142
144
  watch(cb: (event: any) => void): () => void;
143
145
  }
144
146
 
145
- export declare class InngestWorkflow<TSteps extends NewStep<string, any, any>[] = NewStep<string, any, any>[], TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TPrevSchema extends z.ZodType<any> = TInput> extends NewWorkflow<TSteps, TWorkflowId, TInput, TOutput, TPrevSchema> {
147
+ export declare class InngestWorkflow<TSteps extends Step<string, any, any>[] = Step<string, any, any>[], TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TPrevSchema extends z.ZodType<any> = TInput> extends Workflow<TSteps, TWorkflowId, TInput, TOutput, TPrevSchema> {
146
148
  #private;
147
149
  inngest: Inngest;
148
150
  private function;
149
- constructor(params: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>, inngest: Inngest);
151
+ constructor(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>, inngest: Inngest);
152
+ getWorkflowRuns(args?: {
153
+ fromDate?: Date;
154
+ toDate?: Date;
155
+ limit?: number;
156
+ offset?: number;
157
+ resourceId?: string;
158
+ }): Promise<WorkflowRuns>;
159
+ getWorkflowRunById(runId: string): Promise<WorkflowRun | null>;
150
160
  __registerMastra(mastra: Mastra): void;
151
161
  createRun(options?: {
152
162
  runId?: string;
@@ -1,35 +1,37 @@
1
1
  import type { BaseContext } from 'inngest';
2
2
  import { ClientOptions } from 'inngest';
3
- import { cloneStep } from '@mastra/core/workflows/vNext';
4
- import { createStep } from '@mastra/core/workflows/vNext';
5
- import { DefaultExecutionEngine } from '@mastra/core/workflows/vNext';
6
- import type { ExecuteFunction } from '@mastra/core/workflows/vNext';
7
- import type { ExecutionContext } from '@mastra/core/workflows/vNext';
8
- import type { ExecutionEngine } from '@mastra/core/workflows/vNext';
9
- import type { ExecutionGraph } from '@mastra/core/workflows/vNext';
3
+ import { cloneStep } from '@mastra/core/workflows';
4
+ import { createStep } from '@mastra/core/workflows';
5
+ import { DefaultExecutionEngine } from '@mastra/core/workflows';
6
+ import type { ExecuteFunction } from '@mastra/core/workflows';
7
+ import type { ExecutionContext } from '@mastra/core/workflows';
8
+ import type { ExecutionEngine } from '@mastra/core/workflows';
9
+ import type { ExecutionGraph } from '@mastra/core/workflows';
10
10
  import { Handler } from 'inngest';
11
11
  import type { Inngest } from 'inngest';
12
12
  import { InngestFunction } from 'inngest';
13
13
  import { InngestMiddleware } from 'inngest';
14
14
  import type { Mastra } from '@mastra/core';
15
- import type { NewStep } from '@mastra/core/workflows/vNext';
16
- import { NewWorkflow } from '@mastra/core/workflows/vNext';
17
- import type { NewWorkflowConfig } from '@mastra/core/workflows/vNext';
18
- import { Run } from '@mastra/core/workflows/vNext';
15
+ import { Run } from '@mastra/core/workflows';
19
16
  import { RuntimeContext } from '@mastra/core/di';
20
17
  import { serve as serve_2 } from 'inngest/hono';
21
18
  import type { Span } from '@opentelemetry/api';
22
- import type { StepFlowEntry } from '@mastra/core/workflows/vNext';
23
- import type { StepResult } from '@mastra/core/workflows/vNext';
24
- import type { WorkflowResult } from '@mastra/core/workflows/vNext';
19
+ import type { Step } from '@mastra/core/workflows';
20
+ import type { StepFlowEntry } from '@mastra/core/workflows';
21
+ import type { StepResult } from '@mastra/core/workflows';
22
+ import { Workflow } from '@mastra/core/workflows';
23
+ import type { WorkflowConfig } from '@mastra/core/workflows';
24
+ import type { WorkflowResult } from '@mastra/core/workflows';
25
+ import type { WorkflowRun } from '@mastra/core';
26
+ import type { WorkflowRuns } from '@mastra/core';
25
27
  import type { z } from 'zod';
26
28
 
27
- declare function cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends NewStep<string, any, any, any, any>[] = NewStep<string, any, any, any, any>[]>(workflow: InngestWorkflow<TSteps, string, TInput, TOutput>, opts: {
29
+ declare function cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TSteps extends Step<string, any, any, any, any>[] = Step<string, any, any, any, any>[]>(workflow: InngestWorkflow<TSteps, string, TInput, TOutput>, opts: {
28
30
  id: TWorkflowId;
29
31
  }): InngestWorkflow<TSteps, TWorkflowId, TInput, TOutput>;
30
32
 
31
33
  export declare function init(inngest: Inngest): {
32
- createWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TOutput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TSteps extends NewStep<string, any, any>[] = NewStep<string, any, any, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>[]>(params: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): InngestWorkflow<TSteps, TWorkflowId, TInput, TOutput, TInput>;
34
+ createWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TOutput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TSteps extends Step<string, any, any>[] = Step<string, any, any, z.ZodType<any, z.ZodTypeDef, any>, z.ZodType<any, z.ZodTypeDef, any>>[]>(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): InngestWorkflow<TSteps, TWorkflowId, TInput, TOutput, TInput>;
33
35
  createStep: typeof createStep;
34
36
  cloneStep: typeof cloneStep;
35
37
  cloneWorkflow: typeof cloneWorkflow;
@@ -41,12 +43,12 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
41
43
  constructor(mastra: Mastra, inngestStep: BaseContext<Inngest>['step'], inngestAttempts?: number);
42
44
  protected fmtReturnValue<TOutput>(executionSpan: Span | undefined, emitter: {
43
45
  emit: (event: string, data: any) => Promise<void>;
44
- }, stepResults: Record<string, StepResult<any>>, lastOutput: StepResult<any>, error?: Error | string): Promise<TOutput>;
46
+ }, stepResults: Record<string, StepResult<any, any, any, any>>, lastOutput: StepResult<any, any, any, any>, error?: Error | string): Promise<TOutput>;
45
47
  superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
46
48
  workflowId: string;
47
49
  runId: string;
48
- step: NewStep<string, any, any>;
49
- stepResults: Record<string, StepResult<any>>;
50
+ step: Step<string, any, any>;
51
+ stepResults: Record<string, StepResult<any, any, any, any>>;
50
52
  executionContext: ExecutionContext;
51
53
  resume?: {
52
54
  steps: string[];
@@ -57,10 +59,10 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
57
59
  emit: (event: string, data: any) => Promise<void>;
58
60
  };
59
61
  runtimeContext: RuntimeContext;
60
- }): Promise<StepResult<any>>;
62
+ }): Promise<StepResult<any, any, any, any>>;
61
63
  executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
62
- step: NewStep<string, any, any>;
63
- stepResults: Record<string, StepResult<any>>;
64
+ step: Step<string, any, any>;
65
+ stepResults: Record<string, StepResult<any, any, any, any>>;
64
66
  executionContext: {
65
67
  workflowId: string;
66
68
  runId: string;
@@ -81,11 +83,11 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
81
83
  emit: (event: string, data: any) => Promise<void>;
82
84
  };
83
85
  runtimeContext: RuntimeContext;
84
- }): Promise<StepResult<any>>;
86
+ }): Promise<StepResult<any, any, any, any>>;
85
87
  persistStepUpdate({ workflowId, runId, stepResults, executionContext, }: {
86
88
  workflowId: string;
87
89
  runId: string;
88
- stepResults: Record<string, StepResult<any>>;
90
+ stepResults: Record<string, StepResult<any, any, any, any>>;
89
91
  executionContext: ExecutionContext;
90
92
  }): Promise<void>;
91
93
  executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, resume, executionContext, emitter, runtimeContext, }: {
@@ -98,10 +100,10 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
98
100
  };
99
101
  prevStep: StepFlowEntry;
100
102
  prevOutput: any;
101
- stepResults: Record<string, StepResult<any>>;
103
+ stepResults: Record<string, StepResult<any, any, any, any>>;
102
104
  resume?: {
103
105
  steps: string[];
104
- stepResults: Record<string, StepResult<any>>;
106
+ stepResults: Record<string, StepResult<any, any, any, any>>;
105
107
  resumePayload: any;
106
108
  resumePath: number[];
107
109
  };
@@ -110,10 +112,10 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
110
112
  emit: (event: string, data: any) => Promise<void>;
111
113
  };
112
114
  runtimeContext: RuntimeContext;
113
- }): Promise<StepResult<any>>;
115
+ }): Promise<StepResult<any, any, any, any>>;
114
116
  }
115
117
 
116
- export declare class InngestRun<TSteps extends NewStep<string, any, any>[] = NewStep<string, any, any>[], TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>> extends Run<TSteps, TInput, TOutput> {
118
+ export declare class InngestRun<TSteps extends Step<string, any, any>[] = Step<string, any, any>[], TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>> extends Run<TSteps, TInput, TOutput> {
117
119
  #private;
118
120
  private inngest;
119
121
  constructor(params: {
@@ -136,17 +138,25 @@ export declare class InngestRun<TSteps extends NewStep<string, any, any>[] = New
136
138
  }): Promise<WorkflowResult<TOutput, TSteps>>;
137
139
  resume<TResumeSchema extends z.ZodType<any>>(params: {
138
140
  resumeData?: z.infer<TResumeSchema>;
139
- step: NewStep<string, any, any, TResumeSchema, any> | [...NewStep<string, any, any, any, any>[], NewStep<string, any, any, TResumeSchema, any>] | string | string[];
141
+ step: Step<string, any, any, TResumeSchema, any> | [...Step<string, any, any, any, any>[], Step<string, any, any, TResumeSchema, any>] | string | string[];
140
142
  runtimeContext?: RuntimeContext;
141
143
  }): Promise<WorkflowResult<TOutput, TSteps>>;
142
144
  watch(cb: (event: any) => void): () => void;
143
145
  }
144
146
 
145
- export declare class InngestWorkflow<TSteps extends NewStep<string, any, any>[] = NewStep<string, any, any>[], TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TPrevSchema extends z.ZodType<any> = TInput> extends NewWorkflow<TSteps, TWorkflowId, TInput, TOutput, TPrevSchema> {
147
+ export declare class InngestWorkflow<TSteps extends Step<string, any, any>[] = Step<string, any, any>[], TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TPrevSchema extends z.ZodType<any> = TInput> extends Workflow<TSteps, TWorkflowId, TInput, TOutput, TPrevSchema> {
146
148
  #private;
147
149
  inngest: Inngest;
148
150
  private function;
149
- constructor(params: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>, inngest: Inngest);
151
+ constructor(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>, inngest: Inngest);
152
+ getWorkflowRuns(args?: {
153
+ fromDate?: Date;
154
+ toDate?: Date;
155
+ limit?: number;
156
+ offset?: number;
157
+ resourceId?: string;
158
+ }): Promise<WorkflowRuns>;
159
+ getWorkflowRunById(runId: string): Promise<WorkflowRun | null>;
150
160
  __registerMastra(mastra: Mastra): void;
151
161
  createRun(options?: {
152
162
  runId?: string;
package/dist/index.cjs CHANGED
@@ -3,12 +3,13 @@
3
3
  var crypto = require('crypto');
4
4
  var realtime = require('@inngest/realtime');
5
5
  var di = require('@mastra/core/di');
6
- var vNext = require('@mastra/core/workflows/vNext');
6
+ var workflows = require('@mastra/core/workflows');
7
+ var _constants = require('@mastra/core/workflows/_constants');
7
8
  var hono = require('inngest/hono');
8
9
 
9
10
  // src/index.ts
10
11
  function serve({ mastra, inngest }) {
11
- const wfs = mastra.vnext_getWorkflows();
12
+ const wfs = mastra.getWorkflows();
12
13
  const functions = Object.values(wfs).flatMap((wf) => {
13
14
  if (wf instanceof InngestWorkflow) {
14
15
  wf.__registerMastra(mastra);
@@ -21,7 +22,7 @@ function serve({ mastra, inngest }) {
21
22
  functions
22
23
  });
23
24
  }
24
- var InngestRun = class extends vNext.Run {
25
+ var InngestRun = class extends workflows.Run {
25
26
  inngest;
26
27
  #mastra;
27
28
  constructor(params, inngest) {
@@ -137,7 +138,7 @@ var InngestRun = class extends vNext.Run {
137
138
  };
138
139
  }
139
140
  };
140
- var InngestWorkflow = class _InngestWorkflow extends vNext.NewWorkflow {
141
+ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
141
142
  #mastra;
142
143
  inngest;
143
144
  function;
@@ -146,6 +147,23 @@ var InngestWorkflow = class _InngestWorkflow extends vNext.NewWorkflow {
146
147
  this.#mastra = params.mastra;
147
148
  this.inngest = inngest;
148
149
  }
150
+ async getWorkflowRuns(args) {
151
+ const storage = this.#mastra?.getStorage();
152
+ if (!storage) {
153
+ this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
154
+ return { runs: [], total: 0 };
155
+ }
156
+ return storage.getWorkflowRuns({ workflowName: this.id, ...args ?? {} });
157
+ }
158
+ async getWorkflowRunById(runId) {
159
+ const storage = this.#mastra?.getStorage();
160
+ if (!storage) {
161
+ this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
162
+ return null;
163
+ }
164
+ const run = await storage.getWorkflowRunById({ runId, workflowName: this.id });
165
+ return run ?? (this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null);
166
+ }
149
167
  __registerMastra(mastra) {
150
168
  this.#mastra = mastra;
151
169
  this.executionEngine.__registerMastra(mastra);
@@ -266,12 +284,12 @@ function init(inngest) {
266
284
  createWorkflow(params) {
267
285
  return new InngestWorkflow(params, inngest);
268
286
  },
269
- createStep: vNext.createStep,
270
- cloneStep: vNext.cloneStep,
287
+ createStep: workflows.createStep,
288
+ cloneStep: workflows.cloneStep,
271
289
  cloneWorkflow
272
290
  };
273
291
  }
274
- var InngestExecutionEngine = class extends vNext.DefaultExecutionEngine {
292
+ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
275
293
  inngestStep;
276
294
  inngestAttempts;
277
295
  constructor(mastra, inngestStep, inngestAttempts = 0) {
@@ -658,7 +676,7 @@ var InngestExecutionEngine = class extends vNext.DefaultExecutionEngine {
658
676
  // TODO: this function shouldn't have suspend probably?
659
677
  suspend: async (_suspendPayload) => {
660
678
  },
661
- emitter
679
+ [_constants.EMITTER_SYMBOL]: emitter
662
680
  });
663
681
  return result ? index : null;
664
682
  } catch (e) {
package/dist/index.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import { randomUUID } from 'crypto';
2
2
  import { subscribe } from '@inngest/realtime';
3
3
  import { RuntimeContext } from '@mastra/core/di';
4
- import { Run, NewWorkflow, cloneStep, createStep, DefaultExecutionEngine } from '@mastra/core/workflows/vNext';
4
+ import { Run, Workflow, cloneStep, createStep, DefaultExecutionEngine } from '@mastra/core/workflows';
5
+ import { EMITTER_SYMBOL } from '@mastra/core/workflows/_constants';
5
6
  import { serve as serve$1 } from 'inngest/hono';
6
7
 
7
8
  // src/index.ts
8
9
  function serve({ mastra, inngest }) {
9
- const wfs = mastra.vnext_getWorkflows();
10
+ const wfs = mastra.getWorkflows();
10
11
  const functions = Object.values(wfs).flatMap((wf) => {
11
12
  if (wf instanceof InngestWorkflow) {
12
13
  wf.__registerMastra(mastra);
@@ -135,7 +136,7 @@ var InngestRun = class extends Run {
135
136
  };
136
137
  }
137
138
  };
138
- var InngestWorkflow = class _InngestWorkflow extends NewWorkflow {
139
+ var InngestWorkflow = class _InngestWorkflow extends Workflow {
139
140
  #mastra;
140
141
  inngest;
141
142
  function;
@@ -144,6 +145,23 @@ var InngestWorkflow = class _InngestWorkflow extends NewWorkflow {
144
145
  this.#mastra = params.mastra;
145
146
  this.inngest = inngest;
146
147
  }
148
+ async getWorkflowRuns(args) {
149
+ const storage = this.#mastra?.getStorage();
150
+ if (!storage) {
151
+ this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
152
+ return { runs: [], total: 0 };
153
+ }
154
+ return storage.getWorkflowRuns({ workflowName: this.id, ...args ?? {} });
155
+ }
156
+ async getWorkflowRunById(runId) {
157
+ const storage = this.#mastra?.getStorage();
158
+ if (!storage) {
159
+ this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
160
+ return null;
161
+ }
162
+ const run = await storage.getWorkflowRunById({ runId, workflowName: this.id });
163
+ return run ?? (this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null);
164
+ }
147
165
  __registerMastra(mastra) {
148
166
  this.#mastra = mastra;
149
167
  this.executionEngine.__registerMastra(mastra);
@@ -656,7 +674,7 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
656
674
  // TODO: this function shouldn't have suspend probably?
657
675
  suspend: async (_suspendPayload) => {
658
676
  },
659
- emitter
677
+ [EMITTER_SYMBOL]: emitter
660
678
  });
661
679
  return result ? index : null;
662
680
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/inngest",
3
- "version": "0.0.0-vnext-inngest-20250508122351",
3
+ "version": "0.0.0-vnextAgentNetwork-20250527091247",
4
4
  "description": "Mastra Inngest integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,15 +22,14 @@
22
22
  "@inngest/realtime": "^0.3.1",
23
23
  "inngest": "^3.35.1",
24
24
  "zod": "^3.24.2",
25
- "@opentelemetry/api": "^1.9.0",
26
- "@mastra/core": "0.0.0-vnext-inngest-20250508122351"
25
+ "@opentelemetry/api": "^1.9.0"
27
26
  },
28
27
  "devDependencies": {
29
- "@ai-sdk/openai": "^1.2.1",
28
+ "@ai-sdk/openai": "^1.3.22",
30
29
  "@hono/node-server": "^1.14.1",
31
30
  "@microsoft/api-extractor": "^7.52.2",
32
31
  "@types/node": "^20.17.27",
33
- "ai": "^4.2.2",
32
+ "ai": "^4.3.15",
34
33
  "eslint": "^9.23.0",
35
34
  "execa": "^9.5.2",
36
35
  "get-port": "7.1.0",
@@ -38,8 +37,12 @@
38
37
  "tsup": "^8.4.0",
39
38
  "typescript": "^5.8.2",
40
39
  "vitest": "^2.1.9",
41
- "@internal/lint": "0.0.0-vnext-inngest-20250508122351",
42
- "@mastra/deployer": "0.0.0-vnext-inngest-20250508122351"
40
+ "@mastra/deployer": "0.0.0-vnextAgentNetwork-20250527091247",
41
+ "@internal/lint": "0.0.0-vnextAgentNetwork-20250527091247",
42
+ "@mastra/core": "0.0.0-vnextAgentNetwork-20250527091247"
43
+ },
44
+ "peerDependencies": {
45
+ "@mastra/core": "^0.10.0"
43
46
  },
44
47
  "scripts": {
45
48
  "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
package/src/index.test.ts CHANGED
@@ -71,7 +71,7 @@ describe('MastraInngestWorkflow', () => {
71
71
  url: ':memory:',
72
72
  },
73
73
  }),
74
- vnext_workflows: {
74
+ workflows: {
75
75
  'test-workflow': workflow,
76
76
  },
77
77
  server: {
@@ -148,7 +148,7 @@ describe('MastraInngestWorkflow', () => {
148
148
  url: ':memory:',
149
149
  },
150
150
  }),
151
- vnext_workflows: {
151
+ workflows: {
152
152
  'test-workflow': workflow,
153
153
  },
154
154
  server: {
@@ -231,7 +231,7 @@ describe('MastraInngestWorkflow', () => {
231
231
  url: ':memory:',
232
232
  },
233
233
  }),
234
- vnext_workflows: {
234
+ workflows: {
235
235
  'test-workflow': workflow,
236
236
  },
237
237
  server: {
@@ -305,7 +305,7 @@ describe('MastraInngestWorkflow', () => {
305
305
  url: ':memory:',
306
306
  },
307
307
  }),
308
- vnext_workflows: {
308
+ workflows: {
309
309
  'test-workflow': workflow,
310
310
  },
311
311
  server: {
@@ -394,7 +394,7 @@ describe('MastraInngestWorkflow', () => {
394
394
  url: ':memory:',
395
395
  },
396
396
  }),
397
- vnext_workflows: {
397
+ workflows: {
398
398
  'test-workflow': workflow,
399
399
  },
400
400
  server: {
@@ -463,7 +463,7 @@ describe('MastraInngestWorkflow', () => {
463
463
  url: ':memory:',
464
464
  },
465
465
  }),
466
- vnext_workflows: {
466
+ workflows: {
467
467
  'test-workflow': workflow,
468
468
  },
469
469
  server: {
@@ -540,7 +540,7 @@ describe('MastraInngestWorkflow', () => {
540
540
  url: ':memory:',
541
541
  },
542
542
  }),
543
- vnext_workflows: {
543
+ workflows: {
544
544
  'test-workflow': workflow,
545
545
  },
546
546
  server: {
@@ -624,7 +624,7 @@ describe('MastraInngestWorkflow', () => {
624
624
  url: ':memory:',
625
625
  },
626
626
  }),
627
- vnext_workflows: {
627
+ workflows: {
628
628
  'test-workflow': workflow,
629
629
  },
630
630
  server: {
@@ -729,7 +729,7 @@ describe('MastraInngestWorkflow', () => {
729
729
  url: ':memory:',
730
730
  },
731
731
  }),
732
- vnext_workflows: {
732
+ workflows: {
733
733
  'test-workflow': workflow,
734
734
  },
735
735
  server: {
@@ -807,7 +807,7 @@ describe('MastraInngestWorkflow', () => {
807
807
  url: ':memory:',
808
808
  },
809
809
  }),
810
- vnext_workflows: {
810
+ workflows: {
811
811
  'test-workflow': workflow,
812
812
  },
813
813
  server: {
@@ -914,7 +914,7 @@ describe('MastraInngestWorkflow', () => {
914
914
  url: ':memory:',
915
915
  },
916
916
  }),
917
- vnext_workflows: {
917
+ workflows: {
918
918
  'test-workflow': workflow,
919
919
  },
920
920
  server: {
@@ -999,7 +999,7 @@ describe('MastraInngestWorkflow', () => {
999
999
  url: ':memory:',
1000
1000
  },
1001
1001
  }),
1002
- vnext_workflows: {
1002
+ workflows: {
1003
1003
  'test-workflow': workflow,
1004
1004
  },
1005
1005
  server: {
@@ -1069,7 +1069,7 @@ describe('MastraInngestWorkflow', () => {
1069
1069
  url: ':memory:',
1070
1070
  },
1071
1071
  }),
1072
- vnext_workflows: {
1072
+ workflows: {
1073
1073
  'test-workflow': workflow,
1074
1074
  },
1075
1075
  server: {
@@ -1155,7 +1155,7 @@ describe('MastraInngestWorkflow', () => {
1155
1155
  url: ':memory:',
1156
1156
  },
1157
1157
  }),
1158
- vnext_workflows: {
1158
+ workflows: {
1159
1159
  'test-workflow': workflow,
1160
1160
  },
1161
1161
  server: {
@@ -1251,7 +1251,7 @@ describe('MastraInngestWorkflow', () => {
1251
1251
  url: ':memory:',
1252
1252
  },
1253
1253
  }),
1254
- vnext_workflows: {
1254
+ workflows: {
1255
1255
  'main-workflow': mainWorkflow,
1256
1256
  },
1257
1257
  server: {
@@ -1381,7 +1381,7 @@ describe('MastraInngestWorkflow', () => {
1381
1381
  url: ':memory:',
1382
1382
  },
1383
1383
  }),
1384
- vnext_workflows: {
1384
+ workflows: {
1385
1385
  'test-workflow': workflow,
1386
1386
  },
1387
1387
  server: {
@@ -1485,7 +1485,7 @@ describe('MastraInngestWorkflow', () => {
1485
1485
  url: ':memory:',
1486
1486
  },
1487
1487
  }),
1488
- vnext_workflows: {
1488
+ workflows: {
1489
1489
  'test-workflow': counterWorkflow,
1490
1490
  },
1491
1491
  server: {
@@ -1590,7 +1590,7 @@ describe('MastraInngestWorkflow', () => {
1590
1590
  url: ':memory:',
1591
1591
  },
1592
1592
  }),
1593
- vnext_workflows: {
1593
+ workflows: {
1594
1594
  'test-workflow': counterWorkflow,
1595
1595
  },
1596
1596
  server: {
@@ -1681,7 +1681,7 @@ describe('MastraInngestWorkflow', () => {
1681
1681
  url: ':memory:',
1682
1682
  },
1683
1683
  }),
1684
- vnext_workflows: {
1684
+ workflows: {
1685
1685
  'test-workflow': counterWorkflow,
1686
1686
  },
1687
1687
  server: {
@@ -1836,7 +1836,7 @@ describe('MastraInngestWorkflow', () => {
1836
1836
  url: ':memory:',
1837
1837
  },
1838
1838
  }),
1839
- vnext_workflows: {
1839
+ workflows: {
1840
1840
  'test-workflow': counterWorkflow,
1841
1841
  },
1842
1842
  server: {
@@ -1987,7 +1987,7 @@ describe('MastraInngestWorkflow', () => {
1987
1987
  url: ':memory:',
1988
1988
  },
1989
1989
  }),
1990
- vnext_workflows: {
1990
+ workflows: {
1991
1991
  'test-workflow': counterWorkflow,
1992
1992
  },
1993
1993
  server: {
@@ -2161,7 +2161,7 @@ describe('MastraInngestWorkflow', () => {
2161
2161
  url: ':memory:',
2162
2162
  },
2163
2163
  }),
2164
- vnext_workflows: {
2164
+ workflows: {
2165
2165
  'test-workflow': workflow,
2166
2166
  },
2167
2167
  server: {
@@ -2229,7 +2229,7 @@ describe('MastraInngestWorkflow', () => {
2229
2229
  url: ':memory:',
2230
2230
  },
2231
2231
  }),
2232
- vnext_workflows: {
2232
+ workflows: {
2233
2233
  'test-workflow': workflow,
2234
2234
  },
2235
2235
  server: {
@@ -2292,7 +2292,7 @@ describe('MastraInngestWorkflow', () => {
2292
2292
  });
2293
2293
 
2294
2294
  new Mastra({
2295
- vnext_workflows: {
2295
+ workflows: {
2296
2296
  'test-workflow': workflow,
2297
2297
  },
2298
2298
  server: {
@@ -2363,7 +2363,7 @@ describe('MastraInngestWorkflow', () => {
2363
2363
  url: ':memory:',
2364
2364
  },
2365
2365
  }),
2366
- vnext_workflows: {
2366
+ workflows: {
2367
2367
  'test-workflow': workflow,
2368
2368
  },
2369
2369
  server: {
@@ -2436,7 +2436,7 @@ describe('MastraInngestWorkflow', () => {
2436
2436
  url: ':memory:',
2437
2437
  },
2438
2438
  }),
2439
- vnext_workflows: {
2439
+ workflows: {
2440
2440
  'test-workflow': workflow,
2441
2441
  },
2442
2442
  server: {
@@ -2624,7 +2624,7 @@ describe('MastraInngestWorkflow', () => {
2624
2624
  url: ':memory:',
2625
2625
  },
2626
2626
  }),
2627
- vnext_workflows: {
2627
+ workflows: {
2628
2628
  'test-workflow': workflow,
2629
2629
  },
2630
2630
  server: {
@@ -2804,7 +2804,7 @@ describe('MastraInngestWorkflow', () => {
2804
2804
  url: ':memory:',
2805
2805
  },
2806
2806
  }),
2807
- vnext_workflows: {
2807
+ workflows: {
2808
2808
  'test-workflow': promptEvalWorkflow,
2809
2809
  },
2810
2810
  server: {
@@ -2956,7 +2956,7 @@ describe('MastraInngestWorkflow', () => {
2956
2956
  url: ':memory:',
2957
2957
  },
2958
2958
  }),
2959
- vnext_workflows: {
2959
+ workflows: {
2960
2960
  'test-workflow': workflow,
2961
2961
  },
2962
2962
  server: {
@@ -3160,7 +3160,7 @@ describe('MastraInngestWorkflow', () => {
3160
3160
  url: ':memory:',
3161
3161
  },
3162
3162
  }),
3163
- vnext_workflows: {
3163
+ workflows: {
3164
3164
  'test-workflow': workflow,
3165
3165
  },
3166
3166
  server: {
@@ -3356,7 +3356,7 @@ describe('MastraInngestWorkflow', () => {
3356
3356
  url: ':memory:',
3357
3357
  },
3358
3358
  }),
3359
- vnext_workflows: {
3359
+ workflows: {
3360
3360
  'test-workflow': promptEvalWorkflow,
3361
3361
  },
3362
3362
  server: {
@@ -3482,7 +3482,7 @@ describe('MastraInngestWorkflow', () => {
3482
3482
  url: ':memory:',
3483
3483
  },
3484
3484
  }),
3485
- vnext_workflows: {
3485
+ workflows: {
3486
3486
  'test-workflow': workflow,
3487
3487
  },
3488
3488
  server: {
@@ -3587,7 +3587,7 @@ describe('MastraInngestWorkflow', () => {
3587
3587
  url: ':memory:',
3588
3588
  },
3589
3589
  }),
3590
- vnext_workflows: {
3590
+ workflows: {
3591
3591
  'test-workflow': workflow,
3592
3592
  },
3593
3593
  server: {
@@ -3725,7 +3725,7 @@ describe('MastraInngestWorkflow', () => {
3725
3725
  url: ':memory:',
3726
3726
  },
3727
3727
  }),
3728
- vnext_workflows: {
3728
+ workflows: {
3729
3729
  'test-workflow': workflow,
3730
3730
  },
3731
3731
  server: {
@@ -3870,7 +3870,7 @@ describe('MastraInngestWorkflow', () => {
3870
3870
  url: ':memory:',
3871
3871
  },
3872
3872
  }),
3873
- vnext_workflows: {
3873
+ workflows: {
3874
3874
  'test-workflow': counterWorkflow,
3875
3875
  },
3876
3876
  server: {
@@ -4024,7 +4024,7 @@ describe('MastraInngestWorkflow', () => {
4024
4024
  url: ':memory:',
4025
4025
  },
4026
4026
  }),
4027
- vnext_workflows: {
4027
+ workflows: {
4028
4028
  'test-workflow': counterWorkflow,
4029
4029
  },
4030
4030
  server: {
@@ -4183,7 +4183,7 @@ describe('MastraInngestWorkflow', () => {
4183
4183
  url: ':memory:',
4184
4184
  },
4185
4185
  }),
4186
- vnext_workflows: {
4186
+ workflows: {
4187
4187
  'test-workflow': counterWorkflow,
4188
4188
  },
4189
4189
  server: {
@@ -4344,7 +4344,7 @@ describe('MastraInngestWorkflow', () => {
4344
4344
  url: ':memory:',
4345
4345
  },
4346
4346
  }),
4347
- vnext_workflows: {
4347
+ workflows: {
4348
4348
  'test-workflow': counterWorkflow,
4349
4349
  },
4350
4350
  server: {
@@ -4543,7 +4543,7 @@ describe('MastraInngestWorkflow', () => {
4543
4543
  url: ':memory:',
4544
4544
  },
4545
4545
  }),
4546
- vnext_workflows: {
4546
+ workflows: {
4547
4547
  'test-workflow': counterWorkflow,
4548
4548
  },
4549
4549
  server: {
@@ -4701,7 +4701,7 @@ describe('MastraInngestWorkflow', () => {
4701
4701
  url: ':memory:',
4702
4702
  },
4703
4703
  }),
4704
- vnext_workflows: {
4704
+ workflows: {
4705
4705
  'test-workflow': counterWorkflow,
4706
4706
  },
4707
4707
  server: {
@@ -4851,7 +4851,7 @@ describe('MastraInngestWorkflow', () => {
4851
4851
  url: ':memory:',
4852
4852
  },
4853
4853
  }),
4854
- vnext_workflows: {
4854
+ workflows: {
4855
4855
  'test-workflow': counterWorkflow,
4856
4856
  },
4857
4857
  server: {
@@ -5038,7 +5038,7 @@ describe('MastraInngestWorkflow', () => {
5038
5038
  url: ':memory:',
5039
5039
  },
5040
5040
  }),
5041
- vnext_workflows: {
5041
+ workflows: {
5042
5042
  'test-workflow': counterWorkflow,
5043
5043
  },
5044
5044
  server: {
@@ -5197,7 +5197,7 @@ describe('MastraInngestWorkflow', () => {
5197
5197
  url: ':memory:',
5198
5198
  },
5199
5199
  }),
5200
- vnext_workflows: {
5200
+ workflows: {
5201
5201
  'test-workflow': counterWorkflow,
5202
5202
  },
5203
5203
  server: {
@@ -5274,7 +5274,7 @@ describe('MastraInngestWorkflow', () => {
5274
5274
  url: ':memory:',
5275
5275
  },
5276
5276
  }),
5277
- vnext_workflows: {
5277
+ workflows: {
5278
5278
  'test-workflow': workflow,
5279
5279
  },
5280
5280
  server: {
@@ -5339,7 +5339,7 @@ describe('MastraInngestWorkflow', () => {
5339
5339
  url: ':memory:',
5340
5340
  },
5341
5341
  }),
5342
- vnext_workflows: {
5342
+ workflows: {
5343
5343
  'test-workflow': workflow,
5344
5344
  },
5345
5345
  server: {
package/src/index.ts CHANGED
@@ -1,27 +1,27 @@
1
1
  import { randomUUID } from 'crypto';
2
2
  import { subscribe } from '@inngest/realtime';
3
- import type { Mastra } from '@mastra/core';
3
+ import type { Mastra, WorkflowRun, WorkflowRuns } from '@mastra/core';
4
4
  import { RuntimeContext } from '@mastra/core/di';
5
- import { NewWorkflow, createStep, Run, DefaultExecutionEngine, cloneStep } from '@mastra/core/workflows/vNext';
5
+ import { Workflow, createStep, Run, DefaultExecutionEngine, cloneStep } from '@mastra/core/workflows';
6
6
  import type {
7
7
  ExecuteFunction,
8
8
  ExecutionContext,
9
9
  ExecutionEngine,
10
10
  ExecutionGraph,
11
- NewStep,
12
- NewStep as Step,
13
- NewWorkflowConfig,
11
+ Step,
12
+ WorkflowConfig,
14
13
  StepFlowEntry,
15
14
  StepResult,
16
15
  WorkflowResult,
17
- } from '@mastra/core/workflows/vNext';
16
+ } from '@mastra/core/workflows';
17
+ import { EMITTER_SYMBOL } from '@mastra/core/workflows/_constants';
18
18
  import type { Span } from '@opentelemetry/api';
19
19
  import type { Inngest, BaseContext } from 'inngest';
20
20
  import { serve as inngestServe } from 'inngest/hono';
21
21
  import type { z } from 'zod';
22
22
 
23
23
  export function serve({ mastra, inngest }: { mastra: Mastra; inngest: Inngest }): ReturnType<typeof inngestServe> {
24
- const wfs = mastra.vnext_getWorkflows();
24
+ const wfs = mastra.getWorkflows();
25
25
  const functions = Object.values(wfs).flatMap(wf => {
26
26
  if (wf instanceof InngestWorkflow) {
27
27
  wf.__registerMastra(mastra);
@@ -36,7 +36,7 @@ export function serve({ mastra, inngest }: { mastra: Mastra; inngest: Inngest })
36
36
  }
37
37
 
38
38
  export class InngestRun<
39
- TSteps extends NewStep<string, any, any>[] = NewStep<string, any, any>[],
39
+ TSteps extends Step<string, any, any>[] = Step<string, any, any>[],
40
40
  TInput extends z.ZodType<any> = z.ZodType<any>,
41
41
  TOutput extends z.ZodType<any> = z.ZodType<any>,
42
42
  > extends Run<TSteps, TInput, TOutput> {
@@ -196,23 +196,53 @@ export class InngestRun<
196
196
  }
197
197
 
198
198
  export class InngestWorkflow<
199
- TSteps extends NewStep<string, any, any>[] = NewStep<string, any, any>[],
199
+ TSteps extends Step<string, any, any>[] = Step<string, any, any>[],
200
200
  TWorkflowId extends string = string,
201
201
  TInput extends z.ZodType<any> = z.ZodType<any>,
202
202
  TOutput extends z.ZodType<any> = z.ZodType<any>,
203
203
  TPrevSchema extends z.ZodType<any> = TInput,
204
- > extends NewWorkflow<TSteps, TWorkflowId, TInput, TOutput, TPrevSchema> {
204
+ > extends Workflow<TSteps, TWorkflowId, TInput, TOutput, TPrevSchema> {
205
205
  #mastra: Mastra;
206
206
  public inngest: Inngest;
207
207
 
208
208
  private function: ReturnType<Inngest['createFunction']> | undefined;
209
209
 
210
- constructor(params: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>, inngest: Inngest) {
210
+ constructor(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>, inngest: Inngest) {
211
211
  super(params);
212
212
  this.#mastra = params.mastra!;
213
213
  this.inngest = inngest;
214
214
  }
215
215
 
216
+ async getWorkflowRuns(args?: {
217
+ fromDate?: Date;
218
+ toDate?: Date;
219
+ limit?: number;
220
+ offset?: number;
221
+ resourceId?: string;
222
+ }) {
223
+ const storage = this.#mastra?.getStorage();
224
+ if (!storage) {
225
+ this.logger.debug('Cannot get workflow runs. Mastra engine is not initialized');
226
+ return { runs: [], total: 0 };
227
+ }
228
+
229
+ return storage.getWorkflowRuns({ workflowName: this.id, ...(args ?? {}) }) as unknown as WorkflowRuns;
230
+ }
231
+
232
+ async getWorkflowRunById(runId: string): Promise<WorkflowRun | null> {
233
+ const storage = this.#mastra?.getStorage();
234
+ if (!storage) {
235
+ this.logger.debug('Cannot get workflow runs. Mastra engine is not initialized');
236
+ return null;
237
+ }
238
+ const run = (await storage.getWorkflowRunById({ runId, workflowName: this.id })) as unknown as WorkflowRun;
239
+
240
+ return (
241
+ run ??
242
+ (this.runs.get(runId) ? ({ ...this.runs.get(runId), workflowName: this.id } as unknown as WorkflowRun) : null)
243
+ );
244
+ }
245
+
216
246
  __registerMastra(mastra: Mastra) {
217
247
  this.#mastra = mastra;
218
248
  this.executionEngine.__registerMastra(mastra);
@@ -364,7 +394,7 @@ export function init(inngest: Inngest) {
364
394
  TInput extends z.ZodType<any> = z.ZodType<any>,
365
395
  TOutput extends z.ZodType<any> = z.ZodType<any>,
366
396
  TSteps extends Step<string, any, any>[] = Step<string, any, any>[],
367
- >(params: NewWorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>) {
397
+ >(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>) {
368
398
  return new InngestWorkflow(params, inngest);
369
399
  },
370
400
  createStep,
@@ -386,8 +416,8 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
386
416
  protected async fmtReturnValue<TOutput>(
387
417
  executionSpan: Span | undefined,
388
418
  emitter: { emit: (event: string, data: any) => Promise<void> },
389
- stepResults: Record<string, StepResult<any>>,
390
- lastOutput: StepResult<any>,
419
+ stepResults: Record<string, StepResult<any, any, any, any>>,
420
+ lastOutput: StepResult<any, any, any, any>,
391
421
  error?: Error | string,
392
422
  ): Promise<TOutput> {
393
423
  const base: any = {
@@ -471,7 +501,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
471
501
  workflowId: string;
472
502
  runId: string;
473
503
  step: Step<string, any, any>;
474
- stepResults: Record<string, StepResult<any>>;
504
+ stepResults: Record<string, StepResult<any, any, any, any>>;
475
505
  executionContext: ExecutionContext;
476
506
  resume?: {
477
507
  steps: string[];
@@ -480,7 +510,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
480
510
  prevOutput: any;
481
511
  emitter: { emit: (event: string, data: any) => Promise<void> };
482
512
  runtimeContext: RuntimeContext;
483
- }): Promise<StepResult<any>> {
513
+ }): Promise<StepResult<any, any, any, any>> {
484
514
  return super.executeStep({
485
515
  workflowId,
486
516
  runId,
@@ -504,7 +534,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
504
534
  runtimeContext,
505
535
  }: {
506
536
  step: Step<string, any, any>;
507
- stepResults: Record<string, StepResult<any>>;
537
+ stepResults: Record<string, StepResult<any, any, any, any>>;
508
538
  executionContext: {
509
539
  workflowId: string;
510
540
  runId: string;
@@ -520,7 +550,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
520
550
  prevOutput: any;
521
551
  emitter: { emit: (event: string, data: any) => Promise<void> };
522
552
  runtimeContext: RuntimeContext;
523
- }): Promise<StepResult<any>> {
553
+ }): Promise<StepResult<any, any, any, any>> {
524
554
  await this.inngestStep.run(
525
555
  `workflow.${executionContext.workflowId}.run.${executionContext.runId}.step.${step.id}.running_ev`,
526
556
  async () => {
@@ -614,7 +644,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
614
644
  return { executionContext, result: { status: 'failed', error: result?.error } };
615
645
  } else if (result.status === 'suspended') {
616
646
  const suspendedSteps = Object.entries(result.steps).filter(([_stepName, stepResult]) => {
617
- const stepRes: StepResult<any> = stepResult as StepResult<any>;
647
+ const stepRes: StepResult<any, any, any, any> = stepResult as StepResult<any, any, any, any>;
618
648
  return stepRes?.status === 'suspended';
619
649
  });
620
650
 
@@ -702,7 +732,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
702
732
  );
703
733
 
704
734
  Object.assign(executionContext, res.executionContext);
705
- return res.result as StepResult<any>;
735
+ return res.result as StepResult<any, any, any, any>;
706
736
  }
707
737
 
708
738
  const stepRes = await this.inngestStep.run(`workflow.${executionContext.workflowId}.step.${step.id}`, async () => {
@@ -789,7 +819,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
789
819
  }: {
790
820
  workflowId: string;
791
821
  runId: string;
792
- stepResults: Record<string, StepResult<any>>;
822
+ stepResults: Record<string, StepResult<any, any, any, any>>;
793
823
  executionContext: ExecutionContext;
794
824
  }) {
795
825
  await this.inngestStep.run(
@@ -829,17 +859,17 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
829
859
  entry: { type: 'conditional'; steps: StepFlowEntry[]; conditions: ExecuteFunction<any, any, any, any>[] };
830
860
  prevStep: StepFlowEntry;
831
861
  prevOutput: any;
832
- stepResults: Record<string, StepResult<any>>;
862
+ stepResults: Record<string, StepResult<any, any, any, any>>;
833
863
  resume?: {
834
864
  steps: string[];
835
- stepResults: Record<string, StepResult<any>>;
865
+ stepResults: Record<string, StepResult<any, any, any, any>>;
836
866
  resumePayload: any;
837
867
  resumePath: number[];
838
868
  };
839
869
  executionContext: ExecutionContext;
840
870
  emitter: { emit: (event: string, data: any) => Promise<void> };
841
871
  runtimeContext: RuntimeContext;
842
- }): Promise<StepResult<any>> {
872
+ }): Promise<StepResult<any, any, any, any>> {
843
873
  let execResults: any;
844
874
  const truthyIndexes = (
845
875
  await Promise.all(
@@ -866,7 +896,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
866
896
 
867
897
  // TODO: this function shouldn't have suspend probably?
868
898
  suspend: async (_suspendPayload: any) => {},
869
- emitter,
899
+ [EMITTER_SYMBOL]: emitter,
870
900
  });
871
901
  return result ? index : null;
872
902
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -879,7 +909,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
879
909
  ).filter((index: any): index is number => index !== null);
880
910
 
881
911
  const stepsToRun = entry.steps.filter((_, index) => truthyIndexes.includes(index));
882
- const results: StepResult<any>[] = await Promise.all(
912
+ const results: StepResult<any, any, any, any>[] = await Promise.all(
883
913
  stepsToRun.map((step, index) =>
884
914
  this.executeEntry({
885
915
  workflowId,