Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

WebGPU: offer only Compass Tiny v2.1 and Bonsai 2 2B Vision for now

Claudecdaae432958f
diff --git a/docs/apocalypse-mode.md b/docs/apocalypse-mode.md
index 846a04d8e..c0942af5d 100644
--- a/docs/apocalypse-mode.md
+++ b/docs/apocalypse-mode.md
@@ -20,8 +20,8 @@ from Hugging Face. The download continues in the background, but screenshot
operations report its status and never wait for it. Wikipedia archives still
require their own confirmation. The default local **text** model is Compass
Tiny v2.1 (`webbrain-one/webbrain-compass-tiny-v2.1`, about 1.87 GB, 32k
-context window); the picker also offers the Ternary Bonsai 2 text and Vision
-presets. The selected model's download starts automatically when Apocalypse
+context window); the picker also offers Ternary Bonsai 2 2B Vision. The other
+Bonsai 2 presets ship but are hidden from the pickers for now. The selected model's download starts automatically when Apocalypse
Mode is enabled. Once downloaded,
Compass works without Apocalypse Mode enabled: it is selectable as a chat
provider under Settings → Providers and through the standalone chat control.
diff --git a/docs/fr/providers-and-models.md b/docs/fr/providers-and-models.md
index f669bc6e0..e99eb682f 100644
--- a/docs/fr/providers-and-models.md
+++ b/docs/fr/providers-and-models.md
@@ -46,7 +46,7 @@ class BaseLLMProvider {
| `localai` | `openai` | local | (modèle chargé) | Métadonnées auto / surcharge |
| `gpt4all` | `openai` | local | (modèle chargé) | Oui (activé par défaut) |
| `local_openai_proxy` | `openai` | local | (requis) | Désactivée / bascule manuelle |
-| `webgpu` (Chromium) | `webgpu` | local | Compass Tiny v2.1 (préréglage unique) ; dépôt HF ONNX personnalisé expérimental | Non |
+| `webgpu` (Chromium) | `webgpu` | local | Compass Tiny v2.1 ; Ternary Bonsai 2 2B Vision ; dépôt HF ONNX personnalisé expérimental | Préréglage Bonsai Vision uniquement |
| `azure_openai` | `azure_openai` | cloud | (déploiement) | Bascule manuelle |
| `aws_bedrock` | `aws_bedrock` | cloud | (ID de modèle) | Non |
| `openai` | `openai` | cloud | `gpt-5.6-terra` | Regex nom de modèle |
@@ -118,12 +118,16 @@ Entrées volontairement exclues : `github-models` (retrait de GitHub Models le
### Fournisseurs Locaux
Sur Chromium, **WebGPU (dans le navigateur)** est un fournisseur local sans
-point de terminaison. Le sélecteur Apocalypse propose un préréglage embarqué
-unique : **Compass Tiny v2.1** (`q4f16`, environ 1,87 Go) via Transformers.js /
-ONNX, téléchargé à l’activation d’Apocalypse. Une fois en cache, Compass
-fonctionne sans qu’Apocalypse soit activé. Le fournisseur est texte seul, avec
-une fenêtre de contexte de 32k par défaut ; sur les GPU limités, réduisez-la
-dans Settings → Providers si nécessaire. Firefox n’expose pas cette carte.
+point de terminaison. Settings et le sélecteur Apocalypse proposent deux
+préréglages : **Compass Tiny v2.1** (par défaut, `q4f16`, environ 1,87 Go,
+texte seul, contexte de 32k) et **Ternary Bonsai 2 2B Vision** (environ
+1,45 Go, accepte les images, contexte de 16k), via Transformers.js / ONNX.
+Settings accepte aussi un dépôt Hugging Face personnalisé. Les autres
+préréglages Bonsai 2 sont livrés mais masqués des sélecteurs pour l’instant.
+Le modèle choisi est téléchargé à l’activation d’Apocalypse ; une fois en
+cache, il fonctionne sans qu’Apocalypse soit activé. Sur les GPU limités,
+réduisez la fenêtre de contexte dans Settings → Providers si nécessaire.
+Firefox n’expose pas cette carte.
Les modèles dans le navigateur répondent seulement aux questions. Dans le
panneau latéral, chaque tour Ask fait un seul appel sans outils : WebBrain lit
diff --git a/docs/providers-and-models.md b/docs/providers-and-models.md
index 7b1234e02..e7b5aa76c 100644
--- a/docs/providers-and-models.md
+++ b/docs/providers-and-models.md
@@ -273,7 +273,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 | Compass Tiny v2.1; Ternary Bonsai 2 2B / 4B, text or vision | Bonsai Vision presets only |
+| `webgpu` (Chromium) | `webgpu` | local | Compass Tiny v2.1; Ternary Bonsai 2 2B Vision; custom HF repo | Bonsai Vision presets only |
| `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 |
@@ -418,14 +418,23 @@ duplicate request.
### Local Providers
On Chromium, **WebGPU (In-browser)** is an endpoint-free local provider.
-Settings and Apocalypse Mode offer the same five presets, in this order:
+Settings and Apocalypse Mode offer the same two presets, in this order, and
+Settings also accepts a custom Hugging Face repository:
| Model | Download | Images | Browser context |
| --- | --- | --- | --- |
| [Compass Tiny v2.1](https://huggingface.co/webbrain-one/webbrain-compass-tiny-v2.1) (default) | 1.87 GB, Q4/FP16 | No | 32k |
+| [Ternary Bonsai 2 2B Vision](https://huggingface.co/webbrain-one/Ternary-Bonsai-2-2B-ONNX-WebGPU-Vision) | 1.45 GB, Q2/FP16 | Yes | 16k |
+
+These presets ship but are hidden from the pickers for now
+(`WEBGPU_HIDDEN_MODEL_IDS` in `src/chrome/src/providers/webgpu.js`). A saved
+selection still loads: Settings shows it as a custom model, and Apocalypse Mode
+switches to an offered preset.
+
+| Model | Download | Images | Browser context |
+| --- | --- | --- | --- |
| [Ternary Bonsai 2 2B](https://huggingface.co/danyalmalik/Ternary-Bonsai-2-2B-ONNX-WebGPU) | 787 MB, Q2/FP16 | No | 16k |
| [Ternary Bonsai 2 4B](https://huggingface.co/Mike0021/Ternary-Bonsai-2-4B-text-ONNX) | 1.50 GB, Q2/FP16 | No | 16k |
-| [Ternary Bonsai 2 2B Vision](https://huggingface.co/webbrain-one/Ternary-Bonsai-2-2B-ONNX-WebGPU-Vision) | 1.45 GB, Q2/FP16 | Yes | 16k |
| [Ternary Bonsai 2 4B Vision](https://huggingface.co/webbrain-one/Ternary-Bonsai-2-4B-ONNX-WebGPU-Vision) | 2.15 GB, Q2/FP16 | Yes | 16k |
Download sizes are approximate and exclude GPU working memory. Bonsai's native
diff --git a/docs/zh-CN/providers-and-models.md b/docs/zh-CN/providers-and-models.md
index cd5f6cde5..557f2897e 100644
--- a/docs/zh-CN/providers-and-models.md
+++ b/docs/zh-CN/providers-and-models.md
@@ -46,7 +46,7 @@ class BaseLLMProvider {
| `localai` | `openai` | 本地 | (已加载模型) | 自动元数据 / 覆盖 |
| `gpt4all` | `openai` | 本地 | (已加载模型) | 是(默认开启) |
| `local_openai_proxy` | `openai` | 本地 | (必填) | 默认关闭 / 手动开关 |
-| `webgpu`(Chromium) | `webgpu` | 本地 | Compass Tiny v2.1(唯一预设);实验性自定义 HF ONNX 仓库 | 否 |
+| `webgpu`(Chromium) | `webgpu` | 本地 | Compass Tiny v2.1;Ternary Bonsai 2 2B Vision;实验性自定义 HF ONNX 仓库 | 仅 Bonsai Vision 预设 |
| `azure_openai` | `azure_openai` | 云端 | (部署) | 手动开关 |
| `aws_bedrock` | `aws_bedrock` | 云端 | (模型 ID) | 否 |
| `openai` | `openai` | 云端 | `gpt-5.6-terra` | 模型名正则 |
@@ -111,7 +111,7 @@ WebBrain 会直接记录;若服务省略用量,则记录基于字符数的
### 本地提供商
-在 Chromium 上,**WebGPU(浏览器内)** 是无端点的本地提供商。末日模式文本选择器仅提供一个内置预设:**Compass Tiny v2.1**(`q4f16`,约 1.87 GB),走 Transformers.js / ONNX,启用末日模式时会自动开始下载。缓存完成后,即使未启用末日模式,Compass 也可正常使用。该提供商仅支持文本,默认上下文窗口为 32k;在显存受限的 GPU 上,可在 Settings → Providers 中将其调低。Firefox 不提供该卡片。
+在 Chromium 上,**WebGPU(浏览器内)** 是无端点的本地提供商。Settings 和末日模式选择器提供两个预设:**Compass Tiny v2.1**(默认,`q4f16`,约 1.87 GB,仅文本,32k 上下文)和 **Ternary Bonsai 2 2B Vision**(约 1.45 GB,支持图片,16k 上下文),走 Transformers.js / ONNX;Settings 还接受自定义 Hugging Face 仓库。其他 Bonsai 2 预设随扩展提供,但暂时不在选择器中显示。启用末日模式时会自动下载所选模型;缓存完成后,即使未启用末日模式也可正常使用。在显存受限的 GPU 上,可在 Settings → Providers 中调低上下文窗口。Firefox 不提供该卡片。
浏览器内模型只回答问题。在侧边栏中,每个 Ask 回合只进行一次不带工具的调用:WebBrain 先读取当前页面、选中文本、PDF 标签页以及问题中链接的页面,再把这些文本和一个简短提示一起发送(tiny Ask,见 `docs/webgpu-models.md`)。该提供商不支持 Act 和 Dev 模式;如需在浏览器中执行操作,请选择其他提供商。
diff --git a/src/chrome/src/providers/webgpu.js b/src/chrome/src/providers/webgpu.js
index 1ee047eb5..81df4bf90 100644
--- a/src/chrome/src/providers/webgpu.js
+++ b/src/chrome/src/providers/webgpu.js
@@ -183,13 +183,25 @@ export const WEBGPU_MODEL_PRESETS = Object.freeze([
]);
// Keep legacy presets loadable without offering them for new selections.
// Both Chrome pickers use this order; Firefox has no offscreen chat runtime.
-export const WEBGPU_SELECTABLE_MODEL_PRESETS = Object.freeze([
+// The Apocalypse Mode markup lists every preset here in the same order.
+export const WEBGPU_PICKER_MODEL_IDS = Object.freeze([
WEBGPU_COMPASS_TINY_V2_MODEL_ID,
WEBGPU_BONSAI2_2B_MODEL_ID,
WEBGPU_BONSAI2_4B_MODEL_ID,
WEBGPU_BONSAI2_VL_2B_MODEL_ID,
WEBGPU_BONSAI2_VL_4B_MODEL_ID,
-].map(id => WEBGPU_MODEL_PRESETS.find(preset => preset.id === id)));
+]);
+// Shipped and loadable, but not offered in the pickers yet. To show one again,
+// remove its id here. A saved selection still loads: Settings shows it as a
+// custom model, and Apocalypse Mode switches to an offered preset.
+export const WEBGPU_HIDDEN_MODEL_IDS = Object.freeze([
+ WEBGPU_BONSAI2_2B_MODEL_ID,
+ WEBGPU_BONSAI2_4B_MODEL_ID,
+ WEBGPU_BONSAI2_VL_4B_MODEL_ID,
+]);
+export const WEBGPU_SELECTABLE_MODEL_PRESETS = Object.freeze(WEBGPU_PICKER_MODEL_IDS
+ .filter(id => !WEBGPU_HIDDEN_MODEL_IDS.includes(id))
+ .map(id => WEBGPU_MODEL_PRESETS.find(preset => preset.id === id)));
export const WEBGPU_MODEL_NOT_READY_ERROR = `${WEBGPU_COMPASS_TINY_V2_MODEL_ID} is not downloaded. Open Settings > Providers > WebGPU or Apocalypse Mode > WebGPU to download it before chatting.`;
// Chrome-only selection state. Keep this separate from the synced
// `visionModel` endpoint so enabling the fallback never overwrites a user's
diff --git a/src/chrome/src/ui/apocalypse-mode.js b/src/chrome/src/ui/apocalypse-mode.js
index ccbb843cb..74f270be5 100644
--- a/src/chrome/src/ui/apocalypse-mode.js
+++ b/src/chrome/src/ui/apocalypse-mode.js
@@ -62,6 +62,11 @@ const elements = Object.fromEntries([
'emergency-box-callout', 'emergency-gate-reason', 'emergency-box-link',
'offline-answer-engine', 'offline-rag-readiness', 'rag-components',
].map(id => [id, document.getElementById(id)]));
+// The markup lists every picker preset; drop the ones not offered yet before
+// any selection or listener code sees them.
+for (const input of document.querySelectorAll('[data-webgpu-text-preset]')) {
+ if (!isSelectableWebgpuPreset(input.value)) input.closest('.webgpu-text-preset')?.remove();
+}
if (elements['vision-model-card']) elements['vision-model-card'].hidden = !supportsWebgpuVision;
if (elements['webgpu-provider-card']) elements['webgpu-provider-card'].hidden = !supportsWebgpuVision;
if (elements['basic-wikipedia-card']) elements['basic-wikipedia-card'].hidden = !supportsWebgpuVision;
diff --git a/test/quality/webgpu-presets-mv3.mjs b/test/quality/webgpu-presets-mv3.mjs
index 504c2a1f2..bff101aef 100644
--- a/test/quality/webgpu-presets-mv3.mjs
+++ b/test/quality/webgpu-presets-mv3.mjs
@@ -74,14 +74,15 @@ try {
}, preset.id);
assert.ok((await page.locator('[data-webgpu-text-copy]').textContent()).includes(preset.label));
}
- await message('update_provider', { providerId: 'webgpu', config: { model: ids[1], contextWindow: 4096 } });
- await page.waitForFunction(id => document.querySelector('[data-webgpu-text-preset]:checked')?.value === id, ids[1]);
+ // The loop above left the last preset selected; adopt a different one.
+ await message('update_provider', { providerId: 'webgpu', config: { model: ids[0], contextWindow: 4096 } });
+ await page.waitForFunction(id => document.querySelector('[data-webgpu-text-preset]:checked')?.value === id, ids[0]);
assert.equal((await message('get_providers')).providers.webgpu.contextWindow, 4096,
'polling must adopt an external Settings selection without overwriting its context budget');
await page.setViewportSize({ width: 390, height: 900 });
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth > innerWidth), false);
assert.deepEqual(errors, []);
- console.log('PASS: installed MV3 Settings and Apocalypse offer five presets; saved capabilities/context/tier, external selection changes, normal provider selection, and mobile layout verified. Cache readiness was mocked; no inference performed.');
+ console.log('PASS: installed MV3 Settings and Apocalypse offer only the visible presets (hidden ones stay out of both pickers); saved capabilities/context/tier, external selection changes, normal provider selection, and mobile layout verified. Cache readiness was mocked; no inference performed.');
} finally {
await context?.close();
const resolvedProfile = path.resolve(profile);
diff --git a/test/run.js b/test/run.js
index ab3e3e848..b028b79dd 100644
--- a/test/run.js
+++ b/test/run.js
@@ -1047,6 +1047,8 @@ const {
WEBGPU_MODEL_ID,
WEBGPU_MODEL_PRESETS,
WEBGPU_SELECTABLE_MODEL_PRESETS,
+ WEBGPU_PICKER_MODEL_IDS,
+ WEBGPU_HIDDEN_MODEL_IDS,
WEBGPU_VISION_DTYPE,
WEBGPU_VISION_AUTO_SELECTED_KEY,
WEBGPU_VISION_CONSENT_VERSION,
@@ -65626,12 +65628,26 @@ test('failed sensitive field-tool readbacks are annotated and redacted', () => {
console.log('\nprovider categorization');
test('Bonsai WebGPU presets preserve ordered selection and model-specific image capabilities', async () => {
- const expectedIds = [WEBGPU_COMPASS_TINY_V2_MODEL_ID, WEBGPU_BONSAI2_2B_MODEL_ID, WEBGPU_BONSAI2_4B_MODEL_ID,
+ const pickerIds = [WEBGPU_COMPASS_TINY_V2_MODEL_ID, WEBGPU_BONSAI2_2B_MODEL_ID, WEBGPU_BONSAI2_4B_MODEL_ID,
WEBGPU_BONSAI2_VL_2B_MODEL_ID, WEBGPU_BONSAI2_VL_4B_MODEL_ID];
- assert.deepEqual(WEBGPU_SELECTABLE_MODEL_PRESETS.map(preset => preset.id), expectedIds);
+ assert.deepEqual(WEBGPU_PICKER_MODEL_IDS, pickerIds);
+ // Only Compass Tiny and Bonsai 2 2B Vision are offered for now; the rest
+ // stay shipped and loadable until they are shown again.
+ const offeredIds = [WEBGPU_COMPASS_TINY_V2_MODEL_ID, WEBGPU_BONSAI2_VL_2B_MODEL_ID];
+ assert.deepEqual(WEBGPU_SELECTABLE_MODEL_PRESETS.map(preset => preset.id), offeredIds);
+ assert.deepEqual(WEBGPU_HIDDEN_MODEL_IDS, [WEBGPU_BONSAI2_2B_MODEL_ID, WEBGPU_BONSAI2_4B_MODEL_ID, WEBGPU_BONSAI2_VL_4B_MODEL_ID]);
+ for (const id of WEBGPU_HIDDEN_MODEL_IDS) {
+ assert.equal(isSelectableWebgpuPreset(id), false, `${id} should be hidden from the pickers`);
+ assert.equal(isShippedWebgpuPreset(id), true, `${id} must stay shipped and loadable`);
+ }
const html = fs.readFileSync(path.join(ROOT, 'src/chrome/src/ui/apocalypse-mode.html'), 'utf8');
- assert.deepEqual([...html.matchAll(/<input[^>]+value="([^"]+)"[^>]*data-webgpu-text-preset/g)].map(match => match[1]), expectedIds,
- 'the Apocalypse radio choices must stay in the same order as the Settings suggestions');
+ assert.deepEqual([...html.matchAll(/<input[^>]+value="([^"]+)"[^>]*data-webgpu-text-preset/g)].map(match => match[1]), pickerIds,
+ 'the Apocalypse radio markup must list every picker preset in the Settings order');
+ const apocalypseSource = fs.readFileSync(path.join(ROOT, 'src/chrome/src/ui/apocalypse-mode.js'), 'utf8');
+ const prune = apocalypseSource.indexOf("if (!isSelectableWebgpuPreset(input.value)) input.closest('.webgpu-text-preset')?.remove();");
+ assert.ok(prune > 0, 'Apocalypse Mode must drop the radios of hidden presets');
+ assert.ok(prune < apocalypseSource.indexOf("document.querySelectorAll('[data-webgpu-text-preset]').forEach((input) => {"),
+ 'hidden radios must be dropped before listeners are attached');
assert.equal(isSelectableWebgpuPreset(''), false);
assert.equal(isSelectableWebgpuPreset(WEBGPU_BONSAI27_MODEL_ID), false);
assert.equal(isShippedWebgpuPreset(WEBGPU_BONSAI27_MODEL_ID), true, 'saved legacy presets must remain loadable');
@@ -65640,7 +65656,7 @@ test('Bonsai WebGPU presets preserve ordered selection and model-specific image
manager.save = async () => {};
manager.providers.set('webgpu', new WebGPUProvider(manager._defaultConfigs().webgpu));
const messages = [{ role: 'user', content: [{ type: 'image_url', image_url: { url: 'data:image/png;base64,AA==' } }] }];
- for (const preset of WEBGPU_SELECTABLE_MODEL_PRESETS) {
+ for (const preset of pickerIds.map(id => webgpuModelPreset(id))) {
await manager.updateProvider('webgpu', { model: preset.id });
const provider = manager.providers.get('webgpu');
assert.equal(manager.getAll().webgpu.contextWindow, preset.contextWindow);
@@ -65705,16 +65721,16 @@ test('Apocalypse hydrates every selectable Bonsai preset and inspects sibling ca
vm.runInContext(functions, context);
await vm.runInContext('refreshWebgpuDownloadStatus({ probeSibling: true })', context);
assert.equal(selectedId, preset.id, 'opening Apocalypse must preserve the selected Bonsai variant');
- assert.equal(queried.length, 5);
+ assert.equal(queried.length, WEBGPU_SELECTABLE_MODEL_PRESETS.length);
assert.deepEqual(new Set(queried), new Set(WEBGPU_SELECTABLE_MODEL_PRESETS.map(option => option.id)));
- assert.equal(recorded.length, 4);
+ assert.equal(recorded.length, WEBGPU_SELECTABLE_MODEL_PRESETS.length - 1);
}
});
test('Apocalypse ignores stale preset status while saving and retains the selected model after a failed download', async () => {
const source = fs.readFileSync(path.join(ROOT, 'src/chrome/src/ui/apocalypse-mode.js'), 'utf8');
const functions = source.slice(source.indexOf('async function ensureFixedWebgpuProvider('), source.indexOf('async function runWebgpuDownloadAction('));
- const target = WEBGPU_BONSAI2_VL_4B_MODEL_ID;
+ const target = WEBGPU_BONSAI2_VL_2B_MODEL_ID;
let selected = WEBGPU_COMPASS_TINY_V2_MODEL_ID;
let saved = selected;
let releaseOldStatus;