@@ -1041,16 +1041,37 @@ class Agent: |
| 1041 | 1041 | result_text = result.output |
| 1042 | 1042 | is_error = result.is_error |
| 1043 | 1043 | except ConfirmationRequired as e: |
| 1044 | + # Emit confirmation event |
| 1045 | + await emit(AgentEvent( |
| 1046 | + type="confirmation", |
| 1047 | + tool_name=e.tool_name, |
| 1048 | + confirm_message=e.message, |
| 1049 | + confirm_details=e.details, |
| 1050 | + )) |
| 1044 | 1051 | if on_confirmation: |
| 1045 | 1052 | confirmed = await on_confirmation(tc.name, e.message, e.details) |
| 1046 | 1053 | if confirmed: |
| 1047 | | - result = await self.registry.execute(tc.name, **tc.arguments, confirmed=True) |
| 1048 | | - result_text = result.output |
| 1049 | | - is_error = result.is_error |
| 1054 | + # Re-execute with skip_confirmation |
| 1055 | + old_skip = self.registry.skip_confirmation |
| 1056 | + self.registry.skip_confirmation = True |
| 1057 | + try: |
| 1058 | + result = await self.registry.execute(tc.name, **tc.arguments) |
| 1059 | + result_text = result.output |
| 1060 | + is_error = result.is_error |
| 1061 | + finally: |
| 1062 | + self.registry.skip_confirmation = old_skip |
| 1050 | 1063 | else: |
| 1051 | 1064 | result_text = "Tool execution cancelled by user." |
| 1052 | 1065 | else: |
| 1053 | | - result_text = f"Tool requires confirmation: {e.message}" |
| 1066 | + # No callback - auto-confirm for extracted tool calls |
| 1067 | + old_skip = self.registry.skip_confirmation |
| 1068 | + self.registry.skip_confirmation = True |
| 1069 | + try: |
| 1070 | + result = await self.registry.execute(tc.name, **tc.arguments) |
| 1071 | + result_text = result.output |
| 1072 | + is_error = result.is_error |
| 1073 | + finally: |
| 1074 | + self.registry.skip_confirmation = old_skip |
| 1054 | 1075 | except Exception as e: |
| 1055 | 1076 | result_text = f"Error: {e}" |
| 1056 | 1077 | is_error = True |