[RFC] First draft of plugin interface design

@csavage-mdsol @sheavalentine-mdsol please review (not now. when you're actually at work).
Not sure how/whether to configure middleware order. @csavage-mdsol IIRC you were thinking about this at some point. Maybe we want middleware to have types that go in a set order?