That is not implemented in the current bot. We have support for doing that, except for changing out skill gems, which will be added to the API again in the near future.
As for the logic to do that, the bot won't ever be able to do that on its own. That is something that has to be user coded / configured, as the socket colors, links, and overall "what constitutes an upgrade" is pretty dynamic.