Skip to content

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

refactor(tinyagents): remove unused generation enrichment plumbing from event bridge

Steven Enamakela2ca279c9c43
diff --git a/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs b/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
index 7f58ad0014..56309b1a54 100644
--- a/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
@@ -15,7 +15,7 @@ use tinytools::humanize_tool_name;
use super::bridge_types::{ProviderUsageCarry, SubagentScope, ToolFailureMap, ToolNameMap};
use tinyagents_harness::events::{CallDedupe, IterationCursor, OrderedSender};
-use tinyagents_harness::events::{AgentEvent, EventSink};
+use tinyagents_harness::events::AgentEvent;
fn valid_provider_id(value: &str) -> bool {
!value.is_empty()
@@ -73,13 +73,6 @@ pub(crate) struct OpenhumanEventBridge {
/// Shared with the model adapter so thinking deltas line up with the
/// model call (iteration) they belong to.
pub(super) cursor: IterationCursor,
- /// Original run-local event source, used to append content-free host
- /// enrichment while the corresponding native generation is still open.
- pub(super) native_events: Mutex<Option<EventSink>>,
- /// Current model-call identity by native 1-based attempt ordinal. Usage
- /// events do not carry call IDs, but are emitted between ModelStarted and
- /// ModelCompleted on this run-local sink.
- pub(super) call_ids: Mutex<std::collections::HashMap<u32, tinyagents_harness::ids::CallId>>,
/// Shared `call_id → tool_name` map written by the model adapter's
/// `ThinkingForwarder` on tool-call start; read here to label the
/// incremental tool-argument fragments projected off the crate stream.
@@ -186,8 +179,6 @@ impl OpenhumanEventBridge {
scope,
definition: std::sync::OnceLock::new(),
cursor,
- native_events: Mutex::new(None),
- call_ids: Mutex::new(std::collections::HashMap::new()),
tool_names,
failure_map,
usage_carry,
@@ -209,57 +200,6 @@ impl OpenhumanEventBridge {
}
}
- pub(crate) fn set_native_events(&self, events: EventSink) {
- *self
- .native_events
- .lock()
- .unwrap_or_else(std::sync::PoisonError::into_inner) = Some(events);
- }
-
- pub(super) fn emit_generation_enrichment(
- &self,
- call_id: tinyagents_harness::ids::CallId,
- enrichment: tinyagents_harness::events::GenerationEnrichment,
- ) {
- if let Some(events) = self
- .native_events
- .lock()
- .unwrap_or_else(std::sync::PoisonError::into_inner)
- .as_ref()
- {
- events.emit(AgentEvent::GenerationEnriched {
- call_id,
- enrichment,
- });
- }
- }
-
- pub(super) fn base_generation_enrichment(
- &self,
- ) -> tinyagents_harness::events::GenerationEnrichment {
- let provider_id = valid_provider_id(&self.provider_id).then(|| self.provider_id.clone());
- let pricing = if self.model.trim().to_ascii_lowercase().ends_with(":free") {
- Some(tinyagents_harness::events::GenerationPricing {
- input_per_mtok_usd: Some(0.0),
- cached_input_per_mtok_usd: Some(0.0),
- output_per_mtok_usd: Some(0.0),
- })
- } else {
- tinyagents_registry::pricing::lookup(&self.model).map(|price| {
- tinyagents_harness::events::GenerationPricing {
- input_per_mtok_usd: Some(price.input_per_mtok_usd),
- cached_input_per_mtok_usd: Some(price.cached_input_per_mtok_usd),
- output_per_mtok_usd: Some(price.output_per_mtok_usd),
- }
- })
- };
- tinyagents_harness::events::GenerationEnrichment {
- provider_id,
- pricing,
- estimated_cost_usd: None,
- }
- }
-
/// Resolve `tool_name` against the turn's registered tool sets and
/// compute the presentation pair from the tool's OWN
/// [`tinytools::Tool::display_label`] / [`tinytools::Tool::display_detail`]