Skip to content

Conversation

@unitythemaker
Copy link
Contributor

@unitythemaker unitythemaker commented Jan 20, 2026

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

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.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found 2 potentially related PRs that address similar issues:

  1. PR fix(server): allow WASM loading in CSP for ghostty-web terminal #9451 - fix(server): allow WASM loading in CSP for ghostty-web terminal

  2. PR fix(app): load ghostty wasm via asset url #9186 - fix(app): load ghostty wasm via asset url

These appear to be related to the CSP/WASM aspect of your PR. Check if these have already been merged or are still open, as your PR might supersede or complement them.

@adamdotdevin
Copy link
Contributor

@unitythemaker could you share some gifs/screenshots?

@unitythemaker
Copy link
Contributor Author

unitythemaker commented Jan 21, 2026

@adamdotdevin
Copy link
Contributor

@unitythemaker please rebase and resolve conflicts and I'll get this merged!

@unitythemaker
Copy link
Contributor Author

@unitythemaker please rebase and resolve conflicts and I'll get this merged!

Sure!

… state

- Close terminal tabs automatically when shell exits
- Fix freeze when closing middle tabs
- Auto-close terminal panel when last tab is closed
- Fix keyboard focus going to terminal instead of chat
- Add terminal error state UI showing 'Connection Lost' message
- Add terminal rename via double-click or context menu
- Add OPENCODE_TERMINAL=1 env var for PTY sessions
- Update CSP to allow wasm-unsafe-eval for ghostty terminal
@unitythemaker
Copy link
Contributor Author

Conflicts resolved!

@adamdotdevin adamdotdevin merged commit 87d91c2 into anomalyco:dev Jan 21, 2026
1 check passed
sergiu-svinarciuc pushed a commit to sergiu-svinarciuc/opencode that referenced this pull request Jan 22, 2026
* dev: (345 commits)
  fix after merge
  tweak(session title): change prompt to have the response with user language (anomalyco#9847)
  fix(app): new workspace button with all languages (anomalyco#9848)
  chore: generate
  fix(app): add aria-labels to titlebar and sidebar buttons (anomalyco#9843)
  test(app): fix e2e
  wip: black
  fix: type error
  fix(app): breaking out of auto-scroll
  chore: generate
  feat(app): model tooltip metadata in chooser (per Figma request) (anomalyco#9707)
  chore: generate
  fix(app): workspaces padding wonkiness (anomalyco#9772)
  feat(desktop): properly integrate window controls on windows (anomalyco#9835)
  test(app): fix e2e
  fix(app): terminal improvements - focus, rename, error state, CSP (anomalyco#9700)
  fix(app): japanese language support
  fix(desktop): add workaround for nushell
  test(app): fix e2e
  fix(core): snapshot regression
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants