diff --git a/CHANGELOG.md b/CHANGELOG.md
index f6e4abcd0..a71df3ed3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,7 +5,7 @@ Releases before 0.10.0 are in the
- Fixed constrained JSON (`responseFormat`) ignoring the grammar after a `ThinkingBudget` closes a template-opened thought on native llama.cpp (Qwen3.5 and similar), and the same for required tool calls on templates whose grammar takes that thought.
- Fixed a required tool call on Seed-OSS being unconstrained after a `ThinkingBudget` closes a thought the model opened, on native llama.cpp ([#1958](https://github.com/leehack/llamadart/issues/1958)).
-- Aligned the default WebGPU bridge assets to `v0.1.84`: constrained JSON (`responseFormat`) and Seed-OSS required tool calls stay constrained after a `ThinkingBudget` closes a thought on WebGPU, and older assets throw `LlamaUnsupportedException` for that combination ([#1954](https://github.com/leehack/llamadart/issues/1954)). Web keeps native llama.cpp `v0.9.0` parity (upstream `v0.9.0@cd959bae99ff4bed22bef2604f45241c09bbb8c8`) and `@litert-lm/core@0.19.0`. Manifest SHA-256: `55abeb377597148156059a8ee5400f2314c6254ad91b57db65b709e304c0dea0`.
+- Aligned the default WebGPU bridge assets to `v0.1.84`: constrained JSON (`responseFormat`) and required tool calls that take the thought stay constrained after a `ThinkingBudget` closes it on WebGPU, and older assets throw `LlamaUnsupportedException` for that combination ([#1954](https://github.com/leehack/llamadart/issues/1954)). Web keeps native llama.cpp `v0.9.0` parity (upstream `v0.9.0@cd959bae99ff4bed22bef2604f45241c09bbb8c8`) and `@litert-lm/core@0.19.0`. Manifest SHA-256: `55abeb377597148156059a8ee5400f2314c6254ad91b57db65b709e304c0dea0`.
## 0.19.7
diff --git a/doc/webgpu_bridge.md b/doc/webgpu_bridge.md
index 25d1597fe..3c4839c4b 100644
--- a/doc/webgpu_bridge.md
+++ b/doc/webgpu_bridge.md
@@ -211,7 +211,8 @@ physical playback, intelligibility or speaker-reference fidelity.
([llama-web-bridge#213](https://github.com/leehack/llama-web-bridge/pull/213)).
llamadart sends it, as native does, only when `grammarLazy` is off and the
grammar takes the thought (`ToolCallGrammarUtils.keepsAppliedThroughThought`:
- constrained JSON on Qwen3.5, required tool calls on Seed-OSS), and throws
+ a `think-body` or `seed-thought` root, as in `responseFormat` and required
+ tool calls), and throws
`LlamaUnsupportedException` for that combination on assets without the flag.
Every other request omits `pauseGrammar` and is unchanged.
diff --git a/lib/src/backends/webgpu/webgpu_backend.dart b/lib/src/backends/webgpu/webgpu_backend.dart
index 463e22c41..3ee857c0d 100644
--- a/lib/src/backends/webgpu/webgpu_backend.dart
+++ b/lib/src/backends/webgpu/webgpu_backend.dart
@@ -1955,9 +1955,9 @@ class WebGpuLlamaBackend
ToolCallGrammarUtils.keepsAppliedThroughThought(grammar);
if (keepGrammarApplied && !capabilities.thinkingBudgetPauseGrammar) {
throw LlamaUnsupportedException(
- 'WebGPU thinking-budget control with a grammar that stays applied '
- 'through the thought (responseFormat on Qwen3.5, required tool calls '
- 'on Seed-OSS) needs bridge assets v0.1.84+ whose '
+ 'WebGPU thinking-budget control with an eager grammar that takes the '
+ 'thought (responseFormat or required tool calls on templates that '
+ 'open or model one) needs bridge assets v0.1.84+ whose '
'getCompletionCapabilities() reports thinkingBudgetPauseGrammar; '
'the loaded core pauses every grammar while the model reasons, so '
'the reply would not be constrained.',
diff --git a/lib/src/backends/webgpu/webgpu_errors.dart b/lib/src/backends/webgpu/webgpu_errors.dart
index 06c6f4fcd..b213bf5f2 100644
--- a/lib/src/backends/webgpu/webgpu_errors.dart
+++ b/lib/src/backends/webgpu/webgpu_errors.dart
@@ -54,9 +54,9 @@ final RegExp _bridgeArgument = RegExp(
final RegExp _bridgeUnsupportedCompletion = RegExp(
r'^The loaded WebGPU core does not support CompletionOptions\.'
- r'(?:presencePenalty|minP|thinkingBudget|grammarLazy|grammarRoot|penaltyPromptTokensWithGrammar|speculativeDecoding)'
+ r'(?:presencePenalty|minP|thinkingBudget\.pauseGrammar|thinkingBudget|grammarLazy|grammarRoot|penaltyPromptTokensWithGrammar|speculativeDecoding)'
r'(?: or CompletionOptions\.'
- r'(?:presencePenalty|minP|thinkingBudget|grammarLazy|grammarRoot|penaltyPromptTokensWithGrammar|speculativeDecoding))*\.$',
+ r'(?:presencePenalty|minP|thinkingBudget\.pauseGrammar|thinkingBudget|grammarLazy|grammarRoot|penaltyPromptTokensWithGrammar|speculativeDecoding))*\.$',
);
/// Classifies request rejections without reclassifying unknown runtime errors.
@@ -78,6 +78,7 @@ LlamaException? webGpuBridgeRequestError(
final message = webGpuBridgeErrorText(error, sourceUrls: sourceUrls);
if (name == 'Error' &&
(message.contains('CompletionOptions.grammar') ||
+ message.contains('CompletionOptions.thinkingBudget') ||
message.contains(
'CompletionOptions.penaltyPromptTokensWithGrammar',
)) &&
diff --git a/lib/src/core/models/inference/generation_params.dart b/lib/src/core/models/inference/generation_params.dart
index 5bfe3326c..7a86281f5 100644
--- a/lib/src/core/models/inference/generation_params.dart
+++ b/lib/src/core/models/inference/generation_params.dart
@@ -951,15 +951,14 @@ class GenerationParams {
/// Optional llama.cpp-style limit for tokens generated inside a reasoning
/// block.
///
- /// The native llama.cpp backend keeps a grammar that takes the
- /// template-opened thought itself (a root starting with `think-body`) or
- /// models the thought the model opens (Seed-OSS's required-call root,
- /// starting with `seed-thought`) applied while budgeted reasoning is
- /// active. It pauses every other grammar, lazy grammars included, until
- /// reasoning has ended. Native LiteRT-LM applies it to chat generation on
+ /// The native llama.cpp backend keeps an eager grammar whose root takes the
+ /// thought (`think-body` or `seed-thought`, as in response-format and
+ /// required tool-call grammars on templates that open or model a thought)
+ /// applied while budgeted reasoning is active. It pauses every lazy grammar,
+ /// whatever its root, and every other grammar until reasoning has ended. Native LiteRT-LM applies it to chat generation on
/// bundles with a thinking channel, which it closes with the bundle's own
/// end marker; it rejects a zero budget and [ThinkingBudget.forcedMessage].
- /// WebGPU bridges that report `thinkingBudget` support it and pause grammars
+ /// WebGPU bridges that report `thinkingBudget` support it and treat grammars
/// the same way as native llama.cpp; keeping a grammar applied through the
/// thought needs assets that report `thinkingBudgetPauseGrammar` (v0.1.84+),
/// and older assets reject that combination.
diff --git a/skills/llamadart-web/SKILL.md b/skills/llamadart-web/SKILL.md
index a256e8c37..562d16d17 100644
--- a/skills/llamadart-web/SKILL.md
+++ b/skills/llamadart-web/SKILL.md
@@ -101,9 +101,9 @@ in the llamadart-getting-started and llamadart-chat-streaming skills.
unless `withTextHistory()` is used and the loaded runtime supports them. Unreported
controls throw `LlamaUnsupportedException`; `engine.runtime` names the
runtime, so never sniff the `.litertlm` extension after loading.
- - A `ThinkingBudget` with a grammar that stays applied through the thought
- (`responseFormat` on Qwen3.5, required calls on Seed-OSS) needs assets that
- report `thinkingBudgetPauseGrammar`; older assets throw
+ - A `ThinkingBudget` with an eager grammar that takes the thought
+ (`responseFormat` or required tool calls on templates that open or model
+ one) needs assets that report `thinkingBudgetPauseGrammar`; older assets throw
`LlamaUnsupportedException`.
- `engine.supportsNextTokenScoring` and
`engine.supportsStatePersistence`.
diff --git a/test/integration/thinking_budget_grammar_test.dart b/test/integration/thinking_budget_grammar_test.dart
index f1d06b568..b88f8a2ee 100644
--- a/test/integration/thinking_budget_grammar_test.dart
+++ b/test/integration/thinking_budget_grammar_test.dart
@@ -165,4 +165,40 @@ thought-text ::= [^d]*
}
}
});
+
+ test('a lazy grammar constrains the reply once the thought closes', () async {
+ for (final budget in [0, 3]) {
+ final chunks = await backend
+ .generate(
+ context,
+ prompt,
+ GenerationParams(
+ maxTokens: 48,
+ temp: 0,
+ seed: 1,
+ penalty: 1,
+ grammar: 'root ::= " a" [a-z ]*\n',
+ grammarLazy: true,
+ grammarTriggers: const [
+ GenerationGrammarTrigger.typed(
+ type: GrammarTriggerType.word,
+ value: ' a',
+ ),
+ ],
+ thinkingBudget: ThinkingBudget(
+ maxTokens: budget,
+ startTag: '',
+ endTag: '',
+ ),
+ ),
+ )
+ .toList();
+
+ expect(
+ utf8.decode(chunks.expand((chunk) => chunk).toList()),
+ matches(RegExp(r'.* a[a-z ]*$', dotAll: true)),
+ reason: 'budget $budget',
+ );
+ }
+ });
}
diff --git a/test/unit/backends/webgpu/webgpu_errors_test.dart b/test/unit/backends/webgpu/webgpu_errors_test.dart
index dcb9796d9..e00d8980a 100644
--- a/test/unit/backends/webgpu/webgpu_errors_test.dart
+++ b/test/unit/backends/webgpu/webgpu_errors_test.dart
@@ -15,6 +15,14 @@ void main() {
'The loaded WebGPU core does not support CompletionOptions.penaltyPromptTokensWithGrammar.',
isA(),
),
+ (
+ 'The loaded WebGPU core does not support CompletionOptions.thinkingBudget.',
+ isA(),
+ ),
+ (
+ 'The loaded WebGPU core does not support CompletionOptions.thinkingBudget.pauseGrammar.',
+ isA(),
+ ),
(
'The loaded WebGPU core does not support CompletionOptions.grammarLazy.',
isA(),
diff --git a/test/unit/tooling/docs_changelog_drift_test.dart b/test/unit/tooling/docs_changelog_drift_test.dart
index 84c5a8c99..e77d8f85b 100644
--- a/test/unit/tooling/docs_changelog_drift_test.dart
+++ b/test/unit/tooling/docs_changelog_drift_test.dart
@@ -91,4 +91,45 @@ void main() {
isEmpty,
);
});
+
+ test('names the first differing line and a whitespace-only difference', () {
+ final problems = docsChangelogDriftProblems(
+ {'0.2.0': '- Fix a.\n- Fix b.\n'},
+ {'0.2.0': '- Fix a.\n- Fix b.\n'},
+ );
+
+ expect(problems, hasLength(1));
+ expect(
+ problems.single,
+ allOf(
+ contains('only in whitespace'),
+ contains('first differing line 2'),
+ contains('`- Fix b.`'),
+ ),
+ );
+ expect(
+ docsChangelogDriftProblems(
+ {'0.2.0': '- Fix a.\n'},
+ {'0.2.0': '- Fix c.\n'},
+ ).single,
+ allOf(contains('in content'), contains('first differing line 1')),
+ );
+ });
+
+ test('requires the prescribed bridge wording on the docs page', () {
+ for (final docsLine in [
+ '* Keep default WebGPU bridge assets at `v1` (unchanged from 0.1.0).\n',
+ bridgeCore,
+ ]) {
+ final problems = docsChangelogDriftProblems(
+ {'0.2.0': bridgeCore},
+ {'0.2.0': docsLine},
+ );
+
+ expect(problems, hasLength(1), reason: docsLine);
+ expect(problems.single, contains('bridge line must read'));
+ }
+ expect(docsChangelogDriftProblems({}, {'0.2.0': bridgeCore}), hasLength(1));
+ expect(docsChangelogDriftProblems({}, {'Unreleased': bridgeCore}), isEmpty);
+ });
}
diff --git a/tool/testing/verify_release_docs_versions.dart b/tool/testing/verify_release_docs_versions.dart
index 8985605f8..dbaf0c80b 100644
--- a/tool/testing/verify_release_docs_versions.dart
+++ b/tool/testing/verify_release_docs_versions.dart
@@ -992,10 +992,37 @@ String _normalizedBridgeLines(String body) => body
.join('\n')
.trimRight();
+/// The first line where [core] and [docs] differ, numbered from 1, and
+/// whether they differ only in whitespace.
+String _firstDifference(String core, String docs) {
+ final coreLines = core.split('\n');
+ final docsLines = docs.split('\n');
+ final count = coreLines.length > docsLines.length
+ ? coreLines.length
+ : docsLines.length;
+ var index = 0;
+ while (index < count &&
+ index < coreLines.length &&
+ index < docsLines.length &&
+ coreLines[index] == docsLines[index]) {
+ index++;
+ }
+ final whitespaceOnly =
+ core.replaceAll(RegExp(r'\s+'), '') ==
+ docs.replaceAll(RegExp(r'\s+'), '');
+ String line(List lines) =>
+ index < lines.length ? '`${lines[index]}`' : '(missing)';
+ return '${whitespaceOnly ? 'only in whitespace' : 'in content'}; first '
+ 'differing line ${index + 1}: CHANGELOG.md ${line(coreLines)}, docs '
+ 'page ${line(docsLines)}';
+}
+
/// Released sections that [docs] keeps from [core] but words differently.
///
/// Both changelogs are edited by hand and union-merge, so nothing else keeps
-/// a retained release's bullets identical.
+/// a retained release's bullets identical. The docs page must use its
+/// prescribed bridge wording (`- ` marker, no "the"), which normalising both
+/// sides would otherwise let a `*` or "the default" through.
List docsChangelogDriftProblems(
Map core,
Map docs,
@@ -1003,12 +1030,21 @@ List docsChangelogDriftProblems(
final normalized = _normalizedBridgeLines;
return [
for (final MapEntry(key: heading, value: body) in docs.entries)
- if (heading != 'Unreleased' &&
- core.containsKey(heading) &&
- normalized(core[heading]!) != normalized(body))
- '$_docsChangelog `## $heading` differs from CHANGELOG.md; keep the '
- 'bullets of every retained release identical (apart from the bullet '
- 'marker and "the" on the WebGPU bridge line).',
+ if (heading != 'Unreleased') ...[
+ for (final line in body.split('\n'))
+ if (_bridgeBulletLine.hasMatch(line) &&
+ (line.startsWith('* ') ||
+ line.contains('the default WebGPU bridge assets')))
+ '$_docsChangelog `## $heading` bridge line must read "- ... '
+ 'default WebGPU bridge assets ..." (a `-` marker, no "the"): '
+ '`$line`',
+ if (core.containsKey(heading) &&
+ normalized(core[heading]!) != normalized(body))
+ '$_docsChangelog `## $heading` differs from CHANGELOG.md '
+ '${_firstDifference(normalized(core[heading]!), normalized(body))}'
+ '; keep the bullets of every retained release identical (apart '
+ 'from the bullet marker and "the" on the WebGPU bridge line).',
+ ],
];
}
diff --git a/website/docs/changelog/recent-releases.md b/website/docs/changelog/recent-releases.md
index 40239f351..943ca37c4 100644
--- a/website/docs/changelog/recent-releases.md
+++ b/website/docs/changelog/recent-releases.md
@@ -15,7 +15,7 @@ validate against the exact release tag notes.
- Fixed constrained JSON (`responseFormat`) ignoring the grammar after a `ThinkingBudget` closes a template-opened thought on native llama.cpp (Qwen3.5 and similar), and the same for required tool calls on templates whose grammar takes that thought.
- Fixed a required tool call on Seed-OSS being unconstrained after a `ThinkingBudget` closes a thought the model opened, on native llama.cpp ([#1958](https://github.com/leehack/llamadart/issues/1958)).
-- Aligned default WebGPU bridge assets to `v0.1.84`: constrained JSON (`responseFormat`) and Seed-OSS required tool calls stay constrained after a `ThinkingBudget` closes a thought on WebGPU, and older assets throw `LlamaUnsupportedException` for that combination ([#1954](https://github.com/leehack/llamadart/issues/1954)). Web keeps native llama.cpp `v0.9.0` parity (upstream `v0.9.0@cd959bae99ff4bed22bef2604f45241c09bbb8c8`) and `@litert-lm/core@0.19.0`. Manifest SHA-256: `55abeb377597148156059a8ee5400f2314c6254ad91b57db65b709e304c0dea0`.
+- Aligned default WebGPU bridge assets to `v0.1.84`: constrained JSON (`responseFormat`) and required tool calls that take the thought stay constrained after a `ThinkingBudget` closes it on WebGPU, and older assets throw `LlamaUnsupportedException` for that combination ([#1954](https://github.com/leehack/llamadart/issues/1954)). Web keeps native llama.cpp `v0.9.0` parity (upstream `v0.9.0@cd959bae99ff4bed22bef2604f45241c09bbb8c8`) and `@litert-lm/core@0.19.0`. Manifest SHA-256: `55abeb377597148156059a8ee5400f2314c6254ad91b57db65b709e304c0dea0`.
## 0.19.7
diff --git a/website/docs/guides/generation-and-streaming.md b/website/docs/guides/generation-and-streaming.md
index c78184ed7..93a496254 100644
--- a/website/docs/guides/generation-and-streaming.md
+++ b/website/docs/guides/generation-and-streaming.md
@@ -351,15 +351,12 @@ templates. Raw `engine.generate(...)` calls must provide both delimiters in
`ThinkingBudget`. A budget of `0` immediately forces the end delimiter. On
Qwen3-Coder XML templates (Qwen3.5, Nemotron 3 Nano, StepFun 3.5 Flash) the
forced text is a line break before the end delimiter, as llama.cpp forces it.
-On native llama.cpp, a grammar that takes the template-opened thought itself
-(its root starts with `think-body`, as for `responseFormat` on Qwen3.5), or one
-that models the thought the model opens (the Seed-OSS required-call grammar,
-whose root starts with `seed-thought`), stays applied while the model reasons,
-so it also constrains the reply after a spent budget. Other grammars, such as a
-typical caller `grammar` or a lazy grammar, wait until the thought closes.
-WebGPU still pauses every grammar during
-budgeted reasoning
-([#1954](https://github.com/leehack/llamadart/issues/1954)).
+On native llama.cpp and WebGPU, an eager grammar whose root takes the thought
+(`think-body` or `seed-thought`, as in `responseFormat` and required tool-call
+grammars on templates that open or model a thought) stays applied while the
+model reasons, so it also constrains the reply after a spent budget. Every lazy
+grammar, whatever its root, and every other grammar, such as a typical caller
+`grammar`, waits until the thought closes.
Native llama.cpp, WebGPU bridges that report `thinkingBudget` and native
LiteRT-LM chat generation on bundles with a thinking channel support a budget
(see [Runtime parameters](../configuration/runtime-parameters)); other
diff --git a/website/docs/platforms/webgpu-bridge.md b/website/docs/platforms/webgpu-bridge.md
index 8cc8d5c07..58551f73d 100644
--- a/website/docs/platforms/webgpu-bridge.md
+++ b/website/docs/platforms/webgpu-bridge.md
@@ -287,10 +287,10 @@ The feature-by-runtime table is in the
probe reports `penaltyPromptTokens`), as native llama.cpp does. `ToolChoice.auto` requests that skip the lazy tool-call
grammar keep the prompt out, as native does under that grammar
([llama-web-bridge#187](https://github.com/leehack/llama-web-bridge/pull/187)).
- A thinking budget is text-only. As on native llama.cpp, a thinking budget keeps a
- grammar applied through the thought when that grammar takes it (constrained JSON
- on Qwen3.5, required tool calls on Seed-OSS) and pauses every other grammar until
- reasoning ends; the former needs assets whose probe reports
+ A thinking budget is text-only. As on native llama.cpp, a thinking budget keeps an
+ eager grammar applied through the thought when its root takes it (`think-body`
+ or `seed-thought`, as in `responseFormat` and required tool calls) and pauses
+ every lazy and every other grammar until reasoning ends; the former needs assets whose probe reports
`thinkingBudgetPauseGrammar` (`v0.1.84+`) and throws `LlamaUnsupportedException`
without it. A LoRA adapter is a `ModelSource` whose URL the bridge downloads once
per model load (a `ModelSource.path` is a URL relative to the document, or a `blob:` URL), through Cache Storage unless the URL carries credentials; reload