refactor(heartbeat): Move machine heartbeating out of agent