Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Python agentaianthropicclaude-codecompressioncontext-engineeringcontext-windowcursorfastapilangchainllmmcpopenaiprompt-engineeringproxypythonragtoken-optimizationtokenstypescript
fix(deps): enforce transformers security floor (#2201)
JD Daviscbfa267c5f4f
diff --git a/headroom/cli/wrap.py b/headroom/cli/wrap.pyindex b4079ad8a..5ebcdf78a 100644--- a/headroom/cli/wrap.py+++ b/headroom/cli/wrap.py@@ -5615,7 +5615,7 @@ def zcode(upstream = _detect_zcode_upstream()anthropic_url, openai_url = _zcode_upstream_to_urls(upstream)- def _print_zcode_setup(actual_port: int) -> None:+ def _print_zcode_setup(actual_port: int = port) -> None:click.echo(f" Detected provider: {upstream.provider_name}")click.echo(f" Upstream: {upstream.base_url}")click.echo()diff --git a/headroom/proxy/handlers/anthropic.py b/headroom/proxy/handlers/anthropic.pyindex 897318b5c..027051a7b 100644--- a/headroom/proxy/handlers/anthropic.py+++ b/headroom/proxy/handlers/anthropic.py@@ -1572,9 +1572,7 @@ class AnthropicHandlerMixin:# Split timeout from other errors: a timeout means the# compression budget was too tight, not a code bug.reason = (- "timeout"- if isinstance(e, (asyncio.TimeoutError, TimeoutError))- else "error"+ "timeout" if isinstance(e, asyncio.TimeoutError | TimeoutError) else "error")self.metrics.record_compression_failed(reason)@@ -3661,7 +3659,7 @@ class AnthropicHandlerMixin:# Same fail-open accounting as the single-message path: a# timeout means the budget was too tight, not a code bug.reason = (- "timeout" if isinstance(e, (asyncio.TimeoutError, TimeoutError)) else "error"+ "timeout" if isinstance(e, asyncio.TimeoutError | TimeoutError) else "error")self.metrics.record_compression_failed(reason)# Pass through unchanged on failurediff --git a/pyproject.toml b/pyproject.tomlindex 3bf14239a..920a39519 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -76,7 +76,7 @@ proxy = ["zstandard>=0.20.0", # Decompress zstd request bodies (Codex, etc.)"websockets>=13.0", # WebSocket proxy for /v1/responses (Codex gpt-5.4+)"onnxruntime>=1.16.0", # Kompress ONNX INT8 text compression (no torch needed)- "transformers>=4.30.0,<6.0", # Tokenizer only (for Kompress)+ "transformers>=5.5.0,<6.0", # Tokenizer only (for Kompress)"watchdog>=4.0.0", # File watcher for live code graph reindexing (--code-graph)"sqlite-vec>=0.1.6", # Vector index for memory (--memory). Lightweight, no torch.]@@ -105,7 +105,7 @@ ml = [# PyTorch does not publish wheels for macOS 15 x86_64 at this floor, which# makes `headroom-ai[all]` unsatisfiable on Intel Macs (#1931)."torch>=2.12.1; sys_platform != 'darwin' or platform_machine != 'x86_64'",- "transformers>=4.30.0,<6.0",+ "transformers>=5.5.0,<6.0",# transformers >= 5.x requires huggingface-hub >= 1.5.0,<2.0; pinning# the floor here prevents Kompress from silently falling back to# "unavailable" when a sibling install (e.g. `pip install@@ -218,7 +218,7 @@ mcp = [# Voice filler detectionvoice = ["onnxruntime>=1.16.0",- "transformers>=4.30.0,<6.0",+ "transformers>=5.5.0,<6.0","torch>=2.12.1; sys_platform != 'darwin' or platform_machine != 'x86_64'",]# Voice training (includes voice deps + training extras)diff --git a/uv.lock b/uv.lockindex f74a040dd..28b84d856 100644--- a/uv.lock+++ b/uv.lock@@ -1501,6 +1501,7 @@ all = [{ name = "sentence-transformers", marker = "platform_machine != 'x86_64' or sys_platform != 'darwin'" },{ name = "sentencepiece" },{ name = "sqlite-vec" },+ { name = "starlette" },{ name = "torch", marker = "platform_machine != 'x86_64' or sys_platform != 'darwin'" },{ name = "trafilatura" },{ name = "transformers" },@@ -1660,6 +1661,7 @@ sandbox = [{ name = "opentelemetry-sdk" },{ name = "orjson", marker = "platform_python_implementation != 'PyPy'" },{ name = "sqlite-vec" },+ { name = "starlette" },{ name = "trafilatura" },{ name = "transformers" },{ name = "tree-sitter" },@@ -1781,9 +1783,9 @@ requires-dist = [{ name = "torch", marker = "(platform_machine != 'x86_64' and extra == 'ml') or (sys_platform != 'darwin' and extra == 'ml')", specifier = ">=2.12.1" },{ name = "torch", marker = "(platform_machine != 'x86_64' and extra == 'voice') or (sys_platform != 'darwin' and extra == 'voice')", specifier = ">=2.12.1" },{ name = "trafilatura", marker = "extra == 'html'", specifier = ">=1.6.0" },- { name = "transformers", marker = "extra == 'ml'", specifier = ">=4.30.0,<6.0" },- { name = "transformers", marker = "extra == 'proxy'", specifier = ">=4.30.0,<6.0" },- { name = "transformers", marker = "extra == 'voice'", specifier = ">=4.30.0,<6.0" },+ { name = "transformers", marker = "extra == 'ml'", specifier = ">=5.5.0,<6.0" },+ { name = "transformers", marker = "extra == 'proxy'", specifier = ">=5.5.0,<6.0" },+ { name = "transformers", marker = "extra == 'voice'", specifier = ">=5.5.0,<6.0" },{ name = "tree-sitter", marker = "extra == 'code'", specifier = ">=0.25.2,<0.27" },{ name = "tree-sitter-language-pack", marker = "extra == 'code'", specifier = ">=0.10.0,<1.0" },{ name = "uvicorn", marker = "extra == 'dev'", specifier = ">=0.23.0,<1.0" },