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
mux: a pane that wedges on request, for checking the server around it
RoversXfee28d5a9d14
diff --git a/mux/src/lib.rs b/mux/src/lib.rsindex eb8d89b0..df511be2 100644--- a/mux/src/lib.rs+++ b/mux/src/lib.rs@@ -563,6 +563,36 @@ pub(crate) fn has_external_kitty_image_data_source(actions: &[Action]) -> bool {/// This function applies parsed actions to the pane and notifies any/// mux subscribers about the output event+/// A pane whose parser holds the terminal for a long time, on request:+/// `THINKTERM_WEDGE_PANE=<pane id>` in the server's environment makes that+/// pane's parser take its terminal lock and keep it for+/// `THINKTERM_WEDGE_SECS` (default 60) once, on the pane's first batch of+/// output. What a runaway program does by accident, made to order, so the+/// promise that one such pane leaves every other pane, the pane list and+/// every client answering can be checked rather than assumed. Costs one+/// atomic load per batch when unset.+fn wedge_for_the_test(pane: &Arc<dyn Pane>) {+ use std::sync::OnceLock;+ static WEDGE: OnceLock<Option<(PaneId, Duration)>> = OnceLock::new();+ static DONE: AtomicBool = AtomicBool::new(false);+ let Some((wedged, hold)) = *WEDGE.get_or_init(|| {+ let pane_id = std::env::var("THINKTERM_WEDGE_PANE").ok()?.parse().ok()?;+ let secs = std::env::var("THINKTERM_WEDGE_SECS")+ .ok()+ .and_then(|s| s.parse().ok())+ .unwrap_or(60);+ Some((pane_id, Duration::from_secs(secs)))+ }) else {+ return;+ };+ if pane.pane_id() != wedged || DONE.swap(true, Ordering::Relaxed) {+ return;+ }+ log::warn!("THINKTERM_WEDGE_PANE: holding pane {wedged}'s terminal for {hold:?}");+ pane.hold_render_state_for_the_test(hold);+ log::warn!("THINKTERM_WEDGE_PANE: pane {wedged} released");+}+fn send_actions_to_mux(pane: &Weak<dyn Pane>, dead: &Arc<AtomicBool>, mut actions: Vec<Action>) {let start = Instant::now();// External kitty payloads (a path or shm name) are read here, on the@@ -574,6 +604,7 @@ fn send_actions_to_mux(pane: &Weak<dyn Pane>, dead: &Arc<AtomicBool>, mut action}match pane.upgrade() {Some(pane) => {+ wedge_for_the_test(&pane);pane.perform_actions(actions);histogram!("send_actions_to_mux.perform_actions.latency").record(start.elapsed());Mux::notify_from_any_thread(MuxNotification::PaneOutput(pane.pane_id()));diff --git a/mux/src/localpane.rs b/mux/src/localpane.rsindex a5d345e4..9a494699 100644--- a/mux/src/localpane.rs+++ b/mux/src/localpane.rs@@ -376,6 +376,11 @@ impl Pane for LocalPane {self.terminal.try_lock().is_none()}+ fn hold_render_state_for_the_test(&self, hold: Duration) {+ let _held = self.terminal.lock();+ std::thread::sleep(hold);+ }+fn summary_without_waiting(&self) -> PaneSummary {let mut summary = match self.terminal.try_lock() {Some(mut term) => self.store_summary(&mut term),diff --git a/mux/src/pane.rs b/mux/src/pane.rsindex baedceca..d0ca0710 100644--- a/mux/src/pane.rs+++ b/mux/src/pane.rs@@ -308,6 +308,13 @@ pub trait Pane: Downcast + Send + Sync {false}+ /// Take whatever `render_state_is_contended` reports on and hold it+ /// for `hold`, sleeping. Only the wedge hook in `send_actions_to_mux`+ /// uses it; a pane with nothing to hold does nothing.+ fn hold_render_state_for_the_test(&self, hold: std::time::Duration) {+ let _ = hold;+ }+/// What a listing shows of this pane, without waiting for its parser:/// the facts as they are if they can be read now, otherwise as they/// were last read. A pane with nothing to wait for reads them now.