
    riv              	       f    d dl mZ d dlmZ d dlmZ  ee          Zddededee	         defd	Z
d
S )    )Optional)ShellManager)setup_logger       @command
channel_idtimeoutreturnc                 8   t                      }	 |                    |          }|                    | |          }|                                sdS |S # t          $ r;}t
                              d| d           dt          |           cY d}~S d}~ww xY w)aU  
    Executes a shell command in a persistent session for the given channel.
    
    Args:
        command: The shell command to execute.
        channel_id: The Slack channel ID.
        timeout: Max time to wait for output (default 2.0s). Set higher for long running commands.
        
    Returns:
        The output of the command.
    )r	   z(No output)zShell execution failed: T)exc_infozError executing command: N)r   get_sessionexecutestrip	Exceptionloggererrorstr)r   r   r	   managersessionoutputes          3/root/projects/butler/slack_bot/tools/shell_tool.pyexecute_shellr      s     nnG4%%j11 ':: ||~~ 	! = 4 4 4333dCCC33q66333333334s$   A A A 
B0BBBN)r   )typingr   slack_bot.shell.managerr   health.utils.logging_configr   __name__r   r   floatr        r   <module>r!      s          0 0 0 0 0 0 4 4 4 4 4 4	h		4 43 4C 4(5/ 4TW 4 4 4 4 4 4r    