assistant_tool: Decouple Tool from Workspace (#26309)

This PR decouples the `Tool` trait from the `Workspace` (and from the
UI, in general).

`Tool::run` now takes a `WeakEntity<Project>` instead of a
`WeakEntity<Workspace>` and a `Window`.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-03-07 17:41:56 -05:00 committed by GitHub
parent 4f6682c7fe
commit 18f3f8097f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 35 additions and 52 deletions

View file

@ -31,4 +31,3 @@ settings.workspace = true
smol.workspace = true
url = { workspace = true, features = ["serde"] }
util.workspace = true
workspace.workspace = true

View file

@ -2,7 +2,7 @@ use std::sync::Arc;
use anyhow::{anyhow, bail};
use assistant_tool::Tool;
use gpui::{App, Entity, Task, Window};
use gpui::{App, Entity, Task};
use crate::manager::ContextServerManager;
use crate::types;
@ -51,8 +51,7 @@ impl Tool for ContextServerTool {
fn run(
self: std::sync::Arc<Self>,
input: serde_json::Value,
_workspace: gpui::WeakEntity<workspace::Workspace>,
_: &mut Window,
_project: gpui::WeakEntity<project::Project>,
cx: &mut App,
) -> gpui::Task<gpui::Result<String>> {
if let Some(server) = self.server_manager.read(cx).get_server(&self.server_id) {