A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.
Rust agentagent-orchestrationaiai-agentsclaude-codecodexcoding-agentlinuxmacosmultiplayermultiplexerrustterminalterminal-emulatorterminal-multiplexertmuxtuiweztermwindows
use crate::sftp::types::Metadata;
use crate::sftp::{SftpChannelError, SftpChannelResult};
use camino::Utf8PathBuf;
pub(crate) enum DirWrap {
#[cfg(feature = "ssh2")]
Ssh2(ssh2::File),
#[cfg(feature = "libssh-rs")]
LibSsh(libssh_rs::SftpDir),
}
impl DirWrap {
pub fn read_dir(&mut self) -> SftpChannelResult<(Utf8PathBuf, Metadata)> {
match self {
#[cfg(feature = "ssh2")]
Self::Ssh2(file) => {
use std::convert::TryFrom;
file.readdir()
.map_err(SftpChannelError::from)
.and_then(|(path, stat)| match Utf8PathBuf::try_from(path) {
Ok(path) => Ok((path, Metadata::from(stat))),
Err(x) => Err(SftpChannelError::from(std::io::Error::new(
std::io::ErrorKind::InvalidData,
x,
))),
})
}
#[cfg(feature = "libssh-rs")]
Self::LibSsh(dir) => match dir.read_dir() {
None => Err(SftpChannelError::from(std::io::Error::new(
std::io::ErrorKind::UnexpectedEof,
"no more files",
))),
Some(Err(err)) => Err(SftpChannelError::from(err)),
Some(Ok(metadata)) => {
let path: Utf8PathBuf = metadata
.name()
.expect("name to be present in read_dir")
.into();
let md: Metadata = metadata.into();
Ok((path, md))
}
},
}
}
}