Added proper command handlers in the ai library.