Refactor API to support simplified clustering of services.
Add type parameters for state machine command input/output.