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
Merge branch 'main' into worktree-tab-icons
RoversX019099c7444b
diff --cc codec/src/lib.rsindex c4f5426e,0d15d8b1..61b8c3bc--- a/codec/src/lib.rs+++ b/codec/src/lib.rs@@@ -481,12 -486,16 +486,16 @@@ macro_rules! pdu_ => {metrics::histogram!("pdu.size", "pdu" => "??").record(decoded.data.len() as f64);metrics::histogram!("pdu.size.rate", "pdu" => "??").record(decoded.data.len() as f64);- Ok(DecodedPdu {+ return Ok(DecodedPdu {serial: decoded.serial,pdu: Pdu::Invalid{ident:decoded.ident}- })+ });}}+ Ok(DecodedPdu {+ serial: decoded.serial,- pdu: deserialize_variant(decoded.data.as_slice(), decoded.is_compressed)?.sanitize_agent_status()++ pdu: deserialize_variant(decoded.data.as_slice(), decoded.is_compressed)?.sanitize_pane_metadata()+ })}pub async fn decode_async<R>(r: &mut R, max_serial: Option<u64>) -> Result<DecodedPdu, Error>@@@ -527,12 -525,32 +525,32 @@@,)*_ => {metrics::histogram!("pdu.size", "pdu" => "??").record(decoded.data.len() as f64);- Ok(DecodedPdu {+ return Ok(DecodedPdu {serial: decoded.serial,pdu: Pdu::Invalid{ident:decoded.ident}- })+ });}+ };+ #[cfg(not(target_family = "wasm"))]+ let deserialize_started = std::time::Instant::now();- let pdu = deserialize_variant(decoded.data.as_slice(), decoded.is_compressed)?.sanitize_agent_status();++ let pdu = deserialize_variant(decoded.data.as_slice(), decoded.is_compressed)?.sanitize_pane_metadata();+ #[cfg(not(target_family = "wasm"))]+ if decoded.data.len() > 64 * 1024 {+ log::debug!(+ "decode {} serial {}: {} bytes read in {:?}, deserialized in {:?}",+ name,+ decoded.serial,+ decoded.data.len(),+ read_took,+ deserialize_started.elapsed()+ );}+ #[cfg(target_family = "wasm")]+ let _ = name;+ Ok(DecodedPdu {+ serial: decoded.serial,+ pdu,+ })}}}@@@ -678,9 -693,9 +696,12 @@@ pdu!DefaultPalette: 94,MoveTab: 95,PluginFrame: 96,+ GetKittyFrameSelections: 97,+ KittyFrameSelections: 98,+ GetKittyImage: 99,+ ForegroundProgramChanged: 100,+ GetForegroundPrograms: 101,+ GetForegroundProgramsResponse: 102,}impl Pdu {@@@ -2758,6 -2656,37 +2783,39 @@@ mod test}}+ #[test]+ fn shared_image_response_keeps_the_legacy_positional_shape() {+ let response = GetImageCellResponse { pane_id: 3, data: None, data_generation: 5, frames_from: 0 };+ let mut bytes = Vec::new();+ response.serialize(&mut varbincode::Serializer::new(&mut bytes)).unwrap();+ assert_eq!(bytes, [3, 0, 5, 0]);+ }++ #[test]+ fn frame_control_extension_round_trips_without_changing_legacy_version() {- assert_eq!(CODEC_VERSION, 73);++ // The extension is asked for, so it needed no bump of its own; 74++ // is the foreground program's, which a server sends unasked.++ assert_eq!(CODEC_VERSION, 74);+ for pdu in [+ Pdu::GetKittyImage(GetKittyImage { pane_id: 3, image_id: 7, data_hash: [9; 32], have_frames: 2, image_epoch: Some(4) }),+ Pdu::GetKittyFrameSelections(GetKittyFrameSelections { pane_id: 3, subscribe: true }),+ Pdu::GetKittyFrameSelections(GetKittyFrameSelections { pane_id: 3, subscribe: false }),+ Pdu::KittyFrameSelections(KittyFrameSelections {+ pane_id: 3, image_epoch: 0, now_ms: 100, revision: 5,+ selections: vec![wezterm_term::KittyFrameSelection { relative_placements: Vec::new(), virtual_placements: Vec::new(), data_generation: 0, image_id: 7, data_hash: [9; 32], animation: wezterm_term::kitty_animation::KittyAnimation::new([0, 40, 70], 100) }],+ }),+ ] {+ let mut encoded = Vec::new();+ pdu.encode(&mut encoded, 17).unwrap();+ let decoded = Pdu::decode(encoded.as_slice()).unwrap();+ assert_eq!(decoded.serial, 17);+ assert_eq!(decoded.pdu, pdu);+ if matches!(pdu, Pdu::KittyFrameSelections(_)) {+ assert_eq!(decoded.pdu.pane_id(), Some(3));+ }+ }+ }+#[test]fn thinkterm_session_viewport_and_landing_protocol_round_trip() {let size = TerminalSize {diff --cc wezterm-client/src/pane/clientpane.rsindex 913d11f4,e4e8e7af..746c487f--- a/wezterm-client/src/pane/clientpane.rs+++ b/wezterm-client/src/pane/clientpane.rs@@@ -78,7 -78,7 +78,8 @@@ pub struct ClientPaneunseen_output: Mutex<bool>,progress: Mutex<Progress>,agent_status: Mutex<Option<thinkterm_proto::AgentStatus>>,+ foreground_program: Mutex<Option<thinkterm_proto::ForegroundProgram>>,+ kitty_relay: Mutex<Option<Arc<super::kitty::Relay>>>,}impl ClientPane {@@@ -89,11 -89,13 +90,18 @@@*self.agent_status.lock() = status.filter(|s| s.within_budget());}+ /// The same, for the foreground program.+ pub fn set_foreground_program(&self, program: Option<thinkterm_proto::ForegroundProgram>) {+ *self.foreground_program.lock() = program.filter(|program| program.within_budget());+ }++ pub fn reconnect_kitty_frames(&self) {+ let relay = self.kitty_relay.lock().clone();+ if let Some(relay) = relay {+ relay.reconnected();+ }+ }+/// Ask the (single) sender worker to bring the server to `palette`./// Starts the worker when none is running; a running worker picks the/// new target up by itself. Re-sends of identical palettes are@@@ -273,7 -275,7 +281,8 @@@// existed, and nothing re-delivers it until the agent next// changes state.agent_status: Mutex::new(client.remote_agent_status(remote_pane_id)),+ foreground_program: Mutex::new(client.remote_foreground_program(remote_pane_id)),+ kitty_relay: Mutex::new(None),}}