@mastra/inngest 1.0.0-beta.4 → 1.0.0-beta.6
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 +68 -0
- package/dist/execution-engine.d.ts.map +1 -1
- package/dist/index.cjs +36 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -10
- package/dist/index.js.map +1 -1
- package/dist/workflow.d.ts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,73 @@
|
|
|
1
1
|
# @mastra/inngest
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Support new Workflow tripwire run status. Tripwires that are thrown from within a workflow will now bubble up and return a graceful state with information about tripwires. ([#10947](https://github.com/mastra-ai/mastra/pull/10947))
|
|
8
|
+
|
|
9
|
+
When a workflow contains an agent step that triggers a tripwire, the workflow returns with `status: 'tripwire'` and includes tripwire details:
|
|
10
|
+
|
|
11
|
+
```typescript showLineNumbers copy
|
|
12
|
+
const run = await workflow.createRun();
|
|
13
|
+
const result = await run.start({ inputData: { message: 'Hello' } });
|
|
14
|
+
|
|
15
|
+
if (result.status === 'tripwire') {
|
|
16
|
+
console.log('Workflow terminated by tripwire:', result.tripwire?.reason);
|
|
17
|
+
console.log('Processor ID:', result.tripwire?.processorId);
|
|
18
|
+
console.log('Retry requested:', result.tripwire?.retry);
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Adds new UI state for tripwire in agent chat and workflow UI.
|
|
23
|
+
|
|
24
|
+
This is distinct from `status: 'failed'` which indicates an unexpected error. A tripwire status means a processor intentionally stopped execution (e.g., for content moderation).
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [[`38380b6`](https://github.com/mastra-ai/mastra/commit/38380b60fca905824bdf6b43df307a58efb1aa15), [`798d0c7`](https://github.com/mastra-ai/mastra/commit/798d0c740232653b1d754870e6b43a55c364ffe2), [`ffe84d5`](https://github.com/mastra-ai/mastra/commit/ffe84d54f3b0f85167fe977efd027dba027eb998), [`2c212e7`](https://github.com/mastra-ai/mastra/commit/2c212e704c90e2db83d4109e62c03f0f6ebd2667), [`4ca4306`](https://github.com/mastra-ai/mastra/commit/4ca430614daa5fa04730205a302a43bf4accfe9f), [`3bf6c5f`](https://github.com/mastra-ai/mastra/commit/3bf6c5f104c25226cd84e0c77f9dec15f2cac2db)]:
|
|
27
|
+
- @mastra/core@1.0.0-beta.11
|
|
28
|
+
|
|
29
|
+
## 1.0.0-beta.5
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Internal code refactoring ([#10830](https://github.com/mastra-ai/mastra/pull/10830))
|
|
34
|
+
|
|
35
|
+
- Add support for typed structured output in agent workflow steps ([#11014](https://github.com/mastra-ai/mastra/pull/11014))
|
|
36
|
+
|
|
37
|
+
When wrapping an agent with `createStep()` and providing a `structuredOutput.schema`, the step's `outputSchema` is now correctly inferred from the provided schema instead of defaulting to `{ text: string }`.
|
|
38
|
+
|
|
39
|
+
This enables type-safe chaining of agent steps with structured output to subsequent steps:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
const articleSchema = z.object({
|
|
43
|
+
title: z.string(),
|
|
44
|
+
summary: z.string(),
|
|
45
|
+
tags: z.array(z.string()),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Agent step with structured output - outputSchema is now articleSchema
|
|
49
|
+
const agentStep = createStep(agent, {
|
|
50
|
+
structuredOutput: { schema: articleSchema },
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// Next step can receive the structured output directly
|
|
54
|
+
const processStep = createStep({
|
|
55
|
+
id: 'process',
|
|
56
|
+
inputSchema: articleSchema, // Matches agent's outputSchema
|
|
57
|
+
outputSchema: z.object({ tagCount: z.number() }),
|
|
58
|
+
execute: async ({ inputData }) => ({
|
|
59
|
+
tagCount: inputData.tags.length, // Fully typed!
|
|
60
|
+
}),
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
workflow.then(agentStep).then(processStep).commit();
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
When `structuredOutput` is not provided, the agent step continues to use the default `{ text: string }` output schema.
|
|
67
|
+
|
|
68
|
+
- Updated dependencies [[`edb07e4`](https://github.com/mastra-ai/mastra/commit/edb07e49283e0c28bd094a60e03439bf6ecf0221), [`b7e17d3`](https://github.com/mastra-ai/mastra/commit/b7e17d3f5390bb5a71efc112204413656fcdc18d), [`261473a`](https://github.com/mastra-ai/mastra/commit/261473ac637e633064a22076671e2e02b002214d), [`5d7000f`](https://github.com/mastra-ai/mastra/commit/5d7000f757cd65ea9dc5b05e662fd83dfd44e932), [`4f0331a`](https://github.com/mastra-ai/mastra/commit/4f0331a79bf6eb5ee598a5086e55de4b5a0ada03), [`8a000da`](https://github.com/mastra-ai/mastra/commit/8a000da0c09c679a2312f6b3aa05b2ca78ca7393)]:
|
|
69
|
+
- @mastra/core@1.0.0-beta.10
|
|
70
|
+
|
|
3
71
|
## 1.0.0-beta.4
|
|
4
72
|
|
|
5
73
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-engine.d.ts","sourceRoot":"","sources":["../src/execution-engine.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAmC,MAAM,wBAAwB,CAAC;AACjG,OAAO,KAAK,EACV,gBAAgB,EAChB,IAAI,EACJ,UAAU,EAEV,OAAO,EACP,sBAAsB,EACtB,yBAAyB,EAE1B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGpD,qBAAa,sBAAuB,SAAQ,sBAAsB;IAChE,OAAO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GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;CAgNnD"}
|
package/dist/index.cjs
CHANGED
|
@@ -5,9 +5,9 @@ var workflows = require('@mastra/core/workflows');
|
|
|
5
5
|
var _constants = require('@mastra/core/workflows/_constants');
|
|
6
6
|
var zod = require('zod');
|
|
7
7
|
var crypto = require('crypto');
|
|
8
|
-
var web = require('stream/web');
|
|
9
8
|
var di = require('@mastra/core/di');
|
|
10
9
|
var inngest = require('inngest');
|
|
10
|
+
var web = require('stream/web');
|
|
11
11
|
var realtime = require('@inngest/realtime');
|
|
12
12
|
var stream = require('@mastra/core/stream');
|
|
13
13
|
var hono = require('inngest/hono');
|
|
@@ -267,6 +267,23 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
267
267
|
payload: {}
|
|
268
268
|
}
|
|
269
269
|
};
|
|
270
|
+
} else if (result.status === "tripwire") {
|
|
271
|
+
await emitter.emit("watch", {
|
|
272
|
+
type: "workflow-step-result",
|
|
273
|
+
payload: {
|
|
274
|
+
id: step.id,
|
|
275
|
+
status: "tripwire",
|
|
276
|
+
error: result?.tripwire?.reason,
|
|
277
|
+
payload: prevOutput
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
return {
|
|
281
|
+
executionContext,
|
|
282
|
+
result: {
|
|
283
|
+
status: "tripwire",
|
|
284
|
+
tripwire: result?.tripwire
|
|
285
|
+
}
|
|
286
|
+
};
|
|
270
287
|
}
|
|
271
288
|
await emitter.emit("watch", {
|
|
272
289
|
type: "workflow-step-result",
|
|
@@ -955,12 +972,10 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
|
|
|
955
972
|
abortController: new AbortController(),
|
|
956
973
|
// currentSpan: undefined, // TODO: Pass actual parent Span from workflow execution context
|
|
957
974
|
outputOptions,
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
}
|
|
963
|
-
})
|
|
975
|
+
outputWriter: async (chunk) => {
|
|
976
|
+
void emitter.emit("watch", chunk).catch(() => {
|
|
977
|
+
});
|
|
978
|
+
}
|
|
964
979
|
});
|
|
965
980
|
await step.run(`workflow.${this.id}.finalize`, async () => {
|
|
966
981
|
if (result.status === "failed") {
|
|
@@ -1035,6 +1050,7 @@ function createStep(params, agentOptions) {
|
|
|
1035
1050
|
return params;
|
|
1036
1051
|
}
|
|
1037
1052
|
if (isAgent(params)) {
|
|
1053
|
+
const outputSchema = agentOptions?.structuredOutput?.schema ?? zod.z.object({ text: zod.z.string() });
|
|
1038
1054
|
return {
|
|
1039
1055
|
id: params.name,
|
|
1040
1056
|
description: params.getDescription(),
|
|
@@ -1043,9 +1059,7 @@ function createStep(params, agentOptions) {
|
|
|
1043
1059
|
// resourceId: z.string().optional(),
|
|
1044
1060
|
// threadId: z.string().optional(),
|
|
1045
1061
|
}),
|
|
1046
|
-
outputSchema
|
|
1047
|
-
text: zod.z.string()
|
|
1048
|
-
}),
|
|
1062
|
+
outputSchema,
|
|
1049
1063
|
execute: async ({
|
|
1050
1064
|
inputData,
|
|
1051
1065
|
[_constants.EMITTER_SYMBOL]: emitter,
|
|
@@ -1061,6 +1075,7 @@ function createStep(params, agentOptions) {
|
|
|
1061
1075
|
streamPromise.resolve = resolve;
|
|
1062
1076
|
streamPromise.reject = reject;
|
|
1063
1077
|
});
|
|
1078
|
+
let structuredResult = null;
|
|
1064
1079
|
const toolData = {
|
|
1065
1080
|
name: params.name,
|
|
1066
1081
|
args: inputData
|
|
@@ -1074,6 +1089,10 @@ function createStep(params, agentOptions) {
|
|
|
1074
1089
|
requestContext,
|
|
1075
1090
|
tracingContext,
|
|
1076
1091
|
onFinish: (result) => {
|
|
1092
|
+
const resultWithObject = result;
|
|
1093
|
+
if (agentOptions?.structuredOutput?.schema && resultWithObject.object) {
|
|
1094
|
+
structuredResult = resultWithObject.object;
|
|
1095
|
+
}
|
|
1077
1096
|
streamPromise.resolve(result.text);
|
|
1078
1097
|
void agentOptions?.onFinish?.(result);
|
|
1079
1098
|
},
|
|
@@ -1086,6 +1105,10 @@ function createStep(params, agentOptions) {
|
|
|
1086
1105
|
requestContext,
|
|
1087
1106
|
tracingContext,
|
|
1088
1107
|
onFinish: (result) => {
|
|
1108
|
+
const resultWithObject = result;
|
|
1109
|
+
if (agentOptions?.structuredOutput?.schema && resultWithObject.object) {
|
|
1110
|
+
structuredResult = resultWithObject.object;
|
|
1111
|
+
}
|
|
1089
1112
|
streamPromise.resolve(result.text);
|
|
1090
1113
|
void agentOptions?.onFinish?.(result);
|
|
1091
1114
|
},
|
|
@@ -1119,6 +1142,9 @@ function createStep(params, agentOptions) {
|
|
|
1119
1142
|
if (abortSignal.aborted) {
|
|
1120
1143
|
return abort();
|
|
1121
1144
|
}
|
|
1145
|
+
if (structuredResult !== null) {
|
|
1146
|
+
return structuredResult;
|
|
1147
|
+
}
|
|
1122
1148
|
return {
|
|
1123
1149
|
text: await streamPromise.promise
|
|
1124
1150
|
};
|