first pass of merging in warp (doesn't build)

This commit is contained in:
Ryan Ward
2026-07-01 16:08:58 -05:00
parent 2f64909469
commit 4770ac06b5
3662 changed files with 414574 additions and 89772 deletions
+1 -3
View File
@@ -5,11 +5,9 @@ use galaxy_core::ui::theme::AnsiColorIdentifier;
use galaxyui::elements::{ChildView, Element, Empty, ParentElement, Wrap};
use galaxyui::{AppContext, Entity, TypedActionView, View, ViewContext, ViewHandle};
use super::{file_button_label, Artifact};
use crate::notebooks::NotebookId;
use crate::terminal::input::MenuPositioning;
use super::file_button_label;
use super::Artifact;
use crate::view_components::action_button::{
ActionButton, ActionButtonTheme, ButtonSize, SecondaryTheme, TooltipAlignment,
};
+51 -3
View File
@@ -19,8 +19,9 @@ use crate::notebooks::NotebookId;
use crate::server::server_api::ai::ArtifactDownloadResponse;
use crate::server::server_api::ServerApiProvider;
use crate::view_components::DismissibleToast;
use crate::workspace::ToastStack;
use crate::workspace::WorkspaceAction;
#[cfg(feature = "local_fs")]
use crate::view_components::ToastLink;
use crate::workspace::{ToastStack, WorkspaceAction};
pub mod buttons;
pub use buttons::{ArtifactButtonsRow, ArtifactButtonsRowEvent};
@@ -439,6 +440,7 @@ fn open_file_download_picker<V: galaxyui::View>(
let artifact_uid = artifact.artifact_uid().to_string();
let path = PathBuf::from(path);
let toast_filename = download_toast_filename(&path);
let toast_path = path.clone();
let artifact_for_download = artifact.clone();
ctx.spawn(
async move {
@@ -448,7 +450,7 @@ fn open_file_download_picker<V: galaxyui::View>(
move |_me, result, ctx| match result {
Ok(()) => show_file_download_toast(
&artifact_uid,
DismissibleToast::success(format!("Downloaded {toast_filename}.")),
file_download_success_toast(&toast_filename, &toast_path),
ctx,
),
Err(error) => {
@@ -489,6 +491,52 @@ fn download_toast_filename(path: &Path) -> String {
.to_string()
}
/// The platform-appropriate label for the toast link that reveals a downloaded
/// file in the system file manager.
#[cfg(feature = "local_fs")]
fn reveal_in_file_manager_label() -> &'static str {
#[cfg(target_os = "macos")]
{
"View in Finder"
}
#[cfg(target_os = "windows")]
{
"Show in Explorer"
}
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
{
"Open folder"
}
}
/// Builds the success message shown after a file artifact is downloaded,
/// including the directory the file landed in.
#[cfg(feature = "local_fs")]
fn download_success_message(filename: &str, directory: &Path) -> String {
format!("{filename} was downloaded to {}.", directory.display())
}
/// Builds the success toast for a completed file-artifact download. When the
/// saved path has a parent directory, the toast reports where the file landed
/// and offers a link to reveal it in the file manager; otherwise it falls back
/// to a plain confirmation.
#[cfg(feature = "local_fs")]
fn file_download_success_toast(
filename: &str,
file_path: &Path,
) -> DismissibleToast<WorkspaceAction> {
let Some(directory) = file_path.parent() else {
return DismissibleToast::success(format!("Downloaded {filename}."));
};
DismissibleToast::success(download_success_message(filename, directory)).with_link(
ToastLink::new(reveal_in_file_manager_label().to_string()).with_onclick_action(
WorkspaceAction::OpenInExplorer {
path: file_path.to_path_buf(),
},
),
)
}
fn non_empty_trimmed(value: &str) -> Option<&str> {
let trimmed = value.trim();
(!trimmed.is_empty()).then_some(trimmed)
+12 -1
View File
@@ -1,7 +1,7 @@
use super::*;
use anyhow::anyhow;
use chrono::{TimeZone, Utc};
use super::*;
#[cfg(feature = "local_fs")]
use crate::ai::artifact_download::default_download_filename;
use crate::server::server_api::ai::{
@@ -151,6 +151,17 @@ fn default_download_filename_falls_back_to_artifact_uid_with_extension() {
);
}
#[test]
#[cfg(feature = "local_fs")]
fn download_success_message_includes_filename_and_directory() {
use std::path::Path;
assert_eq!(
download_success_message("report.csv", Path::new("/Users/me/Downloads")),
"report.csv was downloaded to /Users/me/Downloads."
);
}
#[test]
fn converts_graphql_file_artifact() {
let artifact = Artifact::try_from(galaxy_graphql::ai::AIConversationArtifact::FileArtifact(