Expand description
What the engine underneath gglib can do — the mirror of
GgufCapabilities.
gglib has always had rich detection for what a model can do: GGUF metadata drives capability flags, which drive launch flags and request shaping. It has had none for what llama-server can do. The version was read at install time, printed to the console, and discarded.
That gap is why compensation accumulates. Every behaviour gglib applies to work around a llama.cpp limitation — dialect normalization, grammar origination, reasoning-tag stripping — is hardcoded as unconditionally on, because there has never been a way to ask is this still needed?. Upstream ships the fix, gglib keeps compensating, and nobody finds out.
RuntimeCapabilities closes that loop: probe the binary once, record what
it is, and let a capability be a question with an answer rather than an
assumption baked into a call site.
§Unknown means gglib compensates
A version string this module cannot parse yields
RuntimeCapabilities::unknown — no build number, no flags — and every
compensation stays on. This is the same discipline
ModelContext::catalog_resolved applies to models: an empty capability
set means nobody knows, not the feature is absent, and the safe
response to not knowing is to keep doing the work ourselves. Deferring to
native behaviour on a runtime we failed to identify would trade a known
cost for an unknown risk.
§Resolved once, held for the run
A probe result is taken when a server is launched and held for that process’s lifetime. Nothing re-probes mid-request, and nothing switches strategy mid-stream: a request that starts under one set of capabilities finishes under the same set.
This is deliberate. Hot-swapping parsing or constraint strategy partway through a response — on the evidence of a residue hit, say — would make failures depend on when within a stream the evidence arrived, which is precisely the class of bug that cannot be reproduced from a recording. The observation layer’s job is to log divergence between what a runtime claimed and what it delivered. Acting on that log is a deliberate change to a threshold in this module, made between runs with the evidence in hand — not an automatic reaction inside one.
§Adding a capability
- Add a
const MIN_BUILD_*with a doc comment citing the upstream release, PR, or issue that establishes the build. - Add the matching
RuntimeFlagsbit. - Set it in
RuntimeCapabilities::from_build. - Add a test pinning both sides of the threshold.
Note what step 4 buys: the threshold is the claim, and the test is what stops it drifting into folklore.
Structs§
- Runtime
Capabilities - What the llama-server binary underneath gglib is, and what it can do.
- Runtime
Flags - Capabilities of the llama-server binary gglib is running against.
Constants§
- MIN_
BUILD_ 🔒PEG_ NATIVE_ TOOL_ CALLS - First llama.cpp build whose PEG-native chat parser handles delimited
(“constructed”) tool-call dialects — the XML-style envelopes gglib’s own
DelimitedToolCallParserwas written for — natively. - MIN_
PLAUSIBLE_ 🔒BUILD - Smallest build number treated as a real llama.cpp release.
Functions§
- leading_
number 🔒 - The leading run of ASCII digits in
s, parsed. - parse_
build_ 🔒number - Extract the llama.cpp build number from a
--versionbanner. - parse_
commit 🔒 - Extract the commit sha from a
--versionbanner. - version_
line 🔒 - The most informative single line of a version banner.