openkind_engine/lib.rs
1//! `openkind-engine`: Runtime-agnostic decision engine abstractions and dispatch.
2//!
3//! # Architecture & Responsibilities
4//! `openkind-engine` defines the central execution abstractions for Jev-compatible decision inference.
5//! Per `docs/ARCHITECTURE.md`, the engine layer sits between `openkind-core` and the transport
6//! layers (`openkind-api`):
7//!
8//! `core` ⇐ `engine` ⇐ `api` ⇐ `server/cli`.
9//!
10//! The engine abstraction is completely transport-agnostic: it accepts a [`SystemRequest`] and returns
11//! a [`SystemResponse`], remaining oblivious to whether evaluation was triggered over HTTP/REST or gRPC.
12//!
13//! # Core Components
14//! - [`DecisionEngine`]: Trait implemented by inference backends (e.g. [`MockEngine`], Candle, GGUF/llama.cpp, ONNX).
15//! - [`EngineRegistry`]: Thread-safe mapping of public model aliases (e.g. `"jev-latest"`, `"mock"`) to engine instances.
16//! - [`dispatch`]: Unified entrypoint that orchestrates validation, metrics recording, token estimation, and backend evaluation.
17
18#![warn(missing_docs)]
19
20/// Decision request dispatching, validation, and token accounting.
21pub mod dispatch;
22/// DecisionEngine trait and token estimation helpers.
23pub mod engine;
24/// Engine-specific error types and result aliases.
25pub mod error;
26/// In-memory mock decision engine implementation for testing.
27pub mod mock;
28/// Model execution profile contracts and parity specifications.
29pub mod profile;
30/// Thread-safe registry mapping model aliases to decision engines.
31pub mod registry;
32
33#[cfg(test)]
34mod tests;
35
36pub use dispatch::dispatch;
37pub use engine::DecisionEngine;
38pub use error::{EngineError, EngineResult};
39pub use mock::MockEngine;
40pub use profile::{
41 ArtifactIdentity, ExecutionSemantics, ModelExecutionProfile, ParityContract, ProbabilitySpace,
42 ProfileSource, ProfileValidationError,
43};
44pub use registry::EngineRegistry;