Skip to content

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

chore: files changed crates/openhuman-core/src/memory/engine.rs,crates/openhuman-core/src/memory/eng

Steven Enamakel2906585ac67b
diff --git a/crates/openhuman-core/src/memory/engine.rs b/crates/openhuman-core/src/memory/engine.rs
index b825fd2e25..e48d819019 100644
--- a/crates/openhuman-core/src/memory/engine.rs
+++ b/crates/openhuman-core/src/memory/engine.rs
@@ -121,7 +121,7 @@ pub use tinymemory_integrations::HOST_ENGINE_ENDPOINT;
/// Binds `engine` for every config in this process, ahead of the configured
/// one. For an embedding host that owns its memory store; the engine's writes
-/// are scrubbed like any other's ([`super::guard`]). A later call replaces the
+/// are scrubbed by the native binder like any other's. A later call replaces the
/// earlier engine. Writes are scrubbed under the host policy and operations
/// are timed by TinyMemory's native binder.
pub fn install_host_engine(engine: Arc<dyn MemoryEngine>) {
diff --git a/crates/openhuman-core/src/memory/engine_tests.rs b/crates/openhuman-core/src/memory/engine_tests.rs
index 885006e80f..1ae7648050 100644
--- a/crates/openhuman-core/src/memory/engine_tests.rs
+++ b/crates/openhuman-core/src/memory/engine_tests.rs
@@ -328,9 +328,7 @@ fn the_cache_fingerprint_never_contains_the_key() {
async fn host_bearer_reads_the_credential_per_request() {
let tmp = tempfile::tempdir().unwrap();
let config = config_in(&tmp);
- let source = HostBearer {
- config: Arc::new(config.clone()),
- };
+ let source = backend_bearer_source(Arc::new(config.clone()));
let error = source.bearer().await.unwrap_err();
assert!(matches!(error, tinymemory_api::Error::Unauthorized(_)));
@@ -351,9 +349,7 @@ async fn host_bearer_rejects_a_local_session_token() {
true,
)
.unwrap();
- let source = HostBearer {
- config: Arc::new(config),
- };
+ let source = backend_bearer_source(Arc::new(config));
let error = source.bearer().await.unwrap_err();
diff --git a/crates/openhuman-tinyhumans/src/transport/memory_bearer_tests.rs b/crates/openhuman-tinyhumans/src/transport/memory_bearer_tests.rs
new file mode 100644
index 0000000000..be717e592f
--- /dev/null
+++ b/crates/openhuman-tinyhumans/src/transport/memory_bearer_tests.rs
@@ -0,0 +1,47 @@
+use std::sync::Arc;
+
+use openhuman_embed::__host::config::Config;
+use tempfile::TempDir;
+
+use super::SdkBackendTransport;
+
+fn config(tmp: &TempDir) -> Config {
+ Config {
+ workspace_dir: tmp.path().join("workspace"),
+ action_dir: tmp.path().join("workspace"),
+ config_path: tmp.path().join("config.toml"),
+ ..Config::default()
+ }
+}
+
+#[tokio::test]
+async fn memory_bearer_reads_the_host_credential_for_each_request() {
+ let tmp = TempDir::new().expect("temporary credential workspace");
+ let config = config(&tmp);
+ crate::hosted::test_support::store_session(&config, "jwt.first");
+ let transport = SdkBackendTransport::new().expect("SDK transport");
+ let source = transport
+ .memory_bearer_source(Arc::new(config.clone()))
+ .expect("SDK memory bearer source");
+
+ assert_eq!(source.bearer().await.unwrap(), "jwt.first");
+
+ crate::hosted::test_support::store_session(&config, "jwt.refreshed");
+ assert_eq!(source.bearer().await.unwrap(), "jwt.refreshed");
+}
+
+#[tokio::test]
+async fn memory_bearer_rejects_the_host_local_session() {
+ let tmp = TempDir::new().expect("temporary credential workspace");
+ let config = config(&tmp);
+ crate::hosted::test_support::store_session(&config, "desktop.test.local");
+ let transport = SdkBackendTransport::new().expect("SDK transport");
+ let source = transport
+ .memory_bearer_source(Arc::new(config))
+ .expect("SDK memory bearer source");
+
+ assert!(matches!(
+ source.bearer().await,
+ Err(openhuman_embed::__host::memory::MemoryError::Unauthorized(_))
+ ));
+}
diff --git a/crates/openhuman-tinyhumans/src/transport/mod.rs b/crates/openhuman-tinyhumans/src/transport/mod.rs
index ff94e43b8d..84a338783c 100644
--- a/crates/openhuman-tinyhumans/src/transport/mod.rs
+++ b/crates/openhuman-tinyhumans/src/transport/mod.rs
@@ -20,6 +20,10 @@ use tinyhumans_sdk::TinyHumansClient;
mod error;
+#[cfg(test)]
+#[path = "memory_bearer_tests.rs"]
+mod memory_bearer_tests;
+
pub use error::map_sdk_error;
/// One `reqwest::Client` per [`TransportProfile`], each built from