@mastra/inngest 0.0.0-tool-list-type-20250910154522 → 0.0.0-toolOptionTypes-20250917085558
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 +78 -3
- package/dist/index.cjs +52 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +22 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +52 -64
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,88 @@
|
|
|
1
1
|
# @mastra/inngest
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-toolOptionTypes-20250917085558
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Fully deprecated createRun (now throws an error) in favour of createRunAsync ([#7897](https://github.com/mastra-ai/mastra/pull/7897))
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- dependencies updates: ([#7865](https://github.com/mastra-ai/mastra/pull/7865))
|
|
12
|
+
- Updated dependency [`inngest@^3.40.3` ↗︎](https://www.npmjs.com/package/inngest/v/3.40.3) (from `^3.40.2`, in `dependencies`)
|
|
13
|
+
|
|
14
|
+
- Added the ability to hide internal ai tracing spans (enabled by default) ([#7764](https://github.com/mastra-ai/mastra/pull/7764))
|
|
15
|
+
|
|
16
|
+
- Update peerdep of @mastra/core ([#7619](https://github.com/mastra-ai/mastra/pull/7619))
|
|
17
|
+
|
|
18
|
+
- refactored handling of internal ai spans to be more intelligent ([#7876](https://github.com/mastra-ai/mastra/pull/7876))
|
|
19
|
+
|
|
20
|
+
- fix(workflows/inngest): handle Date serialization in sleepUntil execution ([#7863](https://github.com/mastra-ai/mastra/pull/7863))
|
|
21
|
+
|
|
22
|
+
- add resourceId support to inngest workflow execution engine for workflow snapshot persistance ([#7792](https://github.com/mastra-ai/mastra/pull/7792))
|
|
23
|
+
|
|
24
|
+
- feat(inngest): add support for user-supplied functions in `serve` / `inngestServe` ([#7900](https://github.com/mastra-ai/mastra/pull/7900))
|
|
25
|
+
|
|
26
|
+
- Updated dependencies [[`a1bb887`](https://github.com/mastra-ai/mastra/commit/a1bb887e8bfae44230f487648da72e96ef824561), [`fb84c21`](https://github.com/mastra-ai/mastra/commit/fb84c21859d09bdc8f158bd5412bdc4b5835a61c), [`5802bf5`](https://github.com/mastra-ai/mastra/commit/5802bf57f6182e4b67c28d7d91abed349a8d14f3), [`5bda53a`](https://github.com/mastra-ai/mastra/commit/5bda53a9747bfa7d876d754fc92c83a06e503f62), [`f26a8fd`](https://github.com/mastra-ai/mastra/commit/f26a8fd99fcb0497a5d86c28324430d7f6a5fb83), [`6047778`](https://github.com/mastra-ai/mastra/commit/6047778e501df460648f31decddf8e443f36e373), [`a0f5f1c`](https://github.com/mastra-ai/mastra/commit/a0f5f1ca39c3c5c6d26202e9fcab986b4fe14568), [`9d4fc09`](https://github.com/mastra-ai/mastra/commit/9d4fc09b2ad55caa7738c7ceb3a905e454f74cdd), [`d75ccf0`](https://github.com/mastra-ai/mastra/commit/d75ccf06dfd2582b916aa12624e3cd61b279edf1), [`5cadbc4`](https://github.com/mastra-ai/mastra/commit/5cadbc473019b6a08625fc7c624290d564533508), [`b356f5f`](https://github.com/mastra-ai/mastra/commit/b356f5f7566cb3edb755d91f00b72fc1420b2a37), [`de056a0`](https://github.com/mastra-ai/mastra/commit/de056a02cbb43f6aa0380ab2150ea404af9ec0dd), [`f5ce05f`](https://github.com/mastra-ai/mastra/commit/f5ce05f831d42c69559bf4c0fdb46ccb920fc3a3), [`60c9cec`](https://github.com/mastra-ai/mastra/commit/60c9cec7048a79a87440f7840c383875bd710d93), [`c93532a`](https://github.com/mastra-ai/mastra/commit/c93532a340b80e4dd946d4c138d9381de5f70399), [`9f6f30f`](https://github.com/mastra-ai/mastra/commit/9f6f30f04ec6648bbca798ea8aad59317c40d8db), [`547c621`](https://github.com/mastra-ai/mastra/commit/547c62104af3f7a551b3754e9cbdf0a3fbba15e4), [`897995e`](https://github.com/mastra-ai/mastra/commit/897995e630d572fe2891e7ede817938cabb43251), [`0fed8f2`](https://github.com/mastra-ai/mastra/commit/0fed8f2aa84b167b3415ea6f8f70755775132c8d), [`1a1fbe6`](https://github.com/mastra-ai/mastra/commit/1a1fbe66efb7d94abc373ed0dd9676adb8122454), [`d706fad`](https://github.com/mastra-ai/mastra/commit/d706fad6e6e4b72357b18d229ba38e6c913c0e70), [`87fd07f`](https://github.com/mastra-ai/mastra/commit/87fd07ff35387a38728967163460231b5d33ae3b), [`5c3768f`](https://github.com/mastra-ai/mastra/commit/5c3768fa959454232ad76715c381f4aac00c6881), [`2685a78`](https://github.com/mastra-ai/mastra/commit/2685a78f224b8b04e20d4fab5ac1adb638190071), [`36f39c0`](https://github.com/mastra-ai/mastra/commit/36f39c00dc794952dc3c11aab91c2fa8bca74b11), [`8a3f5e4`](https://github.com/mastra-ai/mastra/commit/8a3f5e4212ec36b302957deb4bd47005ab598382)]:
|
|
27
|
+
- @mastra/core@0.0.0-toolOptionTypes-20250917085558
|
|
28
|
+
|
|
29
|
+
## 0.14.0-alpha.2
|
|
30
|
+
|
|
31
|
+
### Minor Changes
|
|
32
|
+
|
|
33
|
+
- Fully deprecated createRun (now throws an error) in favour of createRunAsync ([#7897](https://github.com/mastra-ai/mastra/pull/7897))
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- refactored handling of internal ai spans to be more intelligent ([#7876](https://github.com/mastra-ai/mastra/pull/7876))
|
|
38
|
+
|
|
39
|
+
- feat(inngest): add support for user-supplied functions in `serve` / `inngestServe` ([#7900](https://github.com/mastra-ai/mastra/pull/7900))
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [[`fb84c21`](https://github.com/mastra-ai/mastra/commit/fb84c21859d09bdc8f158bd5412bdc4b5835a61c), [`9d4fc09`](https://github.com/mastra-ai/mastra/commit/9d4fc09b2ad55caa7738c7ceb3a905e454f74cdd), [`d75ccf0`](https://github.com/mastra-ai/mastra/commit/d75ccf06dfd2582b916aa12624e3cd61b279edf1), [`0fed8f2`](https://github.com/mastra-ai/mastra/commit/0fed8f2aa84b167b3415ea6f8f70755775132c8d), [`87fd07f`](https://github.com/mastra-ai/mastra/commit/87fd07ff35387a38728967163460231b5d33ae3b)]:
|
|
42
|
+
- @mastra/core@0.17.0-alpha.4
|
|
43
|
+
|
|
44
|
+
## 0.13.3-alpha.1
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- dependencies updates: ([#7865](https://github.com/mastra-ai/mastra/pull/7865))
|
|
49
|
+
- Updated dependency [`inngest@^3.40.3` ↗︎](https://www.npmjs.com/package/inngest/v/3.40.3) (from `^3.40.2`, in `dependencies`)
|
|
50
|
+
|
|
51
|
+
- Update peerdep of @mastra/core ([#7619](https://github.com/mastra-ai/mastra/pull/7619))
|
|
52
|
+
|
|
53
|
+
- fix(workflows/inngest): handle Date serialization in sleepUntil execution ([#7863](https://github.com/mastra-ai/mastra/pull/7863))
|
|
54
|
+
|
|
55
|
+
- add resourceId support to inngest workflow execution engine for workflow snapshot persistance ([#7792](https://github.com/mastra-ai/mastra/pull/7792))
|
|
56
|
+
|
|
57
|
+
- Updated dependencies [[`a1bb887`](https://github.com/mastra-ai/mastra/commit/a1bb887e8bfae44230f487648da72e96ef824561), [`a0f5f1c`](https://github.com/mastra-ai/mastra/commit/a0f5f1ca39c3c5c6d26202e9fcab986b4fe14568), [`b356f5f`](https://github.com/mastra-ai/mastra/commit/b356f5f7566cb3edb755d91f00b72fc1420b2a37), [`f5ce05f`](https://github.com/mastra-ai/mastra/commit/f5ce05f831d42c69559bf4c0fdb46ccb920fc3a3), [`9f6f30f`](https://github.com/mastra-ai/mastra/commit/9f6f30f04ec6648bbca798ea8aad59317c40d8db), [`d706fad`](https://github.com/mastra-ai/mastra/commit/d706fad6e6e4b72357b18d229ba38e6c913c0e70), [`5c3768f`](https://github.com/mastra-ai/mastra/commit/5c3768fa959454232ad76715c381f4aac00c6881), [`8a3f5e4`](https://github.com/mastra-ai/mastra/commit/8a3f5e4212ec36b302957deb4bd47005ab598382)]:
|
|
58
|
+
- @mastra/core@0.17.0-alpha.3
|
|
59
|
+
|
|
60
|
+
## 0.13.3-alpha.0
|
|
61
|
+
|
|
62
|
+
### Patch Changes
|
|
63
|
+
|
|
64
|
+
- Added the ability to hide internal ai tracing spans (enabled by default) ([#7764](https://github.com/mastra-ai/mastra/pull/7764))
|
|
65
|
+
|
|
66
|
+
- Updated dependencies [[`5802bf5`](https://github.com/mastra-ai/mastra/commit/5802bf57f6182e4b67c28d7d91abed349a8d14f3), [`5bda53a`](https://github.com/mastra-ai/mastra/commit/5bda53a9747bfa7d876d754fc92c83a06e503f62), [`f26a8fd`](https://github.com/mastra-ai/mastra/commit/f26a8fd99fcb0497a5d86c28324430d7f6a5fb83), [`1a1fbe6`](https://github.com/mastra-ai/mastra/commit/1a1fbe66efb7d94abc373ed0dd9676adb8122454), [`36f39c0`](https://github.com/mastra-ai/mastra/commit/36f39c00dc794952dc3c11aab91c2fa8bca74b11)]:
|
|
67
|
+
- @mastra/core@0.16.4-alpha.0
|
|
68
|
+
|
|
69
|
+
## 0.13.2
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- various improvements to input & output data on ai spans ([#7636](https://github.com/mastra-ai/mastra/pull/7636))
|
|
74
|
+
|
|
75
|
+
- Updated dependencies [[`b4379f7`](https://github.com/mastra-ai/mastra/commit/b4379f703fd74474f253420e8c3a684f2c4b2f8e), [`2a6585f`](https://github.com/mastra-ai/mastra/commit/2a6585f7cb71f023f805d521d1c3c95fb9a3aa59), [`3d26e83`](https://github.com/mastra-ai/mastra/commit/3d26e8353a945719028f087cc6ac4b06f0ce27d2), [`dd9119b`](https://github.com/mastra-ai/mastra/commit/dd9119b175a8f389082f75c12750e51f96d65dca), [`d34aaa1`](https://github.com/mastra-ai/mastra/commit/d34aaa1da5d3c5f991740f59e2fe6d28d3e2dd91), [`56e55d1`](https://github.com/mastra-ai/mastra/commit/56e55d1e9eb63e7d9e41aa46e012aae471256812), [`ce1e580`](https://github.com/mastra-ai/mastra/commit/ce1e580f6391e94a0c6816a9c5db0a21566a262f), [`b2babfa`](https://github.com/mastra-ai/mastra/commit/b2babfa9e75b22f2759179e71d8473f6dc5421ed), [`d8c3ba5`](https://github.com/mastra-ai/mastra/commit/d8c3ba516f4173282d293f7e64769cfc8738d360), [`a566c4e`](https://github.com/mastra-ai/mastra/commit/a566c4e92d86c1671707c54359b1d33934f7cc13), [`af333aa`](https://github.com/mastra-ai/mastra/commit/af333aa30fe6d1b127024b03a64736c46eddeca2), [`3863c52`](https://github.com/mastra-ai/mastra/commit/3863c52d44b4e5779968b802d977e87adf939d8e), [`6424c7e`](https://github.com/mastra-ai/mastra/commit/6424c7ec38b6921d66212431db1e0958f441b2a7), [`db94750`](https://github.com/mastra-ai/mastra/commit/db94750a41fd29b43eb1f7ce8e97ba8b9978c91b), [`a66a371`](https://github.com/mastra-ai/mastra/commit/a66a3716b00553d7f01842be9deb34f720b10fab), [`69fc3cd`](https://github.com/mastra-ai/mastra/commit/69fc3cd0fd814901785bdcf49bf536ab1e7fd975)]:
|
|
76
|
+
- @mastra/core@0.16.3
|
|
77
|
+
|
|
78
|
+
## 0.13.2-alpha.0
|
|
4
79
|
|
|
5
80
|
### Patch Changes
|
|
6
81
|
|
|
7
82
|
- various improvements to input & output data on ai spans ([#7636](https://github.com/mastra-ai/mastra/pull/7636))
|
|
8
83
|
|
|
9
|
-
- Updated dependencies [[`b4379f7`](https://github.com/mastra-ai/mastra/commit/b4379f703fd74474f253420e8c3a684f2c4b2f8e), [`d34aaa1`](https://github.com/mastra-ai/mastra/commit/d34aaa1da5d3c5f991740f59e2fe6d28d3e2dd91), [`b2babfa`](https://github.com/mastra-ai/mastra/commit/b2babfa9e75b22f2759179e71d8473f6dc5421ed), [`d8c3ba5`](https://github.com/mastra-ai/mastra/commit/d8c3ba516f4173282d293f7e64769cfc8738d360), [`6424c7e`](https://github.com/mastra-ai/mastra/commit/6424c7ec38b6921d66212431db1e0958f441b2a7), [`db94750`](https://github.com/mastra-ai/mastra/commit/db94750a41fd29b43eb1f7ce8e97ba8b9978c91b), [`a66a371`](https://github.com/mastra-ai/mastra/commit/a66a3716b00553d7f01842be9deb34f720b10fab), [`69fc3cd`](https://github.com/mastra-ai/mastra/commit/69fc3cd0fd814901785bdcf49bf536ab1e7fd975)]:
|
|
10
|
-
- @mastra/core@0.
|
|
84
|
+
- Updated dependencies [[`b4379f7`](https://github.com/mastra-ai/mastra/commit/b4379f703fd74474f253420e8c3a684f2c4b2f8e), [`dd9119b`](https://github.com/mastra-ai/mastra/commit/dd9119b175a8f389082f75c12750e51f96d65dca), [`d34aaa1`](https://github.com/mastra-ai/mastra/commit/d34aaa1da5d3c5f991740f59e2fe6d28d3e2dd91), [`ce1e580`](https://github.com/mastra-ai/mastra/commit/ce1e580f6391e94a0c6816a9c5db0a21566a262f), [`b2babfa`](https://github.com/mastra-ai/mastra/commit/b2babfa9e75b22f2759179e71d8473f6dc5421ed), [`d8c3ba5`](https://github.com/mastra-ai/mastra/commit/d8c3ba516f4173282d293f7e64769cfc8738d360), [`a566c4e`](https://github.com/mastra-ai/mastra/commit/a566c4e92d86c1671707c54359b1d33934f7cc13), [`af333aa`](https://github.com/mastra-ai/mastra/commit/af333aa30fe6d1b127024b03a64736c46eddeca2), [`3863c52`](https://github.com/mastra-ai/mastra/commit/3863c52d44b4e5779968b802d977e87adf939d8e), [`6424c7e`](https://github.com/mastra-ai/mastra/commit/6424c7ec38b6921d66212431db1e0958f441b2a7), [`db94750`](https://github.com/mastra-ai/mastra/commit/db94750a41fd29b43eb1f7ce8e97ba8b9978c91b), [`a66a371`](https://github.com/mastra-ai/mastra/commit/a66a3716b00553d7f01842be9deb34f720b10fab), [`69fc3cd`](https://github.com/mastra-ai/mastra/commit/69fc3cd0fd814901785bdcf49bf536ab1e7fd975)]:
|
|
85
|
+
- @mastra/core@0.16.3-alpha.0
|
|
11
86
|
|
|
12
87
|
## 0.13.1
|
|
13
88
|
|
package/dist/index.cjs
CHANGED
|
@@ -11,9 +11,13 @@ var hono = require('inngest/hono');
|
|
|
11
11
|
var zod = require('zod');
|
|
12
12
|
|
|
13
13
|
// src/index.ts
|
|
14
|
-
function serve({
|
|
14
|
+
function serve({
|
|
15
|
+
mastra,
|
|
16
|
+
inngest,
|
|
17
|
+
functions: userFunctions = []
|
|
18
|
+
}) {
|
|
15
19
|
const wfs = mastra.getWorkflows();
|
|
16
|
-
const
|
|
20
|
+
const workflowFunctions = Array.from(
|
|
17
21
|
new Set(
|
|
18
22
|
Object.values(wfs).flatMap((wf) => {
|
|
19
23
|
if (wf instanceof InngestWorkflow) {
|
|
@@ -26,7 +30,7 @@ function serve({ mastra, inngest }) {
|
|
|
26
30
|
);
|
|
27
31
|
return hono.serve({
|
|
28
32
|
client: inngest,
|
|
29
|
-
functions
|
|
33
|
+
functions: [...workflowFunctions, ...userFunctions]
|
|
30
34
|
});
|
|
31
35
|
}
|
|
32
36
|
var InngestRun = class extends workflows.Run {
|
|
@@ -54,7 +58,6 @@ var InngestRun = class extends workflows.Run {
|
|
|
54
58
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
55
59
|
runs = await this.getRuns(eventId);
|
|
56
60
|
if (runs?.[0]?.status === "Failed") {
|
|
57
|
-
console.log("run", runs?.[0]);
|
|
58
61
|
throw new Error(`Function run ${runs?.[0]?.status}`);
|
|
59
62
|
} else if (runs?.[0]?.status === "Cancelled") {
|
|
60
63
|
const snapshot = await this.#mastra?.storage?.loadWorkflowSnapshot({
|
|
@@ -87,6 +90,7 @@ var InngestRun = class extends workflows.Run {
|
|
|
87
90
|
await this.#mastra?.storage?.persistWorkflowSnapshot({
|
|
88
91
|
workflowName: this.workflowId,
|
|
89
92
|
runId: this.runId,
|
|
93
|
+
resourceId: this.resourceId,
|
|
90
94
|
snapshot: {
|
|
91
95
|
...snapshot,
|
|
92
96
|
status: "canceled"
|
|
@@ -100,6 +104,7 @@ var InngestRun = class extends workflows.Run {
|
|
|
100
104
|
await this.#mastra.getStorage()?.persistWorkflowSnapshot({
|
|
101
105
|
workflowName: this.workflowId,
|
|
102
106
|
runId: this.runId,
|
|
107
|
+
resourceId: this.resourceId,
|
|
103
108
|
snapshot: {
|
|
104
109
|
runId: this.runId,
|
|
105
110
|
serializedStepGraph: this.serializedStepGraph,
|
|
@@ -116,7 +121,8 @@ var InngestRun = class extends workflows.Run {
|
|
|
116
121
|
name: `workflow.${this.workflowId}`,
|
|
117
122
|
data: {
|
|
118
123
|
inputData,
|
|
119
|
-
runId: this.runId
|
|
124
|
+
runId: this.runId,
|
|
125
|
+
resourceId: this.resourceId
|
|
120
126
|
}
|
|
121
127
|
});
|
|
122
128
|
const eventId = eventOutput.ids[0];
|
|
@@ -204,33 +210,9 @@ var InngestRun = class extends workflows.Run {
|
|
|
204
210
|
}
|
|
205
211
|
stream({ inputData, runtimeContext } = {}) {
|
|
206
212
|
const { readable, writable } = new TransformStream();
|
|
207
|
-
let currentToolData = void 0;
|
|
208
213
|
const writer = writable.getWriter();
|
|
209
214
|
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
|
-
}
|
|
221
215
|
try {
|
|
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
216
|
const e = {
|
|
235
217
|
...event,
|
|
236
218
|
type: event.type.replace("workflow-", "")
|
|
@@ -312,23 +294,14 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
|
|
|
312
294
|
}
|
|
313
295
|
}
|
|
314
296
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
executionGraph: this.executionGraph,
|
|
323
|
-
serializedStepGraph: this.serializedStepGraph,
|
|
324
|
-
mastra: this.#mastra,
|
|
325
|
-
retryConfig: this.retryConfig,
|
|
326
|
-
cleanup: () => this.runs.delete(runIdToUse)
|
|
327
|
-
},
|
|
328
|
-
this.inngest
|
|
297
|
+
/**
|
|
298
|
+
* @deprecated Use createRunAsync() instead.
|
|
299
|
+
* @throws {Error} Always throws an error directing users to use createRunAsync()
|
|
300
|
+
*/
|
|
301
|
+
createRun(_options) {
|
|
302
|
+
throw new Error(
|
|
303
|
+
"createRun() has been deprecated. Please use createRunAsync() instead.\n\nMigration guide:\n Before: const run = workflow.createRun();\n After: const run = await workflow.createRunAsync();\n\nNote: createRunAsync() is an async method, so make sure your calling function is async."
|
|
329
304
|
);
|
|
330
|
-
this.runs.set(runIdToUse, run);
|
|
331
|
-
return run;
|
|
332
305
|
}
|
|
333
306
|
async createRunAsync(options) {
|
|
334
307
|
const runIdToUse = options?.runId || crypto.randomUUID();
|
|
@@ -336,6 +309,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
|
|
|
336
309
|
{
|
|
337
310
|
workflowId: this.id,
|
|
338
311
|
runId: runIdToUse,
|
|
312
|
+
resourceId: options?.resourceId,
|
|
339
313
|
executionEngine: this.executionEngine,
|
|
340
314
|
executionGraph: this.executionGraph,
|
|
341
315
|
serializedStepGraph: this.serializedStepGraph,
|
|
@@ -351,6 +325,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
|
|
|
351
325
|
await this.mastra?.getStorage()?.persistWorkflowSnapshot({
|
|
352
326
|
workflowName: this.id,
|
|
353
327
|
runId: runIdToUse,
|
|
328
|
+
resourceId: options?.resourceId,
|
|
354
329
|
snapshot: {
|
|
355
330
|
runId: runIdToUse,
|
|
356
331
|
status: "pending",
|
|
@@ -384,7 +359,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
|
|
|
384
359
|
},
|
|
385
360
|
{ event: `workflow.${this.id}` },
|
|
386
361
|
async ({ event, step, attempt, publish }) => {
|
|
387
|
-
let { inputData, runId, resume } = event.data;
|
|
362
|
+
let { inputData, runId, resourceId, resume } = event.data;
|
|
388
363
|
if (!runId) {
|
|
389
364
|
runId = await step.run(`workflow.${this.id}.runIdGen`, async () => {
|
|
390
365
|
return crypto.randomUUID();
|
|
@@ -416,6 +391,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
|
|
|
416
391
|
const result = await engine.execute({
|
|
417
392
|
workflowId: this.id,
|
|
418
393
|
runId,
|
|
394
|
+
resourceId,
|
|
419
395
|
graph: this.executionGraph,
|
|
420
396
|
serializedStepGraph: this.serializedStepGraph,
|
|
421
397
|
input: inputData,
|
|
@@ -463,8 +439,6 @@ function createStep(params) {
|
|
|
463
439
|
// @ts-ignore
|
|
464
440
|
inputSchema: zod.z.object({
|
|
465
441
|
prompt: zod.z.string()
|
|
466
|
-
// resourceId: z.string().optional(),
|
|
467
|
-
// threadId: z.string().optional(),
|
|
468
442
|
}),
|
|
469
443
|
// @ts-ignore
|
|
470
444
|
outputSchema: zod.z.object({
|
|
@@ -480,13 +454,7 @@ function createStep(params) {
|
|
|
480
454
|
name: params.name,
|
|
481
455
|
args: inputData
|
|
482
456
|
};
|
|
483
|
-
await emitter.emit("watch-v2", {
|
|
484
|
-
type: "workflow-agent-call-start",
|
|
485
|
-
payload: toolData
|
|
486
|
-
});
|
|
487
457
|
const { fullStream } = await params.stream(inputData.prompt, {
|
|
488
|
-
// resourceId: inputData.resourceId,
|
|
489
|
-
// threadId: inputData.threadId,
|
|
490
458
|
runtimeContext,
|
|
491
459
|
tracingContext,
|
|
492
460
|
onFinish: (result) => {
|
|
@@ -497,12 +465,22 @@ function createStep(params) {
|
|
|
497
465
|
if (abortSignal.aborted) {
|
|
498
466
|
return abort();
|
|
499
467
|
}
|
|
468
|
+
await emitter.emit("watch-v2", {
|
|
469
|
+
type: "tool-call-streaming-start",
|
|
470
|
+
...toolData ?? {}
|
|
471
|
+
});
|
|
500
472
|
for await (const chunk of fullStream) {
|
|
501
|
-
|
|
473
|
+
if (chunk.type === "text-delta") {
|
|
474
|
+
await emitter.emit("watch-v2", {
|
|
475
|
+
type: "tool-call-delta",
|
|
476
|
+
...toolData ?? {},
|
|
477
|
+
argsTextDelta: chunk.textDelta
|
|
478
|
+
});
|
|
479
|
+
}
|
|
502
480
|
}
|
|
503
481
|
await emitter.emit("watch-v2", {
|
|
504
|
-
type: "
|
|
505
|
-
|
|
482
|
+
type: "tool-call-streaming-finish",
|
|
483
|
+
...toolData ?? {}
|
|
506
484
|
});
|
|
507
485
|
return {
|
|
508
486
|
text: await streamPromise.promise
|
|
@@ -572,8 +550,8 @@ function init(inngest) {
|
|
|
572
550
|
var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
573
551
|
inngestStep;
|
|
574
552
|
inngestAttempts;
|
|
575
|
-
constructor(mastra, inngestStep, inngestAttempts = 0) {
|
|
576
|
-
super({ mastra });
|
|
553
|
+
constructor(mastra, inngestStep, inngestAttempts = 0, options) {
|
|
554
|
+
super({ mastra, options });
|
|
577
555
|
this.inngestStep = inngestStep;
|
|
578
556
|
this.inngestAttempts = inngestAttempts;
|
|
579
557
|
}
|
|
@@ -669,7 +647,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
669
647
|
attributes: {
|
|
670
648
|
durationMs: duration,
|
|
671
649
|
sleepType: fn ? "dynamic" : "fixed"
|
|
672
|
-
}
|
|
650
|
+
},
|
|
651
|
+
tracingPolicy: this.options?.tracingPolicy
|
|
673
652
|
});
|
|
674
653
|
if (fn) {
|
|
675
654
|
const stepCallId = crypto.randomUUID();
|
|
@@ -754,7 +733,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
754
733
|
untilDate: date,
|
|
755
734
|
durationMs: date ? Math.max(0, date.getTime() - Date.now()) : void 0,
|
|
756
735
|
sleepType: fn ? "dynamic" : "fixed"
|
|
757
|
-
}
|
|
736
|
+
},
|
|
737
|
+
tracingPolicy: this.options?.tracingPolicy
|
|
758
738
|
});
|
|
759
739
|
if (fn) {
|
|
760
740
|
date = await this.inngestStep.run(`workflow.${workflowId}.sleepUntil.${entry.id}`, async () => {
|
|
@@ -804,6 +784,9 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
804
784
|
)
|
|
805
785
|
});
|
|
806
786
|
});
|
|
787
|
+
if (date && !(date instanceof Date)) {
|
|
788
|
+
date = new Date(date);
|
|
789
|
+
}
|
|
807
790
|
const time = !date ? 0 : date.getTime() - Date.now();
|
|
808
791
|
sleepUntilSpan?.update({
|
|
809
792
|
attributes: {
|
|
@@ -852,7 +835,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
852
835
|
input: prevOutput,
|
|
853
836
|
attributes: {
|
|
854
837
|
stepId: step.id
|
|
855
|
-
}
|
|
838
|
+
},
|
|
839
|
+
tracingPolicy: this.options?.tracingPolicy
|
|
856
840
|
});
|
|
857
841
|
const startedAt = await this.inngestStep.run(
|
|
858
842
|
`workflow.${executionContext.workflowId}.run.${executionContext.runId}.step.${step.id}.running_ev`,
|
|
@@ -1213,6 +1197,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1213
1197
|
workflowId,
|
|
1214
1198
|
runId,
|
|
1215
1199
|
stepResults,
|
|
1200
|
+
resourceId,
|
|
1216
1201
|
executionContext,
|
|
1217
1202
|
serializedStepGraph,
|
|
1218
1203
|
workflowStatus,
|
|
@@ -1225,6 +1210,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1225
1210
|
await this.mastra?.getStorage()?.persistWorkflowSnapshot({
|
|
1226
1211
|
workflowName: workflowId,
|
|
1227
1212
|
runId,
|
|
1213
|
+
resourceId,
|
|
1228
1214
|
snapshot: {
|
|
1229
1215
|
runId,
|
|
1230
1216
|
value: {},
|
|
@@ -1266,7 +1252,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1266
1252
|
input: prevOutput,
|
|
1267
1253
|
attributes: {
|
|
1268
1254
|
conditionCount: entry.conditions.length
|
|
1269
|
-
}
|
|
1255
|
+
},
|
|
1256
|
+
tracingPolicy: this.options?.tracingPolicy
|
|
1270
1257
|
});
|
|
1271
1258
|
let execResults;
|
|
1272
1259
|
const truthyIndexes = (await Promise.all(
|
|
@@ -1278,7 +1265,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1278
1265
|
input: prevOutput,
|
|
1279
1266
|
attributes: {
|
|
1280
1267
|
conditionIndex: index
|
|
1281
|
-
}
|
|
1268
|
+
},
|
|
1269
|
+
tracingPolicy: this.options?.tracingPolicy
|
|
1282
1270
|
});
|
|
1283
1271
|
try {
|
|
1284
1272
|
const result = await cond({
|