Skip to main content

EventSink

Trait EventSink 

Source
pub trait EventSink {
    // Required method
    fn emit_event(&mut self, event: &ProtocolEvent) -> Result<()>;

    // Provided methods
    fn reasoning_started(&mut self) -> Result<()> { ... }
    fn reasoning_completed(&mut self) -> Result<()> { ... }
    fn skill_instruction_attached(&mut self, _name: &str) -> Result<()> { ... }
    fn context_usage(&mut self, _tokens: usize) -> Result<()> { ... }
    fn compaction_started(&mut self) -> Result<()> { ... }
    fn compaction_finished(
        &mut self,
        _tokens_before: usize,
        _tokens_after: usize,
    ) -> Result<()> { ... }
}
Expand description

The normalized event boundary shared by the machine protocol and the TUI.

Required Methods§

Source

fn emit_event(&mut self, event: &ProtocolEvent) -> Result<()>

Provided Methods§

Source

fn reasoning_started(&mut self) -> Result<()>

Notify interactive frontends that the provider sent genuine reasoning metadata. This is intentionally not part of the public protocol.

Source

fn reasoning_completed(&mut self) -> Result<()>

Notify interactive frontends after the provider’s reasoning metadata has ended. This is intentionally not part of the public protocol.

Source

fn skill_instruction_attached(&mut self, _name: &str) -> Result<()>

Notify interactive frontends after an explicit skill invocation was expanded from the immutable session snapshot. This is not a public JSONL protocol event.

Source

fn context_usage(&mut self, _tokens: usize) -> Result<()>

Notify interactive frontends of the estimated prompt context size. This is intentionally not part of the public JSONL protocol.

Source

fn compaction_started(&mut self) -> Result<()>

Notify interactive frontends that an internal context compaction began. This is intentionally not part of the public JSONL protocol.

Source

fn compaction_finished( &mut self, _tokens_before: usize, _tokens_after: usize, ) -> Result<()>

Notify interactive frontends after a compaction boundary was persisted. This is intentionally not part of the public JSONL protocol.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§