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
chore: files changed crates/openhuman-core/src/agent/session_host/runtime/run_loop.rs,crates/openhum
Steven Enamakel8fa730eadf5f
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 816d87f2c7..e76ed17900 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@@ -44,7 +44,7 @@ impl OpenHumanSessionHost {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 origin = origin.or_else(|| crate::core::runtime::DispatchCtx::ambient_turn().turn_origin());let guard = enforce_prompt_input(message,PromptEnforcementContext {diff --git a/crates/openhuman-core/src/agent/turn_origin.rs b/crates/openhuman-core/src/agent/turn_origin.rsindex ad689fd521..5e9ae7f4c3 100644--- a/crates/openhuman-core/src/agent/turn_origin.rs+++ b/crates/openhuman-core/src/agent/turn_origin.rs@@ -174,12 +174,6 @@ impl AgentTurnOrigin {}}-/// Whether the current turn's text was written by a person — `false` outside-/// any origin scope, matching [`AgentTurnOrigin::is_user_authored`]'s allowlist.-pub fn current_is_user_authored() -> bool {- current().is_some_and(|origin| origin.is_user_authored())-}-/// Run `fut` as a turn labelled `origin`.////// The label rides the [`CoreContext`](crate::core::runtime::CoreContext) the@@ -208,9 +202,15 @@ pub async fn with_origin<F: std::future::Future>(origin: AgentTurnOrigin, fut: F/// `CoreContext`. The process default never supplies authority. `None` when no/// caller scoped one; the gate maps that to [`AgentTurnOrigin::Unknown`]/// (fail closed).+///+/// The one place the origin is read from task state, for the library and test+/// boundary and for [`capture`]. Production readers take the origin from the+/// context they were handed ([`DispatchCtx::turn_origin`]) or from the tool+/// run carrier.+///+/// [`DispatchCtx::turn_origin`]: crate::core::runtime::DispatchCtx::turn_originpub fn current() -> Option<AgentTurnOrigin> {- crate::core::runtime::CoreContext::scoped_for_turn()- .and_then(|context| context.turn_origin().cloned())+ crate::core::runtime::DispatchCtx::ambient_turn().turn_origin()}/// Capture the ambient origin so it can be carried across a `tokio::spawn`diff --git a/crates/openhuman-core/src/core/runtime/agent_scope_tests.rs b/crates/openhuman-core/src/core/runtime/agent_scope_tests.rsindex 0f80bd50ed..ea57d836b3 100644--- a/crates/openhuman-core/src/core/runtime/agent_scope_tests.rs+++ b/crates/openhuman-core/src/core/runtime/agent_scope_tests.rs@@ -159,7 +159,7 @@ async fn spawn_scoped_keeps_the_agent_context_and_tokio_spawn_does_not() {let scoped = spawn_scoped(async {(current_agent_id(),- CoreContext::current_agent_policy().map(|p| p.autonomy),+ DispatchCtx::ambient().agent_policy().map(|p| p.autonomy),)}).awaitdiff --git a/crates/openhuman-core/src/core/runtime/context_agent.rs b/crates/openhuman-core/src/core/runtime/context_agent.rsindex 18c44dea20..beb4ca4f61 100644--- a/crates/openhuman-core/src/core/runtime/context_agent.rs+++ b/crates/openhuman-core/src/core/runtime/context_agent.rs@@ -59,31 +59,16 @@ impl CoreContext {self.agent.host_overrides.clone()}- /// Host adapters of the ambient agent, without changing process globals.- pub fn current_host_overrides() -> Option<Arc<crate::agent::host_overrides::HostOverrides>> {- Self::current().and_then(|ctx| ctx.host_overrides())- }-/// The security policy of the agent this context was derived for.pub fn agent_policy(&self) -> Option<Arc<crate::security::SecurityPolicy>> {self.agent.policy.clone()}- /// [`agent_policy`](Self::agent_policy) of the ambient context.- pub fn current_agent_policy() -> Option<Arc<crate::security::SecurityPolicy>> {- Self::current().and_then(|ctx| ctx.agent.policy.clone())- }-/// Whether the interactive approval gate is off for this context's agent.pub fn approvals_disabled(&self) -> bool {self.agent.approvals_disabled}- /// [`approvals_disabled`](Self::approvals_disabled) of the ambient context.- pub fn current_approvals_disabled() -> bool {- Self::current().is_some_and(|ctx| ctx.agent.approvals_disabled)- }-/// The sub-agent catalogue of the agent this context was derived for.pub fn definitions(&self,