Skip to content

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

chore: reformat search-related code for consistency

Steven Enamakela234458ca041
diff --git a/crates/openhuman-core/src/agent/orchestration/workflow_runs/host.rs b/crates/openhuman-core/src/agent/orchestration/workflow_runs/host.rs
index ebecef1505..c5e80a08e4 100644
--- a/crates/openhuman-core/src/agent/orchestration/workflow_runs/host.rs
+++ b/crates/openhuman-core/src/agent/orchestration/workflow_runs/host.rs
@@ -78,8 +78,7 @@ impl OpenHumanWorkflowExecutor {
"workflow safety admission rejected unknown agent '{agent_id}'"
))
})?;
- let allowed_named_tool =
- |tool: &str| {
+ let allowed_named_tool = |tool: &str| {
matches!(
tool,
"web_search_tool" | "web_answer_tool" | "web_contents_tool" | "web_fetch"
diff --git a/crates/openhuman-core/src/config/mod.rs b/crates/openhuman-core/src/config/mod.rs
index 038556c467..107258e246 100644
--- a/crates/openhuman-core/src/config/mod.rs
+++ b/crates/openhuman-core/src/config/mod.rs
@@ -46,23 +46,24 @@ pub use schema::{
DelegateAgentConfig, DiagramViewerConfig, DictationActivationMode, DictationConfig,
DiscordConfig, DockerRuntimeConfig, EmailConfig, EmbeddingRouteConfig, GitbooksConfig,
HeartbeatConfig, HttpHeader, HttpRequestConfig, IMessageConfig, IntegrationToggle,
- IntegrationsConfig, LarkConfig, LearningConfig, LinqConfig, LlmBackend, LocalAiConfig,
- MatrixConfig, McpAuthConfig, McpClientConfig, McpClientIdentityConfig, McpServerConfig,
- MemoryConfig, MemoryTreeConfig, ModelRouteConfig, MultimodalConfig, MultimodalFileConfig,
- ObservabilityConfig, OrchestratorModelConfig, PrivacyConfig, PrivacyMode, ProxyConfig,
- ProxyScope, ReflectionSource, ReliabilityConfig, ResourceLimitsConfig, RuntimeConfig,
- RuntimePoolConfig, RuntimePoolLangConfig, SandboxBackend, SandboxConfig, SchedulerConfig,
- SchedulerGateConfig, SchedulerGateMode, SearchConfig, SearchEngineCredentials, SearchPresentation, SearchProviderSettings, SearchRoute,
- SearxngConfig, SecretsConfig, SecurityConfig, ShellConfig, SlackConfig, StorageConfig,
- StorageProviderConfig, StorageProviderSection, StreamMode, SttEngine, TeamModelConfig,
- TelegramConfig, TokenjuiceConfig, UpdateConfig, UpdateRestartStrategy, VoiceActivationMode,
- VoiceServerConfig, WebSearchConfig, WebhookConfig, YuanbaoConfig, DEFAULT_CLOUD_LLM_MODEL,
+ IntegrationsConfig, LarkConfig, LearningConfig, LegacySearchInputs, LinqConfig, LlmBackend,
+ LocalAiConfig, MatrixConfig, McpAuthConfig, McpClientConfig, McpClientIdentityConfig,
+ McpServerConfig, MemoryConfig, MemoryTreeConfig, ModelRouteConfig, MultimodalConfig,
+ MultimodalFileConfig, ObservabilityConfig, OrchestratorModelConfig, PrivacyConfig, PrivacyMode,
+ ProxyConfig, ProxyScope, ReflectionSource, ReliabilityConfig, ResourceLimitsConfig,
+ RuntimeConfig, RuntimePoolConfig, RuntimePoolLangConfig, SandboxBackend, SandboxConfig,
+ SchedulerConfig, SchedulerGateConfig, SchedulerGateMode, SearchConfig, SearchEngineCredentials,
+ SearchPresentation, SearchProviderSettings, SearchRoute, SearxngConfig, SecretsConfig,
+ SecurityConfig, ShellConfig, SlackConfig, StorageConfig, StorageProviderConfig,
+ StorageProviderSection, StreamMode, SttEngine, TeamModelConfig, TelegramConfig,
+ TokenjuiceConfig, UpdateConfig, UpdateRestartStrategy, VoiceActivationMode, VoiceServerConfig,
+ WebSearchConfig, WebhookConfig, YuanbaoConfig, DEFAULT_CLOUD_LLM_MODEL,
DEFAULT_MEMORY_SYNC_INTERVAL_SECS, DEFAULT_MODEL, LEGACY_TIER_MODELS,
- MANAGED_MULTIMODAL_MODELS, MEMORY_SYNC_INTERVAL_PRESETS_SECS, MODEL_IMAGE_GENERATION_AGENT,
- MODEL_MANAGED_DEFAULT, MODEL_MEDIA_UNDERSTANDING, MODEL_VIDEO_GENERATION_AGENT,
- SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED,
- SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, MANAGED_SEARCH_PROVIDERS, SEARCH_PROVIDERS,
- SEARCH_ROLES, SEARCH_ROLE_ANSWER, SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH, LegacySearchInputs,
+ MANAGED_MULTIMODAL_MODELS, MANAGED_SEARCH_PROVIDERS, MEMORY_SYNC_INTERVAL_PRESETS_SECS,
+ MODEL_IMAGE_GENERATION_AGENT, MODEL_MANAGED_DEFAULT, MODEL_MEDIA_UNDERSTANDING,
+ MODEL_VIDEO_GENERATION_AGENT, SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA,
+ SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS,
+ SEARCH_ROLES, SEARCH_ROLE_ANSWER, SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH,
};
// Kept as a separate re-export (issue #4117) so the large alphabetized group
// above stays byte-identical and rustfmt-stable.
diff --git a/crates/openhuman-core/src/config/ops/search.rs b/crates/openhuman-core/src/config/ops/search.rs
index 3d150a0ce8..9ae178aefc 100644
--- a/crates/openhuman-core/src/config/ops/search.rs
+++ b/crates/openhuman-core/src/config/ops/search.rs
@@ -199,7 +199,10 @@ fn apply_roles(config: &mut Config, roles: BTreeMap<String, Vec<String>>) -> Res
if cleaned.is_empty() {
config.search.roles.remove(role_key(role));
} else {
- config.search.roles.insert(role_key(role).to_string(), cleaned);
+ config
+ .search
+ .roles
+ .insert(role_key(role).to_string(), cleaned);
}
}
Ok(())
@@ -254,8 +257,9 @@ pub fn apply_search_patch(config: &mut Config, update: SearchSettingsPatch) -> R
apply_roles(config, roles)?;
}
if let Some(mode) = update.presentation.as_deref() {
- config.search.presentation = SearchPresentation::parse(mode)
- .ok_or_else(|| "presentation must be roles, all_tools, router or one_provider".to_string())?;
+ config.search.presentation = SearchPresentation::parse(mode).ok_or_else(|| {
+ "presentation must be roles, all_tools, router or one_provider".to_string()
+ })?;
}
if let Some(provider) = update.presentation_provider {
let provider = provider.trim().to_ascii_lowercase();
@@ -272,7 +276,9 @@ pub fn apply_search_patch(config: &mut Config, update: SearchSettingsPatch) -> R
}
if let Some(secs) = update.timeout_secs {
if !(1..=120).contains(&secs) {
- return Err(format!("timeout_secs must be between 1 and 120 (got {secs})"));
+ return Err(format!(
+ "timeout_secs must be between 1 and 120 (got {secs})"
+ ));
}
config.search.timeout_secs = secs;
}
@@ -349,7 +355,12 @@ pub(crate) fn search_settings_json_with(config: &Config, managed_available: bool
.collect();
let roles: serde_json::Map<String, Value> = ROLES
.into_iter()
- .map(|role| (role_key(role).to_string(), json!(providers::role_order(config, role))))
+ .map(|role| {
+ (
+ role_key(role).to_string(),
+ json!(providers::role_order(config, role)),
+ )
+ })
.collect();
let effective_roles: serde_json::Map<String, Value> = ROLES
.into_iter()
diff --git a/crates/openhuman-core/src/config/ops/search_tests.rs b/crates/openhuman-core/src/config/ops/search_tests.rs
index dd7fabbf41..11db89297f 100644
--- a/crates/openhuman-core/src/config/ops/search_tests.rs
+++ b/crates/openhuman-core/src/config/ops/search_tests.rs
@@ -88,11 +88,8 @@ fn roles_are_validated_deduplicated_and_resettable() {
config.search.roles.get("search"),
Some(&vec!["brave".to_string(), "exa".to_string()])
);
- let err = apply_search_patch(
- &mut config,
- patch(json!({"roles": {"answer": ["brave"]}})),
- )
- .unwrap_err();
+ let err = apply_search_patch(&mut config, patch(json!({"roles": {"answer": ["brave"]}})))
+ .unwrap_err();
assert!(err.contains("cannot serve the answer role"), "{err}");
assert!(apply_search_patch(&mut config, patch(json!({"roles": {"research": []}}))).is_err());
apply_search_patch(&mut config, patch(json!({"roles": {"search": []}}))).unwrap();
@@ -166,7 +163,10 @@ fn settings_view_reports_status_roles_and_never_keys() {
assert_eq!(gemini["deep_research_available"], true);
assert_eq!(provider(&view, "tinyfish")["routes"], json!(["managed"]));
assert_eq!(provider(&view, "brave")["status"], "disabled");
- assert_eq!(view["effective_roles"]["answer"], json!(["gemini", "gemini_deep_research"]));
+ assert_eq!(
+ view["effective_roles"]["answer"],
+ json!(["gemini", "gemini_deep_research"])
+ );
assert_eq!(view["effective_roles"]["search"], json!(["exa"]));
assert!(!view.to_string().contains("secret-gemini"));
assert!(view["providers"]
diff --git a/crates/openhuman-core/src/config/schema/load/env_overlay/search.rs b/crates/openhuman-core/src/config/schema/load/env_overlay/search.rs
index 4c99ef511c..ab3b11cfc9 100644
--- a/crates/openhuman-core/src/config/schema/load/env_overlay/search.rs
+++ b/crates/openhuman-core/src/config/schema/load/env_overlay/search.rs
@@ -97,7 +97,9 @@ impl Config {
let mut providers = std::collections::BTreeMap::new();
for entry in names.split(',').map(str::trim).filter(|e| !e.is_empty()) {
let (name, route) = match entry.split_once(':') {
- Some((name, route)) => (name.trim().to_ascii_lowercase(), SearchRoute::parse(route)),
+ Some((name, route)) => {
+ (name.trim().to_ascii_lowercase(), SearchRoute::parse(route))
+ }
None => (entry.to_ascii_lowercase(), None),
};
if name == "managed" {
@@ -106,7 +108,9 @@ impl Config {
continue;
}
if !SEARCH_PROVIDERS.contains(&name.as_str()) {
- log::warn!("[config][search] OPENHUMAN_SEARCH_PROVIDERS: unknown provider '{name}'");
+ log::warn!(
+ "[config][search] OPENHUMAN_SEARCH_PROVIDERS: unknown provider '{name}'"
+ );
continue;
}
let default_route = if MANAGED_SEARCH_PROVIDERS.contains(&name.as_str()) {
@@ -167,7 +171,9 @@ impl Config {
if let Some(mode) = env.get_any(&["OPENHUMAN_SEARCH_PRESENTATION"]) {
match SearchPresentation::parse(&mode) {
Some(mode) => self.search.presentation = mode,
- None => log::warn!("[config][search] ignoring OPENHUMAN_SEARCH_PRESENTATION='{mode}'"),
+ None => {
+ log::warn!("[config][search] ignoring OPENHUMAN_SEARCH_PRESENTATION='{mode}'")
+ }
}
}
if env.contains("OPENHUMAN_PARALLEL_ROUTE")
diff --git a/crates/openhuman-core/src/config/schema/mod.rs b/crates/openhuman-core/src/config/schema/mod.rs
index 0d4093679e..675b314fd2 100644
--- a/crates/openhuman-core/src/config/schema/mod.rs
+++ b/crates/openhuman-core/src/config/schema/mod.rs
@@ -121,12 +121,14 @@ pub use task_sources::TaskSourcesConfig;
pub use tokenjuice::TokenjuiceConfig;
pub use tools::{
BrowserComputerUseConfig, BrowserConfig, ComposioConfig, CurlConfig, GitbooksConfig,
- HttpHeader, HttpRequestConfig, IntegrationToggle, IntegrationsConfig, McpAuthConfig,
- McpClientConfig, McpClientIdentityConfig, McpServerConfig, MultimodalConfig,
- MultimodalFileConfig, SearchConfig, SearchEngineCredentials, SearchPresentation, SearchProviderSettings, SearchRoute, SearxngConfig,
- SecretsConfig, SeltzConfig, WebSearchConfig, COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT,
+ HttpHeader, HttpRequestConfig, IntegrationToggle, IntegrationsConfig, LegacySearchInputs,
+ McpAuthConfig, McpClientConfig, McpClientIdentityConfig, McpServerConfig, MultimodalConfig,
+ MultimodalFileConfig, SearchConfig, SearchEngineCredentials, SearchPresentation,
+ SearchProviderSettings, SearchRoute, SearxngConfig, SecretsConfig, SeltzConfig,
+ WebSearchConfig, COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT, MANAGED_SEARCH_PROVIDERS,
SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED,
- SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, SEARCH_ROLES, SEARCH_ROLE_ANSWER, SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH, MANAGED_SEARCH_PROVIDERS, LegacySearchInputs,
+ SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, SEARCH_ROLES, SEARCH_ROLE_ANSWER,
+ SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH,
};
pub use update::{UpdateConfig, UpdateRestartStrategy};
pub use web_chat_config::WebChatConfig;
diff --git a/crates/openhuman-core/src/config/schema/tools/mod.rs b/crates/openhuman-core/src/config/schema/tools/mod.rs
index 5434b7ef20..2aa9eb70d8 100644
--- a/crates/openhuman-core/src/config/schema/tools/mod.rs
+++ b/crates/openhuman-core/src/config/schema/tools/mod.rs
@@ -18,4 +18,10 @@ pub use mcp::{
McpServerConfig,
};
pub use multimodal::{MultimodalConfig, MultimodalFileConfig};
-pub use search::{LegacySearchInputs, SearchConfig, SearchEngineCredentials, SearchPresentation, SearchProviderSettings, SearchRoute, SearxngConfig, SeltzConfig, WebSearchConfig, MANAGED_SEARCH_PROVIDERS, SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, SEARCH_ROLES, SEARCH_ROLE_ANSWER, SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH, SEARCH_SCHEMA_VERSION,};
+pub use search::{
+ LegacySearchInputs, SearchConfig, SearchEngineCredentials, SearchPresentation,
+ SearchProviderSettings, SearchRoute, SearxngConfig, SeltzConfig, WebSearchConfig,
+ MANAGED_SEARCH_PROVIDERS, SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA,
+ SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS,
+ SEARCH_ROLES, SEARCH_ROLE_ANSWER, SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH,
+};
diff --git a/crates/openhuman-core/src/config/schema/tools/search_migrate.rs b/crates/openhuman-core/src/config/schema/tools/search_migrate.rs
index ddc9c49f12..ebf02c572d 100644
--- a/crates/openhuman-core/src/config/schema/tools/search_migrate.rs
+++ b/crates/openhuman-core/src/config/schema/tools/search_migrate.rs
@@ -4,10 +4,10 @@
use std::collections::BTreeMap;
use super::{
- LegacySearchInputs, SearchConfig, SearchEngineCredentials, SearchProviderSettings,
- SearchRoute, SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA,
- SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS,
- SEARCH_ROLE_SEARCH, SEARCH_SCHEMA_VERSION,
+ LegacySearchInputs, SearchConfig, SearchEngineCredentials, SearchProviderSettings, SearchRoute,
+ SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED,
+ SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, SEARCH_ROLE_SEARCH,
+ SEARCH_SCHEMA_VERSION,
};
impl SearchConfig {
@@ -131,7 +131,10 @@ impl SearchConfig {
SEARCH_ENGINE_BRAVE | SEARCH_ENGINE_QUERIT | SEARCH_ENGINE_TAVILY
) && providers.contains_key(engine.as_str())
{
- roles.insert(SEARCH_ROLE_SEARCH.to_string(), vec![engine.clone(), "exa".into()]);
+ roles.insert(
+ SEARCH_ROLE_SEARCH.to_string(),
+ vec![engine.clone(), "exa".into()],
+ );
}
if dropped_parallel {
diff --git a/crates/openhuman-core/src/config/schema/tools/search_search_config_tests_tests.rs b/crates/openhuman-core/src/config/schema/tools/search_search_config_tests_tests.rs
index 8d7e005072..bd2ca4b315 100644
--- a/crates/openhuman-core/src/config/schema/tools/search_search_config_tests_tests.rs
+++ b/crates/openhuman-core/src/config/schema/tools/search_search_config_tests_tests.rs
@@ -15,8 +15,14 @@ fn fresh_defaults_are_managed_exa_and_gemini_with_roles_presentation() {
assert!(!cfg.needs_migration());
assert!(cfg.is_enabled());
assert_eq!(cfg.presentation, SearchPresentation::Roles);
- assert_eq!(provider(&cfg, "exa"), Some(SearchProviderSettings::managed()));
- assert_eq!(provider(&cfg, "gemini"), Some(SearchProviderSettings::managed()));
+ assert_eq!(
+ provider(&cfg, "exa"),
+ Some(SearchProviderSettings::managed())
+ );
+ assert_eq!(
+ provider(&cfg, "gemini"),
+ Some(SearchProviderSettings::managed())
+ );
assert_eq!(cfg.providers.len(), 2);
assert!(cfg.roles.is_empty());
}
@@ -44,8 +50,14 @@ fn legacy_managed_becomes_managed_exa_and_gemini() {
let mut cfg = legacy("engine = \"managed\"\n");
assert!(cfg.migrate_legacy(LegacySearchInputs::default()));
assert!(cfg.is_enabled());
- assert_eq!(provider(&cfg, "exa"), Some(SearchProviderSettings::managed()));
- assert_eq!(provider(&cfg, "gemini"), Some(SearchProviderSettings::managed()));
+ assert_eq!(
+ provider(&cfg, "exa"),
+ Some(SearchProviderSettings::managed())
+ );
+ assert_eq!(
+ provider(&cfg, "gemini"),
+ Some(SearchProviderSettings::managed())
+ );
assert!(cfg.roles.is_empty());
assert_eq!(cfg.schema_version, SEARCH_SCHEMA_VERSION);
assert!(cfg.engine.is_none());
@@ -75,7 +87,10 @@ fn legacy_disabled_stays_disabled_but_keeps_providers_configured() {
fn legacy_byok_engine_leads_the_search_role() {
let mut cfg = legacy("engine = \"tavily\"\n[tavily]\napi_key = \"t\"\n");
cfg.migrate_legacy(LegacySearchInputs::default());
- assert_eq!(provider(&cfg, "tavily"), Some(SearchProviderSettings::direct()));
+ assert_eq!(
+ provider(&cfg, "tavily"),
+ Some(SearchProviderSettings::direct())
+ );
assert_eq!(
cfg.roles.get(SEARCH_ROLE_SEARCH),
Some(&vec!["tavily".to_string(), "exa".to_string()])
@@ -94,7 +109,10 @@ fn legacy_byok_engine_without_key_does_not_claim_a_role() {
fn legacy_exa_engine_with_key_keeps_exa_direct() {
let mut cfg = legacy("engine = \"exa\"\n[exa]\napi_key = \"e\"\n");
cfg.migrate_legacy(LegacySearchInputs::default());
- assert_eq!(provider(&cfg, "exa"), Some(SearchProviderSettings::direct()));
+ assert_eq!(
+ provider(&cfg, "exa"),
+ Some(SearchProviderSettings::direct())
+ );
assert_eq!(cfg.exa.key(), Some("e"));
}
@@ -102,7 +120,10 @@ fn legacy_exa_engine_with_key_keeps_exa_direct() {
fn exa_key_under_managed_engine_stays_managed() {
let mut cfg = legacy("engine = \"managed\"\n[exa]\napi_key = \"e\"\n");
cfg.migrate_legacy(LegacySearchInputs::default());
- assert_eq!(provider(&cfg, "exa"), Some(SearchProviderSettings::managed()));
+ assert_eq!(
+ provider(&cfg, "exa"),
+ Some(SearchProviderSettings::managed())
+ );
}
#[test]
@@ -112,7 +133,10 @@ fn parallel_selection_and_key_are_dropped() {
assert!(!cfg.providers.contains_key("parallel"));
assert!(cfg.parallel.key().is_none());
// Parallel's roles fall to the managed defaults.
- assert_eq!(provider(&cfg, "exa"), Some(SearchProviderSettings::managed()));
+ assert_eq!(
+ provider(&cfg, "exa"),
+ Some(SearchProviderSettings::managed())
+ );
let written = toml::to_string(&cfg).unwrap();
assert!(!written.contains("parallel"), "{written}");
assert!(!written.contains("engine"), "{written}");
@@ -125,10 +149,22 @@ fn explicit_provider_selection_maps_managed_and_routes() {
gemini_route = \"direct\"\n[gemini]\napi_key = \"g\"\n",
);
cfg.migrate_legacy(LegacySearchInputs::default());
- assert_eq!(provider(&cfg, "exa"), Some(SearchProviderSettings::managed()));
- assert_eq!(provider(&cfg, "gemini"), Some(SearchProviderSettings::direct()));
- assert_eq!(provider(&cfg, "tinyfish"), Some(SearchProviderSettings::managed()));
- assert_eq!(provider(&cfg, "querit"), Some(SearchProviderSettings::direct()));
+ assert_eq!(
+ provider(&cfg, "exa"),
+ Some(SearchProviderSettings::managed())
+ );
+ assert_eq!(
+ provider(&cfg, "gemini"),
+ Some(SearchProviderSettings::direct())
+ );
+ assert_eq!(
+ provider(&cfg, "tinyfish"),
+ Some(SearchProviderSettings::managed())
+ );
+ assert_eq!(
+ provider(&cfg, "querit"),
+ Some(SearchProviderSettings::direct())
+ );
assert!(!cfg.providers.contains_key("parallel"));
assert!(cfg.enabled_providers.is_none());
}
@@ -141,9 +177,18 @@ fn legacy_toggles_outside_search_migrate_when_active() {
seltz_active: true,
searxng_active: true,
});
- assert_eq!(provider(&cfg, "tinyfish"), Some(SearchProviderSettings::managed()));
- assert_eq!(provider(&cfg, "seltz"), Some(SearchProviderSettings::direct()));
- assert_eq!(provider(&cfg, "searxng"), Some(SearchProviderSettings::direct()));
+ assert_eq!(
+ provider(&cfg, "tinyfish"),
+ Some(SearchProviderSettings::managed())
+ );
+ assert_eq!(
+ provider(&cfg, "seltz"),
+ Some(SearchProviderSettings::direct())
+ );
+ assert_eq!(
+ provider(&cfg, "searxng"),
+ Some(SearchProviderSettings::direct())
+ );
}
#[test]
@@ -194,6 +239,9 @@ fn route_and_presentation_parse_accept_legacy_spellings() {
fn credentials_resolve_per_provider() {
let mut cfg = SearchConfig::default();
cfg.credentials_mut("gemini").unwrap().api_key = Some(" g ".into());
- assert_eq!(cfg.credentials("gemini_deep_research").unwrap().key(), Some("g"));
+ assert_eq!(
+ cfg.credentials("gemini_deep_research").unwrap().key(),
+ Some("g")
+ );
assert!(cfg.credentials("seltz").is_none());
}
diff --git a/crates/openhuman-core/src/config/schemas/controllers/integrations.rs b/crates/openhuman-core/src/config/schemas/controllers/integrations.rs
index 29ff4a9652..e8dca740da 100644
--- a/crates/openhuman-core/src/config/schemas/controllers/integrations.rs
+++ b/crates/openhuman-core/src/config/schemas/controllers/integrations.rs
@@ -5,9 +5,7 @@ use serde_json::{Map, Value};
use crate::config::rpc as config_rpc;
use crate::core::all::ControllerFuture;
-use super::super::helpers::{
- deserialize_params, to_json, ComposioTriggerSettingsUpdate,
-};
+use super::super::helpers::{deserialize_params, to_json, ComposioTriggerSettingsUpdate};
pub(super) fn handle_update_search_settings(params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
diff --git a/crates/openhuman-core/src/mcp/server/tools/mod.rs b/crates/openhuman-core/src/mcp/server/tools/mod.rs
index 3c034ac71d..1ec1ce84b9 100644
--- a/crates/openhuman-core/src/mcp/server/tools/mod.rs
+++ b/crates/openhuman-core/src/mcp/server/tools/mod.rs
@@ -40,14 +40,14 @@ pub use crate::config::rpc as config_rpc;
#[cfg(all(test, feature = "mcp"))]
pub use crate::core::all;
#[cfg(all(test, feature = "mcp"))]
-pub use types::SEARCH_MAX_RESULTS;
-#[cfg(all(test, feature = "mcp"))]
pub use dispatch::{mcp_dispatch_block_reason, subagent_summary_line};
#[cfg(all(test, feature = "mcp"))]
pub use params::{build_rpc_params, slug_from};
#[cfg(all(test, feature = "mcp"))]
pub use serde_json::{json, Value};
#[cfg(all(test, feature = "mcp"))]
+pub use types::SEARCH_MAX_RESULTS;
+#[cfg(all(test, feature = "mcp"))]
pub use types::{DEFAULT_LIMIT, MAX_LIMIT, TREE_TAG_MAX_TAGS, TREE_TAG_MAX_TAG_LENGTH};
#[cfg(all(test, feature = "mcp"))]
diff --git a/crates/openhuman-core/src/mcp/server/tools/params.rs b/crates/openhuman-core/src/mcp/server/tools/params.rs
index 45846f76b9..e57a5d733d 100644
--- a/crates/openhuman-core/src/mcp/server/tools/params.rs
+++ b/crates/openhuman-core/src/mcp/server/tools/params.rs
@@ -4,9 +4,10 @@ use crate::core::all;
use super::types::{
McpToolSpec, ToolCallError, DEFAULT_LIMIT, MAX_LIMIT, MEMORY_NOTE_ARGUMENTS,
- MEMORY_STORE_ARGUMENTS, QUERY_ARGUMENTS, SEARCH_MAX_RESULTS, SEARXNG_SEARCH_ARGUMENTS, SUBAGENT_RUN_ARGUMENTS, WEB_ANSWER_ARGUMENTS, WEB_SEARCH_ARGUMENTS,
- TREE_BROWSE_ARGUMENTS, TREE_LIST_SOURCES_ARGUMENTS, TREE_READ_CHUNK_ARGUMENTS,
- TREE_TAG_ARGUMENTS, TREE_TAG_MAX_TAGS, TREE_TAG_MAX_TAG_LENGTH, TREE_TOP_ENTITIES_ARGUMENTS,
+ MEMORY_STORE_ARGUMENTS, QUERY_ARGUMENTS, SEARCH_MAX_RESULTS, SEARXNG_SEARCH_ARGUMENTS,
+ SUBAGENT_RUN_ARGUMENTS, TREE_BROWSE_ARGUMENTS, TREE_LIST_SOURCES_ARGUMENTS,
+ TREE_READ_CHUNK_ARGUMENTS, TREE_TAG_ARGUMENTS, TREE_TAG_MAX_TAGS, TREE_TAG_MAX_TAG_LENGTH,
+ TREE_TOP_ENTITIES_ARGUMENTS, WEB_ANSWER_ARGUMENTS, WEB_SEARCH_ARGUMENTS,
};
pub fn build_rpc_params(
diff --git a/crates/openhuman-core/src/mcp/server/tools/specs.rs b/crates/openhuman-core/src/mcp/server/tools/specs.rs
index bbd05fb40b..a266b9847a 100644
--- a/crates/openhuman-core/src/mcp/server/tools/specs.rs
+++ b/crates/openhuman-core/src/mcp/server/tools/specs.rs
@@ -11,7 +11,11 @@ pub fn tool_specs() -> Vec<McpToolSpec> {
/// Every search tool MCP can expose; `list_tools_result_for_config` keeps
/// only those whose role has a usable provider.
pub fn search_tool_specs() -> Vec<McpToolSpec> {
- vec![web_search_tool_spec(), web_answer_tool_spec(), searxng_tool_spec()]
+ vec![
+ web_search_tool_spec(),
+ web_answer_tool_spec(),
+ searxng_tool_spec(),
+ ]
}
pub fn web_search_tool_spec() -> McpToolSpec {
@@ -285,7 +289,10 @@ pub fn list_tools_result_for_config(config: &crate::config::Config) -> Value {
}
/// Base tools plus the search tools this config can serve.
-pub fn tool_specs_for_config(config: &crate::config::Config, managed_available: bool) -> Vec<McpToolSpec> {
+pub fn tool_specs_for_config(
+ config: &crate::config::Config,
+ managed_available: bool,
+) -> Vec<McpToolSpec> {
use crate::search::providers::{effective_role_providers, resolve_with};
use tinysearch_bus::Role;
diff --git a/crates/openhuman-core/src/mcp/server/tools_tests_params_and_specs_tests.rs b/crates/openhuman-core/src/mcp/server/tools_tests_params_and_specs_tests.rs
index 7af1fc534a..c919241dfa 100644
--- a/crates/openhuman-core/src/mcp/server/tools_tests_params_and_specs_tests.rs
+++ b/crates/openhuman-core/src/mcp/server/tools_tests_params_and_specs_tests.rs
@@ -136,10 +136,10 @@ fn run_subagent_annotations_signal_act_semantics() {
#[test]
fn list_tools_includes_searxng_when_enabled() {
let mut config = crate::config::Config::default();
- config
- .search
- .providers
- .insert("searxng".into(), crate::config::SearchProviderSettings::direct());
+ config.search.providers.insert(
+ "searxng".into(),
+ crate::config::SearchProviderSettings::direct(),
+ );
let result = list_tools_result_for_config(&config);
let names = result["tools"]
.as_array()
@@ -259,8 +259,8 @@ fn web_search_params_accept_a_pinned_provider() {
#[test]
fn web_answer_params_validate_depth() {
- let params = build_rpc_params("web_answer", json!({"query": "why", "depth": "deep"}))
- .expect("params");
+ let params =
+ build_rpc_params("web_answer", json!({"query": "why", "depth": "deep"})).expect("params");
assert_eq!(params["depth"], "deep");
let err = build_rpc_params("web_answer", json!({"query": "why", "depth": "long"}))
.expect_err("must reject");
diff --git a/crates/openhuman-core/src/modules/search/config_tests.rs b/crates/openhuman-core/src/modules/search/config_tests.rs
index e917775bc1..bda4626071 100644
--- a/crates/openhuman-core/src/modules/search/config_tests.rs
+++ b/crates/openhuman-core/src/modules/search/config_tests.rs
@@ -88,7 +88,10 @@ fn role_tools_follow_provider_selection() {
"web_contents_tool".to_string()
]
);
- select(&mut config, &[("gemini", SearchProviderSettings::managed())]);
+ select(
+ &mut config,
+ &[("gemini", SearchProviderSettings::managed())],
+ );
let names: Vec<String> = configured_tool_specs(&config)
.into_iter()
.map(|spec| spec.name)
@@ -163,7 +166,10 @@ fn seltz_and_searxng_use_their_own_sections() {
config.searxng.base_url = "http://127.0.0.1:8888".into();
let payload = module_config(&config);
assert!(payload.providers["seltz"].enabled);
- assert_eq!(payload.providers["seltz"].credential.as_deref(), Some("test-secret"));
+ assert_eq!(
+ payload.providers["seltz"].credential.as_deref(),
+ Some("test-secret")
+ );
assert!(payload.providers["searxng"].enabled);
assert_eq!(
payload.providers["searxng"].base_url.as_deref(),
diff --git a/crates/openhuman-core/src/modules/search/mod.rs b/crates/openhuman-core/src/modules/search/mod.rs
index 1e11d9992e..aa855263a2 100644
--- a/crates/openhuman-core/src/modules/search/mod.rs
+++ b/crates/openhuman-core/src/modules/search/mod.rs
@@ -34,7 +34,11 @@ fn direct_settings(config: &Config, provider: &str) -> ProviderConfig {
};
match provider {
"seltz" => {
- settings.credential = config.seltz.api_key.clone().filter(|k| !k.trim().is_empty());
+ settings.credential = config
+ .seltz
+ .api_key
+ .clone()
+ .filter(|k| !k.trim().is_empty());
settings.base_url = config.seltz.api_url.clone();
settings.max_results = Some(config.seltz.max_results as u64);
settings.timeout_secs = Some(config.seltz.timeout_secs);
@@ -93,7 +97,9 @@ pub fn module_config(config: &Config) -> ModuleSearchConfig {
.collect();
// Deep research runs on the direct Gemini API and needs the user's key,
// even when grounded Gemini answers go through the managed route.
- if module_providers.contains_key("gemini") && !module_providers.contains_key("gemini_deep_research") {
+ if module_providers.contains_key("gemini")
+ && !module_providers.contains_key("gemini_deep_research")
+ {
let mut deep = direct_settings(config, "gemini_deep_research");
deep.enabled = config.search.is_enabled() && deep.credential.is_some();
module_providers.insert("gemini_deep_research".into(), deep);
diff --git a/crates/openhuman-core/src/search/bus.rs b/crates/openhuman-core/src/search/bus.rs
index ea7e241a35..0a820f85a7 100644
--- a/crates/openhuman-core/src/search/bus.rs
+++ b/crates/openhuman-core/src/search/bus.rs
@@ -38,8 +38,12 @@ impl EventHandler<DomainEvent> for CredentialRefreshSubscriber {
}
};
match crate::modules::search::refresh_loaded(&config).await {
- Ok(()) => tracing::debug!(kind = %kind, "[search][bus] module refreshed after credential change"),
- Err(error) => tracing::warn!(kind = %kind, %error, "[search][bus] module refresh failed"),
+ Ok(()) => {
+ tracing::debug!(kind = %kind, "[search][bus] module refreshed after credential change")
+ }
+ Err(error) => {
+ tracing::warn!(kind = %kind, %error, "[search][bus] module refresh failed")
+ }
}
}
}
@@ -48,7 +52,9 @@ impl EventHandler<DomainEvent> for CredentialRefreshSubscriber {
pub fn register_credential_refresh_subscriber() {
match crate::core::bus::BUS.subscribe(Arc::new(CredentialRefreshSubscriber)) {
Some(handle) => std::mem::forget(handle),
- None => tracing::warn!("[search][bus] failed to register credential refresh — bus not initialized"),
+ None => tracing::warn!(
+ "[search][bus] failed to register credential refresh — bus not initialized"
+ ),
}
}
diff --git a/crates/openhuman-core/src/search/providers.rs b/crates/openhuman-core/src/search/providers.rs
index c2268f35fa..a4e6149be2 100644
--- a/crates/openhuman-core/src/search/providers.rs
+++ b/crates/openhuman-core/src/search/providers.rs
@@ -140,7 +140,11 @@ pub fn role_order(config: &Config, role: Role) -> Vec<String> {
/// Usable providers for `role`, in serving order. The first one answers; the
/// rest are fallbacks.
-pub fn effective_role_providers(resolved: &[ResolvedProvider], config: &Config, role: Role) -> Vec<String> {
+pub fn effective_role_providers(
+ resolved: &[ResolvedProvider],
+ config: &Config,
+ role: Role,
+) -> Vec<String> {
role_order(config, role)
.into_iter()
.filter(|provider| {
diff --git a/crates/openhuman-core/src/search/providers_tests.rs b/crates/openhuman-core/src/search/providers_tests.rs
index 48c2532242..5a16745902 100644
--- a/crates/openhuman-core/src/search/providers_tests.rs
+++ b/crates/openhuman-core/src/search/providers_tests.rs
@@ -11,7 +11,10 @@ fn config_with(providers: &[(&str, SearchProviderSettings)]) -> Config {
}
fn find<'a>(resolved: &'a [ResolvedProvider], id: &str) -> &'a ResolvedProvider {
- resolved.iter().find(|p| p.id == id).expect("provider resolved")
+ resolved
+ .iter()
+ .find(|p| p.id == id)
+ .expect("provider resolved")
}
#[test]
@@ -80,7 +83,10 @@ fn search_off_makes_nothing_usable() {
config.search.enabled = Some(false);
let resolved = resolve_with(&config, true);
assert!(resolved.iter().all(|p| !p.usable));
- assert_eq!(find(&resolved, "exa").status(false), ProviderStatus::SearchOff);
+ assert_eq!(
+ find(&resolved, "exa").status(false),
+ ProviderStatus::SearchOff
+ );
}
#[test]
@@ -123,7 +129,10 @@ fn role_order_drops_providers_that_cannot_serve_the_role() {
.search
.roles
.insert("answer".into(), vec!["brave".into(), "gemini".into()]);
- assert_eq!(role_order(&config, Role::Answer), vec!["gemini".to_string()]);
+ assert_eq!(
+ role_order(&config, Role::Answer),
+ vec!["gemini".to_string()]
+ );
}
#[test]
diff --git a/crates/openhuman-core/src/search/render.rs b/crates/openhuman-core/src/search/render.rs
index 9ea15ac188..5608ee9111 100644
--- a/crates/openhuman-core/src/search/render.rs
+++ b/crates/openhuman-core/src/search/render.rs
@@ -62,7 +62,8 @@ pub fn render(
let provider = provider_label(&response.provider);
let mut result = ToolResult::success(render_text(response, subject, &provider, max_results));
if prefer_markdown {
- result.markdown_formatted = Some(render_markdown(response, subject, &provider, max_results));
+ result.markdown_formatted =
+ Some(render_markdown(response, subject, &provider, max_results));
}
result.metadata = Some(metadata(response, subject, &provider, max_results));
result
@@ -97,7 +98,12 @@ fn render_text(
max_results: usize,
) -> String {
let mut lines = vec![heading(response, subject, provider)];
- if let Some(answer) = response.answer.as_deref().map(str::trim).filter(|a| !a.is_empty()) {
+ if let Some(answer) = response
+ .answer
+ .as_deref()
+ .map(str::trim)
+ .filter(|a| !a.is_empty())
+ {
lines.push(String::new());
lines.push(answer.to_string());
}
@@ -109,10 +115,20 @@ fn render_text(
};
lines.push(format!("{}. {}", index + 1, title));
lines.push(format!(" {}", item.url.trim()));
- if let Some(date) = item.published.as_deref().map(str::trim).filter(|d| !d.is_empty()) {
+ if let Some(date) = item
+ .published
+ .as_deref()
+ .map(str::trim)
+ .filter(|d| !d.is_empty())
+ {
lines.push(format!(" Published: {date}"));
}
- if let Some(snippet) = item.snippet.as_deref().map(str::trim).filter(|s| !s.is_empty()) {
+ if let Some(snippet) = item
+ .snippet
+ .as_deref()
+ .map(str::trim)
+ .filter(|s| !s.is_empty())
+ {
lines.push(format!(
" {}",
crate::util::truncate_with_suffix(snippet, TEXT_EXCERPT_CHARS, "…")
@@ -123,7 +139,12 @@ fn render_text(
lines.push(String::new());
lines.push("Sources:".into());
for (index, citation) in response.citations.iter().enumerate() {
- match citation.title.as_deref().map(str::trim).filter(|t| !t.is_empty()) {
+ match citation
+ .title
+ .as_deref()
+ .map(str::trim)
+ .filter(|t| !t.is_empty())
+ {
Some(title) => lines.push(format!("[{}] {} — {}", index + 1, title, citation.url)),
None => lines.push(format!("[{}] {}", index + 1, citation.url)),
}
@@ -139,7 +160,12 @@ fn render_markdown(
max_results: usize,
) -> String {
let mut out = format!("# {}\n", heading(response, subject, provider));
- if let Some(answer) = response.answer.as_deref().map(str::trim).filter(|a| !a.is_empty()) {
+ if let Some(answer) = response
+ .answer
+ .as_deref()
+ .map(str::trim)
+ .filter(|a| !a.is_empty())
+ {
out.push_str(&format!("\n{answer}\n"));
}
for item in response.results.iter().take(max_results) {
@@ -149,10 +175,20 @@ fn render_markdown(
item.title.trim()
};
out.push_str(&format!("\n## [{title}]({})\n", item.url.trim()));
- if let Some(date) = item.published.as_deref().map(str::trim).filter(|d| !d.is_empty()) {
+ if let Some(date) = item
+ .published
+ .as_deref()
+ .map(str::trim)
+ .filter(|d| !d.is_empty())
+ {
out.push_str(&format!("_Published: {date}_\n\n"));
}
- if let Some(snippet) = item.snippet.as_deref().map(str::trim).filter(|s| !s.is_empty()) {
+ if let Some(snippet) = item
+ .snippet
+ .as_deref()
+ .map(str::trim)
+ .filter(|s| !s.is_empty())
+ {
out.push_str(&format!(
"> {}\n",
crate::util::truncate_with_suffix(snippet, TEXT_EXCERPT_CHARS, "…")
@@ -186,10 +222,20 @@ fn metadata(
.take(max_results)
.map(|item| {
let mut obj = json!({ "title": item.title, "url": item.url });
- if let Some(published) = item.published.as_deref().map(str::trim).filter(|s| !s.is_empty()) {
+ if let Some(published) = item
+ .published
+ .as_deref()
+ .map(str::trim)
+ .filter(|s| !s.is_empty())
+ {
obj["published"] = json!(published);
}
- if let Some(snippet) = item.snippet.as_deref().map(str::trim).filter(|s| !s.is_empty()) {
+ if let Some(snippet) = item
+ .snippet
+ .as_deref()
+ .map(str::trim)
+ .filter(|s| !s.is_empty())
+ {
obj["excerpt"] = json!(crate::util::truncate_with_ellipsis(
snippet,
METADATA_EXCERPT_CHARS
@@ -207,7 +253,12 @@ fn metadata(
if let Some(role) = response.role {
payload["role"] = json!(role);
}
- if let Some(answer) = response.answer.as_deref().map(str::trim).filter(|a| !a.is_empty()) {
+ if let Some(answer) = response
+ .answer
+ .as_deref()
+ .map(str::trim)
+ .filter(|a| !a.is_empty())
+ {
payload["answer"] = json!(answer);
}
if !response.citations.is_empty() {
diff --git a/crates/openhuman-core/src/search/render_tests.rs b/crates/openhuman-core/src/search/render_tests.rs
index a4b96698b7..860287bb71 100644
--- a/crates/openhuman-core/src/search/render_tests.rs
+++ b/crates/openhuman-core/src/search/render_tests.rs
@@ -94,7 +94,13 @@ fn results_are_capped_and_subject_reads_urls() {
})
.collect();
let result = render(&many, "q", 3, false);
- assert_eq!(result.metadata.unwrap()["results"].as_array().unwrap().len(), 3);
+ assert_eq!(
+ result.metadata.unwrap()["results"]
+ .as_array()
+ .unwrap()
+ .len(),
+ 3
+ );
assert_eq!(
subject(&serde_json::json!({"urls": ["https://a", "https://b"]})),
"https://a, https://b"
diff --git a/crates/openhuman-core/src/search/tools.rs b/crates/openhuman-core/src/search/tools.rs
index 4d1f27285c..c6c6beb578 100644
--- a/crates/openhuman-core/src/search/tools.rs
+++ b/crates/openhuman-core/src/search/tools.rs
@@ -81,7 +81,10 @@ pub fn user_facing_error(error: &str) -> String {
.to_string()
}
c if c == errors::INVALID_ARGUMENTS => {
- format!("The search request was rejected: {}", error.split_once(": ").map(|(_, d)| d).unwrap_or(error))
+ format!(
+ "The search request was rejected: {}",
+ error.split_once(": ").map(|(_, d)| d).unwrap_or(error)
+ )
}
_ => format!("Web search failed: {error}"),
}
diff --git a/crates/openhuman-core/src/search/tools_tests.rs b/crates/openhuman-core/src/search/tools_tests.rs
index 15b074d90a..b8f1ce00bc 100644
--- a/crates/openhuman-core/src/search/tools_tests.rs
+++ b/crates/openhuman-core/src/search/tools_tests.rs
@@ -25,7 +25,10 @@ fn classified_errors_become_actionable_messages() {
"The search request was rejected: urls must not be empty"
);
assert_eq!(user_facing_error("boom"), "Web search failed: boom");
- assert_eq!(error_code("x tinysearch.rate_limited: y"), Some("rate_limited"));
+ assert_eq!(
+ error_code("x tinysearch.rate_limited: y"),
+ Some("rate_limited")
+ );
assert_eq!(error_code("plain"), None);
}
@@ -38,7 +41,10 @@ fn role_tools_are_built_for_usable_byok_providers() {
assert!(names.contains(&"web_contents_tool"), "{names:?}");
// Nothing usable can answer without a session or a Gemini key.
assert!(!names.contains(&"web_answer_tool"), "{names:?}");
- let search = tools.iter().find(|t| t.name() == "web_search_tool").unwrap();
+ let search = tools
+ .iter()
+ .find(|t| t.name() == "web_search_tool")
+ .unwrap();
assert_eq!(search.category(), ToolCategory::Workflow);
assert!(search.supports_markdown());
assert!(search.parameters_schema()["properties"]["query"].is_object());
diff --git a/crates/openhuman-core/src/tools/schemas/web_search.rs b/crates/openhuman-core/src/tools/schemas/web_search.rs
index 0bb9fcf132..9f4f887d86 100644
--- a/crates/openhuman-core/src/tools/schemas/web_search.rs
+++ b/crates/openhuman-core/src/tools/schemas/web_search.rs
@@ -29,7 +29,11 @@ fn optional_text(params: &Map<String, Value>, key: &str) -> Option<String> {
}
/// Run one role tool and shape the response for RPC callers.
-async fn run_role_tool(tool: &'static str, arguments: Value, method: &str) -> Result<Value, String> {
+async fn run_role_tool(
+ tool: &'static str,
+ arguments: Value,
+ method: &str,
+) -> Result<Value, String> {
let config = config_rpc::load_config_with_timeout().await?;
run_role_tool_with(&config, tool, arguments, method).await
}
@@ -86,7 +90,10 @@ fn search_arguments(params: &Map<String, Value>, provider: Option<&str>) -> Resu
if let Some(max) = params.get("max_results").and_then(Value::as_u64) {
arguments["max_results"] = json!(max.clamp(1, 20));
}
- if let Some(provider) = provider.map(str::to_string).or_else(|| optional_text(params, "provider")) {
+ if let Some(provider) = provider
+ .map(str::to_string)
+ .or_else(|| optional_text(params, "provider"))
+ {
arguments["provider"] = json!(provider);
}
let pinned = arguments
@@ -112,7 +119,12 @@ pub(super) fn handle_web_search(params: Map<String, Value>) -> ControllerFuture
pub(super) fn handle_searxng_search(params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let arguments = search_arguments(&params, Some("searxng"))?;
- run_role_tool(tinysearch_bus::tools::WEB_SEARCH, arguments, "searxng_search").await
+ run_role_tool(
+ tinysearch_bus::tools::WEB_SEARCH,
+ arguments,
+ "searxng_search",
+ )
+ .await
})
}
@@ -129,7 +141,10 @@ pub(super) fn handle_web_answer(params: Map<String, Value>) -> ControllerFuture
if let Some(provider) = optional_text(&params, "provider") {
arguments["provider"] = json!(provider);
}
- tracing::debug!(query_len = query.chars().count(), "[rpc][tools.web_answer] request");
+ tracing::debug!(
+ query_len = query.chars().count(),
+ "[rpc][tools.web_answer] request"
+ );
run_role_tool(tinysearch_bus::tools::WEB_ANSWER, arguments, "web_answer").await
})
}
@@ -148,7 +163,12 @@ pub(super) fn handle_web_contents(params: Map<String, Value>) -> ControllerFutur
arguments["provider"] = json!(provider);
}
tracing::debug!(urls = urls.len(), "[rpc][tools.web_contents] request");
- run_role_tool(tinysearch_bus::tools::WEB_CONTENTS, arguments, "web_contents").await
+ run_role_tool(
+ tinysearch_bus::tools::WEB_CONTENTS,
+ arguments,
+ "web_contents",
+ )
+ .await
})
}
@@ -176,4 +196,3 @@ pub(super) fn optional_string_array(
})
.collect()
}
-