vibetunnel/web
Helmut Januschka 9792908fe1
Add terminal max width control and fix WebSocket panic (#29)
* feat: add terminal max width option

- Add terminal preferences manager for persistent settings storage
- Add maxCols property to terminal component with width constraint logic
- Add UI toggle button (∞/80) in session header for easy width control
- Default behavior unchanged: unlimited width (takes full container)
- Optional 80-column max width limit when enabled
- Preferences saved to localStorage and restored on page load
- Real-time updates without page refresh

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: enhance terminal width selector with common presets and custom input

- Add common terminal width presets: ∞, 80, 100, 120, 132, 160
- Add custom width input field (20-500 columns)
- Replace simple toggle with dropdown selector UI
- Include helpful descriptions for each preset
- Support keyboard shortcuts (Enter to submit, Escape to cancel)
- Add click-outside-to-close functionality
- Maintain all existing preferences persistence
- Show current width in button label and tooltip

Common widths:
- 80: Classic terminal
- 100: Modern standard
- 120: Wide terminal
- 132: Mainframe width
- 160: Ultra-wide
- Custom: User-defined (20-500)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: prevent WebSocket send on closed channel panic

Added safeSend helper function with panic recovery to handle race conditions
when multiple goroutines access WebSocket channels. Replaces unsafe channel
sends with graceful error handling.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-20 09:21:20 +02:00
..
scripts Fix cross-platform build issues in web package 2025-06-19 01:43:27 +02:00
src Add terminal max width control and fix WebSocket panic (#29) 2025-06-20 09:21:20 +02:00
.gitignore Remove lint_output.txt and add to gitignore 2025-06-18 23:46:22 +02:00
.prettierignore lint web 2025-06-17 01:03:37 +02:00
.prettierrc.json lint web 2025-06-17 01:03:37 +02:00
CLAUDE.md add mention of linter 2025-06-17 01:12:13 +02:00
eslint.config.js lint web 2025-06-17 01:03:37 +02:00
package-lock.json Remove Hummingbird 2025-06-20 06:59:17 +02:00
package.json Fix cross-platform build issues in web package 2025-06-19 01:43:27 +02:00
postcss.config.js Add complete web frontend for terminal multiplexer 2025-06-16 00:29:33 +02:00
README.md Fix linter formatting issues 2025-06-17 01:52:52 +02:00
snapshot-format.md Fix binary buffer encoding to support large terminals 2025-06-20 02:31:15 +02:00
tailwind.config.js Web design tweaks 2025-06-20 06:59:22 +02:00
tsconfig.client.json Web WIP 2025-06-16 03:35:14 +02:00
tsconfig.json Add complete web frontend for terminal multiplexer 2025-06-16 00:29:33 +02:00
vitest.config.ts feat: add integration tests and fix compatibility issues 2025-06-18 19:39:42 +02:00
vitest.d.ts fix: apply formatters to pass CI checks (#19) 2025-06-19 01:39:27 +02:00
vitest.integration.config.ts feat: add integration tests and fix compatibility issues 2025-06-18 19:39:42 +02:00

VibeTunnel Web Frontend

A modern web interface for the VibeTunnel terminal multiplexer built with TypeScript, Lit Elements, and XTerm.js. Provides professional terminal emulation with mobile-optimized controls and real-time session management.

Features

  • Professional Terminal Emulation using XTerm.js with full VT compatibility
  • Real-time Session Management with live streaming via Server-Sent Events
  • Mobile-Optimized Interface with touch controls and responsive design
  • Session Snapshots for previewing terminal output in card view
  • Interactive Terminal Input with full keyboard support and mobile input overlay
  • VS Code Dark Theme with consistent styling throughout
  • Custom Font Support using Fira Code with programming ligatures
  • File Browser for selecting working directories
  • Session Lifecycle Management (create, monitor, kill, cleanup)

Quick Start

  1. Install dependencies:

    npm install
    
  2. Start development server:

    npm run dev
    
  3. Open browser: Navigate to http://localhost:3000

Development Scripts

# Development (auto-rebuild and watch)
npm run dev                 # Start full dev environment
npm run watch:server        # Watch server TypeScript only
npm run watch:css          # Watch CSS changes only

# Building
npm run build              # Build everything for production
npm run build:server       # Build server TypeScript
npm run build:client       # Build client TypeScript  
npm run build:css          # Build Tailwind CSS

# Bundling (ES modules)
npm run bundle             # Bundle client code
npm run bundle:watch       # Watch and bundle client code

# Code Quality
npm run lint               # Check ESLint issues
npm run lint:fix           # Auto-fix ESLint issues
npm run format             # Format code with Prettier
npm run format:check       # Check code formatting
npm run pre-commit         # Run all quality checks

# Testing
npm run test               # Run Jest tests
npm run test:watch         # Watch and run tests

Architecture

Client-Side Components

Built with Lit Elements (Web Components):

src/client/
├── app.ts                    # Main application controller
├── components/
│   ├── app-header.ts         # Main navigation and controls
│   ├── session-list.ts       # Session grid with cards
│   ├── session-card.ts       # Individual session preview
│   ├── session-view.ts       # Full terminal view
│   ├── session-create-form.ts # New session modal
│   └── file-browser.ts       # Directory selection
├── renderer.ts               # XTerm.js terminal renderer
└── scale-fit-addon.ts        # Custom terminal scaling

Server-Side Architecture

Express.js server with tty-fwd integration:

src/
├── server.ts                 # Main Express server
└── input.css                # Tailwind source styles

Build Output

dist/                         # Compiled TypeScript
public/
├── bundle/
│   ├── client-bundle.js      # Bundled client code
│   ├── renderer.js           # Terminal renderer
│   └── output.css            # Compiled styles
├── fonts/                    # Fira Code font files
└── index.html                # Main HTML

API Reference

Session Management

GET    /api/sessions                    # List all sessions
POST   /api/sessions                    # Create new session
DELETE /api/sessions/:id                # Kill session
DELETE /api/sessions/:id/cleanup        # Clean up session files
POST   /api/cleanup-exited              # Clean all exited sessions

Terminal I/O

GET    /api/sessions/:id/stream         # Live session stream (SSE)
GET    /api/sessions/:id/snapshot       # Session snapshot (cast format)
POST   /api/sessions/:id/input          # Send input to session

File System

GET    /api/fs/browse?path=<path>       # Browse directories
POST   /api/mkdir                       # Create directory

Technology Stack

  • Frontend Framework: Lit Elements (Web Components)
  • Terminal Emulation: XTerm.js with custom addons
  • Styling: Tailwind CSS with VS Code theme
  • Typography: Fira Code Variable Font
  • Backend: Express.js + TypeScript
  • Terminal Backend: tty-fwd (Rust binary)
  • Build Tools: TypeScript, ESBuild, Tailwind
  • Code Quality: ESLint, Prettier, Pre-commit hooks

Mobile Support

  • Touch-optimized scrolling with proper overscroll prevention
  • Mobile input overlay with virtual keyboard support
  • Responsive design with mobile-first approach
  • Gesture navigation (swipe from edge to go back)
  • Pull-to-refresh prevention during terminal interaction

Browser Compatibility

  • Modern ES6+ browsers (Chrome 63+, Firefox 67+, Safari 13+)
  • Mobile browsers with full touch support
  • Progressive enhancement with graceful degradation

Deployment

  1. Build for production:

    npm run build
    
  2. Start production server:

    npm start
    
  3. Environment variables:

    • PORT - Server port (default: 3000)
    • TTY_FWD_CONTROL_DIR - tty-fwd control directory

Development Notes

  • Hot reload enabled in development
  • TypeScript strict mode with comprehensive type checking
  • ESLint + Prettier enforced via pre-commit hooks
  • Component-based architecture for maintainability
  • Mobile-first responsive design principles