pub struct PreLlmCtx {
pub session_id: SessionId,
pub messages: Vec<ChatMessage>,
pub tools: Vec<Value>,
pub emit_fn: Option<Box<dyn Fn(UserEvent) + Send + Sync>>,
}Fields§
§session_id: SessionId§messages: Vec<ChatMessage>§tools: Vec<Value>§emit_fn: Option<Box<dyn Fn(UserEvent) + Send + Sync>>Unified emit function: sends UserEvent to both the renderer (real-time)
and the event bus (persistence). Set by the react loop; middleware calls
emit() which delegates to this closure.
The closure captures the renderer callback and the event bus, so middleware never needs to know about broadcast channels or drain mechanics.
Implementations§
Source§impl PreLlmCtx
impl PreLlmCtx
Sourcepub fn emit(&self, event: UserEvent)
pub fn emit(&self, event: UserEvent)
Emit a UserEvent to both the renderer and the event bus.
This is the single entry point for middleware to send events. The event is delivered to the renderer callback (real-time display) and to the event bus (persistence, event_log, checkpoint) in one call.
Does nothing if the emit function was not set (e.g. in tests). Panics inside the emit function are caught and logged as warnings.
Auto Trait Implementations§
impl !RefUnwindSafe for PreLlmCtx
impl !UnwindSafe for PreLlmCtx
impl Freeze for PreLlmCtx
impl Send for PreLlmCtx
impl Sync for PreLlmCtx
impl Unpin for PreLlmCtx
impl UnsafeUnpin for PreLlmCtx
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more