@mastra/inngest 0.0.0-tool-call-parts-20250630193309 → 0.0.0-tsconfig-compile-20250703214351

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,21 +1,81 @@
1
1
  # @mastra/inngest
2
2
 
3
- ## 0.0.0-tool-call-parts-20250630193309
3
+ ## 0.0.0-tsconfig-compile-20250703214351
4
4
 
5
5
  ### Patch Changes
6
6
 
7
+ - b790fd1: Ability to pass a function to .sleep()/.sleepUntil()
8
+ - Updated dependencies [b790fd1]
9
+ - Updated dependencies [f36e4f1]
10
+ - @mastra/core@0.0.0-tsconfig-compile-20250703214351
11
+
12
+ ## 0.11.2
13
+
14
+ ### Patch Changes
15
+
16
+ - 48d9738: Fix inngest sleep stream events
17
+ - Updated dependencies [4d3fbdf]
18
+ - @mastra/core@0.10.10
19
+
20
+ ## 0.11.2-alpha.0
21
+
22
+ ### Patch Changes
23
+
24
+ - 48d9738: Fix inngest sleep stream events
25
+ - Updated dependencies [4d3fbdf]
26
+ - @mastra/core@0.10.10-alpha.0
27
+
28
+ ## 0.11.1
29
+
30
+ ### Patch Changes
31
+
32
+ - e423a31: Fix bug where nested workflows would cause Inngest duplicate key error
33
+ - 764f86a: Introduces the runCount property in the execution parameters for the steps execute function
34
+ - 1760a1c: Use workflow stream in playground instead of watch
35
+ - 038e5ae: Add cancel workflow run
36
+ - 81a1b3b: Update peerdeps
37
+ - Updated dependencies [9dda1ac]
38
+ - Updated dependencies [c984582]
39
+ - Updated dependencies [7e801dd]
40
+ - Updated dependencies [a606c75]
41
+ - Updated dependencies [7aa70a4]
42
+ - Updated dependencies [764f86a]
43
+ - Updated dependencies [1760a1c]
44
+ - Updated dependencies [038e5ae]
45
+ - Updated dependencies [7dda16a]
46
+ - Updated dependencies [5ebfcdd]
47
+ - Updated dependencies [b2d0c91]
48
+ - Updated dependencies [4e809ad]
49
+ - Updated dependencies [57929df]
50
+ - Updated dependencies [b7852ed]
51
+ - Updated dependencies [6320a61]
52
+ - @mastra/core@0.10.9
53
+
54
+ ## 0.11.1-alpha.0
55
+
56
+ ### Patch Changes
57
+
58
+ - e423a31: Fix bug where nested workflows would cause Inngest duplicate key error
7
59
  - 764f86a: Introduces the runCount property in the execution parameters for the steps execute function
8
60
  - 1760a1c: Use workflow stream in playground instead of watch
61
+ - 038e5ae: Add cancel workflow run
62
+ - 81a1b3b: Update peerdeps
9
63
  - Updated dependencies [9dda1ac]
64
+ - Updated dependencies [c984582]
10
65
  - Updated dependencies [7e801dd]
66
+ - Updated dependencies [a606c75]
11
67
  - Updated dependencies [7aa70a4]
12
68
  - Updated dependencies [764f86a]
13
69
  - Updated dependencies [1760a1c]
70
+ - Updated dependencies [038e5ae]
14
71
  - Updated dependencies [7dda16a]
15
- - Updated dependencies [d80069a]
72
+ - Updated dependencies [5ebfcdd]
73
+ - Updated dependencies [b2d0c91]
74
+ - Updated dependencies [4e809ad]
16
75
  - Updated dependencies [57929df]
76
+ - Updated dependencies [b7852ed]
17
77
  - Updated dependencies [6320a61]
18
- - @mastra/core@0.0.0-tool-call-parts-20250630193309
78
+ - @mastra/core@0.10.9-alpha.0
19
79
 
20
80
  ## 0.11.0
21
81
 
@@ -91,9 +91,10 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
91
91
  delay?: number;
92
92
  };
93
93
  runtimeContext: RuntimeContext;
94
+ abortController: AbortController;
94
95
  }): Promise<TOutput>;
95
96
  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>;
