Skip to main content

StatusSink

Trait StatusSink 

Source
pub trait StatusSink:
    Send
    + Sync
    + 'static {
    // Provided methods
    fn status_changed(
        &self,
        _status: EngineStatus,
        _model_name: Option<&str>,
        _error: Option<&str>,
    ) { ... }
    fn replied(&self, _reply: &ChatReply) { ... }
    fn text_delta(&self, _delta: &str) { ... }
    fn tool_requested(&self, _call: &ToolCall) { ... }
    fn approval_requested(&self, _request: &ApprovalRequest) { ... }
    fn tool_started(&self, _call: &ToolCall) { ... }
    fn tool_finished(&self, _result: &ToolExecutionResult) { ... }
    fn agent_replied(&self, _reply: &AgentReply) { ... }
    fn warning(&self, _message: &str) { ... }
}
Expand description

Compatibility name retained for the original Ed API. Compatibility name retained for the original Ed API. Compatibility name retained for the original Ed API. Receives lifecycle transitions and completed replies.

onde reports status by polling info(), which is the wrong shape for a UI: nothing tells the view that a load finished, so hosts end up either timing a poll loop or threading their own event emission through every call site. Ed pushes instead, and a host implements this once to bridge into whatever its UI listens on.

Both methods are synchronous and should stay cheap — they are called while Ed is mid-operation. Hand off to a channel or an event bus rather than blocking. Implementations must be Send + Sync because a load or a send may be driven from any task.

Provided Methods§

Source

fn status_changed( &self, _status: EngineStatus, _model_name: Option<&str>, _error: Option<&str>, )

The engine moved to a new lifecycle state.

model_name is the model involved where one is known, and error carries the reason when status is EngineStatus::Error.

Source

fn replied(&self, _reply: &ChatReply)

An inference turn finished, successfully or not.

Delivered as a notification rather than only as a return value because inference is slow: a host that awaits the call from a UI callback can have that callback collected before it resolves. Emitting lets the view pick the result up independently.

Source

fn text_delta(&self, _delta: &str)

A piece of the assistant’s reply, as it is generated.

Called zero or more times during Ed::run before the final reply is reported. Concatenating the deltas gives the reply text. The default does nothing, so sinks written before streaming existed keep compiling and keep seeing only the finished reply.

Source

fn tool_requested(&self, _call: &ToolCall)

Source

fn approval_requested(&self, _request: &ApprovalRequest)

Source

fn tool_started(&self, _call: &ToolCall)

Source

fn tool_finished(&self, _result: &ToolExecutionResult)

Source

fn agent_replied(&self, _reply: &AgentReply)

Source

fn warning(&self, _message: &str)

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§