Extend API protocol with a "flush work queue" command

**WIP - not complete yet**