Skip to content

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

fix(host_extensions): handle missing extension directory gracefully

Steven Enamakel955ff8d34e26
diff --git a/crates/openhuman-core/src/tools/host_extensions.rs b/crates/openhuman-core/src/tools/host_extensions.rs
index 808d16c17a..e6a147bb0d 100644
--- a/crates/openhuman-core/src/tools/host_extensions.rs
+++ b/crates/openhuman-core/src/tools/host_extensions.rs
@@ -34,6 +34,21 @@ pub fn generated_runtime_context(
.map(|boxed| *boxed)
}
+/// Reads the provider-assigned tool-call id from a canonical tool's run
+/// context, when the run is driven through the tinyagents harness.
+///
+/// `ToolRunContext`'s portable surface (workspace, thread id, output cap)
+/// deliberately does not carry the call id — it is harness-owned. This
+/// downcasts the erased host extension to tinyagents'
+/// `ToolExecutionContext` (the same seam `ToolExecutionContext`'s own doc
+/// comment documents) and reads `call_id` off it. `None` for a context that
+/// carries no such extension (e.g. a test double) or no context at all.
+pub fn tool_call_id(ctx: Option<&dyn ToolRunContext>) -> Option<String> {
+ ctx.and_then(ToolRunContext::host_extension)
+ .and_then(|any| any.downcast_ref::<tinyagents_harness::tool::ToolExecutionContext>())
+ .map(|harness_ctx| harness_ctx.call_id.as_str().to_string())
+}
+
#[cfg(test)]
#[path = "traits_tests.rs"]
mod tests;