@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/CHANGELOG.md +6 -0
- package/dist/index.js +5 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/workflow-agent.ts +12 -5
package/package.json
CHANGED
package/src/workflow-agent.ts
CHANGED
|
@@ -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 (
|
|
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
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
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,
|