@mastra/inngest 0.14.1-alpha.0 → 0.14.2-alpha.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/CHANGELOG.md +27 -0
- package/dist/index.cjs +40 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -20
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @mastra/inngest
|
|
2
2
|
|
|
3
|
+
## 0.14.2-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- add register options to serve function ([#8139](https://github.com/mastra-ai/mastra/pull/8139))
|
|
8
|
+
|
|
9
|
+
- Add input data validation to workflow step execution ([#7779](https://github.com/mastra-ai/mastra/pull/7779))
|
|
10
|
+
Add resume data validation to resume workflow method
|
|
11
|
+
Add input data validation to start workflow method
|
|
12
|
+
Use default value from inputSchema/resumeSchema
|
|
13
|
+
|
|
14
|
+
- When step is created from agent or tool, add the description and component key to show that ([#8151](https://github.com/mastra-ai/mastra/pull/8151))
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`dc099b4`](https://github.com/mastra-ai/mastra/commit/dc099b40fb31147ba3f362f98d991892033c4c67), [`b342a68`](https://github.com/mastra-ai/mastra/commit/b342a68e1399cf1ece9ba11bda112db89d21118c), [`303a9c0`](https://github.com/mastra-ai/mastra/commit/303a9c0d7dd58795915979f06a0512359e4532fb), [`370f8a6`](https://github.com/mastra-ai/mastra/commit/370f8a6480faec70fef18d72e5f7538f27004301), [`623ffaf`](https://github.com/mastra-ai/mastra/commit/623ffaf2d969e11e99a0224633cf7b5a0815c857), [`9fc1613`](https://github.com/mastra-ai/mastra/commit/9fc16136400186648880fd990119ac15f7c02ee4), [`61f62aa`](https://github.com/mastra-ai/mastra/commit/61f62aa31bc88fe4ddf8da6240dbcfbeb07358bd), [`3e292ba`](https://github.com/mastra-ai/mastra/commit/3e292ba00837886d5d68a34cbc0d9b703c991883), [`418c136`](https://github.com/mastra-ai/mastra/commit/418c1366843d88e491bca3f87763899ce855ca29), [`c84b7d0`](https://github.com/mastra-ai/mastra/commit/c84b7d093c4657772140cbfd2b15ef72f3315ed5)]:
|
|
17
|
+
- @mastra/core@0.18.1-alpha.0
|
|
18
|
+
|
|
19
|
+
## 0.14.1
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Fixes for `getStepResult` in workflow steps ([#8065](https://github.com/mastra-ai/mastra/pull/8065))
|
|
24
|
+
|
|
25
|
+
- Update Peerdeps for packages based on core minor bump ([#8025](https://github.com/mastra-ai/mastra/pull/8025))
|
|
26
|
+
|
|
27
|
+
- Updated dependencies [[`cf34503`](https://github.com/mastra-ai/mastra/commit/cf345031de4e157f29087946449e60b965e9c8a9), [`6b4b1e4`](https://github.com/mastra-ai/mastra/commit/6b4b1e4235428d39e51cbda9832704c0ba70ab32), [`3469fca`](https://github.com/mastra-ai/mastra/commit/3469fca7bb7e5e19369ff9f7044716a5e4b02585), [`a61f23f`](https://github.com/mastra-ai/mastra/commit/a61f23fbbca4b88b763d94f1d784c47895ed72d7), [`4b339b8`](https://github.com/mastra-ai/mastra/commit/4b339b8141c20d6a6d80583c7e8c5c05d8c19492), [`d1dc606`](https://github.com/mastra-ai/mastra/commit/d1dc6067b0557a71190b68d56ee15b48c26d2411), [`c45298a`](https://github.com/mastra-ai/mastra/commit/c45298a0a0791db35cf79f1199d77004da0704cb), [`c4a8204`](https://github.com/mastra-ai/mastra/commit/c4a82046bfd241d6044e234bc5917d5a01fe6b55), [`d3bd4d4`](https://github.com/mastra-ai/mastra/commit/d3bd4d482a685bbb67bfa89be91c90dca3fa71ad), [`c591dfc`](https://github.com/mastra-ai/mastra/commit/c591dfc1e600fae1dedffe239357d250e146378f), [`1920c5c`](https://github.com/mastra-ai/mastra/commit/1920c5c6d666f687785c73021196aa551e579e0d), [`b6a3b65`](https://github.com/mastra-ai/mastra/commit/b6a3b65d830fa0ca7754ad6481661d1f2c878f21), [`af3abb6`](https://github.com/mastra-ai/mastra/commit/af3abb6f7c7585d856e22d27f4e7d2ece2186b9a)]:
|
|
28
|
+
- @mastra/core@0.18.0
|
|
29
|
+
|
|
3
30
|
## 0.14.1-alpha.0
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -14,7 +14,8 @@ var zod = require('zod');
|
|
|
14
14
|
function serve({
|
|
15
15
|
mastra,
|
|
16
16
|
inngest,
|
|
17
|
-
functions: userFunctions = []
|
|
17
|
+
functions: userFunctions = [],
|
|
18
|
+
registerOptions
|
|
18
19
|
}) {
|
|
19
20
|
const wfs = mastra.getWorkflows();
|
|
20
21
|
const workflowFunctions = Array.from(
|
|
@@ -29,6 +30,7 @@ function serve({
|
|
|
29
30
|
)
|
|
30
31
|
);
|
|
31
32
|
return hono.serve({
|
|
33
|
+
...registerOptions,
|
|
32
34
|
client: inngest,
|
|
33
35
|
functions: [...workflowFunctions, ...userFunctions]
|
|
34
36
|
});
|
|
@@ -117,10 +119,11 @@ var InngestRun = class extends workflows.Run {
|
|
|
117
119
|
status: "running"
|
|
118
120
|
}
|
|
119
121
|
});
|
|
122
|
+
const inputDataToUse = await this._validateInput(inputData);
|
|
120
123
|
const eventOutput = await this.inngest.send({
|
|
121
124
|
name: `workflow.${this.workflowId}`,
|
|
122
125
|
data: {
|
|
123
|
-
inputData,
|
|
126
|
+
inputData: inputDataToUse,
|
|
124
127
|
runId: this.runId,
|
|
125
128
|
resourceId: this.resourceId
|
|
126
129
|
}
|
|
@@ -158,17 +161,19 @@ var InngestRun = class extends workflows.Run {
|
|
|
158
161
|
workflowName: this.workflowId,
|
|
159
162
|
runId: this.runId
|
|
160
163
|
});
|
|
164
|
+
const suspendedStep = this.workflowSteps[steps?.[0] ?? ""];
|
|
165
|
+
const resumeDataToUse = await this._validateResumeData(params.resumeData, suspendedStep);
|
|
161
166
|
const eventOutput = await this.inngest.send({
|
|
162
167
|
name: `workflow.${this.workflowId}`,
|
|
163
168
|
data: {
|
|
164
|
-
inputData:
|
|
169
|
+
inputData: resumeDataToUse,
|
|
165
170
|
runId: this.runId,
|
|
166
171
|
workflowId: this.workflowId,
|
|
167
172
|
stepResults: snapshot?.context,
|
|
168
173
|
resume: {
|
|
169
174
|
steps,
|
|
170
175
|
stepResults: snapshot?.context,
|
|
171
|
-
resumePayload:
|
|
176
|
+
resumePayload: resumeDataToUse,
|
|
172
177
|
// @ts-ignore
|
|
173
178
|
resumePath: snapshot?.suspendedPaths?.[steps?.[0]]
|
|
174
179
|
}
|
|
@@ -315,7 +320,8 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
|
|
|
315
320
|
serializedStepGraph: this.serializedStepGraph,
|
|
316
321
|
mastra: this.#mastra,
|
|
317
322
|
retryConfig: this.retryConfig,
|
|
318
|
-
cleanup: () => this.runs.delete(runIdToUse)
|
|
323
|
+
cleanup: () => this.runs.delete(runIdToUse),
|
|
324
|
+
workflowSteps: this.steps
|
|
319
325
|
},
|
|
320
326
|
this.inngest
|
|
321
327
|
);
|
|
@@ -436,6 +442,7 @@ function createStep(params) {
|
|
|
436
442
|
if (isAgent(params)) {
|
|
437
443
|
return {
|
|
438
444
|
id: params.name,
|
|
445
|
+
description: params.getDescription(),
|
|
439
446
|
// @ts-ignore
|
|
440
447
|
inputSchema: zod.z.object({
|
|
441
448
|
prompt: zod.z.string()
|
|
@@ -485,7 +492,8 @@ function createStep(params) {
|
|
|
485
492
|
return {
|
|
486
493
|
text: await streamPromise.promise
|
|
487
494
|
};
|
|
488
|
-
}
|
|
495
|
+
},
|
|
496
|
+
component: params.component
|
|
489
497
|
};
|
|
490
498
|
}
|
|
491
499
|
if (isTool(params)) {
|
|
@@ -496,16 +504,20 @@ function createStep(params) {
|
|
|
496
504
|
// TODO: tool probably should have strong id type
|
|
497
505
|
// @ts-ignore
|
|
498
506
|
id: params.id,
|
|
507
|
+
description: params.description,
|
|
499
508
|
inputSchema: params.inputSchema,
|
|
500
509
|
outputSchema: params.outputSchema,
|
|
501
|
-
execute: async ({ inputData, mastra, runtimeContext, tracingContext }) => {
|
|
510
|
+
execute: async ({ inputData, mastra, runtimeContext, tracingContext, suspend, resumeData }) => {
|
|
502
511
|
return params.execute({
|
|
503
512
|
context: inputData,
|
|
504
513
|
mastra: aiTracing.wrapMastra(mastra, tracingContext),
|
|
505
514
|
runtimeContext,
|
|
506
|
-
tracingContext
|
|
515
|
+
tracingContext,
|
|
516
|
+
suspend,
|
|
517
|
+
resumeData
|
|
507
518
|
});
|
|
508
|
-
}
|
|
519
|
+
},
|
|
520
|
+
component: "TOOL"
|
|
509
521
|
};
|
|
510
522
|
}
|
|
511
523
|
return {
|
|
@@ -530,7 +542,8 @@ function init(inngest) {
|
|
|
530
542
|
description: step.description,
|
|
531
543
|
inputSchema: step.inputSchema,
|
|
532
544
|
outputSchema: step.outputSchema,
|
|
533
|
-
execute: step.execute
|
|
545
|
+
execute: step.execute,
|
|
546
|
+
component: step.component
|
|
534
547
|
};
|
|
535
548
|
},
|
|
536
549
|
cloneWorkflow(workflow, opts) {
|
|
@@ -820,6 +833,11 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
820
833
|
},
|
|
821
834
|
tracingPolicy: this.options?.tracingPolicy
|
|
822
835
|
});
|
|
836
|
+
const { inputData, validationError } = await workflows.validateStepInput({
|
|
837
|
+
prevOutput,
|
|
838
|
+
step,
|
|
839
|
+
validateInputs: this.options?.validateInputs ?? false
|
|
840
|
+
});
|
|
823
841
|
const startedAt = await this.inngestStep.run(
|
|
824
842
|
`workflow.${executionContext.workflowId}.run.${executionContext.runId}.step.${step.id}.running_ev`,
|
|
825
843
|
async () => {
|
|
@@ -850,7 +868,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
850
868
|
payload: {
|
|
851
869
|
id: step.id,
|
|
852
870
|
status: "running",
|
|
853
|
-
payload:
|
|
871
|
+
payload: inputData,
|
|
854
872
|
startedAt: startedAt2
|
|
855
873
|
}
|
|
856
874
|
});
|
|
@@ -870,7 +888,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
870
888
|
const invokeResp = await this.inngestStep.invoke(`workflow.${executionContext.workflowId}.step.${step.id}`, {
|
|
871
889
|
function: step.getFunction(),
|
|
872
890
|
data: {
|
|
873
|
-
inputData
|
|
891
|
+
inputData,
|
|
874
892
|
runId,
|
|
875
893
|
resume: {
|
|
876
894
|
runId,
|
|
@@ -888,7 +906,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
888
906
|
const invokeResp = await this.inngestStep.invoke(`workflow.${executionContext.workflowId}.step.${step.id}`, {
|
|
889
907
|
function: step.getFunction(),
|
|
890
908
|
data: {
|
|
891
|
-
inputData
|
|
909
|
+
inputData
|
|
892
910
|
}
|
|
893
911
|
});
|
|
894
912
|
result = invokeResp.result;
|
|
@@ -1033,12 +1051,15 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1033
1051
|
let suspended;
|
|
1034
1052
|
let bailed;
|
|
1035
1053
|
try {
|
|
1054
|
+
if (validationError) {
|
|
1055
|
+
throw validationError;
|
|
1056
|
+
}
|
|
1036
1057
|
const result = await step.execute({
|
|
1037
1058
|
runId: executionContext.runId,
|
|
1038
1059
|
mastra: this.mastra,
|
|
1039
1060
|
runtimeContext,
|
|
1040
1061
|
writableStream,
|
|
1041
|
-
inputData
|
|
1062
|
+
inputData,
|
|
1042
1063
|
resumeData: resume?.steps[0] === step.id ? resume?.resumePayload : void 0,
|
|
1043
1064
|
tracingContext: {
|
|
1044
1065
|
currentSpan: stepAISpan
|
|
@@ -1070,14 +1091,14 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1070
1091
|
output: result,
|
|
1071
1092
|
startedAt,
|
|
1072
1093
|
endedAt,
|
|
1073
|
-
payload:
|
|
1094
|
+
payload: inputData,
|
|
1074
1095
|
resumedAt: resume?.steps[0] === step.id ? startedAt : void 0,
|
|
1075
1096
|
resumePayload: resume?.steps[0] === step.id ? resume?.resumePayload : void 0
|
|
1076
1097
|
};
|
|
1077
1098
|
} catch (e) {
|
|
1078
1099
|
execResults = {
|
|
1079
1100
|
status: "failed",
|
|
1080
|
-
payload:
|
|
1101
|
+
payload: inputData,
|
|
1081
1102
|
error: e instanceof Error ? e.message : String(e),
|
|
1082
1103
|
endedAt: Date.now(),
|
|
1083
1104
|
startedAt,
|
|
@@ -1089,14 +1110,14 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1089
1110
|
execResults = {
|
|
1090
1111
|
status: "suspended",
|
|
1091
1112
|
suspendedPayload: suspended.payload,
|
|
1092
|
-
payload:
|
|
1113
|
+
payload: inputData,
|
|
1093
1114
|
suspendedAt: Date.now(),
|
|
1094
1115
|
startedAt,
|
|
1095
1116
|
resumedAt: resume?.steps[0] === step.id ? startedAt : void 0,
|
|
1096
1117
|
resumePayload: resume?.steps[0] === step.id ? resume?.resumePayload : void 0
|
|
1097
1118
|
};
|
|
1098
1119
|
} else if (bailed) {
|
|
1099
|
-
execResults = { status: "bailed", output: bailed.payload, payload:
|
|
1120
|
+
execResults = { status: "bailed", output: bailed.payload, payload: inputData, endedAt: Date.now(), startedAt };
|
|
1100
1121
|
}
|
|
1101
1122
|
if (execResults.status === "failed") {
|
|
1102
1123
|
if (executionContext.retryConfig.attempts > 0 && this.inngestAttempts < executionContext.retryConfig.attempts) {
|
|
@@ -1154,7 +1175,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1154
1175
|
await this.runScorers({
|
|
1155
1176
|
scorers: step.scorers,
|
|
1156
1177
|
runId: executionContext.runId,
|
|
1157
|
-
input:
|
|
1178
|
+
input: inputData,
|
|
1158
1179
|
output: stepRes.result,
|
|
1159
1180
|
workflowId: executionContext.workflowId,
|
|
1160
1181
|
stepId: step.id,
|