@mastra/inngest 0.0.0-transpile-packages-20250724123433 → 0.0.0-transpile-packages-20250730132657
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 +50 -2
- package/dist/_tsup-dts-rollup.d.cts +11 -5
- package/dist/_tsup-dts-rollup.d.ts +11 -5
- package/dist/index.cjs +47 -10
- package/dist/index.js +48 -11
- package/package.json +6 -6
- package/src/index.test.ts +118 -0
- package/src/index.ts +44 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
# @mastra/inngest
|
|
2
2
|
|
|
3
|
-
## 0.0.0-transpile-packages-
|
|
3
|
+
## 0.0.0-transpile-packages-20250730132657
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [3f89307]
|
|
8
|
+
- Updated dependencies [9d49408]
|
|
9
|
+
- Updated dependencies [7a7754f]
|
|
10
|
+
- Updated dependencies [fc92d80]
|
|
11
|
+
- Updated dependencies [3546c40]
|
|
12
|
+
- @mastra/core@0.0.0-transpile-packages-20250730132657
|
|
13
|
+
|
|
14
|
+
## 0.11.6
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- ce088f5: Update all peerdeps to latest core
|
|
19
|
+
- @mastra/core@0.11.1
|
|
20
|
+
|
|
21
|
+
## 0.11.5
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
6
24
|
|
|
@@ -8,20 +26,50 @@
|
|
|
8
26
|
- Updated dependencies [f248d53]
|
|
9
27
|
- Updated dependencies [2affc57]
|
|
10
28
|
- Updated dependencies [66e13e3]
|
|
29
|
+
- Updated dependencies [edd9482]
|
|
11
30
|
- Updated dependencies [18344d7]
|
|
31
|
+
- Updated dependencies [9d372c2]
|
|
12
32
|
- Updated dependencies [40c2525]
|
|
13
33
|
- Updated dependencies [e473f27]
|
|
34
|
+
- Updated dependencies [032cb66]
|
|
14
35
|
- Updated dependencies [703ac71]
|
|
15
36
|
- Updated dependencies [a723d69]
|
|
16
37
|
- Updated dependencies [7827943]
|
|
17
38
|
- Updated dependencies [5889a31]
|
|
18
39
|
- Updated dependencies [bf1e7e7]
|
|
40
|
+
- Updated dependencies [65e3395]
|
|
19
41
|
- Updated dependencies [4933192]
|
|
20
42
|
- Updated dependencies [d1c77a4]
|
|
43
|
+
- Updated dependencies [bea9dd1]
|
|
21
44
|
- Updated dependencies [dcd4802]
|
|
22
45
|
- Updated dependencies [cbddd18]
|
|
23
46
|
- Updated dependencies [7ba91fa]
|
|
24
|
-
- @mastra/core@0.
|
|
47
|
+
- @mastra/core@0.11.0
|
|
48
|
+
|
|
49
|
+
## 0.11.5-alpha.0
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- a723d69: Pass workflowId through
|
|
54
|
+
- Updated dependencies [f248d53]
|
|
55
|
+
- Updated dependencies [2affc57]
|
|
56
|
+
- Updated dependencies [66e13e3]
|
|
57
|
+
- Updated dependencies [edd9482]
|
|
58
|
+
- Updated dependencies [18344d7]
|
|
59
|
+
- Updated dependencies [9d372c2]
|
|
60
|
+
- Updated dependencies [40c2525]
|
|
61
|
+
- Updated dependencies [e473f27]
|
|
62
|
+
- Updated dependencies [032cb66]
|
|
63
|
+
- Updated dependencies [703ac71]
|
|
64
|
+
- Updated dependencies [a723d69]
|
|
65
|
+
- Updated dependencies [5889a31]
|
|
66
|
+
- Updated dependencies [65e3395]
|
|
67
|
+
- Updated dependencies [4933192]
|
|
68
|
+
- Updated dependencies [d1c77a4]
|
|
69
|
+
- Updated dependencies [bea9dd1]
|
|
70
|
+
- Updated dependencies [dcd4802]
|
|
71
|
+
- Updated dependencies [7ba91fa]
|
|
72
|
+
- @mastra/core@0.11.0-alpha.2
|
|
25
73
|
|
|
26
74
|
## 0.11.4
|
|
27
75
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Agent } from '@mastra/core';
|
|
2
2
|
import type { BaseContext } from 'inngest';
|
|
3
|
+
import type { ChunkType } from '@mastra/core/workflows';
|
|
3
4
|
import { ClientOptions } from 'inngest';
|
|
4
5
|
import { DefaultExecutionEngine } from '@mastra/core/workflows';
|
|
5
6
|
import type { Emitter } from '@mastra/core/workflows';
|
|
@@ -94,7 +95,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
94
95
|
abortController: AbortController;
|
|
95
96
|
}): Promise<TOutput>;
|
|
96
97
|
protected fmtReturnValue<TOutput>(executionSpan: Span | undefined, emitter: Emitter, stepResults: Record<string, StepResult<any, any, any, any>>, lastOutput: StepResult<any, any, any, any>, error?: Error | string): Promise<TOutput>;
|
|
97
|
-
superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, abortController, runtimeContext, }: {
|
|
98
|
+
superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, abortController, runtimeContext, writableStream, }: {
|
|
98
99
|
workflowId: string;
|
|
99
100
|
runId: string;
|
|
100
101
|
step: Step<string, any, any>;
|
|
@@ -108,8 +109,9 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
108
109
|
emitter: Emitter;
|
|
109
110
|
abortController: AbortController;
|
|
110
111
|
runtimeContext: RuntimeContext;
|
|
112
|
+
writableStream?: WritableStream<ChunkType>;
|
|
111
113
|
}): Promise<StepResult<any, any, any, any>>;
|
|
112
|
-
executeSleep({ workflowId, runId, entry, prevOutput, stepResults, emitter, abortController, runtimeContext, }: {
|
|
114
|
+
executeSleep({ workflowId, runId, entry, prevOutput, stepResults, emitter, abortController, runtimeContext, writableStream, }: {
|
|
113
115
|
workflowId: string;
|
|
114
116
|
runId: string;
|
|
115
117
|
serializedStepGraph: SerializedStepFlowEntry[];
|
|
@@ -132,8 +134,9 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
132
134
|
emitter: Emitter;
|
|
133
135
|
abortController: AbortController;
|
|
134
136
|
runtimeContext: RuntimeContext;
|
|
137
|
+
writableStream?: WritableStream<ChunkType>;
|
|
135
138
|
}): Promise<void>;
|
|
136
|
-
executeSleepUntil({ workflowId, runId, entry, prevOutput, stepResults, emitter, abortController, runtimeContext, }: {
|
|
139
|
+
executeSleepUntil({ workflowId, runId, entry, prevOutput, stepResults, emitter, abortController, runtimeContext, writableStream, }: {
|
|
137
140
|
workflowId: string;
|
|
138
141
|
runId: string;
|
|
139
142
|
serializedStepGraph: SerializedStepFlowEntry[];
|
|
@@ -156,12 +159,13 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
156
159
|
emitter: Emitter;
|
|
157
160
|
abortController: AbortController;
|
|
158
161
|
runtimeContext: RuntimeContext;
|
|
162
|
+
writableStream?: WritableStream<ChunkType>;
|
|
159
163
|
}): Promise<void>;
|
|
160
164
|
executeWaitForEvent({ event, timeout }: {
|
|
161
165
|
event: string;
|
|
162
166
|
timeout?: number;
|
|
163
167
|
}): Promise<any>;
|
|
164
|
-
executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, abortController, runtimeContext, }: {
|
|
168
|
+
executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, abortController, runtimeContext, writableStream, }: {
|
|
165
169
|
step: Step<string, any, any>;
|
|
166
170
|
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
167
171
|
executionContext: ExecutionContext;
|
|
@@ -174,6 +178,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
174
178
|
emitter: Emitter;
|
|
175
179
|
abortController: AbortController;
|
|
176
180
|
runtimeContext: RuntimeContext;
|
|
181
|
+
writableStream?: WritableStream<ChunkType>;
|
|
177
182
|
}): Promise<StepResult<any, any, any, any>>;
|
|
178
183
|
persistStepUpdate({ workflowId, runId, stepResults, executionContext, serializedStepGraph, workflowStatus, result, error, }: {
|
|
179
184
|
workflowId: string;
|
|
@@ -186,7 +191,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
186
191
|
error?: string | Error;
|
|
187
192
|
runtimeContext: RuntimeContext;
|
|
188
193
|
}): Promise<void>;
|
|
189
|
-
executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, abortController, runtimeContext, }: {
|
|
194
|
+
executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, abortController, runtimeContext, writableStream, }: {
|
|
190
195
|
workflowId: string;
|
|
191
196
|
runId: string;
|
|
192
197
|
entry: {
|
|
@@ -208,6 +213,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
208
213
|
emitter: Emitter;
|
|
209
214
|
abortController: AbortController;
|
|
210
215
|
runtimeContext: RuntimeContext;
|
|
216
|
+
writableStream?: WritableStream<ChunkType>;
|
|
211
217
|
}): Promise<StepResult<any, any, any, any>>;
|
|
212
218
|
}
|
|
213
219
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Agent } from '@mastra/core';
|
|
2
2
|
import type { BaseContext } from 'inngest';
|
|
3
|
+
import type { ChunkType } from '@mastra/core/workflows';
|
|
3
4
|
import { ClientOptions } from 'inngest';
|
|
4
5
|
import { DefaultExecutionEngine } from '@mastra/core/workflows';
|
|
5
6
|
import type { Emitter } from '@mastra/core/workflows';
|
|
@@ -94,7 +95,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
94
95
|
abortController: AbortController;
|
|
95
96
|
}): Promise<TOutput>;
|
|
96
97
|
protected fmtReturnValue<TOutput>(executionSpan: Span | undefined, emitter: Emitter, stepResults: Record<string, StepResult<any, any, any, any>>, lastOutput: StepResult<any, any, any, any>, error?: Error | string): Promise<TOutput>;
|
|
97
|
-
superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, abortController, runtimeContext, }: {
|
|
98
|
+
superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, abortController, runtimeContext, writableStream, }: {
|
|
98
99
|
workflowId: string;
|
|
99
100
|
runId: string;
|
|
100
101
|
step: Step<string, any, any>;
|
|
@@ -108,8 +109,9 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
108
109
|
emitter: Emitter;
|
|
109
110
|
abortController: AbortController;
|
|
110
111
|
runtimeContext: RuntimeContext;
|
|
112
|
+
writableStream?: WritableStream<ChunkType>;
|
|
111
113
|
}): Promise<StepResult<any, any, any, any>>;
|
|
112
|
-
executeSleep({ workflowId, runId, entry, prevOutput, stepResults, emitter, abortController, runtimeContext, }: {
|
|
114
|
+
executeSleep({ workflowId, runId, entry, prevOutput, stepResults, emitter, abortController, runtimeContext, writableStream, }: {
|
|
113
115
|
workflowId: string;
|
|
114
116
|
runId: string;
|
|
115
117
|
serializedStepGraph: SerializedStepFlowEntry[];
|
|
@@ -132,8 +134,9 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
132
134
|
emitter: Emitter;
|
|
133
135
|
abortController: AbortController;
|
|
134
136
|
runtimeContext: RuntimeContext;
|
|
137
|
+
writableStream?: WritableStream<ChunkType>;
|
|
135
138
|
}): Promise<void>;
|
|
136
|
-
executeSleepUntil({ workflowId, runId, entry, prevOutput, stepResults, emitter, abortController, runtimeContext, }: {
|
|
139
|
+
executeSleepUntil({ workflowId, runId, entry, prevOutput, stepResults, emitter, abortController, runtimeContext, writableStream, }: {
|
|
137
140
|
workflowId: string;
|
|
138
141
|
runId: string;
|
|
139
142
|
serializedStepGraph: SerializedStepFlowEntry[];
|
|
@@ -156,12 +159,13 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
156
159
|
emitter: Emitter;
|
|
157
160
|
abortController: AbortController;
|
|
158
161
|
runtimeContext: RuntimeContext;
|
|
162
|
+
writableStream?: WritableStream<ChunkType>;
|
|
159
163
|
}): Promise<void>;
|
|
160
164
|
executeWaitForEvent({ event, timeout }: {
|
|
161
165
|
event: string;
|
|
162
166
|
timeout?: number;
|
|
163
167
|
}): Promise<any>;
|
|
164
|
-
executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, abortController, runtimeContext, }: {
|
|
168
|
+
executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, abortController, runtimeContext, writableStream, }: {
|
|
165
169
|
step: Step<string, any, any>;
|
|
166
170
|
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
167
171
|
executionContext: ExecutionContext;
|
|
@@ -174,6 +178,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
174
178
|
emitter: Emitter;
|
|
175
179
|
abortController: AbortController;
|
|
176
180
|
runtimeContext: RuntimeContext;
|
|
181
|
+
writableStream?: WritableStream<ChunkType>;
|
|
177
182
|
}): Promise<StepResult<any, any, any, any>>;
|
|
178
183
|
persistStepUpdate({ workflowId, runId, stepResults, executionContext, serializedStepGraph, workflowStatus, result, error, }: {
|
|
179
184
|
workflowId: string;
|
|
@@ -186,7 +191,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
186
191
|
error?: string | Error;
|
|
187
192
|
runtimeContext: RuntimeContext;
|
|
188
193
|
}): Promise<void>;
|
|
189
|
-
executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, abortController, runtimeContext, }: {
|
|
194
|
+
executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, abortController, runtimeContext, writableStream, }: {
|
|
190
195
|
workflowId: string;
|
|
191
196
|
runId: string;
|
|
192
197
|
entry: {
|
|
@@ -208,6 +213,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
208
213
|
emitter: Emitter;
|
|
209
214
|
abortController: AbortController;
|
|
210
215
|
runtimeContext: RuntimeContext;
|
|
216
|
+
writableStream?: WritableStream<ChunkType>;
|
|
211
217
|
}): Promise<StepResult<any, any, any, any>>;
|
|
212
218
|
}
|
|
213
219
|
|
package/dist/index.cjs
CHANGED
|
@@ -651,7 +651,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
651
651
|
prevOutput,
|
|
652
652
|
emitter,
|
|
653
653
|
abortController,
|
|
654
|
-
runtimeContext
|
|
654
|
+
runtimeContext,
|
|
655
|
+
writableStream
|
|
655
656
|
}) {
|
|
656
657
|
return super.executeStep({
|
|
657
658
|
workflowId,
|
|
@@ -663,7 +664,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
663
664
|
prevOutput,
|
|
664
665
|
emitter,
|
|
665
666
|
abortController,
|
|
666
|
-
runtimeContext
|
|
667
|
+
runtimeContext,
|
|
668
|
+
writableStream
|
|
667
669
|
});
|
|
668
670
|
}
|
|
669
671
|
// async executeSleep({ id, duration }: { id: string; duration: number }): Promise<void> {
|
|
@@ -677,10 +679,12 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
677
679
|
stepResults,
|
|
678
680
|
emitter,
|
|
679
681
|
abortController,
|
|
680
|
-
runtimeContext
|
|
682
|
+
runtimeContext,
|
|
683
|
+
writableStream
|
|
681
684
|
}) {
|
|
682
685
|
let { duration, fn } = entry;
|
|
683
686
|
if (fn) {
|
|
687
|
+
const stepCallId = crypto.randomUUID();
|
|
684
688
|
duration = await this.inngestStep.run(`workflow.${workflowId}.sleep.${entry.id}`, async () => {
|
|
685
689
|
return await fn({
|
|
686
690
|
runId,
|
|
@@ -710,7 +714,16 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
710
714
|
},
|
|
711
715
|
[_constants.EMITTER_SYMBOL]: emitter,
|
|
712
716
|
engine: { step: this.inngestStep },
|
|
713
|
-
abortSignal: abortController?.signal
|
|
717
|
+
abortSignal: abortController?.signal,
|
|
718
|
+
writer: new tools.ToolStream(
|
|
719
|
+
{
|
|
720
|
+
prefix: "step",
|
|
721
|
+
callId: stepCallId,
|
|
722
|
+
name: "sleep",
|
|
723
|
+
runId
|
|
724
|
+
},
|
|
725
|
+
writableStream
|
|
726
|
+
)
|
|
714
727
|
});
|
|
715
728
|
});
|
|
716
729
|
}
|
|
@@ -724,11 +737,13 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
724
737
|
stepResults,
|
|
725
738
|
emitter,
|
|
726
739
|
abortController,
|
|
727
|
-
runtimeContext
|
|
740
|
+
runtimeContext,
|
|
741
|
+
writableStream
|
|
728
742
|
}) {
|
|
729
743
|
let { date, fn } = entry;
|
|
730
744
|
if (fn) {
|
|
731
745
|
date = await this.inngestStep.run(`workflow.${workflowId}.sleepUntil.${entry.id}`, async () => {
|
|
746
|
+
const stepCallId = crypto.randomUUID();
|
|
732
747
|
return await fn({
|
|
733
748
|
runId,
|
|
734
749
|
workflowId,
|
|
@@ -757,7 +772,16 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
757
772
|
},
|
|
758
773
|
[_constants.EMITTER_SYMBOL]: emitter,
|
|
759
774
|
engine: { step: this.inngestStep },
|
|
760
|
-
abortSignal: abortController?.signal
|
|
775
|
+
abortSignal: abortController?.signal,
|
|
776
|
+
writer: new tools.ToolStream(
|
|
777
|
+
{
|
|
778
|
+
prefix: "step",
|
|
779
|
+
callId: stepCallId,
|
|
780
|
+
name: "sleep",
|
|
781
|
+
runId
|
|
782
|
+
},
|
|
783
|
+
writableStream
|
|
784
|
+
)
|
|
761
785
|
});
|
|
762
786
|
});
|
|
763
787
|
}
|
|
@@ -784,7 +808,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
784
808
|
prevOutput,
|
|
785
809
|
emitter,
|
|
786
810
|
abortController,
|
|
787
|
-
runtimeContext
|
|
811
|
+
runtimeContext,
|
|
812
|
+
writableStream
|
|
788
813
|
}) {
|
|
789
814
|
const startedAt = await this.inngestStep.run(
|
|
790
815
|
`workflow.${executionContext.workflowId}.run.${executionContext.runId}.step.${step.id}.running_ev`,
|
|
@@ -1003,6 +1028,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1003
1028
|
runId: executionContext.runId,
|
|
1004
1029
|
mastra: this.mastra,
|
|
1005
1030
|
runtimeContext,
|
|
1031
|
+
writableStream,
|
|
1006
1032
|
inputData: prevOutput,
|
|
1007
1033
|
resumeData: resume?.steps[0] === step.id ? resume?.resumePayload : void 0,
|
|
1008
1034
|
getInitData: () => stepResults?.input,
|
|
@@ -1162,7 +1188,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1162
1188
|
executionContext,
|
|
1163
1189
|
emitter,
|
|
1164
1190
|
abortController,
|
|
1165
|
-
runtimeContext
|
|
1191
|
+
runtimeContext,
|
|
1192
|
+
writableStream
|
|
1166
1193
|
}) {
|
|
1167
1194
|
let execResults;
|
|
1168
1195
|
const truthyIndexes = (await Promise.all(
|
|
@@ -1199,7 +1226,16 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1199
1226
|
engine: {
|
|
1200
1227
|
step: this.inngestStep
|
|
1201
1228
|
},
|
|
1202
|
-
abortSignal: abortController.signal
|
|
1229
|
+
abortSignal: abortController.signal,
|
|
1230
|
+
writer: new tools.ToolStream(
|
|
1231
|
+
{
|
|
1232
|
+
prefix: "step",
|
|
1233
|
+
callId: crypto.randomUUID(),
|
|
1234
|
+
name: "conditional",
|
|
1235
|
+
runId
|
|
1236
|
+
},
|
|
1237
|
+
writableStream
|
|
1238
|
+
)
|
|
1203
1239
|
});
|
|
1204
1240
|
return result ? index : null;
|
|
1205
1241
|
} catch (e) {
|
|
@@ -1229,7 +1265,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1229
1265
|
},
|
|
1230
1266
|
emitter,
|
|
1231
1267
|
abortController,
|
|
1232
|
-
runtimeContext
|
|
1268
|
+
runtimeContext,
|
|
1269
|
+
writableStream
|
|
1233
1270
|
})
|
|
1234
1271
|
)
|
|
1235
1272
|
);
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { randomUUID } from 'crypto';
|
|
2
2
|
import { subscribe } from '@inngest/realtime';
|
|
3
3
|
import { RuntimeContext } from '@mastra/core/di';
|
|
4
|
-
import { Tool } from '@mastra/core/tools';
|
|
4
|
+
import { ToolStream, Tool } from '@mastra/core/tools';
|
|
5
5
|
import { Run, Workflow, DefaultExecutionEngine } from '@mastra/core/workflows';
|
|
6
6
|
import { EMITTER_SYMBOL } from '@mastra/core/workflows/_constants';
|
|
7
7
|
import { serve as serve$1 } from 'inngest/hono';
|
|
@@ -649,7 +649,8 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
|
|
|
649
649
|
prevOutput,
|
|
650
650
|
emitter,
|
|
651
651
|
abortController,
|
|
652
|
-
runtimeContext
|
|
652
|
+
runtimeContext,
|
|
653
|
+
writableStream
|
|
653
654
|
}) {
|
|
654
655
|
return super.executeStep({
|
|
655
656
|
workflowId,
|
|
@@ -661,7 +662,8 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
|
|
|
661
662
|
prevOutput,
|
|
662
663
|
emitter,
|
|
663
664
|
abortController,
|
|
664
|
-
runtimeContext
|
|
665
|
+
runtimeContext,
|
|
666
|
+
writableStream
|
|
665
667
|
});
|
|
666
668
|
}
|
|
667
669
|
// async executeSleep({ id, duration }: { id: string; duration: number }): Promise<void> {
|
|
@@ -675,10 +677,12 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
|
|
|
675
677
|
stepResults,
|
|
676
678
|
emitter,
|
|
677
679
|
abortController,
|
|
678
|
-
runtimeContext
|
|
680
|
+
runtimeContext,
|
|
681
|
+
writableStream
|
|
679
682
|
}) {
|
|
680
683
|
let { duration, fn } = entry;
|
|
681
684
|
if (fn) {
|
|
685
|
+
const stepCallId = randomUUID();
|
|
682
686
|
duration = await this.inngestStep.run(`workflow.${workflowId}.sleep.${entry.id}`, async () => {
|
|
683
687
|
return await fn({
|
|
684
688
|
runId,
|
|
@@ -708,7 +712,16 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
|
|
|
708
712
|
},
|
|
709
713
|
[EMITTER_SYMBOL]: emitter,
|
|
710
714
|
engine: { step: this.inngestStep },
|
|
711
|
-
abortSignal: abortController?.signal
|
|
715
|
+
abortSignal: abortController?.signal,
|
|
716
|
+
writer: new ToolStream(
|
|
717
|
+
{
|
|
718
|
+
prefix: "step",
|
|
719
|
+
callId: stepCallId,
|
|
720
|
+
name: "sleep",
|
|
721
|
+
runId
|
|
722
|
+
},
|
|
723
|
+
writableStream
|
|
724
|
+
)
|
|
712
725
|
});
|
|
713
726
|
});
|
|
714
727
|
}
|
|
@@ -722,11 +735,13 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
|
|
|
722
735
|
stepResults,
|
|
723
736
|
emitter,
|
|
724
737
|
abortController,
|
|
725
|
-
runtimeContext
|
|
738
|
+
runtimeContext,
|
|
739
|
+
writableStream
|
|
726
740
|
}) {
|
|
727
741
|
let { date, fn } = entry;
|
|
728
742
|
if (fn) {
|
|
729
743
|
date = await this.inngestStep.run(`workflow.${workflowId}.sleepUntil.${entry.id}`, async () => {
|
|
744
|
+
const stepCallId = randomUUID();
|
|
730
745
|
return await fn({
|
|
731
746
|
runId,
|
|
732
747
|
workflowId,
|
|
@@ -755,7 +770,16 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
|
|
|
755
770
|
},
|
|
756
771
|
[EMITTER_SYMBOL]: emitter,
|
|
757
772
|
engine: { step: this.inngestStep },
|
|
758
|
-
abortSignal: abortController?.signal
|
|
773
|
+
abortSignal: abortController?.signal,
|
|
774
|
+
writer: new ToolStream(
|
|
775
|
+
{
|
|
776
|
+
prefix: "step",
|
|
777
|
+
callId: stepCallId,
|
|
778
|
+
name: "sleep",
|
|
779
|
+
runId
|
|
780
|
+
},
|
|
781
|
+
writableStream
|
|
782
|
+
)
|
|
759
783
|
});
|
|
760
784
|
});
|
|
761
785
|
}
|
|
@@ -782,7 +806,8 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
|
|
|
782
806
|
prevOutput,
|
|
783
807
|
emitter,
|
|
784
808
|
abortController,
|
|
785
|
-
runtimeContext
|
|
809
|
+
runtimeContext,
|
|
810
|
+
writableStream
|
|
786
811
|
}) {
|
|
787
812
|
const startedAt = await this.inngestStep.run(
|
|
788
813
|
`workflow.${executionContext.workflowId}.run.${executionContext.runId}.step.${step.id}.running_ev`,
|
|
@@ -1001,6 +1026,7 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
|
|
|
1001
1026
|
runId: executionContext.runId,
|
|
1002
1027
|
mastra: this.mastra,
|
|
1003
1028
|
runtimeContext,
|
|
1029
|
+
writableStream,
|
|
1004
1030
|
inputData: prevOutput,
|
|
1005
1031
|
resumeData: resume?.steps[0] === step.id ? resume?.resumePayload : void 0,
|
|
1006
1032
|
getInitData: () => stepResults?.input,
|
|
@@ -1160,7 +1186,8 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
|
|
|
1160
1186
|
executionContext,
|
|
1161
1187
|
emitter,
|
|
1162
1188
|
abortController,
|
|
1163
|
-
runtimeContext
|
|
1189
|
+
runtimeContext,
|
|
1190
|
+
writableStream
|
|
1164
1191
|
}) {
|
|
1165
1192
|
let execResults;
|
|
1166
1193
|
const truthyIndexes = (await Promise.all(
|
|
@@ -1197,7 +1224,16 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
|
|
|
1197
1224
|
engine: {
|
|
1198
1225
|
step: this.inngestStep
|
|
1199
1226
|
},
|
|
1200
|
-
abortSignal: abortController.signal
|
|
1227
|
+
abortSignal: abortController.signal,
|
|
1228
|
+
writer: new ToolStream(
|
|
1229
|
+
{
|
|
1230
|
+
prefix: "step",
|
|
1231
|
+
callId: randomUUID(),
|
|
1232
|
+
name: "conditional",
|
|
1233
|
+
runId
|
|
1234
|
+
},
|
|
1235
|
+
writableStream
|
|
1236
|
+
)
|
|
1201
1237
|
});
|
|
1202
1238
|
return result ? index : null;
|
|
1203
1239
|
} catch (e) {
|
|
@@ -1227,7 +1263,8 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
|
|
|
1227
1263
|
},
|
|
1228
1264
|
emitter,
|
|
1229
1265
|
abortController,
|
|
1230
|
-
runtimeContext
|
|
1266
|
+
runtimeContext,
|
|
1267
|
+
writableStream
|
|
1231
1268
|
})
|
|
1232
1269
|
)
|
|
1233
1270
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/inngest",
|
|
3
|
-
"version": "0.0.0-transpile-packages-
|
|
3
|
+
"version": "0.0.0-transpile-packages-20250730132657",
|
|
4
4
|
"description": "Mastra Inngest integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"tsup": "^8.5.0",
|
|
39
39
|
"typescript": "^5.8.3",
|
|
40
40
|
"vitest": "^3.2.4",
|
|
41
|
-
"@mastra/core": "0.0.0-transpile-packages-
|
|
42
|
-
"@mastra/libsql": "0.0.0-transpile-packages-
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
41
|
+
"@mastra/core": "0.0.0-transpile-packages-20250730132657",
|
|
42
|
+
"@mastra/libsql": "0.0.0-transpile-packages-20250730132657",
|
|
43
|
+
"@mastra/deployer": "0.0.0-transpile-packages-20250730132657",
|
|
44
|
+
"@internal/lint": "0.0.0-transpile-packages-20250730132657"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@mastra/core": "0.0.0-transpile-packages-
|
|
47
|
+
"@mastra/core": "0.0.0-transpile-packages-20250730132657"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
|
package/src/index.test.ts
CHANGED
|
@@ -4258,6 +4258,124 @@ describe('MastraInngestWorkflow', () => {
|
|
|
4258
4258
|
|
|
4259
4259
|
expect(promptAgentAction).toHaveBeenCalledTimes(2);
|
|
4260
4260
|
});
|
|
4261
|
+
|
|
4262
|
+
it('should handle consecutive nested workflows with suspend/resume', async ctx => {
|
|
4263
|
+
const inngest = new Inngest({
|
|
4264
|
+
id: 'mastra',
|
|
4265
|
+
baseUrl: `http://localhost:${(ctx as any).inngestPort}`,
|
|
4266
|
+
middleware: [realtimeMiddleware()],
|
|
4267
|
+
});
|
|
4268
|
+
|
|
4269
|
+
const { createWorkflow, createStep } = init(inngest);
|
|
4270
|
+
|
|
4271
|
+
const step1 = vi.fn().mockImplementation(async ({ resumeData, suspend }) => {
|
|
4272
|
+
if (!resumeData?.suspect) {
|
|
4273
|
+
return await suspend({ message: 'What is the suspect?' });
|
|
4274
|
+
}
|
|
4275
|
+
return { suspect: resumeData.suspect };
|
|
4276
|
+
});
|
|
4277
|
+
const step1Definition = createStep({
|
|
4278
|
+
id: 'step-1',
|
|
4279
|
+
inputSchema: z.object({ suspect: z.string() }),
|
|
4280
|
+
outputSchema: z.object({ suspect: z.string() }),
|
|
4281
|
+
suspendSchema: z.object({ message: z.string() }),
|
|
4282
|
+
resumeSchema: z.object({ suspect: z.string() }),
|
|
4283
|
+
execute: step1,
|
|
4284
|
+
});
|
|
4285
|
+
|
|
4286
|
+
const step2 = vi.fn().mockImplementation(async ({ resumeData, suspend }) => {
|
|
4287
|
+
if (!resumeData?.suspect) {
|
|
4288
|
+
return await suspend({ message: 'What is the second suspect?' });
|
|
4289
|
+
}
|
|
4290
|
+
return { suspect: resumeData.suspect };
|
|
4291
|
+
});
|
|
4292
|
+
const step2Definition = createStep({
|
|
4293
|
+
id: 'step-2',
|
|
4294
|
+
inputSchema: z.object({ suspect: z.string() }),
|
|
4295
|
+
outputSchema: z.object({ suspect: z.string() }),
|
|
4296
|
+
suspendSchema: z.object({ message: z.string() }),
|
|
4297
|
+
resumeSchema: z.object({ suspect: z.string() }),
|
|
4298
|
+
execute: step2,
|
|
4299
|
+
});
|
|
4300
|
+
|
|
4301
|
+
const subWorkflow1 = createWorkflow({
|
|
4302
|
+
id: 'sub-workflow-1',
|
|
4303
|
+
inputSchema: z.object({ suspect: z.string() }),
|
|
4304
|
+
outputSchema: z.object({ suspect: z.string() }),
|
|
4305
|
+
})
|
|
4306
|
+
.then(step1Definition)
|
|
4307
|
+
.commit();
|
|
4308
|
+
|
|
4309
|
+
const subWorkflow2 = createWorkflow({
|
|
4310
|
+
id: 'sub-workflow-2',
|
|
4311
|
+
inputSchema: z.object({ suspect: z.string() }),
|
|
4312
|
+
outputSchema: z.object({ suspect: z.string() }),
|
|
4313
|
+
})
|
|
4314
|
+
.then(step2Definition)
|
|
4315
|
+
.commit();
|
|
4316
|
+
|
|
4317
|
+
const mainWorkflow = createWorkflow({
|
|
4318
|
+
id: 'main-workflow',
|
|
4319
|
+
inputSchema: z.object({ suspect: z.string() }),
|
|
4320
|
+
outputSchema: z.object({ suspect: z.string() }),
|
|
4321
|
+
})
|
|
4322
|
+
.then(subWorkflow1)
|
|
4323
|
+
.then(subWorkflow2)
|
|
4324
|
+
.commit();
|
|
4325
|
+
|
|
4326
|
+
const mastra = new Mastra({
|
|
4327
|
+
logger: false,
|
|
4328
|
+
storage: new DefaultStorage({
|
|
4329
|
+
url: ':memory:',
|
|
4330
|
+
}),
|
|
4331
|
+
workflows: { mainWorkflow },
|
|
4332
|
+
server: {
|
|
4333
|
+
apiRoutes: [
|
|
4334
|
+
{
|
|
4335
|
+
path: '/inngest/api',
|
|
4336
|
+
method: 'ALL',
|
|
4337
|
+
createHandler: async ({ mastra }) => inngestServe({ mastra, inngest }),
|
|
4338
|
+
},
|
|
4339
|
+
],
|
|
4340
|
+
},
|
|
4341
|
+
});
|
|
4342
|
+
|
|
4343
|
+
const app = await createHonoServer(mastra);
|
|
4344
|
+
|
|
4345
|
+
const srv = (globServer = serve({
|
|
4346
|
+
fetch: app.fetch,
|
|
4347
|
+
port: (ctx as any).handlerPort,
|
|
4348
|
+
}));
|
|
4349
|
+
await resetInngest();
|
|
4350
|
+
|
|
4351
|
+
const run = await mainWorkflow.createRunAsync();
|
|
4352
|
+
|
|
4353
|
+
const initialResult = await run.start({ inputData: { suspect: 'initial-suspect' } });
|
|
4354
|
+
expect(initialResult.status).toBe('suspended');
|
|
4355
|
+
|
|
4356
|
+
const firstResumeResult = await run.resume({
|
|
4357
|
+
step: ['sub-workflow-1', 'step-1'],
|
|
4358
|
+
resumeData: { suspect: 'first-suspect' },
|
|
4359
|
+
});
|
|
4360
|
+
expect(firstResumeResult.status).toBe('suspended');
|
|
4361
|
+
|
|
4362
|
+
const secondResumeResult = await run.resume({
|
|
4363
|
+
step: ['sub-workflow-2', 'step-2'],
|
|
4364
|
+
resumeData: { suspect: 'second-suspect' },
|
|
4365
|
+
});
|
|
4366
|
+
|
|
4367
|
+
expect(step1).toHaveBeenCalledTimes(2);
|
|
4368
|
+
expect(step2).toHaveBeenCalledTimes(2);
|
|
4369
|
+
expect(secondResumeResult.status).toBe('success');
|
|
4370
|
+
expect(secondResumeResult.steps['sub-workflow-1']).toMatchObject({
|
|
4371
|
+
status: 'success',
|
|
4372
|
+
});
|
|
4373
|
+
expect(secondResumeResult.steps['sub-workflow-2']).toMatchObject({
|
|
4374
|
+
status: 'success',
|
|
4375
|
+
});
|
|
4376
|
+
|
|
4377
|
+
srv.close();
|
|
4378
|
+
});
|
|
4261
4379
|
});
|
|
4262
4380
|
|
|
4263
4381
|
describe('Accessing Mastra', () => {
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { ReadableStream } from 'node:stream/web';
|
|
|
3
3
|
import { subscribe } from '@inngest/realtime';
|
|
4
4
|
import type { Agent, Mastra, ToolExecutionContext, WorkflowRun, WorkflowRuns } from '@mastra/core';
|
|
5
5
|
import { RuntimeContext } from '@mastra/core/di';
|
|
6
|
-
import { Tool } from '@mastra/core/tools';
|
|
6
|
+
import { Tool, ToolStream } from '@mastra/core/tools';
|
|
7
7
|
import { Workflow, Run, DefaultExecutionEngine } from '@mastra/core/workflows';
|
|
8
8
|
import type {
|
|
9
9
|
ExecuteFunction,
|
|
@@ -20,6 +20,7 @@ import type {
|
|
|
20
20
|
Emitter,
|
|
21
21
|
WatchEvent,
|
|
22
22
|
StreamEvent,
|
|
23
|
+
ChunkType,
|
|
23
24
|
} from '@mastra/core/workflows';
|
|
24
25
|
import { EMITTER_SYMBOL } from '@mastra/core/workflows/_constants';
|
|
25
26
|
import type { Span } from '@opentelemetry/api';
|
|
@@ -969,6 +970,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
969
970
|
emitter,
|
|
970
971
|
abortController,
|
|
971
972
|
runtimeContext,
|
|
973
|
+
writableStream,
|
|
972
974
|
}: {
|
|
973
975
|
workflowId: string;
|
|
974
976
|
runId: string;
|
|
@@ -983,6 +985,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
983
985
|
emitter: Emitter;
|
|
984
986
|
abortController: AbortController;
|
|
985
987
|
runtimeContext: RuntimeContext;
|
|
988
|
+
writableStream?: WritableStream<ChunkType>;
|
|
986
989
|
}): Promise<StepResult<any, any, any, any>> {
|
|
987
990
|
return super.executeStep({
|
|
988
991
|
workflowId,
|
|
@@ -995,6 +998,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
995
998
|
emitter,
|
|
996
999
|
abortController,
|
|
997
1000
|
runtimeContext,
|
|
1001
|
+
writableStream,
|
|
998
1002
|
});
|
|
999
1003
|
}
|
|
1000
1004
|
|
|
@@ -1011,6 +1015,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
1011
1015
|
emitter,
|
|
1012
1016
|
abortController,
|
|
1013
1017
|
runtimeContext,
|
|
1018
|
+
writableStream,
|
|
1014
1019
|
}: {
|
|
1015
1020
|
workflowId: string;
|
|
1016
1021
|
runId: string;
|
|
@@ -1034,10 +1039,12 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
1034
1039
|
emitter: Emitter;
|
|
1035
1040
|
abortController: AbortController;
|
|
1036
1041
|
runtimeContext: RuntimeContext;
|
|
1042
|
+
writableStream?: WritableStream<ChunkType>;
|
|
1037
1043
|
}): Promise<void> {
|
|
1038
1044
|
let { duration, fn } = entry;
|
|
1039
1045
|
|
|
1040
1046
|
if (fn) {
|
|
1047
|
+
const stepCallId = randomUUID();
|
|
1041
1048
|
duration = await this.inngestStep.run(`workflow.${workflowId}.sleep.${entry.id}`, async () => {
|
|
1042
1049
|
return await fn({
|
|
1043
1050
|
runId,
|
|
@@ -1069,6 +1076,15 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
1069
1076
|
[EMITTER_SYMBOL]: emitter,
|
|
1070
1077
|
engine: { step: this.inngestStep },
|
|
1071
1078
|
abortSignal: abortController?.signal,
|
|
1079
|
+
writer: new ToolStream(
|
|
1080
|
+
{
|
|
1081
|
+
prefix: 'step',
|
|
1082
|
+
callId: stepCallId,
|
|
1083
|
+
name: 'sleep',
|
|
1084
|
+
runId,
|
|
1085
|
+
},
|
|
1086
|
+
writableStream,
|
|
1087
|
+
),
|
|
1072
1088
|
});
|
|
1073
1089
|
});
|
|
1074
1090
|
}
|
|
@@ -1085,6 +1101,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
1085
1101
|
emitter,
|
|
1086
1102
|
abortController,
|
|
1087
1103
|
runtimeContext,
|
|
1104
|
+
writableStream,
|
|
1088
1105
|
}: {
|
|
1089
1106
|
workflowId: string;
|
|
1090
1107
|
runId: string;
|
|
@@ -1108,11 +1125,13 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
1108
1125
|
emitter: Emitter;
|
|
1109
1126
|
abortController: AbortController;
|
|
1110
1127
|
runtimeContext: RuntimeContext;
|
|
1128
|
+
writableStream?: WritableStream<ChunkType>;
|
|
1111
1129
|
}): Promise<void> {
|
|
1112
1130
|
let { date, fn } = entry;
|
|
1113
1131
|
|
|
1114
1132
|
if (fn) {
|
|
1115
1133
|
date = await this.inngestStep.run(`workflow.${workflowId}.sleepUntil.${entry.id}`, async () => {
|
|
1134
|
+
const stepCallId = randomUUID();
|
|
1116
1135
|
return await fn({
|
|
1117
1136
|
runId,
|
|
1118
1137
|
workflowId,
|
|
@@ -1143,6 +1162,15 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
1143
1162
|
[EMITTER_SYMBOL]: emitter,
|
|
1144
1163
|
engine: { step: this.inngestStep },
|
|
1145
1164
|
abortSignal: abortController?.signal,
|
|
1165
|
+
writer: new ToolStream(
|
|
1166
|
+
{
|
|
1167
|
+
prefix: 'step',
|
|
1168
|
+
callId: stepCallId,
|
|
1169
|
+
name: 'sleep',
|
|
1170
|
+
runId,
|
|
1171
|
+
},
|
|
1172
|
+
writableStream,
|
|
1173
|
+
),
|
|
1146
1174
|
});
|
|
1147
1175
|
});
|
|
1148
1176
|
}
|
|
@@ -1176,6 +1204,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
1176
1204
|
emitter,
|
|
1177
1205
|
abortController,
|
|
1178
1206
|
runtimeContext,
|
|
1207
|
+
writableStream,
|
|
1179
1208
|
}: {
|
|
1180
1209
|
step: Step<string, any, any>;
|
|
1181
1210
|
stepResults: Record<string, StepResult<any, any, any, any>>;
|
|
@@ -1189,6 +1218,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
1189
1218
|
emitter: Emitter;
|
|
1190
1219
|
abortController: AbortController;
|
|
1191
1220
|
runtimeContext: RuntimeContext;
|
|
1221
|
+
writableStream?: WritableStream<ChunkType>;
|
|
1192
1222
|
}): Promise<StepResult<any, any, any, any>> {
|
|
1193
1223
|
const startedAt = await this.inngestStep.run(
|
|
1194
1224
|
`workflow.${executionContext.workflowId}.run.${executionContext.runId}.step.${step.id}.running_ev`,
|
|
@@ -1432,6 +1462,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
1432
1462
|
runId: executionContext.runId,
|
|
1433
1463
|
mastra: this.mastra!,
|
|
1434
1464
|
runtimeContext,
|
|
1465
|
+
writableStream,
|
|
1435
1466
|
inputData: prevOutput,
|
|
1436
1467
|
resumeData: resume?.steps[0] === step.id ? resume?.resumePayload : undefined,
|
|
1437
1468
|
getInitData: () => stepResults?.input as any,
|
|
@@ -1617,6 +1648,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
1617
1648
|
emitter,
|
|
1618
1649
|
abortController,
|
|
1619
1650
|
runtimeContext,
|
|
1651
|
+
writableStream,
|
|
1620
1652
|
}: {
|
|
1621
1653
|
workflowId: string;
|
|
1622
1654
|
runId: string;
|
|
@@ -1639,6 +1671,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
1639
1671
|
emitter: Emitter;
|
|
1640
1672
|
abortController: AbortController;
|
|
1641
1673
|
runtimeContext: RuntimeContext;
|
|
1674
|
+
writableStream?: WritableStream<ChunkType>;
|
|
1642
1675
|
}): Promise<StepResult<any, any, any, any>> {
|
|
1643
1676
|
let execResults: any;
|
|
1644
1677
|
const truthyIndexes = (
|
|
@@ -1678,6 +1711,15 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
1678
1711
|
step: this.inngestStep,
|
|
1679
1712
|
},
|
|
1680
1713
|
abortSignal: abortController.signal,
|
|
1714
|
+
writer: new ToolStream(
|
|
1715
|
+
{
|
|
1716
|
+
prefix: 'step',
|
|
1717
|
+
callId: randomUUID(),
|
|
1718
|
+
name: 'conditional',
|
|
1719
|
+
runId,
|
|
1720
|
+
},
|
|
1721
|
+
writableStream,
|
|
1722
|
+
),
|
|
1681
1723
|
});
|
|
1682
1724
|
return result ? index : null;
|
|
1683
1725
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -1711,6 +1753,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
|
|
|
1711
1753
|
emitter,
|
|
1712
1754
|
abortController,
|
|
1713
1755
|
runtimeContext,
|
|
1756
|
+
writableStream,
|
|
1714
1757
|
}),
|
|
1715
1758
|
),
|
|
1716
1759
|
);
|