Skip to content

fix(query): run provider tool calls through hooks#85

Closed
BunsDev wants to merge 1 commit into
mainfrom
pr-37-provider-tool-hooks
Closed

fix(query): run provider tool calls through hooks#85
BunsDev wants to merge 1 commit into
mainfrom
pr-37-provider-tool-hooks

Conversation

@BunsDev

@BunsDev BunsDev commented Jun 15, 2026

Copy link
Copy Markdown
Member

Route provider tool calls through the hook pipeline for consistent processing.

Originally a local review patch. Opened as draft PR for review.

@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Error Error Jun 15, 2026 6:41am

@BunsDev BunsDev marked this pull request as ready for review June 15, 2026 07:57
Copilot AI review requested due to automatic review settings June 15, 2026 07:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_hooks to 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;

@BunsDev BunsDev closed this Jun 15, 2026
@BunsDev BunsDev deleted the pr-37-provider-tool-hooks branch June 15, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants