Terminal-emulator State Machine library