1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! 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. On
//! `wasm32-unknown-unknown` it builds against `onde`'s web target. Other
//! targets outside that list get a stub engine with the same signatures,
//! whose calls all return an "unsupported" error.
//!
//! 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());
//! # }
//! ```
pub use Ed;
pub use ChatReply;
pub use ;
pub use ;
pub use TextStream;
pub use ;
// 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 ;
pub use ;