mouser_mode_api/lib.rs
1//! The public API every Mouser mode plugin is built on (docs/protocol.md).
2//!
3//! A mode is its own executable. Mouser starts it once, keeps it running and
4//! talks to it over its stdin/stdout with length-prefixed frames
5//! ([`codec`]), MessagePack by default or JSON with `MOUSER_MODE_WIRE=json`.
6//! The first exchange is a handshake ([`protocol::Hello`] /
7//! [`protocol::Welcome`]) that picks a shared protocol version
8//! ([`protocol::negotiate`]) and registers the plugin's event listeners.
9//! Then events flow in ([`events`]) and views, effects, emits and host calls
10//! ([`host_api`]) flow out. Images travel through a shared-memory ring
11//! ([`shm`]) with inline bytes as the fallback. The host restarts a crashed
12//! plugin with back-off and gives up after a cap ([`supervisor`]). Plugins
13//! reach host features (remote files, preferences, models, permissions,
14//! fetch) through the [`services`] traits, answered over RPC.
15//!
16//! Commander, chat and preferences are built on this crate exactly like a
17//! third-party mode.
18
19pub mod codec;
20pub mod complete;
21pub mod events;
22#[cfg(feature = "markdown")]
23pub mod highlight;
24pub mod host;
25pub mod host_api;
26pub mod hosted;
27#[cfg(feature = "markdown")]
28pub mod markdown;
29pub mod mode;
30pub mod protocol;
31pub mod serve;
32pub mod services;
33pub mod shm;
34pub mod supervisor;
35pub mod ui;
36
37pub use hosted::{Hosted, HostedItem, HostedView, ItemIcon, ViewLayout};
38pub use mode::{Context, Effect};
39pub use protocol::{API_VERSION, ApiRange};
40pub use serve::{Host, Mode, serve};
41pub use ui::{Action, DockSize, MenuEntry, Panel, PanelItem, PanelStyle, Rect, Viewport, dock_chrome_height};