96
- superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
97
+ superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, abortController, runtimeContext, }: {
97
98
  workflowId: string;
98
99
  runId: string;
99
100
  step: Step<string, any, any>;
@@ -105,29 +106,65 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
105
106
  };
106
107
  prevOutput: any;
107
108
  emitter: Emitter;
109
+ abortController: AbortController;
108
110
  runtimeContext: RuntimeContext;
109
111
  }): Promise<StepResult<any, any, any, any>>;
110
- executeSleep({ id, duration }: {
111
- id: string;
112
- duration: number;
112
+ executeSleep({ workflowId, runId, entry, prevOutput, stepResults, emitter, abortController, runtimeContext, }: {
113
+ workflowId: string;
114
+ runId: string;
115
+ serializedStepGraph: SerializedStepFlowEntry[];
116
+ entry: {
117
+ type: 'sleep';
118
+ id: string;
119
+ duration?: number;
120
+ fn?: ExecuteFunction<any, any, any, any, InngestEngineType>;
121
+ };
122
+ prevStep: StepFlowEntry;
123
+ prevOutput: any;
124
+ stepResults: Record<string, StepResult<any, any, any, any>>;
125
+ resume?: {
126
+ steps: string[];
127
+ stepResults: Record<string, StepResult<any, any, any, any>>;
128
+ resumePayload: any;
129
+ resumePath: number[];
130
+ };
131
+ executionContext: ExecutionContext;
132
+ emitter: Emitter;
133
+ abortController: AbortController;
134
+ runtimeContext: RuntimeContext;
135
+ }): Promise<void>;
136
+ executeSleepUntil({ workflowId, runId, entry, prevOutput, stepResults, emitter, abortController, runtimeContext, }: {
137
+ workflowId: string;
138
+ runId: string;
139
+ serializedStepGraph: SerializedStepFlowEntry[];
140
+ entry: {
141
+ type: 'sleepUntil';
142
+ id: string;
143
+ date?: Date;
144
+ fn?: ExecuteFunction<any, any, any, any, InngestEngineType>;
145
+ };
146
+ prevStep: StepFlowEntry;
147
+ prevOutput: any;
148
+ stepResults: Record<string, StepResult<any, any, any, any>>;
149
+ resume?: {
150
+ steps: string[];
151
+ stepResults: Record<string, StepResult<any, any, any, any>>;
152
+ resumePayload: any;
153
+ resumePath: number[];
154
+ };
155
+ executionContext: ExecutionContext;
156
+ emitter: Emitter;
157
+ abortController: AbortController;
158
+ runtimeContext: RuntimeContext;
113
159
  }): Promise<void>;
114
160
  executeWaitForEvent({ event, timeout }: {
115
161
  event: string;
116
162
  timeout?: number;
117
163
  }): Promise<any>;
118
- executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
164
+ executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, abortController, runtimeContext, }: {
119
165
  step: Step<string, any, any>;
120
166
  stepResults: Record<string, StepResult<any, any, any, any>>;
121
- executionContext: {
122
- workflowId: string;
123
- runId: string;
124
- executionPath: number[];
125
- suspendedPaths: Record<string, number[]>;
126
- retryConfig: {
127
- attempts: number;
128
- delay: number;
129
- };
130
- };
167
+ executionContext: ExecutionContext;
131
168
  resume?: {
132
169
  steps: string[];
133
170
  resumePayload: any;
@@ -135,6 +172,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
135
172
  };
136
173
  prevOutput: any;
137
174
  emitter: Emitter;
175
+ abortController: AbortController;
138
176
  runtimeContext: RuntimeContext;
139
177
  }): Promise<StepResult<any, any, any, any>>;
140
178
  persistStepUpdate({ workflowId, runId, stepResults, executionContext, serializedStepGraph, workflowStatus, result, error, }: {
@@ -147,7 +185,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
147
185
  result?: Record<string, any>;
148
186
  error?: string | Error;
149
187
  }): Promise<void>;
150
- executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, runtimeContext, }: {
188
+ executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, abortController, runtimeContext, }: {
151
189
  workflowId: string;
152
190
  runId: string;
153
191
  entry: {
@@ -167,6 +205,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
167
205
  };
168
206
  executionContext: ExecutionContext;
169
207
  emitter: Emitter;
208
+ abortController: AbortController;
170
209
  runtimeContext: RuntimeContext;
171
210
  }): Promise<StepResult<any, any, any, any>>;
