@ai-sdk/workflow 1.0.50 → 1.0.52

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,23 @@
1
1
  # @ai-sdk/workflow
2
2
 
3
+ ## 1.0.52
4
+
5
+ ### Patch Changes
6
+
7
+ - 94e6a99: Stream executed tool results when a sibling tool pauses for client execution or approval.
8
+ - Updated dependencies [3836a85]
9
+ - Updated dependencies [1bec07d]
10
+ - ai@7.0.52
11
+ - @ai-sdk/provider-utils@5.0.21
12
+
13
+ ## 1.0.51
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [160ccdb]
18
+ - @ai-sdk/provider-utils@5.0.20
19
+ - ai@7.0.51
20
+
3
21
  ## 1.0.50
4
22
 
5
23
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1543,6 +1543,9 @@ var WorkflowAgent = class {
1543
1543
  }));
1544
1544
  }
1545
1545
  if (options.writable) {
1546
+ if (allToolResults.length > 0) {
1547
+ await writeToolResults(options.writable, allToolResults);
1548
+ }
1546
1549
  const approvalToolCalls = pausedToolCalls.filter((_, i) => {
1547
1550
  const tcIndex = nonProviderToolCalls.indexOf(
1548
1551
  pausedToolCalls[i]
@@ -1634,7 +1637,7 @@ var WorkflowAgent = class {
1634
1637
  return [];
1635
1638
  });
1636
1639
  if (options.writable) {
1637
- await writeToolResultsWithStepBoundary(
1640
+ await writeToolResults(
1638
1641
  options.writable,
1639
1642
  executedToolResults.map((r) => {
1640
1643
  var _a2;
@@ -1646,7 +1649,8 @@ var WorkflowAgent = class {
1646
1649
  )) == null ? void 0 : _a2.input,
1647
1650
  output: r.rawOutput
1648
1651
  };
1649
- })
1652
+ }),
1653
+ true
1650
1654
  );
1651
1655
  }
1652
1656
  lastStepToolCalls = toolCalls.map((tc) => ({
@@ -1806,7 +1810,7 @@ async function writeApprovalRequests(writable, toolCalls) {
1806
1810
  writer.releaseLock();
1807
1811
  }
1808
1812
  }
1809
- async function writeToolResultsWithStepBoundary(writable, results) {
1813
+ async function writeToolResults(writable, results, writeStepBoundary = false) {
1810
1814
  "use step";
1811
1815
  const writer = writable.getWriter();
1812
1816
  try {
@@ -1819,8 +1823,10 @@ async function writeToolResultsWithStepBoundary(writable, results) {
1819
1823
  output: r.output
1820
1824
  });
1821
1825
  }
1822
- await writer.write({ type: "finish-step" });
1823
- await writer.write({ type: "start-step" });
1826
+ if (writeStepBoundary) {
1827
+ await writer.write({ type: "finish-step" });
1828
+ await writer.write({ type: "start-step" });
1829
+ }
1824
1830
  } finally {
1825
1831
  writer.releaseLock();
1826
1832
  }