Repository navigation
feat(harness): add ToolExecutionContext::call_id_of and PackRegistryHandle::of - #616
Open
CodeGhost21 wants to merge 1 commit into
Open
CodeGhost21 wants to merge 1 commit into
CodeGhost21 wants to merge 1 commit into
Conversation
…andle::of Hosts recovered the harness call id and the use_skill pack-registry handle with their own downcasts over tinytools' erased host-extension seams. Expose the accessors on the owning types instead: - ToolExecutionContext::of(Option<&dyn ToolRunContext>) is the single host_extension downcast; call_id_of returns the call id through it. - PackRegistryHandle::of(&dyn Tool) reads the handle UseSkillTool attaches as ToolCallBinding metadata; skills::pack_registry_handle delegates to it. The media artifact tool's call-id extraction now uses call_id_of. Refs senamakel#93 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CodeGhost21
marked this pull request as ready for review
November 16, 2026 14:12
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two accessors so hosts stop hand-rolling downcasts of harness types:
ToolExecutionContext::of(context: Option<&dyn ToolRunContext>) -> Option<&Self>: the one documented downcast throughToolRunContext::host_extension.ToolExecutionContext::call_id_of(context) -> Option<String>reads the call id through it.PackRegistryHandle::of(tool: &dyn Tool) -> Option<Self>: reads the handleUseSkillTool::newattaches as metadata on the tool'sToolCallBinding. The existingskills::pack_registry_handlefree function now calls it, so it stays public and works as before.media/artifact_tool.rs::canonical_tool_call_idusescall_id_ofinstead of its own copy of the downcast, with an identical result.OpenHuman's
crates/openhuman-core/src/tools/host_extensions.rsexists only to do these two downcasts. Itstool_call_id(ctx)andpack_registry_handle(tool)map 1:1 ontoToolExecutionContext::call_id_ofandPackRegistryHandle::of, with the same input and output types (host adoption: senamakel/openhuman#363).Fixes senamakel#93. Part of tinyhumansai/openhuman#7390 (phase 3 tracker senamakel/openhuman#391).
API Or Behavior Changes
tinyagents_harness::tool::ToolExecutionContext::{of, call_id_of}tinyagents_harness_tools::skills::PackRegistryHandle::ofpack_registry_handleandcanonical_tool_call_iddelegate to the new accessors.PackRegistryHandle::oflives intinyagents-harness-tools, besidePackRegistryHandle, not intinyagents-harness/src/tool/as the issue's target column says. That crate is where the type and its free-function downcast already were.call_id_ofreturnsOption<String>to match OpenHuman 1:1. A borrowing form is already available asToolExecutionContext::of(ctx).map(|c| &c.call_id).Tests
tinyagents-harness/src/tool/context_tests.rs, 4 new:call_id_of_reads_the_harness_execution_contextandcall_id_of_is_none_without_a_context, which are OpenHuman'stool_call_idtests, adapted;of_recovers_the_harness_context_from_the_erased_run_context, which checks pointer identity;of_is_none_without_a_context_or_for_a_foreign_context.tinyagents-harness-tools/src/skills/mod_tests.rs, 2 new:of_returns_the_handle_use_skill_was_built_with;of_is_none_for_a_tool_without_a_pack_registry_handle.Commands run locally:
cargo fmt --check(cargo fmt --all -- --check)cargo clippy --all-targets -- -D warnings(--workspace)cargo clippy --all-targets --all-features -- -D warnings(--workspace)cargo build --all-targets(cargo check -p tinyagents-harness -p tinyagents-harness-tools)cargo build --all-targets --all-features: left to CIcargo test, scoped:-p tinyagents-harness --lib tool::: 309 passed.-p tinyagents-harness-tools --all-features --lib media::: 10 passed.-p tinyagents-harness-tools --lib -- skills::: 30 passed, 5 failed. The 5 fail identically on unmodifiedupstream/main(28cf21e) with "packed tool catalog is unavailable for this registration":typed_use_skill_dispatch_pins_the_selected_target_and_live_parentpinned_pack_call_merges_outer_approval_and_shared_adapter_forwards_bindinggeneric_binding_applies_tool_rules_to_the_selected_packed_toolharness_rule_denial_blocks_the_pinned_inner_tool_before_typed_dispatchregistered_pack_dispatch_runs_through_the_harness_with_admitted_target_and_live_parentcargo test --all-features: left to CIDocumentation
CHANGELOG.md: new "Unreleased" entry.crates/tinyagents-harness/src/tool/README.mdandcrates/tinyagents-harness-tools/README.md.Release note: OpenHuman needs a tag that contains this before it can bump the gitlink, swap its callers and delete
tools/host_extensions.rs.🤖 Generated with Claude Code
Summary by CodeRabbit
skills::pack_registry_handlefunction remains available.