Skip to content

Commit eee045c

Browse files
committed
feat: add interactive mode with single-node and multiplex support
- Implement PTY-based interactive shell sessions - Support both single-node and multi-node multiplexed modes - Add rustyline for command history and readline functionality - Include node selection interface for single-node mode - Display real-time status indicators for connected nodes - Add comprehensive tests and documentation
1 parent 4ca294d commit eee045c

File tree

18 files changed

+1396
-88
lines changed

18 files changed

+1396
-88
lines changed

ARCHITECTURE.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ The codebase has been restructured for better maintainability and scalability:
4848
2. **Command Modules (`commands/`):**
4949
- `exec.rs`: Command execution with output management
5050
- `ping.rs`: Connectivity testing
51+
- `interactive.rs`: Interactive shell sessions (Phase 1 completed)
5152
- `list.rs`: Cluster listing
5253
- `upload.rs`: File upload operations
5354
- `download.rs`: File download operations
@@ -285,6 +286,61 @@ Focus on more impactful optimizations like:
285286
3. **Compression:** Enable SSH compression for large outputs
286287
4. **Caching:** Cache host keys and authentication
287288

289+
## Interactive Mode Architecture
290+
291+
### Overview
292+
293+
Interactive mode provides persistent shell sessions with single-node or multiplexed multi-node support. This feature enables real-time interaction with cluster nodes, maintaining stateful connections for extended operations.
294+
295+
### Design Decisions
296+
297+
1. **PTY Support:**
298+
- Full pseudo-terminal allocation for proper shell interaction
299+
- Terminal size detection and dynamic resizing
300+
- ANSI escape sequence support for colored output
301+
302+
2. **Session Management:**
303+
- Persistent SSH connections with keep-alive
304+
- Graceful reconnection on connection drops
305+
- Session state tracking (working directory, environment)
306+
307+
3. **Input/Output Multiplexing:**
308+
- Commands broadcast to all nodes simultaneously
309+
- Node-prefixed output with color coding
310+
- Visual status indicators (● connected, ○ disconnected)
311+
312+
### Implementation Details
313+
314+
```rust
315+
struct NodeSession {
316+
node: Node,
317+
client: Client,
318+
channel: Channel<Msg>,
319+
working_dir: String,
320+
is_connected: bool,
321+
}
322+
```
323+
324+
### Modes of Operation
325+
326+
1. **Single-Node Mode (`--single-node`):**
327+
- Interactive shell on one selected node
328+
- Full terminal emulation
329+
- Command history with rustyline
330+
331+
2. **Multiplex Mode (default):**
332+
- Commands sent to all nodes
333+
- Synchronized output display
334+
- Node status tracking
335+
336+
### Future Enhancements (Phase 2-3)
337+
338+
- Node switching with `!node1`, `!node2` commands
339+
- Session persistence and detach/reattach
340+
- Full TUI with ratatui (split panes, monitoring)
341+
- File manager integration
342+
- Performance metrics visualization
343+
288344
## Security Model
289345

290346
### Current Implementation

Cargo.lock

Lines changed: 180 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)