Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(tools): add todo and presentation tools to delegate graph

Steven Enamakel1d7ea42290ee
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs b/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs
index b3b28261f7..bae42c47de 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs
@@ -229,7 +229,7 @@ impl DelegateGraphTool {
}
};
- let config = match crate::config::ops::load_current_or_init(&DispatchCtx::ambient()).await {
+ let config = match crate::config::ops::load_current_or_init(&run_context.dispatch_ctx()).await {
Ok(cfg) => Arc::new(cfg),
Err(e) => {
return Ok(ToolResult::error(format!(
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
index 8f11707a8a..14ca35106d 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
@@ -526,11 +526,12 @@ impl OpenHumanRunContext {
}
/// The dispatch context this run's readers (config, tenant stores) use:
- /// the run's own context, else unbound.
+ /// the run's own context, 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 {
match &self.core {
Some(core) => crate::core::runtime::DispatchCtx::new(Arc::clone(core)),
- None => crate::core::runtime::DispatchCtx::unbound(),
+ None => crate::core::runtime::DispatchCtx::ambient(),
}
}
diff --git a/crates/openhuman-core/src/agent/tools/todo.rs b/crates/openhuman-core/src/agent/tools/todo.rs
index ba715e7eb5..fb4ae0fbcf 100644
--- a/crates/openhuman-core/src/agent/tools/todo.rs
+++ b/crates/openhuman-core/src/agent/tools/todo.rs
@@ -60,7 +60,7 @@ impl ToolDispatch<(), crate::agent::tinyagents::host::OpenHumanRunContext> for T
let context = ToolExecutionContext::from_run_context(parent, call_id);
let workspace_dir = match parent.data.parent.as_ref() {
Some(parent_ctx) => parent_ctx.workspace_dir.clone(),
- None => crate::config::ops::load_current_or_init(&DispatchCtx::ambient())
+ None => crate::config::ops::load_current_or_init(&parent.data.dispatch_ctx())
.await
.map(|c| c.workspace_dir)
.map_err(|e| anyhow::anyhow!("[tool][todo] load config: {e}"))?,
diff --git a/crates/openhuman-core/src/tools/impl/presentation/mod.rs b/crates/openhuman-core/src/tools/impl/presentation/mod.rs
index cc301ee3ec..bd58c67bfd 100644
--- a/crates/openhuman-core/src/tools/impl/presentation/mod.rs
+++ b/crates/openhuman-core/src/tools/impl/presentation/mod.rs
@@ -27,6 +27,7 @@
//! #3026 Files panel, and the orchestrator grounding rule in #3029
//! continue to work without change.
+use crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool;
use crate::core::runtime::DispatchCtx;
use std::path::PathBuf;
use std::sync::Arc;
diff --git a/crates/openhuman-core/src/tools/impl/system/shell.rs b/crates/openhuman-core/src/tools/impl/system/shell.rs
index a20826e399..4bbca6b76b 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell.rs
@@ -4,6 +4,7 @@ use super::shell_support::container_environment;
use super::shell_support::{command_failure, exec_result, python_utf8_env, tool_timeout_message};
use crate::agent::host_runtime::RuntimeAdapter;
use crate::config::Config;
+use crate::agent::tinyagents::host::run_context::dispatch_ctx_for_tool;
use crate::core::runtime::DispatchCtx;
use crate::security::{AuditLogger, CommandExecutionLog, SecurityPolicy};
use async_trait::async_trait;