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-host): add runtime session turn handling
Steven Enamakelfb293dff6bb3
diff --git a/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs b/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rsindex 406f0c9d23..300973d762 100644--- a/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs@@ -30,6 +30,19 @@ impl OpenHumanSessionHost {&mut self,message: &str,origin: Option<crate::agent::turn_origin::AgentTurnOrigin>,+ ) -> Result<String> {+ self.run_single_with_approval(message, origin, Default::default())+ .await+ }++ /// [`Self::run_single_with_origin`] for a turn that also owns an approval+ /// context (chat surface, copilot flag, flow run). The context is handed to+ /// this turn alone.+ pub async fn run_single_with_approval(+ &mut self,+ message: &str,+ origin: Option<crate::agent::turn_origin::AgentTurnOrigin>,+ approval: crate::security::approval::ApprovalTurnContext,) -> Result<String> {let origin = origin.or_else(crate::core::runtime::CoreContext::current_turn_origin);let guard = enforce_prompt_input(@@ -85,7 +98,10 @@ impl OpenHumanSessionHost {channel: self.event_channel().to_string(),});- match self.turn_with_origin(message, origin.as_ref()).await {+ match self+ .turn_with_approval(message, origin.as_ref(), approval)+ .await+ {Ok(response) => {let history = self.history();let new_entries = Self::new_entries_for_turn(&history_snapshot, &history);diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rsindex 4fefc2144f..b2ffec9e65 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_turn.rs@@ -12,12 +12,27 @@ impl OpenHumanSessionHost {&mut self,user_message: &str,origin: Option<&crate::agent::turn_origin::AgentTurnOrigin>,+ ) -> Result<String> {+ self.turn_with_approval(user_message, origin, Default::default())+ .await+ }++ /// [`Self::turn_with_origin`] with the approval context of the turn: where+ /// its parked approvals surface, whether it is the flow copilot and which+ /// flow run it belongs to. It rides this turn's run context only, so it is+ /// never left behind on the session for a later turn to inherit.+ pub async fn turn_with_approval(+ &mut self,+ user_message: &str,+ origin: Option<&crate::agent::turn_origin::AgentTurnOrigin>,+ approval: crate::security::approval::ApprovalTurnContext,) -> Result<String> {self.ensure_runtime_session()?;let staged = super::attachment_input::stage_turn(self, user_message, origin).await?;let mut context = OpenHumanRunContext::new().with_host_env(&self.host_env);context.untrusted_input_turn = self.untrusted_input;context.origin = origin.cloned();+ context.approval = approval;context.progress = self.on_progress.clone();context.thread_id = self.thread_id.clone();context.task_recency_window = self.task_recency_window;