@mastra/inngest 0.0.0-fix-persist-session-cache-option-mcp-server-20251031154006 → 0.0.0-fix-9244-clickhouse-metadata-20251104213434

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 CHANGED
@@ -1,15 +1,32 @@
1
1
  # @mastra/inngest
2
2
 
3
- ## 0.0.0-fix-persist-session-cache-option-mcp-server-20251031154006
3
+ ## 0.0.0-fix-9244-clickhouse-metadata-20251104213434
4
4
 
5
5
  ### Major Changes
6
6
 
7
+ - Moving scorers under the eval domain, api method consistency, prebuilt evals, scorers require ids. ([#9589](https://github.com/mastra-ai/mastra/pull/9589))
8
+
7
9
  - Rename RuntimeContext to RequestContext ([#9511](https://github.com/mastra-ai/mastra/pull/9511))
8
10
 
11
+ - **Breaking Change**: Remove legacy v1 watch events and consolidate on v2 implementation. ([#9252](https://github.com/mastra-ai/mastra/pull/9252))
12
+
13
+ This change simplifies the workflow watching API by removing the legacy v1 event system and promoting v2 as the standard (renamed to just `watch`).
14
+
15
+ ### What's Changed
16
+ - Removed legacy v1 watch event handlers and types
17
+ - Renamed `watch-v2` to `watch` throughout the codebase
18
+ - Removed `.watch()` method from client-js SDK (`Workflow` and `AgentBuilder` classes)
19
+ - Removed `/watch` HTTP endpoints from server and deployer
20
+ - Removed `WorkflowWatchResult` and v1 `WatchEvent` types
21
+
9
22
  - Changing getAgents -> listAgents, getTools -> listTools, getWorkflows -> listWorkflows ([#9495](https://github.com/mastra-ai/mastra/pull/9495))
10
23
 
11
24
  - Removed old tracing code based on OpenTelemetry ([#9237](https://github.com/mastra-ai/mastra/pull/9237))
12
25
 
26
+ - Mark as stable ([`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc))
27
+
28
+ - moved ai-tracing code into @mastra/observability ([#9661](https://github.com/mastra-ai/mastra/pull/9661))
29
+
13
30
  - Remove legacy evals from Mastra ([#9491](https://github.com/mastra-ai/mastra/pull/9491))
14
31
 
15
32
  ### Minor Changes
@@ -40,14 +57,60 @@
40
57
 
41
58
  - Fix Inngest workflow tests by adding missing imports and updating middleware path. ([#9259](https://github.com/mastra-ai/mastra/pull/9259))
42
59
 
60
+ - Update tool execution signature ([#9587](https://github.com/mastra-ai/mastra/pull/9587))
61
+
62
+ Consolidated the 3 different execution contexts to one
63
+
64
+ ```typescript
65
+ // before depending on the context the tool was executed in
66
+ tool.execute({ context: data });
67
+ tool.execute({ context: { inputData: data } });
68
+ tool.execute(data);
69
+
70
+ // now, for all contexts
71
+ tool.execute(data, context);
72
+ ```
73
+
74
+ **Before:**
75
+
76
+ ```typescript
77
+ inputSchema: z.object({ something: z.string() }),
78
+ execute: async ({ context, tracingContext, runId, ... }) => {
79
+ return doSomething(context.string);
80
+ }
81
+ ```
82
+
83
+ **After:**
84
+
85
+ ```typescript
86
+ inputSchema: z.object({ something: z.string() }),
87
+ execute: async (inputData, context) => {
88
+ const { agent, mcp, workflow, ...sharedContext } = context
89
+
90
+ // context that only an agent would get like toolCallId, messages, suspend, resume, etc
91
+ if (agent) {
92
+ doSomething(inputData.something, agent)
93
+ // context that only a workflow would get like runId, state, suspend, resume, etc
94
+ } else if (workflow) {
95
+ doSomething(inputData.something, workflow)
96
+ // context that only a workflow would get like "extra", "elicitation"
97
+ } else if (mcp) {
98
+ doSomething(inputData.something, mcp)
99
+ } else {
100
+ // Running a tool in no execution context
101
+ return doSomething(inputData.something);
102
+ }
103
+ }
104
+ ```
105
+
43
106
  - Add tool call approval ([#8649](https://github.com/mastra-ai/mastra/pull/8649))
44
107
 
45
108
  - Added support for .streamVNext and .stream that uses it in the inngest execution engine ([#9434](https://github.com/mastra-ai/mastra/pull/9434))
46
109
 
47
110
  - Prevent changing workflow status to suspended when some parallel steps are still running ([#9431](https://github.com/mastra-ai/mastra/pull/9431))
48
111
 
49
- - Updated dependencies [[`f743dbb`](https://github.com/mastra-ai/mastra/commit/f743dbb8b40d1627b5c10c0e6fc154f4ebb6e394), [`0e8ed46`](https://github.com/mastra-ai/mastra/commit/0e8ed467c54d6901a6a365f270ec15d6faadb36c), [`6c049d9`](https://github.com/mastra-ai/mastra/commit/6c049d94063fdcbd5b81c4912a2bf82a92c9cc0b), [`3443770`](https://github.com/mastra-ai/mastra/commit/3443770662df8eb24c9df3589b2792d78cfcb811), [`9e1911d`](https://github.com/mastra-ai/mastra/commit/9e1911db2b4db85e0e768c3f15e0d61e319869f6), [`ebac155`](https://github.com/mastra-ai/mastra/commit/ebac15564a590117db7078233f927a7e28a85106), [`5948e6a`](https://github.com/mastra-ai/mastra/commit/5948e6a5146c83666ba3f294b2be576c82a513fb), [`8940859`](https://github.com/mastra-ai/mastra/commit/89408593658199b4ad67f7b65e888f344e64a442), [`e629310`](https://github.com/mastra-ai/mastra/commit/e629310f1a73fa236d49ec7a1d1cceb6229dc7cc), [`4c6b492`](https://github.com/mastra-ai/mastra/commit/4c6b492c4dd591c6a592520c1f6855d6e936d71f), [`9d819d5`](https://github.com/mastra-ai/mastra/commit/9d819d54b61481639f4008e4694791bddf187edd), [`71c8d6c`](https://github.com/mastra-ai/mastra/commit/71c8d6c161253207b2b9588bdadb7eed604f7253), [`6179a9b`](https://github.com/mastra-ai/mastra/commit/6179a9ba36ffac326de3cc3c43cdc8028d37c251), [`7051bf3`](https://github.com/mastra-ai/mastra/commit/7051bf38b3b122a069008f861f7bfc004a6d9f6e), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`c576fc0`](https://github.com/mastra-ai/mastra/commit/c576fc0b100b2085afded91a37c97a0ea0ec09c7), [`9f4a683`](https://github.com/mastra-ai/mastra/commit/9f4a6833e88b52574665c028fd5508ad5c2f6004), [`57d157f`](https://github.com/mastra-ai/mastra/commit/57d157f0b163a95c3e6c9eae31bdb11d1bfc64f9), [`2a90c55`](https://github.com/mastra-ai/mastra/commit/2a90c55a86a9210697d5adaab5ee94584b079adc), [`d78b38d`](https://github.com/mastra-ai/mastra/commit/d78b38d898fce285260d3bbb4befade54331617f), [`c710c16`](https://github.com/mastra-ai/mastra/commit/c710c1652dccfdc4111c8412bca7a6bb1d48b441), [`cfae733`](https://github.com/mastra-ai/mastra/commit/cfae73394f4920635e6c919c8e95ff9a0788e2e5), [`e3dfda7`](https://github.com/mastra-ai/mastra/commit/e3dfda7b11bf3b8c4bb55637028befb5f387fc74), [`844ea5d`](https://github.com/mastra-ai/mastra/commit/844ea5dc0c248961e7bf73629ae7dcff503e853c), [`f0f8f12`](https://github.com/mastra-ai/mastra/commit/f0f8f125c308f2d0fd36942ef652fd852df7522f), [`7b763e5`](https://github.com/mastra-ai/mastra/commit/7b763e52fc3eaf699c2a99f2adf418dd46e4e9a5), [`d36cfbb`](https://github.com/mastra-ai/mastra/commit/d36cfbbb6565ba5f827883cc9bb648eb14befdc1), [`3697853`](https://github.com/mastra-ai/mastra/commit/3697853deeb72017d90e0f38a93c1e29221aeca0), [`a534e95`](https://github.com/mastra-ai/mastra/commit/a534e9591f83b3cc1ebff99c67edf4cda7bf81d3), [`9d0e7fe`](https://github.com/mastra-ai/mastra/commit/9d0e7feca8ed98de959f53476ee1456073673348), [`53d927c`](https://github.com/mastra-ai/mastra/commit/53d927cc6f03bff33655b7e2b788da445a08731d), [`22f64bc`](https://github.com/mastra-ai/mastra/commit/22f64bc1d37149480b58bf2fefe35b79a1e3e7d5), [`bda6370`](https://github.com/mastra-ai/mastra/commit/bda637009360649aaf579919e7873e33553c273e), [`c7f1f7d`](https://github.com/mastra-ai/mastra/commit/c7f1f7d24f61f247f018cc2d1f33bf63212959a7), [`735d8c1`](https://github.com/mastra-ai/mastra/commit/735d8c1c0d19fbc09e6f8b66cf41bc7655993838), [`c218bd3`](https://github.com/mastra-ai/mastra/commit/c218bd3759e32423735b04843a09404572631014), [`2c4438b`](https://github.com/mastra-ai/mastra/commit/2c4438b87817ab7eed818c7990fef010475af1a3), [`2b8893c`](https://github.com/mastra-ai/mastra/commit/2b8893cb108ef9acb72ee7835cd625610d2c1a4a), [`8e5c75b`](https://github.com/mastra-ai/mastra/commit/8e5c75bdb1d08a42d45309a4c72def4b6890230f), [`fa8409b`](https://github.com/mastra-ai/mastra/commit/fa8409bc39cfd8ba6643b9db5269b90b22e2a2f7), [`173c535`](https://github.com/mastra-ai/mastra/commit/173c535c0645b0da404fe09f003778f0b0d4e019)]:
50
- - @mastra/core@0.0.0-fix-persist-session-cache-option-mcp-server-20251031154006
112
+ - Updated dependencies [[`f743dbb`](https://github.com/mastra-ai/mastra/commit/f743dbb8b40d1627b5c10c0e6fc154f4ebb6e394), [`fec5129`](https://github.com/mastra-ai/mastra/commit/fec5129de7fc64423ea03661a56cef31dc747a0d), [`0e8ed46`](https://github.com/mastra-ai/mastra/commit/0e8ed467c54d6901a6a365f270ec15d6faadb36c), [`6c049d9`](https://github.com/mastra-ai/mastra/commit/6c049d94063fdcbd5b81c4912a2bf82a92c9cc0b), [`3443770`](https://github.com/mastra-ai/mastra/commit/3443770662df8eb24c9df3589b2792d78cfcb811), [`f0a07e0`](https://github.com/mastra-ai/mastra/commit/f0a07e0111b3307c5fabfa4094c5c2cfb734fbe6), [`1521d71`](https://github.com/mastra-ai/mastra/commit/1521d716e5daedc74690c983fbd961123c56756b), [`9e1911d`](https://github.com/mastra-ai/mastra/commit/9e1911db2b4db85e0e768c3f15e0d61e319869f6), [`ebac155`](https://github.com/mastra-ai/mastra/commit/ebac15564a590117db7078233f927a7e28a85106), [`5948e6a`](https://github.com/mastra-ai/mastra/commit/5948e6a5146c83666ba3f294b2be576c82a513fb), [`8940859`](https://github.com/mastra-ai/mastra/commit/89408593658199b4ad67f7b65e888f344e64a442), [`e629310`](https://github.com/mastra-ai/mastra/commit/e629310f1a73fa236d49ec7a1d1cceb6229dc7cc), [`4c6b492`](https://github.com/mastra-ai/mastra/commit/4c6b492c4dd591c6a592520c1f6855d6e936d71f), [`dff01d8`](https://github.com/mastra-ai/mastra/commit/dff01d81ce1f4e4087cfac20fa868e6db138dd14), [`9d819d5`](https://github.com/mastra-ai/mastra/commit/9d819d54b61481639f4008e4694791bddf187edd), [`71c8d6c`](https://github.com/mastra-ai/mastra/commit/71c8d6c161253207b2b9588bdadb7eed604f7253), [`6179a9b`](https://github.com/mastra-ai/mastra/commit/6179a9ba36ffac326de3cc3c43cdc8028d37c251), [`00f4921`](https://github.com/mastra-ai/mastra/commit/00f4921dd2c91a1e5446799599ef7116a8214a1a), [`7051bf3`](https://github.com/mastra-ai/mastra/commit/7051bf38b3b122a069008f861f7bfc004a6d9f6e), [`a8f1494`](https://github.com/mastra-ai/mastra/commit/a8f1494f4bbdc2770bcf327d4c7d869e332183f1), [`0793497`](https://github.com/mastra-ai/mastra/commit/079349753620c40246ffd673e3f9d7d9820beff3), [`5df9cce`](https://github.com/mastra-ai/mastra/commit/5df9cce1a753438413f64c11eeef8f845745c2a8), [`a854ede`](https://github.com/mastra-ai/mastra/commit/a854ede62bf5ac0945a624ac48913dd69c73aabf), [`c576fc0`](https://github.com/mastra-ai/mastra/commit/c576fc0b100b2085afded91a37c97a0ea0ec09c7), [`3defc80`](https://github.com/mastra-ai/mastra/commit/3defc80cf2b88a1b7fc1cc4ddcb91e982a614609), [`16153fe`](https://github.com/mastra-ai/mastra/commit/16153fe7eb13c99401f48e6ca32707c965ee28b9), [`9f4a683`](https://github.com/mastra-ai/mastra/commit/9f4a6833e88b52574665c028fd5508ad5c2f6004), [`bc94344`](https://github.com/mastra-ai/mastra/commit/bc943444a1342d8a662151b7bce1df7dae32f59c), [`57d157f`](https://github.com/mastra-ai/mastra/commit/57d157f0b163a95c3e6c9eae31bdb11d1bfc64f9), [`2a90c55`](https://github.com/mastra-ai/mastra/commit/2a90c55a86a9210697d5adaab5ee94584b079adc), [`96d35f6`](https://github.com/mastra-ai/mastra/commit/96d35f61376bc2b1bf148648a2c1985bd51bef55), [`5cbe88a`](https://github.com/mastra-ai/mastra/commit/5cbe88aefbd9f933bca669fd371ea36bf939ac6d), [`a1bd7b8`](https://github.com/mastra-ai/mastra/commit/a1bd7b8571db16b94eb01588f451a74758c96d65), [`d78b38d`](https://github.com/mastra-ai/mastra/commit/d78b38d898fce285260d3bbb4befade54331617f), [`0633100`](https://github.com/mastra-ai/mastra/commit/0633100a911ad22f5256471bdf753da21c104742), [`c710c16`](https://github.com/mastra-ai/mastra/commit/c710c1652dccfdc4111c8412bca7a6bb1d48b441), [`cfae733`](https://github.com/mastra-ai/mastra/commit/cfae73394f4920635e6c919c8e95ff9a0788e2e5), [`e3dfda7`](https://github.com/mastra-ai/mastra/commit/e3dfda7b11bf3b8c4bb55637028befb5f387fc74), [`844ea5d`](https://github.com/mastra-ai/mastra/commit/844ea5dc0c248961e7bf73629ae7dcff503e853c), [`f0f8f12`](https://github.com/mastra-ai/mastra/commit/f0f8f125c308f2d0fd36942ef652fd852df7522f), [`0d7618b`](https://github.com/mastra-ai/mastra/commit/0d7618bc650bf2800934b243eca5648f4aeed9c2), [`7b763e5`](https://github.com/mastra-ai/mastra/commit/7b763e52fc3eaf699c2a99f2adf418dd46e4e9a5), [`d36cfbb`](https://github.com/mastra-ai/mastra/commit/d36cfbbb6565ba5f827883cc9bb648eb14befdc1), [`3697853`](https://github.com/mastra-ai/mastra/commit/3697853deeb72017d90e0f38a93c1e29221aeca0), [`a534e95`](https://github.com/mastra-ai/mastra/commit/a534e9591f83b3cc1ebff99c67edf4cda7bf81d3), [`9d0e7fe`](https://github.com/mastra-ai/mastra/commit/9d0e7feca8ed98de959f53476ee1456073673348), [`53d927c`](https://github.com/mastra-ai/mastra/commit/53d927cc6f03bff33655b7e2b788da445a08731d), [`22f64bc`](https://github.com/mastra-ai/mastra/commit/22f64bc1d37149480b58bf2fefe35b79a1e3e7d5), [`83d5942`](https://github.com/mastra-ai/mastra/commit/83d5942669ce7bba4a6ca4fd4da697a10eb5ebdc), [`bda6370`](https://github.com/mastra-ai/mastra/commit/bda637009360649aaf579919e7873e33553c273e), [`d7acd8e`](https://github.com/mastra-ai/mastra/commit/d7acd8e987b5d7eff4fd98b0906c17c06a2e83d5), [`c7f1f7d`](https://github.com/mastra-ai/mastra/commit/c7f1f7d24f61f247f018cc2d1f33bf63212959a7), [`0bddc6d`](https://github.com/mastra-ai/mastra/commit/0bddc6d8dbd6f6008c0cba2e4960a2da75a55af1), [`735d8c1`](https://github.com/mastra-ai/mastra/commit/735d8c1c0d19fbc09e6f8b66cf41bc7655993838), [`acf322e`](https://github.com/mastra-ai/mastra/commit/acf322e0f1fd0189684cf529d91c694bea918a45), [`c942802`](https://github.com/mastra-ai/mastra/commit/c942802a477a925b01859a7b8688d4355715caaa), [`a0c8c1b`](https://github.com/mastra-ai/mastra/commit/a0c8c1b87d4fee252aebda73e8637fbe01d761c9), [`cc34739`](https://github.com/mastra-ai/mastra/commit/cc34739c34b6266a91bea561119240a7acf47887), [`c218bd3`](https://github.com/mastra-ai/mastra/commit/c218bd3759e32423735b04843a09404572631014), [`2c4438b`](https://github.com/mastra-ai/mastra/commit/2c4438b87817ab7eed818c7990fef010475af1a3), [`2b8893c`](https://github.com/mastra-ai/mastra/commit/2b8893cb108ef9acb72ee7835cd625610d2c1a4a), [`8e5c75b`](https://github.com/mastra-ai/mastra/commit/8e5c75bdb1d08a42d45309a4c72def4b6890230f), [`fa8409b`](https://github.com/mastra-ai/mastra/commit/fa8409bc39cfd8ba6643b9db5269b90b22e2a2f7), [`173c535`](https://github.com/mastra-ai/mastra/commit/173c535c0645b0da404fe09f003778f0b0d4e019)]:
113
+ - @mastra/core@0.0.0-fix-9244-clickhouse-metadata-20251104213434
51
114
 
52
115
  ## 0.17.0
53
116
 
package/dist/index.cjs CHANGED
@@ -3,8 +3,8 @@
3
3
  var crypto = require('crypto');
4
4
  var web = require('stream/web');
5
5
  var realtime = require('@inngest/realtime');
6
- var aiTracing = require('@mastra/core/ai-tracing');
7
6
  var di = require('@mastra/core/di');
7
+ var observability = require('@mastra/core/observability');
8
8
  var stream = require('@mastra/core/stream');
9
9
  var tools = require('@mastra/core/tools');
10
10
  var workflows = require('@mastra/core/workflows');
@@ -59,11 +59,12 @@ var InngestRun = class extends workflows.Run {
59
59
  }
60
60
  async getRunOutput(eventId) {
61
61
  let runs = await this.getRuns(eventId);
62
+ const storage = this.#mastra?.getStorage();
62
63
  while (runs?.[0]?.status !== "Completed" || runs?.[0]?.event_id !== eventId) {
63
64
  await new Promise((resolve) => setTimeout(resolve, 1e3));
64
65
  runs = await this.getRuns(eventId);
65
66
  if (runs?.[0]?.status === "Failed") {
66
- const snapshot = await this.#mastra?.storage?.loadWorkflowSnapshot({
67
+ const snapshot = await storage?.loadWorkflowSnapshot({
67
68
  workflowName: this.workflowId,
68
69
  runId: this.runId
69
70
  });
@@ -72,7 +73,7 @@ var InngestRun = class extends workflows.Run {
72
73
  };
73
74
  }
74
75
  if (runs?.[0]?.status === "Cancelled") {
75
- const snapshot = await this.#mastra?.storage?.loadWorkflowSnapshot({
76
+ const snapshot = await storage?.loadWorkflowSnapshot({
76
77
  workflowName: this.workflowId,
77
78
  runId: this.runId
78
79
  });
@@ -88,18 +89,19 @@ var InngestRun = class extends workflows.Run {
88
89
  });
89
90
  }
90
91
  async cancel() {
92
+ const storage = this.#mastra?.getStorage();
91
93
  await this.inngest.send({
92
94
  name: `cancel.workflow.${this.workflowId}`,
93
95
  data: {
94
96
  runId: this.runId
95
97
  }
96
98
  });
97
- const snapshot = await this.#mastra?.storage?.loadWorkflowSnapshot({
99
+ const snapshot = await storage?.loadWorkflowSnapshot({
98
100
  workflowName: this.workflowId,
99
101
  runId: this.runId
100
102
  });
101
103
  if (snapshot) {
102
- await this.#mastra?.storage?.persistWorkflowSnapshot({
104
+ await storage?.persistWorkflowSnapshot({
103
105
  workflowName: this.workflowId,
104
106
  runId: this.runId,
105
107
  resourceId: this.resourceId,
@@ -177,10 +179,11 @@ var InngestRun = class extends workflows.Run {
177
179
  return p;
178
180
  }
179
181
  async _resume(params) {
182
+ const storage = this.#mastra?.getStorage();
180
183
  const steps = (Array.isArray(params.step) ? params.step : [params.step]).map(
181
184
  (step) => typeof step === "string" ? step : step?.id
182
185
  );
183
- const snapshot = await this.#mastra?.storage?.loadWorkflowSnapshot({
186
+ const snapshot = await storage?.loadWorkflowSnapshot({
184
187
  workflowName: this.workflowId,
185
188
  runId: this.runId
186
189
  });
@@ -214,12 +217,12 @@ var InngestRun = class extends workflows.Run {
214
217
  }
215
218
  return result;
216
219
  }
217
- watch(cb, type = "watch") {
220
+ watch(cb) {
218
221
  let active = true;
219
222
  const streamPromise = realtime.subscribe(
220
223
  {
221
224
  channel: `workflow:${this.workflowId}:${this.runId}`,
222
- topics: [type],
225
+ topics: ["watch"],
223
226
  app: this.inngest
224
227
  },
225
228
  (message) => {
@@ -259,7 +262,7 @@ var InngestRun = class extends workflows.Run {
259
262
  await writer.write(e);
260
263
  } catch {
261
264
  }
262
- }, "watch-v2");
265
+ });
263
266
  this.closeStreamAction = async () => {
264
267
  await writer.write({
265
268
  type: "finish",
@@ -313,7 +316,7 @@ var InngestRun = class extends workflows.Run {
313
316
  ...payload
314
317
  }
315
318
  });
316
- }, "watch-v2");
319
+ });
317
320
  self.closeStreamAction = async () => {
318
321
  unwatch();
319
322
  try {
@@ -379,13 +382,13 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
379
382
  this.#mastra = params.mastra;
380
383
  this.inngest = inngest;
381
384
  }
382
- async getWorkflowRuns(args) {
385
+ async listWorkflowRuns(args) {
383
386
  const storage = this.#mastra?.getStorage();
384
387
  if (!storage) {
385
388
  this.logger.debug("Cannot get workflow runs. Mastra engine is not initialized");
386
389
  return { runs: [], total: 0 };
387
390
  }
388
- return storage.getWorkflowRuns({ workflowName: this.id, ...args ?? {} });
391
+ return storage.listWorkflowRuns({ workflowName: this.id, ...args ?? {} });
389
392
  }
390
393
  async getWorkflowRunById(runId) {
391
394
  const storage = this.#mastra?.getStorage();
@@ -414,16 +417,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
414
417
  }
415
418
  }
416
419
  }
417
- /**
418
- * @deprecated Use createRunAsync() instead.
419
- * @throws {Error} Always throws an error directing users to use createRunAsync()
420
- */
421
- createRun(_options) {
422
- throw new Error(
423
- "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."
424
- );
425
- }
426
- async createRunAsync(options) {
420
+ async createRun(options) {
427
421
  const runIdToUse = options?.runId || crypto.randomUUID();
428
422
  const run = this.runs.get(runIdToUse) ?? new InngestRun(
429
423
  {
@@ -533,7 +527,7 @@ var InngestWorkflow = class _InngestWorkflow extends workflows.Workflow {
533
527
  outputOptions,
534
528
  writableStream: new WritableStream({
535
529
  write(chunk) {
536
- void emitter.emit("watch-v2", chunk).catch(() => {
530
+ void emitter.emit("watch", chunk).catch(() => {
537
531
  });
538
532
  }
539
533
  })
@@ -637,20 +631,20 @@ function createStep(params, agentOptions) {
637
631
  stream = modelOutput.fullStream;
638
632
  }
639
633
  if (streamFormat === "legacy") {
640
- await emitter.emit("watch-v2", {
634
+ await emitter.emit("watch", {
641
635
  type: "tool-call-streaming-start",
642
636
  ...toolData ?? {}
643
637
  });
644
638
  for await (const chunk of stream) {
645
639
  if (chunk.type === "text-delta") {
646
- await emitter.emit("watch-v2", {
640
+ await emitter.emit("watch", {
647
641
  type: "tool-call-delta",
648
642
  ...toolData ?? {},
649
643
  argsTextDelta: chunk.textDelta
650
644
  });
651
645
  }
652
646
  }
653
- await emitter.emit("watch-v2", {
647
+ await emitter.emit("watch", {
654
648
  type: "tool-call-streaming-finish",
655
649
  ...toolData ?? {}
656
650
  });
@@ -683,7 +677,7 @@ function createStep(params, agentOptions) {
683
677
  execute: async ({ inputData, mastra, requestContext, tracingContext, suspend, resumeData }) => {
684
678
  return params.execute({
685
679
  context: inputData,
686
- mastra: aiTracing.wrapMastra(mastra, tracingContext),
680
+ mastra: observability.wrapMastra(mastra, tracingContext),
687
681
  requestContext,
688
682
  tracingContext,
689
683
  suspend,
@@ -753,45 +747,10 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
753
747
  steps: stepResults
754
748
  };
755
749
  if (lastOutput.status === "success") {
756
- await emitter.emit("watch", {
757
- type: "watch",
758
- payload: {
759
- workflowState: {
760
- status: lastOutput.status,
761
- steps: stepResults,
762
- result: lastOutput.output
763
- }
764
- },
765
- eventTimestamp: Date.now()
766
- });
767
750
  base.result = lastOutput.output;
768
751
  } else if (lastOutput.status === "failed") {
769
752
  base.error = error instanceof Error ? error?.stack ?? error.message : lastOutput?.error instanceof Error ? lastOutput.error.message : lastOutput.error ?? error ?? "Unknown error";
770
- await emitter.emit("watch", {
771
- type: "watch",
772
- payload: {
773
- workflowState: {
774
- status: lastOutput.status,
775
- steps: stepResults,
776
- result: null,
777
- error: base.error
778
- }
779
- },
780
- eventTimestamp: Date.now()
781
- });
782
753
  } else if (lastOutput.status === "suspended") {
783
- await emitter.emit("watch", {
784
- type: "watch",
785
- payload: {
786
- workflowState: {
787
- status: lastOutput.status,
788
- steps: stepResults,
789
- result: null,
790
- error: null
791
- }
792
- },
793
- eventTimestamp: Date.now()
794
- });
795
754
  const suspendedStepIds = Object.entries(stepResults).flatMap(([stepId, stepResult]) => {
796
755
  if (stepResult?.status === "suspended") {
797
756
  const nestedPath = stepResult?.suspendPayload?.__workflow_meta?.path;
@@ -821,7 +780,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
821
780
  }) {
822
781
  let { duration, fn } = entry;
823
782
  const sleepSpan = tracingContext?.currentSpan?.createChildSpan({
824
- type: aiTracing.AISpanType.WORKFLOW_SLEEP,
783
+ type: observability.AISpanType.WORKFLOW_SLEEP,
825
784
  name: `sleep: ${duration ? `${duration}ms` : "dynamic"}`,
826
785
  attributes: {
827
786
  durationMs: duration,
@@ -844,7 +803,6 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
844
803
  setState: (state) => {
845
804
  executionContext.state = state;
846
805
  },
847
- runCount: -1,
848
806
  retryCount: -1,
849
807
  tracingContext: {
850
808
  currentSpan: sleepSpan
@@ -910,7 +868,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
910
868
  }) {
911
869
  let { date, fn } = entry;
912
870
  const sleepUntilSpan = tracingContext?.currentSpan?.createChildSpan({
913
- type: aiTracing.AISpanType.WORKFLOW_SLEEP,
871
+ type: observability.AISpanType.WORKFLOW_SLEEP,
914
872
  name: `sleepUntil: ${date ? date.toISOString() : "dynamic"}`,
915
873
  attributes: {
916
874
  untilDate: date,
@@ -934,7 +892,6 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
934
892
  setState: (state) => {
935
893
  executionContext.state = state;
936
894
  },
937
- runCount: -1,
938
895
  retryCount: -1,
939
896
  tracingContext: {
940
897
  currentSpan: sleepUntilSpan
@@ -1018,7 +975,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1018
975
  }) {
1019
976
  const stepAISpan = tracingContext?.currentSpan?.createChildSpan({
1020
977
  name: `workflow step: '${step.id}'`,
1021
- type: aiTracing.AISpanType.WORKFLOW_STEP,
978
+ type: observability.AISpanType.WORKFLOW_STEP,
1022
979
  input: prevOutput,
1023
980
  attributes: {
1024
981
  stepId: step.id
@@ -1035,27 +992,6 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1035
992
  async () => {
1036
993
  const startedAt2 = Date.now();
1037
994
  await emitter.emit("watch", {
1038
- type: "watch",
1039
- payload: {
1040
- currentStep: {
1041
- id: step.id,
1042
- status: "running"
1043
- },
1044
- workflowState: {
1045
- status: "running",
1046
- steps: {
1047
- ...stepResults,
1048
- [step.id]: {
1049
- status: "running"
1050
- }
1051
- },
1052
- result: null,
1053
- error: null
1054
- }
1055
- },
1056
- eventTimestamp: Date.now()
1057
- });
1058
- await emitter.emit("watch-v2", {
1059
995
  type: "workflow-step-start",
1060
996
  payload: {
1061
997
  id: step.id,
@@ -1131,23 +1067,6 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1131
1067
  async () => {
1132
1068
  if (result.status === "failed") {
1133
1069
  await emitter.emit("watch", {
1134
- type: "watch",
1135
- payload: {
1136
- currentStep: {
1137
- id: step.id,
1138
- status: "failed",
1139
- error: result?.error
1140
- },
1141
- workflowState: {
1142
- status: "running",
1143
- steps: stepResults,
1144
- result: null,
1145
- error: null
1146
- }
1147
- },
1148
- eventTimestamp: Date.now()
1149
- });
1150
- await emitter.emit("watch-v2", {
1151
1070
  type: "workflow-step-result",
1152
1071
  payload: {
1153
1072
  id: step.id,
@@ -1166,27 +1085,6 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1166
1085
  const suspendPath = [stepName, ...stepResult?.suspendPayload?.__workflow_meta?.path ?? []];
1167
1086
  executionContext.suspendedPaths[step.id] = executionContext.executionPath;
1168
1087
  await emitter.emit("watch", {
1169
- type: "watch",
1170
- payload: {
1171
- currentStep: {
1172
- id: step.id,
1173
- status: "suspended",
1174
- payload: stepResult.payload,
1175
- suspendPayload: {
1176
- ...stepResult?.suspendPayload,
1177
- __workflow_meta: { runId, path: suspendPath }
1178
- }
1179
- },
1180
- workflowState: {
1181
- status: "running",
1182
- steps: stepResults,
1183
- result: null,
1184
- error: null
1185
- }
1186
- },
1187
- eventTimestamp: Date.now()
1188
- });
1189
- await emitter.emit("watch-v2", {
1190
1088
  type: "workflow-step-suspended",
1191
1089
  payload: {
1192
1090
  id: step.id,
@@ -1205,23 +1103,6 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1205
1103
  }
1206
1104
  };
1207
1105
  }
1208
- await emitter.emit("watch", {
1209
- type: "watch",
1210
- payload: {
1211
- currentStep: {
1212
- id: step.id,
1213
- status: "suspended",
1214
- payload: {}
1215
- },
1216
- workflowState: {
1217
- status: "running",
1218
- steps: stepResults,
1219
- result: null,
1220
- error: null
1221
- }
1222
- },
1223
- eventTimestamp: Date.now()
1224
- });
1225
1106
  return {
1226
1107
  executionContext,
1227
1108
  result: {
@@ -1231,23 +1112,6 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1231
1112
  };
1232
1113
  }
1233
1114
  await emitter.emit("watch", {
1234
- type: "watch",
1235
- payload: {
1236
- currentStep: {
1237
- id: step.id,
1238
- status: "success",
1239
- output: result?.result
1240
- },
1241
- workflowState: {
1242
- status: "running",
1243
- steps: stepResults,
1244
- result: null,
1245
- error: null
1246
- }
1247
- },
1248
- eventTimestamp: Date.now()
1249
- });
1250
- await emitter.emit("watch-v2", {
1251
1115
  type: "workflow-step-result",
1252
1116
  payload: {
1253
1117
  id: step.id,
@@ -1255,7 +1119,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1255
1119
  output: result?.result
1256
1120
  }
1257
1121
  });
1258
- await emitter.emit("watch-v2", {
1122
+ await emitter.emit("watch", {
1259
1123
  type: "workflow-step-finish",
1260
1124
  payload: {
1261
1125
  id: step.id,
@@ -1385,24 +1249,8 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1385
1249
  startedAt
1386
1250
  };
1387
1251
  }
1388
- await emitter.emit("watch", {
1389
- type: "watch",
1390
- payload: {
1391
- currentStep: {
1392
- id: step.id,
1393
- ...execResults
1394
- },
1395
- workflowState: {
1396
- status: "running",
1397
- steps: { ...stepResults, [step.id]: execResults },
1398
- result: null,
1399
- error: null
1400
- }
1401
- },
1402
- eventTimestamp: Date.now()
1403
- });
1404
1252
  if (execResults.status === "suspended") {
1405
- await emitter.emit("watch-v2", {
1253
+ await emitter.emit("watch", {
1406
1254
  type: "workflow-step-suspended",
1407
1255
  payload: {
1408
1256
  id: step.id,
@@ -1410,14 +1258,14 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1410
1258
  }
1411
1259
  });
1412
1260
  } else {
1413
- await emitter.emit("watch-v2", {
1261
+ await emitter.emit("watch", {
1414
1262
  type: "workflow-step-result",
1415
1263
  payload: {
1416
1264
  id: step.id,
1417
1265
  ...execResults
1418
1266
  }
1419
1267
  });
1420
- await emitter.emit("watch-v2", {
1268
+ await emitter.emit("watch", {
1421
1269
  type: "workflow-step-finish",
1422
1270
  payload: {
1423
1271
  id: step.id,
@@ -1524,7 +1372,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1524
1372
  tracingContext
1525
1373
  }) {
1526
1374
  const conditionalSpan = tracingContext?.currentSpan?.createChildSpan({
1527
- type: aiTracing.AISpanType.WORKFLOW_CONDITIONAL,
1375
+ type: observability.AISpanType.WORKFLOW_CONDITIONAL,
1528
1376
  name: `conditional: '${entry.conditions.length} conditions'`,
1529
1377
  input: prevOutput,
1530
1378
  attributes: {
@@ -1537,7 +1385,7 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1537
1385
  entry.conditions.map(
1538
1386
  (cond, index) => this.inngestStep.run(`workflow.${workflowId}.conditional.${index}`, async () => {
1539
1387
  const evalSpan = conditionalSpan?.createChildSpan({
1540
- type: aiTracing.AISpanType.WORKFLOW_CONDITIONAL_EVAL,
1388
+ type: observability.AISpanType.WORKFLOW_CONDITIONAL_EVAL,
1541
1389
  name: `condition: '${index}'`,
1542
1390
  input: prevOutput,
1543
1391
  attributes: {
@@ -1553,7 +1401,6 @@ var InngestExecutionEngine = class extends workflows.DefaultExecutionEngine {
1553
1401
  workflowId,
1554
1402
  mastra: this.mastra,
1555
1403
  requestContext,
1556
- runCount: -1,
1557
1404
  retryCount: -1,
1558
1405
  inputData: prevOutput,
1559
1406
  state: executionContext.state,