172
211
  }
@@ -191,6 +230,7 @@ export declare class InngestRun<TEngineType = InngestEngineType, TSteps extends
191
230
  getRuns(eventId: string): Promise<any>;
192
231
  getRunOutput(eventId: string): Promise<any>;
193
232
  sendEvent(event: string, data: any): Promise<void>;
233
+ cancel(): Promise<void>;
194
234
  start({ inputData, }: {
195
235
  inputData?: z.infer<TInput>;
196
236
  runtimeContext?: RuntimeContext;
@@ -91,9 +91,10 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
91
91
  delay?: number;
92
92
  };
93
93
  runtimeContext: RuntimeContext;
94
+ abortController: AbortController;
94
95
  }): Promise<TOutput>;
95
96
  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>;
96
- superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
97
+ superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, abortController, runtimeContext, }: {
97
98
  workflowId: string;
98
99
  runId: string;
99
100
  step: Step<string, any, any>;
@@ -105,29 +106,65 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
105
106
  };
106
107
  prevOutput: any;
107
108
  emitter: Emitter;
109
+ abortController: AbortController;
108
110
  runtimeContext: RuntimeContext;
109
111
  }): Promise<StepResult<any, any, any, any>>;
110
- executeSleep({ id, duration }: {
111
- id: string;
112
- duration: number;
112
+ executeSleep({ workflowId, runId, entry, prevOutput, stepResults, emitter, abortController, runtimeContext, }: {
113
+ workflowId: string;
114
+ runId: string;
115
+ serializedStepGraph: SerializedStepFlowEntry[];
116
+ entry: {
117
+ type: 'sleep';
118
+ id: string;
119
+ duration?: number;
120
+ fn?: ExecuteFunction<any, any, any, any, InngestEngineType>;
121
+ };
122
+ prevStep: StepFlowEntry;
123
+ prevOutput: any;
124
+ stepResults: Record<string, StepResult<any, any, any, any>>;
125
+ resume?: {
126
+ steps: string[];
127
+ stepResults: Record<string, StepResult<any, any, any, any>>;
128
+ resumePayload: any;
129
+ resumePath: number[];
130
+ };
131
+ executionContext: ExecutionContext;
132
+ emitter: Emitter;
133
+ abortController: AbortController;
134
+ runtimeContext: RuntimeContext;
135
+ }): Promise<void>;
136
+ executeSleepUntil({ workflowId, runId, entry, prevOutput, stepResults, emitter, abortController, runtimeContext, }: {
137
+ workflowId: string;
138
+ runId: string;
139
+ serializedStepGraph: SerializedStepFlowEntry[];
140
+ entry: {
141
+ type: 'sleepUntil';
142
+ id: string;
143
+ date?: Date;
144
+ fn?: ExecuteFunction<any, any, any, any, InngestEngineType>;
145
+ };
146
+ prevStep: StepFlowEntry;
147
+ prevOutput: any;
148
+ stepResults: Record<string, StepResult<any, any, any, any>>;
149
+ resume?: {
150
+ steps: string[];
151
+ stepResults: Record<string, StepResult<any, any, any, any>>;
152
+ resumePayload: any;
153
+ resumePath: number[];
154
+ };
155
+ executionContext: ExecutionContext;
156
+ emitter: Emitter;
157
+ abortController: AbortController;
158
+ runtimeContext: RuntimeContext;
113
159
  }): Promise<void>;
114
160
  executeWaitForEvent({ event, timeout }: {
115
161
  event: string;
116
162
  timeout?: number;
117
163
  }): Promise<any>;
118
- executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, runtimeContext, }: {
164
+ executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, abortController, runtimeContext, }: {
119
165
  step: Step<string, any, any>;
120
166
  stepResults: Record<string, StepResult<any, any, any, any>>;
121
- executionContext: {
122
- workflowId: string;
123
- runId: string;
124
- executionPath: number[];
125
- suspendedPaths: Record<string, number[]>;
126
- retryConfig: {
127
- attempts: number;
128
- delay: number;
129
- };
130
- };
167
+ executionContext: ExecutionContext;
131
168
  resume?: {
132
169
  steps: string[];
133
170
  resumePayload: any;
@@ -135,6 +172,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
135
172
  };
136
173
  prevOutput: any;
137
174
  emitter: Emitter;
175
+ abortController: AbortController;
138
176
  runtimeContext: RuntimeContext;
139
177
  }): Promise<StepResult<any, any, any, any>>;
