@ai-sdk/workflow 2.0.59 → 2.0.60

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/workflow",
3
- "version": "2.0.59",
3
+ "version": "2.0.60",
4
4
  "type": "module",
5
5
  "description": "WorkflowAgent for building AI agents with AI SDK",
6
6
  "license": "Apache-2.0",
@@ -1950,6 +1950,7 @@ export class WorkflowAgent<
1950
1950
  input: collected.toolCall.input,
1951
1951
  reason: collected.approvalResponse.reason,
1952
1952
  providerExecuted: collected.toolCall.providerExecuted === true,
1953
+ existingToolResult: collected.existingToolResult,
1953
1954
  }),
1954
1955
  );
1955
1956
 
@@ -2092,7 +2093,10 @@ export class WorkflowAgent<
2092
2093
  for (const denial of deniedToolApprovals) {
2093
2094
  // Provider-executed denials are forwarded to the provider via the
2094
2095
  // preserved approval response below, not turned into a local result.
2095
- if (denial.providerExecuted) {
2096
+ if (
2097
+ denial.providerExecuted ||
2098
+ denial.existingToolResult !== undefined
2099
+ ) {
2096
2100
  continue;
2097
2101
  }
2098
2102
  toolResultContent.push({
@@ -2161,10 +2165,13 @@ export class WorkflowAgent<
2161
2165
  // Write tool results and step boundaries to the stream so the UI
2162
2166
  // can transition approved/denied tool parts to the correct state
2163
2167
  // and properly separate them from the subsequent model step.
2164
- if (options.writable && toolResultContent.length > 0) {
2165
- const deniedResults = toolResultContent
2166
- .filter(r => r.output.type === 'execution-denied')
2167
- .map(r => ({ toolCallId: r.toolCallId }));
2168
+ const deniedResults = deniedToolApprovals
2169
+ .filter(denial => !denial.providerExecuted)
2170
+ .map(denial => ({ toolCallId: denial.toolCallId }));
2171
+ if (
2172
+ options.writable &&
2173
+ (toolResultContent.length > 0 || deniedResults.length > 0)
2174
+ ) {
2168
2175
  await writeApprovalToolResults(
2169
2176
  options.writable,
2170
2177
  approvedRawResults,