Skip to content

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

refactor(embed): pass run context to tool hook callbacks

Steven Enamakelb38bfadc36b4
diff --git a/crates/openhuman-embed/src/profiles/host.rs b/crates/openhuman-embed/src/profiles/host.rs
index fe45e1debc..aa2bb70b78 100644
--- a/crates/openhuman-embed/src/profiles/host.rs
+++ b/crates/openhuman-embed/src/profiles/host.rs
@@ -1,7 +1,7 @@
//! Operator adapters installed once, before the SaaS profile host boots.
use super::{ProfileError, ProfileRuntimeBuilder, SaasConfig};
-use crate::seams::{ToolHook, ToolHookContext};
+use crate::seams::{OpenHumanRunContext, ToolHook, ToolHookContext};
use crate::{
HostTools, HostTurnTools, PermissionFuture, PermissionLevel, ToolScopeSpec, TurnContext,
};
diff --git a/crates/openhuman-embed/src/runtime/seams_tests.rs b/crates/openhuman-embed/src/runtime/seams_tests.rs
index d5cf2dab1b..18b0ca22a5 100644
--- a/crates/openhuman-embed/src/runtime/seams_tests.rs
+++ b/crates/openhuman-embed/src/runtime/seams_tests.rs
@@ -93,10 +93,18 @@ impl ToolHook<OpenHumanRunContext> for NamedToolHook {
fn name(&self) -> &str {
self.0
}
- async fn before_tool(&self, _context: &ToolHookContext) -> anyhow::Result<()> {
+ async fn before_tool(
+ &self,
+ _: &OpenHumanRunContext,
+ _context: &ToolHookContext,
+ ) -> anyhow::Result<()> {
Ok(())
}
- async fn after_tool(&self, _context: &ToolHookContext) -> anyhow::Result<()> {
+ async fn after_tool(
+ &self,
+ _: &OpenHumanRunContext,
+ _context: &ToolHookContext,
+ ) -> anyhow::Result<()> {
Ok(())
}
}
diff --git a/crates/openhuman-embed/tests/scoped_hooks.rs b/crates/openhuman-embed/tests/scoped_hooks.rs
index ef579dd694..9fb9fa813e 100644
--- a/crates/openhuman-embed/tests/scoped_hooks.rs
+++ b/crates/openhuman-embed/tests/scoped_hooks.rs
@@ -48,7 +48,11 @@ impl ToolHook<OpenHumanRunContext> for Observer {
fn name(&self) -> &str {
"same-policy-name"
}
- async fn before_tool(&self, ctx: &ToolHookContext) -> anyhow::Result<()> {
+ async fn before_tool(
+ &self,
+ _: &OpenHumanRunContext,
+ ctx: &ToolHookContext,
+ ) -> anyhow::Result<()> {
self.record("before", ctx.arguments["owner"].as_str().unwrap());
if self.first.swap(false, Ordering::SeqCst) {
if let Some(barrier) = &self.overlap {
@@ -57,7 +61,11 @@ impl ToolHook<OpenHumanRunContext> for Observer {
}
Ok(())
}
- async fn after_tool(&self, ctx: &ToolHookContext) -> anyhow::Result<()> {
+ async fn after_tool(
+ &self,
+ _: &OpenHumanRunContext,
+ ctx: &ToolHookContext,
+ ) -> anyhow::Result<()> {
assert_eq!(ctx.success, Some(true));
self.record("after", ctx.arguments["owner"].as_str().unwrap());
Ok(())