From 0fa6440d41c31f23ba2126e4b23bc5627705e317 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Tue, 30 Jun 2026 02:47:50 +0300 Subject: feat: add terminal session control stream --- src/protocol/wire.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/protocol') diff --git a/src/protocol/wire.rs b/src/protocol/wire.rs index e6ba5746..5f44691b 100644 --- a/src/protocol/wire.rs +++ b/src/protocol/wire.rs @@ -387,6 +387,14 @@ pub enum ClientMessage { /// Pane, terminal, or agent target to observe. target: String, }, + + /// Switch this connection into writable terminal control mode. + ControlTerminal { + /// Pane, terminal, or agent target to control. + target: String, + /// Replace an existing writable controller for this terminal. + takeover: bool, + }, } #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] @@ -1005,6 +1013,13 @@ mod tests { }), 8 ); + assert_eq!( + tag(&ClientMessage::ControlTerminal { + target: "w1:p1".to_owned(), + takeover: false, + }), + 9 + ); } #[test] @@ -1143,6 +1158,18 @@ mod tests { assert_eq!(msg, decoded); } + #[test] + fn client_control_terminal_roundtrip() { + let msg = ClientMessage::ControlTerminal { + target: "w1:p1".to_owned(), + takeover: true, + }; + let encoded = bincode::serde::encode_to_vec(&msg, bincode::config::standard()).unwrap(); + let (decoded, _): (ClientMessage, _) = + bincode::serde::decode_from_slice(&encoded, bincode::config::standard()).unwrap(); + assert_eq!(msg, decoded); + } + #[test] fn client_attach_scroll_roundtrip() { let msg = ClientMessage::AttachScroll { -- cgit v1.2.3