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

@ -3,7 +3,8 @@ use std::sync::Arc;
use anyhow::{anyhow, Result};
use assistant_tool::Tool;
use chrono::{Local, Utc};
use gpui::{App, Task, WeakEntity, Window};
use gpui::{App, Task, WeakEntity};
use project::Project;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
@ -41,8 +42,7 @@ impl Tool for NowTool {
fn run(
self: Arc<Self>,
input: serde_json::Value,
_workspace: WeakEntity<workspace::Workspace>,
_window: &mut Window,
_project: WeakEntity<Project>,
_cx: &mut App,
) -> Task<Result<String>> {
let input: NowToolInput = match serde_json::from_value(input) {