fix(query): run provider tool calls through hooks#85
Closed
BunsDev wants to merge 1 commit into
Closed
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR routes non-Anthropic/provider tool calls through the same hook-aware tool execution pipeline used for Anthropic streaming, ensuring PreToolUse/plugin policy and post-hook events are consistently enforced.
Changes:
- Replaced the provider (non-streaming) per-tool execution loop with a shared hook-aware executor.
- Refactored the streaming
"tool_use"stop-reason path to reuse the shared executor. - Introduced
execute_tool_blocks_with_hooksto centralize pre-hook gating, concurrent execution, post-hooks, and TUI events.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+2027
to
+2043
| // Phase 2: execute non-blocked tools concurrently. | ||
| let exec_futures: Vec<_> = prepared | ||
| .iter() | ||
| .map(|p| { | ||
| if let Some(result) = p.blocked_result.clone() { | ||
| futures::future::Either::Left(async move { result }) | ||
| } else { | ||
| let name = p.name.clone(); | ||
| let input = p.input.clone(); | ||
| futures::future::Either::Right(async move { | ||
| execute_tool(&name, &input, tools, tool_ctx).await | ||
| }) | ||
| } | ||
| }) | ||
| .collect(); | ||
| let exec_results: Vec<ToolResult> = futures::future::join_all(exec_futures).await; | ||
|
|
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.
Route provider tool calls through the hook pipeline for consistent processing.