Skip to content

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

refactor(embed): migrate turn hooks to TurnSummary

Steven Enamakelbff22a3ed565
diff --git a/crates/openhuman-embed/examples/hooks.rs b/crates/openhuman-embed/examples/hooks.rs
index d73d7020c4..820ab00741 100644
--- a/crates/openhuman-embed/examples/hooks.rs
+++ b/crates/openhuman-embed/examples/hooks.rs
@@ -47,7 +47,7 @@ impl openhuman_embed::seams::LearningSink for Counter {
}
async fn on_turn_complete(
&self,
- _: &openhuman_embed::seams::TurnContext,
+ _: &openhuman_embed::seams::TurnSummary,
) -> anyhow::Result<()> {
self.0.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
Ok(())
diff --git a/crates/openhuman-embed/examples/runtime_events.rs b/crates/openhuman-embed/examples/runtime_events.rs
index 317346e5c7..62e33484ba 100644
--- a/crates/openhuman-embed/examples/runtime_events.rs
+++ b/crates/openhuman-embed/examples/runtime_events.rs
@@ -78,7 +78,7 @@ impl openhuman_embed::seams::LearningSink for Counter {
}
async fn on_turn_complete(
&self,
- _: &openhuman_embed::seams::TurnContext,
+ _: &openhuman_embed::seams::TurnSummary,
) -> anyhow::Result<()> {
self.0.fetch_add(1, Ordering::SeqCst);
Ok(())
diff --git a/crates/openhuman-embed/src/runtime/seams_tests.rs b/crates/openhuman-embed/src/runtime/seams_tests.rs
index 60c26e7d71..d53f3dc396 100644
--- a/crates/openhuman-embed/src/runtime/seams_tests.rs
+++ b/crates/openhuman-embed/src/runtime/seams_tests.rs
@@ -2,7 +2,8 @@
//! and the ranker tests (one slot for the whole process) serialize on a lock.
use super::*;
-use openhuman_core::agent::hooks::{ToolHookContext, TurnContext};
+use tinyagents_hooks::tool::ToolHookContext;
+use tinyagents_harness::host::TurnSummary;
use tinytools::{RankCandidate, RankContext, RankError, RankHit, ToolRanker};
static RANKER_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());
@@ -32,7 +33,7 @@ impl LearningSink for NamedPostTurn {
fn name(&self) -> &str {
self.0
}
- async fn on_turn_complete(&self, _ctx: &TurnContext) -> anyhow::Result<()> {
+ async fn on_turn_complete(&self, _ctx: &TurnContextTurnSummary) -> anyhow::Result<()> {
Ok(())
}
}
diff --git a/crates/openhuman-embed/tests/runtime_observation.rs b/crates/openhuman-embed/tests/runtime_observation.rs
index a95f60aae2..11f758cde3 100644
--- a/crates/openhuman-embed/tests/runtime_observation.rs
+++ b/crates/openhuman-embed/tests/runtime_observation.rs
@@ -33,7 +33,7 @@ impl LearningSink for Hook {
fn name(&self) -> &str {
self.name
}
- async fn on_turn_complete(&self, ctx: &TurnContext) -> anyhow::Result<()> {
+ async fn on_turn_complete(&self, ctx: &TurnContextTurnSummary) -> anyhow::Result<()> {
self.seen.send(ctx.agent_id.clone().unwrap_or_default())?;
Ok(())
}
diff --git a/crates/openhuman-embed/tests/scoped_hooks.rs b/crates/openhuman-embed/tests/scoped_hooks.rs
index 084ff38205..36007c1431 100644
--- a/crates/openhuman-embed/tests/scoped_hooks.rs
+++ b/crates/openhuman-embed/tests/scoped_hooks.rs
@@ -69,7 +69,7 @@ impl LearningSink for Observer {
fn name(&self) -> &str {
"same-policy-name"
}
- async fn on_turn_complete(&self, ctx: &TurnContext) -> anyhow::Result<()> {
+ async fn on_turn_complete(&self, ctx: &TurnContextTurnSummary) -> anyhow::Result<()> {
assert!(ctx.session_id.is_some());
assert!(ctx.agent_id.is_some());
self.record("turn", ctx.user_message.lines().last().unwrap());
diff --git a/crates/openhuman-embed/tests/seams_runtime.rs b/crates/openhuman-embed/tests/seams_runtime.rs
index 789e7d89cc..9c840501ce 100644
--- a/crates/openhuman-embed/tests/seams_runtime.rs
+++ b/crates/openhuman-embed/tests/seams_runtime.rs
@@ -50,7 +50,7 @@ impl LearningSink for ProbeHook {
}
async fn on_turn_complete(
&self,
- _ctx: &openhuman_embed::seams::TurnContext,
+ _ctx: &openhuman_embed::seams::TurnSummary,
) -> anyhow::Result<()> {
Ok(())
}