Make herdr persistent by default. Launching herdr now starts or reattaches to a background session server. Clients can detach and reattach while panes and agent processes keep running. Session mode now supports multi-client attach, auto-detect startup, and a thin-client/headless-server split. This also refactors the large app, ui, input, pane, config, workspace, and persistence modules into smaller focused submodules, while preserving behavior and colocating tests with the code they exercise. Upgrade notes: - persistence mode is now the default - in-app quit detaches the current client instead of stopping the server - use `herdr server stop` to stop the background session - use `--no-session` for the old single-process behavior - default socket paths now live under the config directory
46 lines
1.4 KiB
Rust
46 lines
1.4 KiB
Rust
//! Internal app events delivered via channel.
|
|
//!
|
|
//! Background tasks (PTY child watchers, future hook listeners, etc.) send
|
|
//! events to the main loop through this channel. No polling needed.
|
|
|
|
use crate::detect::{Agent, AgentState};
|
|
use crate::layout::PaneId;
|
|
|
|
/// An event from a background task to the main loop.
|
|
#[derive(Debug)]
|
|
pub enum AppEvent {
|
|
/// A pane's child process exited.
|
|
PaneDied { pane_id: PaneId },
|
|
/// Fallback detector state changed in a pane.
|
|
StateChanged {
|
|
pane_id: PaneId,
|
|
agent: Option<Agent>,
|
|
state: AgentState,
|
|
},
|
|
/// Hook-authoritative agent state was reported for a pane.
|
|
HookStateReported {
|
|
pane_id: PaneId,
|
|
source: String,
|
|
agent_label: String,
|
|
state: AgentState,
|
|
message: Option<String>,
|
|
},
|
|
/// Hook authority was explicitly cleared for a pane.
|
|
HookAuthorityCleared {
|
|
pane_id: PaneId,
|
|
source: Option<String>,
|
|
},
|
|
/// The current detected agent gracefully released this pane back to the shell.
|
|
HookAgentReleased {
|
|
pane_id: PaneId,
|
|
source: String,
|
|
agent_label: String,
|
|
known_agent: Option<Agent>,
|
|
},
|
|
/// A new version is available and ready to install explicitly.
|
|
UpdateReady { version: String },
|
|
/// A pane child emitted a valid OSC 52 clipboard write. The main loop
|
|
/// re-emits it through herdr's own clipboard writer.
|
|
ClipboardWrite { content: Vec<u8> },
|
|
}
|