@@ -649,7 +649,10 @@ def shell_exec(self, id: str, command: str, block: bool = True) -> str:
649649 output = exec_output .decode ('utf-8' , errors = 'ignore' )
650650
651651 log_entry += f"--- Output ---\n { output } \n "
652- return _to_plain (output )
652+ if output .strip ():
653+ return _to_plain (output )
654+ else :
655+ return "Command executed successfully (no output)."
653656 except subprocess .TimeoutExpired :
654657 error_msg = (
655658 f"Error: Command timed out after { self .timeout } seconds."
@@ -824,7 +827,12 @@ def shell_write_to_process(self, id: str, command: str) -> str:
824827 # Wait for and collect the new output
825828 output = self ._collect_output_until_idle (id )
826829
827- return output
830+ if output .strip ():
831+ return output
832+ else :
833+ return (
834+ f"Input sent to session '{ id } ' successfully (no output)."
835+ )
828836
829837 except Exception as e :
830838 return f"Error writing to session '{ id } ': { e } "
@@ -945,7 +953,7 @@ def shell_ask_user_for_help(self, id: str, prompt: str) -> str:
945953 been executed, or help information for general queries.
946954 """
947955 logger .info ("\n " + "=" * 60 )
948- logger .info ("🤖 LLM Agent needs your help!" )
956+ logger .info ("LLM Agent needs your help!" )
949957 logger .info (f"PROMPT: { prompt } " )
950958
951959 # Case 1: Session doesn't exist - offer to create one
@@ -970,15 +978,14 @@ def shell_ask_user_for_help(self, id: str, prompt: str) -> str:
970978 else :
971979 # Get the latest output to show the user the current state
972980 last_output = self ._collect_output_until_idle (id )
981+ last_output_display = (
982+ last_output .strip () if last_output .strip () else "(no output)"
983+ )
973984
974985 logger .info (f"SESSION: '{ id } ' (active)" )
975986 logger .info ("=" * 60 )
976987 logger .info ("--- LAST OUTPUT ---" )
977- logger .info (
978- last_output .strip ()
979- if last_output .strip ()
980- else "(no recent output)"
981- )
988+ logger .info (last_output_display )
982989 logger .info ("-------------------" )
983990
984991 try :
0 commit comments