@mastra/inngest 1.1.2 → 1.2.0

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.d.ts CHANGED
@@ -1,15 +1,14 @@
1
1
  import { Agent } from '@mastra/core/agent';
2
2
  import type { MastraScorers } from '@mastra/core/evals';
3
- import type { Processor } from '@mastra/core/processors';
4
- import { ProcessorStepOutputSchema, ProcessorStepSchema } from '@mastra/core/processors';
5
- import type { OutputSchema } from '@mastra/core/stream';
3
+ import type { Processor, ProcessorStepInputSchema } from '@mastra/core/processors';
4
+ import { ProcessorStepOutputSchema } from '@mastra/core/processors';
5
+ import type { InferPublicSchema, PublicSchema, StandardSchemaWithJSON } from '@mastra/core/schema';
6
6
  import type { ToolExecutionContext } from '@mastra/core/tools';
7
7
  import { Tool, createTool } from '@mastra/core/tools';
8
8
  import type { DynamicArgument } from '@mastra/core/types';
9
9
  import type { Step, AgentStepOptions, StepParams, StepMetadata } from '@mastra/core/workflows';
10
10
  import { Workflow } from '@mastra/core/workflows';
11
11
  import type { Inngest } from 'inngest';
12
- import { z } from 'zod';
13
12
  import type { InngestEngineType, InngestWorkflowConfig } from './types.js';
14
13
  import { InngestWorkflow } from './workflow.js';
15
14
  export * from './workflow.js';
@@ -28,13 +27,13 @@ export * from './types.js';
28
27
  * @param params.execute Function that performs the step's operations
29
28
  * @returns A Step object that can be added to the workflow
30
29
  */
31
- export declare function createStep<TStepId extends string, TStateSchema extends z.ZodTypeAny | undefined, TInputSchema extends z.ZodTypeAny, TOutputSchema extends z.ZodTypeAny, TResumeSchema extends z.ZodTypeAny | undefined = undefined, TSuspendSchema extends z.ZodTypeAny | undefined = undefined>(params: StepParams<TStepId, TStateSchema, TInputSchema, TOutputSchema, TResumeSchema, TSuspendSchema>): Step<TStepId, TStateSchema extends z.ZodTypeAny ? z.infer<TStateSchema> : unknown, z.infer<TInputSchema>, z.infer<TOutputSchema>, TResumeSchema extends z.ZodTypeAny ? z.infer<TResumeSchema> : unknown, TSuspendSchema extends z.ZodTypeAny ? z.infer<TSuspendSchema> : unknown, InngestEngineType>;
30
+ export declare function createStep<TStepId extends string, TStateSchema extends PublicSchema | undefined, TInputSchema extends PublicSchema, TOutputSchema extends PublicSchema, TResumeSchema extends PublicSchema | undefined = undefined, TSuspendSchema extends PublicSchema | undefined = undefined>(params: StepParams<TStepId, TStateSchema, TInputSchema, TOutputSchema, TResumeSchema, TSuspendSchema>): Step<TStepId, TStateSchema extends PublicSchema ? InferPublicSchema<TStateSchema> : unknown, InferPublicSchema<TInputSchema>, InferPublicSchema<TOutputSchema>, TResumeSchema extends PublicSchema ? InferPublicSchema<TResumeSchema> : unknown, TSuspendSchema extends PublicSchema ? InferPublicSchema<TSuspendSchema> : unknown, InngestEngineType>;
32
31
  /**
33
32
  * Creates a step from an agent with structured output
34
33
  */
