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
fix(embed): keep session store and memory engine on the builder
Steven Enamakeldb7d7c95cb8b
diff --git a/crates/openhuman-embed/src/runtime/run.rs b/crates/openhuman-embed/src/runtime/run.rsindex ab71db5ddc..1799841930 100644--- a/crates/openhuman-embed/src/runtime/run.rs+++ b/crates/openhuman-embed/src/runtime/run.rs@@ -87,8 +87,11 @@ impl RuntimeBuilder {}/// Separate the process-global pieces from the builder that boots the- /// server. The transport stays on the builder as well, so the server's- /// runtime binds it.+ /// server. The transport, memory engine and session store stay on the+ /// builder as well: the server's runtime binds the transport, and+ /// `build()` validates a `Workspace::Stateless` workspace against the+ /// session store and installs the custom engine/store over the+ /// launcher's defaults.pub(super) fn split_for_cli(mut self) -> (RuntimeBuilder, CliGlobals) {if self.seams.live_policy.take().is_some() {log::warn!(@@ -98,8 +101,8 @@ impl RuntimeBuilder {}let globals = CliGlobals {transport: self.backend_transport.clone(),- memory_engine: self.memory_engine.take(),- session_store: self.session_store.take(),+ memory_engine: self.memory_engine.clone(),+ session_store: self.session_store.clone(),seams: std::mem::take(&mut self.seams),};(self, globals)diff --git a/crates/openhuman-embed/src/runtime/run_tests.rs b/crates/openhuman-embed/src/runtime/run_tests.rsindex f27e121919..872e791150 100644--- a/crates/openhuman-embed/src/runtime/run_tests.rs+++ b/crates/openhuman-embed/src/runtime/run_tests.rs@@ -39,8 +39,7 @@ fn split_for_cli_moves_process_globals_out_and_drops_live_policy() {assert!(globals.seams.server_launcher.is_some());let summary = rest.summary();assert!(!summary.has_server_launcher, "installed once, not twice");- assert!(!summary.has_memory_engine && !summary.has_session_store);- assert!(!summary.has_live_policy);+ assert!(!summary.has_live_policy);}#[test]@@ -52,3 +51,18 @@ fn the_launcher_takes_the_handed_over_builder_once() {assert_eq!(taken.summary().host_kind, HostKind::detect_standalone());assert!(RuntimeBuilder::from_host_boot(&boot).is_none());}++#[test]+fn split_for_cli_keeps_the_session_store_for_a_stateless_workspace() {+ use openhuman_core::agent::session_store::InMemorySessionStores;+ let store: Arc<dyn SessionStoreProvider> = Arc::new(InMemorySessionStores::default());+ let builder = configured()+ .workspace(crate::Workspace::Stateless)+ .session_store(store);+ let (rest, globals) = builder.split_for_cli();+ assert!(globals.session_store.is_some(), "installed as a process global");+ assert!(+ rest.summary().has_session_store,+ "and still on the builder, so `build()` accepts the stateless workspace"+ );+}diff --git a/crates/openhuman-rpc/src/server/README.md b/crates/openhuman-rpc/src/server/README.mdindex b03a62be44..79a010cc3b 100644--- a/crates/openhuman-rpc/src/server/README.md+++ b/crates/openhuman-rpc/src/server/README.md@@ -15,26 +15,30 @@ core's: every transport here resolves a method throughThere are two ways in, and both end in `serve`. (`crate::host::cli` and`host::desktop` are the same two paths with the TinyHumans backend-connected on the builder; `host::desktop` enters at `build_and_serve`.)+connected on the builder; `host::cli` hands that builder to the core CLI and+`host::desktop` enters at `build_and_serve`.)```textopenhuman-core run|serve desktop shell (core_process.rs)- install_cli_server() run_server_embedded_with_ready(- -> core::server_launcher host, port, socketio, cancel,- launch(ServeRequest) ready_tx, Some(bearer))- headless_api? run_server_headless |- : run_server |+ RuntimeBuilder::run_from_args(args) run_server_embedded_with_ready(+ -> core::run_core_from_args_with host, port, socketio, cancel,+ (args, HostBoot(builder)) ready_tx, Some(bearer))+ -> core::server_launcher |+ launch(ServeRequest) |+ --mode saas? run_server_saas (own boot) |+ else base = HostBoot builder |+ or RuntimeBuilder::cli() |+ flagged_builder(base, flags) |\ /v v- run_server_with_services(host, port, ServiceSet, ...)- preset: RuntimeBuilder::desktop() if embedded (HostKind::TauriShell)- else RuntimeBuilder::cli() (detect_standalone())- both: DomainSet::full, discovered config,+ run_server_with_services(host, port, ServiceSet, ...) (desktop path)+ preset: RuntimeBuilder::desktop() (HostKind::TauriShell)+ both presets: DomainSet::full, discovered config,OPENHUMAN_E2E set -> ToolGroups::advertised()server_builder: services, TokenSource::Fixed(bearer) if handedin (else EnvOrFile), listen host/port if givenbuild_and_serve(builder, ready_tx, shutdown_token)- session_store::install() (before boot: recovery)+ session_store::install_for_host() (before boot: recovery)RuntimeBuilder::build() (claims the embed runtime slot)|v@@ -42,10 +46,16 @@ connected on the builder; `host::desktop` enters at `build_and_serve`.)drop(runtime) (releases the slot)```-`run_server` and `run_server_embedded` use `ServiceSet::desktop()` with-Socket.IO set by the caller; `run_server_headless` uses+The CLI path boots from the builder the host handed `run_from_args`, or the+`cli` preset when there is none. Precedence, highest first: the operator's+explicit flags (`--host`, `--port`, `--jsonrpc-only`, `--headless-api`), the+host's builder, the preset. `--headless-api` replaces the services with`ServiceSet::headless_api()` (request/response only, no detached background-jobs). An embedder that built its own `CoreRuntime` can call `serve` directly.+jobs); `--jsonrpc-only` only clears Socket.IO on the builder's services.+`--mode saas` ignores the builder and boots the operator's config.+`run_server` and `run_server_embedded` (the older shims) use+`ServiceSet::desktop()` with Socket.IO set by the caller. An embedder that+built its own `CoreRuntime` can call `serve` directly.`serve` then:diff --git a/crates/openhuman-tinyhumans/src/runtime_tests.rs b/crates/openhuman-tinyhumans/src/runtime_tests.rsindex 2b16a466e5..07f54bb08c 100644--- a/crates/openhuman-tinyhumans/src/runtime_tests.rs+++ b/crates/openhuman-tinyhumans/src/runtime_tests.rs@@ -179,15 +179,17 @@ fn turning_jev_back_on_does_not_replace_a_host_ranker() {}#[test]-fn run_from_args_hands_the_connected_builder_to_the_cli_unchanged() {+fn connect_keeps_cli_knobs_for_the_host_boot() {use openhuman_embed::seams::HostBoot;use openhuman_embed::{DomainSet, ServiceSet, TokenSource};let mut domains = DomainSet::full();domains.mcp = false;// `run_from_args` is `connect()` followed by the embed builder's- // `run_from_args`, which wraps the builder in a `HostBoot` for the core's- // `run` / `serve` launcher: the knobs set here must survive both steps.+ // `run_from_args`, which wraps the connected builder in a `HostBoot` for+ // the core's `run` / `serve` launcher. This covers the connect step and+ // the HostBoot extraction; the dispatch itself needs a live CLI process+ // and is covered by the cli/saas e2e suites.let connected = RuntimeBuilder::cli().domains(domains).services(ServiceSet::headless_api())