Skip to main content

AdvisorRuntimeHost

Trait AdvisorRuntimeHost 

Source
pub trait AdvisorRuntimeHost:
    Send
    + Sync
    + 'static {
    // Required methods
    fn snapshot_messages(&self) -> Vec<Message>;
    fn enqueue_advice(&self, note: AdvisorNote);

    // Provided methods
    fn maintain_context(&self, _incoming_tokens: usize) -> bool { ... }
    fn begin_advisor_update(&self) { ... }
    fn notify_failure(&self, _error: &str) { ... }
}
Expand description

Host callbacks the runtime needs. omp AdvisorRuntimeHost.

Required Methods§

Source

fn snapshot_messages(&self) -> Vec<Message>

Snapshot of the primary transcript (host should exclude the advisor’s own echoed advice so it isn’t re-fed).

Source

fn enqueue_advice(&self, note: AdvisorNote)

Route an accepted note to the primary (the host applies its emission guard + delivery channel). omp enqueueAdvice.

Provided Methods§

Source

fn maintain_context(&self, _incoming_tokens: usize) -> bool

Pre-prompt context maintenance for the advisor’s own context. Return true to force a re-prime (reset advisor context + replay the full current transcript). omp maintainContext. Optional.

Source

fn begin_advisor_update(&self)

Called immediately before each advisor prompt cycle, so the host can clear per-update advisor state (its emission guard’s one-advise budget). omp beginAdvisorUpdate. Optional.

Source

fn notify_failure(&self, _error: &str)

Surface a non-recovering advisor failure (3 consecutive errors) without adding model-visible context. omp notifyFailure. Optional.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§