35
34
  export declare function createStep<TStepId extends string, TStepOutput>(agent: Agent<TStepId, any>, agentOptions: AgentStepOptions<TStepOutput> & {
36
35
  structuredOutput: {
37
- schema: OutputSchema<TStepOutput>;
36
+ schema: StandardSchemaWithJSON<TStepOutput>;
38
37
  };
39
38
  retries?: number;
40
39
  scorers?: DynamicArgument<MastraScorers>;
@@ -49,11 +48,14 @@ export declare function createStep<TStepId extends string, TStepInput extends {
49
48
  prompt: string;
50
49
  }, TStepOutput extends {
51
50
  text: string;
52
- }, TResume, TSuspend>(agent: Agent<TStepId, any>): Step<TStepId, unknown, TStepInput, TStepOutput, TResume, TSuspend, InngestEngineType>;
51
+ }, TResume, TSuspend>(agent: Agent<TStepId, any>, agentOptions?: AgentStepOptions<TStepOutput> & {
52
+ retries?: number;
53
+ scorers?: DynamicArgument<MastraScorers>;
54
+ }): Step<TStepId, unknown, TStepInput, TStepOutput, TResume, TSuspend, InngestEngineType>;
53
55
  /**
54
56
  * Creates a step from a tool
55
57
  */
56
- export declare function createStep<TSchemaIn, TSuspend, TResume, TSchemaOut, TContext extends ToolExecutionContext<TSuspend, TResume, any> = ToolExecutionContext<TSuspend, TResume>, TId extends string = string, TRequestContext extends Record<string, any> | unknown = unknown>(tool: Tool<TSchemaIn, TSchemaOut, TSuspend, TResume, TContext, TId, TRequestContext>, toolOptions?: {
58
+ export declare function createStep<TSchemaIn, TSchemaOut, TSuspend, TResume, TContext extends ToolExecutionContext<TSuspend, TResume, any> = ToolExecutionContext<TSuspend, TResume>, TId extends string = string, TRequestContext extends Record<string, any> | unknown = unknown>(tool: Tool<TSchemaIn, TSchemaOut, TSuspend, TResume, TContext, TId, TRequestContext>, toolOptions?: {
57
59
  retries?: number;
58
60
  scorers?: DynamicArgument<MastraScorers>;
59
61
  metadata?: StepMetadata;
@@ -74,13 +76,13 @@ export declare function createStep<TProcessorId extends string>(processor: (Proc
74
76
  processOutputResult: Function;
75
77
  }) | (Processor<TProcessorId> & {
76
78
  processOutputStep: Function;
77
- })): Step<`processor:${TProcessorId}`, unknown, typeof ProcessorStepSchema, typeof ProcessorStepOutputSchema, unknown, unknown, InngestEngineType>;
79
+ })): Step<`processor:${TProcessorId}`, unknown, InferPublicSchema<typeof ProcessorStepInputSchema>, InferPublicSchema<typeof ProcessorStepOutputSchema>, unknown, unknown, InngestEngineType>;
78
80
  /**
79
81
  * IMPORTANT: Fallback overload - provides better error messages when StepParams doesn't match
80
82
  * This should be LAST and will show clearer errors about what's wrong
81
83
  * This is a copy of first one, KEEP THIS IN SYNC!
82
84
  */
83
- export declare function createStep<TStepId extends string, TStateSchema extends z.ZodTypeAny | undefined, TInputSchema extends z.ZodTypeAny, TOutputSchema extends z.ZodTypeAny, TResumeSchema extends z.ZodTypeAny | undefined = undefined, TSuspendSchema extends z.ZodTypeAny | undefined = undefined>(params: StepParams<TStepId, TStateSchema, TInputSchema, TOutputSchema, TResumeSchema, TSuspendSchema>): Step<TStepId, TStateSchema extends z.ZodTypeAny ? z.infer<TStateSchema> : unknown, z.infer<TInputSchema>, z.infer<TOutputSchema>, TResumeSchema extends z.ZodTypeAny ? z.infer<TResumeSchema> : unknown, TSuspendSchema extends z.ZodTypeAny ? z.infer<TSuspendSchema> : unknown, InngestEngineType>;
85
+ export declare function createStep<TStepId extends string, TStateSchema extends PublicSchema | undefined, TInputSchema extends PublicSchema, TOutputSchema extends PublicSchema, TResumeSchema extends PublicSchema | undefined = undefined, TSuspendSchema extends PublicSchema | undefined = undefined>(params: StepParams<TStepId, TStateSchema, TInputSchema, TOutputSchema, TResumeSchema, TSuspendSchema>): Step<TStepId, TStateSchema extends PublicSchema ? InferPublicSchema<TStateSchema> : unknown, InferPublicSchema<TInputSchema>, InferPublicSchema<TOutputSchema>, TResumeSchema extends PublicSchema ? InferPublicSchema<TResumeSchema> : unknown, TSuspendSchema extends PublicSchema ? InferPublicSchema<TSuspendSchema> : unknown, InngestEngineType>;
84
86
  export declare function init(inngest: Inngest): {
85
87
  createTool: typeof createTool;
86
88
  createWorkflow<TWorkflowId extends string = string, TState = any, TInput = any, TOutput = any, TSteps extends Step<string, any, any, any, any, any, InngestEngineType>[] = Step<string, any, any, any, any, any, InngestEngineType, unknown>[]>(params: InngestWorkflowConfig<TWorkflowId, TState, TInput, TOutput, TSteps>): InngestWorkflow<InngestEngineType, TSteps, TWorkflowId, TState, TInput, TOutput, TInput>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAyB,MAAM,oBAAoB,CAAC;AAGlE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIxD,OAAO,KAAK,EAAE,SAAS,EAAuB,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAmB,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC1G,OAAO,KAAK,EAAa,YAAY,EAAwB,MAAM,qBAAqB,CAAC;AACzF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MA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B1D,WAAW,SAAS,MAAM,WAC1B,MAAM,YACN,MAAM,YACN,OAAO,YACP,MAAM,SAAS,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,iBAAiB,CAAC,EAAE,wEASzE,KAAK,qBAEK,QAAQ,CAAC,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,QAC/E;QAAE,EAAE,EAAE,WAAW,CAAA;KAAE,GACxB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC;EAetF"}
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ import { MessageList, Agent, TripWire } from '@mastra/core/agent';
2
2
  import { getErrorFromUnknown, MastraError, ErrorDomain, ErrorCategory } from '@mastra/core/error';
3
3
  import { EntityType, SpanType } from '@mastra/core/observability';
4
4
  import { ProcessorStepOutputSchema, ProcessorStepSchema, ProcessorRunner } from '@mastra/core/processors';
5
+ import { toStandardSchema } from '@mastra/core/schema';
5
6
  import { createTool, Tool } from '@mastra/core/tools';
6
7
  import { DefaultExecutionEngine, createTimeTravelExecutionParams, Run, hydrateSerializedStepErrors, Workflow } from '@mastra/core/workflows';
7
8
  import { PUBSUB_SYMBOL, STREAM_FORMAT_SYMBOL } from '@mastra/core/workflows/_constants';
@@ -13,6 +14,8 @@ import { subscribe } from '@inngest/realtime';
13
14
  import { PubSub } from '@mastra/core/events';
14
15
  import { ReadableStream } from 'stream/web';
15
16
  import { ChunkFrom, WorkflowRunOutput } from '@mastra/core/stream';
17
+ import { context } from '@opentelemetry/api';
18
+ import { suppressTracing } from '@opentelemetry/core';
16
19
  import { serve as serve$1 } from 'inngest/hono';
17
20
 
18
21
  // src/index.ts
@@ -640,13 +643,13 @@ var InngestRun = class extends Run {
640
643
  let lastError = null;
641
644
  for (let attempt = 0; attempt < maxRetries; attempt++) {
642
645
  try {
643
- const response = await fetch(
644
- `${this.inngest.apiBaseUrl ?? "https://api.inngest.com"}/v1/events/${eventId}/runs`,
645
- {
646
+ const response = await context.with(
647
+ suppressTracing(context.active()),
648
+ () => fetch(`${this.inngest.apiBaseUrl ?? "https://api.inngest.com"}/v1/events/${eventId}/runs`, {
646
649
  headers: {
647
650
  Authorization: `Bearer ${process.env.INNGEST_SIGNING_KEY}`
648
651
  }
649
- }
652
+ })
650
653
  );
651
654
  if (response.status === 429) {
652
655
  const retryAfter = parseInt(response.headers.get("retry-after") || "2", 10);
@@ -1785,11 +1788,11 @@ function createStepFromParams(params) {
1785
1788
  return {
1786
1789
  id: params.id,
1787
1790
  description: params.description,
1788
- inputSchema: params.inputSchema,
1789
- stateSchema: params.stateSchema,
1790
- outputSchema: params.outputSchema,
1791
- resumeSchema: params.resumeSchema,
1792
- suspendSchema: params.suspendSchema,
1791
+ inputSchema: toStandardSchema(params.inputSchema),
1792
+ stateSchema: params.stateSchema ? toStandardSchema(params.stateSchema) : void 0,
1793
+ outputSchema: toStandardSchema(params.outputSchema),
1794
+ resumeSchema: params.resumeSchema ? toStandardSchema(params.resumeSchema) : void 0,
1795
+ suspendSchema: params.suspendSchema ? toStandardSchema(params.suspendSchema) : void 0,
1793
1796
  scorers: params.scorers,
1794
1797
  retries: params.retries,
1795
1798
  metadata: params.metadata,
@@ -1803,10 +1806,12 @@ function createStepFromAgent(params, agentOrToolOptions) {
1803
1806
  return {
1804
1807
  id: params.name,
1805
1808
  description: params.getDescription(),
1806
- inputSchema: z.object({
1807
- prompt: z.string()
1808
- }),
1809
- outputSchema,
1809
+ inputSchema: toStandardSchema(
1810
+ z.object({
1811
+ prompt: z.string()
1812
+ })
1813
+ ),
1814
+ outputSchema: toStandardSchema(outputSchema),
1810
1815
  retries,
1811
1816
  scorers,
1812
1817
  metadata,
@@ -1849,20 +1854,25 @@ function createStepFromAgent(params, agentOrToolOptions) {
1849
1854
  });
1850
1855
  stream = fullStream;
1851
1856
  } else {
1852
- const modelOutput = await params.stream(inputData.prompt, {
1853
- ...agentOptions ?? {},
1857
+ const { structuredOutput, ...restAgentOptions } = agentOptions ?? {};
1858
+ const baseOptions = {
1859
+ ...restAgentOptions,
1854
1860
  requestContext,
1855
1861
  tracingContext,
1856
1862
  onFinish: (result) => {
1857
1863
  const resultWithObject = result;
1858
- if (agentOptions?.structuredOutput?.schema && resultWithObject.object) {
1864
+ if (structuredOutput?.schema && resultWithObject.object) {
1859
1865
  structuredResult = resultWithObject.object;
1860
1866
  }
1861
1867
  streamPromise.resolve(result.text);
1862
1868
  void agentOptions?.onFinish?.(result);
1863
1869
  },
1864
1870
  abortSignal
1865
- });
1871
+ };
1872
+ const modelOutput = structuredOutput ? await params.stream(inputData.prompt, {
1873
+ ...baseOptions,
1874
+ structuredOutput
1875
+ }) : await params.stream(inputData.prompt, baseOptions);
1866
1876
  stream = modelOutput.fullStream;
1867
1877
  }
1868
1878
  if (streamFormat === "legacy") {
@@ -2012,6 +2022,7 @@ function createStepFromProcessor(processor) {
2012
2022
  part,
2013
2023
  streamParts,
2014
2024
  state,
2025
+ result,
2015
2026
  finishReason,
2016
2027
  toolCalls,
2017
2028
  text,
@@ -2063,6 +2074,7 @@ function createStepFromProcessor(processor) {
2063
2074
  systemMessages,
2064
2075
  streamParts,
2065
2076
  state,
2077
+ result,
2066
2078
  finishReason,
2067
2079
  toolCalls,
2068
2080
  text,
@@ -2079,9 +2091,9 @@ function createStepFromProcessor(processor) {
2079
2091
  };
2080
2092
  const executePhaseWithSpan = async (fn) => {
2081
2093
  try {
2082
- const result = await fn();
2083
- processorSpan?.end({ output: result });
2084
- return result;
2094
+ const result2 = await fn();
2095
+ processorSpan?.end({ output: result2 });
2096
+ return result2;
2085
2097
  } catch (error) {
2086
2098
  if (error instanceof TripWire) {
2087
2099
  processorSpan?.end({ output: { tripwire: error.message } });
@@ -2105,15 +2117,15 @@ function createStepFromProcessor(processor) {
2105
2117
  }
2106
2118
  const idsBeforeProcessing = messages.map((m) => m.id);
2107
2119
  const check = passThrough.messageList.makeMessageSourceChecker();
2108
- const result = await processor.processInput({
2120
+ const result2 = await processor.processInput({
2109
2121
  ...baseContext,
2110
2122
  messages,
2111
2123
  messageList: passThrough.messageList,
2112
2124
  systemMessages: systemMessages ?? [],
2113
2125
  state: {}
2114
2126
  });
2115
- if (result instanceof MessageList) {
2116
- if (result !== passThrough.messageList) {
2127
+ if (result2 instanceof MessageList) {
2128
+ if (result2 !== passThrough.messageList) {
2117
2129
  throw new MastraError({
2118
2130
  category: ErrorCategory.USER,
2119
2131
  domain: ErrorDomain.MASTRA_WORKFLOW,
@@ -2123,20 +2135,20 @@ function createStepFromProcessor(processor) {
2123
2135
  }
2124
2136
  return {
2125
2137
  ...passThrough,
2126
- messages: result.get.all.db(),
2127
- systemMessages: result.getAllSystemMessages()
2138
+ messages: result2.get.all.db(),
2139
+ systemMessages: result2.getAllSystemMessages()
2128
2140
  };
2129
- } else if (Array.isArray(result)) {
2141
+ } else if (Array.isArray(result2)) {
2130
2142
  ProcessorRunner.applyMessagesToMessageList(
2131
- result,
2143
+ result2,
2132
2144
  passThrough.messageList,
2133
2145
  idsBeforeProcessing,
2134
2146
  check,
2135
2147
  "input"
2136
2148
  );
2137
- return { ...passThrough, messages: result };
2138
- } else if (result && "messages" in result && "systemMessages" in result) {
2139
- const typedResult = result;
2149
+ return { ...passThrough, messages: result2 };
2150
+ } else if (result2 && "messages" in result2 && "systemMessages" in result2) {
2151
+ const typedResult = result2;
2140
2152
  ProcessorRunner.applyMessagesToMessageList(
2141
2153
  typedResult.messages,
2142
2154
  passThrough.messageList,
@@ -2167,7 +2179,7 @@ function createStepFromProcessor(processor) {
2167
2179
  }
2168
2180
  const idsBeforeProcessing = messages.map((m) => m.id);
2169
2181
  const check = passThrough.messageList.makeMessageSourceChecker();
2170
- const result = await processor.processInputStep({
2182
+ const result2 = await processor.processInputStep({
2171
2183
  ...baseContext,
2172
2184
  messages,
2173
2185
  messageList: passThrough.messageList,
@@ -2184,7 +2196,7 @@ function createStepFromProcessor(processor) {
2184
2196
  steps: steps ?? [],
2185
2197
  state: {}
2186
2198
  });
2187
- const validatedResult = await ProcessorRunner.validateAndFormatProcessInputStepResult(result, {
2199
+ const validatedResult = await ProcessorRunner.validateAndFormatProcessInputStepResult(result2, {
2188
2200
  messageList: passThrough.messageList,
2189
2201
  processor,
2190
2202
  stepNumber: stepNumber ?? 0
@@ -2232,9 +2244,9 @@ function createStepFromProcessor(processor) {
2232
2244
  };
2233
2245
  }
2234
2246
  const processorTracingContext2 = processorSpan2 ? { currentSpan: processorSpan2 } : baseContext.tracingContext;
2235
- let result;
2247
+ let result2;
2236
2248
  try {
2237
- result = await processor.processOutputStream({
2249
+ result2 = await processor.processOutputStream({
2238
2250
  ...baseContext,
2239
2251
  tracingContext: processorTracingContext2,
2240
2252
  part,
@@ -2244,7 +2256,7 @@ function createStepFromProcessor(processor) {
2244
2256
  // Optional for stream processing
2245
2257
  });
2246
2258
  if (part && part.type === "finish") {
2247
- processorSpan2?.end({ output: result });
2259
+ processorSpan2?.end({ output: result2 });
2248
2260
  delete mutableState[spanKey];
2249
2261
  }
2250
2262
  } catch (error) {
@@ -2256,7 +2268,7 @@ function createStepFromProcessor(processor) {
2256
2268
  delete mutableState[spanKey];
2257
2269
  throw error;
2258
2270
  }
2259
- return { ...passThrough, state: mutableState, part: result };
2271
+ return { ...passThrough, state: mutableState, part: result2 };
2260
2272
  }
2261
2273
  return { ...passThrough, part };
2262
2274
  }
@@ -2272,14 +2284,21 @@ function createStepFromProcessor(processor) {
2272
2284
  }
2273
2285
  const idsBeforeProcessing = messages.map((m) => m.id);
2274
2286
  const check = passThrough.messageList.makeMessageSourceChecker();
2275
- const result = await processor.processOutputResult({
2287
+ const outputResult = passThrough.result ?? {
2288
+ text: "",
2289
+ usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0 },
2290
+ finishReason: "unknown",
2291
+ steps: []
2292
+ };
2293
+ const processResult = await processor.processOutputResult({
2276
2294
  ...baseContext,
2277
2295
  messages,
2278
2296
  messageList: passThrough.messageList,
2279
- state: {}
2297
+ state: passThrough.state ?? {},
2298
+ result: outputResult
2280
2299
  });
2281
- if (result instanceof MessageList) {
2282
- if (result !== passThrough.messageList) {
2300
+ if (processResult instanceof MessageList) {
2301
+ if (processResult !== passThrough.messageList) {
2283
2302
  throw new MastraError({
2284
2303
  category: ErrorCategory.USER,
2285
2304
  domain: ErrorDomain.MASTRA_WORKFLOW,
@@ -2289,20 +2308,20 @@ function createStepFromProcessor(processor) {
2289
2308
  }
2290
2309
  return {
2291
2310
  ...passThrough,
2292
- messages: result.get.all.db(),
2293
- systemMessages: result.getAllSystemMessages()
2311
+ messages: processResult.get.all.db(),
2312
+ systemMessages: processResult.getAllSystemMessages()
2294
2313
  };
2295
- } else if (Array.isArray(result)) {
2314
+ } else if (Array.isArray(processResult)) {
2296
2315
  ProcessorRunner.applyMessagesToMessageList(
2297
- result,
2316
+ processResult,
2298
2317
  passThrough.messageList,
2299
2318
  idsBeforeProcessing,
2300
2319
  check,
2301
2320
  "response"
2302
2321
  );
2303
- return { ...passThrough, messages: result };
2304
- } else if (result && "messages" in result && "systemMessages" in result) {
2305
- const typedResult = result;
2322
+ return { ...passThrough, messages: processResult };
2323
+ } else if (processResult && "messages" in processResult && "systemMessages" in processResult) {
2324
+ const typedResult = processResult;
2306
2325
  ProcessorRunner.applyMessagesToMessageList(
2307
2326
  typedResult.messages,
2308
2327
  passThrough.messageList,
@@ -2333,7 +2352,7 @@ function createStepFromProcessor(processor) {
2333
2352
  }
2334
2353
  const idsBeforeProcessing = messages.map((m) => m.id);
2335
2354
  const check = passThrough.messageList.makeMessageSourceChecker();
2336
- const result = await processor.processOutputStep({
2355
+ const result2 = await processor.processOutputStep({
2337
2356
  ...baseContext,
2338
2357
  messages,
2339
2358
  messageList: passThrough.messageList,
@@ -2345,8 +2364,8 @@ function createStepFromProcessor(processor) {
2345
2364
  steps: steps ?? [],
2346
2365
  state: {}
2347
2366
  });
2348
- if (result instanceof MessageList) {
2349
- if (result !== passThrough.messageList) {
2367
+ if (result2 instanceof MessageList) {
2368
+ if (result2 !== passThrough.messageList) {
2350
2369
  throw new MastraError({
2351
2370
  category: ErrorCategory.USER,
2352
2371
  domain: ErrorDomain.MASTRA_WORKFLOW,
@@ -2356,20 +2375,20 @@ function createStepFromProcessor(processor) {
2356
2375
  }
2357
2376
  return {
2358
2377
  ...passThrough,
2359
- messages: result.get.all.db(),
2360
- systemMessages: result.getAllSystemMessages()
2378
+ messages: result2.get.all.db(),
2379
+ systemMessages: result2.getAllSystemMessages()
2361
2380
  };
2362
- } else if (Array.isArray(result)) {
2381
+ } else if (Array.isArray(result2)) {
2363
2382
  ProcessorRunner.applyMessagesToMessageList(
2364
- result,
2383
+ result2,
2365
2384
  passThrough.messageList,
2366
2385
  idsBeforeProcessing,
2367
2386
  check,
2368
2387
  "response"
2369
2388
  );
2370
- return { ...passThrough, messages: result };
2371
- } else if (result && "messages" in result && "systemMessages" in result) {
2372
- const typedResult = result;
2389
+ return { ...passThrough, messages: result2 };
2390
+ } else if (result2 && "messages" in result2 && "systemMessages" in result2) {
2391
+ const typedResult = result2;
2373
2392
  ProcessorRunner.applyMessagesToMessageList(
2374
2393
  typedResult.messages,
2375
2394
  passThrough.messageList,