Implement compose(middlewares) that chains async middleware functions
(like Koa.js or Starlette). Each middleware receives (req, next) wherenext() (a coroutine) calls the following middleware.
solve builds middlewares from a declarative ops list and runs them:
{'op': 'set', 'key': ..., 'val': ...} — adds key to req then awaits next().{'op': 'stop'} — marks req['stopped'] = True, does not await next().Return the final req state after compose(middlewares)(req) resolves.
Sample tests