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): introduce driver parent abstraction for context sharing
Steven Enamakeld02c395f328d
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rsindex c8088afd33..418a22ecf3 100644--- a/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs+++ b/crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_surface.rs@@ -27,6 +27,34 @@ pub struct SpawnSubagentTool {advertised_ids: Vec<String>,}+enum DriverParent<'a> {+ Borrowed(&'a RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>),+ Owned(RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>),+}++impl DriverParent<'_> {+ fn as_ref(&self) -> &RunContext<crate::agent::tinyagents::host::OpenHumanRunContext> {+ match self {+ Self::Borrowed(parent) => parent,+ Self::Owned(parent) => parent,+ }+ }+}++impl<'a> From<&'a RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>>+ for DriverParent<'a>+{+ fn from(parent: &'a RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>) -> Self {+ Self::Borrowed(parent)+ }+}++impl From<RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>> for DriverParent<'_> {+ fn from(parent: RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>) -> Self {+ Self::Owned(parent)+ }+}+/// Harness dispatch for the detached child path. It owns the typed parent run/// so the spawned child receives the caller's carrier before `tokio::spawn`.pub(crate) struct SpawnSubagentDispatch {@@ -342,19 +370,20 @@ impl SpawnSubagentTool {.await}- pub(crate) async fn execute_with_live_parent_context(+ pub(crate) async fn execute_with_live_parent_context<'a>(&self,args: serde_json::Value,tool_context: Option<&dyn ToolRunContext>,run_context: crate::agent::tinyagents::host::OpenHumanRunContext,- detached_parent: &RunContext<crate::agent::tinyagents::host::OpenHumanRunContext>,+ detached_parent: impl Into<DriverParent<'a>>,) -> anyhow::Result<ToolResult> {+ let detached_parent = detached_parent.into();self.execute_with_context_inner(args,ToolCallOptions::default(),tool_context,run_context,- Some(detached_parent),+ Some(detached_parent.as_ref()),).await}diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rsindex 4879ca2e92..173ae7e7d4 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs@@ -502,13 +502,6 @@ impl OpenHumanRunContext {self}- /// Marks an opted-in headless root whose host will settle driver jobs.- #[must_use]- pub(crate) fn with_headless_descendant_settlement(mut self) -> Self {- self.headless_descendant_settlement = true;- self- }-/// The dispatch context this run's readers use: its own `core`, else the/// calling task's (a run assembled by a caller that did not bind one).pub fn dispatch_ctx(&self) -> crate::core::runtime::DispatchCtx {