@ai-sdk/workflow 1.0.30 → 1.0.32

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,24 @@
1
1
  # @ai-sdk/workflow
2
2
 
3
+ ## 1.0.32
4
+
5
+ ### Patch Changes
6
+
7
+ - a50b88a: fix(workflow): preserve assistant text in tool-call conversation messages
8
+ - Updated dependencies [6cd7c74]
9
+ - Updated dependencies [e35bcae]
10
+ - Updated dependencies [a4eb3f3]
11
+ - ai@7.0.32
12
+
13
+ ## 1.0.31
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [70f18c3]
18
+ - Updated dependencies [cd06458]
19
+ - ai@7.0.31
20
+ - @ai-sdk/provider-utils@5.0.11
21
+
3
22
  ## 1.0.30
4
23
 
5
24
  ### Patch Changes
package/dist/index.js CHANGED
@@ -508,20 +508,28 @@ async function* streamTextIterator({
508
508
  const finishReason = finish == null ? void 0 : finish.finishReason;
509
509
  if (finishReason === "tool-calls") {
510
510
  lastStepWasToolCalls = true;
511
+ const textContent = step.content.filter(
512
+ (item) => item.type === "text"
513
+ );
511
514
  conversationPrompt.push({
512
515
  role: "assistant",
513
- content: toolCalls.map((toolCall) => {
514
- const sanitizedMetadata = sanitizeProviderMetadataForToolCall(
515
- toolCall.providerMetadata
516
- );
517
- return {
518
- type: "tool-call",
519
- toolCallId: toolCall.toolCallId,
520
- toolName: toolCall.toolName,
521
- input: toolCall.input,
522
- ...sanitizedMetadata != null ? { providerOptions: sanitizedMetadata } : {}
523
- };
524
- })
516
+ content: [
517
+ ...textContent,
518
+ ...toolCalls.map((toolCall) => {
519
+ const sanitizedMetadata = sanitizeProviderMetadataForToolCall(
520
+ toolCall.providerMetadata
521
+ );
522
+ return {
523
+ type: "tool-call",
524
+ toolCallId: toolCall.toolCallId,
525
+ toolName: toolCall.toolName,
526
+ input: toolCall.input,
527
+ ...sanitizedMetadata != null ? {
528
+ providerOptions: sanitizedMetadata
529
+ } : {}
530
+ };
531
+ })
532
+ ]
525
533
  });
526
534
  const toolResults = yield {
527
535
  toolCalls,