agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

terminal on the web ui has glitchy display.

Open whoisasx opened this issue 7 months ago • 0 comments

Terminal Visual Overhaul + WebGL Performance

Image

Context

The current terminal in the AO dashboard feels underwhelming — it's centered in a max-w-[1180px] container that clips text on wider monitors, has no top chrome or status bar, uses the default canvas renderer (no WebGL), and lacks the polish seen in tools like Railway. This plan adds visual chrome inspired by the user's mockup + Railway's design language, removes the width constraint, and enables GPU-accelerated rendering.

No architecture changes. Same xterm.js, same PTY/WebSocket/tmux stack. Just CSS, wrapper components, and one addon.


Changes

1. WebGL Addon — GPU-accelerated rendering

File: packages/web/package.json

  • Add @xterm/addon-webgl dependency

File: packages/web/src/components/DirectTerminal.tsx

  • Import WebglAddon from @xterm/addon-webgl
  • After terminal.open(container), load the addon with try/catch fallback to canvas:
    try {
      terminal.loadAddon(new WebglAddon());
    } catch {
      // canvas fallback — no action needed
    }
    
  • Also add @xterm/addon-search + SearchAddon for the search button in the top bar

Why: 900% faster frame rendering, smooth scrolling during heavy output bursts. 3-line change with automatic canvas fallback.


2. Full-width terminal layout

File: packages/web/src/components/SessionDetail.tsx (~line 365-380)

  • Change max-w-[1180px] to max-w-full on the dashboard-main wrapper only on the session detail page
  • Keep horizontal padding (px-5 lg:px-8) so content doesn't touch edges
  • The xterm.js FitAddon will automatically recalculate columns to fill the wider space

Before:

<div className="dashboard-main mx-auto max-w-[1180px] px-5 py-5 lg:px-8">

After:

<div className="dashboard-main mx-auto max-w-full px-5 py-5 lg:px-8">

3. Terminal top bar chrome

File: packages/web/src/components/DirectTerminal.tsx (~line 700-730)

Replace/enhance the existing minimal chrome bar with a proper top bar:

  • Left side: Pulsing green connection dot + session name + "CONNECTED"/"RECONNECTING" badge + agent type badge (e.g. "Claude Code")
  • Right side: Search button (triggers SearchAddon), Settings button (toggles settings panel), Fullscreen button
  • Background: rgba(22, 27, 34, 0.8) with backdrop-filter: blur(12px) (frosted glass)
  • Border bottom: 1px solid border color

The connection dot pulses with a CSS animation (green glow) when connected, turns yellow/red on reconnect/error. Data for session name + agent type comes from existing props.


4. Terminal status bar

File: packages/web/src/components/DirectTerminal.tsx

Add a bottom status bar below the terminal area:

  • Left side: Permission mode indicator, keyboard hint "(shift+tab to cycle)", PR link if available
  • Right side: Cost display if available from session info
  • Background: solid dark (#161b22), border-top
  • Font: 11px, muted colors

Props needed: permissionMode, prNumber, prUrl — these can be passed from SessionDetail which already has session data.


5. Theme refresh — Railway-inspired colors

File: packages/web/src/components/DirectTerminal.tsx (~line 75-137)

Update the dark theme to use richer, slightly purple-tinted colors (Railway-inspired):

Token Current New
background #0a0a0f #0d1117 (GitHub Dark / Railway-ish)
foreground #d4d4d8 #c9d1d9
cursor #5b7ef8 #58a6ff
selection current blue rgba(88, 166, 255, 0.3)
ANSI palette current Refresh to GitHub Dark Dimmed palette

Keep the light theme as-is.


6. Terminal container styling

File: packages/web/src/components/DirectTerminal.tsx + globals.css

Update the terminal container wrapper:

  • border-radius: 12px (currently using default)
  • Multi-layer box shadow: 0 8px 24px rgba(0,0,0,0.4) + subtle inner glow
  • Border: 1px solid #21262d
  • Slightly more padding inside terminal body (p-2 instead of p-1.5)

7. Settings panel (localStorage-persisted)

File: New section within DirectTerminal.tsx (or a small TerminalSettings.tsx if it exceeds 400-line component limit)

A dropdown panel toggled by the settings button in the top bar:

  • Font size — 12/13/14/15/16px options (default 14)
  • Cursor style — block/bar/underline (default bar)
  • Theme swatches — GitHub Dark, Dracula, Tokyo Night, One Dark, Catppuccin, Nord
  • Save to localStorage('ao-terminal-settings'), apply on mount

Position: absolute, anchored to settings button, same style as mockup (dark panel, rounded corners, subtle shadow).


8. Scrollbar refinement

File: packages/web/src/app/globals.css (~line 452-496)

Already decent, minor tweaks:

  • Thumb color slightly brighter on hover
  • Track fully transparent (no bg)
  • Width stays at 5-6px

Files Modified

File Change
packages/web/package.json Add @xterm/addon-webgl, @xterm/addon-search
packages/web/src/components/DirectTerminal.tsx WebGL addon, top bar, status bar, theme, container styling, settings panel
packages/web/src/components/SessionDetail.tsx max-w-[1180px] → max-w-full
packages/web/src/app/globals.css Scrollbar tweaks, settings panel styles, pulse animation
packages/web/src/components/TerminalSettings.tsx New file (only if DirectTerminal exceeds 400 lines)

Existing code to reuse

  • FitAddon already initialized at ~line 293 — just call fitAddon.fit() after WebGL loads
  • WebLinksAddon already loaded — no change
  • Connection state already tracked (wsConnected, reconnectAttempt) — use for dot/badge color
  • Fullscreen logic already exists (fullscreen state + fixed inset-0) — wire to new button
  • sessionId prop already passed — use for session name display
  • Theme objects at ~line 75-137 — update in place

Verification

  1. pnpm install — confirm new deps install
  2. pnpm --filter @composio/ao-web typecheck — no type errors
  3. pnpm dev — open dashboard, navigate to a session
  4. Visual checks:
    • Terminal fills full width (no centering gap on wide monitors)
    • Top bar shows connection dot (green pulse), session name, badges, buttons
    • Status bar shows at bottom
    • Settings panel opens/closes, changes persist across page reload
    • Search addon works (Ctrl+F or button)
    • Scrolling is smooth during heavy output (WebGL)
    • Fullscreen still works
    • Light/dark theme toggle still works
  5. pnpm --filter @composio/ao-web test — existing tests pass

whoisasx avatar Apr 06 '26 17:04 whoisasx