@mastra/inngest 0.0.0-http-transporter-20250702160118 → 0.0.0-memory-system-message-error-20250813233316

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/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';
@@ -231,6 +232,7 @@ export class InngestRun<
231
232
  data: {
232
233
  inputData: params.resumeData,
233
234
  runId: this.runId,
235
+ workflowId: this.workflowId,
234
236
  stepResults: snapshot?.context as any,
235
237
  resume: {
236
238
  steps,
@@ -968,6 +970,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
968
970
  emitter,
969
971
  abortController,
970
972
  runtimeContext,
973
+ writableStream,
971
974
  }: {
972
975
  workflowId: string;
973
976
  runId: string;
@@ -982,6 +985,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
982
985
  emitter: Emitter;
983
986
  abortController: AbortController;
984
987
  runtimeContext: RuntimeContext;
988
+ writableStream?: WritableStream<ChunkType>;
985
989
  }): Promise<StepResult<any, any, any, any>> {
986
990
  return super.executeStep({
987
991
  workflowId,
@@ -994,11 +998,188 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
994
998
  emitter,
995
999
  abortController,
996
1000
  runtimeContext,
1001
+ writableStream,
997
1002
  });
998
1003
  }
999
1004
 
1000
- async executeSleep({ id, duration }: { id: string; duration: number }): Promise<void> {
1001
- await this.inngestStep.sleep(id, duration);
1005
+ // async executeSleep({ id, duration }: { id: string; duration: number }): Promise<void> {
1006
+ // await this.inngestStep.sleep(id, duration);
1007
+ // }
1008
+
1009
+ async executeSleep({
1010
+ workflowId,
1011
+ runId,
1012
+ entry,
1013
+ prevOutput,
1014
+ stepResults,
1015
+ emitter,
1016
+ abortController,
1017
+ runtimeContext,
1018
+ writableStream,
1019
+ }: {
1020
+ workflowId: string;
1021
+ runId: string;
1022
+ serializedStepGraph: SerializedStepFlowEntry[];
1023
+ entry: {
1024
+ type: 'sleep';
1025
+ id: string;
1026
+ duration?: number;
1027
+ fn?: ExecuteFunction<any, any, any, any, InngestEngineType>;
1028
+ };
1029
+ prevStep: StepFlowEntry;
1030
+ prevOutput: any;
1031
+ stepResults: Record<string, StepResult<any, any, any, any>>;
1032
+ resume?: {
1033
+ steps: string[];
1034
+ stepResults: Record<string, StepResult<any, any, any, any>>;
1035
+ resumePayload: any;
1036
+ resumePath: number[];
1037
+ };
1038
+ executionContext: ExecutionContext;
1039
+ emitter: Emitter;
1040
+ abortController: AbortController;
1041
+ runtimeContext: RuntimeContext;
1042
+ writableStream?: WritableStream<ChunkType>;
1043
+ }): Promise<void> {
1044
+ let { duration, fn } = entry;
1045
+
1046
+ if (fn) {
1047
+ const stepCallId = randomUUID();
1048
+ duration = await this.inngestStep.run(`workflow.${workflowId}.sleep.${entry.id}`, async () => {
1049
+ return await fn({
1050
+ runId,
1051
+ workflowId,
1052
+ mastra: this.mastra!,
1053
+ runtimeContext,
1054
+ inputData: prevOutput,
1055
+ runCount: -1,
1056
+ getInitData: () => stepResults?.input as any,
1057
+ getStepResult: (step: any) => {
1058
+ if (!step?.id) {
1059
+ return null;
1060
+ }
1061
+
1062
+ const result = stepResults[step.id];
1063
+ if (result?.status === 'success') {
1064
+ return result.output;
1065
+ }
1066
+
1067
+ return null;
1068
+ },
1069
+
1070
+ // TODO: this function shouldn't have suspend probably?
1071
+ suspend: async (_suspendPayload: any): Promise<any> => {},
1072
+ bail: () => {},
1073
+ abort: () => {
1074
+ abortController?.abort();
1075
+ },
1076
+ [EMITTER_SYMBOL]: emitter,
1077
+ engine: { step: this.inngestStep },
1078
+ abortSignal: abortController?.signal,
1079
+ writer: new ToolStream(
1080
+ {
1081
+ prefix: 'step',
1082
+ callId: stepCallId,
1083
+ name: 'sleep',
1084
+ runId,
1085
+ },
1086
+ writableStream,
1087
+ ),
1088
+ });
1089
+ });
1090
+ }
1091
+
1092
+ await this.inngestStep.sleep(entry.id, !duration || duration < 0 ? 0 : duration);
1093
+ }
1094
+
1095
+ async executeSleepUntil({
1096
+ workflowId,
1097
+ runId,
1098
+ entry,
1099
+ prevOutput,
1100
+ stepResults,
1101
+ emitter,
1102
+ abortController,
1103
+ runtimeContext,
1104
+ writableStream,
1105
+ }: {
1106
+ workflowId: string;
1107
+ runId: string;
1108
+ serializedStepGraph: SerializedStepFlowEntry[];
1109
+ entry: {
1110
+ type: 'sleepUntil';
1111
+ id: string;
1112
+ date?: Date;
1113
+ fn?: ExecuteFunction<any, any, any, any, InngestEngineType>;
1114
+ };
1115
+ prevStep: StepFlowEntry;
1116
+ prevOutput: any;
1117
+ stepResults: Record<string, StepResult<any, any, any, any>>;
1118
+ resume?: {
1119
+ steps: string[];
1120
+ stepResults: Record<string, StepResult<any, any, any, any>>;
1121
+ resumePayload: any;
1122
+ resumePath: number[];
1123
+ };
1124
+ executionContext: ExecutionContext;
1125
+ emitter: Emitter;
1126
+ abortController: AbortController;
1127
+ runtimeContext: RuntimeContext;
1128
+ writableStream?: WritableStream<ChunkType>;
1129
+ }): Promise<void> {
1130
+ let { date, fn } = entry;
1131
+
1132
+ if (fn) {
1133
+ date = await this.inngestStep.run(`workflow.${workflowId}.sleepUntil.${entry.id}`, async () => {
1134
+ const stepCallId = randomUUID();
1135
+ return await fn({
1136
+ runId,
1137
+ workflowId,
1138
+ mastra: this.mastra!,
1139
+ runtimeContext,
1140
+ inputData: prevOutput,
1141
+ runCount: -1,
1142
+ getInitData: () => stepResults?.input as any,
1143
+ getStepResult: (step: any) => {
1144
+ if (!step?.id) {
1145
+ return null;
1146
+ }
1147
+
1148
+ const result = stepResults[step.id];
1149
+ if (result?.status === 'success') {
1150
+ return result.output;
1151
+ }
1152
+
1153
+ return null;
1154
+ },
1155
+
1156
+ // TODO: this function shouldn't have suspend probably?
1157
+ suspend: async (_suspendPayload: any): Promise<any> => {},
1158
+ bail: () => {},
1159
+ abort: () => {
1160
+ abortController?.abort();
1161
+ },
1162
+ [EMITTER_SYMBOL]: emitter,
1163
+ engine: { step: this.inngestStep },
1164
+ abortSignal: abortController?.signal,
1165
+ writer: new ToolStream(
1166
+ {
1167
+ prefix: 'step',
1168
+ callId: stepCallId,
1169
+ name: 'sleep',
1170
+ runId,
1171
+ },
1172
+ writableStream,
1173
+ ),
1174
+ });
1175
+ });
1176
+ }
1177
+
1178
+ if (!(date instanceof Date)) {
1179
+ return;
1180
+ }
1181
+
1182
+ await this.inngestStep.sleepUntil(entry.id, date);
1002
1183
  }
1003
1184
 
1004
1185
  async executeWaitForEvent({ event, timeout }: { event: string; timeout?: number }): Promise<any> {
@@ -1023,6 +1204,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
1023
1204
  emitter,
1024
1205
  abortController,
1025
1206
  runtimeContext,
1207
+ writableStream,
1026
1208
  }: {
1027
1209
  step: Step<string, any, any>;
1028
1210
  stepResults: Record<string, StepResult<any, any, any, any>>;
@@ -1036,6 +1218,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
1036
1218
  emitter: Emitter;
1037
1219
  abortController: AbortController;
1038
1220
  runtimeContext: RuntimeContext;
1221
+ writableStream?: WritableStream<ChunkType>;
1039
1222
  }): Promise<StepResult<any, any, any, any>> {
1040
1223
  const startedAt = await this.inngestStep.run(
1041
1224
  `workflow.${executionContext.workflowId}.run.${executionContext.runId}.step.${step.id}.running_ev`,
@@ -1279,6 +1462,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
1279
1462
  runId: executionContext.runId,
1280
1463
  mastra: this.mastra!,
1281
1464
  runtimeContext,
1465
+ writableStream,
1282
1466
  inputData: prevOutput,
1283
1467
  resumeData: resume?.steps[0] === step.id ? resume?.resumePayload : undefined,
1284
1468
  getInitData: () => stepResults?.input as any,
@@ -1425,6 +1609,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
1425
1609
  workflowStatus: 'success' | 'failed' | 'suspended' | 'running';
1426
1610
  result?: Record<string, any>;
1427
1611
  error?: string | Error;
1612
+ runtimeContext: RuntimeContext;
1428
1613
  }) {
1429
1614
  await this.inngestStep.run(
1430
1615
  `workflow.${workflowId}.run.${runId}.path.${JSON.stringify(executionContext.executionPath)}.stepUpdate`,
@@ -1463,6 +1648,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
1463
1648
  emitter,
1464
1649
  abortController,
1465
1650
  runtimeContext,
1651
+ writableStream,
1466
1652
  }: {
1467
1653
  workflowId: string;
1468
1654
  runId: string;
@@ -1485,6 +1671,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
1485
1671
  emitter: Emitter;
1486
1672
  abortController: AbortController;
1487
1673
  runtimeContext: RuntimeContext;
1674
+ writableStream?: WritableStream<ChunkType>;
1488
1675
  }): Promise<StepResult<any, any, any, any>> {
1489
1676
  let execResults: any;
1490
1677
  const truthyIndexes = (
@@ -1494,6 +1681,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
1494
1681
  try {
1495
1682
  const result = await cond({
1496
1683
  runId,
1684
+ workflowId,
1497
1685
  mastra: this.mastra!,
1498
1686
  runtimeContext,
1499
1687
  runCount: -1,
@@ -1523,6 +1711,15 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
1523
1711
  step: this.inngestStep,
1524
1712
  },
1525
1713
  abortSignal: abortController.signal,
1714
+ writer: new ToolStream(
1715
+ {
1716
+ prefix: 'step',
1717
+ callId: randomUUID(),
1718
+ name: 'conditional',
1719
+ runId,
1720
+ },
1721
+ writableStream,
1722
+ ),
1526
1723
  });
1527
1724
  return result ? index : null;
1528
1725
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -1556,6 +1753,7 @@ export class InngestExecutionEngine extends DefaultExecutionEngine {
1556
1753
  emitter,
1557
1754
  abortController,
1558
1755
  runtimeContext,
1756
+ writableStream,
1559
1757
  }),
1560
1758
  ),
1561
1759
  );
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": ["./tsconfig.json", "../../tsconfig.build.json"],
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "rootDir": "./src"
6
+ },
7
+ "include": ["src/**/*"],
8
+ "exclude": ["node_modules", "**/*.test.ts", "src/**/*.mock.ts"]
9
+ }
package/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "extends": "../../tsconfig.node.json",
3
- "include": ["src/**/*"],
3
+ "include": ["src/**/*", "tsup.config.ts"],
4
4
  "exclude": ["node_modules", "**/*.test.ts"]
5
5
  }
package/tsup.config.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { generateTypes } from '@internal/types-builder';
2
+ import { defineConfig } from 'tsup';
3
+
4
+ export default defineConfig({
5
+ entry: ['src/index.ts'],
6
+ format: ['esm', 'cjs'],
7
+ clean: true,
8
+ dts: false,
9
+ splitting: true,
10
+ treeshake: {
11
+ preset: 'smallest',
12
+ },
13
+ sourcemap: true,
14
+ onSuccess: async () => {
15
+ await generateTypes(process.cwd());
16
+ },
17
+ });
@@ -1,265 +0,0 @@
1
- import type { Agent } from '@mastra/core';
2
- import type { BaseContext } from 'inngest';
3
- import { ClientOptions } from 'inngest';
4
- import { DefaultExecutionEngine } from '@mastra/core/workflows';
5
- import type { Emitter } from '@mastra/core/workflows';
6
- import type { ExecuteFunction } from '@mastra/core/workflows';
7
- import type { ExecutionContext } from '@mastra/core/workflows';
8
- import type { ExecutionEngine } from '@mastra/core/workflows';
9
- import type { ExecutionGraph } from '@mastra/core/workflows';
10
- import { Handler } from 'inngest';
11
- import type { Inngest } from 'inngest';
12
- import { InngestFunction } from 'inngest';
13
- import { InngestMiddleware } from 'inngest';
14
- import type { Mastra } from '@mastra/core';
15
- import type { ReadableStream as ReadableStream_2 } from 'node:stream/web';
16
- import { Run } from '@mastra/core/workflows';
17
- import { RuntimeContext } from '@mastra/core/di';
18
- import type { SerializedStepFlowEntry } from '@mastra/core/workflows';
19
- import { serve as serve_2 } from 'inngest/hono';
20
- import type { Span } from '@opentelemetry/api';
21
- import type { Step } from '@mastra/core/workflows';
22
- import type { StepFlowEntry } from '@mastra/core/workflows';
23
- import type { StepResult } from '@mastra/core/workflows';
24
- import type { StreamEvent } from '@mastra/core/workflows';
25
- import { Tool } from '@mastra/core/tools';
26
- import type { ToolExecutionContext } from '@mastra/core';
27
- import type { WatchEvent } from '@mastra/core/workflows';
28
- import { Workflow } from '@mastra/core/workflows';
29
- import type { WorkflowConfig } from '@mastra/core/workflows';
30
- import type { WorkflowResult } from '@mastra/core/workflows';
31
- import type { WorkflowRun } from '@mastra/core';
32
- import type { WorkflowRuns } from '@mastra/core';
33
- import { z } from 'zod';
34
-
35
- export declare function createStep<TStepId extends string, TStepInput extends z.ZodType<any>, TStepOutput extends z.ZodType<any>, TResumeSchema extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>>(params: {
36
- id: TStepId;
37
- description?: string;
38
- inputSchema: TStepInput;
39
- outputSchema: TStepOutput;
40
- resumeSchema?: TResumeSchema;
41
- suspendSchema?: TSuspendSchema;
42
- execute: ExecuteFunction<z.infer<TStepInput>, z.infer<TStepOutput>, z.infer<TResumeSchema>, z.infer<TSuspendSchema>, InngestEngineType>;
43
- }): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema, InngestEngineType>;
44
-
45
- export declare function createStep<TStepId extends string, TStepInput extends z.ZodObject<{
46
- prompt: z.ZodString;
47
- }>, TStepOutput extends z.ZodObject<{
48
- text: z.ZodString;
49
- }>, TResumeSchema extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>>(agent: Agent<TStepId, any, any>): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema, InngestEngineType>;
50
-
51
- export declare function createStep<TSchemaIn extends z.ZodType<any>, TSchemaOut extends z.ZodType<any>, TContext extends ToolExecutionContext<TSchemaIn>>(tool: Tool<TSchemaIn, TSchemaOut, TContext> & {
52
- inputSchema: TSchemaIn;
53
- outputSchema: TSchemaOut;
54
- execute: (context: TContext) => Promise<any>;
55
- }): Step<string, TSchemaIn, TSchemaOut, z.ZodType<any>, z.ZodType<any>, InngestEngineType>;
56
-
57
- export declare function init(inngest: Inngest): {
58
- createWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TOutput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TSteps extends Step<string, any, any, any, any, InngestEngineType>[] = Step<string, any, any, any, any, InngestEngineType>[]>(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>): InngestWorkflow<InngestEngineType, TSteps, TWorkflowId, TInput, TOutput, TInput>;
59
- createStep: typeof createStep;
60
- cloneStep<TStepId extends string>(step: Step<string, any, any, any, any, InngestEngineType>, opts: {
61
- id: TStepId;
62
- }): Step<TStepId, any, any, any, any, InngestEngineType>;
63
- cloneWorkflow<TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TOutput extends z.ZodType<any> = z.ZodType<any, z.ZodTypeDef, any>, TSteps extends Step<string, any, any, any, any, InngestEngineType>[] = Step<string, any, any, any, any, InngestEngineType>[], TPrevSchema extends z.ZodType<any> = TInput>(workflow: Workflow<InngestEngineType, TSteps, string, TInput, TOutput, TPrevSchema>, opts: {
64
- id: TWorkflowId;
65
- }): Workflow<InngestEngineType, TSteps, TWorkflowId, TInput, TOutput, TPrevSchema>;
66
- };
67
-
68
- export declare type InngestEngineType = {
69
- step: any;
70
- };
71
-
72
- export declare class InngestExecutionEngine extends DefaultExecutionEngine {
73
- private inngestStep;
74
- private inngestAttempts;
75
- constructor(mastra: Mastra, inngestStep: BaseContext<Inngest>['step'], inngestAttempts?: number);
76
- execute<TInput, TOutput>(params: {
77
- workflowId: string;
78
- runId: string;
79
- graph: ExecutionGraph;
80
- serializedStepGraph: SerializedStepFlowEntry[];
81
- input?: TInput;
82
- resume?: {
83
- steps: string[];
84
- stepResults: Record<string, StepResult<any, any, any, any>>;
85
- resumePayload: any;
86
- resumePath: number[];
87
- };
88
- emitter: Emitter;
89
- retryConfig?: {
90
- attempts?: number;
91
- delay?: number;
92
- };
93
- runtimeContext: RuntimeContext;
94
- abortController: AbortController;
95
- }): Promise<TOutput>;
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>;
97
- superExecuteStep({ workflowId, runId, step, stepResults, executionContext, resume, prevOutput, emitter, abortController, runtimeContext, }: {
98
- workflowId: string;
99
- runId: string;
100
- step: Step<string, any, any>;
101
- stepResults: Record<string, StepResult<any, any, any, any>>;
102
- executionContext: ExecutionContext;
103
- resume?: {
104
- steps: string[];
105
- resumePayload: any;
106
- };
107
- prevOutput: any;
108
- emitter: Emitter;
109
- abortController: AbortController;
110
- runtimeContext: RuntimeContext;
111
- }): Promise<StepResult<any, any, any, any>>;
112
- executeSleep({ id, duration }: {
113
- id: string;
114
- duration: number;
115
- }): Promise<void>;
116
- executeWaitForEvent({ event, timeout }: {
117
- event: string;
118
- timeout?: number;
119
- }): Promise<any>;
120
- executeStep({ step, stepResults, executionContext, resume, prevOutput, emitter, abortController, runtimeContext, }: {
121
- step: Step<string, any, any>;
122
- stepResults: Record<string, StepResult<any, any, any, any>>;
123
- executionContext: ExecutionContext;
124
- resume?: {
125
- steps: string[];
126
- resumePayload: any;
127
- runId?: string;
128
- };
129
- prevOutput: any;
130
- emitter: Emitter;
131
- abortController: AbortController;
132
- runtimeContext: RuntimeContext;
133
- }): Promise<StepResult<any, any, any, any>>;
134
- persistStepUpdate({ workflowId, runId, stepResults, executionContext, serializedStepGraph, workflowStatus, result, error, }: {
135
- workflowId: string;
136
- runId: string;
137
- stepResults: Record<string, StepResult<any, any, any, any>>;
138
- serializedStepGraph: SerializedStepFlowEntry[];
139
- executionContext: ExecutionContext;
140
- workflowStatus: 'success' | 'failed' | 'suspended' | 'running';
141
- result?: Record<string, any>;
142
- error?: string | Error;
143
- }): Promise<void>;
144
- executeConditional({ workflowId, runId, entry, prevOutput, prevStep, stepResults, serializedStepGraph, resume, executionContext, emitter, abortController, runtimeContext, }: {
145
- workflowId: string;
146
- runId: string;
147
- entry: {
148
- type: 'conditional';
149
- steps: StepFlowEntry[];
150
- conditions: ExecuteFunction<any, any, any, any, InngestEngineType>[];
151
- };
152
- prevStep: StepFlowEntry;
153
- serializedStepGraph: SerializedStepFlowEntry[];
154
- prevOutput: any;
155
- stepResults: Record<string, StepResult<any, any, any, any>>;
156
- resume?: {
157
- steps: string[];
158
- stepResults: Record<string, StepResult<any, any, any, any>>;
159
- resumePayload: any;
160
- resumePath: number[];
161
- };
162
- executionContext: ExecutionContext;
163
- emitter: Emitter;
164
- abortController: AbortController;
165
- runtimeContext: RuntimeContext;
166
- }): Promise<StepResult<any, any, any, any>>;
167
- }
168
-
169
- export declare class InngestRun<TEngineType = InngestEngineType, TSteps extends Step<string, any, any>[] = Step<string, any, any>[], TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>> extends Run<TEngineType, TSteps, TInput, TOutput> {
170
- #private;
171
- private inngest;
172
- serializedStepGraph: SerializedStepFlowEntry[];
173
- constructor(params: {
174
- workflowId: string;
175
- runId: string;
176
- executionEngine: ExecutionEngine;
177
- executionGraph: ExecutionGraph;
178
- serializedStepGraph: SerializedStepFlowEntry[];
179
- mastra?: Mastra;
180
- retryConfig?: {
181
- attempts?: number;
182
- delay?: number;
183
- };
184
- cleanup?: () => void;
185
- }, inngest: Inngest);
186
- getRuns(eventId: string): Promise<any>;
187
- getRunOutput(eventId: string): Promise<any>;
188
- sendEvent(event: string, data: any): Promise<void>;
189
- cancel(): Promise<void>;
190
- start({ inputData, }: {
191
- inputData?: z.infer<TInput>;
192
- runtimeContext?: RuntimeContext;
193
- }): Promise<WorkflowResult<TOutput, TSteps>>;
194
- resume<TResumeSchema extends z.ZodType<any>>(params: {
195
- resumeData?: z.infer<TResumeSchema>;
196
- step: Step<string, any, any, TResumeSchema, any> | [...Step<string, any, any, any, any>[], Step<string, any, any, TResumeSchema, any>] | string | string[];
197
- runtimeContext?: RuntimeContext;
198
- }): Promise<WorkflowResult<TOutput, TSteps>>;
199
- _resume<TResumeSchema extends z.ZodType<any>>(params: {
200
- resumeData?: z.infer<TResumeSchema>;
201
- step: Step<string, any, any, TResumeSchema, any> | [...Step<string, any, any, any, any>[], Step<string, any, any, TResumeSchema, any>] | string | string[];
202
- runtimeContext?: RuntimeContext;
203
- }): Promise<WorkflowResult<TOutput, TSteps>>;
204
- watch(cb: (event: WatchEvent) => void, type?: 'watch' | 'watch-v2'): () => void;
205
- stream({ inputData, runtimeContext }?: {
206
- inputData?: z.infer<TInput>;
207
- runtimeContext?: RuntimeContext;
208
- }): {
209
- stream: ReadableStream_2<StreamEvent>;
210
- getWorkflowState: () => Promise<WorkflowResult<TOutput, TSteps>>;
211
- };
212
- }
213
-
214
- export declare class InngestWorkflow<TEngineType = InngestEngineType, TSteps extends Step<string, any, any>[] = Step<string, any, any>[], TWorkflowId extends string = string, TInput extends z.ZodType<any> = z.ZodType<any>, TOutput extends z.ZodType<any> = z.ZodType<any>, TPrevSchema extends z.ZodType<any> = TInput> extends Workflow<TEngineType, TSteps, TWorkflowId, TInput, TOutput, TPrevSchema> {
215
- #private;
216
- inngest: Inngest;
217
- private function;
218
- constructor(params: WorkflowConfig<TWorkflowId, TInput, TOutput, TSteps>, inngest: Inngest);
219
- getWorkflowRuns(args?: {
220
- fromDate?: Date;
221
- toDate?: Date;
222
- limit?: number;
223
- offset?: number;
224
- resourceId?: string;
225
- }): Promise<WorkflowRuns>;
226
- getWorkflowRunById(runId: string): Promise<WorkflowRun | null>;
227
- getWorkflowRunExecutionResult(runId: string): Promise<WatchEvent['payload']['workflowState'] | null>;
228
- __registerMastra(mastra: Mastra): void;
229
- createRun(options?: {
230
- runId?: string;
231
- }): Run<TEngineType, TSteps, TInput, TOutput>;
232
- createRunAsync(options?: {
233
- runId?: string;
234
- }): Promise<Run<TEngineType, TSteps, TInput, TOutput>>;
235
- getFunction(): InngestFunction<Omit<InngestFunction.Options<Inngest<ClientOptions>, InngestMiddleware.Stack, InngestFunction.Trigger<string>[] | [{
236
- cron: string;
237
- } & Partial<Record<"event" | "if", never>>] | [{
238
- event: string;
239
- if?: string;
240
- } & Partial<Record<"cron", never>>], Handler.Any>, "triggers">, Handler.Any, Handler.Any, Inngest<ClientOptions>, InngestMiddleware.Stack, InngestFunction.Trigger<string>[] | [{
241
- cron: string;
242
- } & Partial<Record<"event" | "if", never>>] | [{
243
- event: string;
244
- if?: string;
245
- } & Partial<Record<"cron", never>>]>;
246
- getNestedFunctions(steps: StepFlowEntry[]): ReturnType<Inngest['createFunction']>[];
247
- getFunctions(): InngestFunction<Omit<InngestFunction.Options<Inngest<ClientOptions>, InngestMiddleware.Stack, InngestFunction.Trigger<string>[] | [{
248
- cron: string;
249
- } & Partial<Record<"event" | "if", never>>] | [{
250
- event: string;
251
- if?: string;
252
- } & Partial<Record<"cron", never>>], Handler.Any>, "triggers">, Handler.Any, Handler.Any, Inngest<ClientOptions>, InngestMiddleware.Stack, InngestFunction.Trigger<string>[] | [{
253
- cron: string;
254
- } & Partial<Record<"event" | "if", never>>] | [{
255
- event: string;
256
- if?: string;
257
- } & Partial<Record<"cron", never>>]>[];
258
- }
259
-
260
- export declare function serve({ mastra, inngest }: {
261
- mastra: Mastra;
262
- inngest: Inngest;
263
- }): ReturnType<typeof serve_2>;
264
-
265
- export { }