opencode
opencode copied to clipboard
Add Agent terminal panel for viewing bash command output
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 andcreatingguard - 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.