Skip to content

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

refactor(rpc): update session store and plan review module paths

Steven Enamakel46696a1e7a5c
diff --git a/crates/openhuman-rpc/src/server/socketio.rs b/crates/openhuman-rpc/src/server/socketio.rs
index 4efa0851c2..d6a116ee4b 100644
--- a/crates/openhuman-rpc/src/server/socketio.rs
+++ b/crates/openhuman-rpc/src/server/socketio.rs
@@ -32,10 +32,10 @@
use serde::Deserialize;
use serde::Serialize;
-use serde_json::Value;
use serde_json::json;
-use socketioxide::SocketIo;
+use serde_json::Value;
use socketioxide::extract::{AckSender, Data, SocketRef, TryData};
+use socketioxide::SocketIo;
use crate::core_host::web_chat::{GuardrailPayload, WebChannelEvent};
@@ -1276,8 +1276,8 @@ fn replay_parked_plan_review(socket: &SocketRef, thread_id: &str) {
let Ok(tenant) = crate::core_host::core::runtime::DispatchCtx::ambient().tenant() else {
return;
};
- let Some(row) =
- crate::core_host::plan_review::gate::global().parked_review_for_thread(&tenant, thread_id)
+ let Some(row) = crate::core_host::agent::plan_review::gate::global()
+ .parked_review_for_thread(&tenant, thread_id)
else {
return;
};
diff --git a/crates/openhuman-rpc/src/session_store/mod.rs b/crates/openhuman-rpc/src/session_store/mod.rs
index 14b4098978..f8fb1e8b8e 100644
--- a/crates/openhuman-rpc/src/session_store/mod.rs
+++ b/crates/openhuman-rpc/src/session_store/mod.rs
@@ -43,7 +43,7 @@ use std::sync::Arc;
use anyhow::Context as _;
use tinyagents_session::port::SessionStoreProvider;
-use crate::core_host::storage::sessions::{ReboundSessionStores, WorkspaceSessionStores};
+use crate::core_host::agent::session_store::{ReboundSessionStores, WorkspaceSessionStores};
/// Installs the session store the host's configuration asks for, before the
/// core boots.
@@ -122,7 +122,7 @@ fn storage_url_from(
pub async fn install_for_url(url: Option<String>) -> anyhow::Result<()> {
let provider = provider_for_url(url).await?;
log::debug!("[rpc:session_store] installing process-wide (host configuration)");
- crate::core_host::storage::sessions::install(provider);
+ crate::core_host::agent::session_store::install(provider);
Ok(())
}
@@ -152,7 +152,7 @@ pub async fn provider_for_url(
pub async fn install_for_saas(url: Option<String>) -> anyhow::Result<()> {
let provider = provider_for_url_with(url, Some(false)).await?;
log::debug!("[rpc:session_store] installing process-wide (SaaS, lease-driven recovery)");
- crate::core_host::storage::sessions::install(provider);
+ crate::core_host::agent::session_store::install(provider);
Ok(())
}
diff --git a/crates/openhuman-rpc/src/session_store/mod_tests.rs b/crates/openhuman-rpc/src/session_store/mod_tests.rs
index 046aaed0bf..144ff0bfd6 100644
--- a/crates/openhuman-rpc/src/session_store/mod_tests.rs
+++ b/crates/openhuman-rpc/src/session_store/mod_tests.rs
@@ -20,11 +20,11 @@ fn restore_backend(previous: Option<Arc<dyn crate::core_host::storage::StorageBa
#[tokio::test]
async fn a_storage_url_installs_the_driver_backed_store() {
let _turn = SLOTS.lock().await;
- let previous = crate::core_host::storage::sessions::installed();
+ let previous = crate::core_host::agent::session_store::installed();
let previous_backend = crate::core_host::storage::installed();
install_for_url(Some("memory".into())).await.unwrap();
- let provider = crate::core_host::storage::sessions::installed().unwrap();
+ let provider = crate::core_host::agent::session_store::installed().unwrap();
assert!(
provider
.destination_key()
@@ -50,14 +50,14 @@ async fn a_storage_url_installs_the_driver_backed_store() {
.is_none());
restore_backend(previous_backend);
- crate::core_host::storage::sessions::restore(previous);
+ crate::core_host::agent::session_store::restore(previous);
}
/// A storage URL installs the driver-backed store, and two agents on the one
/// backend keep their turn states apart. Run once per driver the build has.
async fn driver_backed_store_keeps_agents_apart(url: String, driver: &str) {
let _turn = SLOTS.lock().await;
- let previous = crate::core_host::storage::sessions::installed();
+ let previous = crate::core_host::agent::session_store::installed();
let previous_backend = crate::core_host::storage::installed();
install_for_url(Some(url)).await.unwrap();
@@ -65,7 +65,7 @@ async fn driver_backed_store_keeps_agents_apart(url: String, driver: &str) {
crate::core_host::storage::installed().map(|b| b.driver()),
Some(driver)
);
- let provider = crate::core_host::storage::sessions::installed().unwrap();
+ let provider = crate::core_host::agent::session_store::installed().unwrap();
let alice = provider.for_agent("alice");
alice
.turn_states
@@ -80,7 +80,7 @@ async fn driver_backed_store_keeps_agents_apart(url: String, driver: &str) {
.is_none());
restore_backend(previous_backend);
- crate::core_host::storage::sessions::restore(previous);
+ crate::core_host::agent::session_store::restore(previous);
}
#[cfg(feature = "storage-sqlite")]
@@ -158,18 +158,18 @@ async fn the_mongodb_backend_keeps_agents_apart() {
#[tokio::test]
async fn an_unusable_url_fails_the_boot() {
let _turn = SLOTS.lock().await;
- let previous = crate::core_host::storage::sessions::installed();
+ let previous = crate::core_host::agent::session_store::installed();
let error = install_for_url(Some("ftp://nowhere".into()))
.await
.unwrap_err();
assert!(format!("{error:#}").contains("storage"), "{error:#}");
- crate::core_host::storage::sessions::restore(previous);
+ crate::core_host::agent::session_store::restore(previous);
}
#[tokio::test]
async fn the_host_reads_the_storage_url_from_the_environment() {
let _turn = SLOTS.lock().await;
- let previous = crate::core_host::storage::sessions::installed();
+ let previous = crate::core_host::agent::session_store::installed();
let previous_backend = crate::core_host::storage::installed();
let var = crate::core_host::storage::STORAGE_URL_VAR;
let old = std::env::var_os(var);
@@ -186,7 +186,7 @@ async fn the_host_reads_the_storage_url_from_the_environment() {
None => std::env::remove_var(var),
}
restore_backend(previous_backend);
- crate::core_host::storage::sessions::restore(previous);
+ crate::core_host::agent::session_store::restore(previous);
booted.unwrap();
assert_eq!(driver, Some("memory"));
@@ -196,21 +196,21 @@ async fn the_host_reads_the_storage_url_from_the_environment() {
#[tokio::test]
async fn provider_for_url_returns_the_store_without_installing_it() {
let _turn = SLOTS.lock().await;
- let previous = crate::core_host::storage::sessions::installed();
+ let previous = crate::core_host::agent::session_store::installed();
let previous_backend = crate::core_host::storage::installed();
- crate::core_host::storage::sessions::restore(None);
+ crate::core_host::agent::session_store::restore(None);
let backed = provider_for_url(Some("memory".into())).await.unwrap();
let backed_key = backed.destination_key();
let backend_driver = crate::core_host::storage::installed().map(|b| b.driver());
- let left_uninstalled = crate::core_host::storage::sessions::installed().is_none();
+ let left_uninstalled = crate::core_host::agent::session_store::installed().is_none();
// No URL: each workspace keeps its sessions in its own default database.
let per_workspace = provider_for_url(None).await.unwrap();
let cleared = crate::core_host::storage::installed().is_none();
restore_backend(previous_backend);
- crate::core_host::storage::sessions::restore(previous);
+ crate::core_host::agent::session_store::restore(previous);
assert!(
backed_key