@mastra/inngest 0.0.0-fix-zod-to-json-schema-ref-strategy-20250910193441 → 0.0.0-fix-cloud-peer-deps-20250923194656
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 +100 -3
- package/dist/index.cjs +60 -103
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +27 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -104
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,110 @@
|
|
|
1
1
|
# @mastra/inngest
|
|
2
2
|
|
|
3
|
-
## 0.0.0-fix-
|
|
3
|
+
## 0.0.0-fix-cloud-peer-deps-20250923194656
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixes for `getStepResult` in workflow steps ([#8065](https://github.com/mastra-ai/mastra/pull/8065))
|
|
8
|
+
|
|
9
|
+
- Update Peerdeps for packages based on core minor bump ([#8025](https://github.com/mastra-ai/mastra/pull/8025))
|
|
10
|
+
|
|
11
|
+
- 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)]:
|
|
12
|
+
- @mastra/core@0.0.0-fix-cloud-peer-deps-20250923194656
|
|
13
|
+
|
|
14
|
+
## 0.14.1-alpha.0
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Fixes for `getStepResult` in workflow steps ([#8065](https://github.com/mastra-ai/mastra/pull/8065))
|
|
19
|
+
|
|
20
|
+
- Update Peerdeps for packages based on core minor bump ([#8025](https://github.com/mastra-ai/mastra/pull/8025))
|
|
21
|
+
|
|
22
|
+
- 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), [`c4a8204`](https://github.com/mastra-ai/mastra/commit/c4a82046bfd241d6044e234bc5917d5a01fe6b55)]:
|
|
23
|
+
- @mastra/core@0.18.0-alpha.2
|
|
24
|
+
|
|
25
|
+
## 0.14.0
|
|
26
|
+
|
|
27
|
+
### Minor Changes
|
|
28
|
+
|
|
29
|
+
- Fully deprecated createRun (now throws an error) in favour of createRunAsync ([#7897](https://github.com/mastra-ai/mastra/pull/7897))
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- dependencies updates: ([#7865](https://github.com/mastra-ai/mastra/pull/7865))
|
|
34
|
+
- Updated dependency [`inngest@^3.40.3` ↗︎](https://www.npmjs.com/package/inngest/v/3.40.3) (from `^3.40.2`, in `dependencies`)
|
|
35
|
+
|
|
36
|
+
- Added the ability to hide internal ai tracing spans (enabled by default) ([#7764](https://github.com/mastra-ai/mastra/pull/7764))
|
|
37
|
+
|
|
38
|
+
- Update peerdep of @mastra/core ([#7619](https://github.com/mastra-ai/mastra/pull/7619))
|
|
39
|
+
|
|
40
|
+
- refactored handling of internal ai spans to be more intelligent ([#7876](https://github.com/mastra-ai/mastra/pull/7876))
|
|
41
|
+
|
|
42
|
+
- fix(workflows/inngest): handle Date serialization in sleepUntil execution ([#7863](https://github.com/mastra-ai/mastra/pull/7863))
|
|
43
|
+
|
|
44
|
+
- add resourceId support to inngest workflow execution engine for workflow snapshot persistance ([#7792](https://github.com/mastra-ai/mastra/pull/7792))
|
|
45
|
+
|
|
46
|
+
- feat(inngest): add support for user-supplied functions in `serve` / `inngestServe` ([#7900](https://github.com/mastra-ai/mastra/pull/7900))
|
|
47
|
+
|
|
48
|
+
- Updated dependencies [[`197cbb2`](https://github.com/mastra-ai/mastra/commit/197cbb248fc8cb4bbf61bf70b770f1388b445df2), [`a1bb887`](https://github.com/mastra-ai/mastra/commit/a1bb887e8bfae44230f487648da72e96ef824561), [`6590763`](https://github.com/mastra-ai/mastra/commit/65907630ef4bf4127067cecd1cb21b56f55d5f1b), [`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), [`c2eade3`](https://github.com/mastra-ai/mastra/commit/c2eade3508ef309662f065e5f340d7840295dd53), [`f26a8fd`](https://github.com/mastra-ai/mastra/commit/f26a8fd99fcb0497a5d86c28324430d7f6a5fb83), [`222965a`](https://github.com/mastra-ai/mastra/commit/222965a98ce8197b86673ec594244650b5960257), [`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), [`05c7abf`](https://github.com/mastra-ai/mastra/commit/05c7abfe105a015b7760c9bf33ff4419727502a0), [`0324ceb`](https://github.com/mastra-ai/mastra/commit/0324ceb8af9d16c12a531f90e575f6aab797ac81), [`d75ccf0`](https://github.com/mastra-ai/mastra/commit/d75ccf06dfd2582b916aa12624e3cd61b279edf1), [`0f9d227`](https://github.com/mastra-ai/mastra/commit/0f9d227890a98db33865abbea39daf407cd55ef7), [`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), [`6cb1fcb`](https://github.com/mastra-ai/mastra/commit/6cb1fcbc8d0378ffed0d17784c96e68f30cb0272), [`aee4f00`](https://github.com/mastra-ai/mastra/commit/aee4f00e61e1a42e81a6d74ff149dbe69e32695a), [`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), [`4f9ea8c`](https://github.com/mastra-ai/mastra/commit/4f9ea8c95ea74ba9abbf3b2ab6106c7d7bc45689), [`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), [`239b5a4`](https://github.com/mastra-ai/mastra/commit/239b5a497aeae2e8b4d764f46217cfff2284788e), [`8a3f5e4`](https://github.com/mastra-ai/mastra/commit/8a3f5e4212ec36b302957deb4bd47005ab598382)]:
|
|
49
|
+
- @mastra/core@0.17.0
|
|
50
|
+
|
|
51
|
+
## 0.14.0-alpha.2
|
|
52
|
+
|
|
53
|
+
### Minor Changes
|
|
54
|
+
|
|
55
|
+
- Fully deprecated createRun (now throws an error) in favour of createRunAsync ([#7897](https://github.com/mastra-ai/mastra/pull/7897))
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- refactored handling of internal ai spans to be more intelligent ([#7876](https://github.com/mastra-ai/mastra/pull/7876))
|
|
60
|
+
|
|
61
|
+
- feat(inngest): add support for user-supplied functions in `serve` / `inngestServe` ([#7900](https://github.com/mastra-ai/mastra/pull/7900))
|
|
62
|
+
|
|
63
|
+
- 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)]:
|
|
64
|
+
- @mastra/core@0.17.0-alpha.4
|
|
65
|
+
|
|
66
|
+
## 0.13.3-alpha.1
|
|
67
|
+
|
|
68
|
+
### Patch Changes
|
|
69
|
+
|
|
70
|
+
- dependencies updates: ([#7865](https://github.com/mastra-ai/mastra/pull/7865))
|
|
71
|
+
- Updated dependency [`inngest@^3.40.3` ↗︎](https://www.npmjs.com/package/inngest/v/3.40.3) (from `^3.40.2`, in `dependencies`)
|
|
72
|
+
|
|
73
|
+
- Update peerdep of @mastra/core ([#7619](https://github.com/mastra-ai/mastra/pull/7619))
|
|
74
|
+
|
|
75
|
+
- fix(workflows/inngest): handle Date serialization in sleepUntil execution ([#7863](https://github.com/mastra-ai/mastra/pull/7863))
|
|
76
|
+
|
|
77
|
+
- add resourceId support to inngest workflow execution engine for workflow snapshot persistance ([#7792](https://github.com/mastra-ai/mastra/pull/7792))
|
|
78
|
+
|
|
79
|
+
- 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)]:
|
|
80
|
+
- @mastra/core@0.17.0-alpha.3
|
|
81
|
+
|
|
82
|
+
## 0.13.3-alpha.0
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- Added the ability to hide internal ai tracing spans (enabled by default) ([#7764](https://github.com/mastra-ai/mastra/pull/7764))
|
|
87
|
+
|
|
88
|
+
- 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)]:
|
|
89
|
+
- @mastra/core@0.16.4-alpha.0
|
|
90
|
+
|
|
91
|
+
## 0.13.2
|
|
92
|
+
|
|
93
|
+
### Patch Changes
|
|
94
|
+
|
|
95
|
+
- various improvements to input & output data on ai spans ([#7636](https://github.com/mastra-ai/mastra/pull/7636))
|
|
96
|
+
|
|
97
|
+
- 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)]:
|
|
98
|
+
- @mastra/core@0.16.3
|
|
99
|
+
|
|
100
|
+
## 0.13.2-alpha.0
|
|
4
101
|
|
|
5
102
|
### Patch Changes
|
|
6
103
|
|
|
7
104
|
- various improvements to input & output data on ai spans ([#7636](https://github.com/mastra-ai/mastra/pull/7636))
|
|
8
105
|
|
|
9
|
-
- 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), [`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)]:
|
|
10
|
-
- @mastra/core@0.
|
|
106
|
+
- 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)]:
|
|
107
|
+
- @mastra/core@0.16.3-alpha.0
|
|
11
108
|
|
|
12
109
|
## 0.13.1
|
|
13
110
|
|
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
|
|
@@ -520,12 +498,14 @@ function createStep(params) {
|
|
|
520
498
|
id: params.id,
|
|
521
499
|
inputSchema: params.inputSchema,
|
|
522
500
|
outputSchema: params.outputSchema,
|
|
523
|
-
execute: async ({ inputData, mastra, runtimeContext, tracingContext }) => {
|
|
501
|
+
execute: async ({ inputData, mastra, runtimeContext, tracingContext, suspend, resumeData }) => {
|
|
524
502
|
return params.execute({
|
|
525
503
|
context: inputData,
|
|
526
504
|
mastra: aiTracing.wrapMastra(mastra, tracingContext),
|
|
527
505
|
runtimeContext,
|
|
528
|
-
tracingContext
|
|
506
|
+
tracingContext,
|
|
507
|
+
suspend,
|
|
508
|
+
resumeData
|
|
529
509
|
});
|
|
530
510
|
}
|
|
531
511
|
};
|
|
@@ -572,8 +552,8 @@ function init(inngest) {
|
|
|
572
552
|
var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
573
553
|
inngestStep;
|
|
574
554
|
inngestAttempts;
|
|
575
|
-
constructor(mastra, inngestStep, inngestAttempts = 0) {
|
|
576
|
-
super({ mastra });
|
|
555
|
+
constructor(mastra, inngestStep, inngestAttempts = 0, options) {
|
|
556
|
+
super({ mastra, options });
|
|
577
557
|
this.inngestStep = inngestStep;
|
|
578
558
|
this.inngestAttempts = inngestAttempts;
|
|
579
559
|
}
|
|
@@ -669,7 +649,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
669
649
|
attributes: {
|
|
670
650
|
durationMs: duration,
|
|
671
651
|
sleepType: fn ? "dynamic" : "fixed"
|
|
672
|
-
}
|
|
652
|
+
},
|
|
653
|
+
tracingPolicy: this.options?.tracingPolicy
|
|
673
654
|
});
|
|
674
655
|
if (fn) {
|
|
675
656
|
const stepCallId = crypto.randomUUID();
|
|
@@ -685,16 +666,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
685
666
|
currentSpan: sleepSpan
|
|
686
667
|
},
|
|
687
668
|
getInitData: () => stepResults?.input,
|
|
688
|
-
getStepResult: (
|
|
689
|
-
if (!step?.id) {
|
|
690
|
-
return null;
|
|
691
|
-
}
|
|
692
|
-
const result = stepResults[step.id];
|
|
693
|
-
if (result?.status === "success") {
|
|
694
|
-
return result.output;
|
|
695
|
-
}
|
|
696
|
-
return null;
|
|
697
|
-
},
|
|
669
|
+
getStepResult: workflows.getStepResult.bind(this, stepResults),
|
|
698
670
|
// TODO: this function shouldn't have suspend probably?
|
|
699
671
|
suspend: async (_suspendPayload) => {
|
|
700
672
|
},
|
|
@@ -754,7 +726,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
754
726
|
untilDate: date,
|
|
755
727
|
durationMs: date ? Math.max(0, date.getTime() - Date.now()) : void 0,
|
|
756
728
|
sleepType: fn ? "dynamic" : "fixed"
|
|
757
|
-
}
|
|
729
|
+
},
|
|
730
|
+
tracingPolicy: this.options?.tracingPolicy
|
|
758
731
|
});
|
|
759
732
|
if (fn) {
|
|
760
733
|
date = await this.inngestStep.run(`workflow.${workflowId}.sleepUntil.${entry.id}`, async () => {
|
|
@@ -770,16 +743,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
770
743
|
currentSpan: sleepUntilSpan
|
|
771
744
|
},
|
|
772
745
|
getInitData: () => stepResults?.input,
|
|
773
|
-
getStepResult: (
|
|
774
|
-
if (!step?.id) {
|
|
775
|
-
return null;
|
|
776
|
-
}
|
|
777
|
-
const result = stepResults[step.id];
|
|
778
|
-
if (result?.status === "success") {
|
|
779
|
-
return result.output;
|
|
780
|
-
}
|
|
781
|
-
return null;
|
|
782
|
-
},
|
|
746
|
+
getStepResult: workflows.getStepResult.bind(this, stepResults),
|
|
783
747
|
// TODO: this function shouldn't have suspend probably?
|
|
784
748
|
suspend: async (_suspendPayload) => {
|
|
785
749
|
},
|
|
@@ -804,6 +768,9 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
804
768
|
)
|
|
805
769
|
});
|
|
806
770
|
});
|
|
771
|
+
if (date && !(date instanceof Date)) {
|
|
772
|
+
date = new Date(date);
|
|
773
|
+
}
|
|
807
774
|
const time = !date ? 0 : date.getTime() - Date.now();
|
|
808
775
|
sleepUntilSpan?.update({
|
|
809
776
|
attributes: {
|
|
@@ -852,7 +819,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
852
819
|
input: prevOutput,
|
|
853
820
|
attributes: {
|
|
854
821
|
stepId: step.id
|
|
855
|
-
}
|
|
822
|
+
},
|
|
823
|
+
tracingPolicy: this.options?.tracingPolicy
|
|
856
824
|
});
|
|
857
825
|
const startedAt = await this.inngestStep.run(
|
|
858
826
|
`workflow.${executionContext.workflowId}.run.${executionContext.runId}.step.${step.id}.running_ev`,
|
|
@@ -1078,13 +1046,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1078
1046
|
currentSpan: stepAISpan
|
|
1079
1047
|
},
|
|
1080
1048
|
getInitData: () => stepResults?.input,
|
|
1081
|
-
getStepResult: (
|
|
1082
|
-
const result2 = stepResults[step2.id];
|
|
1083
|
-
if (result2?.status === "success") {
|
|
1084
|
-
return result2.output;
|
|
1085
|
-
}
|
|
1086
|
-
return null;
|
|
1087
|
-
},
|
|
1049
|
+
getStepResult: workflows.getStepResult.bind(this, stepResults),
|
|
1088
1050
|
suspend: async (suspendPayload) => {
|
|
1089
1051
|
executionContext.suspendedPaths[step.id] = executionContext.executionPath;
|
|
1090
1052
|
suspended = { payload: suspendPayload };
|
|
@@ -1213,6 +1175,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1213
1175
|
workflowId,
|
|
1214
1176
|
runId,
|
|
1215
1177
|
stepResults,
|
|
1178
|
+
resourceId,
|
|
1216
1179
|
executionContext,
|
|
1217
1180
|
serializedStepGraph,
|
|
1218
1181
|
workflowStatus,
|
|
@@ -1225,6 +1188,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1225
1188
|
await this.mastra?.getStorage()?.persistWorkflowSnapshot({
|
|
1226
1189
|
workflowName: workflowId,
|
|
1227
1190
|
runId,
|
|
1191
|
+
resourceId,
|
|
1228
1192
|
snapshot: {
|
|
1229
1193
|
runId,
|
|
1230
1194
|
value: {},
|
|
@@ -1266,7 +1230,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1266
1230
|
input: prevOutput,
|
|
1267
1231
|
attributes: {
|
|
1268
1232
|
conditionCount: entry.conditions.length
|
|
1269
|
-
}
|
|
1233
|
+
},
|
|
1234
|
+
tracingPolicy: this.options?.tracingPolicy
|
|
1270
1235
|
});
|
|
1271
1236
|
let execResults;
|
|
1272
1237
|
const truthyIndexes = (await Promise.all(
|
|
@@ -1278,7 +1243,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1278
1243
|
input: prevOutput,
|
|
1279
1244
|
attributes: {
|
|
1280
1245
|
conditionIndex: index
|
|
1281
|
-
}
|
|
1246
|
+
},
|
|
1247
|
+
tracingPolicy: this.options?.tracingPolicy
|
|
1282
1248
|
});
|
|
1283
1249
|
try {
|
|
1284
1250
|
const result = await cond({
|
|
@@ -1292,16 +1258,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
|
|
|
1292
1258
|
currentSpan: evalSpan
|
|
1293
1259
|
},
|
|
1294
1260
|
getInitData: () => stepResults?.input,
|
|
1295
|
-
getStepResult: (
|
|
1296
|
-
if (!step?.id) {
|
|
1297
|
-
return null;
|
|
1298
|
-
}
|
|
1299
|
-
const result2 = stepResults[step.id];
|
|
1300
|
-
if (result2?.status === "success") {
|
|
1301
|
-
return result2.output;
|
|
1302
|
-
}
|
|
1303
|
-
return null;
|
|
1304
|
-
},
|
|
1261
|
+
getStepResult: workflows.getStepResult.bind(this, stepResults),
|
|
1305
1262
|
// TODO: this function shouldn't have suspend probably?
|
|
1306
1263
|
suspend: async (_suspendPayload) => {
|
|
1307
1264
|
},
|