@mastra/inngest 0.12.3-alpha.3 → 0.12.3-alpha.4
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 +9 -0
- package/dist/index.cjs +49 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +49 -38
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @mastra/inngest
|
|
2
2
|
|
|
3
|
+
## 0.12.3-alpha.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#7355](https://github.com/mastra-ai/mastra/pull/7355) [`7f3b8da`](https://github.com/mastra-ai/mastra/commit/7f3b8da6dd21c35d3672e44b4f5dd3502b8f8f92) Thanks [@rase-](https://github.com/rase-)! - Automatically pipe writer to workflows as a tool.
|
|
8
|
+
Also changed start, finish, step-output events to be workflow-start, workflow-finish and workflow-step-output
|
|
9
|
+
- Updated dependencies [[`c19bcf7`](https://github.com/mastra-ai/mastra/commit/c19bcf7b43542b02157b5e17303e519933a153ab), [`b42a961`](https://github.com/mastra-ai/mastra/commit/b42a961a5aefd19d6e938a7705fc0ecc90e8f756), [`45e4d39`](https://github.com/mastra-ai/mastra/commit/45e4d391a2a09fc70c48e4d60f505586ada1ba0e), [`0302f50`](https://github.com/mastra-ai/mastra/commit/0302f50861a53c66ff28801fc371b37c5f97e41e), [`74db265`](https://github.com/mastra-ai/mastra/commit/74db265b96aa01a72ffd91dcae0bc3b346cca0f2), [`7f3b8da`](https://github.com/mastra-ai/mastra/commit/7f3b8da6dd21c35d3672e44b4f5dd3502b8f8f92), [`905352b`](https://github.com/mastra-ai/mastra/commit/905352bcda134552400eb252bca1cb05a7975c14), [`f2cda47`](https://github.com/mastra-ai/mastra/commit/f2cda47ae911038c5d5489f54c36517d6f15bdcc), [`cfd377a`](https://github.com/mastra-ai/mastra/commit/cfd377a3a33a9c88b644f6540feed9cd9832db47)]:
|
|
10
|
+
- @mastra/core@0.15.3-alpha.6
|
|
11
|
+
|
|
3
12
|
## 0.12.3-alpha.3
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -204,10 +204,38 @@ var InngestRun = class extends workflows.Run {
|
|
|
204
204
|
}
|
|
205
205
|
stream({ inputData, runtimeContext } = {}) {
|
|
206
206
|
const { readable, writable } = new TransformStream();
|
|
207
|
+
let currentToolData = void 0;
|
|
207
208
|
const writer = writable.getWriter();
|
|
208
209
|
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
|
+
}
|
|
209
221
|
try {
|
|
210
|
-
|
|
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
|
+
const e = {
|
|
235
|
+
...event,
|
|
236
|
+
type: event.type.replace("workflow-", "")
|
|
237
|
+
};
|
|
238
|
+
await writer.write(e);
|
|
211
239
|
} catch {
|
|
212
240
|
}
|
|
213
241
|
}, "watch-v2");
|
|
@@ -453,8 +481,8 @@ function createStep(params) {
|
|
|
453
481
|
args: inputData
|
|
454
482
|
};
|
|
455
483
|
await emitter.emit("watch-v2", {
|
|
456
|
-
type: "
|
|
457
|
-
|
|
484
|
+
type: "workflow-agent-call-start",
|
|
485
|
+
payload: toolData
|
|
458
486
|
});
|
|
459
487
|
const { fullStream } = await params.stream(inputData.prompt, {
|
|
460
488
|
// resourceId: inputData.resourceId,
|
|
@@ -470,29 +498,12 @@ function createStep(params) {
|
|
|
470
498
|
return abort();
|
|
471
499
|
}
|
|
472
500
|
for await (const chunk of fullStream) {
|
|
473
|
-
|
|
474
|
-
case "text-delta":
|
|
475
|
-
await emitter.emit("watch-v2", {
|
|
476
|
-
type: "tool-call-delta",
|
|
477
|
-
...toolData,
|
|
478
|
-
argsTextDelta: chunk.textDelta
|
|
479
|
-
});
|
|
480
|
-
break;
|
|
481
|
-
case "step-start":
|
|
482
|
-
case "step-finish":
|
|
483
|
-
case "finish":
|
|
484
|
-
break;
|
|
485
|
-
case "tool-call":
|
|
486
|
-
case "tool-result":
|
|
487
|
-
case "tool-call-streaming-start":
|
|
488
|
-
case "tool-call-delta":
|
|
489
|
-
case "source":
|
|
490
|
-
case "file":
|
|
491
|
-
default:
|
|
492
|
-
await emitter.emit("watch-v2", chunk);
|
|
493
|
-
break;
|
|
494
|
-
}
|
|
501
|
+
await emitter.emit("watch-v2", chunk);
|
|
495
502
|
}
|
|
503
|
+
await emitter.emit("watch-v2", {
|
|
504
|
+
type: "workflow-agent-call-finish",
|
|
505
|
+
payload: toolData
|
|
506
|
+
});
|
|
496
507
|
return {
|
|
497
508
|
text: await streamPromise.promise
|
|
498
509
|
};
|
|
@@ -568,12 +579,12 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
568
579
|
}
|
|
569
580
|
async execute(params) {
|
|
570
581
|
await params.emitter.emit("watch-v2", {
|
|
571
|
-
type: "start",
|
|
582
|
+
type: "workflow-start",
|
|
572
583
|
payload: { runId: params.runId }
|
|
573
584
|
});
|
|
574
585
|
const result = await super.execute(params);
|
|
575
586
|
await params.emitter.emit("watch-v2", {
|
|
576
|
-
type: "finish",
|
|
587
|
+
type: "workflow-finish",
|
|
577
588
|
payload: { runId: params.runId }
|
|
578
589
|
});
|
|
579
590
|
return result;
|
|
@@ -696,7 +707,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
696
707
|
abortSignal: abortController?.signal,
|
|
697
708
|
writer: new tools.ToolStream(
|
|
698
709
|
{
|
|
699
|
-
prefix: "step",
|
|
710
|
+
prefix: "workflow-step",
|
|
700
711
|
callId: stepCallId,
|
|
701
712
|
name: "sleep",
|
|
702
713
|
runId
|
|
@@ -778,7 +789,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
778
789
|
abortSignal: abortController?.signal,
|
|
779
790
|
writer: new tools.ToolStream(
|
|
780
791
|
{
|
|
781
|
-
prefix: "step",
|
|
792
|
+
prefix: "workflow-step",
|
|
782
793
|
callId: stepCallId,
|
|
783
794
|
name: "sleep",
|
|
784
795
|
runId
|
|
@@ -863,7 +874,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
863
874
|
eventTimestamp: Date.now()
|
|
864
875
|
});
|
|
865
876
|
await emitter.emit("watch-v2", {
|
|
866
|
-
type: "step-start",
|
|
877
|
+
type: "workflow-step-start",
|
|
867
878
|
payload: {
|
|
868
879
|
id: step.id,
|
|
869
880
|
status: "running",
|
|
@@ -933,7 +944,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
933
944
|
eventTimestamp: Date.now()
|
|
934
945
|
});
|
|
935
946
|
await emitter.emit("watch-v2", {
|
|
936
|
-
type: "step-result",
|
|
947
|
+
type: "workflow-step-result",
|
|
937
948
|
payload: {
|
|
938
949
|
id: step.id,
|
|
939
950
|
status: "failed",
|
|
@@ -968,7 +979,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
968
979
|
eventTimestamp: Date.now()
|
|
969
980
|
});
|
|
970
981
|
await emitter.emit("watch-v2", {
|
|
971
|
-
type: "step-suspended",
|
|
982
|
+
type: "workflow-step-suspended",
|
|
972
983
|
payload: {
|
|
973
984
|
id: step.id,
|
|
974
985
|
status: "suspended"
|
|
@@ -1025,7 +1036,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1025
1036
|
eventTimestamp: Date.now()
|
|
1026
1037
|
});
|
|
1027
1038
|
await emitter.emit("watch-v2", {
|
|
1028
|
-
type: "step-result",
|
|
1039
|
+
type: "workflow-step-result",
|
|
1029
1040
|
payload: {
|
|
1030
1041
|
id: step.id,
|
|
1031
1042
|
status: "success",
|
|
@@ -1033,7 +1044,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1033
1044
|
}
|
|
1034
1045
|
});
|
|
1035
1046
|
await emitter.emit("watch-v2", {
|
|
1036
|
-
type: "step-finish",
|
|
1047
|
+
type: "workflow-step-finish",
|
|
1037
1048
|
payload: {
|
|
1038
1049
|
id: step.id,
|
|
1039
1050
|
metadata: {}
|
|
@@ -1146,7 +1157,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1146
1157
|
});
|
|
1147
1158
|
if (execResults.status === "suspended") {
|
|
1148
1159
|
await emitter.emit("watch-v2", {
|
|
1149
|
-
type: "step-suspended",
|
|
1160
|
+
type: "workflow-step-suspended",
|
|
1150
1161
|
payload: {
|
|
1151
1162
|
id: step.id,
|
|
1152
1163
|
...execResults
|
|
@@ -1154,14 +1165,14 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1154
1165
|
});
|
|
1155
1166
|
} else {
|
|
1156
1167
|
await emitter.emit("watch-v2", {
|
|
1157
|
-
type: "step-result",
|
|
1168
|
+
type: "workflow-step-result",
|
|
1158
1169
|
payload: {
|
|
1159
1170
|
id: step.id,
|
|
1160
1171
|
...execResults
|
|
1161
1172
|
}
|
|
1162
1173
|
});
|
|
1163
1174
|
await emitter.emit("watch-v2", {
|
|
1164
|
-
type: "step-finish",
|
|
1175
|
+
type: "workflow-step-finish",
|
|
1165
1176
|
payload: {
|
|
1166
1177
|
id: step.id,
|
|
1167
1178
|
metadata: {}
|
|
@@ -1300,7 +1311,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1300
1311
|
abortSignal: abortController.signal,
|
|
1301
1312
|
writer: new tools.ToolStream(
|
|
1302
1313
|
{
|
|
1303
|
-
prefix: "step",
|
|
1314
|
+
prefix: "workflow-step",
|
|
1304
1315
|
callId: crypto.randomUUID(),
|
|
1305
1316
|
name: "conditional",
|
|
1306
1317
|
runId
|