Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Require confirmation for fetch tool (#36881)
Conrad Irwina102b087438c
diff --git a/crates/agent2/src/tools/fetch_tool.rs b/crates/agent2/src/tools/fetch_tool.rsindex 0313c4e4c2f..dd97271a799 100644--- a/crates/agent2/src/tools/fetch_tool.rs+++ b/crates/agent2/src/tools/fetch_tool.rs@@ -136,12 +136,17 @@ impl AgentTool for FetchTool {fn run(self: Arc<Self>,input: Self::Input,- _event_stream: ToolCallEventStream,+ event_stream: ToolCallEventStream,cx: &mut App,) -> Task<Result<Self::Output>> {+ let authorize = event_stream.authorize(input.url.clone(), cx);+let text = cx.background_spawn({let http_client = self.http_client.clone();- async move { Self::build_message(http_client, &input.url).await }+ async move {+ authorize.await?;+ Self::build_message(http_client, &input.url).await+ }});cx.foreground_executor().spawn(async move {diff --git a/crates/assistant_tools/src/fetch_tool.rs b/crates/assistant_tools/src/fetch_tool.rsindex 79e205f205d..cc22c9fc09f 100644--- a/crates/assistant_tools/src/fetch_tool.rs+++ b/crates/assistant_tools/src/fetch_tool.rs@@ -118,7 +118,7 @@ impl Tool for FetchTool {}fn needs_confirmation(&self, _: &serde_json::Value, _: &Entity<Project>, _: &App) -> bool {- false+ true}fn may_perform_edits(&self) -> bool {