Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
test(hooks): align legacy tool tests with uncapped extraction and fix 2 KB padding
Vinícius DS Andradeb9a3760d956b
diff --git a/crates/ai-memory-hooks/src/payload.rs b/crates/ai-memory-hooks/src/payload.rsindex c28c2912..7e8761ac 100644--- a/crates/ai-memory-hooks/src/payload.rs+++ b/crates/ai-memory-hooks/src/payload.rs@@ -2081,7 +2081,10 @@ mod tests {q,serde_json::json!({"payload":{"tool":"bash","output":"é".repeat(2_000)}}),);- assert!(long.body_excerpt.unwrap().len() <= 2_000);+ let body = long.body_excerpt.unwrap();+ assert!(body.len() > 2_000);+ let capped = truncate_utf8_bytes(&body, durable_body_cap(HookEvent::PostToolUse));+ assert!(capped.len() <= 2_000);}/// OpenCode's plugin `event` hook receives bus events shaped like@@ -2568,8 +2571,9 @@ mod tests {}),);let excerpt = env.body_excerpt.unwrap();- assert!(excerpt.ends_with('…'));assert!(excerpt.starts_with("tool_family: non-file\noutcome: unknown\n---\n"));+ let capped = truncate_utf8_bytes(&excerpt, durable_body_cap(HookEvent::PostToolUse));+ assert!(capped.ends_with('…'));}/// Regression: the native-binary hook command sends the script stem@@ -2927,7 +2931,10 @@ mod tests {},serde_json::json!({"tool_name":"Bash","tool_input":{},"tool_use_id":"utf8-1","output": "é".repeat(2_000)}),);- assert!(long.body_excerpt.unwrap().len() <= 2_000);+ let body = long.body_excerpt.unwrap();+ assert!(body.len() > 2_000);+ let capped = truncate_utf8_bytes(&body, durable_body_cap(HookEvent::PostToolUse));+ assert!(capped.len() <= 2_000);}#[test]diff --git a/crates/ai-memory-hooks/src/router.rs b/crates/ai-memory-hooks/src/router.rsindex 4ccc6487..041da2d7 100644--- a/crates/ai-memory-hooks/src/router.rs+++ b/crates/ai-memory-hooks/src/router.rs@@ -16866,7 +16866,7 @@ mod tests {"cwd": "/repo","tool_name": "Read","tool_use_id": "call-1114",- "tool_response": format!("{} {secret}", "x".repeat(1_940)),+ "tool_response": format!("{} {secret}", "x".repeat(1_920)),}),);process(&state, env, None, Vec::new()).await.unwrap();