Skip to content

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

chore(memory): resolve result type and import name collisions

Steven Enamakelfe73de7a02c0
diff --git a/crates/openhuman-core/src/flows/memory_tools.rs b/crates/openhuman-core/src/flows/memory_tools.rs
index 7f3ce2efc4..d687e93afe 100644
--- a/crates/openhuman-core/src/flows/memory_tools.rs
+++ b/crates/openhuman-core/src/flows/memory_tools.rs
@@ -136,7 +136,7 @@ pub fn flow_meta(flow_id: &str, extra: &[String]) -> MemoryMeta {
pub async fn forget_matching(config: &Config, filter: MetaFilter) -> Result<usize> {
if filter.is_empty() {
return Err(Error::InvalidRequest((
- "refusing to forget with an empty filter",
+ "refusing to forget with an empty filter"
).into()));
}
let bound = match crate::memory::engine::resolve(config).engine() {
diff --git a/crates/openhuman-core/src/memory/backfill.rs b/crates/openhuman-core/src/memory/backfill.rs
index ed297d10f5..a03ff9dc23 100644
--- a/crates/openhuman-core/src/memory/backfill.rs
+++ b/crates/openhuman-core/src/memory/backfill.rs
@@ -217,7 +217,7 @@ pub async fn start(
) -> Result<BackfillView> {
if !params.consent {
return Err(Error::InvalidRequest((
- "storing past chats uploads them to the selected engine; pass consent: true",
+ "storing past chats uploads them to the selected engine; pass consent: true"
).into()));
}
let bound = engine::resolve(config).engine()?;
diff --git a/crates/openhuman-core/src/memory/deletion.rs b/crates/openhuman-core/src/memory/deletion.rs
index e1a2cf1431..a2cfda5476 100644
--- a/crates/openhuman-core/src/memory/deletion.rs
+++ b/crates/openhuman-core/src/memory/deletion.rs
@@ -39,7 +39,7 @@ struct FileStore {
}
impl ListStore<PendingDeletion> for FileStore {
- fn load(&self) -> Result<Vec<PendingDeletion>, StoreError> {
+ fn load(&self) -> std::result::Result<Vec<PendingDeletion>, StoreError> {
let Ok(text) = std::fs::read_to_string(&self.file) else {
return Ok(Vec::new());
};
diff --git a/crates/openhuman-core/src/memory/layout_migration/state.rs b/crates/openhuman-core/src/memory/layout_migration/state.rs
index f383dc0838..66de4e7150 100644
--- a/crates/openhuman-core/src/memory/layout_migration/state.rs
+++ b/crates/openhuman-core/src/memory/layout_migration/state.rs
@@ -6,7 +6,7 @@
use std::path::{Path, PathBuf};
-use tinymemory_tools::layout_migration::{Error, Result};
+use tinymemory_tools::layout_migration::{Error as MigrationError, Result as MigrationResult};
use super::{MigrationState, MigrationStateStore};
use tinymemory_api::{Error, Result};
@@ -34,12 +34,12 @@ impl FileStateStore {
}
impl MigrationStateStore for FileStateStore {
- fn load(&self) -> Result<MigrationState> {
- load(&self.workspace_dir).map_err(|error| Error::State(detail(error)))
+ fn load(&self) -> MigrationResult<MigrationState> {
+ load(&self.workspace_dir).map_err(|error| MigrationError::State(detail(error)))
}
- fn save(&self, state: &MigrationState) -> Result<()> {
- save(&self.workspace_dir, state).map_err(|error| Error::State(detail(error)))
+ fn save(&self, state: &MigrationState) -> MigrationResult<()> {
+ save(&self.workspace_dir, state).map_err(|error| MigrationError::State(detail(error)))
}
}
diff --git a/crates/openhuman-core/src/memory/lifecycle/views.rs b/crates/openhuman-core/src/memory/lifecycle/views.rs
index 896c5c07c1..cc20c9731a 100644
--- a/crates/openhuman-core/src/memory/lifecycle/views.rs
+++ b/crates/openhuman-core/src/memory/lifecycle/views.rs
@@ -169,7 +169,7 @@ fn validate_build_delay_secs(value: Option<u64>) -> Result<Option<u64>> {
.is_none()
{
return Err(Error::InvalidRequest((
- "build_delay_secs must fit within the supported date range",
+ "build_delay_secs must fit within the supported date range"
).into()));
}
Ok(Some(seconds))
diff --git a/crates/openhuman-core/src/memory/ops.rs b/crates/openhuman-core/src/memory/ops.rs
index 522c1fb6c6..912530d799 100644
--- a/crates/openhuman-core/src/memory/ops.rs
+++ b/crates/openhuman-core/src/memory/ops.rs
@@ -93,7 +93,7 @@ pub fn apply_engine_set(config: &mut Config, params: &EngineSetParams) -> Result
// switching back needs no re-entry.
if params.endpoint.is_some() || params.api_key.is_some() {
return Err(Error::InvalidRequest((
- "disabling memory takes no endpoint or API key",
+ "disabling memory takes no endpoint or API key"
).into()));
}
config.memory.engine = DISABLED_ENGINE.to_string();
@@ -130,7 +130,7 @@ pub fn apply_engine_set(config: &mut Config, params: &EngineSetParams) -> Result
CORTEXDB_ENGINE => engine::store_cortexdb_key(config, key)?,
TINYHUMANS_ENGINE => {
return Err(Error::InvalidRequest((
- "the tinyhumans engine uses your sign-in, not an API key",
+ "the tinyhumans engine uses your sign-in, not an API key"
).into()))
}
_ => return Err(Error::InvalidRequest(("this engine takes no API key").into())),
@@ -146,7 +146,7 @@ fn validate_endpoint(endpoint: &str) -> Result<()> {
.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",
+ "the endpoint must be an http(s) URL with a host"
).into()));
}
Ok(())
@@ -422,7 +422,7 @@ pub async fn erase_all(
) -> Result<EraseAllView> {
if !params.confirm {
return Err(Error::InvalidRequest((
- "erasing all memory needs confirm: true; nothing erased comes back",
+ "erasing all memory needs confirm: true; nothing erased comes back"
).into()));
}
let bound = bound(config)?;
diff --git a/crates/openhuman-core/src/memory/sources/mod.rs b/crates/openhuman-core/src/memory/sources/mod.rs
index fb6f47e27a..d92ff3e1fd 100644
--- a/crates/openhuman-core/src/memory/sources/mod.rs
+++ b/crates/openhuman-core/src/memory/sources/mod.rs
@@ -73,7 +73,7 @@ pub fn normalize_target(kind: MemorySourceKind, target: &str) -> Result<String>
Ok(format!("https://github.com/{owner}/{repo}"))
}
_ => Err(Error::InvalidRequest((
- "a GitHub target is `owner/repo` or a repository URL",
+ "a GitHub target is `owner/repo` or a repository URL"
).into())),
}
}
diff --git a/crates/openhuman-core/src/memory/tool_writes.rs b/crates/openhuman-core/src/memory/tool_writes.rs
index 49b389523a..031ff142ef 100644
--- a/crates/openhuman-core/src/memory/tool_writes.rs
+++ b/crates/openhuman-core/src/memory/tool_writes.rs
@@ -181,7 +181,7 @@ pub(super) fn enqueue(
}
if !super::user_scope::within(&item.meta().namespace, &reach.at) || reach.inherit {
return Err(Error::InvalidRequest((
- "learning namespace is outside the trusted reach",
+ "learning namespace is outside the trusted reach"
).into()));
}
WriteOperation::Learn {
@@ -233,7 +233,7 @@ struct FileStore {
}
impl ListStore<Entry> for FileStore {
- fn load(&self) -> Result<Vec<Entry>, StoreError> {
+ fn load(&self) -> std::result::Result<Vec<Entry>, StoreError> {
read_file(&self.file).map_err(|_| StoreError("queue file unreadable".into()))
}
diff --git a/crates/openhuman-core/src/memory/user_scope.rs b/crates/openhuman-core/src/memory/user_scope.rs
index ef647250f5..ac57635810 100644
--- a/crates/openhuman-core/src/memory/user_scope.rs
+++ b/crates/openhuman-core/src/memory/user_scope.rs
@@ -46,7 +46,7 @@ pub fn confinement_in(saas: bool, config: &Config) -> Result<Option<Namespace>>
"[memory:user_scope] no valid confinement root in SaaS mode"
);
Err(Error::InvalidRequest((
- "memory is unavailable: this agent has no valid memory root",
+ "memory is unavailable: this agent has no valid memory root"
).into()))
}
}