el-core — shared domain vocabulary
The foundational crate of the Edge Intelligence SDK: the ubiquitous language of the project turned into Rust types. Every other crate speaks in terms of the ids, value objects, errors, events, and the provider trait defined here.
el-core has zero external dependencies — pure std, so it compiles
offline on any target including wasm32 (ADR-008). It contains no I/O, no
network, and no unsafe (#![forbid(unsafe_code)]).
What it provides
| Module | Key types | Purpose |
|---|---|---|
ids |
SessionId, ModelId, ModelVersion |
Identifier value objects |
value_objects |
Token, ModelFormat, RuntimeKind, DeviceTarget, Phase, SafetyMode, SpeculationMode, StopReason |
Core enums and the Token = u32 alias |
config |
SessionConfig |
Immutable per-session configuration |
error |
EdgeError, Result<T> |
The SDK-wide error type |
events |
DomainEvent, EventEnvelope, DegradeReason |
Content-free domain events |
provider |
LlmProvider, ChatRequest, ChatResponse, ChatMessage, ChatRole, ChatToken, CredentialRef |
The unified backend abstraction |
All names are re-exported at the crate root, e.g. use el_core::{LlmProvider, ChatRequest};.
Cross-cutting invariants encoded here
These are enforced by the type system, not by convention:
- Content-free events (ADR-007).
DomainEventandEventEnvelopederiveCopy. AString/Vec/heap field is notCopy, so adding one fails to compile — "no prompt or response content on an event" is a compile-time guarantee. Ratios and scores are carried as fixed-point integers (*_milli). - Air-gap by default (ADR-004).
SessionConfig::default().hybrid_modeisfalse. The only network seam is an explicit opt-in. - Unified provider (ADR-010).
LlmProvidercovers both the local Candle engine and cloud frontier backends behind one trait, so host apps can swap local ↔ frontier without touching their UI. - Redacted credentials.
CredentialRef'sDebugoutput isCredentialRef([REDACTED]), so bearer keys cannot leak into logs or panic messages.
Usage
This is the crate-local part of a real local SDK call. In an app, the request
can be served by el_engine_candle::QwenChatProvider::from_paths(...) with
models/qwen2.5-0.5b-instruct-q4_k_m.gguf and
models/qwen2.5-0.5b-instruct.tokenizer.json; el-core only defines the
backend-agnostic contract.
use ;
// Configuration is air-gapped by default (ADR-004).
let cfg = default;
assert!;
// A backend-agnostic request. `model` is a routing hint:
// "local"/"" → local engine, "openai/…", "anthropic/…", "ollama/…", "gemini/…"
let req = new
.with_max_tokens
.with_temperature; // 700 = 0.7 (milli to keep the type Eq-able)
// Any backend is reached through the same trait.
Place in the workspace
el-core is the root of the dependency graph: el-memory, el-telemetry,
el-provenance, el-safety, el-runtime, and every adapter depend on it, and
it depends on nothing. Keep it dependency-free — that property is what lets the
local core cross-compile to WASM and mobile targets.
Status
Implemented and tested.
Part of the Edge Intelligence workspace. Realizes
ADR-004,
ADR-007,
ADR-008,
and ADR-010.
The vocabulary mirrors docs/ddd/ubiquitous-language.md.