Stdlib per-tenant service: trusted-header identity (router/relay/worker, constant-time keys, slot pinned to the pod), fail-closed card flags with capability negotiation, tenant-scoped store (atomic writes, revisions, append-only ledgers, content-addressed blobs, manifest), audit outcome for every request, and the /hux/v1 pipeline that maps errors to hux.error.v1. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RNPhwu2bsaRNg3DETSAZoM
25 lines
965 B
Python
25 lines
965 B
Python
"""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)
|