move reusable telegraph library out into telegraph-js