diff --git a/gptme/tools/tmux.py b/gptme/tools/tmux.py index 0d51f228..d7b6bea2 100644 --- a/gptme/tools/tmux.py +++ b/gptme/tools/tmux.py @@ -69,6 +69,17 @@ def new_session(command: str) -> Message: assert result.returncode == 0 print(result.stdout, result.stderr) + # set session size + cmd = ["tmux", "resize-window", "-t", session_id, "-x", "120", "-y", "40"] + print(" ".join(cmd)) + result = subprocess.run( + " ".join(cmd), + check=True, + capture_output=True, + text=True, + shell=True, + ) + cmd = ["tmux", "send-keys", "-t", session_id, command, "Enter"] print(" ".join(cmd)) result = subprocess.run( @@ -200,7 +211,7 @@ def execute_tmux( User: Can you show me the current content of the pane? Assistant: Of course! Let's inspect the pane content: -```terminal +```tmux inspect_pane 0 ``` System: @@ -210,7 +221,7 @@ def execute_tmux( User: Stop the dev server Assistant: I'll send 'Ctrl+C' to the pane to stop the server: -```terminal +```tmux send_keys 0 C-c ``` System: Sent 'C-c' to pane 0 @@ -225,8 +236,8 @@ def execute_tmux( #### Background process User: Start the dev server -Assistant: Certainly! To start the dev server we should use the terminal tool to run it in a tmux session: -```terminal +Assistant: Certainly! To start the dev server we should use the tmux tool to run it in a tmux session: +```tmux new_session 'npm run dev' ``` @@ -249,12 +260,12 @@ def execute_tmux( #### Ending a session User: I changed my mind Assistant: No problem! Let's kill the session and start over: -```terminal +```tmux list_sessions ``` System: Active tmux sessions [0] Assistant: -```terminal +```tmux kill_session 0 ``` System: Killed tmux session with ID 0