opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Add Agent terminal panel for viewing bash command output

Open marcodenic opened this issue 1 week ago • 1 comments

image

Summary

  • Designed to be combined with this PR: https://github.com/anomalyco/opencode/pull/6893
  • Add new "Agent" tab to terminal panel that displays real-time streaming output from agent bash commands
  • Auto-focus Agent tab when agent runs commands (unless user has interacted with PTY terminals)
  • Show spinner indicator on Agent tab when commands are running
  • Support ANSI color codes in output using ansi-to-html
  • Hide Agent tab in empty session state (before first message is sent)

Bug Fixes

  • Fix duplicate terminal creation on session load by adding ready() check and creating guard
  • Track user interaction with PTY terminals to control auto-focus behavior

New Files

  • packages/app/src/context/agent-terminal.tsx - Context for tracking bash tool commands
  • packages/app/src/components/agent-terminal.tsx - UI component for agent terminal output with ANSI color support

Demo

The Agent tab appears on the right side of the terminal panel tabs. When the agent runs bash commands, the output streams in real-time with colored output support. If the user hasn't interacted with any PTY terminal tabs, the Agent tab will auto-focus when commands start running.

marcodenic avatar Jan 05 '26 17:01 marcodenic