[PR #9700] fix(app): terminal improvements - focus, rename, error state, CSP #13199

Closed
opened 2026-02-16 18:18:04 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9700

State: closed
Merged: Yes


Summary

  • Terminal focus fix - Keyboard input now goes to terminal instead of chat (focuses ghostty's internal textarea)
  • Terminal rename - Double-click tab or right-click → Rename (with overlay input approach)
  • Terminal error state - Shows dismissable "Connection Lost" message when connection fails
  • CSP update - Added wasm-unsafe-eval to script-src and data: to connect-src for ghostty WASM
  • OPENCODE_TERMINAL=1 env var - Added for PTY sessions to detect opencode terminal context
  • Terminal navigation - Added next() and previous() methods to terminal context

Issues Fixed

  • Fixes #9420 - CSP blocking WASM/data: URI
  • Fixes #7578 - Terminal not working (input goes to chat)
  • Fixes #9023 - Aggressive auto-focus prevents terminal interaction
  • Fixes #7116 - Can't rename ghostty tab
  • Fixes #6004 - Terminal freezes on shell exit (partially - server-side fix was in #9506)

Files Changed

  • packages/app/src/components/session/session-sortable-terminal-tab.tsx - Rename functionality
  • packages/app/src/components/terminal.tsx - Simplified WebSocket close handling
  • packages/app/src/context/terminal.tsx - Added error field, improved close() logic, navigation
  • packages/app/src/pages/session.tsx - Terminal focus effect, error UI, disabled chat autofocus
  • packages/opencode/src/pty/index.ts - Added OPENCODE_TERMINAL=1 env var
  • packages/opencode/src/server/server.ts - Updated CSP for WASM

Testing

Tested manually with bun dev for both backend and frontend.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9700 **State:** closed **Merged:** Yes --- ## Summary - **Terminal focus fix** - Keyboard input now goes to terminal instead of chat (focuses ghostty's internal textarea) - **Terminal rename** - Double-click tab or right-click → Rename (with overlay input approach) - **Terminal error state** - Shows dismissable "Connection Lost" message when connection fails - **CSP update** - Added `wasm-unsafe-eval` to `script-src` and `data:` to `connect-src` for ghostty WASM - **OPENCODE_TERMINAL=1 env var** - Added for PTY sessions to detect opencode terminal context - **Terminal navigation** - Added `next()` and `previous()` methods to terminal context ## Issues Fixed - Fixes #9420 - CSP blocking WASM/data: URI - Fixes #7578 - Terminal not working (input goes to chat) - Fixes #9023 - Aggressive auto-focus prevents terminal interaction - Fixes #7116 - Can't rename ghostty tab - Fixes #6004 - Terminal freezes on shell exit (partially - server-side fix was in #9506) ## Files Changed - `packages/app/src/components/session/session-sortable-terminal-tab.tsx` - Rename functionality - `packages/app/src/components/terminal.tsx` - Simplified WebSocket close handling - `packages/app/src/context/terminal.tsx` - Added error field, improved close() logic, navigation - `packages/app/src/pages/session.tsx` - Terminal focus effect, error UI, disabled chat autofocus - `packages/opencode/src/pty/index.ts` - Added OPENCODE_TERMINAL=1 env var - `packages/opencode/src/server/server.ts` - Updated CSP for WASM ## Testing Tested manually with `bun dev` for both backend and frontend.
yindo added the pull-request label 2026-02-16 18:18:04 -05:00
yindo closed this issue 2026-02-16 18:18:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13199