Skip to main content

Module domain

Module domain 

Source
Expand description

§domain

Core domain types.

These types represent the pure domain model, independent of any infrastructure concerns (database, filesystem, etc.).

§Structure

  • agent - Agent loop types (AgentConfig, AgentMessage, AgentEvent, etc.)
  • model - Model types (Model, NewModel)
  • model_naming - Shared model-naming policy (resolve_model_name, NameSource)
  • mcp - MCP server types (McpServer, NewMcpServer, etc.)
  • chat - Chat conversation and message types
  • gguf - GGUF metadata and capability types
  • capabilities - Model capability detection and inference
  • thinking - Thinking/reasoning tag parsing and streaming accumulation
  • kv_memory - Shape of a model’s KV memory from GGUF metadata: whether it keeps only part of the token history (kv_memory_is_partial), and how many layers hold a per-token cache at all (kv_cache_layer_count)
  • kv_estimate - Per-token KV cache size, which takes that layer count from kv_memory rather than counting every block. The dependency runs one way only: kv_memory reads metadata and knows nothing of the estimate

Modules

Re-exports§

pub use benchmark::BenchmarkEvent;
pub use benchmark::BenchmarkModelResult;
pub use benchmark::BenchmarkRun;
pub use benchmark::BenchmarkRunStatus;
pub use benchmark::BenchmarkRunType;
pub use benchmark::CandidateSource;
pub use benchmark::CompareConfig;
pub use benchmark::GeneratedOutput;
pub use benchmark::ModelBenchmarkSummary;
pub use benchmark::ModelCompareResult;
pub use benchmark::ModelPerfResult;
pub use benchmark::PerfConfig;
pub use benchmark::ScoreWeights;
pub use benchmark::SweepSpec;
pub use benchmark::TaskCategory;
pub use benchmark::TaskSuite;
pub use benchmark::TuneCandidateResult;
pub use benchmark::TuneConfig;
pub use benchmark::TuneTask;
pub use benchmark::TuneTaskResult;
pub use capability_tags::is_reasoning;
pub use inference_profile::InferenceProfile;
pub use inference_profile::builtin_templates;
pub use recommendation::BUDGET_UTILISATION;
pub use recommendation::BudgetSource;
pub use recommendation::Recommendation;
pub use recommendation::recommend;
pub use slot_eviction::SlotFileMeta;
pub use slot_eviction::compute_auto_disk_budget_bytes;
pub use slot_eviction::select_evictions;
pub use mcp::McpEnvEntry;
pub use mcp::McpLifecycle;
pub use mcp::McpServer;
pub use mcp::McpServerConfig;
pub use mcp::McpServerStatus;
pub use mcp::McpServerType;
pub use mcp::McpTool;
pub use mcp::McpToolResult;
pub use mcp::NewMcpServer;
pub use mcp::ToolIndex;
pub use chat::Conversation;
pub use chat::ConversationUpdate;
pub use chat::Message;
pub use chat::MessageRole;
pub use chat::NewConversation;
pub use chat::NewMessage;
pub use gguf::CapabilityFlags;
pub use gguf::GgufCapabilities;
pub use gguf::GgufMetadata;
pub use gguf::GgufValue;
pub use gguf::RawMetadata;
pub use dialect::BodyCodec;
pub use dialect::DialectSpec;
pub use dialect::EmissionProfile;
pub use agent::AGENT_EVENT_CHANNEL_CAPACITY;
pub use agent::AgentConfig;
pub use agent::AgentEvent;
pub use agent::AgentMessage;
pub use agent::AssistantContent;
pub use agent::DEFAULT_MAX_ITERATIONS;
pub use agent::DEFAULT_MAX_STAGNATION_STEPS;
pub use agent::LlmStreamEvent;
pub use agent::LoopDetector;
pub use agent::MAX_ITERATIONS_CEILING;
pub use agent::MAX_PARALLEL_TOOLS_CEILING;
pub use agent::MAX_TOOL_TIMEOUT_MS_CEILING;
pub use agent::StagnationDetector;
pub use agent::ToolCall;
pub use agent::ToolDefinition;
pub use agent::ToolResult;
pub use capabilities::capabilities_from_architecture;
pub use capabilities::infer_from_chat_template;
pub use capabilities::ChatMessage;
pub use capabilities::MessageContent;
pub use capabilities::ModelCapabilities;
pub use capabilities::transform_messages_for_capabilities;

Modules§

admission 🔒
What the admission queue and the VRAM resident set look like right now.
agent
agent
benchmark
benchmark
cache_budget 🔒
Auto-sizing math for llama-server’s host-RAM prompt cache (--cache-ram).
capabilities
Model capability detection, inference, and request transformation.
capability_tags
The capability tags gglib stores on a model, and the predicates that read them.
chat
Chat domain types.
context_fit 🔒
How large a context this machine can actually serve.
defect_counts
The per-model defect counts — the data half of super::defects.
defects
Per-model defect counters — the Tier C signals the closed loop steers by.
dialect
Tool-call dialect specification.
generation_config 🔒
The sampling recipe a model author publishes in generation_config.json.
gguf
GGUF domain types.
inference 🔒
Inference configuration types.
inference_profile
Named, cross-model sampling profiles.
kv_estimate 🔒
KV-cache size estimation from GGUF metadata.
kv_memory 🔒
The shape of a model’s KV memory, read from GGUF metadata: whether it retains the full token history, and how many layers hold a cache at all.
launch_narration 🔒
What the runtime decided for one llama-server launch, and why.
loop_guard_log
The loop guard’s log, which outlives the process.
mcp
mcp
model 🔒
Model domain types.
model_naming 🔒
Shared model-naming policy.
model_sampling 🔒
The sampler defaults a model carries in its own GGUF metadata.
query 🔒
Model list query, filter, and sort types.
reasoning_effort 🔒
The reasoning_effort level — how hard the model is asked to think.
recommendation
Picking a first model that actually fits the machine it will run on.
residency 🔒
Whether a second model may stay resident in VRAM alongside the first.
runtime_capabilities 🔒
What the engine underneath gglib can do — the mirror of GgufCapabilities.
sampling_discards 🔒
Which parameters a caller named and the ladder then passed over.
sampling_provenance 🔒
Which layer supplied each resolved sampling parameter.
server_config 🔒
Server-level default configuration for models.
slot_eviction
Byte-budget selection for on-disk KV slot cache eviction.
template_caps 🔒
llama-server’s per-template capability self-report, and the tri-state gglib holds it in.