140
178
  persistStepUpdate({ workflowId, runId, stepResults, executionContext, serializedStepGraph, workflowStatus, result, error, }: {
@@ -147,7 +185,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
147
185
  result?: Record<string, any>;
148
186
  error?: string | Error;
149
187
  }): Promise<void>;
150
- executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, runtimeContext, }: {
188
+ executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, abortController, runtimeContext, }: {
151
189
  workflowId: string;
152
190
  runId: string;
153
191
  entry: {
@@ -167,6 +205,7 @@ export declare class InngestExecutionEngine extends DefaultExecutionEngine {
167
205
  };
168
206
  executionContext: ExecutionContext;
169
207
  emitter: Emitter;
208
+ abortController: AbortController;
170
209
  runtimeContext: RuntimeContext;
171
210
  }): Promise<StepResult<any, any, any, any>>;
172
211
  }
@@ -191,6 +230,7 @@ export declare class InngestRun<TEngineType = InngestEngineType, TSteps extends
191
230
  getRuns(eventId: string): Promise<any>;
192
231
  getRunOutput(eventId: string): Promise<any>;
193
232
  sendEvent(event: string, data: any): Promise<void>;
233
+ cancel(): Promise<void>;
194
234
  start({ inputData, }: {
195
235
  inputData?: z.infer<TInput>;
196
236
  runtimeContext?: RuntimeContext;
package/dist/index.cjs CHANGED
@@ -12,13 +12,17 @@ var zod = require('zod');
12
12
  // src/index.ts
13
13
  function serve({ mastra, inngest }) {
14
14
  const wfs = mastra.getWorkflows();
15
- const functions = Object.values(wfs).flatMap((wf) => {
16
- if (wf instanceof InngestWorkflow) {
17
- wf.__registerMastra(mastra);
18
- return wf.getFunctions();
19
- }
20
- return [];
21
- });
15
+ const functions = Array.from(
16
+ new Set(
17
+ Object.values(wfs).flatMap((wf) => {
18
+ if (wf instanceof InngestWorkflow) {
19
+ wf.__registerMastra(mastra);
20
+ return wf.getFunctions();
21
+ }
22
+ return [];
23
+ })
24
+ )
25
+ );
22
26
  return hono.serve({
23
27
  client: inngest,
24
28
  functions
@@ -48,8 +52,15 @@ var InngestRun = class extends workflows.Run {
48
52
  while (runs?.[0]?.status !== "Completed" || runs?.[0]?.event_id !== eventId) {
49
53
  await new Promise((resolve) => setTimeout(resolve, 1e3));
50
54
  runs = await this.getRuns(eventId);
51
- if (runs?.[0]?.status === "Failed" || runs?.[0]?.status === "Cancelled") {
55
+ if (runs?.[0]?.status === "Failed") {
56
+ console.log("run", runs?.[0]);
52
57
  throw new Error(`Function run ${runs?.[0]?.status}`);
58
+ } else if (runs?.[0]?.status === "Cancelled") {
59
+ const snapshot = await this.#mastra?.storage?.loadWorkflowSnapshot({
60
+ workflowName: this.workflowId,
61
+ runId: this.runId
62
+ });
63
+ return { output: { result: { steps: snapshot?.context, status: "canceled" } } };
53
64
  }
54
65
  }
55
66
  return runs?.[0];
@@ -60,6 +71,28 @@ var InngestRun = class extends workflows.Run {
60
71
  data
61
72
  });
62
73
  }
74
+ async cancel() {
75
+ await this.inngest.send({
76
+ name: `cancel.workflow.${this.workflowId}`,
77
+ data: {
78
+ runId: this.runId
79
+ }
80
+ });
81
+ const snapshot = await this.#mastra?.storage?.loadWorkflowSnapshot({
82
+ workflowName: this.workflowId,
83
+ runId: this.runId
84
+ });
85
+ if (snapshot) {
86
+ await this.#mastra?.storage?.persistWorkflowSnapshot({
87
+ workflowName: this.workflowId,
88
+ runId: this.runId,
89
+ snapshot: {
90
+ ...snapshot,
91
+ status: "canceled"
92
+ }
93
+ });
94
+ }
95
+ }
63
96
  async start({
64
97
  inputData
65
98
  }) {
@@ -324,8 +357,12 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
324
357
  return this.function;
325
358
  }
