-
chore(proxy): add third-party extension point
发布于
2026-04-20 04:01:27 +00:00 Adds
headroom/proxy/extensions.py— a generic entry-point hook under
theheadroom.proxy_extensiongroup. External packages register an
install(app, config)callable that runs once at proxy startup and is
free to add ASGI middleware, routes, mutate config, or raise to
fail-closed (e.g., license check failure aborts startup).Why: Headroom OSS keeps a deliberately minimal surface, but several
high-value capabilities — PII redaction + tool-call vaulting, data-
residency routing, multi-tenant RBAC, compliance audit, vision/voice
privacy — only make sense as separately-distributed packages. A small,
stable plugin contract lets those live outside this repo without
requiring the OSS to know about them.Contract:
[project.entry-points."headroom.proxy_extension"] my_extension = "my_pkg.extension:install" def install(app: FastAPI, config: ProxyConfig) -> None: ...An extension that raises from install() is a deliberate fail-closed
signal and aborts startup. Entry-point load failures are logged and
skipped so one broken third-party package cannot take the proxy down.Changes:
- New: headroom/proxy/extensions.py (~55 LOC)
- headroom/proxy/server.py: invoke install_all(app, config) in
create_app() immediately after CORS middleware registration - pyproject.toml: register slow and real_llm pytest markers
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
下载附件