pub struct TeeEmitter { /* private fields */ }Expand description
An AgentEmitter that forwards every event to each of its children, in
registration order. The host builds one around [BroadcastEmitter (→ TUI), ExtensionEmitter (→ plugin handlers)] so a single AgentHarnessOptions .agent_emitter slot feeds both consumers: the TUI keeps rendering from its
broadcast receiver, and plugin on() handlers receive translated
StablePluginEvents.
emit awaits each child in turn (the loop awaits emit, so order matches
registration); try_emit calls each child’s try_emit (the tool
on_update path — non-blocking). A child that panics is isolated by the
child’s own catch_unwind where applicable (the ExtensionEmitter does);
the BroadcastEmitter cannot panic (it’s a tx.send). We do NOT wrap the
fan-out itself in catch_unwind — each child is responsible for its own
soundness, and a generic wrapper would mask a child’s contract violation.
Implementations§
Source§impl TeeEmitter
impl TeeEmitter
Sourcepub fn new(emitters: Vec<Arc<dyn AgentEmitter>>) -> Self
pub fn new(emitters: Vec<Arc<dyn AgentEmitter>>) -> Self
Build a tee over the given emitters. Order is preserved: emit/try_emit
visit them front-to-back. A single-child tee is a trivial passthrough
(the host uses that when no extensions loaded, so the code path is
uniform).
Trait Implementations§
Source§impl AgentEmitter for TeeEmitter
impl AgentEmitter for TeeEmitter
Source§fn emit(&self, event: AgentEvent) -> BoxFuture<'static, ()>
fn emit(&self, event: AgentEvent) -> BoxFuture<'static, ()>
Source§fn try_emit(&self, event: AgentEvent)
fn try_emit(&self, event: AgentEvent)
on_update path. Must never panic
and must never block (it’s called from a &dyn Fn closure inside
execute). Default impl is a no-op so custom emitters opt in.