diff --git a/Cargo.lock b/Cargo.lock index 2b85384681b..20384a30fbd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1429,7 +1429,6 @@ dependencies = [ name = "auto_update_ui" version = "0.1.0" dependencies = [ - "agent_skills", "anyhow", "auto_update", "client", @@ -1437,11 +1436,12 @@ dependencies = [ "editor", "gpui", "markdown_preview", - "prompt_store", + "project", "release_channel", "semver", "serde", "serde_json", + "settings", "smol", "telemetry", "ui", diff --git a/assets/images/delta_announcement_diagram.svg b/assets/images/delta_announcement_diagram.svg new file mode 100644 index 00000000000..689999cc688 --- /dev/null +++ b/assets/images/delta_announcement_diagram.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/delta_announcement_grid.svg b/assets/images/delta_announcement_grid.svg new file mode 100644 index 00000000000..28069fe64a9 --- /dev/null +++ b/assets/images/delta_announcement_grid.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/delta_mark.svg b/assets/images/delta_mark.svg new file mode 100644 index 00000000000..fa9c2901ea5 --- /dev/null +++ b/assets/images/delta_mark.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/crates/auto_update_ui/Cargo.toml b/crates/auto_update_ui/Cargo.toml index f15ead3df25..3bc8a42983e 100644 --- a/crates/auto_update_ui/Cargo.toml +++ b/crates/auto_update_ui/Cargo.toml @@ -14,7 +14,6 @@ test = false doctest = false [dependencies] -agent_skills.workspace = true anyhow.workspace = true auto_update.workspace = true client.workspace = true @@ -22,11 +21,12 @@ db.workspace = true editor.workspace = true gpui.workspace = true markdown_preview.workspace = true -prompt_store.workspace = true +project.workspace = true release_channel.workspace = true semver.workspace = true serde.workspace = true serde_json.workspace = true +settings.workspace = true smol.workspace = true telemetry.workspace = true ui.workspace = true diff --git a/crates/auto_update_ui/src/auto_update_ui.rs b/crates/auto_update_ui/src/auto_update_ui.rs index b6f4faec93f..c900fc123ac 100644 --- a/crates/auto_update_ui/src/auto_update_ui.rs +++ b/crates/auto_update_ui/src/auto_update_ui.rs @@ -1,8 +1,4 @@ -use std::sync::Arc; - -use agent_skills::GLOBAL_SKILLS_DIR_DISPLAY; use auto_update::{AutoUpdater, release_notes_url}; -use client::zed_urls; use db::kvp::Dismissable; use editor::{Editor, MultiBuffer}; use gpui::{ @@ -10,12 +6,13 @@ use gpui::{ prelude::*, }; use markdown_preview::markdown_preview_view::{MarkdownPreviewMode, MarkdownPreviewView}; -use prompt_store::rules_to_skills_migration; +use project::DisableAiSettings; use release_channel::{AppVersion, ReleaseChannel}; use semver::Version; use serde::Deserialize; +use settings::Settings as _; use smol::io::AsyncReadExt; -use ui::{AnnouncementToast, ListBulletItem, SkillsIllustration, prelude::*}; +use ui::{AnnouncementToast, DeltaIllustration, ListBulletItem, prelude::*}; use util::{ResultExt as _, maybe}; use workspace::{ Workspace, @@ -194,60 +191,40 @@ struct AnnouncementContent { bullet_items: Vec, primary_action_label: SharedString, secondary_action_label: SharedString, - primary_action_url: Option, - primary_action_callback: Option>, - secondary_action_url: Option, - on_dismiss: Option>, + primary_action_url: SharedString, + secondary_action_url: SharedString, } -struct SkillsAnnouncement; +struct DeltaAnnouncement; -impl Dismissable for SkillsAnnouncement { - const KEY: &'static str = "skills_announcement_dismissed"; +impl Dismissable for DeltaAnnouncement { + const KEY: &'static str = "delta_announcement_dismissed"; } fn announcement_for_version(version: &Version, cx: &App) -> Option { - let version_with_skills = match ReleaseChannel::global(cx) { - ReleaseChannel::Stable => Version::new(1, 4, 0), - ReleaseChannel::Dev | ReleaseChannel::Nightly | ReleaseChannel::Preview => { - Version::new(1, 4, 0) - } - }; - - if *version >= version_with_skills && !SkillsAnnouncement::dismissed(cx) { - // Only mention the Rules → Skills migration if the user actually - // had Rules that got migrated. New users (and existing users who - // never created a Rule) would otherwise be confused by a bullet - // referring to "your rules" that don't exist. - let migrated_anything = - rules_to_skills_migration::migration_result().is_some_and(|result| !result.is_empty()); - - let mut bullet_items: Vec = Vec::with_capacity(3); - bullet_items - .push(format!("Skills live in {GLOBAL_SKILLS_DIR_DISPLAY}//SKILL.md").into()); - bullet_items.push("Type / to manually invoke a skill".into()); - if migrated_anything { - bullet_items.push( - "The Rules Library is making way for skills: your default rules are now in a global AGENTS.md, and your other rules have been converted to skills".into(), - ); - } - - Some(AnnouncementContent { - heading: "Introducing Skills Support".into(), - description: "Extend the agent with focused instructions and domain knowledge.".into(), - bullet_items, - primary_action_label: "Try Now".into(), - secondary_action_label: "Read Documentation".into(), - primary_action_url: None, - primary_action_callback: Some(Arc::new(move |window, cx| { - window.dispatch_action(Box::new(zed_actions::assistant::FocusAgent), cx); - })), - on_dismiss: Some(Arc::new(|cx| SkillsAnnouncement::set_dismissed(true, cx))), - secondary_action_url: Some(zed_urls::skills_docs(cx).into()), - }) - } else { - None + let version_with_delta = Version::new(1, 22, 0); + if *version < version_with_delta + || DisableAiSettings::get_global(cx).disable_ai + || DeltaAnnouncement::dismissed(cx) + { + return None; } + + Some(AnnouncementContent { + heading: "Introducing Delta".into(), + description: + "Built on DeltaDB, so your threads and code stay in sync across machines and teammates." + .into(), + bullet_items: vec![ + "Made by the Zed team, with the same quality and performance".into(), + "Work with teammates and agents in the same thread, live or later".into(), + "Pick up your thread on the web or your phone, without committing or pushing".into(), + ], + primary_action_label: "Try Delta".into(), + secondary_action_label: "Learn More".into(), + primary_action_url: "https://delta.dev/".into(), + secondary_action_url: "https://delta.dev/docs/getting-started".into(), + }) } struct AnnouncementToastNotification { @@ -265,9 +242,7 @@ impl AnnouncementToastNotification { fn dismiss(&mut self, cx: &mut Context) { cx.emit(DismissEvent); - if let Some(on_dismiss) = &self.content.on_dismiss { - on_dismiss(cx); - } + DeltaAnnouncement::set_dismissed(true, cx); } } @@ -282,9 +257,9 @@ impl EventEmitter for AnnouncementToastNotification {} impl Notification for AnnouncementToastNotification {} impl Render for AnnouncementToastNotification { - fn render(&mut self, _window: &mut Window, cx: &mut Context) -> impl IntoElement { - AnnouncementToast::new() - .illustration(SkillsIllustration::new()) + fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement { + let toast = AnnouncementToast::new() + .illustration(DeltaIllustration::new()) .heading(self.content.heading.clone()) .description(self.content.description.clone()) .bullet_items( @@ -297,31 +272,30 @@ impl Render for AnnouncementToastNotification { .secondary_action_label(self.content.secondary_action_label.clone()) .primary_on_click(cx.listener({ let url = self.content.primary_action_url.clone(); - let callback = self.content.primary_action_callback.clone(); - move |this, _, window, cx| { - telemetry::event!("Skills Announcement Main Click"); - if let Some(callback) = &callback { - callback(window, cx); - } - if let Some(url) = &url { - cx.open_url(url); - } + move |this, _, _window, cx| { + telemetry::event!("Delta Announcement Main Click"); + cx.open_url(&url); this.dismiss(cx); } })) .secondary_on_click(cx.listener({ let url = self.content.secondary_action_url.clone(); move |_, _, _window, cx| { - telemetry::event!("Skills Announcement Secondary Click"); - if let Some(url) = &url { - cx.open_url(url); - } + telemetry::event!("Delta Announcement Secondary Click"); + cx.open_url(&url); } })) .dismiss_on_click(cx.listener(|this, _, _window, cx| { - telemetry::event!("Skills Announcement Dismiss"); + telemetry::event!("Delta Announcement Dismiss"); this.dismiss(cx); - })) + })); + + div() + .self_end() + .flex_none() + .w(rems_from_px(400_f32)) + .max_w((window.viewport_size().width - window.rem_size() * 1.5).max(px(0.))) + .child(toast) } } diff --git a/crates/ui/src/components/ai.rs b/crates/ui/src/components/ai.rs index 479ae55ceb5..769a5312792 100644 --- a/crates/ui/src/components/ai.rs +++ b/crates/ui/src/components/ai.rs @@ -1,11 +1,11 @@ mod agent_setup_button; mod ai_setting_item; mod configured_api_card; -mod skills_illustration; +mod delta_illustration; mod thread_item; pub use agent_setup_button::*; pub use ai_setting_item::*; pub use configured_api_card::*; -pub use skills_illustration::*; +pub use delta_illustration::*; pub use thread_item::*; diff --git a/crates/ui/src/components/ai/delta_illustration.rs b/crates/ui/src/components/ai/delta_illustration.rs new file mode 100644 index 00000000000..9a4ec3a5893 --- /dev/null +++ b/crates/ui/src/components/ai/delta_illustration.rs @@ -0,0 +1,58 @@ +use crate::prelude::*; +use gpui::{linear_color_stop, linear_gradient, svg}; + +#[derive(IntoElement)] +pub struct DeltaIllustration; + +impl DeltaIllustration { + pub fn new() -> Self { + Self + } +} + +impl RenderOnce for DeltaIllustration { + fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement { + let (background_color, bottom_opacity, top_opacity) = if cx.theme().appearance.is_light() { + (cx.theme().colors().icon_muted, 0.05, 0.025) + } else { + (gpui::black(), 0.2, 0.1) + }; + + v_flex() + .relative() + .h(rems_from_px(155_f32)) + .items_center() + .justify_center() + .rounded_t_md() + .overflow_hidden() + .bg(linear_gradient( + 0., + linear_color_stop(background_color.opacity(bottom_opacity), 0.), + linear_color_stop(background_color.opacity(top_opacity), 1.), + )) + .child( + svg() + .absolute() + .inset_0() + .size_full() + .path("images/delta_announcement_grid.svg") + .text_color(cx.theme().colors().border), + ) + .child( + svg() + .absolute() + .inset_0() + .size_full() + .path("images/delta_announcement_diagram.svg") + .text_color(cx.theme().colors().text), + ) + .child( + svg() + .absolute() + .inset_0() + .size_full() + .path("images/delta_mark.svg") + .text_color(gpui::rgb(0xd5442c)), + ) + } +} diff --git a/crates/ui/src/components/ai/skills_illustration.rs b/crates/ui/src/components/ai/skills_illustration.rs deleted file mode 100644 index b42f0c5d2e6..00000000000 --- a/crates/ui/src/components/ai/skills_illustration.rs +++ /dev/null @@ -1,86 +0,0 @@ -use crate::prelude::*; -use gpui::{linear_color_stop, linear_gradient}; - -#[derive(IntoElement)] -pub struct SkillsIllustration; - -impl SkillsIllustration { - pub fn new() -> Self { - Self - } -} - -impl RenderOnce for SkillsIllustration { - fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement { - let skill_crease = |label: SharedString, source: SharedString| { - h_flex() - .py_1() - .px_1p5() - .gap_1p5() - .border_1() - .border_color(cx.theme().colors().border) - .bg(cx.theme().colors().element_active.opacity(0.5)) - .justify_center() - .rounded_md() - .shadow_sm() - .child( - Icon::new(IconName::Sparkle) - .color(Color::Muted) - .size(IconSize::XSmall), - ) - .child(Label::new(label).size(LabelSize::XSmall).buffer_font(cx)) - .child( - Label::new(format!("({source})")) - .size(LabelSize::XSmall) - .color(Color::Muted) - .buffer_font(cx), - ) - }; - - let skill_list = v_flex() - .absolute() - .top_8() - .gap_2p5() - .items_center() - .child( - h_flex() - .gap_2p5() - .child(skill_crease("img-gen".into(), "studio".into())) - .child(skill_crease("frontend-design".into(), "global".into())), - ) - .child( - h_flex() - .gap_2p5() - .child(skill_crease("brainstorming".into(), "global".into())) - .child(skill_crease("borrow-checker-expert".into(), "zed".into())), - ) - .child( - h_flex() - .gap_2p5() - .child(skill_crease("grill-with-docs".into(), "global".into())) - .child(skill_crease("video-edit".into(), "studio".into())), - ); - - let gradient_bg = cx.theme().colors().editor_background; - let gradient_fade = div() - .absolute() - .rounded_t_md() - .inset_0() - .bg(linear_gradient( - 0., - linear_color_stop(gradient_bg.opacity(0.8), 0.), - linear_color_stop(gradient_bg.opacity(0.0), 1.), - )); - - v_flex() - .relative() - .h(rems_from_px(150_f32)) - .justify_end() - .items_center() - .rounded_t_md() - .overflow_hidden() - .bg(gpui::black().opacity(0.2)) - .child(skill_list) - .child(gradient_fade) - } -}