Skip to content

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

refactor(memory): remove redundant parentheses around string literals

Steven Enamakel55658c21fdb7
diff --git a/crates/openhuman-core/src/memory/brain.rs b/crates/openhuman-core/src/memory/brain.rs
index 914e9425cd..c74d9346ec 100644
--- a/crates/openhuman-core/src/memory/brain.rs
+++ b/crates/openhuman-core/src/memory/brain.rs
@@ -154,7 +154,7 @@ pub async fn search(
) -> Result<BrainSearchView> {
let query = params.query.trim();
if query.is_empty() {
- return Err(Error::InvalidRequest(("the query is blank").into()));
+ return Err(Error::InvalidRequest("the query is blank".into()));
}
let source = params.source.as_deref().map(parse_source).transpose()?;
let limit = super::types::clamp_limit(params.limit);
diff --git a/crates/openhuman-core/src/memory/engine.rs b/crates/openhuman-core/src/memory/engine.rs
index d1d11c02b7..665b0662a5 100644
--- a/crates/openhuman-core/src/memory/engine.rs
+++ b/crates/openhuman-core/src/memory/engine.rs
@@ -630,7 +630,7 @@ pub fn read_cortexdb_key(config: &Config) -> anyhow::Result<Option<String>> {
pub fn store_cortexdb_key(config: &Config, key: &str) -> Result<()> {
let key = key.trim();
if key.is_empty() {
- return Err(Error::InvalidRequest(("the API key is blank").into()));
+ return Err(Error::InvalidRequest("the API key is blank".into()));
}
AuthService::from_config(config)
.store_provider_token(
diff --git a/crates/openhuman-core/src/memory/ops.rs b/crates/openhuman-core/src/memory/ops.rs
index b5d4ef7646..ee816ebb5e 100644
--- a/crates/openhuman-core/src/memory/ops.rs
+++ b/crates/openhuman-core/src/memory/ops.rs
@@ -147,7 +147,7 @@ pub fn apply_engine_set(config: &mut Config, params: &EngineSetParams) -> Result
fn validate_endpoint(endpoint: &str) -> Result<()> {
let parsed = url::Url::parse(endpoint)
- .map_err(|_| Error::InvalidRequest(("the endpoint is not a valid URL").into()))?;
+ .map_err(|_| Error::InvalidRequest("the endpoint is not a valid URL".into()))?;
if !matches!(parsed.scheme(), "http" | "https") || parsed.host_str().is_none() {
return Err(Error::InvalidRequest(
("the endpoint must be an http(s) URL with a host").into(),
diff --git a/crates/openhuman-core/src/memory/sources/mod.rs b/crates/openhuman-core/src/memory/sources/mod.rs
index f56f1a67da..ec6cbdcb72 100644
--- a/crates/openhuman-core/src/memory/sources/mod.rs
+++ b/crates/openhuman-core/src/memory/sources/mod.rs
@@ -59,7 +59,7 @@ pub fn list(config: &Config) -> Vec<SourceView> {
pub fn normalize_target(kind: MemorySourceKind, target: &str) -> Result<String> {
let target = target.trim();
if target.is_empty() {
- return Err(Error::InvalidRequest(("target must not be empty").into()));
+ return Err(Error::InvalidRequest("target must not be empty".into()));
}
match kind {
MemorySourceKind::Folder | MemorySourceKind::File => Ok(target.to_string()),
@@ -82,8 +82,8 @@ pub fn normalize_target(kind: MemorySourceKind, target: &str) -> Result<String>
}
fn http_url(target: &str) -> Result<String> {
- let url = url::Url::parse(target)
- .map_err(|_| Error::InvalidRequest(("target is not a URL").into()))?;
+ let url =
+ url::Url::parse(target).map_err(|_| Error::InvalidRequest("target is not a URL".into()))?;
if !matches!(url.scheme(), "http" | "https") || url.host_str().is_none() {
return Err(Error::InvalidRequest(
("target must be an http(s) URL").into(),
diff --git a/crates/openhuman-core/src/memory/tool_writes.rs b/crates/openhuman-core/src/memory/tool_writes.rs
index dcb4847659..f280ccd4ce 100644
--- a/crates/openhuman-core/src/memory/tool_writes.rs
+++ b/crates/openhuman-core/src/memory/tool_writes.rs
@@ -171,7 +171,7 @@ pub(super) fn enqueue(
let operation = match args.get("action").and_then(serde_json::Value::as_str) {
Some("learn") => {
let mut params: LearnParams = serde_json::from_value(args.clone())
- .map_err(|_| Error::InvalidRequest(("invalid learning arguments").into()))?;
+ .map_err(|_| Error::InvalidRequest("invalid learning arguments".into()))?;
params.meta = None;
let mut item = super::ops::learning_item(params, Some(facts.learn_meta()))?;
if let Some(root) = confinement {
@@ -188,7 +188,7 @@ pub(super) fn enqueue(
}
Some("forget") => {
let params: ForgetParams = serde_json::from_value(args.clone())
- .map_err(|_| Error::InvalidRequest(("invalid forgetting arguments").into()))?;
+ .map_err(|_| Error::InvalidRequest("invalid forgetting arguments".into()))?;
let mut ids: Vec<_> = params
.ids
.into_iter()
@@ -204,7 +204,7 @@ pub(super) fn enqueue(
}
WriteOperation::Forget { ids, reach }
}
- _ => return Err(Error::InvalidRequest(("expected a memory write").into())),
+ _ => return Err(Error::InvalidRequest("expected a memory write".into())),
};
let _guard = LOCK
.lock()