The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(session-store): install on-disk session store in rpc and tui hosts
Steven Enamakel0e5283dda820
diff --git a/Cargo.toml b/Cargo.tomlindex 7659d0e40a..06f547e8c1 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -1,6 +1,7 @@# Virtual workspace root. Members: `crates/openhuman-core` (package `openhuman`,# the core library), `crates/openhuman-embed` (library facade),-# `crates/openhuman-rpc` (JSON-RPC envelopes, client and server, above the core), `crates/openhuman-tinyhumans`+# `crates/openhuman-rpc` (JSON-RPC envelopes, client and server, above the core),+# `crates/openhuman-store-sqlite` (the on-disk session store hosts install), `crates/openhuman-tinyhumans`# (SDK-backed backend transport + login/session ownership for hosts),# `crates/openhuman-cli` (the `openhuman-core` binary, developer bins and the# root integration tests), and `crates/openhuman-tui` (terminal client). `crates/openhuman-app` is deliberately excluded: it is itsdiff --git a/crates/openhuman-core/src/agent/session_store/mod.rs b/crates/openhuman-core/src/agent/session_store/mod.rsindex f52aaade60..7f57b5c2fa 100644--- a/crates/openhuman-core/src/agent/session_store/mod.rs+++ b/crates/openhuman-core/src/agent/session_store/mod.rs@@ -112,6 +112,20 @@ pub fn current() -> Option<AgentStores> {Some(provider.for_agent(&agent))}+/// The workspace the current [`CoreContext`](crate::core::runtime::CoreContext)+/// is bound to, for a file-backed store that must follow it (the desktop+/// rebinds it when a different user signs in). Before the core has booted —+/// when no store is asked for anything — the default config's workspace.+#[must_use]+pub fn context_workspace_dir() -> std::path::PathBuf {+ crate::core::runtime::CoreContext::current()+ .and_then(|context| context.workspace_dir().ok())+ .unwrap_or_else(|| {+ log::warn!("[session_store] no booted context; using the default workspace");+ crate::config::Config::default().workspace_dir+ })+}+/// The agent whose stores a turn without a definition id uses. Root turns of/// the desktop app have no per-user agent; a single shared bucket keeps them/// together, as the shared workspace always did.diff --git a/crates/openhuman-rpc/Cargo.toml b/crates/openhuman-rpc/Cargo.tomlindex 66a04f2e8c..fb1b45edc3 100644--- a/crates/openhuman-rpc/Cargo.toml+++ b/crates/openhuman-rpc/Cargo.toml@@ -32,6 +32,7 @@ server = ["dep:rand","dep:uuid","dep:urlencoding",+ "dep:openhuman-store-sqlite",]# Forwarded so the server's Sentry-routing tests run against a core that# reports to Sentry.@@ -39,6 +40,8 @@ crash-reporting = ["openhuman-core/crash-reporting"][dependencies]openhuman-core = { path = "../openhuman-core", package = "openhuman", default-features = false }+# The on-disk session store the app and CLI install (`install_session_store`).+openhuman-store-sqlite = { workspace = true, optional = true }log = "0.4"serde = { version = "1", features = ["derive"] }serde_json = "1"diff --git a/crates/openhuman-rpc/src/server/shims.rs b/crates/openhuman-rpc/src/server/shims.rsindex 99d774f251..3e004b24ea 100644--- a/crates/openhuman-rpc/src/server/shims.rs+++ b/crates/openhuman-rpc/src/server/shims.rs@@ -151,10 +151,24 @@ async fn run_server_with_services(builder = builder.port(port);}+ // The desktop app and the CLI keep conversations in the classic on-disk+ // layout; the core itself carries no storage. Installed before boot so+ // its recovery sweep runs, and resolved per call because the desktop+ // rebinds its workspace when a different user signs in.+ install_session_store();let runtime = builder.build().await?;super::serve::serve(&runtime, ready_tx, shutdown_token).await}+/// Installs the on-disk session store over the current workspace.+pub fn install_session_store() {+ openhuman_core::agent::session_store::install(std::sync::Arc::new(+ openhuman_store_sqlite::SqliteSessionStores::resolving(+ openhuman_core::agent::session_store::context_workspace_dir,+ ),+ ));+}+fn apply_e2e_tool_groups(builder: openhuman_core::core::runtime::CoreBuilder,) -> openhuman_core::core::runtime::CoreBuilder {diff --git a/crates/openhuman-tui/Cargo.toml b/crates/openhuman-tui/Cargo.tomlindex 8792fa7e47..0c1c666a22 100644--- a/crates/openhuman-tui/Cargo.toml+++ b/crates/openhuman-tui/Cargo.toml@@ -17,6 +17,7 @@ path = "src/main.rs"[dependencies]openhuman-core.workspace = true+openhuman-store-sqlite.workspace = trueopenhuman-rpc.workspace = trueopenhuman-tinyhumans.workspace = trueanyhow = "1"diff --git a/crates/openhuman-tui/src/runner.rs b/crates/openhuman-tui/src/runner.rsindex e7db569d3a..5258dcc3b3 100644--- a/crates/openhuman-tui/src/runner.rs+++ b/crates/openhuman-tui/src/runner.rs@@ -174,6 +174,12 @@ async fn async_main(// In-process core: full domains (channel.web_chat needs DomainGroup::Channels,// so harness() is not enough), no RPC transport, no background services.+ // Conversations in the classic on-disk layout, as the desktop keeps them.+ openhuman_core::agent::session_store::install(Arc::new(+ openhuman_store_sqlite::SqliteSessionStores::resolving(+ openhuman_core::agent::session_store::context_workspace_dir,+ ),+ ));let runtime = Arc::new(CoreBuilder::new(HostKind::detect_standalone()).domains(DomainSet::full())