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
@@ -3,7 +3,6 @@ mod in_band_command_executor;
mod local_command_executor;
#[cfg(feature = "local_tty")]
mod msys2_command_executor;
mod tmux_executor;
#[cfg(feature = "local_tty")]
mod wsl_command_executor;
use std::collections::HashMap;
@@ -14,20 +13,13 @@ mod remote_command_executor;
pub(crate) mod remote_server_executor;
mod shared;
use std::{any::Any, fmt::Debug, sync::Arc};
use std::any::Any;
use std::fmt::Debug;
use std::sync::Arc;
use anyhow::Result;
use async_channel::{Receiver, Sender};
use async_trait::async_trait;
use galaxy_completer::completer::CommandOutput;
use galaxyui::ModelContext;
use crate::terminal::{
event::ExecutedExecutorCommandEvent, model::session::Sessions, shell::Shell,
};
use super::SessionInfo;
pub use in_band_command_executor::{
is_in_band_command, InBandCommand, InBandCommandCancelledEvent, InBandCommandExecutor,
InBandCommandOutputReceiver,
@@ -37,7 +29,14 @@ pub use local_command_executor::LocalCommandExecutor;
pub use noop_command_executor::NoOpCommandExecutor;
#[cfg(feature = "local_tty")]
pub use remote_command_executor::RemoteCommandExecutor;
pub use shared::{shell_escape_single_quotes, ExecutorCommandEvent};
pub use shared::{shell_escape_single_quotes, shell_quote_arg, ExecutorCommandEvent};
use warp_completer::completer::CommandOutput;
use warpui::ModelContext;
use super::SessionInfo;
use crate::terminal::event::ExecutedExecutorCommandEvent;
use crate::terminal::model::session::Sessions;
use crate::terminal::shell::Shell;
#[derive(Copy, Clone, Debug)]
pub struct ExecuteCommandOptions {
@@ -151,24 +150,18 @@ fn new_command_executor_for_local_tty_session(
use msys2_command_executor::MSYS2CommandExecutor;
use remote_server_executor::RemoteServerCommandExecutor;
use settings::Setting as _;
use tmux_executor::TmuxCommandExecutor;
use wsl_command_executor::WslCommandExecutor;
use crate::{
features::FeatureFlag,
remote_server::manager::RemoteServerManager,
settings::DebugSettings,
terminal::{
available_shells::AvailableShells,
model::session::{BootstrapSessionType, ShellLaunchData},
shell::ShellType,
},
};
use super::IsSSHWrapperSession;
use crate::features::FeatureFlag;
use crate::remote_server::manager::RemoteServerManager;
use crate::settings::DebugSettings;
use crate::terminal::available_shells::AvailableShells;
use crate::terminal::model::session::{BootstrapSessionType, ShellLaunchData};
use crate::terminal::shell::ShellType;
use super::IsLegacySSHSession;
// When the remote server feature flag is enabled and the session is a
// legacy SSH session, use the remote server executor *if* the manager
// When the remote server feature flag is enabled and the session is an
// SSH wrapper session, use the remote server executor *if* the manager
// already has a live `Connected` client for this session.
//
// By construction this branch is only reached after
@@ -181,7 +174,7 @@ fn new_command_executor_for_local_tty_session(
// `RemoteCommandExecutor` below. This preserves the fallback behavior
// described in specs/APP-3797.
if FeatureFlag::SshRemoteServer.is_enabled() {
if let IsLegacySSHSession::Yes { .. } = &session_info.is_legacy_ssh_session {
if let IsSSHWrapperSession::Yes { .. } = &session_info.is_ssh_wrapper_session {
let session_id = session_info.session_id;
let maybe_client = RemoteServerManager::handle(ctx)
.read(ctx, |mgr, _| mgr.client_for_session(session_id).cloned());
@@ -196,23 +189,6 @@ fn new_command_executor_for_local_tty_session(
}
}
if FeatureFlag::SSHTmuxWrapper.is_enabled()
&& session_info.tmux_control_mode
// We don't allow nested tmux warpification, so if our parent session is already warified using
// tmux then we shouldn't.
&& !parent_session_info.is_some_and(|s| s.tmux_control_mode)
{
log::info!("creating a tmux executor!");
let executor = Arc::new(TmuxCommandExecutor::new(executor_command_tx.clone()));
let executor_clone = executor.clone();
ctx.spawn_stream_local(
in_band_command_output_rx,
move |_, event, _| executor_clone.handle_executed_command_event(event),
|_, _| {}, /* on_done */
);
return executor;
}
let debug_settings = DebugSettings::as_ref(ctx);
let are_in_band_generators_for_all_sessions_enabled_debug_setting = debug_settings
.are_in_band_generators_for_all_sessions_enabled
@@ -220,9 +196,9 @@ fn new_command_executor_for_local_tty_session(
let should_force_disable_in_band_generators =
debug_settings.force_disable_in_band_generators.value();
let is_legacy_ssh_session = matches!(
&session_info.is_legacy_ssh_session,
IsLegacySSHSession::Yes { .. }
let is_ssh_wrapper_session = matches!(
&session_info.is_ssh_wrapper_session,
IsSSHWrapperSession::Yes { .. }
);
let shell_needs_in_band_executor = session_info.shell.force_in_band_command_executor();
@@ -314,15 +290,17 @@ fn new_command_executor_for_local_tty_session(
}
}
BootstrapSessionType::WarpifiedRemote
if is_legacy_ssh_session
if is_ssh_wrapper_session
&& !FeatureFlag::InBandGeneratorsForSSH.is_enabled()
&& !force_use_in_band_generators =>
{
if let IsLegacySSHSession::Yes { socket_path } = &session_info.is_legacy_ssh_session {
if let IsSSHWrapperSession::Yes { socket_path, .. } =
&session_info.is_ssh_wrapper_session
{
let wsl_distro = parent_session_info
.and_then(|session| session.wsl_name())
.map(ToOwned::to_owned);
log::info!("creating a legacy ssh executor!");
log::info!("creating a ControlMaster-based ssh executor!");
Arc::new(RemoteCommandExecutor::new(socket_path.clone(), wsl_distro))
} else {
unreachable!("Unreachable because of match! above. Unfortunately if let guards in rust are still experimental.")
@@ -338,7 +316,7 @@ fn new_command_executor_for_local_tty_session(
// shortly after subshells launch. The setting that triggers this
// codepath is only accessible via a user defaults command that a Warp
// engineer would have given to the user via some first-hand
// correspondance (e.g. GitHub issues).
// correspondence (e.g. GitHub issues).
log::info!("creating a no-op executor!");
Arc::new(NoOpCommandExecutor::new())
} else {
@@ -369,8 +347,6 @@ fn new_command_executor_for_local_tty_session(
#[cfg(test)]
pub mod testing {
use crate::terminal::shell::ShellType;
use anyhow::anyhow;
use command::r#async::Command;
use galaxy_completer::completer::CommandOutput;