Skip to main content

Crate tear_types

Crate tear_types 

Source
Expand description

tear-types — pure typed domain for the tear multiplexer.

Owns the typed primitives (TearSession, TearWindow, TearPane, LayoutNode, KeyTable, StatusBar, TearTheme) plus the MultiplexerControl trait that every backend (in-process, local daemon, remote SSH, tmux passthrough) implements.

No I/O. No subprocess. No filesystem. Just types + serde.

§Why this crate exists at all

mado (the pleme-io GPU terminal emulator) and tear (this multiplexer) both need to model panes, windows, sessions, splits, key tables, and status bars. Without a shared typed surface the two apps would each grow their own duplicated Pane / WindowState types — typical fleet drift. Putting the canonical types here lets:

  1. mado consume the same PaneId / WindowId it would receive from a remote tear-daemon, so tier-2 (mado driving a remote tear) and tier-3 (mado embedding tear-core in-process) speak the same vocabulary.
  2. Third-party drivers (a TUI status bar, a Slack notifier, a JIT pane-snapshot exporter) can implement MultiplexerControl against this crate alone — no runtime dep, no GPU surface, no tmux dep.
  3. The compounding directive’s “solve once” rule applies — the next consumer (a hypothetical gunma shell-replay tool, a fleet pane-monitor) gets these types for free.

§What lives here vs. elsewhere

Pure data + the trait surface. Anything that opens a PTY or talks to disk lives in tear-core. Anything that opens a socket or speaks RPC lives in tear-daemon / tear-client.

Re-exports§

pub use address::Address;
pub use address::AddressError;
pub use address::Pattern;
pub use address::PatternError;
pub use address::PatternToken;
pub use address::SegmentError;
pub use capability::Capability;
pub use capability::DaemonHello;
pub use capability::DaemonIdentity;
pub use control::ControlError;
pub use control::ControlResult;
pub use control::MultiplexerControl;
pub use genesis::Genesis;
pub use genesis::Guid;
pub use direction::Direction;
pub use direction::SplitOrientation;
pub use geometry::Rect;
pub use freio::Admission;
pub use freio::Freio;
pub use freio::RefusalReason;
pub use graphics::Graphic;
pub use graphics::GraphicProtocol;
pub use graphics::GRAPHIC_PAYLOAD_MAX;
pub use host_role::HostRole;
pub use host_role::TearCaps;
pub use modes::ModeSet;
pub use modes::MouseTracking;
pub use shutai::Attested;
pub use shutai::Declared;
pub use shutai::Shutai;
pub use yurai::Yurai;
pub use id::DefinitionId;
pub use id::InstanceId;
pub use id::PaneId;
pub use id::SessionId;
pub use id::WindowId;
pub use keybind::Action;
pub use keybind::KeyBind;
pub use keybind::KeyChord;
pub use keybind::KeyTable;
pub use keybind::KeyTableName;
pub use layout::LayoutError;
pub use layout::LayoutKind;
pub use layout::LayoutNode;
pub use layout::LeafRemoval;
pub use layout::Size;
pub use layout::MIN_RATIO;
pub use live::Durability;
pub use live::LiveSession;
pub use plan::LayoutPlan;
pub use plan::PaneSlot;
pub use plan::PlanError;
pub use plan::SpawnSpec;
pub use plan::WindowPlan;
pub use block::Block;
pub use cast::CastParseError;
pub use cast::CastRow;
pub use cast::CastRowKind;
pub use pane::InputPolicy;
pub use pane::PaneState;
pub use pane::PaneStats;
pub use pane::TearPane;
pub use pane_snapshot::ansi_256_color;
pub use pane_snapshot::default_ansi_palette;
pub use pane_snapshot::Cell;
pub use pane_snapshot::CellAttrs;
pub use pane_snapshot::Color;
pub use pane_snapshot::PaneSnapshot;
pub use pane_snapshot::ANSI_BRIGHT_COLORS;
pub use pane_snapshot::ANSI_COLORS;
pub use session::SessionSource;
pub use session::SessionState;
pub use session::TearSession;
pub use spawn_env::SpawnEnv;
pub use statusbar::Segment;
pub use statusbar::SegmentAlignment;
pub use statusbar::SignalRenderMode;
pub use statusbar::StatusBar;
pub use statusbar::TearSignalKind;
pub use theme::HexColor;
pub use theme::TearTheme;
pub use window::TearWindow;
pub use window::WindowState;

Modules§

address
Addresses — the mutable half of a session’s two keys.
block
Wire-shape mirror of tear_core::blocks::Block.
capability
Daemon capabilities — what the peer on the other end of the socket can actually do, probed rather than assumed.
cast
Typed parser for asciinema v2 .cast rows.
control
The MultiplexerControl trait — every tear backend implements it.
direction
Pane split direction + orientation.
freio
freio — the operator’s brake.
genesis
Genesis + Guid — the immutable half of a session’s two keys.
geometry
Axis-aligned rectangles — the geometry the layout algebra renders to.
graphics
Inline-image payloads carried through the authority.
host_role
Who answers a VT query on a pane — the Relay→Host transition.
id
Typed identifiers — opaque, stable, BLAKE3-derived.
keybind
Keybinding model — typed key chords + actions.
layout
Binary-tree layout for a window’s panes.
live
The live half of the session model — a running incarnation and its durability.
modes
The terminal modes a client must read from the AUTHORITY, never from a parser of its own.
pane
Pane — the atomic unit that runs a shell and owns its PTY.
pane_snapshot
Typed pane snapshot — the wire payload that ferries a rendered pane state from tear-core / tear-daemon to a consumer.
path
Path-string helpers shared across tear crates. Kept tiny and dependency-free so every consumer can reuse without pulling shellexpand or other heavy crates.
plan
The latent layout plan — what a session definition stores, before it is instantiated into live panes.
session
Session — a top-level grouping of windows that survives across client disconnects.
shutai
shutai (主体) — the acting entity behind a connection.
spawn_env
SpawnEnv — the typed seam an embedder (mado) uses to stamp its OWN capability env + working directory onto every child PTY tear spawns, applied AFTER the backend’s inherited + fallback env.
statusbar
Typed status-bar model.
theme
Theme — colors + typography for tear’s status bar / pane borders / message areas. Operators pick from a named theme or roll their own; the canonical fleet theme is DERIVED from ishou_tokens::FleetDefaults — the SAME source mado reads — so a palette change in ishou propagates to tear and mado together by construction (they can never drift).
window
Window — a named tab inside a session, holding a layout tree.
wire
Wire-format types for the tear-daemon ↔ tear-client RPC.
yurai
yurai (由来) — what a PANE remembers about the actor that spawned it.