"""HUX-11 routes: capability negotiation and the data manifest.""" from __future__ import annotations from hux.flags import CONTRACT_VERSION from hux.http import Request, Response, Router def capabilities(request: Request) -> Response: """``GET /hux/v1/capabilities``: what this tenant may call.""" request.audit("foundation.capabilities", "capabilities") return Response(200, request.flags.capabilities(request.identity, request.flags_build)) def manifest(request: Request) -> Response: """``GET /hux/v1/manifest``: the on-disk layout version for rollback readers.""" request.audit("foundation.manifest", "manifest") return Response(200, request.store.manifest(CONTRACT_VERSION)) def register(router: Router) -> None: """Attach HUX-11 routes.""" router.add("GET", "/hux/v1/capabilities", "HUX-11", "foundation.capabilities", capabilities) router.add("GET", "/hux/v1/manifest", "HUX-11", "foundation.manifest", manifest)