Skip to main content

rmux_sdk/
lib.rs

1#![deny(missing_docs)]
2#![deny(rustdoc::broken_intra_doc_links)]
3#![deny(rustdoc::invalid_codeblock_attributes)]
4#![forbid(unsafe_code)]
5
6//! Public daemon-backed RMUX SDK.
7//!
8//! v1 exposes live facade handles, session builders, waits, pane streams,
9//! snapshots, and command escape hatches over the rmux daemon.
10//!
11//! `rmux-sdk` is a public integration peer of `rmux-client` and must not
12//! depend on `rmux-client`, `rmux-core`, `rmux-server`, or `rmux-pty` as
13//! normal dependencies. The authoritative identity newtypes
14//! ([`SessionName`], [`SessionId`], [`WindowId`], [`PaneId`]) live in
15//! `rmux-proto` and are re-exported here so SDK users import them through
16//! `rmux_sdk` without ever depending on those internal crates.
17//!
18//! # Quickstart
19//!
20//! The shortest daemon-backed SDK program connects to a daemon, starting one
21//! through the platform hidden-daemon path if needed, then ensures a session:
22//!
23//! ```no_run
24//! use std::time::Duration;
25//!
26//! use rmux_sdk::{
27//!     EnsureSession, EnsureSessionPolicy, ProcessSpec, Rmux, RmuxEndpoint, SessionName,
28//!     TerminalSizeSpec,
29//! };
30//!
31//! # async fn run() -> rmux_sdk::Result<()> {
32//! let rmux = Rmux::builder()
33//!     .default_timeout(Duration::from_secs(5))
34//!     .connect_or_start()
35//!     .await?;
36//! assert!(!matches!(rmux.endpoint(), RmuxEndpoint::Default));
37//!
38//! let session = SessionName::new("quickstart").expect("valid session name");
39//! let session = rmux
40//!     .ensure_session(
41//!         EnsureSession::named(session)
42//!             .policy(EnsureSessionPolicy::CreateOrReuse)
43//!             .detached(true)
44//!             .size(TerminalSizeSpec::new(120, 32))
45//!             .process(ProcessSpec::default()),
46//!     )
47//!     .await?;
48//! assert!(session.exists().await?);
49//! # Ok(())
50//! # }
51//! ```
52//!
53pub mod actions;
54pub mod bootstrap;
55pub mod broadcast;
56pub(crate) mod capabilities;
57pub mod capture;
58pub mod command;
59pub mod diagnostics;
60pub mod discovery;
61pub mod ensure;
62pub mod error;
63pub mod events;
64pub mod extract;
65pub mod handles;
66pub mod info;
67pub mod input;
68pub mod layout;
69pub mod load_state;
70pub mod locator;
71pub mod pane_set;
72pub mod snapshot;
73pub mod spec;
74pub mod trace;
75pub mod types;
76pub mod wait;
77#[cfg(feature = "web")]
78pub mod web_share;
79
80#[allow(dead_code)]
81pub(crate) mod transport;
82
83pub use actions::{FillStrategy, PaneKeyboard, PaneMouse, PaneSetKeyboard};
84pub use broadcast::{
85    BroadcastPaneFailure, BroadcastPaneSuccess, BroadcastResult, Input, PartialBroadcastFailure,
86};
87pub use capture::{CaptureBuilder, CapturedRegion, Rect};
88pub use command::{CommandRun, RmuxCommand, RmuxCommandKind};
89pub use diagnostics::{
90    command_feature_id, protocol_diagnostic, unsupported_feature_id, Diagnostic,
91    DiagnosticSeverity, FEATURE_DAEMON_SHUTDOWN, FEATURE_PROTOCOL_CAPABILITIES,
92    FEATURE_PROTOCOL_WIRE_VERSION, FEATURE_TRANSPORT_UNIX_SOCKET, FEATURE_TRANSPORT_WINDOWS_PIPE,
93};
94pub use discovery::{DiscoveredPane, DiscoveredSession, PaneFinder, SessionFinder};
95pub use ensure::{EnsureSession, EnsureSessionPolicy};
96pub use error::{CollectError, Result, RmuxError};
97pub use events::{
98    PaneCommandStatus, PaneCommandSummary, PaneDisconnectReason, PaneEvent, PaneExitReason,
99    PaneLagNotice, PaneLineItem, PaneLineStream, PaneNotification, PaneOutputChunk,
100    PaneOutputStart, PaneOutputStream, PanePermissionScope, PaneRecentOutput, PaneRenderStream,
101    RenderUpdate,
102};
103pub use extract::{CollectedPaneOutput, PaneTextMatch};
104pub use handles::{
105    CleanupPolicy, LeaseState, NewWindowBuilder, OwnedSession, OwnedSessionBuilder,
106    OwnedSessionSignalHandlers, Pane, PaneCapture, PaneCaptureBuilder, PaneCloseOutcome,
107    PaneRespawnOptions, PaneSpawnBuilder, PaneSplitBuilder, Rmux, RmuxBuilder, Session,
108    SplitDirection, Window, WindowCloseOutcome, WindowPane,
109};
110pub use info::{InfoSnapshot, PaneExitState, PaneInfo, PaneProcessState, SessionInfo, WindowInfo};
111pub use input::{
112    DetachChord, DetachDetector, DetachOutcome, KeyCode, KeyConversionError, KeyEvent, KeyModifiers,
113};
114pub use layout::{GridLayoutBuilder, LayoutPaneBuilder, SessionLayoutBuilder};
115pub use load_state::{TerminalLoadState, TerminalLoadStateWait};
116pub use locator::{
117    Locator, LocatorAssertion, LocatorExpectation, LocatorFilter, LocatorMatch, LocatorState,
118    LocatorText, LocatorWait,
119};
120pub use pane_set::{
121    PaneSet, PaneSetAny, PaneSetBatch, PaneSetExpectation, PaneSetFailure, PaneSetSuccess,
122    PaneSetVisibleTextOutcome, PaneSetVisibleTextWait,
123};
124pub use rmux_proto::LayoutName;
125#[cfg(feature = "web")]
126pub use rmux_proto::{WebTerminalPalette, WebTerminalTheme};
127pub use snapshot::{
128    PaneAttributes, PaneCell, PaneColor, PaneCursor, PaneGlyph, PaneSnapshot,
129    PaneSnapshotShapeError,
130};
131pub use spec::{
132    AttachSessionReuse, AttachSessionSpec, ClientTerminalSpec, NewSessionReuse, NewSessionSpec,
133    ProcessCommandSpec, ProcessSpec, RefreshClientSpec, SplitDirectionSpec, SplitSpec,
134    SplitTargetSpec, SubscriptionSpec,
135};
136pub use trace::{RmuxTraceBuilder, TraceSession};
137pub use types::{
138    PaneId, PaneRef, RmuxEndpoint, SessionId, SessionName, TargetRef, TerminalSizeSpec, WindowId,
139    WindowRef,
140};
141pub use wait::{ArmedWait, VisibleTextExpectation, VisibleTextWait, WaitTimeoutError};
142#[cfg(feature = "web")]
143pub use web_share::{
144    WebConfigInfo, WebShareBuilder, WebShareHandle, WebShareLookup, WebShareSummary,
145};