@mastra/inngest 0.12.3-alpha.2 → 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 +20 -0
- package/dist/index.cjs +50 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -60
- package/dist/index.js.map +1 -1
- package/package.json +18 -5
- package/.turbo/turbo-build.log +0 -4
- package/docker-compose.yaml +0 -10
- package/eslint.config.js +0 -6
- package/src/index.test.ts +0 -8083
- package/src/index.ts +0 -1957
- package/tsconfig.build.json +0 -9
- package/tsconfig.json +0 -5
- package/tsup.config.ts +0 -17
- package/vitest.config.ts +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
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
|
+
|
|
12
|
+
## 0.12.3-alpha.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#7272](https://github.com/mastra-ai/mastra/pull/7272) [`85ef90b`](https://github.com/mastra-ai/mastra/commit/85ef90bb2cd4ae4df855c7ac175f7d392c55c1bf) Thanks [@taofeeq-deru](https://github.com/taofeeq-deru)! - Return nested workflow steps information in getWorkflowRunExecutionResult
|
|
17
|
+
|
|
18
|
+
- [#7343](https://github.com/mastra-ai/mastra/pull/7343) [`de3cbc6`](https://github.com/mastra-ai/mastra/commit/de3cbc61079211431bd30487982ea3653517278e) Thanks [@LekoArts](https://github.com/LekoArts)! - Update the `package.json` file to include additional fields like `repository`, `homepage` or `files`.
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [[`85ef90b`](https://github.com/mastra-ai/mastra/commit/85ef90bb2cd4ae4df855c7ac175f7d392c55c1bf), [`de3cbc6`](https://github.com/mastra-ai/mastra/commit/de3cbc61079211431bd30487982ea3653517278e)]:
|
|
21
|
+
- @mastra/core@0.15.3-alpha.5
|
|
22
|
+
|
|
3
23
|
## 0.12.3-alpha.2
|
|
4
24
|
|
|
5
25
|
### 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");
|
|
@@ -266,27 +294,6 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
|
|
|
266
294
|
const run = await storage.getWorkflowRunById({ runId, workflowName: this.id });
|
|
267
295
|
return run ?? (this.runs.get(runId) ? { ...this.runs.get(runId), workflowName: this.id } : null);
|
|
268
296
|
}
|
|
269
|
-
async getWorkflowRunExecutionResult(runId) {
|
|
270
|
-
const storage = this.#mastra?.getStorage();
|
|
271
|
-
if (!storage) {
|
|
272
|
-
this.logger.debug("Cannot get workflow run execution result. Mastra storage is not initialized");
|
|
273
|
-
return null;
|
|
274
|
-
}
|
|
275
|
-
const run = await storage.getWorkflowRunById({ runId, workflowName: this.id });
|
|
276
|
-
if (!run?.snapshot) {
|
|
277
|
-
return null;
|
|
278
|
-
}
|
|
279
|
-
if (typeof run.snapshot === "string") {
|
|
280
|
-
return null;
|
|
281
|
-
}
|
|
282
|
-
return {
|
|
283
|
-
status: run.snapshot.status,
|
|
284
|
-
result: run.snapshot.result,
|
|
285
|
-
error: run.snapshot.error,
|
|
286
|
-
payload: run.snapshot.context?.input,
|
|
287
|
-
steps: run.snapshot.context
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
297
|
__registerMastra(mastra) {
|
|
291
298
|
this.#mastra = mastra;
|
|
292
299
|
this.executionEngine.__registerMastra(mastra);
|
|
@@ -339,7 +346,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
|
|
|
339
346
|
this.inngest
|
|
340
347
|
);
|
|
341
348
|
this.runs.set(runIdToUse, run);
|
|
342
|
-
const workflowSnapshotInStorage = await this.getWorkflowRunExecutionResult(runIdToUse);
|
|
349
|
+
const workflowSnapshotInStorage = await this.getWorkflowRunExecutionResult(runIdToUse, false);
|
|
343
350
|
if (!workflowSnapshotInStorage) {
|
|
344
351
|
await this.mastra?.getStorage()?.persistWorkflowSnapshot({
|
|
345
352
|
workflowName: this.id,
|
|
@@ -474,8 +481,8 @@ function createStep(params) {
|
|
|
474
481
|
args: inputData
|
|
475
482
|
};
|
|
476
483
|
await emitter.emit("watch-v2", {
|
|
477
|
-
type: "
|
|
478
|
-
|
|
484
|
+
type: "workflow-agent-call-start",
|
|
485
|
+
payload: toolData
|
|
479
486
|
});
|
|
480
487
|
const { fullStream } = await params.stream(inputData.prompt, {
|
|
481
488
|
// resourceId: inputData.resourceId,
|
|
@@ -491,29 +498,12 @@ function createStep(params) {
|
|
|
491
498
|
return abort();
|
|
492
499
|
}
|
|
493
500
|
for await (const chunk of fullStream) {
|
|
494
|
-
|
|
495
|
-
case "text-delta":
|
|
496
|
-
await emitter.emit("watch-v2", {
|
|
497
|
-
type: "tool-call-delta",
|
|
498
|
-
...toolData,
|
|
499
|
-
argsTextDelta: chunk.textDelta
|
|
500
|
-
});
|
|
501
|
-
break;
|
|
502
|
-
case "step-start":
|
|
503
|
-
case "step-finish":
|
|
504
|
-
case "finish":
|
|
505
|
-
break;
|
|
506
|
-
case "tool-call":
|
|
507
|
-
case "tool-result":
|
|
508
|
-
case "tool-call-streaming-start":
|
|
509
|
-
case "tool-call-delta":
|
|
510
|
-
case "source":
|
|
511
|
-
case "file":
|
|
512
|
-
default:
|
|
513
|
-
await emitter.emit("watch-v2", chunk);
|
|
514
|
-
break;
|
|
515
|
-
}
|
|
501
|
+
await emitter.emit("watch-v2", chunk);
|
|
516
502
|
}
|
|
503
|
+
await emitter.emit("watch-v2", {
|
|
504
|
+
type: "workflow-agent-call-finish",
|
|
505
|
+
payload: toolData
|
|
506
|
+
});
|
|
517
507
|
return {
|
|
518
508
|
text: await streamPromise.promise
|
|
519
509
|
};
|
|
@@ -589,12 +579,12 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
589
579
|
}
|
|
590
580
|
async execute(params) {
|
|
591
581
|
await params.emitter.emit("watch-v2", {
|
|
592
|
-
type: "start",
|
|
582
|
+
type: "workflow-start",
|
|
593
583
|
payload: { runId: params.runId }
|
|
594
584
|
});
|
|
595
585
|
const result = await super.execute(params);
|
|
596
586
|
await params.emitter.emit("watch-v2", {
|
|
597
|
-
type: "finish",
|
|
587
|
+
type: "workflow-finish",
|
|
598
588
|
payload: { runId: params.runId }
|
|
599
589
|
});
|
|
600
590
|
return result;
|
|
@@ -717,7 +707,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
717
707
|
abortSignal: abortController?.signal,
|
|
718
708
|
writer: new tools.ToolStream(
|
|
719
709
|
{
|
|
720
|
-
prefix: "step",
|
|
710
|
+
prefix: "workflow-step",
|
|
721
711
|
callId: stepCallId,
|
|
722
712
|
name: "sleep",
|
|
723
713
|
runId
|
|
@@ -799,7 +789,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
799
789
|
abortSignal: abortController?.signal,
|
|
800
790
|
writer: new tools.ToolStream(
|
|
801
791
|
{
|
|
802
|
-
prefix: "step",
|
|
792
|
+
prefix: "workflow-step",
|
|
803
793
|
callId: stepCallId,
|
|
804
794
|
name: "sleep",
|
|
805
795
|
runId
|
|
@@ -884,7 +874,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
884
874
|
eventTimestamp: Date.now()
|
|
885
875
|
});
|
|
886
876
|
await emitter.emit("watch-v2", {
|
|
887
|
-
type: "step-start",
|
|
877
|
+
type: "workflow-step-start",
|
|
888
878
|
payload: {
|
|
889
879
|
id: step.id,
|
|
890
880
|
status: "running",
|
|
@@ -954,7 +944,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
954
944
|
eventTimestamp: Date.now()
|
|
955
945
|
});
|
|
956
946
|
await emitter.emit("watch-v2", {
|
|
957
|
-
type: "step-result",
|
|
947
|
+
type: "workflow-step-result",
|
|
958
948
|
payload: {
|
|
959
949
|
id: step.id,
|
|
960
950
|
status: "failed",
|
|
@@ -989,7 +979,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
989
979
|
eventTimestamp: Date.now()
|
|
990
980
|
});
|
|
991
981
|
await emitter.emit("watch-v2", {
|
|
992
|
-
type: "step-suspended",
|
|
982
|
+
type: "workflow-step-suspended",
|
|
993
983
|
payload: {
|
|
994
984
|
id: step.id,
|
|
995
985
|
status: "suspended"
|
|
@@ -1046,7 +1036,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1046
1036
|
eventTimestamp: Date.now()
|
|
1047
1037
|
});
|
|
1048
1038
|
await emitter.emit("watch-v2", {
|
|
1049
|
-
type: "step-result",
|
|
1039
|
+
type: "workflow-step-result",
|
|
1050
1040
|
payload: {
|
|
1051
1041
|
id: step.id,
|
|
1052
1042
|
status: "success",
|
|
@@ -1054,7 +1044,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1054
1044
|
}
|
|
1055
1045
|
});
|
|
1056
1046
|
await emitter.emit("watch-v2", {
|
|
1057
|
-
type: "step-finish",
|
|
1047
|
+
type: "workflow-step-finish",
|
|
1058
1048
|
payload: {
|
|
1059
1049
|
id: step.id,
|
|
1060
1050
|
metadata: {}
|
|
@@ -1167,7 +1157,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1167
1157
|
});
|
|
1168
1158
|
if (execResults.status === "suspended") {
|
|
1169
1159
|
await emitter.emit("watch-v2", {
|
|
1170
|
-
type: "step-suspended",
|
|
1160
|
+
type: "workflow-step-suspended",
|
|
1171
1161
|
payload: {
|
|
1172
1162
|
id: step.id,
|
|
1173
1163
|
...execResults
|
|
@@ -1175,14 +1165,14 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1175
1165
|
});
|
|
1176
1166
|
} else {
|
|
1177
1167
|
await emitter.emit("watch-v2", {
|
|
1178
|
-
type: "step-result",
|
|
1168
|
+
type: "workflow-step-result",
|
|
1179
1169
|
payload: {
|
|
1180
1170
|
id: step.id,
|
|
1181
1171
|
...execResults
|
|
1182
1172
|
}
|
|
1183
1173
|
});
|
|
1184
1174
|
await emitter.emit("watch-v2", {
|
|
1185
|
-
type: "step-finish",
|
|
1175
|
+
type: "workflow-step-finish",
|
|
1186
1176
|
payload: {
|
|
1187
1177
|
id: step.id,
|
|
1188
1178
|
metadata: {}
|
|
@@ -1321,7 +1311,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1321
1311
|
abortSignal: abortController.signal,
|
|
1322
1312
|
writer: new tools.ToolStream(
|
|
1323
1313
|
{
|
|
1324
|
-
prefix: "step",
|
|
1314
|
+
prefix: "workflow-step",
|
|
1325
1315
|
callId: crypto.randomUUID(),
|
|
1326
1316
|
name: "conditional",
|
|
1327
1317
|
runId
|