Skip to main content

HarnessEventJournal

Trait HarnessEventJournal 

Source
pub trait HarnessEventJournal: Send + Sync {
    // Required methods
    fn append<'life0, 'async_trait>(
        &'life0 self,
        obs: AgentObservation,
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn read_from<'life0, 'life1, 'async_trait>(
        &'life0 self,
        run_id: &'life1 str,
        offset: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<AgentObservation>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn read_window<'life0, 'life1, 'async_trait>(
        &'life0 self,
        run_id: &'life1 str,
        offset: u64,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<AgentObservation>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn read_filtered<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        run_id: &'life1 str,
        offset: u64,
        kinds: &'life2 [&'life3 str],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<AgentObservation>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
}
Expand description

A durable, append-only journal of AgentObservations keyed by run id.

Journals decouple durable replay from live broadcast: a UI or supervisor can attach after a run has started and reconstruct history by reading from a known offset rather than relying on having subscribed to an in-memory crate::harness::events::EventSink.

Required Methods§

Source

fn append<'life0, 'async_trait>( &'life0 self, obs: AgentObservation, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Appends obs to the journal and returns the offset it was stored at within its run’s stream.

Source

fn read_from<'life0, 'life1, 'async_trait>( &'life0 self, run_id: &'life1 str, offset: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<AgentObservation>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns every observation for run_id whose stream offset is >= offset, in offset order. Reading from 0 replays the whole run; reading an unknown run returns an empty Vec.

Provided Methods§

Source

fn read_window<'life0, 'life1, 'async_trait>( &'life0 self, run_id: &'life1 str, offset: u64, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<AgentObservation>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns at most limit observations for run_id starting at offset (a bounded replay window). The default reads from offset and truncates; durable backends may override for a server-side limit.

Source

fn read_filtered<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, run_id: &'life1 str, offset: u64, kinds: &'life2 [&'life3 str], ) -> Pin<Box<dyn Future<Output = Result<Vec<AgentObservation>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Returns observations for run_id from offset whose AgentEvent::kind is in kinds. An empty kinds slice matches everything. This is the UI-surface filter (text-only, tool timeline, cost updates, errors, …).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§