Terminal Emulator
Jarvis features a powerful terminal emulator built on xterm.js 5.5.0 with native PTY support via theportable-pty Rust crate. Each terminal pane runs its own isolated shell process with full ANSI/VT sequence support.
Architecture
The terminal uses a split-process design:- Frontend: xterm.js handles rendering, scrollback, selection, and ANSI processing
- Backend:
portable-ptyprovides cross-platform pseudo-terminal support - Bridge: JSON-over-IPC connects the two halves bidirectionally
Each terminal pane gets its own dedicated PTY with an isolated shell process and independent scrollback buffer.
Key Features
GPU Acceleration
Hardware-accelerated rendering via xterm.js canvas for smooth scrolling and high frame rates
True Color Support
24-bit color support with configurable themes and Catppuccin Mocha palette
Configurable Scrollback
Up to 100,000 lines of scrollback history per pane
Smart Copy/Paste
Intelligent clipboard handling with bracketed paste mode support
Shell Configuration
Configure your shell injarvis.toml:
Shell Auto-Detection
Whenprogram is empty (default), Jarvis automatically detects your shell:
- Unix: Reads
$SHELL, falls back to/bin/sh - Windows: Reads
$COMSPEC, falls back tocmd.exe
Environment Sanitization
For security, Jarvis does not inherit the full parent environment. Only safe variables are passed:TERM is always set to xterm-256color.
Terminal Settings
Cursor Styles
- Block
- Underline
- Beam
Solid rectangular cursor (default)
PTY Lifecycle
Creation
PTYs are created when:- Terminal Ready: When xterm.js initializes, it sends
terminal_readywith dimensions - Shell Restart: User clicks “Restart Shell” after process exit
Resize
Terminals automatically resize when:- Window is resized
- Pane layout changes (split/close)
- Zoom mode is toggled
FitAddon calculates optimal dimensions and sends pty_resize via IPC.
Cleanup
On pane close or app exit:Data Flow
Input Path (Keystroke to Shell)
Output Path (Shell Output to Screen)
Output Throttling
- Reader thread: 8 KB chunks
- Max per frame: 64 KB
- Poll rate: 125 Hz (8ms interval)
- Effective throughput: ~8 MB/s
Advanced Features
Bracketed Paste Mode
When enabled, pasted text is wrapped in escape sequences:URL Detection
URLs in terminal output are automatically detected and made clickable (when enabled in config):Copy/Paste Behavior
Copy (Cmd+C / Ctrl+Shift+C):- Check xterm.js selection
- Fallback to DOM selection
- Send
clipboard_copyIPC to Rust - System clipboard updated
- IPC request
clipboard_paste - Read system clipboard (text or image)
- Insert as PTY input or dispatch paste event
Multi-Terminal Support
One PTY per Pane
Every tiling pane hosts an independent terminal:- Separate shell processes
- Independent scrollback buffers
- Per-pane resize tracking
- Focus-based keyboard routing
Creating New Terminals
Use keyboard shortcuts or commands:- Split Horizontal:
Cmd+D(side by side) - Split Vertical:
Cmd+Shift+D(top/bottom) - New Pane: Auto-splits based on current dimensions
jarvis-rs/crates/jarvis-app/src/app_state/pty_bridge/jarvis-rs/assets/panels/terminal/index.htmldocs/manual/04-terminal.md
The terminal panel uses xterm.js v5.5.0 and FitAddon v0.10.0, loaded from jsDelivr with SRI verification.