improved stability of hive-cli.js; moved messages generation and parsing to core.js