New crate crates/gateway-domain, the first member of layer L2 in architecture.json (L2 is now a pure layer: tokio, axum, reqwest, libc and the other adapter crates are forbidden dependencies there). It depends on serde, serde_json, leleka-sampler-ref and leleka-tokenizer only. Moved out of control-plane/src with git mv, content unchanged apart from paths: sampling (request sampling extensions, validation) and EngineTune (was in wire.rs), reasoning_budget (the budget driver and its tests), codec (Family, TextCodec, TokenDecoder, QwenCodec), json_order, and the Chat Completions translation (chat_completions: Request -> Responses request, reply fields; the axum handlers stay in chat.rs). strata-control re-exports codec, json_order, reasoning_budget and sampling under their old paths, and wire.rs re-exports EngineTune, so no caller and no test outside the moved modules changed. 4 new tests cover the chat translation. Architecture gate: layer entry added; dyn-trait:leleka-gateway-domain = 5 appears because the five dyn in the moved code (Box<dyn TokenDecoder>, Box<dyn Iterator> in the budget driver, &dyn Fn, ...) change crate; dyn-trait:strata-control fell 21 -> 16 in the same step, so the total is unchanged (--allow-increase was needed for the new per-crate key only). Test outcomes: 597 ok / 2 ignored before, 615 ok / 2 ignored after (18 new tests); the 13 moved tests keep their ids in the new crate and their outcome.
115 lines
3.0 KiB
Rust
115 lines
3.0 KiB
Rust
/// Write one diagnostic line to stderr and ignore any failure. The line goes through `leleka-obs`: a structured event
|
|
/// (JSON when stderr is a file, key=value on a terminal) with the secret scrub applied and a per-call-site rate limit,
|
|
/// so a loop that fails every few milliseconds cannot fill the disk. `LELEKA_LOG_LEGACY=1` restores the bare lines.
|
|
///
|
|
/// `eprintln!` panics when stderr cannot be written (a log consumer that went away gives `EPIPE`, a full disk
|
|
/// `ENOSPC`). On the serving path that would kill the worker supervisor or a response task in the middle of a
|
|
/// request, so every diagnostic in this crate goes through here: charter Gate A requires a terminal event on
|
|
/// every stream no matter what happens to the logs. A consumer that is merely slow can still block the write;
|
|
/// that is bounded by the log sink, not by this macro.
|
|
#[macro_export]
|
|
macro_rules! elog {
|
|
($($arg:tt)*) => {{
|
|
::leleka_obs::obs_msg!(::leleka_obs::Level::Info, "api", $($arg)*);
|
|
}};
|
|
}
|
|
|
|
/// [`elog!`] at warning level: something failed or degraded.
|
|
#[macro_export]
|
|
macro_rules! wlog {
|
|
($($arg:tt)*) => {{
|
|
::leleka_obs::obs_msg!(::leleka_obs::Level::Warn, "api", $($arg)*);
|
|
}};
|
|
}
|
|
|
|
/// The boxed error the command-line and offline-tool functions return.
|
|
pub type BoxError = Box<dyn std::error::Error>;
|
|
|
|
pub use leleka_gateway_domain::{codec, json_order, reasoning_budget, sampling};
|
|
|
|
pub mod adapters;
|
|
pub mod app;
|
|
pub mod asset_bundle;
|
|
pub mod auth;
|
|
pub mod backend_worker;
|
|
pub mod config;
|
|
pub mod derived_iq3;
|
|
pub mod derived_mixed;
|
|
pub mod doctor;
|
|
pub mod embedded_engine;
|
|
#[cfg(test)]
|
|
mod embedded_spec;
|
|
pub mod engine_probe;
|
|
pub mod ggml_bridge;
|
|
pub use leleka_model_format::gguf;
|
|
pub mod gguf_f32_stream;
|
|
pub mod gguf_json;
|
|
pub mod harmony_family;
|
|
mod history_store;
|
|
mod immutable_directory;
|
|
pub use leleka_quant_core::iq3_s;
|
|
pub mod hardware_view;
|
|
pub mod kar;
|
|
pub mod kar_codec;
|
|
pub mod kar_fixture;
|
|
pub mod kar_memory;
|
|
pub mod kar_overlay;
|
|
pub mod kar_quality;
|
|
pub mod kar_sample;
|
|
pub mod kar_stream_encode;
|
|
pub mod kar_writer;
|
|
pub mod key_init;
|
|
pub mod lifecycle;
|
|
pub mod memory_view;
|
|
pub mod metrics;
|
|
pub mod model;
|
|
pub mod model_pipeline;
|
|
pub mod models_api;
|
|
pub mod mtp_fetch;
|
|
pub mod mtp_pack;
|
|
pub mod native_model;
|
|
pub mod native_pack;
|
|
pub mod pool;
|
|
pub mod ports;
|
|
pub mod prefix_view;
|
|
pub mod preflight;
|
|
pub mod prepare_preview;
|
|
pub mod prometheus;
|
|
pub use leleka_gateway_text::prompt;
|
|
pub mod request_monitor;
|
|
use leleka_gateway_text::response_tools;
|
|
pub mod responses;
|
|
pub mod runtime_config;
|
|
pub mod service_install;
|
|
pub mod service_unit;
|
|
pub mod stream_parts;
|
|
pub mod tensor_export;
|
|
pub use leleka_tokenizer as tokenizer;
|
|
pub mod tokenizer_assets;
|
|
pub use leleka_gateway_text::tool_output;
|
|
pub mod wire;
|
|
pub mod worker;
|
|
|
|
pub mod wait_ready;
|
|
|
|
pub mod chat;
|
|
|
|
pub mod messages;
|
|
mod native_events;
|
|
|
|
pub mod cuda_memory;
|
|
|
|
pub mod service_switch;
|
|
|
|
pub mod queue;
|
|
pub mod request_log;
|
|
|
|
pub mod server_api;
|
|
|
|
pub mod stage_trace;
|
|
|
|
pub mod settings;
|
|
|
|
pub mod mcp;
|
|
pub mod vision;
|