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): thread operation context through subagent runner
Steven Enamakelb005d1d8dbb7
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rsindex fcc7d0b634..8e16bf734a 100644--- a/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs+++ b/crates/openhuman-core/src/agent/subagent_host/ops/runner.rs@@ -13,6 +13,7 @@ use crate::agent::harness::artifact_offload::offload_run_result;use crate::agent::harness::fork_context::ParentExecutionContext;use crate::agent::harness::host_definition::{AgentDefinition, AgentDefinitionRegistry};use crate::agent::prompts::{+ render_connected_identities,render_subagent_system_prompt_with_format, PromptContext, SubagentRenderOptions,};use crate::agent::subagent_host::definition_iter_cap;diff --git a/crates/openhuman-core/src/agent/tinyagents/host/operation_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/operation_context.rsindex 95e74e97ea..43a0a20581 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/operation_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/operation_context.rs@@ -4,6 +4,39 @@use crate::agent::turn_origin::AgentTurnOrigin;use tinyagents_definition::SandboxMode;+use std::time::Duration;++/// OpenHuman product values that tools read from the run through+/// `ToolExecutionContext::host::<OpenHumanRunExt>()`, installed by+/// [`OpenHumanRunContext::into_tinyagents`] with `RunContext::with_host`.+/// It replaces the former per-value task-locals, which do not cross a module+/// boundary.+#[derive(Debug, Clone, Default, PartialEq, Eq)]+pub struct OpenHumanRunExt {+ /// Recency window narrowing integration task-fetch tools (morning+ /// briefing only); `None` leaves them unbounded.+ pub task_recency_window: Option<Duration>,+}++/// Reads the run's task-recency window from the explicit tool carrier.+/// Direct tool dispatch (CLI, JSON-RPC, tests) has none.+pub(crate) fn task_recency_window_for_tool(+ context: Option<&dyn tinytools::ToolRunContext>,+) -> Option<Duration> {+ let window = context+ .and_then(tinytools::ToolRunContext::host_extension)+ .and_then(|extension| {+ extension.downcast_ref::<tinyagents_harness::tool::ToolExecutionContext>()+ })+ .and_then(|context| context.host::<OpenHumanRunExt>())+ .and_then(|ext| ext.task_recency_window);+ tracing::trace!(+ has_window = window.is_some(),+ "[composio][task-window] read run window"+ );+ window+}+/// Minimal immutable authority view exposed to shared tools through the/// harness's typed state-view seam.#[derive(Clone, Debug, Default)]diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rsindex 14ca35106d..3b00f266bc 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs@@ -415,43 +415,12 @@ pub(crate) struct HarnessHostPolicy {}pub(crate) use super::operation_context::{- approval_for_tool, dispatch_ctx_for_tool, memory_identity_for_tool, parent_agent_id_for_tool, sandbox_mode_for_tool,- HostOperationContext,+ approval_for_tool, dispatch_ctx_for_tool, memory_identity_for_tool, parent_agent_id_for_tool,+ sandbox_mode_for_tool, task_recency_window_for_tool, HostOperationContext, OpenHumanRunExt,};#[cfg(test)]pub(crate) use super::operation_context::tool_context_with_approval;-/// OpenHuman product values that tools read from the run through-/// `ToolExecutionContext::host::<OpenHumanRunExt>()`, installed by-/// [`OpenHumanRunContext::into_tinyagents`] with `RunContext::with_host`.-/// It replaces the former per-value task-locals, which do not cross a module-/// boundary.-#[derive(Debug, Clone, Default, PartialEq, Eq)]-pub struct OpenHumanRunExt {- /// Recency window narrowing integration task-fetch tools (morning- /// briefing only); `None` leaves them unbounded.- pub task_recency_window: Option<Duration>,-}--/// Reads the run's task-recency window from the explicit tool carrier.-/// Direct tool dispatch (CLI, JSON-RPC, tests) has none.-pub(crate) fn task_recency_window_for_tool(- context: Option<&dyn tinytools::ToolRunContext>,-) -> Option<Duration> {- let window = context- .and_then(tinytools::ToolRunContext::host_extension)- .and_then(|extension| {- extension.downcast_ref::<tinyagents_harness::tool::ToolExecutionContext>()- })- .and_then(|context| context.host::<OpenHumanRunExt>())- .and_then(|ext| ext.task_recency_window);- tracing::trace!(- has_window = window.is_some(),- "[composio][task-window] read run window"- );- window-}-impl Default for OpenHumanRunContext {fn default() -> Self {Self::new()