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
refactor(agent): make workspace binding update optional
Steven Enamakel8c31440dd447
diff --git a/crates/openhuman-core/src/agent/turn_host.rs b/crates/openhuman-core/src/agent/turn_host.rsindex 8eff06c192..e833bf0ef0 100644--- a/crates/openhuman-core/src/agent/turn_host.rs+++ b/crates/openhuman-core/src/agent/turn_host.rs@@ -71,14 +71,11 @@ pub(crate) enum WorkspaceBinding {}impl WorkspaceBinding {- fn apply(- self,- current: Option<tinytools::WorkspaceDescriptor>,- ) -> Option<tinytools::WorkspaceDescriptor> {+ fn update(self) -> Option<Option<tinytools::WorkspaceDescriptor>> {match self {- Self::Preserve => current,- Self::Clear => None,- Self::Set(workspace) => Some(workspace),+ Self::Preserve => None,+ Self::Clear => Some(None),+ Self::Set(workspace) => Some(Some(workspace)),}}}@@ -107,8 +104,9 @@ impl AgentTurnHost {.turn_deadline.map(tinyagents_harness::turn_deadline::TurnDeadline::starting_now);session.set_host_env(host_env);- let workspace = request.workspace.apply(session.live_workspace_descriptor());- session.set_workspace_descriptor(workspace);+ if let Some(workspace) = request.workspace.update() {+ session.set_workspace_descriptor(workspace);+ }// Keep the large agent future behind a pointer while the origin scope// is active. The origin is explicit and independent from RPC metadata.diff --git a/crates/openhuman-core/src/agent/turn_host_tests.rs b/crates/openhuman-core/src/agent/turn_host_tests.rsindex c6a311be83..2f99b99cc3 100644--- a/crates/openhuman-core/src/agent/turn_host_tests.rs+++ b/crates/openhuman-core/src/agent/turn_host_tests.rs@@ -4,7 +4,8 @@ use super::*;fn workspace_binding_clears_a_previous_turns_workspace() {let previous = tinytools::WorkspaceDescriptor::new("/previous/thread");- assert_eq!(WorkspaceBinding::Clear.apply(Some(previous)), None);+ assert_eq!(WorkspaceBinding::Clear.update(), Some(None));+ assert!(previous.root.ends_with("/previous/thread"));}#[test]@@ -12,12 +13,9 @@ fn workspace_binding_can_preserve_or_replace_the_session_workspace() {let previous = tinytools::WorkspaceDescriptor::new("/configured");let requested = tinytools::WorkspaceDescriptor::new("/thread");+ assert_eq!(WorkspaceBinding::Preserve.update(), None);assert_eq!(- WorkspaceBinding::Preserve.apply(Some(previous.clone())),- Some(previous)- );- assert_eq!(- WorkspaceBinding::Set(requested.clone()).apply(None),- Some(requested)+ WorkspaceBinding::Set(requested.clone()).update(),+ Some(Some(requested)));}diff --git a/crates/openhuman-core/src/web_chat/ops/start_chat.rs b/crates/openhuman-core/src/web_chat/ops/start_chat.rsindex 3301857b74..b2e6816dc7 100644--- a/crates/openhuman-core/src/web_chat/ops/start_chat.rs+++ b/crates/openhuman-core/src/web_chat/ops/start_chat.rs@@ -14,7 +14,7 @@ use tinyagents_harness::turn_runner::{QueueDisposition, TurnRequest, TurnRunnerEuse tinychannels_bus::web::{ChatRequestMetadata, QueueMode};use uuid::Uuid;-use super::super::runner::{Admission, runtime, scope_of};+use super::super::runner::{runtime, scope_of, Admission};use super::super::turn_activity::configured_idle_window;use crate::agent::queued_turn::QueuedPayload;use crate::core::events::DomainEvent;@@ -264,6 +264,7 @@ async fn start_chat_inner(payload: QueuedPayload {ctx: Some(ctx.clone()),client_id: client_id.clone(),+ trusted_turn: None,model_override,temperature,locale,