hone-terminal
Package: @honeide/terminal — terminal emulator. 163 tests.
cd hone-terminal && bun test
Components
vt-parser/
VT100/xterm escape sequence parser. Handles:
- CSI (Control Sequence Introducer) — cursor movement, erase, scroll, SGR attributes
- OSC (Operating System Command) — window title, clipboard, hyperlinks
- DCS (Device Control String) — device-specific sequences
pty/
PTY management with platform-specific backends:
- Unix (macOS/Linux) — POSIX PTY via
openpty/forkpty - Windows — ConPTY for modern terminal support
Spawns shell processes and manages bidirectional I/O between the emulator and the child process.
input/
Input encoding layer:
- Key encoder — maps keyboard events to VT escape sequences
- Mouse encoder — translates mouse events to xterm mouse reporting sequences
emulator.ts
Terminal emulator core. Ties together the parser, screen buffer, and input handler into a unified terminal instance. Manages:
- Screen buffer (primary and alternate)
- Cursor state and attributes
- Scroll region and scrollback
- Character set handling
Rendering
Cross-platform rendering via Rust FFI, following the same pattern as hone-editor’s native layer. The TypeScript emulator owns the terminal state; Rust handles platform-specific drawing.