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
ci: fix cargo fmt + maturin action invocation
chopratejas0144cfba51a3
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.ymlindex da31f582b..1bfbebd68 100644--- a/.github/workflows/rust.yml+++ b/.github/workflows/rust.yml@@ -79,8 +79,11 @@ jobs:uses: PyO3/maturin-action@v1with:command: build- manifest-path: crates/headroom-py/Cargo.toml- args: --release --out dist+ # `manifest-path:` is NOT a valid input on this action (it warns and+ # ignores). Pass -m inside `args` so maturin sees the right Cargo.toml.+ # Without this, maturin runs from the repo root and fails because+ # the workspace Cargo.toml has no [package] section.+ args: --release -m crates/headroom-py/Cargo.toml --out disttarget: ${{ matrix.maturin-target }}- name: Upload wheel artifactuses: actions/upload-artifact@v4diff --git a/crates/headroom-proxy/src/proxy.rs b/crates/headroom-proxy/src/proxy.rsindex 16d937db0..91bf158b9 100644--- a/crates/headroom-proxy/src/proxy.rs+++ b/crates/headroom-proxy/src/proxy.rs@@ -10,9 +10,9 @@ use axum::http::{HeaderMap, HeaderName, Request, Response, StatusCode, Uri};use axum::response::IntoResponse;use axum::routing::{any, get};use axum::Router;-use futures_util::{StreamExt as _, TryStreamExt};#[cfg(test)]use bytes::Bytes;+use futures_util::{StreamExt as _, TryStreamExt};#[cfg(test)]use http_body_util::BodyExt;diff --git a/crates/headroom-proxy/tests/e2e_real.rs b/crates/headroom-proxy/tests/e2e_real.rsindex b101f4494..e7755f487 100644--- a/crates/headroom-proxy/tests/e2e_real.rs+++ b/crates/headroom-proxy/tests/e2e_real.rs@@ -311,7 +311,10 @@ async fn e2e_anthropic_streaming() {}}}- eprintln!("[debug] chunks={chunks} bytes={} last_err={last_err:?}", buf.len());+ eprintln!(+ "[debug] chunks={chunks} bytes={} last_err={last_err:?}",+ buf.len()+ );let has_start = buf.contains("message_start");let has_delta = buf.contains("content_block_delta") || buf.contains("\"delta\"");let has_stop = buf.contains("message_stop");@@ -320,7 +323,10 @@ async fn e2e_anthropic_streaming() {"stream missing expected events (start={has_start} delta={has_delta} stop={has_stop}). buf:\n{}",&buf.chars().take(2000).collect::<String>());- assert!(chunks >= 1, "expected at least one SSE chunk (got {chunks})");+ assert!(+ chunks >= 1,+ "expected at least one SSE chunk (got {chunks})"+ );proxy.shutdown().await;drop(py);@@ -357,9 +363,7 @@ async fn e2e_openai_non_streaming() {let text = resp.text().await.unwrap();assert_eq!(status, 200, "non-200 from openai: {text}");let v: Value = serde_json::from_str(&text).unwrap();- let content = v["choices"][0]["message"]["content"]- .as_str()- .unwrap_or("");+ let content = v["choices"][0]["message"]["content"].as_str().unwrap_or("");assert!(content.to_uppercase().contains("PONG"),"expected PONG, got: {content}"