diff --git a/cecli/coders/base_coder.py b/cecli/coders/base_coder.py index 4139412156a..a8a12aa471f 100755 --- a/cecli/coders/base_coder.py +++ b/cecli/coders/base_coder.py @@ -2768,6 +2768,7 @@ async def process_tool_calls(self, tool_call_response): def _print_tool_call_info(self, server_tool_calls): """Print information about an MCP tool call.""" + self.io.ring_bell() # self.io.tool_output("Preparing to run MCP tools", bold=False) for server, tool_calls in server_tool_calls.items(): diff --git a/cecli/io.py b/cecli/io.py index 8f572b7e856..fe149426f4a 100644 --- a/cecli/io.py +++ b/cecli/io.py @@ -1301,6 +1301,7 @@ async def _confirm_ask( self.user_input(f"{question} - {res}", log_only=False) else: # Ring the bell if needed + self.notify_user_input_required() self.ring_bell() self.start_spinner("Awaiting Confirmation...", False) @@ -1708,22 +1709,28 @@ def get_default_notification_command(self): return None # Unknown system + def _send_notification(self): + if self.notifications_command: + try: + result = subprocess.run(self.notifications_command, shell=True, capture_output=True) + if result.returncode != 0 and result.stderr: + error_msg = result.stderr.decode("utf-8", errors="replace") + self.tool_warning(f"Failed to run notifications command: {error_msg}") + except Exception as e: + self.tool_warning(f"Failed to run notifications command: {e}") + else: + print("\a", end="", flush=True) # Ring the bell + + def notify_user_input_required(self): + """Send a notification that user input is required.""" + if self.notifications: + self._send_notification() + def ring_bell(self): """Ring the terminal bell if needed and clear the flag""" if self.bell_on_next_input and self.notifications: - if self.notifications_command: - try: - result = subprocess.run( - self.notifications_command, shell=True, capture_output=True - ) - if result.returncode != 0 and result.stderr: - error_msg = result.stderr.decode("utf-8", errors="replace") - self.tool_warning(f"Failed to run notifications command: {error_msg}") - except Exception as e: - self.tool_warning(f"Failed to run notifications command: {e}") - else: - print("\a", end="", flush=True) # Ring the bell - self.bell_on_next_input = False # Clear the flag + self._send_notification() + self.bell_on_next_input = False def toggle_multiline_mode(self): """Toggle between normal and multiline input modes"""