_to_plain
TerminalToolkit
- use_docker_backend (bool): If True, all commands are executed in a Docker container. Defaults to False.
- docker_container_name (Optional[str]): The name of the Docker container to use. Required if use_docker_backend is True.
- working_dir (str): The base directory for all operations. For the local backend, this acts as a security sandbox.
- session_logs_dir (Optional[str]): The directory to store session logs. Defaults to a ‘terminal_logs’ subfolder in the working_dir.
- timeout (int): The default timeout in seconds for blocking commands. Defaults to 60.
init
_setup_cloned_environment
_setup_initial_environment
_adapt_command_for_environment
_write_to_log
- log_file (str): Path to the log file
- content (str): Content to write
_sanitize_command
_start_output_reader_thread
_collect_output_until_idle
- id (str): The session ID.
- idle_duration (float): How long the stream must be empty to be considered idle.(default: 0.5)
- check_interval (float): The time to sleep between checks. (default: 0.1)
- max_wait (float): The maximum total time to wait for the process to go idle. (default: 5.0)
shell_exec
- command (str): The command to execute.
- block (bool): If True, the command runs synchronously, waiting for it to complete or time out, and returns its full output. If False, the command runs asynchronously in the background.
- id (Optional[str]): A specific ID for the session. If not provided, a unique ID is generated for non-blocking sessions.
shell_write_to_process
- id (str): The unique session ID of the non-blocking process.
- command (str): The text to write to the process’s standard input.
shell_view
- id (str): The unique session ID of the non-blocking process.
shell_wait
- id (str): The unique session ID of the non-blocking process.
- wait_seconds (float): The maximum number of seconds to wait.
shell_kill_process
- id (str): The unique session ID of the process to kill.
shell_ask_user_for_help
- If session exists: Shows session output and allows interaction
- If session doesn’t exist: Creates a temporary session for help
- id (str): The session ID of the interactive process needing help. Can be empty string for general help without session context.
- prompt (str): The question or instruction from the LLM to show the human user (e.g., “The program is asking for a filename. Please enter ‘config.json’.”).