@ai-sdk/workflow 2.0.7 → 2.0.8

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.7",
3
+ "version": "2.0.8",
4
4
  "type": "module",
5
5
  "description": "WorkflowAgent for building AI agents with AI SDK",
6
6
  "license": "Apache-2.0",
@@ -29,7 +29,7 @@
29
29
  "ajv": "^8.20.0",
30
30
  "@ai-sdk/provider": "4.0.7",
31
31
  "@ai-sdk/provider-utils": "5.0.29",
32
- "ai": "7.0.77"
32
+ "ai": "7.0.78"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/node": "22.19.19",
@@ -1562,12 +1562,12 @@ export class WorkflowAgent<
1562
1562
  }
1563
1563
 
1564
1564
  // Re-validate through the shared core implementation: input schema,
1565
- // HMAC signature (when configured), and approval policy. It throws on
1566
- // invalid input/signature; convert that to a denial result so the
1567
- // agent loop can continue gracefully.
1565
+ // HMAC signature (when configured), and approval policy. Convert
1566
+ // invalid input, denial, or signature errors to a tool error result
1567
+ // so the agent loop can continue gracefully.
1568
1568
  let revalidationReason: string | undefined;
1569
1569
  try {
1570
- const { deniedToolApprovals: policyDenied } =
1570
+ const { deniedToolApprovals: policyDenied, invalidToolApprovals } =
1571
1571
  await validateApprovedToolApprovals({
1572
1572
  approvedToolApprovals: [approval.collected],
1573
1573
  tools: this.tools as ToolSet,
@@ -1577,7 +1577,12 @@ export class WorkflowAgent<
1577
1577
  effectiveToolsContext as InferToolSetContext<ToolSet>,
1578
1578
  runtimeContext: effectiveRuntimeContext,
1579
1579
  });
1580
- if (policyDenied.length > 0) {
1580
+
1581
+ if (invalidToolApprovals.length > 0) {
1582
+ revalidationReason = getErrorMessage(
1583
+ invalidToolApprovals[0].error,
1584
+ );
1585
+ } else if (policyDenied.length > 0) {
1581
1586
  revalidationReason =
1582
1587
  policyDenied[0].approvalResponse.reason ??
1583
1588
  'Tool approval denied';