@mastra/inngest 0.0.0-add-runtime-context-to-openai-realtime-20250516201052 → 0.0.0-ai-v5-20250625173645

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/dist/index.js CHANGED
@@ -1,12 +1,15 @@
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 { Tool } from '@mastra/core/tools';
5
+ import { Run, Workflow, DefaultExecutionEngine } from '@mastra/core/workflows';
6
+ import { EMITTER_SYMBOL } from '@mastra/core/workflows/_constants';
5
7
  import { serve as serve$1 } from 'inngest/hono';
8
+ import { z } from 'zod';
6
9
 
7
10
  // src/index.ts
8
11
  function serve({ mastra, inngest }) {
9
- const wfs = mastra.vnext_getWorkflows();
12
+ const wfs = mastra.getWorkflows();
10
13
  const functions = Object.values(wfs).flatMap((wf) => {
11
14
  if (wf instanceof InngestWorkflow) {
12
15
  wf.__registerMastra(mastra);
@@ -21,14 +24,16 @@ function serve({ mastra, inngest }) {
21
24
  }
22
25
  var InngestRun = class extends Run {
23
26
  inngest;
27
+ serializedStepGraph;
24
28
  #mastra;
25
29
  constructor(params, inngest) {
26
30
  super(params);
27
31
  this.inngest = inngest;
32
+ this.serializedStepGraph = params.serializedStepGraph;
28
33
  this.#mastra = params.mastra;
29
34
  }
30
35
  async getRuns(eventId) {
31
- const response = await fetch(`${this.inngest.apiBaseUrl}/v1/events/${eventId}/runs`, {
36
+ const response = await fetch(`${this.inngest.apiBaseUrl ?? "https://api.inngest.com"}/v1/events/${eventId}/runs`, {
32
37
  headers: {
33
38
  Authorization: `Bearer ${process.env.INNGEST_SIGNING_KEY}`
34
39
  }
@@ -38,7 +43,7 @@ var InngestRun = class extends Run {
38
43
  }
39
44
  async getRunOutput(eventId) {
40
45
  let runs = await this.getRuns(eventId);
41
- while (runs?.[0]?.status !== "Completed") {
46
+ while (runs?.[0]?.status !== "Completed" || runs?.[0]?.event_id !== eventId) {
42
47
  await new Promise((resolve) => setTimeout(resolve, 1e3));
43
48
  runs = await this.getRuns(eventId);
44
49
  if (runs?.[0]?.status === "Failed" || runs?.[0]?.status === "Cancelled") {
@@ -47,6 +52,12 @@ var InngestRun = class extends Run {
47
52
  }
48
53
  return runs?.[0];
49
54
  }
55
+ async sendEvent(event, data) {
56
+ await this.inngest.send({
57
+ name: `user-event-${event}`,
58
+ data
59
+ });
60
+ }
50
61
  async start({
51
62
  inputData
52
63
  }) {
@@ -55,11 +66,13 @@ var InngestRun = class extends Run {
55
66
  runId: this.runId,
56
67
  snapshot: {
57
68
  runId: this.runId,
69
+ serializedStepGraph: this.serializedStepGraph,
58
70
  value: {},
59
71
  context: {},
60
72
  activePaths: [],
61
73
  suspendedPaths: {},
62
- timestamp: Date.now()
74
+ timestamp: Date.now(),
75
+ status: "running"
63
76
  }
64
77
  });
65
78
  const eventOutput = await this.inngest.send({
@@ -82,6 +95,17 @@ var InngestRun = class extends Run {
82
95
  return result;
83
96
  }
84
97
  async resume(params) {
98
+ const p = this._resume(params).then((result) => {
99
+ if (result.status !== "suspended") {
100
+ this.closeStreamAction?.().catch(() => {
101
+ });
102
+ }
103
+ return result;
104
+ });
105
+ this.executionResults = p;
106
+ return p;
107
+ }
108
+ async _resume(params) {
85
109
  const steps = (Array.isArray(params.step) ? params.step : [params.step]).map(
86
110
  (step) => typeof step === "string" ? step : step?.id
87
111
  );
@@ -115,27 +139,62 @@ var InngestRun = class extends Run {
115
139
  }
116
140
  return result;
117
141
  }
118
- watch(cb) {
142
+ watch(cb, type = "watch") {
143
+ let active = true;
119
144
  const streamPromise = subscribe(
120
145
  {
121
146
  channel: `workflow:${this.workflowId}:${this.runId}`,
122
- topics: ["watch"],
147
+ topics: [type],
123
148
  app: this.inngest
124
149
  },
125
150
  (message) => {
126
- cb(message.data);
151
+ if (active) {
152
+ cb(message.data);
153
+ }
127
154
  }
128
155
  );
129
156
  return () => {
130
- streamPromise.then((stream) => {
131
- stream.cancel();
157
+ active = false;
158
+ streamPromise.then(async (stream) => {
159
+ return stream.cancel();
132
160
  }).catch((err) => {
133
161
  console.error(err);
134
162
  });
135
163
  };
136
164
  }
165
+ stream({ inputData, runtimeContext } = {}) {
166
+ const { readable, writable } = new TransformStream();
167
+ const writer = writable.getWriter();
168
+ const unwatch = this.watch(async (event) => {
169
+ try {
170
+ await writer.write(event);
171
+ } catch {
172
+ }
173
+ }, "watch-v2");
174
+ this.closeStreamAction = async () => {
175
+ unwatch();
176
+ try {
177
+ await writer.close();
178
+ } catch (err) {
179
+ console.error("Error closing stream:", err);
180
+ } finally {
181
+ writer.releaseLock();
182
+ }
183
+ };
184
+ this.executionResults = this.start({ inputData, runtimeContext }).then((result) => {
185
+ if (result.status !== "suspended") {
186
+ this.closeStreamAction?.().catch(() => {
187
+ });
188
+ }
189
+ return result;
190
+ });
191
+ return {
192
+ stream: readable,
193
+ getWorkflowState: () => this.executionResults
194
+ };
195
+ }
137
196
  };
138
- var InngestWorkflow = class _InngestWorkflow extends NewWorkflow {
197
+ var InngestWorkflow = class _InngestWorkflow extends Workflow {
139
198
  #mastra;
140
199
  inngest;
141
200
  function;
@@ -156,11 +215,32 @@ var InngestWorkflow = class _InngestWorkflow extends NewWorkflow {
156
215
  const storage = this.#mastra?.getStorage();
157
216
  if (!storage) {
158
217
  this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
159
- return null;
218
+ return this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null;
160
219
  }
161
220
  const run = await storage.getWorkflowRunById({ runId, workflowName: this.id });
162
221
  return run ?? (this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null);
163
222
  }
223
+ async getWorkflowRunExecutionResult(runId) {
224
+ const storage = this.#mastra?.getStorage();
225
+ if (!storage) {
226
+ this.logger.debug("Cannot get workflow run execution result. Mastra storage is not initialized");
227
+ return null;
228
+ }
229
+ const run = await storage.getWorkflowRunById({ runId, workflowName: this.id });
230
+ if (!run?.snapshot) {
231
+ return null;
232
+ }
233
+ if (typeof run.snapshot === "string") {
234
+ return null;
235
+ }
236
+ return {
237
+ status: run.snapshot.status,
238
+ result: run.snapshot.result,
239
+ error: run.snapshot.error,
240
+ payload: run.snapshot.context?.input,
241
+ steps: run.snapshot.context
242
+ };
243
+ }
164
244
  __registerMastra(mastra) {
165
245
  this.#mastra = mastra;
166
246
  this.executionEngine.__registerMastra(mastra);
@@ -187,6 +267,7 @@ var InngestWorkflow = class _InngestWorkflow extends NewWorkflow {
187
267
  runId: runIdToUse,
188
268
  executionEngine: this.executionEngine,
189
269
  executionGraph: this.executionGraph,
270
+ serializedStepGraph: this.serializedStepGraph,
190
271
  mastra: this.#mastra,
191
272
  retryConfig: this.retryConfig,
192
273
  cleanup: () => this.runs.delete(runIdToUse)
@@ -219,12 +300,18 @@ var InngestWorkflow = class _InngestWorkflow extends NewWorkflow {
219
300
  try {
220
301
  await publish({
221
302
  channel: `workflow:${this.id}:${runId}`,
222
- topic: "watch",
303
+ topic: event2,
223
304
  data
224
305
  });
225
306
  } catch (err) {
226
307
  this.logger.error("Error emitting event: " + (err?.stack ?? err?.message ?? err));
227
308
  }
309
+ },
310
+ on: (_event, _callback) => {
311
+ },
312
+ off: (_event, _callback) => {
313
+ },
314
+ once: (_event, _callback) => {
228
315
  }
229
316
  };
230
317
  const engine = new InngestExecutionEngine(this.#mastra, step, attempt);
@@ -232,6 +319,7 @@ var InngestWorkflow = class _InngestWorkflow extends NewWorkflow {
232
319
  workflowId: this.id,
233
320
  runId,
234
321
  graph: this.executionGraph,
322
+ serializedStepGraph: this.serializedStepGraph,
235
323
  input: inputData,
236
324
  emitter,
237
325
  retryConfig: this.retryConfig,
@@ -261,20 +349,106 @@ var InngestWorkflow = class _InngestWorkflow extends NewWorkflow {
261
349
  return [this.getFunction(), ...this.getNestedFunctions(this.executionGraph.steps)];
262
350
  }
263
351
  };
264
- function cloneWorkflow(workflow, opts) {
265
- const wf = new InngestWorkflow(
266
- {
267
- id: opts.id,
268
- inputSchema: workflow.inputSchema,
269
- outputSchema: workflow.outputSchema,
270
- steps: workflow.stepDefs,
271
- mastra: workflow.mastra
272
- },
273
- workflow.inngest
274
- );
275
- wf.setStepFlow(workflow.stepGraph);
276
- wf.commit();
277
- return wf;
352
+ function isAgent(params) {
353
+ return params?.component === "AGENT";
354
+ }
355
+ function isTool(params) {
356
+ return params instanceof Tool;
357
+ }
358
+ function createStep(params) {
359
+ if (isAgent(params)) {
360
+ return {
361
+ id: params.name,
362
+ // @ts-ignore
363
+ inputSchema: z.object({
364
+ prompt: z.string()
365
+ // resourceId: z.string().optional(),
366
+ // threadId: z.string().optional(),
367
+ }),
368
+ // @ts-ignore
369
+ outputSchema: z.object({
370
+ text: z.string()
371
+ }),
372
+ execute: async ({ inputData, [EMITTER_SYMBOL]: emitter, runtimeContext }) => {
373
+ let streamPromise = {};
374
+ streamPromise.promise = new Promise((resolve, reject) => {
375
+ streamPromise.resolve = resolve;
376
+ streamPromise.reject = reject;
377
+ });
378
+ const toolData = {
379
+ name: params.name,
380
+ args: inputData
381
+ };
382
+ await emitter.emit("watch-v2", {
383
+ type: "tool-call-streaming-start",
384
+ ...toolData
385
+ });
386
+ const { fullStream } = await params.stream(inputData.prompt, {
387
+ // resourceId: inputData.resourceId,
388
+ // threadId: inputData.threadId,
389
+ runtimeContext,
390
+ onFinish: (result) => {
391
+ streamPromise.resolve(result.text);
392
+ }
393
+ });
394
+ for await (const chunk of fullStream) {
395
+ switch (chunk.type) {
396
+ case "text":
397
+ await emitter.emit("watch-v2", {
398
+ type: "tool-call-delta",
399
+ ...toolData,
400
+ argsTextDelta: chunk.text
401
+ });
402
+ break;
403
+ case "start-step":
404
+ case "finish-step":
405
+ case "finish":
406
+ break;
407
+ case "tool-call":
408
+ case "tool-result":
409
+ case "tool-input-start":
410
+ case "tool-input-delta":
411
+ case "source":
412
+ case "file":
413
+ default:
414
+ await emitter.emit("watch-v2", chunk);
415
+ break;
416
+ }
417
+ }
418
+ return {
419
+ text: await streamPromise.promise
420
+ };
421
+ }
422
+ };
423
+ }
424
+ if (isTool(params)) {
425
+ if (!params.inputSchema || !params.outputSchema) {
426
+ throw new Error("Tool must have input and output schemas defined");
427
+ }
428
+ return {
429
+ // TODO: tool probably should have strong id type
430
+ // @ts-ignore
431
+ id: params.id,
432
+ inputSchema: params.inputSchema,
433
+ outputSchema: params.outputSchema,
434
+ execute: async ({ inputData, mastra, runtimeContext }) => {
435
+ return params.execute({
436
+ context: inputData,
437
+ mastra,
438
+ runtimeContext
439
+ });
440
+ }
441
+ };
442
+ }
443
+ return {
444
+ id: params.id,
445
+ description: params.description,
446
+ inputSchema: params.inputSchema,
447
+ outputSchema: params.outputSchema,
448
+ resumeSchema: params.resumeSchema,
449
+ suspendSchema: params.suspendSchema,
450
+ execute: params.execute
451
+ };
278
452
  }
279
453
  function init(inngest) {
280
454
  return {
@@ -282,8 +456,27 @@ function init(inngest) {
282
456
  return new InngestWorkflow(params, inngest);
283
457
  },
284
458
  createStep,
285
- cloneStep,
286
- cloneWorkflow
459
+ cloneStep(step, opts) {
460
+ return {
461
+ id: opts.id,
462
+ description: step.description,
463
+ inputSchema: step.inputSchema,
464
+ outputSchema: step.outputSchema,
465
+ execute: step.execute
466
+ };
467
+ },
468
+ cloneWorkflow(workflow, opts) {
469
+ const wf = new Workflow({
470
+ id: opts.id,
471
+ inputSchema: workflow.inputSchema,
472
+ outputSchema: workflow.outputSchema,
473
+ steps: workflow.stepDefs,
474
+ mastra: workflow.mastra
475
+ });
476
+ wf.setStepFlow(workflow.stepGraph);
477
+ wf.commit();
478
+ return wf;
479
+ }
287
480
  };
288
481
  }
289
482
  var InngestExecutionEngine = class extends DefaultExecutionEngine {
@@ -294,6 +487,18 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
294
487
  this.inngestStep = inngestStep;
295
488
  this.inngestAttempts = inngestAttempts;
296
489
  }
490
+ async execute(params) {
491
+ await params.emitter.emit("watch-v2", {
492
+ type: "start",
493
+ payload: { runId: params.runId }
494
+ });
495
+ const result = await super.execute(params);
496
+ await params.emitter.emit("watch-v2", {
497
+ type: "finish",
498
+ payload: { runId: params.runId }
499
+ });
500
+ return result;
501
+ }
297
502
  async fmtReturnValue(executionSpan, emitter, stepResults, lastOutput, error) {
298
503
  const base = {
299
504
  status: lastOutput.status,
@@ -374,6 +579,19 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
374
579
  runtimeContext
375
580
  });
376
581
  }
582
+ async executeSleep({ id, duration }) {
583
+ await this.inngestStep.sleep(id, duration);
584
+ }
585
+ async executeWaitForEvent({ event, timeout }) {
586
+ const eventData = await this.inngestStep.waitForEvent(`user-event-${event}`, {
587
+ event: `user-event-${event}`,
588
+ timeout: timeout ?? 5e3
589
+ });
590
+ if (eventData === null) {
591
+ throw "Timeout waiting for event";
592
+ }
593
+ return eventData?.data;
594
+ }
377
595
  async executeStep({
378
596
  step,
379
597
  stepResults,
@@ -383,9 +601,10 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
383
601
  emitter,
384
602
  runtimeContext
385
603
  }) {
386
- await this.inngestStep.run(
604
+ const startedAt = await this.inngestStep.run(
387
605
  `workflow.${executionContext.workflowId}.run.${executionContext.runId}.step.${step.id}.running_ev`,
388
606
  async () => {
607
+ const startedAt2 = Date.now();
389
608
  await emitter.emit("watch", {
390
609
  type: "watch",
391
610
  payload: {
@@ -407,6 +626,13 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
407
626
  },
408
627
  eventTimestamp: Date.now()
409
628
  });
629
+ await emitter.emit("watch-v2", {
630
+ type: "step-start",
631
+ payload: {
632
+ id: step.id
633
+ }
634
+ });
635
+ return startedAt2;
410
636
  }
411
637
  );
412
638
  if (step instanceof InngestWorkflow) {
@@ -467,6 +693,13 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
467
693
  },
468
694
  eventTimestamp: Date.now()
469
695
  });
696
+ await emitter.emit("watch-v2", {
697
+ type: "step-result",
698
+ payload: {
699
+ id: step.id,
700
+ status: "failed"
701
+ }
702
+ });
470
703
  return { executionContext, result: { status: "failed", error: result?.error } };
471
704
  } else if (result.status === "suspended") {
472
705
  const suspendedSteps = Object.entries(result.steps).filter(([_stepName, stepResult]) => {
@@ -493,6 +726,12 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
493
726
  },
494
727
  eventTimestamp: Date.now()
495
728
  });
729
+ await emitter.emit("watch-v2", {
730
+ type: "step-suspended",
731
+ payload: {
732
+ id: step.id
733
+ }
734
+ });
496
735
  return {
497
736
  executionContext,
498
737
  result: {
@@ -543,6 +782,13 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
543
782
  },
544
783
  eventTimestamp: Date.now()
545
784
  });
785
+ await emitter.emit("watch-v2", {
786
+ type: "step-finish",
787
+ payload: {
788
+ id: step.id,
789
+ metadata: {}
790
+ }
791
+ });
546
792
  return { executionContext, result: { status: "success", output: result?.result } };
547
793
  }
548
794
  );
@@ -554,6 +800,7 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
554
800
  let suspended;
555
801
  try {
556
802
  const result = await step.execute({
803
+ runId: executionContext.runId,
557
804
  mastra: this.mastra,
558
805
  runtimeContext,
559
806
  inputData: prevOutput,
@@ -576,14 +823,42 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
576
823
  // @ts-ignore
577
824
  runId: stepResults[step.id]?.payload?.__workflow_meta?.runId
578
825
  },
579
- emitter
826
+ [EMITTER_SYMBOL]: emitter,
827
+ engine: {
828
+ step: this.inngestStep
829
+ }
580
830
  });
581
- execResults = { status: "success", output: result };
831
+ const endedAt = Date.now();
832
+ execResults = {
833
+ status: "success",
834
+ output: result,
835
+ startedAt,
836
+ endedAt,
837
+ payload: prevOutput,
838
+ resumedAt: resume?.steps[0] === step.id ? startedAt : void 0,
839
+ resumePayload: resume?.steps[0] === step.id ? resume?.resumePayload : void 0
840
+ };
582
841
  } catch (e) {
583
- execResults = { status: "failed", error: e instanceof Error ? e.message : String(e) };
842
+ execResults = {
843
+ status: "failed",
844
+ payload: prevOutput,
845
+ error: e instanceof Error ? e.message : String(e),
846
+ endedAt: Date.now(),
847
+ startedAt,
848
+ resumedAt: resume?.steps[0] === step.id ? startedAt : void 0,
849
+ resumePayload: resume?.steps[0] === step.id ? resume?.resumePayload : void 0
850
+ };
584
851
  }
585
852
  if (suspended) {
586
- execResults = { status: "suspended", payload: suspended.payload };
853
+ execResults = {
854
+ status: "suspended",
855
+ suspendedPayload: suspended.payload,
856
+ payload: prevOutput,
857
+ suspendedAt: Date.now(),
858
+ startedAt,
859
+ resumedAt: resume?.steps[0] === step.id ? startedAt : void 0,
860
+ resumePayload: resume?.steps[0] === step.id ? resume?.resumePayload : void 0
861
+ };
587
862
  }
588
863
  if (execResults.status === "failed") {
589
864
  if (executionContext.retryConfig.attempts > 0 && this.inngestAttempts < executionContext.retryConfig.attempts) {
@@ -595,18 +870,43 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
595
870
  payload: {
596
871
  currentStep: {
597
872
  id: step.id,
598
- status: execResults.status,
599
- output: execResults.output
873
+ ...execResults
600
874
  },
601
875
  workflowState: {
602
876
  status: "running",
603
- steps: stepResults,
877
+ steps: { ...stepResults, [step.id]: execResults },
604
878
  result: null,
605
879
  error: null
606
880
  }
607
881
  },
608
882
  eventTimestamp: Date.now()
609
883
  });
884
+ if (execResults.status === "suspended") {
885
+ await emitter.emit("watch-v2", {
886
+ type: "step-suspended",
887
+ payload: {
888
+ id: step.id,
889
+ status: execResults.status,
890
+ output: execResults.status === "success" ? execResults?.output : void 0
891
+ }
892
+ });
893
+ } else {
894
+ await emitter.emit("watch-v2", {
895
+ type: "step-result",
896
+ payload: {
897
+ id: step.id,
898
+ status: execResults.status,
899
+ output: execResults.status === "success" ? execResults?.output : void 0
900
+ }
901
+ });
902
+ await emitter.emit("watch-v2", {
903
+ type: "step-finish",
904
+ payload: {
905
+ id: step.id,
906
+ metadata: {}
907
+ }
908
+ });
909
+ }
610
910
  return { result: execResults, executionContext, stepResults };
611
911
  });
612
912
  Object.assign(executionContext.suspendedPaths, stepRes.executionContext.suspendedPaths);
@@ -617,7 +917,11 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
617
917
  workflowId,
618
918
  runId,
619
919
  stepResults,
620
- executionContext
920
+ executionContext,
921
+ serializedStepGraph,
922
+ workflowStatus,
923
+ result,
924
+ error
621
925
  }) {
622
926
  await this.inngestStep.run(
623
927
  `workflow.${workflowId}.run.${runId}.path.${JSON.stringify(executionContext.executionPath)}.stepUpdate`,
@@ -631,6 +935,10 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
631
935
  context: stepResults,
632
936
  activePaths: [],
633
937
  suspendedPaths: executionContext.suspendedPaths,
938
+ serializedStepGraph,
939
+ status: workflowStatus,
940
+ result,
941
+ error,
634
942
  // @ts-ignore
635
943
  timestamp: Date.now()
636
944
  }
@@ -645,6 +953,7 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
645
953
  prevOutput,
646
954
  prevStep,
647
955
  stepResults,
956
+ serializedStepGraph,
648
957
  resume,
649
958
  executionContext,
650
959
  emitter,
@@ -656,6 +965,7 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
656
965
  (cond, index) => this.inngestStep.run(`workflow.${workflowId}.conditional.${index}`, async () => {
657
966
  try {
658
967
  const result = await cond({
968
+ runId,
659
969
  mastra: this.mastra,
660
970
  runtimeContext,
661
971
  inputData: prevOutput,
@@ -673,7 +983,10 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
673
983
  // TODO: this function shouldn't have suspend probably?
674
984
  suspend: async (_suspendPayload) => {
675
985
  },
676
- emitter
986
+ [EMITTER_SYMBOL]: emitter,
987
+ engine: {
988
+ step: this.inngestStep
989
+ }
677
990
  });
678
991
  return result ? index : null;
679
992
  } catch (e) {
@@ -692,6 +1005,7 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
692
1005
  prevStep,
693
1006
  stepResults,
694
1007
  resume,
1008
+ serializedStepGraph,
695
1009
  executionContext: {
696
1010
  workflowId,
697
1011
  runId,
@@ -705,17 +1019,17 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
705
1019
  })
706
1020
  )
707
1021
  );
708
- const hasFailed = results.find((result) => result.status === "failed");
709
- const hasSuspended = results.find((result) => result.status === "suspended");
1022
+ const hasFailed = results.find((result) => result.result.status === "failed");
1023
+ const hasSuspended = results.find((result) => result.result.status === "suspended");
710
1024
  if (hasFailed) {
711
- execResults = { status: "failed", error: hasFailed.error };
1025
+ execResults = { status: "failed", error: hasFailed.result.error };
712
1026
  } else if (hasSuspended) {
713
- execResults = { status: "suspended", payload: hasSuspended.payload };
1027
+ execResults = { status: "suspended", payload: hasSuspended.result.suspendPayload };
714
1028
  } else {
715
1029
  execResults = {
716
1030
  status: "success",
717
1031
  output: results.reduce((acc, result, index) => {
718
- if (result.status === "success") {
1032
+ if (result.result.status === "success") {
719
1033
  acc[stepsToRun[index].step.id] = result.output;
720
1034
  }
721
1035
  return acc;
@@ -726,4 +1040,4 @@ var InngestExecutionEngine = class extends DefaultExecutionEngine {
726
1040
  }
727
1041
  };
728
1042
 
729
- export { InngestExecutionEngine, InngestRun, InngestWorkflow, init, serve };
1043
+ export { InngestExecutionEngine, InngestRun, InngestWorkflow, createStep, init, serve };