Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor: preserve sanitizer adapters within the runtime ownership boundary

Steven Enamakel340ff2e0dc6f
diff --git a/crates/openhuman-core/src/util/sanitize.rs b/crates/openhuman-core/src/util/sanitize.rs
index ef1c75a91c..b5fe7c79d1 100644
--- a/crates/openhuman-core/src/util/sanitize.rs
+++ b/crates/openhuman-core/src/util/sanitize.rs
@@ -1,14 +1,26 @@
-//! Sanitization helpers for untrusted text bound for a model's context.
+//! Sanitization adapters for untrusted text bound for a model's context.
//!
-//! The implementation is shared from `tinytools_std`; TinyMCP applies it to
-//! remote tool descriptions, and OpenHuman also uses it for skill descriptions.
-//! Keeping both call sites on the same helper prevents their stripping rules
-//! from drifting.
-//!
-//! Re-exported under the path this module has always been at, so callers keep
-//! their spelling.
+//! TinyTools owns the lexical rules, shared with TinyMCP. These thin adapters
+//! retain the host utility API without re-exporting an upstream implementation.
pub use tinymcp_bus::sanitize::{MAX_DESCRIPTION_BYTES, MAX_TITLE_BYTES};
-pub use tinytools_std::sanitize::{
- sanitize_for_llm, strip_control_chars, strip_instruction_fences, truncate_utf8_safe,
-};
+
+/// Strip control characters through TinyTools' shared sanitization rules.
+pub fn strip_control_chars(input: &str) -> String {
+ tinytools_std::sanitize::strip_control_chars(input)
+}
+
+/// Remove instruction delimiters from untrusted text.
+pub fn strip_instruction_fences(input: &str) -> String {
+ tinytools_std::sanitize::strip_instruction_fences(input)
+}
+
+/// Apply a byte limit without splitting a UTF-8 character.
+pub fn truncate_utf8_safe(input: &str, max_bytes: usize) -> String {
+ tinytools_std::sanitize::truncate_utf8_safe(input, max_bytes)
+}
+
+/// Sanitize untrusted text and limit its size through the shared helper.
+pub fn sanitize_for_llm(input: &str, max_bytes: usize) -> String {
+ tinytools_std::sanitize::sanitize_for_llm(input, max_bytes)
+}