326
359
  this.function = this.inngest.createFunction(
327
- // @ts-ignore
328
- { id: `workflow.${this.id}`, retries: this.retryConfig?.attempts ?? 0 },
360
+ {
361
+ id: `workflow.${this.id}`,
362
+ // @ts-ignore
363
+ retries: this.retryConfig?.attempts ?? 0,
364
+ cancelOn: [{ event: `cancel.workflow.${this.id}` }]
365
+ },
329
366
  { event: `workflow.${this.id}` },
330
367
  async ({ event, step, attempt, publish }) => {
331
368
  let { inputData, runId, resume } = event.data;
@@ -367,7 +404,8 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
367
404
  retryConfig: this.retryConfig,
368
405
  runtimeContext: new di.RuntimeContext(),
369
406
  // TODO
370
- resume
407
+ resume,
408
+ abortController: new AbortController()
371
409
  });
372
410
  return { result, runId };
373
411
  }
@@ -411,7 +449,7 @@ function createStep(params) {
411
449
  outputSchema: zod.z.object({
412
450
  text: zod.z.string()
413
451
  }),
414
- execute: async ({ inputData, [_constants.EMITTER_SYMBOL]: emitter, runtimeContext }) => {
452
+ execute: async ({ inputData, [_constants.EMITTER_SYMBOL]: emitter, runtimeContext, abortSignal, abort }) => {
415
453
  let streamPromise = {};
416
454
  streamPromise.promise = new Promise((resolve, reject) => {
417
455
  streamPromise.resolve = resolve;
@@ -431,8 +469,12 @@ function createStep(params) {
431
469
  runtimeContext,
432
470
  onFinish: (result) => {
433
471
  streamPromise.resolve(result.text);
434
- }
472
+ },
473
+ abortSignal
435
474
  });
475
+ if (abortSignal.aborted) {
476
+ return abort();
477
+ }
436
478
  for await (const chunk of fullStream) {
437
479
  switch (chunk.type) {
438
480
  case "text-delta":
@@ -607,6 +649,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
607
649
  resume,
608
650
  prevOutput,
609
651
  emitter,
652
+ abortController,
610
653
  runtimeContext
611
654
  }) {
612
655
  return super.executeStep({
@@ -618,11 +661,107 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
618
661
  resume,
619
662
  prevOutput,
620
663
  emitter,
664
+ abortController,
621
665
  runtimeContext
622
666
  });
623
667
  }
624
- async executeSleep({ id, duration }) {
625
- await this.inngestStep.sleep(id, duration);
668
+ // async executeSleep({ id, duration }: { id: string; duration: number }): Promise<void> {
669
+ // await this.inngestStep.sleep(id, duration);
670
+ // }
671
+ async executeSleep({
672
+ workflowId,
673
+ runId,
674
+ entry,
675
+ prevOutput,
676
+ stepResults,
677
+ emitter,
678
+ abortController,
679
+ runtimeContext
680
+ }) {
681
+ let { duration, fn } = entry;
682
+ if (fn) {
683
+ duration = await this.inngestStep.run(`workflow.${workflowId}.sleep.${entry.id}`, async () => {
684
+ return await fn({
685
+ runId,
686
+ mastra: this.mastra,
687
+ runtimeContext,
688
+ inputData: prevOutput,
689
+ runCount: -1,
690
+ getInitData: () => stepResults?.input,
691
+ getStepResult: (step) => {
692
+ if (!step?.id) {
693
+ return null;
694
+ }
695
+ const result = stepResults[step.id];
696
+ if (result?.status === "success") {
697
+ return result.output;
698
+ }
699
+ return null;
700
+ },
701
+ // TODO: this function shouldn't have suspend probably?
702
+ suspend: async (_suspendPayload) => {
703
+ },
704
+ bail: () => {
705
+ },
706
+ abort: () => {
707
+ abortController?.abort();
708
+ },
709
+ [_constants.EMITTER_SYMBOL]: emitter,
710
+ engine: { step: this.inngestStep },
711
+ abortSignal: abortController?.signal
712
+ });
713
+ });
714
+ }
715
+ await this.inngestStep.sleep(entry.id, !duration || duration < 0 ? 0 : duration);
716
+ }
717
+ async executeSleepUntil({
718
+ workflowId,
719
+ runId,
720
+ entry,
721
+ prevOutput,
722
+ stepResults,
723
+ emitter,
724
+ abortController,
725
+ runtimeContext
726
+ }) {
727
+ let { date, fn } = entry;
728
+ if (fn) {
729
+ date = await this.inngestStep.run(`workflow.${workflowId}.sleepUntil.${entry.id}`, async () => {
730
+ return await fn({
731
+ runId,
732
+ mastra: this.mastra,
733
+ runtimeContext,
734
+ inputData: prevOutput,
735
+ runCount: -1,
736
+ getInitData: () => stepResults?.input,
737
+ getStepResult: (step) => {
738
+ if (!step?.id) {
739
+ return null;
740
+ }
741
+ const result = stepResults[step.id];
742
+ if (result?.status === "success") {
743
+ return result.output;
744
+ }
745
+ return null;
746
+ },
747
+ // TODO: this function shouldn't have suspend probably?
748
+ suspend: async (_suspendPayload) => {
749
+ },
750
+ bail: () => {
751
+ },
752
+ abort: () => {
753
+ abortController?.abort();
754
+ },
755
+ [_constants.EMITTER_SYMBOL]: emitter,
756
+ engine: { step: this.inngestStep },
757
+ abortSignal: abortController?.signal
758
+ });
759
+ });
760
+ }
761
+ if (!(date instanceof Date)) {
762
+ return;
763
+ }
764
+ await this.inngestStep.sleepUntil(entry.id, date);
626
765
  }
627
766
  async executeWaitForEvent({ event, timeout }) {
628
767
  const eventData = await this.inngestStep.waitForEvent(`user-event-${event}`, {
@@ -641,6 +780,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
641
780
  resume,
642
781
  prevOutput,
643
782
  emitter,
783
+ abortController,
644
784
  runtimeContext
645
785
  }) {
646
786
  const startedAt = await this.inngestStep.run(
@@ -672,7 +812,9 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
672
812
  type: "step-start",
673
813
  payload: {
674
814
  id: step.id,
675
- status: "running"
815
+ status: "running",
816
+ payload: prevOutput,
817
+ startedAt: startedAt2
676
818
  }
677
819
  });
678
820
  return startedAt2;
@@ -884,7 +1026,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
884
1026
  [_constants.EMITTER_SYMBOL]: emitter,
885
1027
  engine: {
886
1028
  step: this.inngestStep
887
- }
1029
+ },
1030
+ abortSignal: abortController.signal
888
1031
  });
889
1032
  const endedAt = Date.now();
890
1033
  execResults = {
@@ -1015,6 +1158,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1015
1158
  resume,
1016
1159
  executionContext,
1017
1160
  emitter,
1161
+ abortController,
1018
1162
  runtimeContext
1019
1163
  }) {
1020
1164
  let execResults;
@@ -1044,10 +1188,14 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1044
1188
  },
1045
1189
  bail: () => {
1046
1190
  },
1191
+ abort: () => {
1192
+ abortController.abort();
1193
+ },
1047
1194
  [_constants.EMITTER_SYMBOL]: emitter,
1048
1195
  engine: {
1049
1196
  step: this.inngestStep
1050
- }
1197
+ },
1198
+ abortSignal: abortController.signal
1051
1199
  });
1052
1200
  return result ? index : null;
1053
1201
  } catch (e) {
@@ -1076,6 +1224,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1076
1224
  executionSpan: executionContext.executionSpan
1077
1225
  },
1078
1226
  emitter,
1227
+ abortController,
1079
1228
  runtimeContext
1080
1229
  })
1081
1230
  )