Open-source AI browser agent for Chrome and Firefox (monorepo) ðŸ§
JavaScript ai-agentai-agentsai-toolsbrowser-aibrowser-automationbrowser-extensionchrome-aichrome-devtoolschrome-extensionchrome-extensionsfirefox-addonfirefox-addonsfirefox-extensionfirefox-extensionsgemmagemma4minimaxoffline-aioffline-llmqwen
feat: add MiniCPM5-2B WebGPU preset with XML tool-call support
Emre Sokullub3d4efe85876
diff --git a/docs/providers-and-models.md b/docs/providers-and-models.mdindex ad3ddee28..6759de8fc 100644--- a/docs/providers-and-models.md+++ b/docs/providers-and-models.md@@ -47,7 +47,7 @@ class BaseLLMProvider {| `gpt4all` | `openai` | local | (loaded model) | Yes (default on) || `local_openai_proxy` | `openai` | local | (required) | Off / manual toggle || `unsloth` | `openai` | local | (required) | Off / manual toggle |-| `webgpu` (Chromium) | `webgpu` | local | Seven shipped LFM2.5/Nanbeige/Bonsai presets; experimental custom HF ONNX repos | LFM2.5-VL presets |+| `webgpu` (Chromium) | `webgpu` | local | Eight shipped LFM2.5/Nanbeige/MiniCPM5/Bonsai presets; experimental custom HF ONNX repos | LFM2.5-VL presets || `azure_openai` | `azure_openai` | cloud | (deployment) | Manual toggle || `aws_bedrock` | `aws_bedrock` | cloud | (model id) | No || `openai` | `openai` | cloud | `gpt-5.6-terra` | Model-name regex |@@ -150,7 +150,7 @@ duplicate request.### Local ProvidersOn Chromium, **WebGPU (In-browser)** is an endpoint-free local provider. Its-Apocalypse text picker offers seven shipped presets:+Apocalypse text picker offers eight shipped presets:- [`LiquidAI/LFM2.5-2.6B-ONNX`](https://huggingface.co/LiquidAI/LFM2.5-2.6B-ONNX/)(`q4f16`, about 1.55 GB) through the packaged Transformers.js 4.2 / ONNX@@ -185,6 +185,15 @@ Apocalypse text picker offers seven shipped presets:implementation is the [Nanbeige Browser Lab](https://huggingface.co/spaces/borkiss/nanbeige4-2-3b-browser-lab)Space, which drives the same export through a hand-written ONNX Runtime Webloop rather than Transformers.js.+- [`RASMUS/MiniCPM5-2B-ONNX`](https://huggingface.co/RASMUS/MiniCPM5-2B-ONNX)+ (`q4f16`, about 1.83 GB), a browser-ready ONNX export of+ [`openbmb/MiniCPM5-2B`](https://huggingface.co/openbmb/MiniCPM5-2B) built with+ `onnxruntime-genai -e webgpu` (`MatMulNBits` + `GroupQueryAttention`, default+ `onnx/model_q4f16.onnx` layout). It needs an adapter with `shader-f16` and+ emits XML-style tool calls+ (`<function name="..."><param name="...">...</param></function>`, CDATA-wrapped+ when values contain `<`, `&`, or newlines), which the local fallback parser+ accepts. Its practical context is 16k.- [`prism-ml/Bonsai-27B-gguf`](https://huggingface.co/prism-ml/Bonsai-27B-gguf)(`Q1_0`, about 3.8 GB) through a dedicated vendored [bitgpu](https://github.com/stfurkan/bitgpu)worker. Bonsai is opt-in: WebBrain never auto-downloads the 27B weights.@@ -201,11 +210,11 @@ Do not point Transformers.js at the Bonsai GGUF — 27B is not an ONNX pipeline.The provider defaults to the Compact prompt tier with a conservative 16kpractical context setting (4k for Nanbeige and Bonsai). Text-only presetsreject image blocks; the two LFM2.5-VL presets route image and text blocks-through the local image-text runtime. LFM2.5 2.6B, 1.2B Thinking, and-Nanbeige4.2-3B use reasoning paths; WebBrain keeps completed thinking out of+through the local image-text runtime. LFM2.5 2.6B, 1.2B Thinking,+Nanbeige4.2-3B, and MiniCPM5-2B use reasoning paths; WebBrain keeps completed thinking out ofthe visible answer and reports an error when a template that opens `<think>`in the generation prompt exhausts its output budget before closing it. Those-three presets decode with their publisher's recommended sampling settings; the+four presets decode with their publisher's recommended sampling settings; theremaining ONNX presets stay greedy. Bonsai uses bitgpu`think: true` with a 128-token think budget and the same post-think visible-answer UX. Each repository is cached separately in Chrome.diff --git a/docs/remote-downloads.md b/docs/remote-downloads.mdindex 0f7c8f49e..24507c133 100644--- a/docs/remote-downloads.md+++ b/docs/remote-downloads.md@@ -22,7 +22,7 @@ WebBrain is designed to minimize remote network dependencies. All downloads fall| Component | Remote Server / Origin | Origin Description | Typical Size | Protocol / Method | Checksum & Integrity | Local Storage Destination || :--- | :--- | :--- | :--- | :--- | :--- | :--- |-| **WebGPU Text / Multimodal Models** | `huggingface.co` / Hugging Face CDN | Seven shipped presets: LiquidAI LFM2.5 2.6B, 1.2B Instruct, 1.2B Thinking, VL 1.6B, VL 3B, Michionlion Nanbeige4.2-3B, and prism-ml Bonsai 27B | ~0.76 – 4.0 GB per selected preset | HTTPS GET (Transformers.js/ONNX or bitgpu) | Hugging Face Git LFS SHA-256 hash | Browser Cache API & IndexedDB (`transformers-cache`) |+| **WebGPU Text / Multimodal Models** | `huggingface.co` / Hugging Face CDN | Eight shipped presets: LiquidAI LFM2.5 2.6B, 1.2B Instruct, 1.2B Thinking, VL 1.6B, VL 3B, Michionlion Nanbeige4.2-3B, RASMUS MiniCPM5-2B, and prism-ml Bonsai 27B | ~0.76 – 4.0 GB per selected preset | HTTPS GET (Transformers.js/ONNX or bitgpu) | Hugging Face Git LFS SHA-256 hash | Browser Cache API & IndexedDB (`transformers-cache`) || **Local Vision Model** | `huggingface.co` / Hugging Face CDN | `webbrain-one/webbrain-vl-2-450M-onnx` weights for local screenshot description and UI analysis | ~810 MB | HTTPS GET (Transformers.js pipeline) | Hugging Face Git LFS SHA-256 hash | Browser Cache API & IndexedDB (`transformers-cache`) || **Emergency Text Pack & SQLite Index** | `github.com/webbrain-one/emergency-box-corpus` (GitHub Releases CDN) | Release assets for curated public-domain field references, prebuilt SQLite FTS5 database, and precomputed E5 embeddings | ~245 MB (compressed ZIP) | Resumable HTTP `Range: bytes={offset}-` streaming fetch | Strict **SHA-256** hash comparison against hardcoded release descriptor before activation | OPFS (`webbrain-offline-rag/emergency-box-text/`) & IndexedDB (`webbrain_offline_rag`) || **Multilingual Semantic Model** | `huggingface.co` / Hugging Face CDN (`Xenova/multilingual-e5-small`) | ONNX weights for multilingual query embedding and vector search / candidate reranking | ~134 MB | HTTPS GET (ONNX Runtime Web / Transformers.js) | SHA-256 verification via Transformers.js manifest | Browser Cache API & IndexedDB (`transformers-cache`) |diff --git a/src/chrome/src/agent/tool-call-parser.js b/src/chrome/src/agent/tool-call-parser.jsindex f55ab7bb8..42d680b97 100644--- a/src/chrome/src/agent/tool-call-parser.js+++ b/src/chrome/src/agent/tool-call-parser.js@@ -357,7 +357,12 @@ export function parseToolCallsFromText(text, allowedNames) {const results = [];const parseXmlParamValue = (value) => {- const cleaned = String(value || '')+ const raw = String(value || '');+ // MiniCPM5 wraps values containing <, &, or newlines in CDATA. Extract+ // the literal content first so the tag strip below does not eat it.+ const cdataMatch = /^\s*<!\[CDATA\[([\s\S]*?)\]\]>\s*$/.exec(raw);+ if (cdataMatch) return cdataMatch[1];+ const cleaned = raw.replace(/<[^>]+>/g, '').trim();if (!cleaned) return '';@@ -435,13 +440,36 @@ export function parseToolCallsFromText(text, allowedNames) {// XML-ish tool-call format used by some local/chat-template models:// <tool_call><function=click_ax><parameter=ref_id>ref_6</parameter>...const xmlToolRe = /<tool_call>\s*<function(?:\s*=\s*["']?([A-Za-z_]\w*)["']?|\s+name\s*=\s*["']?([A-Za-z_]\w*)["']?)\s*>\s*([\s\S]*?)\s*<\/function>\s*<\/tool_call>/gi;+ const xmlToolSpans = [];let xmlMatch;while ((xmlMatch = xmlToolRe.exec(text)) !== null) {+ xmlToolSpans.push({ start: xmlMatch.index, end: xmlMatch.index + xmlMatch[0].length });const toolName = xmlMatch[1] || xmlMatch[2];if (!allowedNames.has(toolName)) continue;const body = xmlMatch[3] || '';const args = {};- const paramRe = /<parameter(?:\s*=\s*["']?([A-Za-z_]\w*)["']?|\s+name\s*=\s*["']?([A-Za-z_]\w*)["']?)\s*>\s*([\s\S]*?)\s*<\/parameter>/gi;+ const paramRe = /<(?:param|parameter)(?:\s*=\s*["']?([A-Za-z_]\w*)["']?|\s+name\s*=\s*["']?([A-Za-z_]\w*)["']?)\s*>\s*([\s\S]*?)\s*<\/(?:param|parameter)>/gi;+ let paramMatch;+ while ((paramMatch = paramRe.exec(body)) !== null) {+ const key = paramMatch[1] || paramMatch[2];+ if (!key) continue;+ args[key] = parseXmlParamValue(paramMatch[3]);+ }+ results.push({ name: toolName, arguments: args });+ }++ // MiniCPM5-2B native tool format (no outer <tool_call> wrapper):+ // <function name="click"><param name="ref_id">ref_6</param>...</function>+ const minicpmFunctionRe = /<function(?:\s+name\s*=\s*["']([A-Za-z_]\w*)["']|\s*=\s*["']?([A-Za-z_]\w*)["']?)\s*>\s*([\s\S]*?)\s*<\/function>/gi;+ let minicpmMatch;+ while ((minicpmMatch = minicpmFunctionRe.exec(text)) !== null) {+ // Skip functions already consumed inside a <tool_call> wrapper above.+ if (xmlToolSpans.some(span => minicpmMatch.index >= span.start && minicpmMatch.index < span.end)) continue;+ const toolName = minicpmMatch[1] || minicpmMatch[2];+ if (!allowedNames.has(toolName)) continue;+ const body = minicpmMatch[3] || '';+ const args = {};+ const paramRe = /<(?:param|parameter)(?:\s*=\s*["']?([A-Za-z_]\w*)["']?|\s+name\s*=\s*["']?([A-Za-z_]\w*)["']?)\s*>\s*([\s\S]*?)\s*<\/(?:param|parameter)>/gi;let paramMatch;while ((paramMatch = paramRe.exec(body)) !== null) {const key = paramMatch[1] || paramMatch[2];diff --git a/src/chrome/src/offscreen/inference-worker.js b/src/chrome/src/offscreen/inference-worker.jsindex af8ff7ba2..cc657e1ab 100644--- a/src/chrome/src/offscreen/inference-worker.js+++ b/src/chrome/src/offscreen/inference-worker.js@@ -31,6 +31,7 @@ const WEBGPU_LFM25_12B_THINKING_MODEL_ID = 'LiquidAI/LFM2.5-1.2B-Thinking-ONNX';const WEBGPU_LFM25_VL_16B_MODEL_ID = 'LiquidAI/LFM2.5-VL-1.6B-ONNX';const WEBGPU_LFM25_VL_3B_MODEL_ID = 'LiquidAI/LFM2.5-VL-3B-ONNX';const WEBGPU_NANBEIGE42_3B_MODEL_ID = 'Michionlion/Nanbeige4.2-3B-ONNX-WebGPU';+const WEBGPU_MINICPM5_2B_MODEL_ID = 'RASMUS/MiniCPM5-2B-ONNX';const WEBGPU_BONSAI27_MODEL_ID = 'prism-ml/Bonsai-27B-gguf';const WEBGPU_LFM25_MAX_NEW_TOKENS = 2048;const WEBGPU_LFM25_TEXT_MODEL_IDS = new Set([@@ -48,6 +49,7 @@ const WEBGPU_REASONING_MODEL_IDS = new Set([WEBGPU_LFM25_MODEL_ID,WEBGPU_LFM25_12B_THINKING_MODEL_ID,WEBGPU_NANBEIGE42_3B_MODEL_ID,+ WEBGPU_MINICPM5_2B_MODEL_ID,]);// Chat templates that emit the opening `<think>` themselves, so the runtime// only returns the reasoning suffix.@@ -58,6 +60,7 @@ const WEBGPU_OPEN_THINKING_MODEL_IDS = new Set([const WEBGPU_LONG_OUTPUT_MODEL_IDS = new Set([...WEBGPU_LFM25_TEXT_MODEL_IDS,WEBGPU_NANBEIGE42_3B_MODEL_ID,+ WEBGPU_MINICPM5_2B_MODEL_ID,]);// Publisher-recommended decoding for the shipped reasoning presets. Custom// repositories keep Transformers.js greedy defaults.@@ -66,6 +69,8 @@ const WEBGPU_TEXT_SAMPLING = new Map([[WEBGPU_LFM25_12B_THINKING_MODEL_ID, { temperature: 0.05, top_k: 50, repetition_penalty: 1.05 }],// Nanbeige4.2-3B's own generation_config.json.[WEBGPU_NANBEIGE42_3B_MODEL_ID, { temperature: 0.6, top_k: 20, top_p: 0.95 }],+ // MiniCPM5-2B quickstart: temperature=1.0, top_p=0.95.+ [WEBGPU_MINICPM5_2B_MODEL_ID, { temperature: 1.0, top_p: 0.95 }],]);// Nanbeige ships a single WebGPU-fused graph under a non-default file name.// Without this override Transformers.js looks for `onnx/model_q4f16.onnx`,diff --git a/src/chrome/src/providers/webgpu.js b/src/chrome/src/providers/webgpu.jsindex 2e7f6f9bd..b89c0c253 100644--- a/src/chrome/src/providers/webgpu.js+++ b/src/chrome/src/providers/webgpu.js@@ -11,6 +11,7 @@ export const WEBGPU_LFM25_12B_THINKING_MODEL_ID = 'LiquidAI/LFM2.5-1.2B-Thinkingexport const WEBGPU_LFM25_VL_16B_MODEL_ID = 'LiquidAI/LFM2.5-VL-1.6B-ONNX';export const WEBGPU_LFM25_VL_3B_MODEL_ID = 'LiquidAI/LFM2.5-VL-3B-ONNX';export const WEBGPU_NANBEIGE42_3B_MODEL_ID = 'Michionlion/Nanbeige4.2-3B-ONNX-WebGPU';+export const WEBGPU_MINICPM5_2B_MODEL_ID = 'RASMUS/MiniCPM5-2B-ONNX';export const WEBGPU_BONSAI27_MODEL_ID = 'prism-ml/Bonsai-27B-gguf';export const WEBGPU_DTYPE = 'q4f16';export const WEBGPU_BONSAI27_DTYPE = 'q1';@@ -90,6 +91,19 @@ export const WEBGPU_MODEL_PRESETS = Object.freeze([contextWindow: 4096,supportsVision: false,}),+ Object.freeze({+ id: WEBGPU_MINICPM5_2B_MODEL_ID,+ runtime: WEBGPU_RUNTIME_ONNX,+ label: 'MiniCPM5-2B',+ size: '1.83 GB',+ dtype: WEBGPU_DTYPE,+ dtypeLabel: WEBGPU_DTYPE,+ // OpenBMB's base context is 131k, but the practical browser setting stays+ // at 16k like the LFM2.5 text presets: 42 GQA layers cost roughly 42 KB+ // per token in FP16, so 16k needs about 672 MB of cache on top of weights.+ contextWindow: 16384,+ supportsVision: false,+ }),Object.freeze({id: WEBGPU_BONSAI27_MODEL_ID,runtime: WEBGPU_RUNTIME_BITGPU,diff --git a/src/chrome/src/ui/apocalypse-mode.html b/src/chrome/src/ui/apocalypse-mode.htmlindex 25cd60b44..d0a099f57 100644--- a/src/chrome/src/ui/apocalypse-mode.html+++ b/src/chrome/src/ui/apocalypse-mode.html@@ -167,6 +167,10 @@<input type="radio" name="webgpu-text-preset" value="Michionlion/Nanbeige4.2-3B-ONNX-WebGPU" data-webgpu-text-preset><span>Nanbeige4.2-3B</span></label>+ <label class="webgpu-text-preset">+ <input type="radio" name="webgpu-text-preset" value="RASMUS/MiniCPM5-2B-ONNX" data-webgpu-text-preset>+ <span>MiniCPM5-2B</span>+ </label><label class="webgpu-text-preset"><input type="radio" name="webgpu-text-preset" value="prism-ml/Bonsai-27B-gguf" data-webgpu-text-preset><span data-i18n="ap.models.text.bonsai">Basic text model</span>diff --git a/src/firefox/src/agent/tool-call-parser.js b/src/firefox/src/agent/tool-call-parser.jsindex f55ab7bb8..42d680b97 100644--- a/src/firefox/src/agent/tool-call-parser.js+++ b/src/firefox/src/agent/tool-call-parser.js@@ -357,7 +357,12 @@ export function parseToolCallsFromText(text, allowedNames) {const results = [];const parseXmlParamValue = (value) => {- const cleaned = String(value || '')+ const raw = String(value || '');+ // MiniCPM5 wraps values containing <, &, or newlines in CDATA. Extract+ // the literal content first so the tag strip below does not eat it.+ const cdataMatch = /^\s*<!\[CDATA\[([\s\S]*?)\]\]>\s*$/.exec(raw);+ if (cdataMatch) return cdataMatch[1];+ const cleaned = raw.replace(/<[^>]+>/g, '').trim();if (!cleaned) return '';@@ -435,13 +440,36 @@ export function parseToolCallsFromText(text, allowedNames) {// XML-ish tool-call format used by some local/chat-template models:// <tool_call><function=click_ax><parameter=ref_id>ref_6</parameter>...const xmlToolRe = /<tool_call>\s*<function(?:\s*=\s*["']?([A-Za-z_]\w*)["']?|\s+name\s*=\s*["']?([A-Za-z_]\w*)["']?)\s*>\s*([\s\S]*?)\s*<\/function>\s*<\/tool_call>/gi;+ const xmlToolSpans = [];let xmlMatch;while ((xmlMatch = xmlToolRe.exec(text)) !== null) {+ xmlToolSpans.push({ start: xmlMatch.index, end: xmlMatch.index + xmlMatch[0].length });const toolName = xmlMatch[1] || xmlMatch[2];if (!allowedNames.has(toolName)) continue;const body = xmlMatch[3] || '';const args = {};- const paramRe = /<parameter(?:\s*=\s*["']?([A-Za-z_]\w*)["']?|\s+name\s*=\s*["']?([A-Za-z_]\w*)["']?)\s*>\s*([\s\S]*?)\s*<\/parameter>/gi;+ const paramRe = /<(?:param|parameter)(?:\s*=\s*["']?([A-Za-z_]\w*)["']?|\s+name\s*=\s*["']?([A-Za-z_]\w*)["']?)\s*>\s*([\s\S]*?)\s*<\/(?:param|parameter)>/gi;+ let paramMatch;+ while ((paramMatch = paramRe.exec(body)) !== null) {+ const key = paramMatch[1] || paramMatch[2];+ if (!key) continue;+ args[key] = parseXmlParamValue(paramMatch[3]);+ }+ results.push({ name: toolName, arguments: args });+ }++ // MiniCPM5-2B native tool format (no outer <tool_call> wrapper):+ // <function name="click"><param name="ref_id">ref_6</param>...</function>+ const minicpmFunctionRe = /<function(?:\s+name\s*=\s*["']([A-Za-z_]\w*)["']|\s*=\s*["']?([A-Za-z_]\w*)["']?)\s*>\s*([\s\S]*?)\s*<\/function>/gi;+ let minicpmMatch;+ while ((minicpmMatch = minicpmFunctionRe.exec(text)) !== null) {+ // Skip functions already consumed inside a <tool_call> wrapper above.+ if (xmlToolSpans.some(span => minicpmMatch.index >= span.start && minicpmMatch.index < span.end)) continue;+ const toolName = minicpmMatch[1] || minicpmMatch[2];+ if (!allowedNames.has(toolName)) continue;+ const body = minicpmMatch[3] || '';+ const args = {};+ const paramRe = /<(?:param|parameter)(?:\s*=\s*["']?([A-Za-z_]\w*)["']?|\s+name\s*=\s*["']?([A-Za-z_]\w*)["']?)\s*>\s*([\s\S]*?)\s*<\/(?:param|parameter)>/gi;let paramMatch;while ((paramMatch = paramRe.exec(body)) !== null) {const key = paramMatch[1] || paramMatch[2];diff --git a/test/run.js b/test/run.jsindex 449984905..1cb1ccade 100644--- a/test/run.js+++ b/test/run.js@@ -975,6 +975,7 @@ const {WEBGPU_LFM25_VL_16B_MODEL_ID,WEBGPU_LFM25_VL_3B_MODEL_ID,WEBGPU_NANBEIGE42_3B_MODEL_ID,+ WEBGPU_MINICPM5_2B_MODEL_ID,WEBGPU_BONSAI27_MODEL_ID,WEBGPU_MODEL_ID,WEBGPU_MODEL_PRESETS,@@ -62326,6 +62327,7 @@ test('Chrome exposes separate endpoint-free WebGPU text and vision providers', a{ id: WEBGPU_LFM25_VL_16B_MODEL_ID, label: 'LFM2.5-VL-1.6B', runtime: 'onnx-vl', contextWindow: 16384, supportsVision: true },{ id: WEBGPU_LFM25_VL_3B_MODEL_ID, label: 'LFM2.5-VL-3B', runtime: 'onnx-vl', contextWindow: 16384, supportsVision: true },{ id: WEBGPU_NANBEIGE42_3B_MODEL_ID, label: 'Nanbeige4.2-3B', runtime: 'onnx', contextWindow: 4096, supportsVision: false },+ { id: WEBGPU_MINICPM5_2B_MODEL_ID, label: 'MiniCPM5-2B', runtime: 'onnx', contextWindow: 16384, supportsVision: false },{ id: WEBGPU_BONSAI27_MODEL_ID, label: 'Basic text model', runtime: 'bitgpu', contextWindow: 4096, supportsVision: false },]);assert.equal(new WebGPUProvider({ model: WEBGPU_BONSAI27_MODEL_ID }).dtype, 'q1');@@ -63155,6 +63157,7 @@ test('WebGPU worker follows local text-generation and WebBrain VL vision contracWEBGPU_LFM25_VL_16B_MODEL_ID,WEBGPU_LFM25_VL_3B_MODEL_ID,WEBGPU_NANBEIGE42_3B_MODEL_ID,+ WEBGPU_MINICPM5_2B_MODEL_ID,]) {assert.match(apocalypseHtml, new RegExp(modelId.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')),`${modelId} is missing from the Apocalypse WebGPU picker`);@@ -64063,7 +64066,9 @@ test('WebGPU worker replays text tool history and applies model-specific generatconst content = modelId === 'LiquidAI/LFM2.5-2.6B-ONNX'|| modelId === 'Michionlion/Nanbeige4.2-3B-ONNX-WebGPU'? 'private model reasoning</think>Hello!'- : 'text answer';+ : modelId === 'RASMUS/MiniCPM5-2B-ONNX'+ ? '<think>private model reasoning</think>Hello!'+ : 'text answer';return [{ generated_text: [...input, { role: 'assistant', content }] }];};instance.model = {};@@ -64371,6 +64376,26 @@ test('WebGPU worker replays text tool history and applies model-specific generat'the chat path must load the same overridden graph file name as the download path',);+ const minicpmPayload = {+ ...textPayload,+ modelId: WEBGPU_MINICPM5_2B_MODEL_ID,+ };+ await dispatch('download-text', minicpmPayload);+ assert.equal(globalThis.__webgpuPipelineOptions.options.model_file_name, undefined,+ 'MiniCPM5 publishes the default model_q4f16.onnx graph name');+ const minicpmResponse = await dispatch('text-chat', minicpmPayload);+ assert.equal(minicpmResponse.content, 'Hello!');+ assert.equal(minicpmResponse.reasoningContent, 'private model reasoning',+ 'MiniCPM5 emits a full <think> wrapper, so the closed-think branch is the reasoning path');+ assert.deepEqual(globalThis.__webgpuGenerationOptions, {+ do_sample: true,+ temperature: 1.0,+ top_p: 0.95,+ max_new_tokens: 2048,+ tools: undefined,+ tokenizer_encode_kwargs: { preserve_thinking: false },+ }, 'MiniCPM5 must use its quickstart sampling and the reasoning-template argument');+const lfmInstructPayload = {...textPayload,modelId: WEBGPU_LFM25_12B_INSTRUCT_MODEL_ID,@@ -100344,6 +100369,38 @@ test('text tool-call parser is production code with format and allowlist coverag{ name: 'click_ax', args: { ref_id: 'ref_7' } },],},+ {+ label: 'MiniCPM5 bare function with param tags',+ raw: [+ '<function name="click_ax">',+ '<param name="ref_id">ref_7</param>',+ '<param name="force">true</param>',+ '</function>',+ ].join(''),+ expected: [{+ name: 'click_ax',+ args: { ref_id: 'ref_7', force: true },+ }],+ },+ {+ label: 'MiniCPM5 bare function with CDATA value',+ raw: '<function name="read_page"><param name="text"><![CDATA[Keep <b>this</b> & that]]></param></function>',+ expected: [{+ name: 'read_page',+ args: { text: 'Keep <b>this</b> & that' },+ }],+ },+ {+ label: 'MiniCPM5 bare functions preserve order alongside wrapper',+ raw: [+ '<tool_call>{"name":"read_page","arguments":{}}</tool_call>',+ '<function name="click_ax"><param name="ref_id">ref_7</param></function>',+ ].join('\n'),+ expected: [+ { name: 'read_page', args: {} },+ { name: 'click_ax', args: { ref_id: 'ref_7' } },+ ],+ },];for (const parser of [ToolCallParserCh, ToolCallParserFx]) {