Skip to content

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

refactor(core): update endpoint redaction logic

Steven Enamakelfd856b5ca283
diff --git a/crates/openhuman-core/src/inference/provider/factory/local_runtime.rs b/crates/openhuman-core/src/inference/provider/factory/local_runtime.rs
index 3aef45d5ac..8bab994cf4 100644
--- a/crates/openhuman-core/src/inference/provider/factory/local_runtime.rs
+++ b/crates/openhuman-core/src/inference/provider/factory/local_runtime.rs
@@ -3,6 +3,7 @@
use super::*;
use crate::inference::provider::factory::access_gates::verify_provider_session;
+use tinyinference_llm::providers::openai::AuthStyle as CompatAuthStyle;
use tinyinference_llm::providers::openai::build_local_runtime_chat_model;
/// Local OpenAI-compatible runtimes (Ollama / LM Studio / MLX / OMLX /
diff --git a/crates/openhuman-core/src/tools/impl/network/gitbooks.rs b/crates/openhuman-core/src/tools/impl/network/gitbooks.rs
index 4df17419b0..8c79b65357 100644
--- a/crates/openhuman-core/src/tools/impl/network/gitbooks.rs
+++ b/crates/openhuman-core/src/tools/impl/network/gitbooks.rs
@@ -1,7 +1,7 @@
//! `gitbooks` — answer questions about OpenHuman through the TinyMCP module's
//! confidential one-shot tool-call contract.
-use crate::{config::Config, inference::provider::factory::redact_endpoint};
+use crate::{config::Config, inference::provider::factory::redact_endpoint_origin};
use async_trait::async_trait;
use serde_json::{json, Value};
use std::time::Duration;
@@ -86,7 +86,7 @@ impl Tool for GitbooksSearchTool {
tracing::debug!(
target: "[gitbooks]",
- endpoint = %redact_endpoint(&self.endpoint),
+ endpoint = %redact_endpoint_origin(&self.endpoint),
tool = "searchDocumentation",
"dispatching via shared MCP client"
);
@@ -178,7 +178,7 @@ impl Tool for GitbooksGetPageTool {
tracing::debug!(
target: "[gitbooks]",
- endpoint = %redact_endpoint(&self.endpoint),
+ endpoint = %redact_endpoint_origin(&self.endpoint),
tool = "getPage",
"dispatching via shared MCP client"
);
diff --git a/crates/openhuman-core/src/tools/impl/network/gitbooks_tests.rs b/crates/openhuman-core/src/tools/impl/network/gitbooks_tests.rs
index e346f88a44..b8667acef4 100644
--- a/crates/openhuman-core/src/tools/impl/network/gitbooks_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/network/gitbooks_tests.rs
@@ -133,20 +133,21 @@ async fn gitbooks_tools_fail_closed_when_the_module_is_not_attested() {
}
#[test]
-fn redact_endpoint_keeps_only_origin() {
+fn redact_endpoint_origin_keeps_only_safe_origin() {
assert_eq!(
- redact_endpoint("https://tinyhumans.gitbook.io/openhuman/~gitbook/mcp"),
+ redact_endpoint_origin("https://tinyhumans.gitbook.io/openhuman/~gitbook/mcp"),
"https://tinyhumans.gitbook.io"
);
assert_eq!(
- redact_endpoint("http://example.com:8080/path?token=secret"),
+ redact_endpoint_origin("http://example.com:8080/path?token=secret"),
"http://example.com:8080"
);
assert_eq!(
- redact_endpoint("https://user:[email protected]/path?token=secret"),
- "<redacted>"
+ redact_endpoint_origin("https://user:[email protected]/private/secret?token=secret"),
+ "https://example.com"
);
- assert_eq!(redact_endpoint("file:///private/path"), "file://");
+ assert_eq!(redact_endpoint_origin("file:///private/path"), "null");
+ assert_eq!(redact_endpoint_origin("not a URL secret"), "<endpoint>");
}
#[test]