Asynchronous prompting

Refactored so that the core code can be used from policy code as well as via rpc.

http://jira.webinos.org/browse/WP-956