Skip to main content

tear_types/
lib.rs

1//! `tear-types` — pure typed domain for the tear multiplexer.
2//!
3//! Owns the typed primitives ([`TearSession`], [`TearWindow`],
4//! [`TearPane`], [`LayoutNode`], [`KeyTable`], [`StatusBar`],
5//! [`TearTheme`]) plus the [`MultiplexerControl`] trait that every
6//! backend (in-process, local daemon, remote SSH, tmux passthrough)
7//! implements.
8//!
9//! **No I/O. No subprocess. No filesystem.** Just types + serde.
10//!
11//! ## Why this crate exists at all
12//!
13//! `mado` (the pleme-io GPU terminal emulator) and `tear` (this
14//! multiplexer) both need to model panes, windows, sessions, splits,
15//! key tables, and status bars. Without a shared typed surface the
16//! two apps would each grow their own duplicated `Pane` /
17//! `WindowState` types — typical fleet drift. Putting the canonical
18//! types here lets:
19//!
20//! 1. `mado` consume the same [`PaneId`] / [`WindowId`] it would
21//!    receive from a remote `tear-daemon`, so tier-2 (mado driving a
22//!    remote tear) and tier-3 (mado embedding `tear-core` in-process)
23//!    speak the same vocabulary.
24//! 2. Third-party drivers (a TUI status bar, a Slack notifier, a JIT
25//!    pane-snapshot exporter) can implement [`MultiplexerControl`]
26//!    against this crate alone — no runtime dep, no GPU surface, no
27//!    tmux dep.
28//! 3. The compounding directive's "solve once" rule applies — the
29//!    next consumer (a hypothetical `gunma` shell-replay tool, a
30//!    fleet pane-monitor) gets these types for free.
31//!
32//! ## What lives here vs. elsewhere
33//!
34//! Pure data + the trait surface. Anything that opens a PTY or talks
35//! to disk lives in `tear-core`. Anything that opens a socket or
36//! speaks RPC lives in `tear-daemon` / `tear-client`.
37
38#![forbid(unsafe_code)]
39#![doc(html_root_url = "https://docs.rs/tear-types/0.1.0")]
40
41pub mod address;
42pub mod block;
43pub mod capability;
44pub mod cast;
45pub mod control;
46pub mod genesis;
47#[cfg(feature = "engate")]
48pub mod engate_wrap;
49pub mod direction;
50pub mod freio;
51pub mod geometry;
52pub mod graphics;
53pub mod host_role;
54pub mod id;
55pub mod keybind;
56pub mod layout;
57pub mod live;
58pub mod modes;
59pub mod pane;
60pub mod plan;
61pub mod path;
62pub mod pane_snapshot;
63pub mod session;
64pub mod shutai;
65pub mod spawn_env;
66pub mod statusbar;
67pub mod theme;
68pub mod window;
69pub mod wire;
70pub mod yurai;
71
72// `address::Segment` is deliberately NOT re-exported: the crate root
73// already binds `Segment` to the status-bar widget. Reach the address
74// label as `tear_types::address::Segment`.
75pub use address::{Address, AddressError, Pattern, PatternError, PatternToken, SegmentError};
76pub use capability::{Capability, DaemonHello, DaemonIdentity};
77pub use control::{ControlError, ControlResult, MultiplexerControl};
78pub use genesis::{Genesis, Guid};
79pub use direction::{Direction, SplitOrientation};
80pub use geometry::Rect;
81pub use freio::{Admission, Freio, RefusalReason};
82pub use graphics::{Graphic, GraphicProtocol, GRAPHIC_PAYLOAD_MAX};
83pub use host_role::{HostRole, TearCaps};
84pub use modes::{ModeSet, MouseTracking};
85pub use shutai::{Attested, Declared, Shutai};
86pub use yurai::Yurai;
87pub use id::{DefinitionId, InstanceId, PaneId, SessionId, WindowId};
88pub use keybind::{Action, KeyBind, KeyChord, KeyTable, KeyTableName};
89pub use layout::{LayoutError, LayoutKind, LayoutNode, LeafRemoval, Size, MIN_RATIO};
90pub use live::{Durability, LiveSession};
91pub use plan::{LayoutPlan, PaneSlot, PlanError, SpawnSpec, WindowPlan};
92pub use block::Block;
93pub use cast::{CastParseError, CastRow, CastRowKind};
94pub use pane::{InputPolicy, PaneState, PaneStats, TearPane};
95pub use pane_snapshot::{
96    ansi_256_color, default_ansi_palette, Cell, CellAttrs, Color, PaneSnapshot, ANSI_BRIGHT_COLORS,
97    ANSI_COLORS,
98};
99pub use session::{SessionSource, SessionState, TearSession};
100pub use spawn_env::SpawnEnv;
101pub use statusbar::{Segment, SegmentAlignment, SignalRenderMode, StatusBar, TearSignalKind};
102pub use theme::HexColor;
103pub use theme::TearTheme;
104pub use window::{TearWindow, WindowState};