fllamer 0.4.0
fllamer: ^0.4.0 copied to clipboard
Mobile-first local llama.cpp inference, embeddings, RAG, multimodal, LoRA, and speculative decoding for Dart and Flutter.
0.4.0 #
- ABI 46 adds
LlamaEngine.keepConversation()andforgetConversation()(llama_dart_context_keep_conversation,llama_dart_context_forget_conversation). Before another prompt replaces the context,keepConversation()returns it to its kept prompt boundary and copies the sequence state there in the native session. A later chat with prefix reuse whose prompt starts with those tokens puts it back and reads only the rest, even when the prompt in between was itself read with prefix reuse; the copy is then freed. Nothing passes through Dart, so one copy is held (sizes in Architecture). Prefix reuse now continues from whichever of the committed history, the prompt boundary and a kept conversation covers the most of the prompt. Custom bridges need a rebuild for ABI 46. - A planned chat read with
reusePromptPrefixkeeps the point where the turn of its last message began, and a later prompt that repeats the tokens before it continues from there instead of reading everything again. The next turn of a conversation was never an exact continuation of what was read: a template renders a past reply differently from the tokens generated after the generation prompt (Qwen3.5 drops the empty thinking block), and an app may keep other text for the reply, or for a message it sent with notes for that turn only. The tokens read are those of a full read. For memory that cannot drop the end of a sequence the bridge copies the part that cannot (LLAMA_STATE_SEQ_FLAGS_PARTIAL_ONLY): 52.7 MB of recurrent state for Qwen3.5 4B at any prompt length, 8 bytes for the attention-only Qwen2.5 0.5B; a sliding-window cache that is not full size copies its window. The copy stays allocated until the next planned chat read with reuse replaces it, a LoRA change or context shift clears it, or the context closes. It survivesreset()and a whole-contextrestoreState(), so a snapshot taken before a prompt read without reuse brings it back. No Dart API or ABI change. - Synchronized
third_party/llama.cpptob1b770d90d94cad9e9ea5b993bdbc383a522fb28(upstream releasev1.0.0, build number 12359), 249 commits afterv0.9.0. No Dart API change and no ABI change (ABI 45): upstream removed its deprecated public API, none of which the bridge called, so the bridge source is unchanged and custom ABI 45 bridges only need a rebuild against the new pin. Saved state keeps upstream's session format version 11. The Android Vulkan build-output overlay is version 7: every transform is kept, the shader transforms are byte-identical, and the Qualcomm predicate inggml-vulkan.cppis inserted after upstream's newggml_vk_amd_large_tile_supported. Version 7 cross-compiles for arm64-v8a and x86_64 and has not run on a device. Behavior changes from upstream:- Gemma 4 tool calls follow each tool's
parametersSchemaduring generation and parsing. Keys must be declared ones, in the template's order (sorted by name, ignoring case), with the required ones present. Another key is accepted only when the schema setsadditionalProperties; a schema that listspropertiesand leavesadditionalPropertiesout allows none. A property declared as an array or an object must be one, and an object's own keys follow the same rules. Example: for propertieszulu,alphaandtags(an array),{alpha: …, tags: […], zulu: …}is a call, and{zulu: …, alpha: …},{alpha: …, extra: 1}and{tags: 5}are not. Such a call can no longer be generated, and output that holds one fails withGenerationException("failed to parse chat output…") from upstream's parser. Before, any such call was parsed and fllamer's schema validation decided. That validation accepts keys in any order and, under a schema withoutadditionalProperties, an extra key, so those two kinds of call used to reach the application. The type of a string, number, boolean or null value is still checked only by fllamer after parsing. - Upstream dropped its tool-response rewrite for Gemma 4 GGUFs that embed a chat template older than the official one. Tool results in such a chat were not checked on this pin.
- The JSON Schema grammar for
allOfof plain types is no longer an empty-object grammar. - Tool-call arguments keep valid JSON when a model writes a raw control character inside a quoted string (it is escaped), and invalid UTF-8 in a tool call becomes U+FFFD.
shiftContext()moves the kept positions with each model's own RoPE parameters, which changes its result for models that override them, LFM2 among them.- A model's greedy output can differ from the previous pin. On CPU with a
v0.9.0bridge and this one, Qwen3.5 2B Q6_K answered identically and LFM2.5 1.2B Q6_K worded its answers differently from identical prompts. Upstream changed CPU and Metal kernels and accumulation precision in between (for example #32128, #29810, #31854, #31851 and #30982); which change moves that model's output was not determined.
- Gemma 4 tool calls follow each tool's
0.3.0 #
-
0.2.3 and 0.2.4 were not published to pub.dev; this release includes their entries below as well as these.
-
A planned chat no longer turns message text into control tokens. Before, a chat prompt was tokenized as one string with special-token parsing, so a message containing the text of a control token, for example
<|im_end|>followed by<|im_start|>systemin a user message or an imported character card, was evaluated as those tokens: it ended its turn and opened a system turn. A chat plan now records which bytes of its prompt came from the request (message content, tool calls, tool results and tool definitions), using theis_inputmarks of pinned upstream's Jinja engine. Generation, exact prefix reuse andcountChatTokenstokenize a part of the request that spells a control or unknown token of the vocabulary on its own, with special-token parsing off, and everything else as before. The markers the template writes are still single tokens, including a role marker a template builds fromsystem,user,assistantortool. Behavior change: for a chat with such a message, the model now sees the marker as the characters the message wrote, on every turn while the message is in the history, andcountChatTokensand the prompt token telemetry count them. A chat whose messages spell no control token is tokenized exactly as before. A token the vocabulary lists as user-defined rather than control (in some models<think>or<tool_call>) is still one token in message text, because pinnedllama_tokenizereads those from any text. Not covered: a chat that sets no tools, thinking mode, reasoning budget orseparateReasoningon a template the legacy formatter knows is rendered byllama_chat_apply_template, which returns one string; its message text is still parsed for special tokens. SetseparateReasoning(or a thinking mode) to plan such a chat. AformatChatresult is one string too, so tokenizing or evaluating it withparseSpecialparses all of it. ABI 45: the chat plan is version 3 and addsmessage_text_spans, and the newllama_dart_model_tokenize_chat_plantokenizes a plan's prompt as its completion evaluates it. The plan grows by that list, two numbers for each stretch of request text, and a plan's size counts towardmaximumPromptBytes. Custom ABI 44 bridges require a rebuild. No Dart API change. -
Synchronized
third_party/llama.cpptocd959bae99ff4bed22bef2604f45241c09bbb8c8(upstream releasev0.9.0, build number 12110), 739 commits afterb11371. No Dart API change. Upstream reworked its chat API and removed the serialization of its output parser, so a chat plan can no longer carry the parser. ABI 44:llama_dart_model_create_chat_plangainsout_parserand returns the chat stream parser of the plan's output from the same template application,llama_dart_chat_stream_parser_parse_messagereads the terminal assistant message with it, andllama_dart_chat_parse_outputandllama_dart_chat_stream_parser_createare removed. Custom ABI 43 bridges require a rebuild. Behavior changes from upstream: the reasoning of a chat no longer ends with the whitespace that preceded its end marker, and state saved by an earlier pin no longer restores, because upstream's session format is now version 11. The Android Vulkan build-output overlay is version 6: the Q4_K forced-dequantization replacement follows upstream's rewritten kernel selection, and the port of upstream47f5a64ae1(#29766) is dropped because the pin includes it. Version 6 cross-compiles for arm64-v8a and x86_64 and has not run on a device. -
Chat streams are parsed while they are generated. A chat that asks its template for tools, a thinking mode (
enableThinkingtrue or false) or a reasoning budget, or that sets the newGenerationConfig.separateReasoning, now streams the response text alone inGenerationChunk.text, the reasoning in the newGenerationChunk.reasoningText, and marks a chunk that added to a tool call with the newGenerationChunk.writesToolCall. The pinned upstream chat parser does the separation, so it follows whatever markers the template uses. Before,textwas the raw output for every chat: a template whose generation prompt always opens its reasoning block made every thinking-off response begin with a bare end marker such as</think>, and thinking-on responses carried the whole block. Behavior change: an application that removed reasoning or tool-call markup fromtextitself no longer receives it there. A chat that asks none of these, and raw completion, still stream the output as generated. The terminalassistantMessageof a tool chat is read the same way as its stream, so for a tool chat that sets no thinking mode its text no longer contains the reasoning block; before, the block and its markers were part of that text. An end of the output that could still become one of the template's markers, such as a lone<, is held back fromtextandreasoningTextwhile the response streams and delivered when the response ends, as response text or as reasoning, in the stream and in the terminal message. It is not delivered when the response ends inside a tool call, or when the template's parser rejects the output (text that does not follow the template's format, a malformed tool call); rejected output ends as it was read while it streamed. With thinking off, a block that a model writes at the start of its output although the generation prompt already holds an empty one is read as reasoning. One case still reachestext: the parsers of most templates expect one reasoning block, so a model that goes on reasoning after a reasoning budget closed its block, or that opens another block later in its output, has that text and its markers delivered as response text. Migration: remove any filter that strips reasoning or tool-call markup fromGenerationChunk.texton such chats; read reasoning fromreasoningTextif it is wanted.LlamaChatTemplateCapabilitieshas a new required field,marksReasoning; code that constructs it must pass it.separateReasoningasks for the separation without choosing a thinking mode: the chat is rendered through the model's own template, where llama.cpp suppliesenable_thinkingastrue, and a template the planner cannot render falls back to the legacy formatter with the output streamed as generated.LlamaEngine.formatChatandcountChatTokenstake the same flag.LlamaChatTemplateCapabilities.marksReasoningreports whether the template itself marks its reasoning: upstream names a start and an end marker for it, and the start marker occurs in the template's source or in the generation prompt it renders.reasoningBudgetTokensworks with such a template. ABI 43 addsllama_dart_chat_stream_parser_create,_parseand_free, the chat request fieldseparate_reasoning, andllama_dart_chat_template_capabilities.marks_reasoning. -
Fixed a crash on the second on-device model load in one process after a first load whose Vulkan device creation threw. The pinned
ggml_vk_get_deviceregistered the device before building it, so when creation failed (the Android emulator's device failscreateDevicewithErrorExtensionNotPresent, llama.cpp reports the load as failed and the application retries on CPU) a device with a zeroed buffer type stayed registered, and the next load called through its null function pointers (SIGSEGV inllama_model_loader::create_tensor). The Android Vulkan build-output overlay, now version 5, ports upstream47f5a64ae1(#29766): first creation is serialized and the device is published only when fully built. No ABI or Dart API change. -
Fixed a wait that could never end: cancelling a generation stream while
close()was in flight could send its dispose request to a worker that had already exited. A reply still pending when the worker closes now ends withResourceDisposedException. -
Synchronized
third_party/llama.cppto99b95488cac0f00ce3f05af113a8c1e287753f87(upstream buildb11371). No ABI or Dart API change. The bridge follows four upstream API changes: the repeat-penalty sampler takes the vocabulary size, the media helpers take init options, llama-common takes its own JSON type, and speculative decoding takes llama-common's batch type. State saved by an earlier pin no longer restores, because upstream's session format changed. The Android Vulkan overlay was ported to upstream's reorganized Vulkan backend and is now version 4; it cross-compiles for arm64-v8a and x86_64 but has not been run on a device, so the Adreno 750 result recorded for the previous pin does not carry over. The package now ships upstream's vendored hash and subprocess sources, which the pinned build links, and registers the rotate-bits, SHA-256 and xxHash notices. -
Use
code_assets2 andhooks2.2 for compatibility with applications using the current native build-hook toolchain. -
Added optional
maximumPromptBytesto loaded-enginechat,formatChatandcountChatTokens. It bounds raw UTF-8 staging, encoded chat-plan requests and returned formatted buffers before downstream copies, with a typedPromptBufferExceptionpreserved across worker errors. Upstream template rendering and its initial native return allocation precede the output check. Existing callers that omit the policy retain their behavior; no ABI change. Loaded-engine formatting/counting also acceptreasoningBudgetTokensso preflight includes the generation plan's bounded reasoning metadata. -
Added content-free
GenerationChunk.generatedTokensprogress events after completed native steps, independently of streamed text coalescing. Progress preserves one outstanding worker batch and does not act as a timer heartbeat. Consumers that count text chunks can filter ongeneratedTokens == null. -
Added nullable
LlamaModelInfo.maximumTokenPieceBytes. Native model loading computes and caches the exact largest decoded vocabulary piece, including special-token rendering, for callers that derive output resource bounds. Native ABI is now 42: rebuild custom bridges and regenerate both bindings; ABI 41 binaries are rejected before the expanded model-info struct is used. -
Added optional
enableThinkingto static and loaded-model chat formatting and counting. Counts now use the same explicit native chat-plan mode as generation, so callers need no guessed reasoning-prefix token margin. -
Replaced the duplicate pure-Dart JSON Schema-to-GBNF implementation with a thin compatibility helper over llama.cpp's pinned native converter.
-
Enforced explicit
enableThinking: falsefor chat templates that expose paired reasoning markers by installing the existing native reasoning sampler with a zero budget. If a model still emits a reasoning start, the sampler forces its closing sequence immediately and preserves subsequent public output. Markerless templates and finite thinking budgets are unchanged. -
Key native CMake build directories by normalized source URI so hosted, path, and version switches cannot reuse a cache configured for another source root.
-
Added an opt-in Android Vulkan native-assets variant. It uses the Android NDK for the target loader, SPIR-V headers, and host
glslc, while taking the Vulkan header set from a bundled exact Vulkan-Headers 1.4.357.0 pin. An optionalvulkan_sdkvalue can override only those headers, so consuming apps need no machine-specific SDK path. The CPU backend remains available and Android remains CPU-only by default. The build hook creates a fail-closed, pinned-source overlay in build output without modifying the llama.cpp submodule: five validated Q4_0, Q4_1, and Q8_0 payload-load paths plus a Qualcomm-proprietary-only K-quant policy. That policy uses a restricted Q4_K Vulkan route and makes Q5_K/Q6_K matrix operations fall back to the retained CPU backend. The final-source Adreno 750 Debug-harness gate matched a bounded CPU oracle and passed cancellation, reset/recovery, and repeat disposal. Both safe-overlay markers are exposed in runtime metadata. Switching the same native-assets cache back to Android's default CPU build explicitly clears the header-root, shader-overlay, andglslcCMake cache entries. The strict intermediate backend-result checker still exceeds its relative-error threshold, so this is experimental, device-specific correctness evidence only—not a speed, all-operation-offload, or Android Vulkan qualification claim.
0.2.4 #
- Added
LlamaEmbeddingEngine, a worker-owned persistent embedding context that reuses one loaded model for tokenization, metadata inspection, and repeated single or batch embeddings. The existing static embedding helpers remain available for one-shot work. - Enabled strict-by-default Vulkan native-assets builds on Linux and Windows, with an explicit CPU-only boolean override and optional local Vulkan SDK root. Windows now consumes the native-assets Visual Studio environment and exact compiler/linker/archiver through Ninja; unsupported and cross-architecture desktop builds fail with actionable errors. Vulkan builds require CMake 3.19 or newer.
- Fixed multimodal prompt preprocessing after upstream added an explicit
text_lenfield tomtmd_input_text. The bridge now passes the complete rendered prompt instead of accidentally exposing only its first byte. - Added an optional request-level
GenerationConfig.enableThinkingswitch for chat generation. Explicit values use the pinned Jinja chat-plan path and forward llama.cpp's typedenable_thinkinginput without reloading the model or creating a second context;nullpreserves the 0.2.3 formatter behavior. Raw completion and continuation reject explicit values. Thinking-enabled chat also rejects app-supplied raw grammar, JSON mode, and JSON schema so the constraint cannot consume hidden reasoning; planner-owned tool grammar stays supported, and typed terminal parsing keeps reasoning separate from the normalized assistant value. - Added
GenerationConfig.reasoningBudgetTokensfor chat requests withenableThinking: trueor llama.cpp's default-on thinking input when the flag isnull. ExplicitenableThinking: falseremains incompatible with a budget. The bridge derives bounded multi-token reasoning markers from each model's chat template, initializes llama.cpp's reasoning state from tokenized generation prefill, and leavesmaxTokensas the separate total output cap. Lazy planner grammar is suspended only while reasoning is active, including with an unlimited budget. Every upstream end-tag alternative is preserved, and a matched closing sequence is replayed into lazy grammar so a tool-call trigger can activate directly after reasoning. Model-free sampler tests cover forced and natural multi-token closure, alternate ends, prefill, reset, clone, reasoning-state grammar routing, and prompt-history isolation. A Gemma 4 template/tokenization fixture verifies that plan extraction is not Qwen-specific. - Adapted model loading to upstream's
llama_load_modeenum while preserving all four public mmap/mlock combinations. Integrated MTP tensors are requested only forMtpSpeculationwithout a sidecar; ordinary and separate-sidecar loads retain upstream's reduced memory use. Manual bridge sampling now also enforces model-providedtokenizer.ggml.suppress_tokens. Context inspection reports Flash Attention as enabled when upstream promotesautofor a quantized V cache. - Bumped the bridge ABI to 40 for the plural reasoning-end plan and explicit integrated-MTP load intent. Both committed FFI binding variants were regenerated.
- Replaced the curated
llama.cppsnapshot with an official submodule pinned to upstream buildb10217. Published packages still include the checked-out source required for offline native builds. - Dropped the package-local Metal capability and Gemma 4 generation-grammar patches so the submodule remains identical to upstream. Parsed tool calls continue to be validated against their declared schema before exposure.
0.2.3 #
- Forced automatic GPU selection to an explicit CPU device with zero offloaded layers on Apple Simulator targets. Explicit Metal requests remain unchanged for diagnostics, while context, KV, speculative, and multimodal projector setup now inherit the resolved CPU backend.
0.2.2 #
- Derived Gemma 4 tool-argument grammar from each declared parameter schema instead of accepting arbitrary dictionary keys and value types. Terminal tool calls are also validated against their matching schema before exposure, so missing, extra, mistyped, or otherwise invalid arguments fail with a typed generation error.
- Added
GenerationStopReasonto terminal chunks and generation telemetry, distinguishing end-of-generation, stop sequences, stop tokens, and maximum token exhaustion. Truncated chat/tool output now reports the token limit explicitly instead of only surfacing the downstream PEG parse failure. - Bumped the bridge ABI to 38 for native stop-reason telemetry and regenerated both committed FFI binding variants. Custom native bridges must be rebuilt.
0.2.1 #
- Added a legacy-first Jinja chat-template fallback for ordinary chat, so models such as Gemma 4 can use their embedded template without changing the established legacy path for other models. The fallback keeps custom GBNF, JSON mode, JSON Schema, template stops, and media ordering intact, and plain fallback output is not forced through the strict tool-output parser.
- Corrected the pinned Metal backend's
MUL_MAT,MUL_MAT_ID, andGET_ROWScapability checks to reject source types without compiled kernels, including TQ1_0 and TQ2_0, before scheduling can reach a missing pipeline. - Added a multimodal preflight for non-causal media chunks whose physical
decode batch would exceed
ubatchSize, returning a typed generation error instead of reaching an upstream assertion.
0.2.0 #
- Fixed default bundled-bridge lookup by resolving the native code-asset ID, including Flutter's Apple framework packaging, while preserving explicit library-path and environment overrides.
- Rejected concurrent engine streams and context work instead of placing them
in an unbounded deferred queue. Stream cancellation is now stream-scoped,
awaits worker cleanup, resets partial context state, and cannot abort a
different request; concurrent
close()calls share one cleanup future. - Bumped the bridge ABI to 37. Chat formatting now requires a valid embedded or
explicit
LlamaModelConfig.chatTemplate, exposes the effective template and loaded-model metadata, and never silently substitutes ChatML. Freeing an incomplete native generation resets its context. - Raised generic Flutter iOS native-asset hook inputs to the bridge's real iOS
15 minimum, capped default CMake parallelism at four jobs with an explicit
FLLAMER_BUILD_JOBSoverride, and streamed build output. - Registered vendored llama.cpp, nlohmann/json, cpp-httplib, stb, and miniaudio licenses/authorship as Flutter additional notices.
Migration notes:
- Rebuild custom native bridges for ABI 37; ABI 36 libraries are rejected.
- Supply
LlamaModelConfig.chatTemplatefor models without a valid embedded chat template. - Serialize work per engine. Concurrent generations and context operations now fail immediately instead of entering a deferred queue.
- Treat stream cancellation as clearing the engine context; prefill or resend the intended history before continuing generation.
0.1.1 #
- Updated
code_assetsto 1.2.1,hooksto 2.0.2, andffigento 20.1.1, then regenerated the internal Dart FFI bindings. - Raised the example app to Flutter 3.44 and Dart 3.12, migrated Android to AGP 9.0.1, Kotlin 2.3.20, and a checksum-verified Gradle 9.1 wrapper, and replaced its CocoaPods-only plugin wiring with Swift Package Manager.
- Updated the curated
llama.cppsnapshot to upstream buildb9967, including tokenizer input hardening, Q2_0 support, and CPU/Metal/multimodal fixes, and adapted the private bridge integration to upstream's renamed speculative initialization helper.
0.1.0 #
- Prepared the package for warning-free pub.dev validation: vendored the
curated pinned
llama.cppbuild sources, consolidated Dart CLIs under the conventionalexample/directory, and corrected published documentation paths and licensing metadata. - Added loaded-engine
tokenize,countTokens,detokenize,formatChat,countChatTokens, and chat-template capability methods. They reuse the engine worker's existing model and serialize with inference; static chat token counting now formats and tokenizes with one temporary vocab-only model load instead of two. - Added
LlamaModel.architecture()for typed access to the GGUFgeneral.architecturemetadata on the existing worker-isolate path. - Enabled strict-casts, strict-inference, and strict-raw-types analysis for the package and Flutter example, and documented installation/build prerequisites.
- Changed native-assets builds from
ReleasetoRelWithDebInfoso the optimized bundled bridge retains debug information for local symbolication; runtime build metadata now records the CMake build type. - Raised and enforced the minimum iOS deployment target to 15.0 because the pinned embedded Metal scheduler uses an event API introduced in iOS 15.
- Added a default-on native
LLAMA_DART_NO_NETWORKbuild mode that disables CMake fetches and upstream's optional external LLGuidance project. - Corrected the embedding/reranking
mmprojPathfeature-gate message and documented speculative-decoding restrictions for media-bearing requests. - Documented Android
content://handling and the required copy/validation step from temporary picker content into durable app-private model storage. - Replaced nested
List<Float32List>batch embedding results with row-majorEmbeddingBatchtyped storage and zero-copy vector views; vector indexes now accept iterable vectors so a flat batch can be indexed directly. Batches retain normalization and pooling metadata from their request config. - Added a runnable app-owned-GGUF batch embedding CLI using
EmbeddingBatch. - Made benchmark/chat/RAG CLI error paths directly testable and removed all nested Dart process launches from the test suite.
- Added pinned upstream
ngram-map-kandngram-map-k4vspeculative decoding alongsidengram-simple, removed the bridge's duplicate n-gram algorithm, and added synthetic upstream-draft plus weighted output/state tests. The benchmark now accepts--spec-ngram STRATEGY. - Added typed pinned-upstream
NGramModSpeculationand request-localNGramCacheSpeculation, including ABI validation, reset/restore/shift state recreation, synthetic and weighted equivalence coverage, and benchmark selection/tuning metadata. Cache files remain intentionally unsupported so malformed external data cannot trigger upstream abort paths across the C ABI. - Added typed, upstream-dependent
DFlashSpeculationconfiguration through pinnedcommon_speculative, with stable ABI and validation coverage. It is documented as unverified until a compatible checksum-pinned fixture exists. - Added typed K/V cache data types, KV offload, Flash Attention, full-size SWA, and unified-cache tuning across Dart, the stable bridge, target and draft/MTP contexts, and context inspection. Quantized V caches are rejected when Flash Attention is explicitly disabled.
- Aligned external draft-model and EAGLE-3 context initialization with pinned
upstream
common_base_params_to_speculative, including its required output capacity normalization and the target model's selected backend devices (including CPU-only mode). Target output masks are now strategy-aware, while batches forwarded to draft contexts request only their final output; this avoids upstream output-capacity assertions without a vocabulary-sized draft buffer. Oversized model-backed common parameters are rejected before narrowing toint32, and model-load failures are distinguished from context-creation failures. - Fixed
GpuConfig.cpu()to restrict upstream model devices to CPU and disable context operation/KV offload, preventing accelerator initialization after model-layer offload was disabled. - Kept native lifecycle assertions active in Release CTest builds and verified the bridge with an ASan/UBSan Debug build.
- Made synthetic C bridge compilation errors fail Dart tests with bounded compiler diagnostics; only a genuinely unavailable compiler now skips those probes.
- Made native last-error recording non-throwing so allocation failure while
reporting another failure cannot unwind a C++ exception across the C ABI;
Dart now bounds and lossily decodes malformed native error bytes instead of
throwing a secondary UTF-8
FormatException. - Mapped native token-batch and multimodal-chunk allocation failures to the
existing typed
NativeOutOfMemoryExceptionpath instead of a generic bridge exception. - Removed dynamic string allocation from native validation/catch-path error composition and added complete allocation/exception guards around JSON and chat-plan parsing helpers.
- Removed pre-catch allocation from completion stop-token/chat-role validation and guarded media-path size inspection so malformed requests cannot unwind through the C ABI under allocation or filesystem errors.
- Made arbitrary detokenized/generated bytes use replacement decoding, while invalid UTF-8 model metadata/chat templates and malformed native tool-parser JSON now surface typed model/bridge/generation exceptions.
- Fixed model loading to stop when process-level backend initialization fails, and preserved backend-release failures instead of clearing them on free; Dart invalidates a freed model pointer before surfacing cleanup errors.
- Added exact tokenizer-backed RAG context budgeting that includes headers and source labels, plus full chat-prompt budgeting through an app-supplied model-template token counter.
- Moved full model-file SHA-256 work and vector-index JSON persistence/loading off the caller isolate.
- Added opt-in checksum-pinned Apache-2.0 MiniLM GGUF integration coverage for real model inspection, normalized and raw single embeddings, same-context batch embeddings, deterministic output, and semantic ranking.
- Added opt-in checksum-pinned MIT-derived TinyLlama Q8/Q4 integration coverage for real draft-model speculative output equivalence, proposal/acceptance telemetry, and deterministic engine cleanup.
- Added opt-in checksum-pinned Apache-2.0 Qwen3.5 0.8B MTP integration coverage for lightweight NextN inspection, deterministic ordinary/MTP output equivalence, proposal/acceptance telemetry, and engine cleanup.
- Added opt-in checksum-pinned Apache-2.0 Qwen3 1.7B EAGLE-3 integration coverage using the pinned upstream converter, with deterministic ordinary/EAGLE output equivalence, proposal/acceptance telemetry, and engine cleanup.
- Replaced the Flutter capability-label stub with a mobile-first local text and image chat workspace: platform file selection, explicit model lifecycle, capability gates, cancellable streaming, context reset, compact-phone layout coverage, and final generation telemetry.
- Restricted shared-library exports to the versioned
llama_dart_*C ABI on Apple and ELF targets, hiding statically linked llama.cpp/ggml/common/mtmd symbols and adding a host symbol-table regression test. - Extended the benchmark harness with native warm-up, context-reset sustained iterations, per-run RSS/output/telemetry records, and aggregate throughput, latency, and speculative-acceptance metrics.
- Extended benchmark schema 3 with typed KV-cache/Flash-Attention CLI controls and requested-versus-applied cache metadata.
- Added explicit benchmark device-model metadata through
--device-model, with a visibleunspecifiedfallback instead of guessing from the hostname. - Added opt-in checksum-pinned Apache-2.0 Jina tiny reranker GGUF coverage for
real pair scoring, same-context batches, deterministic semantic ordering,
and
LlamaRerankercandidate reordering. - Added opt-in checksum-pinned MIT base/LoRA GGUF coverage for real adapter loading, global scale changes, per-request disable and restoration, unload, and deterministic baseline recovery, plus focused lifecycle/performance docs.
- Added opt-in checksum-pinned TinyGemma3 model/mmproj/image coverage for real
mtmdvision capability reporting, deterministic file/byte image chat, prompt telemetry, and native cleanup. - Added opt-in checksum-pinned official Apache-2.0 Qwen3 ASR model/mmproj/audio
coverage for real
mtmdaudio capability reporting, deterministic file/byte transcription, telemetry, and cleanup, plus a runnable audio CLI example. - Added opt-in checksum-pinned official Apache-2.0 Qwen2.5 0.5B coverage for weighted named tool-call generation, native typed parsing, generated call ids, correlated result history, and final assistant response generation.
- Fixed sampler state advancing twice for generated tokens and existing context history, which could reject valid grammar-constrained output and over-apply repetition, frequency, and presence penalties.
- Fixed lightweight vocab-only model inspection to report standard GGUF architecture scalars, including context, embedding, layer/head, and NextN metadata, without allocating model weights.
- Bounded Dart allocations for untrusted model descriptions and metadata by entry, field, and total byte limits, with typed load failures before copying; empty/control-containing and duplicate metadata keys are rejected.
- Added worker-isolate prompt-only prefill with typed timing/token telemetry, automatic empty-context special-token insertion, exact continuation state, and real weighted-model coverage.
- Added cancellable decode-only
continueCompletion()streams for prefetched or restored contexts, typed empty-context failures, and sampler penalty history across incremental requests. - Added a non-retaining Dart finalizer safety net that requests cancellation
and worker-owned native cleanup for leaked engines without replacing explicit
close()or hiding deterministic cleanup failures. - Added a shared engine-worker error/exit signal so pending commands and streams fail instead of hanging after unexpected isolate termination; close now completes cleanup even when its preliminary cancellation request fails and skips FFI cancellation through a context address after worker exit.
- Reworked generation streaming into bounded worker start/step/dispose commands,
added validated
streamChunkTokenscoalescing, honored subscription pause/resume backpressure, released paused cancellation promptly, and kept parallel context work serialized with deterministic regression coverage. - Added opt-in process-wide native log capture with typed severity levels, bounded oldest-first eviction, dropped-record reporting, immutable Dart drains, and silent defaults.
- Added transactional target/draft context shifting with automatic or explicit discard counts, dynamic capability and used-token reporting, rollback, and continued-generation integration coverage.
- Prevented successful terminal stream closure from issuing a late native cancellation that poisoned the next context operation.
- Added snapshotted per-request LoRA adapter selection and scales to
GenerationConfig, including disable-all semantics and unconditional global scale restoration after generation. - Added cancellable worker-isolate
LlamaEngine.warmUp()for empty target and draft/MTP contexts, with session-state cleanup after the warm-up decode. - Added validated custom stop token IDs to synchronous and streaming generation; terminating tokens are not decoded, emitted, or committed to the context.
- Added capability-gated upstream Jinja tool calling with typed assistant call and correlated result history, auto/required/none/named choice, parallel-call gating, lazy grammar triggers, template stop handling, native output parsing, terminal parsed assistant messages, and generated call IDs. Tool execution remains app-owned.
- Added model-backed draft, EAGLE-3, and integrated/separate MTP speculative
decoding through pinned upstream
common_speculative, with typed Dart configs, draft limits, compatibility errors, cancellation, and rejected-tail cleanup. - Added speculative draft/verification timing telemetry alongside proposed and accepted token counts, and corrected sampler-state advancement across accepted n-gram drafts.
- Statically linked pinned
llama-commonand included its required sources in native-assets dependency tracking and the package payload without enabling runtime downloads. - Removed redundant direct
llamalinks from the bridge and native test target; CMake now receives that dependency once throughllama-common/mtmdwithout duplicate-library linker warnings. - Replaced target-only context snapshots with a checksummed versioned envelope that atomically captures target, draft/MTP, optional strategy-private, position, and token-history state; retained legacy restore for non-model-backed contexts.
- Routed
GenerationConfig.jsonSchemathrough pinned upstreamjson_schema_to_grammaron the worker isolate, adding local$defs/$refand broader schema support while retaining the pure-Dart subset helper. - Added experimental mmproj-backed image/audio chat through pinned upstream
mtmd, including file/byte inputs, worker-isolate preprocessing, streaming, model-specific capability reporting, and bounded media requests. - Kept video input gated because pinned upstream video helpers require external ffmpeg executables, which are not appropriate for the mobile runtime.
- Bumped the generated native bridge ABI to 36 for multimodal requests, GPU backend selection, model-backed speculation, native JSON Schema conversion, expanded telemetry fields, serialized tool-aware chat plans, and custom stop token IDs, context warm-up, context shifting, token-use reporting, and native log capture, zero-token prompt prefill, and typed KV-cache tuning/reporting.
- Enabled the embedded upstream Metal backend on Apple builds, wired explicit Metal device selection, made auto mode offload all available layers, and exposed compiled/effective backend reporting.
- Included pinned mtmd sources and decoder headers in the published package and native-assets dependency tracking.
- Replaced the generated sample API with typed public configs, errors, capability reporting, and local RAG primitives.
- Reported ABI-mismatched native bridge libraries as unavailable during capability probing.
- Reported ABI-compatible but incomplete native bridge libraries as unavailable during capability probing.
- Rejected invalid Mirostat tau/eta values even when Mirostat sampling is disabled.
- Rejected whitespace in
NGramSpeculation.strategyduring config validation. - Rejected blank RAG prompt headers before prompt assembly.
- Rejected malformed
LlamaRerankercandidate chunks before native scoring. - Rejected blank tool descriptions in public tool definitions.
- Kept in-memory RAG vector index adds atomic when a later chunk or vector is invalid.
- Rejected duplicate chunks inside a single in-memory RAG vector index add batch.
- Made desktop benchmark
--helpreturn usage without parsing later flags. - Rejected symbolic-link paths in
LlamaEngine.restoreStateFromFile()so session state restores cannot read unexpected link targets. - Rejected symbolic-link paths when loading persisted RAG vector indexes.
- Preferred native-assets CMake release library outputs in generator-specific
build subdirectories such as iOS
Release-iphoneos. - Reported native context, model, and LoRA cleanup failures instead of silently clearing Dart handles after a failed native free.
- Added an experimental C ABI bridge for backend init/free, model load/free, model metadata, capabilities, and native smoke coverage.
- Derived the public Dart bridge ABI version from generated bridge bindings.
- Added a native generation handle ABI for worker-isolate token streaming.
- Added generated Dart FFI bindings and worker-isolate model metadata inspection.
- Added upstream file type/quantization names to model inspection.
- Added complete native-assets build-hook dependency tracking for CMake-used bridge and vendored upstream source files.
- Added a minimal Flutter Android example app for supported-ABI native-assets APK validation.
- Added iOS platform files to the minimal Flutter example for config-only build validation.
- Added Dart CLI examples for local chat and model-free local RAG usage.
- Removed the undocumented package-template
bin/fllamer.dartexecutable. - Made the native-assets build hook infer Android NDK location from the Flutter-provided compiler path before falling back to environment variables.
- Made the native-assets build hook choose the newest numeric NDK under
ANDROID_HOME/ndkinstead of using lexicographic path order. - Added Dart build-mode/version and host processor-count metadata to desktop smoke benchmark JSON.
- Added current and peak process RSS snapshots to desktop smoke benchmark JSON.
- Added model file-name metadata to desktop smoke benchmark JSON.
- Added upstream quantization names to desktop smoke benchmark JSON.
- Added Dart tokenizer coverage against the vendored upstream GPT-2 golden fixture.
- Rejected empty byte buffers in byte-backed multimodal content-part constructors.
- Rejected line breaks in desktop smoke benchmark path flags.
- Reported desktop smoke benchmark CLI usage instead of a stack trace for invalid options.
- Rejected missing CLI option values before accidentally consuming the next long flag as a value.
- Reported incompatible native-library paths separately from missing bridge support.
- Aligned
ngram-simpledraft matching with pinned upstream behavior. - Rejected speculative decoding and mmproj settings on native embedding and reranking contexts.
- Cleared generation-stream output buffers before
out_donevalidation. - Rejected oversize native ABI text/path buffers before scanning them.
- Added multimodal documentation for the current typed DTOs and native unsupported boundary.
- Added a validated
mmprojPathmodel config field that remains gated until native multimodal loading is wired. - Reported Dart chat CLI argument errors as usage text instead of stack traces.
- Reported Dart local RAG CLI query errors as usage text instead of stack traces.
- Preserved final streamed text in the Dart chat CLI example.
- Cleared native model/context info structs before null-handle validation failures.
- Cleared native completion stats before early validation failures.
- Kept native heap-buffer lengths empty until buffer allocation succeeds.
- Cleared stale native bridge errors after successful model, context, generation, and LoRA handle frees.
- Cleared stale native bridge errors after freeing result-owned buffers.
- Rejected non-finite native embedding vectors and rerank scores.
- Avoided native cancellation calls from stream subscriptions after engine close.
- Rejected unsupported root keys in OpenAI-shaped tool-call JSON.
- Reported malformed tool-call JSON as an argument error.
- Reported malformed OpenAI-shaped tool-call argument JSON as an argument error.
- Reported unsupported JSON Schema and parallel tool-call policies as typed unsupported feature errors.
- Reported out-of-range Dart chat CLI numeric options as usage errors.
- Rejected blank embedding and rerank text before Dart or native bridge work.
- Rejected blank raw completion prompts before Dart or native bridge work.
- Cleared native context cancellation state when freeing active generation handles.
- Returned native cancellation errors promptly from embedding and rerank jobs.
- Exposed direct
EmbeddingConfig.validate()checks for unsupported rank pooling. - Exposed reranking special-token parsing configuration through the Dart API.
- Prevented native model or LoRA adapter frees while bridge-owned LoRA handles are still live or active on a context.
- Rejected invalid document source URIs in built-in RAG text splitters.
- Kept RAG character splitting on Unicode scalar boundaries instead of splitting surrogate pairs.
- Rejected blank app-supplied RAG chunk text before indexing, retrieval, or prompt assembly.
- Rejected zero-length app-supplied RAG citation spans during prompt assembly.
- Rejected duplicate chunks returned from custom RAG vector indexes.
- Rejected below-threshold chunks returned from custom RAG vector indexes that
ignore
minScore. - Rejected whitespace in custom structured-output grammar roots before Dart or native work.
- Rejected symbolic-link paths in
LlamaModel.deleteFile()so safe deletion does not validate one file and remove only the link. - Rejected symbolic-link paths in
LlamaEngine.saveStateToFile()so session state persistence cannot silently overwrite another file through the link. - Rejected symbolic-link paths in
InMemoryVectorIndex.persist()so local RAG persistence cannot silently overwrite another file through the link. - Rejected unsupported chat roles at the native C ABI before applying upstream chat templates.
- Snapshotted custom RAG vector-index dimensions once per retrieval before query embedding.
- Rejected invalid
LlamaRerankerqueries before empty-candidate fast returns. - Rejected malformed RAG retriever embedding vectors before vector-index search.
- Rejected blank structured-output grammar text and roots before native work.
- Rejected custom structured-output grammar roots when no grammar is provided.
- Rejected blank native bridge model and LoRA paths before upstream calls.
- Rejected empty native bridge chat-template message lists and blank roles/text before upstream calls.
- Rejected whitespace in tool names, tool-call ids, and named tool choices.
- Rejected non-
functiontool-call type values during tool-call parsing. - Cleared native description and metadata string buffers before validation failures.
- Cleared native tokenization and detokenization output buffers before validation and buffer-too-small failures.
- Rejected native GPU layer counts below the upstream
-1all-layers sentinel. - Preserved full native model-description buffer capacities when calling the pinned upstream API.
- Returned immutable LoRA adapter lists from the worker-isolate session API.
- Labeled malformed persisted RAG vector-index JSON errors.
- Rejected duplicate chunk records when loading persisted in-memory vector indexes.
- Rejected unknown keys when loading persisted in-memory vector indexes.
- Rejected explicit
nullnormalize fields when loading persisted in-memory vector indexes. - Rejected explicit
nullrecord lists when loading persisted in-memory vector indexes. - Rejected explicit
nullchunk metadata when loading persisted in-memory vector indexes. - Added an actionable
--target-platform android-arm64,android-x64hint when Flutter asks the native-assets hook for unsupported Android ABIs. - Rejected custom vector indexes that return more retrieval results than
requested by
topK. - Rejected custom RAG rerankers that drop vector-search candidates.
- Rejected partial character or token citation spans when building RAG prompts.
- Rejected unknown keys inside parsed tool-call payloads.
- Rejected explicit empty tool-call arrays during tool-call parsing and OpenAI-shaped serialization.
- Rejected explicit
nullor blank-string tool-call arguments instead of treating them as empty arguments. - Rejected duplicate parsed or serialized tool-call ids.
- Rejected partial native context-state snapshots instead of returning truncated state buffers.
- Rejected JSON Schema object
requiredlists with duplicate or undeclared properties. - Rejected explicit
nullJSON Schematypevalues instead of inferring from other keywords. - Rejected explicit
nullJSON Schema object keywords before grammar generation. - Rejected explicit
nullJSON SchemaprefixItemsandformatkeywords before grammar generation. - Rejected duplicate JSON Schema
enumvalues, including numeric equivalents and object values with different key order, before grammar generation. - Rejected rank pooling through the embedding APIs before native work; rank pooling remains exposed through reranking.
- Accepted generated tokens into the native sampler chain after successful decode so penalties and grammar state track streamed output.
- Rejected malformed custom vector-index dimensions before RAG retrieval.
- Snapshotted JSON-schema generation tool-calling definitions at config creation.
- Snapshotted tool-calling definitions before engine generation worker dispatch.
- Documented the current full iOS build blocker: local Xcode is missing the iOS 26.5 platform, while iOS config-only generation still passes.
- Verified supported-ABI Android release APK packaging from the Flutter example.
- Snapshotted
LlamaRerankercandidate lists before native scoring. - Snapshotted JSON-schema generation stop strings at config creation.
- Flushed persisted in-memory vector index writes to storage.
- Made native bridge tests skip fixture-backed coverage when the vocab fixture is absent from a published source package.
- Excluded the unused upstream model-download CMake helper from published payloads.
- Reduced pub dry-run warnings from vendored upstream ignore rules.
- Added native and Dart tokenization/detokenization using upstream model vocabularies.
- Added token-count helpers for raw text and chat-template prompts.
- Added native context create/free/info ABI with ownership checks.
- Wired
LlamaEngine.load/closeto a worker-isolate native model/context owner. - Added model chat-template formatting through upstream
llama_chat_apply_template. - Added worker-isolate raw prompt and chat completion over upstream decode/sampler APIs.
- Added generation sampling controls for top-k, top-p, min-p, typical-p, and repeat/presence/frequency penalties.
- Added experimental GBNF grammar constraints for structured completion output.
- Added structured-output runtime capability reporting.
- Added an early Dart-side ABI version guard for native bridge loading.
- Added runtime upstream commit reporting from the native bridge.
- Added
LlamaEngine.reset()to clear native context state through the worker isolate. - Added validation and explicit unsupported-feature errors for speculative decoding configs.
- Added native-library-path NUL validation.
- Added
FLLAMER_NATIVE_LIBRARYpath validation before bridge lookup fallback. - Added generation seed range validation.
- Added finite-number validation for generation sampling floats.
- Added non-negative LoRA scale validation.
- Added fixed-width native integer range validation for public configs.
- Added stop-string validation for generation configs.
- Added chat-message NUL validation before native chat-template calls.
- Added tool-call parser validation for empty parsed tool-call ids.
- Snapshot tool-call arguments before OpenAI-shaped JSON serialization.
- Added experimental text embeddings through the native bridge, returning
Float32Listvectors from pooled upstream sequence embeddings. - Added same-context batch embedding helpers for RAG chunk batches.
- Added RAG
EmbeddingModel/Retrieverabstractions,VectorIndexRetriever, andLlamaEmbeddingModelto connect local embeddings to the in-memory index. - Added app-owned RAG reranker hooks.
- Added async token-aware RAG splitting.
- Added JSON persistence for the in-memory vector index.
- Made built-in splitter chunk ids document-scoped and validated vector-index ids against NUL bytes.
- Made RAG prompt budgeting skip oversized chunks instead of dropping all later context.
- Added finite-vector validation for in-memory RAG search.
- Added persisted vector-index version validation.
- Reused vector normalization when loading persisted in-memory RAG indexes.
- Added positive RAG token-count validation.
- Added benchmark CLI validation for empty or NUL string option values.
- Reused benchmark option validation for programmatic benchmark calls.
- Rejected out-of-range numeric desktop benchmark options before native work.
- Mapped empty session-state files to
StateFileException. - Rejected persisted RAG vector dimension mismatches before vector allocation.
- Rejected line breaks in RAG ids before prompt source-marker assembly.
- Rejected line breaks in tool names and tool-call ids.
- Rejected malformed custom vector-index and reranker results before retrieval.
- Snapshotted custom vector-index and reranker chunks before retrieval returns.
- Cleared native C ABI size outputs on validation failures.
- Cleared native C ABI heap and flag outputs on validation failures.
- Rejected invalid RAG tokenizer token ids before detokenizing chunks.
- Rejected NUL bytes in RAG metadata keys and strings.
- Rejected blank or whitespace-containing multimodal MIME subtypes.
- Rejected non-finite scores returned by app-owned RAG rerankers.
- Rejected malformed speculative decoding strategy names before native setup.
- Rejected line breaks in grammar root names before native generation.
- Rejected line breaks in RAG source URIs before indexing or loading.
- Rejected line breaks in model, native-library, LoRA, session-state, media, and RAG index file paths before filesystem or native work.
- Snapshotted RAG tokenizer output before async detokenization.
- Snapshotted chat message lists before worker-isolate formatting/generation.
- Rejected native C ABI grammar root line breaks before grammar parsing.
- Rejected native C ABI chat role line breaks before template formatting.
- Verified the host package suite under
flutter test. - Added pre-embedding retriever search argument validation.
- Added RAG id validation across splitters, indexes, removals, and prompt sources.
- Added Dart-side detokenize token-id range validation before native calls.
- Added native completion sampler finite-float validation.
- Added native grammar-root validation for completion requests.
- Added native context-size and batch-size validation.
- Added native context thread-count validation.
- Added native context pooling and attention enum validation.
- Added native detokenize token-id vocabulary validation.
- Added a native-free empty-token detokenize fast path.
- Added Dart-side NUL validation for native text inputs.
- Added Dart and native NUL validation for raw completion prompts.
- Added native NUL validation for tokenization text.
- Added native NUL validation for embedding text.
- Mapped native allocation failures to
NativeOutOfMemoryException. - Added empty native-library-path validation.
- Mapped model-file type lookup failures to
ModelFileException. - Added cooperative native decode cancellation when a generation stream subscription is cancelled.
- Streamed generation chunks from the worker isolate instead of emitting only a final completion chunk.
- Fixed immediate generation-stream cancellation so the native worker cannot clear a pending cancel before decode starts.
- Added
GenerationConfig.jsonModeusing the pinned upstream JSON grammar. - Allowed public APIs to use
FLLAMER_NATIVE_LIBRARYor platform default native-library lookup whennativeLibraryPathis omitted. - Preserved exact explicit native-library paths, including trailing filename whitespace, when opening the bridge.
- Made unavailable explicit Metal/Vulkan GPU backends fail with typed unsupported-feature errors before model loading.
- Excluded vendored upstream model fixtures from the published package payload.
- Added experimental native reranking scores and
LlamaRerankerfor rank-pooling GGUF models. - Added
RerankingExceptionfor native reranking failures. - Added experimental LoRA adapter load/list/scale/unload support on
LlamaEngine. - Moved generation stop-string handling into the native decode loop.
- Added
LlamaEngine.contextInfo()for actual native context parameters. - Added
LlamaModel.metadata()for GGUF metadata key/value reads. - Added experimental
LlamaEngine.saveState()andrestoreState()for in-memory context snapshots. - Added Mirostat v1/v2 sampling configuration.
- Added final-chunk generation telemetry for prompt/generated token counts and elapsed prompt/decode/total time.
- Added tokenizer special-token metadata to
LlamaModelInfo. - Added
GenerationConfig.jsonSchema()for a common JSON Schema-to-GBNF subset. - Added local model file validation and SHA-256 checks through
LlamaModel.validateFile()andLlamaModel.sha256(). - Added computed tok/s rates to generation telemetry.
- Added architecture, native build, and mobile performance docs.
- Added file-backed context state helpers on
LlamaEngine. - Expanded the JSON Schema grammar helper to allow fixed-order optional object properties.
- Added typed map-object support through JSON Schema
additionalPropertiesschemas. - Allowed common JSON Schema metadata annotation keywords in structured-output grammar generation.
- Made persisted in-memory vector index record order deterministic.
- Rejected line breaks in native bridge model and LoRA paths before file loading.
- Made native CMake flags explicit for unused upstream network/tool/UI and accelerator backend options.
- Excluded disabled upstream backend source trees from the published package payload.
- Added
minPropertiesandmaxPropertiessupport for map-style JSON Schema objects. - Added keyword-based object, array, and string type inference for JSON Schema grammar generation.
- Added Dart-side tool definition DTOs and JSON tool-call parsing.
- Added tool-calling policy to
GenerationConfig. - Added typed multimodal chat content parts with non-text parts gated before native work.
- Added explicit validated local model file deletion through
LlamaModel.deleteFile(). - Added
RagPromptBuilder.buildChatMessages()for source-tagged chat prompt assembly. - Added JSON serialization helpers for tool definitions and parsed tool calls.
- Added native time-to-first-token telemetry for text generation.
- Added default GGUF magic-byte validation to local model file checks.
- Added typed RAG prompt citations with optional character/token source spans.
- Added scalar
constsupport to the JSON Schema grammar helper. - Expanded JSON Schema
constandenumgrammar helpers to support JSON array and object literals. - Added simple
anyOfandoneOfalternatives to the JSON Schema grammar helper. - Added test and documentation coverage for primitive JSON Schema
typeunions. - Added constrained nullable JSON Schema
typeunion support, such as["string", "null"]with string bounds. - Added
minLengthandmaxLengthstring bounds to the JSON Schema grammar helper. - Added selected JSON Schema string formats:
date,time,date-time, anduuid. - Added exact small finite integer ranges for JSON Schema
minimumandmaximum. - Added
exclusiveMinimumandexclusiveMaximumsupport for exact small integer ranges. - Added positive
multipleOffilters for exact small JSON Schema integer ranges. - Added bounded homogeneous array support to the JSON Schema grammar helper.
- Added fixed tuple array support through JSON Schema
prefixItems. - Added OpenAI-shaped serialization for tool-calling config policy.
- Added typed tool-choice policy serialization for tool-calling configs.
- Exposed
ubatchSizeandbatchThreadsruntime tuning onLlamaModelConfig. - Exposed mmap, mlock, and tensor-check model loading flags on
LlamaModelConfig. - Added exact RAG vector-index chunk removal with
documentId. - Made in-memory RAG vector-search tie ordering deterministic.
- Added NUL-byte validation at local RAG text boundaries.
- Added a CMake-backed native-assets build hook for bundling the native bridge.
- Added build-hook smoke coverage for bundled code asset output.
- Rejected empty text-only chat messages before native formatting.
- Added native build-flag reporting to runtime capabilities.
- Added a desktop smoke benchmark harness that records runtime, model, config, and generation telemetry metadata as JSON.
- Added benchmark CLI validation for paired batch and speculative-decoding tuning knobs.
- Added media MIME validation and clearer unsupported-feature errors for multimodal chat parts.
- Added experimental native
ngram-simplespeculative decoding with draft and accepted-token telemetry. - Added Dart and benchmark tuning knobs for
ngram-simplespeculative decoding. - Restricted native-assets Android builds to
arm64-v8aandx86_64until other ABIs are intentionally validated. - Aligned
GenerationConfig.maxTokensvalidation with the native bridge's int32 completion limit. - Exposed upstream NextN/MTP layer count through
LlamaModelInfo. - Fixed character-splitter citation spans to match trimmed chunk text.
- Kept native grammar/sampler setup failures from mutating context prompt state.
- Rejected native state, embedding, rerank, and LoRA context changes during active generation handles.
- Made generation streams created before engine close fail promptly when listened after close.
- Rejected persisted RAG vector-index files whose JSON root is not an object.
- Rejected malformed top-level persisted RAG vector-index fields with
FormatException. - Rejected malformed persisted RAG vector records with
FormatException. - Rejected NUL bytes in custom RAG prompt headers.
- Rejected empty or NUL-containing RAG vector-index persistence paths.
- Rejected non-JSON values in tool schemas and serialized tool-call arguments.
- Mapped session-state file read/write failures to
StateFileException. - Accepted string-keyed JSON maps in top-level tool-call parsing.
- Rejected malformed null top-level
tool_calls. - Validated explicit native-library paths in runtime capability probing.
- Rejected NUL bytes in tool schemas and serialized tool-call arguments.
- Rejected non-JSON values in parsed tool-call arguments.
- Skipped RAG reranking when vector search returns no candidates.
- Returned immutable RAG retriever results after app-owned reranking.
- Rejected non-JSON RAG vector metadata before indexing.
- Snapshotted RAG vector metadata during JSON export.
- Rejected cyclic RAG vector metadata before indexing.
- Deep-snapshotted tool schemas and direct tool-call arguments during JSON export.
- Returned immutable tool/OpenAI JSON adapter maps and lists.
- Ignored malformed Android NDK paths during native-assets build-hook discovery.
- Snapshotted generation stop markers before creating lazy generation streams.
- Snapshotted batch token, embedding, and reranking inputs before worker calls.
- Exposed immutable byte views from image, audio, and video chat content parts.
- Returned immutable RAG vector-index JSON export maps and lists.
- Pinned the Flutter example Android minimum SDK to API 28 and documented it.
- Removed Android internet permissions from Flutter example debug/profile builds.
- Excluded Flutter example Gradle/Xcode generated state from published payloads.
- Excluded Codex guidance and Xcode SwiftPM workspace state from published payloads.
- Documented local-by-default safety notes in the README.
- Added pub.dev topics for FFI, llama.cpp, local AI, and RAG discovery.
- Rejected malformed RAG vector records when loading persisted indexes.
- Mapped RAG vector-index file read/write failures to
RagIndexException. - Skipped RAG query embedding when the vector index is empty.
- Deep-snapshotted RAG vector chunks when adding them to the in-memory index.
- Deep-snapshotted RAG splitter metadata when producing chunks.
- Snapshotted RAG prompt-builder included chunk metadata.
- Deep-snapshotted nested RAG prompt-builder included chunk metadata.
- Rejected malformed persisted RAG vector source URIs.
- Rejected cyclic JSON Schema
constandenumliterals. - Rejected cyclic nested JSON Schema objects.
- Rejected cyclic raw-map JSON Schema objects.
- Rejected unsupported sibling keys on JSON Schema
enumliterals. - Rejected Dart and native configs whose
ubatchSizeexceedsbatchSize. - Rejected multimodal MIME types without a subtype.
- Rejected empty generation grammar strings.
- Rejected empty RAG vector source URIs.
- Rejected literal and percent-encoded NUL bytes in RAG vector source URIs.
- Rejected invalid RAG prompt-builder chunk source URIs before citation output.
- Bounded speculative acceptance-rate telemetry to the valid 0..1 range.
- Fixed JSON-mode number grammar for exponents containing zero.
- Fixed native completion decoding to use explicit context positions.
- Chunked native prompt decoding by the configured batch size.
- Seeded native sampler history with prompt tokens for unconstrained generation.
- Tracked native token history across completions for repeat penalties.