Skip to main content

TearSession

Struct TearSession 

Source
pub struct TearSession {
    pub id: SessionId,
    pub name: String,
    pub windows: BTreeMap<WindowId, TearWindow>,
    pub panes: BTreeMap<PaneId, TearPane>,
    pub active_window: WindowId,
    pub state: SessionState,
    pub created_at_unix: u64,
    pub description: String,
    pub source: SessionSource,
    pub freio: Freio,
}
Expand description

One session: the top-level entity in the multiplexer hierarchy. A session owns a set of windows; each window owns a layout tree of panes. Sessions persist across client attach/detach cycles — this is what makes tear (and tmux) a multiplexer rather than a shell wrapper.

Fields§

§id: SessionId§name: String

Operator-visible session name ("work", "infra", "deploy-staging"). Stable across renames? No — tear rename mutates without minting a new ID.

§windows: BTreeMap<WindowId, TearWindow>

Windows belonging to this session, keyed by id. BTreeMap so the wire format orders deterministically.

§panes: BTreeMap<PaneId, TearPane>

Panes belonging to this session, keyed by id. Stored flat at the session level so a pane can move between windows without changing its address (tmux’s join-pane semantics).

§active_window: WindowId

Currently-focused window id. Must exist in windows.

§state: SessionState

Lifecycle state.

§created_at_unix: u64

Unix-seconds-since-epoch when this session was created.

§description: String

Optional operator-set description / notes — surfaced by tear list and by the status bar.

§source: SessionSource

Provenance — who/what created this session. Lets operators audit at a glance whether a session was opened by a human shell, by an AI agent (via mado MCP / direct UDS), or by a named automation. tear list --source agent filters; mado MCP tools default to Source::Agent so an operator’s tear list separates “what I started” from “what the agent started behind my back”. Default = Source::Human (the safe assumption when nothing said otherwise — pre-#6 sessions deserialise as Human).

§freio: Freio

The operator’s brake. #[serde(default)]Freio::Released, which is what every pre-freio session record already means, so landing this field changes no existing behaviour.

Implementations§

Source§

impl TearSession

Source

pub fn admits(&self, pane: PaneId) -> Option<Admission>

What input a pane ACTUALLY accepts right now.

The only way to answer this question. Note what deliberately does not exist: a TearPane::admits(). A pane alone cannot answer it — the brake lives on the session — and a method that pretended otherwise is exactly how a pane comes to report Free while refusing input. The absent method is the seal.

This also JOINS two gates that already exist rather than adding a third: the Locked check inside tear-core::send_keys and the Leader check in the daemon’s serve loop. Two authorities over one question was already one too many; freio must not make it three.

§The ordering is the design

The brake is consulted BEFORE the policy lattice. That is what makes it non-advisory: a pane explicitly pinned to Free still cannot escape a brake, because the brake is answered before the pin is ever read.

Source

pub fn unbrakable(&self) -> Vec<PaneId>

Panes this session’s brake would NOT stop, because their provenance is unknown.

Exists so the miss above is reportable. An operator pressing a panic button must be told what it did not reach — silence here would let them believe everything stopped.

Trait Implementations§

Source§

impl Clone for TearSession

Source§

fn clone(&self) -> TearSession

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TearSession

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TearSession

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for TearSession

Source§

fn eq(&self, other: &TearSession) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for TearSession

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TearSession

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.