@mastra/ai-sdk 0.3.2 → 0.3.3-alpha.0

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,5 +1,20 @@
1
1
  # @mastra/ai-sdk
2
2
 
3
+ ## 0.3.3-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Return NetworkDataPart on each agent-execution-event and workflow-execution-event in network streams ([#10979](https://github.com/mastra-ai/mastra/pull/10979))
8
+
9
+ - Fixed tool-call-suspended chunks being dropped in workflow-step-output when using AI SDK. Previously, when an agent inside a workflow step called a tool that got suspended, the tool-call-suspended chunk was not received on the frontend even though tool-input-available chunks were correctly received. ([#10988](https://github.com/mastra-ai/mastra/pull/10988))
10
+
11
+ The issue occurred because tool-call-suspended was not included in the isMastraTextStreamChunk list, causing it to be filtered out in transformWorkflow. Now tool-call-suspended, tool-call-approval, object, and tripwire chunks are properly included in the text stream chunk list and will be transformed and passed through correctly.
12
+
13
+ Fixes #10978
14
+
15
+ - Updated dependencies []:
16
+ - @mastra/core@0.24.7-alpha.3
17
+
3
18
  ## 0.3.2
4
19
 
5
20
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -22,6 +22,8 @@ var isMastraTextStreamChunk = (chunk) => {
22
22
  "source",
23
23
  "tool-input-start",
24
24
  "tool-input-delta",
25
+ "tool-call-approval",
26
+ "tool-call-suspended",
25
27
  "tool-call",
26
28
  "tool-result",
27
29
  "tool-error",
@@ -32,6 +34,8 @@ var isMastraTextStreamChunk = (chunk) => {
32
34
  "finish",
33
35
  "abort",
34
36
  "tool-input-end",
37
+ "object",
38
+ "tripwire",
35
39
  "raw"
36
40
  ].includes(chunk.type);
37
41
  };
@@ -1134,6 +1138,26 @@ function transformNetwork(payload, bufferedNetworks, isNested) {
1134
1138
  };
1135
1139
  }
1136
1140
  default: {
1141
+ if (isAgentExecutionDataChunkType(payload)) {
1142
+ if (!("data" in payload.payload)) {
1143
+ throw new Error(
1144
+ `UI Messages require a data property when using data- prefixed chunks
1145
+ ${JSON.stringify(payload)}`
1146
+ );
1147
+ }
1148
+ const { type, data } = payload.payload;
1149
+ return { type, data };
1150
+ }
1151
+ if (isWorkflowExecutionDataChunkType(payload)) {
1152
+ if (!("data" in payload.payload)) {
1153
+ throw new Error(
1154
+ `UI Messages require a data property when using data- prefixed chunks
1155
+ ${JSON.stringify(payload)}`
1156
+ );
1157
+ }
1158
+ const { type, data } = payload.payload;
1159
+ return { type, data };
1160
+ }
1137
1161
  if (payload.type.startsWith("agent-execution-event-")) {
1138
1162
  const stepId = payload.payload.runId;
1139
1163
  const current = bufferedNetworks.get(payload.runId);
@@ -1148,6 +1172,15 @@ function transformNetwork(payload, bufferedNetworks, isNested) {
1148
1172
  const { request, response, ...data } = result.data;
1149
1173
  step.task = data;
1150
1174
  }
1175
+ bufferedNetworks.set(payload.runId, current);
1176
+ return {
1177
+ type: isNested ? "data-tool-network" : "data-network",
1178
+ id: payload.runId,
1179
+ data: {
1180
+ ...current,
1181
+ status: "running"
1182
+ }
1183
+ };
1151
1184
  }
1152
1185
  if (payload.type.startsWith("workflow-execution-event-")) {
1153
1186
  const stepId = payload.payload.runId;
@@ -1166,6 +1199,15 @@ function transformNetwork(payload, bufferedNetworks, isNested) {
1166
1199
  step.task.id = data.name;
1167
1200
  }
1168
1201
  }
1202
+ bufferedNetworks.set(payload.runId, current);
1203
+ return {
1204
+ type: isNested ? "data-tool-network" : "data-network",
1205
+ id: payload.runId,
1206
+ data: {
1207
+ ...current,
1208
+ status: "running"
1209
+ }
1210
+ };
1169
1211
  }
1170
1212
  if (isDataChunkType(payload)) {
1171
1213
  if (!("data" in payload)) {
@@ -1177,26 +1219,6 @@ function transformNetwork(payload, bufferedNetworks, isNested) {
1177
1219
  const { type, data } = payload;
1178
1220
  return { type, data };
1179
1221
  }
1180
- if (isAgentExecutionDataChunkType(payload)) {
1181
- if (!("data" in payload.payload)) {
1182
- throw new Error(
1183
- `UI Messages require a data property when using data- prefixed chunks
1184
- ${JSON.stringify(payload)}`
1185
- );
1186
- }
1187
- const { type, data } = payload.payload;
1188
- return { type, data };
1189
- }
1190
- if (isWorkflowExecutionDataChunkType(payload)) {
1191
- if (!("data" in payload.payload)) {
1192
- throw new Error(
1193
- `UI Messages require a data property when using data- prefixed chunks
1194
- ${JSON.stringify(payload)}`
1195
- );
1196
- }
1197
- const { type, data } = payload.payload;
1198
- return { type, data };
1199
- }
1200
1222
  return null;
1201
1223
  }
1202
1224
  }