ed-agent 1.2.2

Embeddable local-LLM-first chat agent: engine lifecycle, history, and status over the Onde inference SDK.
Documentation
//! Ed: an embeddable, local-LLM-first chat agent.
//!
//! Ed sits one layer above the [`onde`] inference SDK. `onde` gives you a
//! [`ChatEngine`](onde::inference::ChatEngine) you can load a model into and
//! send messages to; Ed adds the part every application built on it was
//! writing for itself:
//!
//! - **Lifecycle orchestration.** Loading a model is a sequence of state
//!   changes, not one call. Ed drives `Loading -> Ready` (or `-> Error`) and
//!   reports each transition.
//! - **Notification.** `onde` exposes status by polling
//!   [`info()`](onde::inference::ChatEngine::info). A UI needs to be told.
//!   Ed pushes transitions and replies to a [`StatusSink`] the host implements.
//! - **A flattened reply.** Inference returns `Result<InferenceResult, _>`;
//!   a frontend wants one shape covering both outcomes. That's [`ChatReply`].
//!
//! Ed deliberately does *not* own sessions, persistence, model catalogues, or
//! downloads. Those differ per application and belong to the host. For
//! persistence it defines the [`SessionStore`] seam the host implements.
//!
//! # Platforms
//!
//! Ed has no `cfg(target_os)` gates. `onde` already splits real and fallback
//! implementations internally, so this crate compiles on every platform `onde`
//! supports (macOS, iOS, tvOS, visionOS, watchOS, Windows, Linux, Android) and
//! simply surfaces `onde`'s error where it can't run inference. Outside that
//! list `onde` falls back to a stub whose signatures differ, so Ed does not
//! build there either.
//!
//! Do not add platform gates here, and be careful about adding them in a host:
//! a gate narrower than `onde`'s own support list silently disables chat on a
//! platform that would have worked.
//!
//! # Example
//!
//! ```no_run
//! use ed_agent::{Ed, GgufModelConfig};
//!
//! # async fn example() {
//! let ed = Ed::new();
//! let config = GgufModelConfig::qwen25_1_5b();
//! ed.load(config, None, None).await.expect("load");
//!
//! let reply = ed.send("Summarise this thread.").await;
//! println!("{}", reply.reply.unwrap_or_default());
//! # }
//! ```

#![forbid(unsafe_code)]

mod ed;
mod reply;
mod session;
mod sink;
mod stream;
mod tool;

pub use ed::Ed;
pub use reply::ChatReply;
pub use session::{SessionError, SessionMeta, SessionStore};
pub use sink::{EventSink, NoopSink, StatusSink};
pub use stream::TextStream;
pub use tool::{
    AgentConfig, AgentError, AgentReply, AgentToolDefinition, ApprovalDecision, ApprovalHandler,
    ApprovalRequest, DenyApprovals, RejectingExecutor, ToolCall, ToolExecutionResult, ToolExecutor,
    ToolRisk,
};

// Re-exported so a host depends on `ed-agent` alone and never has to match a
// second `onde` version against this crate's.
pub use onde::inference::types::{ChatMessage, ChatRole};
pub use onde::inference::{
    ChatEngine, EngineInfo, EngineStatus, GgufModelConfig, InferenceError, SamplingConfig,
    ToolCallingSupport, UqffModelConfig,
};