diff --git a/data/scripts/o b/data/scripts/o index 79dcbbd..19223cf 100755 --- a/data/scripts/o +++ b/data/scripts/o @@ -360,36 +360,45 @@ cmd_tui() { tmux kill-session -t "$tmux_session" 2>/dev/null || true # Layout: - # ┌──────────────────────┬──────────┐ - # │ │ state │ - # │ chat (75%) │ (25%) │ - # │ ├──────────┤ - # │ │ shell │ - # ├──────────────────────┴──────────┤ - # │ prompt (20%) │ - # └─────────────────────────────────┘ + # ┌──────────────────────────────────┐ + # │ chat │ + # │ │ + # ├──────────────────────────────────┤ + # │ prompt (20%) │ + # └──────────────────────────────────┘ + # State shown in tmux status-right. - # Pane 0: chat (left, large) + # Pane 0: chat (top, 80%) tmux new-session -d -s "$tmux_session" -c "$HOME" \ -e "session=$s" -e "agent=$a" tmux send-keys -t "$tmux_session" "o tail | grep -v '\\[\\[\\[.*\\]\\]\\]'" Enter - # Pane 1: state monitor (right column, 25% width) - tmux split-window -t "$tmux_session" -h -l 25% \ - -e "session=$s" -e "agent=$a" - tmux send-keys -t "$tmux_session" "o readloop statewait" Enter - - # Pane 2: shell (bottom of right column, 50% of right) - tmux split-window -t "$tmux_session" -v -l 50% \ - -e "session=$s" -e "agent=$a" - - # Pane 3: prompt REPL (bottom, 20% height, spans full width) - tmux split-window -t "$tmux_session:0.0" -v -l 20% \ + # Pane 1: prompt REPL (bottom, 20% height) + tmux split-window -t "$tmux_session" -v -l 20% \ -e "session=$s" -e "agent=$a" tmux send-keys -t "$tmux_session" "o prompt" Enter + # Show agent state in tmux status bar (live updates via statewait) + tmux set-option -t "$tmux_session" status-right "starting... | %H:%M" + tmux set-option -t "$tmux_session" status-right-length 64 + # Background: loops on statewait, updates status bar instantly on each change + while true; do + ollie-9p read "session/$s/agent/$a/statewait" 2>/dev/null | while read -r state; do + bg="" + case "$state" in + idle) bg="colour70" ;; # green + calling*) bg="colour214" ;; # orange + thinking) bg="colour33" ;; # blue + paused) bg="colour245" ;; # gray + *) bg="default" ;; + esac + tmux set-option -t "$tmux_session" status-right-style "fg=default,bg=$bg" + tmux set-option -t "$tmux_session" status-right "$state | %H:%M" + done + done & + # Focus the prompt pane - tmux select-pane -t "$tmux_session:0.3" + tmux select-pane -t "$tmux_session:0.1" exec tmux attach -t "$tmux_session" }