@mastra/inngest 0.0.0-ai-telementry-ui-20250908102126 → 0.0.0-break-rename-vnext-legacy-20251002212351

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.cjs CHANGED
@@ -11,9 +11,14 @@ var hono = require('inngest/hono');
11
11
  var zod = require('zod');
12
12
 
13
13
  // src/index.ts
14
- function serve({ mastra, inngest }) {
14
+ function serve({
15
+ mastra,
16
+ inngest,
17
+ functions: userFunctions = [],
18
+ registerOptions
19
+ }) {
15
20
  const wfs = mastra.getWorkflows();
16
- const functions = Array.from(
21
+ const workflowFunctions = Array.from(
17
22
  new Set(
18
23
  Object.values(wfs).flatMap((wf) => {
19
24
  if (wf instanceof InngestWorkflow) {
@@ -25,8 +30,9 @@ function serve({ mastra, inngest }) {
25
30
  )
26
31
  );
27
32
  return hono.serve({
33
+ ...registerOptions,
28
34
  client: inngest,
29
- functions
35
+ functions: [...workflowFunctions, ...userFunctions]
30
36
  });
31
37
  }
32
38
  var InngestRun = class extends workflows.Run {
@@ -54,7 +60,6 @@ var InngestRun = class extends workflows.Run {
54
60
  await new Promise((resolve) => setTimeout(resolve, 1e3));
55
61
  runs = await this.getRuns(eventId);
56
62
  if (runs?.[0]?.status === "Failed") {
57
- console.log("run", runs?.[0]);
58
63
  throw new Error(`Function run ${runs?.[0]?.status}`);
59
64
  } else if (runs?.[0]?.status === "Cancelled") {
60
65
  const snapshot = await this.#mastra?.storage?.loadWorkflowSnapshot({
@@ -87,6 +92,7 @@ var InngestRun = class extends workflows.Run {
87
92
  await this.#mastra?.storage?.persistWorkflowSnapshot({
88
93
  workflowName: this.workflowId,
89
94
  runId: this.runId,
95
+ resourceId: this.resourceId,
90
96
  snapshot: {
91
97
  ...snapshot,
92
98
  status: "canceled"
@@ -100,6 +106,7 @@ var InngestRun = class extends workflows.Run {
100
106
  await this.#mastra.getStorage()?.persistWorkflowSnapshot({
101
107
  workflowName: this.workflowId,
102
108
  runId: this.runId,
109
+ resourceId: this.resourceId,
103
110
  snapshot: {
104
111
  runId: this.runId,
105
112
  serializedStepGraph: this.serializedStepGraph,
@@ -112,11 +119,13 @@ var InngestRun = class extends workflows.Run {
112
119
  status: "running"
113
120
  }
114
121
  });
122
+ const inputDataToUse = await this._validateInput(inputData);
115
123
  const eventOutput = await this.inngest.send({
116
124
  name: `workflow.${this.workflowId}`,
117
125
  data: {
118
- inputData,
119
- runId: this.runId
126
+ inputData: inputDataToUse,
127
+ runId: this.runId,
128
+ resourceId: this.resourceId
120
129
  }
121
130
  });
122
131
  const eventId = eventOutput.ids[0];
@@ -152,17 +161,19 @@ var InngestRun = class extends workflows.Run {
152
161
  workflowName: this.workflowId,
153
162
  runId: this.runId
154
163
  });
164
+ const suspendedStep = this.workflowSteps[steps?.[0] ?? ""];
165
+ const resumeDataToUse = await this._validateResumeData(params.resumeData, suspendedStep);
155
166
  const eventOutput = await this.inngest.send({
156
167
  name: `workflow.${this.workflowId}`,
157
168
  data: {
158
- inputData: params.resumeData,
169
+ inputData: resumeDataToUse,
159
170
  runId: this.runId,
160
171
  workflowId: this.workflowId,
161
172
  stepResults: snapshot?.context,
162
173
  resume: {
163
174
  steps,
164
175
  stepResults: snapshot?.context,
165
- resumePayload: params.resumeData,
176
+ resumePayload: resumeDataToUse,
166
177
  // @ts-ignore
167
178
  resumePath: snapshot?.suspendedPaths?.[steps?.[0]]
168
179
  }
@@ -204,33 +215,9 @@ var InngestRun = class extends workflows.Run {
204
215
  }
205
216
  stream({ inputData, runtimeContext } = {}) {
206
217
  const { readable, writable } = new TransformStream();
207
- let currentToolData = void 0;
208
218
  const writer = writable.getWriter();
209
219
  const unwatch = this.watch(async (event) => {
210
- if (event.type === "workflow-agent-call-start") {
211
- currentToolData = {
212
- name: event.payload.name,
213
- args: event.payload.args
214
- };
215
- await writer.write({
216
- ...event.payload,
217
- type: "tool-call-streaming-start"
218
- });
219
- return;
220
- }
221
220
  try {
222
- if (event.type === "workflow-agent-call-finish") {
223
- return;
224
- } else if (!event.type.startsWith("workflow-")) {
225
- if (event.type === "text-delta") {
226
- await writer.write({
227
- type: "tool-call-delta",
228
- ...currentToolData ?? {},
229
- argsTextDelta: event.textDelta
230
- });
231
- }
232
- return;
233
- }
234
221
  const e = {
235
222
  ...event,
236
223
  type: event.type.replace("workflow-", "")
@@ -312,23 +299,14 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
312
299
  }
313
300
  }
314
301
  }
315
- createRun(options) {
316
- const runIdToUse = options?.runId || crypto.randomUUID();
317
- const run = this.runs.get(runIdToUse) ?? new InngestRun(
318
- {
319
- workflowId: this.id,
320
- runId: runIdToUse,
321
- executionEngine: this.executionEngine,
322
- executionGraph: this.executionGraph,
323
- serializedStepGraph: this.serializedStepGraph,
324
- mastra: this.#mastra,
325
- retryConfig: this.retryConfig,
326
- cleanup: () => this.runs.delete(runIdToUse)
327
- },
328
- this.inngest
302
+ /**
303
+ * @deprecated Use createRunAsync() instead.
304
+ * @throws {Error} Always throws an error directing users to use createRunAsync()
305
+ */
306
+ createRun(_options) {
307
+ throw new Error(
308
+ "createRun() has been deprecated. Please use createRunAsync() instead.\n\nMigration guide:\n Before: const run = workflow.createRun();\n After: const run = await workflow.createRunAsync();\n\nNote: createRunAsync() is an async method, so make sure your calling function is async."
329
309
  );
330
- this.runs.set(runIdToUse, run);
331
- return run;
332
310
  }
333
311
  async createRunAsync(options) {
334
312
  const runIdToUse = options?.runId || crypto.randomUUID();
@@ -336,12 +314,14 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
336
314
  {
337
315
  workflowId: this.id,
338
316
  runId: runIdToUse,
317
+ resourceId: options?.resourceId,
339
318
  executionEngine: this.executionEngine,
340
319
  executionGraph: this.executionGraph,
341
320
  serializedStepGraph: this.serializedStepGraph,
342
321
  mastra: this.#mastra,
343
322
  retryConfig: this.retryConfig,
344
- cleanup: () => this.runs.delete(runIdToUse)
323
+ cleanup: () => this.runs.delete(runIdToUse),
324
+ workflowSteps: this.steps
345
325
  },
346
326
  this.inngest
347
327
  );
@@ -351,6 +331,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
351
331
  await this.mastra?.getStorage()?.persistWorkflowSnapshot({
352
332
  workflowName: this.id,
353
333
  runId: runIdToUse,
334
+ resourceId: options?.resourceId,
354
335
  snapshot: {
355
336
  runId: runIdToUse,
356
337
  status: "pending",
@@ -384,7 +365,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
384
365
  },
385
366
  { event: `workflow.${this.id}` },
386
367
  async ({ event, step, attempt, publish }) => {
387
- let { inputData, runId, resume } = event.data;
368
+ let { inputData, runId, resourceId, resume } = event.data;
388
369
  if (!runId) {
389
370
  runId = await step.run(`workflow.${this.id}.runIdGen`, async () => {
390
371
  return crypto.randomUUID();
@@ -416,6 +397,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
416
397
  const result = await engine.execute({
417
398
  workflowId: this.id,
418
399
  runId,
400
+ resourceId,
419
401
  graph: this.executionGraph,
420
402
  serializedStepGraph: this.serializedStepGraph,
421
403
  input: inputData,
@@ -460,11 +442,10 @@ function createStep(params) {
460
442
  if (isAgent(params)) {
461
443
  return {
462
444
  id: params.name,
445
+ description: params.getDescription(),
463
446
  // @ts-ignore
464
447
  inputSchema: zod.z.object({
465
448
  prompt: zod.z.string()
466
- // resourceId: z.string().optional(),
467
- // threadId: z.string().optional(),
468
449
  }),
469
450
  // @ts-ignore
470
451
  outputSchema: zod.z.object({
@@ -480,34 +461,66 @@ function createStep(params) {
480
461
  name: params.name,
481
462
  args: inputData
482
463
  };
483
- await emitter.emit("watch-v2", {
484
- type: "workflow-agent-call-start",
485
- payload: toolData
486
- });
487
- const { fullStream } = await params.stream(inputData.prompt, {
488
- // resourceId: inputData.resourceId,
489
- // threadId: inputData.threadId,
490
- runtimeContext,
491
- tracingContext,
492
- onFinish: (result) => {
493
- streamPromise.resolve(result.text);
494
- },
495
- abortSignal
496
- });
497
- if (abortSignal.aborted) {
498
- return abort();
499
- }
500
- for await (const chunk of fullStream) {
501
- await emitter.emit("watch-v2", chunk);
464
+ if ((await params.getLLM()).getModel().specificationVersion === `v2`) {
465
+ const { fullStream } = await params.stream(inputData.prompt, {
466
+ runtimeContext,
467
+ tracingContext,
468
+ onFinish: (result) => {
469
+ streamPromise.resolve(result.text);
470
+ },
471
+ abortSignal
472
+ });
473
+ if (abortSignal.aborted) {
474
+ return abort();
475
+ }
476
+ await emitter.emit("watch-v2", {
477
+ type: "tool-call-streaming-start",
478
+ ...toolData ?? {}
479
+ });
480
+ for await (const chunk of fullStream) {
481
+ if (chunk.type === "text-delta") {
482
+ await emitter.emit("watch-v2", {
483
+ type: "tool-call-delta",
484
+ ...toolData ?? {},
485
+ argsTextDelta: chunk.payload.text
486
+ });
487
+ }
488
+ }
489
+ } else {
490
+ const { fullStream } = await params.streamLegacy(inputData.prompt, {
491
+ runtimeContext,
492
+ tracingContext,
493
+ onFinish: (result) => {
494
+ streamPromise.resolve(result.text);
495
+ },
496
+ abortSignal
497
+ });
498
+ if (abortSignal.aborted) {
499
+ return abort();
500
+ }
501
+ await emitter.emit("watch-v2", {
502
+ type: "tool-call-streaming-start",
503
+ ...toolData ?? {}
504
+ });
505
+ for await (const chunk of fullStream) {
506
+ if (chunk.type === "text-delta") {
507
+ await emitter.emit("watch-v2", {
508
+ type: "tool-call-delta",
509
+ ...toolData ?? {},
510
+ argsTextDelta: chunk.textDelta
511
+ });
512
+ }
513
+ }
502
514
  }
503
515
  await emitter.emit("watch-v2", {
504
- type: "workflow-agent-call-finish",
505
- payload: toolData
516
+ type: "tool-call-streaming-finish",
517
+ ...toolData ?? {}
506
518
  });
507
519
  return {
508
520
  text: await streamPromise.promise
509
521
  };
510
- }
522
+ },
523
+ component: params.component
511
524
  };
512
525
  }
513
526
  if (isTool(params)) {
@@ -518,16 +531,20 @@ function createStep(params) {
518
531
  // TODO: tool probably should have strong id type
519
532
  // @ts-ignore
520
533
  id: params.id,
534
+ description: params.description,
521
535
  inputSchema: params.inputSchema,
522
536
  outputSchema: params.outputSchema,
523
- execute: async ({ inputData, mastra, runtimeContext, tracingContext }) => {
537
+ execute: async ({ inputData, mastra, runtimeContext, tracingContext, suspend, resumeData }) => {
524
538
  return params.execute({
525
539
  context: inputData,
526
540
  mastra: aiTracing.wrapMastra(mastra, tracingContext),
527
541
  runtimeContext,
528
- tracingContext
542
+ tracingContext,
543
+ suspend,
544
+ resumeData
529
545
  });
530
- }
546
+ },
547
+ component: "TOOL"
531
548
  };
532
549
  }
533
550
  return {
@@ -552,7 +569,8 @@ function init(inngest) {
552
569
  description: step.description,
553
570
  inputSchema: step.inputSchema,
554
571
  outputSchema: step.outputSchema,
555
- execute: step.execute
572
+ execute: step.execute,
573
+ component: step.component
556
574
  };
557
575
  },
558
576
  cloneWorkflow(workflow, opts) {
@@ -572,8 +590,8 @@ function init(inngest) {
572
590
  var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
573
591
  inngestStep;
574
592
  inngestAttempts;
575
- constructor(mastra, inngestStep, inngestAttempts = 0) {
576
- super({ mastra });
593
+ constructor(mastra, inngestStep, inngestAttempts = 0, options) {
594
+ super({ mastra, options });
577
595
  this.inngestStep = inngestStep;
578
596
  this.inngestAttempts = inngestAttempts;
579
597
  }
@@ -669,7 +687,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
669
687
  attributes: {
670
688
  durationMs: duration,
671
689
  sleepType: fn ? "dynamic" : "fixed"
672
- }
690
+ },
691
+ tracingPolicy: this.options?.tracingPolicy
673
692
  });
674
693
  if (fn) {
675
694
  const stepCallId = crypto.randomUUID();
@@ -685,16 +704,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
685
704
  currentSpan: sleepSpan
686
705
  },
687
706
  getInitData: () => stepResults?.input,
688
- getStepResult: (step) => {
689
- if (!step?.id) {
690
- return null;
691
- }
692
- const result = stepResults[step.id];
693
- if (result?.status === "success") {
694
- return result.output;
695
- }
696
- return null;
697
- },
707
+ getStepResult: workflows.getStepResult.bind(this, stepResults),
698
708
  // TODO: this function shouldn't have suspend probably?
699
709
  suspend: async (_suspendPayload) => {
700
710
  },
@@ -754,7 +764,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
754
764
  untilDate: date,
755
765
  durationMs: date ? Math.max(0, date.getTime() - Date.now()) : void 0,
756
766
  sleepType: fn ? "dynamic" : "fixed"
757
- }
767
+ },
768
+ tracingPolicy: this.options?.tracingPolicy
758
769
  });
759
770
  if (fn) {
760
771
  date = await this.inngestStep.run(`workflow.${workflowId}.sleepUntil.${entry.id}`, async () => {
@@ -770,16 +781,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
770
781
  currentSpan: sleepUntilSpan
771
782
  },
772
783
  getInitData: () => stepResults?.input,
773
- getStepResult: (step) => {
774
- if (!step?.id) {
775
- return null;
776
- }
777
- const result = stepResults[step.id];
778
- if (result?.status === "success") {
779
- return result.output;
780
- }
781
- return null;
782
- },
784
+ getStepResult: workflows.getStepResult.bind(this, stepResults),
783
785
  // TODO: this function shouldn't have suspend probably?
784
786
  suspend: async (_suspendPayload) => {
785
787
  },
@@ -804,6 +806,9 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
804
806
  )
805
807
  });
806
808
  });
809
+ if (date && !(date instanceof Date)) {
810
+ date = new Date(date);
811
+ }
807
812
  const time = !date ? 0 : date.getTime() - Date.now();
808
813
  sleepUntilSpan?.update({
809
814
  attributes: {
@@ -852,7 +857,13 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
852
857
  input: prevOutput,
853
858
  attributes: {
854
859
  stepId: step.id
855
- }
860
+ },
861
+ tracingPolicy: this.options?.tracingPolicy
862
+ });
863
+ const { inputData, validationError } = await workflows.validateStepInput({
864
+ prevOutput,
865
+ step,
866
+ validateInputs: this.options?.validateInputs ?? false
856
867
  });
857
868
  const startedAt = await this.inngestStep.run(
858
869
  `workflow.${executionContext.workflowId}.run.${executionContext.runId}.step.${step.id}.running_ev`,
@@ -884,7 +895,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
884
895
  payload: {
885
896
  id: step.id,
886
897
  status: "running",
887
- payload: prevOutput,
898
+ payload: inputData,
888
899
  startedAt: startedAt2
889
900
  }
890
901
  });
@@ -904,7 +915,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
904
915
  const invokeResp = await this.inngestStep.invoke(`workflow.${executionContext.workflowId}.step.${step.id}`, {
905
916
  function: step.getFunction(),
906
917
  data: {
907
- inputData: prevOutput,
918
+ inputData,
908
919
  runId,
909
920
  resume: {
910
921
  runId,
@@ -922,7 +933,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
922
933
  const invokeResp = await this.inngestStep.invoke(`workflow.${executionContext.workflowId}.step.${step.id}`, {
923
934
  function: step.getFunction(),
924
935
  data: {
925
- inputData: prevOutput
936
+ inputData
926
937
  }
927
938
  });
928
939
  result = invokeResp.result;
@@ -1067,24 +1078,21 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1067
1078
  let suspended;
1068
1079
  let bailed;
1069
1080
  try {
1081
+ if (validationError) {
1082
+ throw validationError;
1083
+ }
1070
1084
  const result = await step.execute({
1071
1085
  runId: executionContext.runId,
1072
1086
  mastra: this.mastra,
1073
1087
  runtimeContext,
1074
1088
  writableStream,
1075
- inputData: prevOutput,
1089
+ inputData,
1076
1090
  resumeData: resume?.steps[0] === step.id ? resume?.resumePayload : void 0,
1077
1091
  tracingContext: {
1078
1092
  currentSpan: stepAISpan
1079
1093
  },
1080
1094
  getInitData: () => stepResults?.input,
1081
- getStepResult: (step2) => {
1082
- const result2 = stepResults[step2.id];
1083
- if (result2?.status === "success") {
1084
- return result2.output;
1085
- }
1086
- return null;
1087
- },
1095
+ getStepResult: workflows.getStepResult.bind(this, stepResults),
1088
1096
  suspend: async (suspendPayload) => {
1089
1097
  executionContext.suspendedPaths[step.id] = executionContext.executionPath;
1090
1098
  suspended = { payload: suspendPayload };
@@ -1110,14 +1118,14 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1110
1118
  output: result,
1111
1119
  startedAt,
1112
1120
  endedAt,
1113
- payload: prevOutput,
1121
+ payload: inputData,
1114
1122
  resumedAt: resume?.steps[0] === step.id ? startedAt : void 0,
1115
1123
  resumePayload: resume?.steps[0] === step.id ? resume?.resumePayload : void 0
1116
1124
  };
1117
1125
  } catch (e) {
1118
1126
  execResults = {
1119
1127
  status: "failed",
1120
- payload: prevOutput,
1128
+ payload: inputData,
1121
1129
  error: e instanceof Error ? e.message : String(e),
1122
1130
  endedAt: Date.now(),
1123
1131
  startedAt,
@@ -1129,14 +1137,14 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1129
1137
  execResults = {
1130
1138
  status: "suspended",
1131
1139
  suspendedPayload: suspended.payload,
1132
- payload: prevOutput,
1140
+ payload: inputData,
1133
1141
  suspendedAt: Date.now(),
1134
1142
  startedAt,
1135
1143
  resumedAt: resume?.steps[0] === step.id ? startedAt : void 0,
1136
1144
  resumePayload: resume?.steps[0] === step.id ? resume?.resumePayload : void 0
1137
1145
  };
1138
1146
  } else if (bailed) {
1139
- execResults = { status: "bailed", output: bailed.payload, payload: prevOutput, endedAt: Date.now(), startedAt };
1147
+ execResults = { status: "bailed", output: bailed.payload, payload: inputData, endedAt: Date.now(), startedAt };
1140
1148
  }
1141
1149
  if (execResults.status === "failed") {
1142
1150
  if (executionContext.retryConfig.attempts > 0 && this.inngestAttempts < executionContext.retryConfig.attempts) {
@@ -1194,7 +1202,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1194
1202
  await this.runScorers({
1195
1203
  scorers: step.scorers,
1196
1204
  runId: executionContext.runId,
1197
- input: prevOutput,
1205
+ input: inputData,
1198
1206
  output: stepRes.result,
1199
1207
  workflowId: executionContext.workflowId,
1200
1208
  stepId: step.id,
@@ -1213,6 +1221,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1213
1221
  workflowId,
1214
1222
  runId,
1215
1223
  stepResults,
1224
+ resourceId,
1216
1225
  executionContext,
1217
1226
  serializedStepGraph,
1218
1227
  workflowStatus,
@@ -1225,6 +1234,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1225
1234
  await this.mastra?.getStorage()?.persistWorkflowSnapshot({
1226
1235
  workflowName: workflowId,
1227
1236
  runId,
1237
+ resourceId,
1228
1238
  snapshot: {
1229
1239
  runId,
1230
1240
  value: {},
@@ -1262,11 +1272,12 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1262
1272
  }) {
1263
1273
  const conditionalSpan = tracingContext?.currentSpan?.createChildSpan({
1264
1274
  type: aiTracing.AISpanType.WORKFLOW_CONDITIONAL,
1265
- name: `conditional: ${entry.conditions.length} conditions`,
1275
+ name: `conditional: '${entry.conditions.length} conditions'`,
1266
1276
  input: prevOutput,
1267
1277
  attributes: {
1268
1278
  conditionCount: entry.conditions.length
1269
- }
1279
+ },
1280
+ tracingPolicy: this.options?.tracingPolicy
1270
1281
  });
1271
1282
  let execResults;
1272
1283
  const truthyIndexes = (await Promise.all(
@@ -1274,11 +1285,12 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1274
1285
  (cond, index) => this.inngestStep.run(`workflow.${workflowId}.conditional.${index}`, async () => {
1275
1286
  const evalSpan = conditionalSpan?.createChildSpan({
1276
1287
  type: aiTracing.AISpanType.WORKFLOW_CONDITIONAL_EVAL,
1277
- name: `condition ${index}`,
1288
+ name: `condition: '${index}'`,
1278
1289
  input: prevOutput,
1279
1290
  attributes: {
1280
1291
  conditionIndex: index
1281
- }
1292
+ },
1293
+ tracingPolicy: this.options?.tracingPolicy
1282
1294
  });
1283
1295
  try {
1284
1296
  const result = await cond({
@@ -1292,16 +1304,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1292
1304
  currentSpan: evalSpan
1293
1305
  },
1294
1306
  getInitData: () => stepResults?.input,
1295
- getStepResult: (step) => {
1296
- if (!step?.id) {
1297
- return null;
1298
- }
1299
- const result2 = stepResults[step.id];
1300
- if (result2?.status === "success") {
1301
- return result2.output;
1302
- }
1303
- return null;
1304
- },
1307
+ getStepResult: workflows.getStepResult.bind(this, stepResults),
1305
1308
  // TODO: this function shouldn't have suspend probably?
1306
1309
  suspend: async (_suspendPayload) => {
1307
1310
  },