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
deps: bump md-5 from 0.10.6 to 0.11.0 (#3146)
dependabot[bot]c6dd82338434
diff --git a/Cargo.lock b/Cargo.lockindex 9f15bc270..1c602e60e 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -2698,12 +2698,12 @@ dependencies = [[[package]]name = "md-5"-version = "0.10.6"+version = "0.11.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf"+checksum = "69b6441f590336821bb897fb28fc622898ccceb1d6cea3fde5ea86b090c4de98"dependencies = ["cfg-if",- "digest 0.10.7",+ "digest 0.11.3",][[package]]diff --git a/crates/headroom-core/Cargo.toml b/crates/headroom-core/Cargo.tomlindex 8d59472ae..3deb63a58 100644--- a/crates/headroom-core/Cargo.toml+++ b/crates/headroom-core/Cargo.toml@@ -25,7 +25,7 @@ tokenizers = "0.23"hf-hub = { version = "0.5", default-features = false, features = ["ureq", "rustls-tls"] }# `md5` for the CCR cache_key. Python's compression_store hashes the original# diff with MD5 truncated to 24 hex chars; we must match byte-for-byte.-md-5 = "0.10"+md-5 = "0.11"# `sha2` for `_hash_field_name` in smart_crusher (SHA256 truncated to 16# hex chars). Python uses `hashlib.sha256` so we need byte-exact parity.sha2 = "0.11"diff --git a/crates/headroom-core/src/transforms/anchor_selector.rs b/crates/headroom-core/src/transforms/anchor_selector.rsindex bc1a94f14..eda97491b 100644--- a/crates/headroom-core/src/transforms/anchor_selector.rs+++ b/crates/headroom-core/src/transforms/anchor_selector.rs@@ -350,7 +350,7 @@ fn calculate_structural_uniqueness(item: &Value, all_items: &[Value]) -> f64 {pub fn compute_item_hash(item: &Value) -> String {let content = python_json_dumps_sort_keys(item);let digest = Md5::digest(content.as_bytes());- let hex = format!("{:x}", digest);+ let hex: String = digest.iter().map(|byte| format!("{byte:02x}")).collect();hex[..16].to_string()}diff --git a/crates/headroom-core/src/transforms/smart_crusher/orchestration.rs b/crates/headroom-core/src/transforms/smart_crusher/orchestration.rsindex cb9c3ec3b..4840523cd 100644--- a/crates/headroom-core/src/transforms/smart_crusher/orchestration.rs+++ b/crates/headroom-core/src/transforms/smart_crusher/orchestration.rs@@ -305,7 +305,11 @@ fn item_content_hash(item: &Value, idx: usize) -> String {_ => format!("__idx_{}__", idx),};let digest = Md5::digest(content.as_bytes());- format!("{:x}", digest)[..16].to_string()+ digest+ .iter()+ .map(|byte| format!("{byte:02x}"))+ .collect::<String>()[..16]+ .to_string()}}diff --git a/crates/headroom-core/src/transforms/smart_crusher/planning.rs b/crates/headroom-core/src/transforms/smart_crusher/planning.rsindex 888e7daf7..8d32692c4 100644--- a/crates/headroom-core/src/transforms/smart_crusher/planning.rs+++ b/crates/headroom-core/src/transforms/smart_crusher/planning.rs@@ -390,7 +390,11 @@ impl<'a> SmartCrusherPlanner<'a> {.unwrap_or("");let truncated: String = msg.chars().take(50).collect();let digest = Md5::digest(truncated.as_bytes());- let hash = format!("{:x}", digest)[..8].to_string();+ let hash = digest+ .iter()+ .map(|byte| format!("{byte:02x}"))+ .collect::<String>()[..8]+ .to_string();clusters.entry(hash).or_default().push(i);}// Keep up to 2 representatives from each cluster.diff --git a/crates/headroom-proxy/Cargo.toml b/crates/headroom-proxy/Cargo.tomlindex a2bf52f31..c9f2134ad 100644--- a/crates/headroom-proxy/Cargo.toml+++ b/crates/headroom-proxy/Cargo.toml@@ -92,7 +92,7 @@ async-trait = "0.1"# ordering — never persisted, never compared cross-host. Same crate# the core uses for the CCR cache_key, so no additional hash backend# enters the dep tree.-md-5 = "0.10"+md-5 = "0.11"[dev-dependencies]tower = { workspace = true, features = ["util"] }