pub trait Orchestrator: Send + Sync {
// Required methods
fn deliver_mailbox(
&self,
sessions: &[SessionSnapshot],
) -> Vec<(u32, String)>;
fn deliver_interrupts(
&self,
sessions: &[SessionSnapshot],
) -> Vec<(String, String)>;
fn expire_stale(&self, live_session_ids: &[String]);
}Expand description
Tick the orchestration layer once per refresh: deliver pending mailbox messages, deliver pending coordination interrupts, and bookkeep stale rows in the underlying stores.
Each deliver_* method returns (id, status_message) tuples the TUI
surfaces in the status bar. id is a u32 for mailbox (matching the
brain’s per-PID queue) and a String for interrupts (matching the
coord interrupt_id). They differ deliberately — keeping the trait honest
to the underlying surfaces rather than papering over the distinction.
Unlike CoordView / BrainView which are read-only, this trait is
stateful: each call writes to the brain/coord SQLite stores. It still
boxes as Arc<dyn> because no method needs &mut self — implementations
open a connection per call.
Implementations may be no-ops when the relevant feature is off (e.g. the
coord feature is disabled at compile time), so call sites don’t need
#[cfg(feature = "...")] guards.
Required Methods§
Sourcefn deliver_mailbox(&self, sessions: &[SessionSnapshot]) -> Vec<(u32, String)>
fn deliver_mailbox(&self, sessions: &[SessionSnapshot]) -> Vec<(u32, String)>
Drain pending mailbox messages addressed to running sessions and
deliver them to the live terminals. Used by App::tick to surface
"Brain → sess_X: 'go ahead'" style messages.
Sourcefn deliver_interrupts(
&self,
sessions: &[SessionSnapshot],
) -> Vec<(String, String)>
fn deliver_interrupts( &self, sessions: &[SessionSnapshot], ) -> Vec<(String, String)>
Deliver pending coordination interrupts (cross-agent signals) to
running sessions. Returns (interrupt_id, status_message) tuples.
Sourcefn expire_stale(&self, live_session_ids: &[String])
fn expire_stale(&self, live_session_ids: &[String])
Expire stale leases and interrupts that have passed their deadline. Bookkeeping side-effect; best-effort, no return. Implementations log failures rather than propagating them.
live_session_ids are the sessions running now. Their leases are
renewed before anything expires (#569), so the caller passes what it
already discovered rather than the runtime scanning again.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".