Overview
Implement proper pseudo-terminal (PTY) allocation for interactive SSH sessions, providing full terminal emulation capabilities including terminal resize handling, raw mode support, and proper handling of colors and special keys.
Technical Approach
Enhance the existing interactive mode with true PTY support:
- Terminal raw mode using crossterm for cross-platform support
- PTY request through russh's request_pty API
- Bidirectional I/O bridge between local terminal and SSH channel
- Signal handling for terminal resize (SIGWINCH)
- Multi-node support with PTY session switching
Implementation Tasks
Phase 1: PTY Foundation
Phase 2: Terminal Bridge
Phase 3: Window Resize Support
Phase 4: Enhanced Features
Phase 5: Multi-Node Integration
Success Criteria
- Full compatibility with terminal applications (vim, nano, htop, etc.)
- Input latency < 10ms
- Window resize handling < 50ms
- Memory usage < 1MB per PTY session
- Proper cleanup on disconnect
- Works on Linux and macOS
- No terminal corruption on exit
Testing Applications
Examples
# Force PTY allocation (like ssh -t)
bssh -t user@host
# Disable PTY allocation (like ssh -T)
bssh -T user@host "command"
# Interactive session with proper PTY
bssh user@host
> vim /etc/config # Should work with full terminal capabilities
# Multi-node with PTY
bssh -C cluster interactive
> !node1 # Switch to node1 with PTY
> top # Should display correctly with colors
Dependencies
- crossterm (already in dependencies)
- terminal_size (already in dependencies)
- signal-hook (for SIGWINCH handling)
- No new external dependencies required
Labels
enhancement, help wanted, ssh-compat, interactive
Overview
Implement proper pseudo-terminal (PTY) allocation for interactive SSH sessions, providing full terminal emulation capabilities including terminal resize handling, raw mode support, and proper handling of colors and special keys.
Technical Approach
Enhance the existing interactive mode with true PTY support:
Implementation Tasks
Phase 1: PTY Foundation
src/pty/mod.rs)Phase 2: Terminal Bridge
Phase 3: Window Resize Support
Phase 4: Enhanced Features
Phase 5: Multi-Node Integration
Success Criteria
Testing Applications
Examples
Dependencies
Labels
enhancement,help wanted,ssh-compat,interactive