Structs§

AdmissionSnapshot
Everything the admission queue and resident set look like right now.
FieldSources
Per-field provenance for one resolved InferenceConfig.
FitInputs
What fit_context worked from, for a person reading a launch log.
InferenceConfig
Inference parameters for LLM sampling.
KvElemsPerToken
Per-token K and V element counts, type-agnostic.
LaunchDecision
One resolved launch decision, paired with the reason it was chosen.
LaunchNarration
Everything the runtime decided for one llama-server launch.
Model
A model that exists in the system with a database ID.
ModelFile
Represents a single file (shard) belonging to a model.
ModelFilterOptions
Filter options for the model library UI.
ModelListQuery
Complete filter + sort specification for the model list.
ModelSamplingContext
Everything about the target model that changes how sampling resolves, independent of any specific request.
ModelSamplingDefaults
The sampler defaults one model declares.
NewModel
A model to be inserted into the system (no ID yet).
NewModelFile
A model file entry to be inserted into the system (no ID yet).
QueuedModelSnapshot
Requests waiting for one model that is not currently resident.
RangeValues
A range of numeric values with min and max.
ResidentSlotSnapshot
One model resident in VRAM.
RuntimeCapabilities
What the llama-server binary underneath gglib is, and what it can do.
RuntimeFlags
Capabilities of the llama-server binary gglib is running against.
SecondarySlotStatus
Why the second VRAM slot is or is not in use.
ServerConfig
Server-level defaults for a specific model.
SlotFootprint
What one resident model is expected to occupy in VRAM.
TemplateCaps
The nine bools of chat_template_caps, as GET /props reports them.

Enums§

CacheRamHealth
How healthy a resolved --cache-ram budget is, for user-facing display.
DefaultsOrigin
Whether a model’s stored inference_defaults were set by the user or written automatically at import time.
FieldIssue
What reading one client-supplied sampling field did, when it was not simply “read it”.
ModelSamplingDefault
What one model’s GGUF says about one sampler field.
ModelSortBy
The field to sort the model list by.
NameSource
Which naming signals are available for a model being added.
ParamSource
Which rung of a sampling ladder supplied one resolved parameter.
ReasoningEffort
A reasoning-effort level gglib is willing to put on the wire.
SamplingLayer
The five rungs of the ladder resolve_with_profile builds, in priority order.
SamplingOverride
What gglib is doing with one field’s published recommendation.
SecondarySlotDecision
Whether a candidate may take the second resident slot, and why not when it may not.
SortOrder
Direction for sorting.
Support
One capability’s answer, with unknown kept distinct from no.
TemplateCapsState
What gglib currently holds about a model’s template caps.

Constants§

CACHE_RAM_UNKNOWN_KV_ALLOWANCE_BYTES
KV allowance assumed when the model’s metadata doesn’t permit an estimate. Deliberately generous: over-reserving shrinks the cache (safe), whereas under-reserving risks memory pressure.
MODEL_SAMPLING_KEYS
gglib’s wire name for a sampler field, paired with the GGUF key that can move it.
RESIDENCY_UTILISATION
Fraction of free VRAM a co-resident candidate is allowed to claim.

Functions§

apply_query
Apply a ModelListQuery to a model list, returning a filtered and sorted copy.
classify_cache_ram
Classify a resolved --cache-ram budget.
compute_auto_cache_ram_mb
Compute the auto --cache-ram budget, in MiB.
decide_secondary_slot
Decide whether candidate may stay resident alongside what is already loaded.
declared_name
The general.name declared in the GGUF header, or None if absent or blank.
discarded_from_rung
The parameters named set that did not survive to the resolution.
estimate_kv_bytes_for_context
Estimate total KV cache bytes for a given context size.
estimate_kv_elems_per_token
Estimate K and V element counts consumed per token of context.
fit_context
The largest context weights_bytes can serve inside budget_bytes.
fit_context_explained
The same calculation, reporting what it worked from.
format_gib
Format a byte count as GiB with one decimal, e.g. 17.2 GiB.
format_mib_as_gib
Format a MiB count as GiB with one decimal, for the RAM cache budget.
generation_config_candidates
Where to look for a generation_config.json, best candidate first.
is_system_tag
Returns true when tag is a system tag that callers must not remove through the standard tag-mutation API.
kv_bytes_per_token
Convert per-token K/V element counts to bytes at the given cache types.
kv_cache_layer_count
How many of the model’s layers hold a per-token KV cache.
kv_memory_is_partial
Whether the model’s KV memory retains only part of the token history (sliding-window, hybrid, or recurrent attention).
parse_generation_config
Read a model author’s generation_config.json.
reasoning_effort_support
Whether a model’s template reads reasoning_effort, from its recorded caps.
repo_short_name
Strip a HuggingFace repo id down to its final path segment.
resolve_model_name
Resolve the models.name for a model being added.
strip_gguf_suffix
Strip a trailing -GGUF marker, case-insensitively.