diff --git a/crates/tty7-core/src/daemon/ssh/mod.rs b/crates/tty7-core/src/daemon/ssh/mod.rs index e69a28f5..20403102 100644 --- a/crates/tty7-core/src/daemon/ssh/mod.rs +++ b/crates/tty7-core/src/daemon/ssh/mod.rs @@ -138,10 +138,20 @@ impl SshManager { )) } + /// Always empty: loopback forwards are not a registry of their own. A + /// forward `ensure_loopback` sets up is an ordinary [`ForwardEntry`] under + /// the owning pane or workspace, so the managed list is where it shows up + /// and where it is closed from. + /// + /// Kept because the wire protocol still carries `ListLoopbackForwards` and + /// `CloseLoopbackForward`; nothing in this workspace sends either. pub fn list_loopback_forwards(&self) -> Vec { Vec::new() } + /// Always false, for the reason on [`Self::list_loopback_forwards`]: there + /// is no separate registry to close from. Auto forwards go away with their + /// owner, or through the managed list. pub fn close_loopback_forward(&self, _id: &LoopbackForwardId) -> bool { false } diff --git a/src/terminal/remote.rs b/src/terminal/remote.rs index 40874350..53958418 100644 --- a/src/terminal/remote.rs +++ b/src/terminal/remote.rs @@ -1,5 +1,3 @@ -#![allow(dead_code)] - use std::borrow::Cow; use std::io::Read as _; use std::path::PathBuf; @@ -20,8 +18,7 @@ use crate::core::cli_agent::{AgentSessionState, CLIAgent}; use crate::core::config::CursorStyle as ConfigCursorStyle; use crate::core::osc::OscTokenizer; use crate::daemon::protocol::{ - AuthPromptKind, AuthResponse, ClientMsg, DaemonMsg, KnownHostEntry, KnownHostId, - LoopbackForward, LoopbackForwardId, LoopbackForwardInfo, LoopbackForwardRequest, + AuthPromptKind, AuthResponse, ClientMsg, DaemonMsg, LoopbackForward, LoopbackForwardRequest, ManagedForward, NativeSshSpec, PaneProcs, RemoteContext, RestoreFrom, SftpEntry, SftpJobProgress, SftpOp, SftpOpResult, SftpTransferSpec, ShellSpec, SshForwardRule, SshPhase, SshTestReport, WinSize, WorkspaceOp, WorkspaceRequest, @@ -233,25 +230,6 @@ fn spawn_workspace(owner: Option<&str>, route: &PaneRoute) -> Option { } impl RemoteTerminal { - pub fn spawn( - size: TermSize, - cell_w: u16, - cell_h: u16, - cwd: Option, - shell: Option, - ) -> anyhow::Result<(Self, u64)> { - Self::spawn_on( - &PaneRoute::Local, - size, - cell_w, - cell_h, - cwd, - shell, - None, - None, - ) - } - pub fn spawn_on( route: &PaneRoute, size: TermSize, @@ -389,10 +367,6 @@ impl RemoteTerminal { } } - pub fn attach(size: TermSize, cell_w: u16, cell_h: u16, pane_id: u64) -> anyhow::Result { - Self::attach_on(&PaneRoute::Local, size, cell_w, cell_h, pane_id) - } - pub fn attach_on( route: &PaneRoute, size: TermSize, @@ -1224,10 +1198,6 @@ impl RemoteTerminal { self.size } - pub fn list_panes() -> Vec { - Self::list_panes_on(&PaneRoute::Local) - } - pub fn list_panes_on(route: &PaneRoute) -> Vec { Self::try_list_panes_on(route).unwrap_or_default() } @@ -1243,10 +1213,6 @@ impl RemoteTerminal { } } - pub fn kill_pane(pane_id: u64) { - Self::kill_pane_on(&PaneRoute::Local, pane_id) - } - pub fn kill_pane_on(route: &PaneRoute, pane_id: u64) { if let Ok(mut stream) = connect_routed(route) { let _ = ClientMsg::Kill { pane_id }.encode(&mut stream); @@ -1275,34 +1241,6 @@ impl RemoteTerminal { } } - pub fn list_loopback_forwards() -> Vec { - fn query() -> anyhow::Result> { - let mut stream = connect()?; - ClientMsg::ListLoopbackForwards.encode(&mut stream)?; - match DaemonMsg::read(&mut stream)? { - DaemonMsg::LoopbackForwardList(list) => Ok(list), - other => Err(anyhow::anyhow!( - "unexpected reply to ListLoopbackForwards: {other:?}" - )), - } - } - query().unwrap_or_default() - } - - pub fn close_loopback_forward(id: LoopbackForwardId) -> Vec { - fn query(id: LoopbackForwardId) -> anyhow::Result> { - let mut stream = connect()?; - ClientMsg::CloseLoopbackForward(id).encode(&mut stream)?; - match DaemonMsg::read(&mut stream)? { - DaemonMsg::LoopbackForwardList(list) => Ok(list), - other => Err(anyhow::anyhow!( - "unexpected reply to CloseLoopbackForward: {other:?}" - )), - } - } - query(id).unwrap_or_default() - } - pub fn spawn_native_ssh( size: TermSize, cell_w: u16, @@ -1415,20 +1353,6 @@ impl RemoteTerminal { } } - pub fn list_known_hosts() -> Vec { - fn query() -> anyhow::Result> { - let mut stream = connect()?; - ClientMsg::ListKnownHosts.encode(&mut stream)?; - match DaemonMsg::read(&mut stream)? { - DaemonMsg::KnownHostsList(list) => Ok(list), - other => Err(anyhow::anyhow!( - "unexpected reply to ListKnownHosts: {other:?}" - )), - } - } - query().unwrap_or_default() - } - /// Ask the daemon to dial this spec and say what happened. Blocking, and /// bounded by the spec's own connect timeout on the far side — call it off /// the UI thread. @@ -1446,20 +1370,6 @@ impl RemoteTerminal { }) } - pub fn delete_known_host(id: KnownHostId) -> Vec { - fn query(id: KnownHostId) -> anyhow::Result> { - let mut stream = connect()?; - ClientMsg::DeleteKnownHost(id).encode(&mut stream)?; - match DaemonMsg::read(&mut stream)? { - DaemonMsg::KnownHostsList(list) => Ok(list), - other => Err(anyhow::anyhow!( - "unexpected reply to DeleteKnownHost: {other:?}" - )), - } - } - query(id).unwrap_or_default() - } - pub fn sftp_list(pane_id: u64, path: &str) -> Result, String> { fn query(pane_id: u64, path: String) -> anyhow::Result, String>> { let mut stream = connect()?; @@ -1594,20 +1504,6 @@ impl RemoteTerminal { } } - pub fn on_workspace_forwards(req: WorkspaceRequest) -> Vec { - match Self::on_workspace(req) { - Ok(DaemonMsg::ForwardList(list)) => list, - Ok(other) => { - log::warn!("unexpected reply to a workspace forward request: {other:?}"); - Vec::new() - } - Err(e) => { - log::warn!("workspace forward request failed: {e}"); - Vec::new() - } - } - } - pub fn workspace_request( ws: &PaneWorkspace, view_pane: u64,