Skip to content

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

fix(observability): restore tool event bridge and icon

Steven Enamakel73312c80b2ee
diff --git a/app/src/features/conversations/tools/ToolIcon.tsx b/app/src/features/conversations/tools/ToolIcon.tsx
new file mode 100644
index 0000000000..6107ae95ad
--- /dev/null
+++ b/app/src/features/conversations/tools/ToolIcon.tsx
@@ -0,0 +1,37 @@
+import { useState } from 'react';
+
+import { cn } from '../../../components/assistant-ui/lib/utils';
+import { composioLogoUrl } from '../../../components/composio/toolkitMeta';
+import type { ToolCallPresentation } from './toolPresentation';
+
+/**
+ * The glyph for a tool call: the connected app's logo for an integration
+ * action (the same Composio-hosted logo the Skills page already shows), or the
+ * registry's lucide icon. A logo that fails to load falls back to the icon, so
+ * an unknown toolkit never renders a broken image.
+ */
+export function ToolIcon({
+ presentation,
+ className,
+}: {
+ presentation: Pick<ToolCallPresentation, 'icon' | 'integration'>;
+ className?: string;
+}) {
+ const [logoFailed, setLogoFailed] = useState(false);
+ const Icon = presentation.icon;
+ const integration = presentation.integration;
+ if (integration?.known && !logoFailed) {
+ return (
+ <img
+ src={composioLogoUrl(integration.slug)}
+ alt=""
+ aria-hidden
+ data-testid="tool-icon-logo"
+ className={cn('size-4 shrink-0 rounded-sm object-contain', className)}
+ loading="lazy"
+ onError={() => setLogoFailed(true)}
+ />
+ );
+ }
+ return <Icon aria-hidden data-testid="tool-icon" className={cn('size-4 shrink-0', className)} />;
+}
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 f111eba175..cabe8a25b4 100644
--- a/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
@@ -132,12 +132,17 @@ impl OpenhumanEventBridge {
Arc::default(),
Arc::default(),
Arc::default(),
+ Vec::new(),
)
}
/// Build a bridge, optionally child-scoped, sharing `cursor` (iteration
/// attribution) and `tool_names` (tool-call name lookup for the streamed
- /// argument fragments) with the model adapter.
+ /// argument fragments) with the model adapter. `tool_sets` is the turn's
+ /// registered tool sets (cheap `Arc` clones), used to resolve a live
+ /// `&dyn Tool` for `display_label`/`display_detail` — pass `Vec::new()`
+ /// when none are available (e.g. tests).
+ #[allow(clippy::too_many_arguments)]
pub(crate) fn with_scope(
on_progress: Option<Sender<AgentProgress>>,
model: impl Into<String>,
@@ -148,6 +153,7 @@ impl OpenhumanEventBridge {
tool_names: ToolNameMap,
failure_map: ToolFailureMap,
usage_carry: ProviderUsageCarry,
+ tool_sets: Vec<Arc<Vec<Box<dyn tinytools::Tool>>>>,
) -> Arc<Self> {
Arc::new(Self {
on_progress,
@@ -162,11 +168,52 @@ impl OpenhumanEventBridge {
recorded_iterations: Mutex::new(std::collections::HashSet::new()),
resolved_calls: Mutex::new(std::collections::HashMap::new()),
tool_started_at: Mutex::new(std::collections::HashMap::new()),
+ tool_sets,
state: Mutex::new(BridgeState::default()),
overflow: Arc::default(),
})
}
+ /// 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`]
+ /// using `args` (the real call arguments when known, `Null` at call-start
+ /// before they've arrived). Unknown tools (not found in any set — the
+ /// unknown-tool-call path never registers one) fall back to a humanized
+ /// name with no detail, matching the pre-existing behavior.
+ pub(super) fn resolve_display(
+ &self,
+ tool_name: &str,
+ args: &serde_json::Value,
+ ) -> (Option<String>, Option<String>) {
+ match self
+ .tool_sets
+ .iter()
+ .flat_map(|set| set.iter())
+ .find(|t| t.name() == tool_name)
+ {
+ Some(tool) => {
+ let label = tool.display_label(args);
+ let detail = tool.display_detail(args);
+ tracing::trace!(
+ tool_name,
+ label = ?label,
+ detail = ?detail,
+ "[tool-presentation] resolved display label/detail from registered tool"
+ );
+ (label, detail)
+ }
+ None => {
+ tracing::debug!(
+ tool_name,
+ "[tool-presentation] tool not found in turn's registered sets — \
+ falling back to humanized name"
+ );
+ (Some(humanize_tool_name(tool_name)), None)
+ }
+ }
+ }
+
/// Cumulative `(input_tokens, output_tokens, charged_usd)` observed so far.
#[cfg(test)]
pub(super) fn totals(&self) -> (u64, u64, f64) {