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: WebGPU Compass Tiny v2.1 only with 32k default, independent of Apocalypse Mode
Emre Sokullu1bc2df7f04d0
diff --git a/src/chrome/src/background.js b/src/chrome/src/background.jsindex 67c465596..91000aa0c 100644--- a/src/chrome/src/background.js+++ b/src/chrome/src/background.js@@ -2173,14 +2173,12 @@ async function standaloneRunProviderId(msg) {if (providerId !== 'webgpu' || msg.standaloneChat !== true) {throw new Error('WebGPU is available only through the standalone chat control.');}- const apocalypse = await apocalypseController.handle('status');- if (apocalypse?.enabled !== true) {- throw new Error('Enable Apocalypse Mode before using WebGPU in standalone chat.');- }+ // Compass Tiny v2.1 works independently of Apocalypse Mode: Apocalypse can+ // still host the download, but its enabled toggle is no longer required.const config = providerManager.getAll().webgpu;const download = await providerManager.getWebgpuDownloadStatus().catch(() => null);if (!isShippedWebgpuPreset(config?.model) || download?.ready !== true) {- throw new Error(`Download ${webgpuModelDisplayName(config?.model || WEBGPU_MODEL_ID)} in Apocalypse Mode before using WebGPU in standalone chat.`);+ throw new Error(`Download ${webgpuModelDisplayName(config?.model || WEBGPU_MODEL_ID)} in Settings > Providers > WebGPU or Apocalypse Mode > WebGPU before using WebGPU in standalone chat.`);}return providerId;}@@ -3942,12 +3940,13 @@ async function handleMessage(msg, sender) {}case 'get_standalone_webgpu_status': {- const apocalypse = await apocalypseController.handle('status');const config = providerManager.getAll().webgpu;const download = await providerManager.getWebgpuDownloadStatus().catch(() => null);return {ok: true,- enabled: apocalypse?.enabled === true,+ // Compass Tiny v2.1 is usable without Apocalypse Mode; the control+ // stays enabled and only tracks download readiness.+ enabled: true,ready: isShippedWebgpuPreset(config?.model) && download?.ready === true,status: download?.status || 'not-downloaded',};diff --git a/src/chrome/src/offscreen/bonsai-worker.js b/src/chrome/src/offscreen/bonsai-worker.jsindex 9bfc0521f..8f4f174d9 100644--- a/src/chrome/src/offscreen/bonsai-worker.js+++ b/src/chrome/src/offscreen/bonsai-worker.js@@ -575,7 +575,7 @@ async function getTextRuntime({ localFilesOnly = false } = {}) {if (textRuntime) return textRuntime;if (textRuntimeLoadPromise) return textRuntimeLoadPromise;if (localFilesOnly && !await isTextModelReady()) {- throw new Error(`${WEBGPU_BONSAI27_MODEL_ID} is not downloaded. Open Apocalypse Mode > WebGPU to download it before chatting.`);+ throw new Error(`${WEBGPU_BONSAI27_MODEL_ID} is not downloaded. Open Settings > Providers > WebGPU or Apocalypse Mode > WebGPU to download it before chatting.`);}textRuntimeLoadPromise = (async () => {const { createEngine: engineCreate, createChat: chatCreate } = await loadLibraries();@@ -831,7 +831,7 @@ function normalizeBitgpuToolCalls(toolCalls) {async function runText(payload) {const modelId = assertBonsaiModel(payload?.modelId);if (!await isTextModelReady(modelId, payload?.dtype || WEBGPU_BONSAI27_DTYPE)) {- throw new Error(`${modelId} is not downloaded. Open Apocalypse Mode > WebGPU to download it before chatting.`);+ throw new Error(`${modelId} is not downloaded. Open Settings > Providers > WebGPU or Apocalypse Mode > WebGPU to download it before chatting.`);}const runtime = await getTextRuntime({ localFilesOnly: true });const requestedTokens = Number(payload?.options?.maxTokens);diff --git a/src/chrome/src/offscreen/inference-worker.js b/src/chrome/src/offscreen/inference-worker.jsindex 173aff0e3..f8994724d 100644--- a/src/chrome/src/offscreen/inference-worker.js+++ b/src/chrome/src/offscreen/inference-worker.js@@ -1311,7 +1311,7 @@ async function runMultimodalText(payload) {decoder_model_merged: 'q4',};if (!await isTextModelReady(modelId, dtype)) {- throw new Error(`${modelId} is not downloaded. Open Apocalypse Mode > WebGPU to download it before chatting.`);+ throw new Error(`${modelId} is not downloaded. Open Settings > Providers > WebGPU or Apocalypse Mode > WebGPU to download it before chatting.`);}const runtime = await getVisionRuntime(modelId, dtype, device, {localFilesOnly: true,@@ -1368,7 +1368,7 @@ async function runText(payload) {const usesLongOutputBudget = WEBGPU_LONG_OUTPUT_MODEL_IDS.has(modelId);const sampling = WEBGPU_TEXT_SAMPLING.get(modelId);if (!await isTextModelReady(modelId, dtype)) {- throw new Error(`${modelId} is not downloaded. Open Apocalypse Mode > WebGPU to download it before chatting.`);+ throw new Error(`${modelId} is not downloaded. Open Settings > Providers > WebGPU or Apocalypse Mode > WebGPU to download it before chatting.`);}const runtime = await getTextRuntime(modelId, dtype, device, { localFilesOnly: true });if (payload?.requireTools === true) assertToolCapableTextRuntime(runtime, modelId);diff --git a/src/chrome/src/providers/manager.js b/src/chrome/src/providers/manager.jsindex 8fe691a65..8e60ff217 100644--- a/src/chrome/src/providers/manager.js+++ b/src/chrome/src/providers/manager.js@@ -8,6 +8,7 @@ import { AwsBedrockProvider } from './aws-bedrock.js';import {WebGPUProvider,WebGPUVisionProvider,+ WEBGPU_COMPASS_TINY_V2_MODEL_ID,WEBGPU_DTYPE,WEBGPU_MODEL_ID,WEBGPU_RUNTIME_BITGPU,@@ -628,10 +629,10 @@ export class ProviderManager {label: 'WebGPU (In-browser)',providerName: 'webgpu',baseUrl: '',- model: WEBGPU_MODEL_ID,+ model: WEBGPU_COMPASS_TINY_V2_MODEL_ID,device: 'webgpu',dtype: WEBGPU_DTYPE,- contextWindow: 16384,+ contextWindow: 32768,promptTier: 'compact',supportsAskStreaming: false,supportsVision: false,@@ -967,6 +968,30 @@ export class ProviderManager {baseUrl: DEEPSEEK_DEFAULT_BASE_URL,};}+ // WebGPU now ships Compass Tiny v2.1 only (32k). Migrate untouched+ // LFM2.5 2.6B 16k defaults so fresh and uncustomized installs land on+ // Compass without wiping an explicitly chosen model.+ if (migrated.webgpu+ && String(migrated.webgpu.model || '').trim() === WEBGPU_MODEL_ID+ && migrated.webgpu.configured !== true+ && Number(migrated.webgpu.contextWindow) === 16384) {+ migrated.webgpu = {+ ...migrated.webgpu,+ model: WEBGPU_COMPASS_TINY_V2_MODEL_ID,+ contextWindow: 32768,+ };+ }+ // Compass itself shipped at 16k before the 32k default. Bump untouched+ // Compass 16k configs to 32k.+ if (migrated.webgpu+ && String(migrated.webgpu.model || '').trim() === WEBGPU_COMPASS_TINY_V2_MODEL_ID+ && migrated.webgpu.configured !== true+ && Number(migrated.webgpu.contextWindow) === 16384) {+ migrated.webgpu = {+ ...migrated.webgpu,+ contextWindow: 32768,+ };+ }this._migrateUntouchedShippedDefaults(migrated);// The OpenCode entry is editable, so only replace the retired shipped// model while it still points at the official Zen endpoint. In particular,@@ -1722,17 +1747,17 @@ export class ProviderManager {return this._webgpuProvider().downloadStatus(msg);}- /** Configure a shipped Apocalypse text preset and start LFM's cache fill. */+ /** Configure a shipped Apocalypse text preset and start Compass cache fill. */async enableAndStartWebgpuTextDownload() {try {const currentModel = this.getAll().webgpu?.model;const preset = webgpuModelPreset(currentModel);- const model = preset?.id || WEBGPU_MODEL_ID;+ const model = preset?.id || WEBGPU_COMPASS_TINY_V2_MODEL_ID;const dtype = preset?.dtype || webgpuModelDtype(model, WEBGPU_DTYPE);await this.updateProvider('webgpu', {model,dtype,- contextWindow: preset?.contextWindow || 16384,+ contextWindow: preset?.contextWindow || 32768,promptTier: 'compact',});const provider = this._webgpuProvider();@@ -1783,7 +1808,7 @@ export class ProviderManager {if (nextProvider instanceof WebGPUProvider) {const download = await nextProvider.downloadStatus();if (!download.ready) {- throw new Error(`Download ${webgpuModelDisplayName(nextProvider.model)} in Apocalypse Mode > WebGPU before selecting it for chat.`);+ throw new Error(`Download ${webgpuModelDisplayName(nextProvider.model)} in Settings > Providers > WebGPU or Apocalypse Mode > WebGPU before selecting it for chat.`);}}this.activeProviderId = id;@@ -1822,6 +1847,12 @@ export class ProviderManager {...updates,configured: id !== WEBBRAIN_CLOUD_PROVIDER_ID && (markConfigured || current.configured === true),};+ if (id === 'webgpu' && Object.hasOwn(updates, 'model')) {+ const preset = webgpuModelPreset(merged.model);+ if (preset?.contextWindow && !Object.hasOwn(updates, 'contextWindow')) {+ merged.contextWindow = preset.contextWindow;+ }+ }if (this._providerDefinitionId(id, current) === 'ollama') {merged.visionMode = OLLAMA_VISION_MODES.has(merged.visionMode) ? merged.visionMode : 'auto';delete merged.supportsVision;diff --git a/src/chrome/src/providers/webgpu.js b/src/chrome/src/providers/webgpu.jsindex 7e4628fb4..078e6f25d 100644--- a/src/chrome/src/providers/webgpu.js+++ b/src/chrome/src/providers/webgpu.js@@ -108,15 +108,14 @@ export const WEBGPU_MODEL_PRESETS = Object.freeze([Object.freeze({id: WEBGPU_COMPASS_TINY_V2_MODEL_ID,runtime: WEBGPU_RUNTIME_ONNX,- label: 'Compass Tiny v2',+ label: 'Compass Tiny v2.1',size: '1.87 GB',dtype: WEBGPU_DTYPE,dtypeLabel: WEBGPU_DTYPE,- // WebBrain Compass Tiny v2 fine-tune of MiniCPM5-2B for Compact tool- // routing. Same 42-layer GQA shape as the base export, so the practical- // browser setting stays at 16k. Tested with thinking disabled and greedy- // decoding, which is the worker's default path for non-reasoning presets.- contextWindow: 16384,+ // WebBrain Compass Tiny v2.1 fine-tune of MiniCPM5-2B for Compact tool+ // routing. Same 42-layer GQA shape as the base export. Default browser+ // context is 32k.+ contextWindow: 32768,supportsVision: false,}),Object.freeze({@@ -130,7 +129,7 @@ export const WEBGPU_MODEL_PRESETS = Object.freeze([supportsVision: false,}),]);-export const WEBGPU_MODEL_NOT_READY_ERROR = `${WEBGPU_MODEL_ID} is not downloaded. Open Apocalypse Mode > WebGPU to download it before chatting.`;+export const WEBGPU_MODEL_NOT_READY_ERROR = `${WEBGPU_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// remote vision credentials or sends a Chromium-only provider type to Firefox.@@ -351,7 +350,7 @@ export class WebGPUProvider extends WebGPUOffscreenProvider {}const download = await this.downloadStatus();if (!download.ready) {- throw new Error(`${webgpuModelDisplayName(this.model)} is not downloaded. Open Apocalypse Mode > WebGPU to download it before chatting.`);+ throw new Error(`${webgpuModelDisplayName(this.model)} is not downloaded. Open Settings > Providers > WebGPU or Apocalypse Mode > WebGPU to download it before chatting.`);}const response = await this._dispatch({type: 'webgpu-chat',diff --git a/src/chrome/src/ui/apocalypse-mode.html b/src/chrome/src/ui/apocalypse-mode.htmlindex 6bfccee9e..bdd9a318c 100644--- a/src/chrome/src/ui/apocalypse-mode.html+++ b/src/chrome/src/ui/apocalypse-mode.html@@ -138,46 +138,12 @@<div class="local-model-body"><div class="local-model-head"><strong data-i18n="ap.models.text.title"></strong>- <span class="meta" data-webgpu-text-size>1.55 GB Ā· WebGPU</span>+ <span class="meta" data-webgpu-text-size>1.87 GB Ā· WebGPU</span></div><div class="webgpu-text-presets" role="radiogroup" aria-label="Local text model"><label class="webgpu-text-preset">- <input type="radio" name="webgpu-text-preset" value="LiquidAI/LFM2.5-2.6B-ONNX" data-webgpu-text-preset checked>- <span data-i18n="ap.models.text.lfm">Minimal text model</span>- </label>- <label class="webgpu-text-preset">- <input type="radio" name="webgpu-text-preset" value="LiquidAI/LFM2.5-1.2B-Instruct-ONNX" data-webgpu-text-preset>- <span>LFM2.5-1.2B-Instruct</span>- </label>- <label class="webgpu-text-preset">- <input type="radio" name="webgpu-text-preset" value="LiquidAI/LFM2.5-1.2B-Thinking-ONNX" data-webgpu-text-preset>- <span>LFM2.5-1.2B-Thinking</span>- </label>- <label class="webgpu-text-preset">- <input type="radio" name="webgpu-text-preset" value="LiquidAI/LFM2.5-VL-1.6B-ONNX" data-webgpu-text-preset>- <span>LFM2.5-VL-1.6B</span>- <span class="webgpu-capability" data-i18n="st.tab.multimodal" data-i18n-title="st.provider.field.supports_vision">Multimodal</span>- </label>- <label class="webgpu-text-preset">- <input type="radio" name="webgpu-text-preset" value="LiquidAI/LFM2.5-VL-3B-ONNX" data-webgpu-text-preset>- <span>LFM2.5-VL-3B</span>- <span class="webgpu-capability" data-i18n="st.tab.multimodal" data-i18n-title="st.provider.field.supports_vision">Multimodal</span>- </label>- <label class="webgpu-text-preset">- <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="webbrain-one/webbrain-compass-tiny-v2.1" data-webgpu-text-preset>- <span>Compass Tiny v2</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>+ <input type="radio" name="webgpu-text-preset" value="webbrain-one/webbrain-compass-tiny-v2.1" data-webgpu-text-preset checked>+ <span>Compass Tiny v2.1</span></label></div><p class="meta" data-webgpu-text-warning hidden data-i18n="ap.models.text.bonsai_warning"></p>diff --git a/src/chrome/src/ui/apocalypse-mode.js b/src/chrome/src/ui/apocalypse-mode.jsindex d19d08aa9..1ecb950d7 100644--- a/src/chrome/src/ui/apocalypse-mode.js+++ b/src/chrome/src/ui/apocalypse-mode.js@@ -21,10 +21,8 @@ import {} from './emergency-download-client.js';import { createOfflineRagReadinessController } from './offline-rag-readiness.js';import {- WEBGPU_BONSAI27_MODEL_ID,+ WEBGPU_COMPASS_TINY_V2_MODEL_ID,WEBGPU_DTYPE,- WEBGPU_MODEL_ID,- WEBGPU_MODEL_PRESETS,WEBGPU_VISION_CONSENT_VERSION,WEBGPU_VISION_CONSENT_VERSION_KEY,WEBGPU_VISION_ENABLED_KEY,@@ -90,7 +88,7 @@ let webgpuDownloadStatusRequest = 0;let webgpuDownloadState = {status: 'checking',ready: false,- modelId: WEBGPU_MODEL_ID,+ modelId: WEBGPU_COMPASS_TINY_V2_MODEL_ID,dtype: WEBGPU_DTYPE,file: '',loaded: 0,@@ -415,27 +413,26 @@ function confirmCompletedModelRemoval(action, status, modelTitleKey) {function selectedWebgpuPreset() {const checked = document.querySelector('[data-webgpu-text-preset]:checked');- return webgpuModelPreset(checked?.value) || webgpuModelPreset(WEBGPU_MODEL_ID);+ return webgpuModelPreset(checked?.value) || webgpuModelPreset(WEBGPU_COMPASS_TINY_V2_MODEL_ID);}function selectedWebgpuModelId() {- return selectedWebgpuPreset()?.id || WEBGPU_MODEL_ID;+ return selectedWebgpuPreset()?.id || WEBGPU_COMPASS_TINY_V2_MODEL_ID;}function updateWebgpuTextPresetUi() {const preset = selectedWebgpuPreset();const size = document.querySelector('[data-webgpu-text-size]');- if (size) size.textContent = `${preset?.size || '1.55 GB'} Ā· WebGPU`;+ if (size) size.textContent = `${preset?.size || '1.87 GB'} Ā· WebGPU`;const warning = document.querySelector('[data-webgpu-text-warning]');- if (warning) warning.hidden = preset?.id !== WEBGPU_BONSAI27_MODEL_ID;+ if (warning) warning.hidden = true;const copy = document.querySelector('[data-webgpu-text-copy]');if (copy) {- const key = preset?.id === WEBGPU_BONSAI27_MODEL_ID ? 'ap.webgpu.rag.pro' : 'ap.webgpu.rag';- copy.dataset.i18n = key;- copy.textContent = t(key);+ copy.dataset.i18n = 'ap.webgpu.rag';+ copy.textContent = t('ap.webgpu.rag');}for (const input of document.querySelectorAll('[data-webgpu-text-preset]')) {- input.checked = input.value === (preset?.id || WEBGPU_MODEL_ID);+ input.checked = input.value === (preset?.id || WEBGPU_COMPASS_TINY_V2_MODEL_ID);}}@@ -511,7 +508,7 @@ async function runVisionDownloadAction(action) {async function ensureFixedWebgpuProvider({ markConfigured = false, force = false } = {}) {const preset = selectedWebgpuPreset();- const model = preset?.id || WEBGPU_MODEL_ID;+ const model = preset?.id || WEBGPU_COMPASS_TINY_V2_MODEL_ID;const dtype = preset?.dtype || webgpuModelDtype(model, WEBGPU_DTYPE);if (!force && fixedWebgpuProviderConfigured && (!markConfigured || fixedWebgpuProviderMarkedReady)) {const current = webgpuDownloadState?.modelId;@@ -522,7 +519,7 @@ async function ensureFixedWebgpuProvider({ markConfigured = false, force = falseconfig: {model,dtype,- contextWindow: preset.contextWindow,+ contextWindow: preset?.contextWindow || 32768,promptTier: 'compact',},markConfigured,@@ -538,10 +535,10 @@ async function refreshWebgpuDownloadStatus({ probeSibling = false } = {}) {let state = await providerCommand('get_webgpu_download_status');if (requestId !== webgpuDownloadStatusRequest) return;let preset = webgpuModelPreset(state?.modelId);- if (!preset) {- // Apocalypse Mode exposes only shipped presets. Retain an active custom- // transfer in the aggregate tracker, then switch the provider to the- // checked shipped preset before rendering its controls.+ if (!preset || preset.id !== WEBGPU_COMPASS_TINY_V2_MODEL_ID) {+ // Only Compass Tiny v2.1 is offered. Retain an active transfer in the+ // aggregate tracker, then switch the provider to Compass before+ // rendering its controls.setWebgpuDownloadState(state);await ensureFixedWebgpuProvider({ force: true });if (requestId !== webgpuDownloadStatusRequest) return;@@ -569,17 +566,9 @@ async function refreshWebgpuDownloadStatus({ probeSibling = false } = {}) {}async function refreshSiblingWebgpuTextStatus(currentModelId, requestId = webgpuDownloadStatusRequest) {- const current = String(currentModelId || selectedWebgpuModelId() || '');- for (const preset of WEBGPU_MODEL_PRESETS) {- if (preset.id === current) continue;- if (requestId !== webgpuDownloadStatusRequest) return;- const sibling = await providerCommand('get_webgpu_download_status', {- model: preset.id,- dtype: preset.dtype,- }).catch(() => null);- if (requestId !== webgpuDownloadStatusRequest) return;- if (sibling && !sibling.error) setWebgpuDownloadState(sibling);- }+ // Only Compass Tiny v2.1 is offered, so there are no unselected shipped+ // text models to probe.+ return;}async function onWebgpuTextPresetChange() {diff --git a/src/chrome/src/ui/locales/en.js b/src/chrome/src/ui/locales/en.jsindex 21621ada4..92f6a9e86 100644--- a/src/chrome/src/ui/locales/en.js+++ b/src/chrome/src/ui/locales/en.js@@ -1116,8 +1116,8 @@ export default {'st.sync.confirm.reset': 'Replace the encrypted cloud copy with this deviceās current WebBrain setup?','st.sync.consent.legacy': 'Turn on encrypted sync? WebBrain will transmit an end-to-end encrypted copy of your memories, profile autofill, and API-key provider settings to WebBrain Compass. Chat history and OAuth sign-ins are not synced.','st.sync.consent.denied': 'Encrypted sync permission was not granted.',- 'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Apocalypse Mode, then use the nuclear control in standalone chat.',- 'st.providers.webgpu_note.managed_body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Apocalypse Mode, then use the nuclear control in standalone chat. It does not replace your selected provider.',+ 'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat.',+ 'st.providers.webgpu_note.managed_body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat. It does not replace your selected provider.','st.providers.webgpu_download.title': 'WebGPU model files','st.providers.webgpu_download.progress_label': 'WebGPU model download progress','st.providers.webgpu_download.checking': 'Checking local model filesā¦',diff --git a/src/chrome/src/ui/settings.js b/src/chrome/src/ui/settings.jsindex fa8eb2ecc..7231f3a03 100644--- a/src/chrome/src/ui/settings.js+++ b/src/chrome/src/ui/settings.js@@ -64,6 +64,7 @@ import { ADDITIONAL_PROVIDER_UI } from '../providers/provider-catalog.js';import { AUTO_VISION_PROVIDER_IDS, visionDetectionMatches } from '../providers/vision-capabilities.js';import { canonicalizeOllamaBaseUrl } from '../providers/context-windows.js';import {+ WEBGPU_COMPASS_TINY_V2_MODEL_ID,WEBGPU_MODEL_PRESETS,WEBGPU_VISION_AUTO_SELECTED_KEY,WEBGPU_VISION_CONSENT_VERSION,@@ -2364,6 +2365,11 @@ const CONTEXT_WINDOW_FIELD = {step: 1024,};+const WEBGPU_CONTEXT_WINDOW_FIELD = {+ ...CONTEXT_WINDOW_FIELD,+ placeholder: '32768',+};+const MAX_OUTPUT_TOKENS_FIELD = {key: 'maxOutputTokens',labelKey: 'st.provider.field.max_output_tokens',@@ -2816,13 +2822,13 @@ function renderProviders() {labelKey: 'st.provider.field.model',type: 'text',placeholder: 'owner/repository',- suggestions: WEBGPU_MODEL_PRESETS.map(option => option.id),- suggestionLabels: Object.fromEntries(WEBGPU_MODEL_PRESETS.map(option => [+ suggestions: [WEBGPU_COMPASS_TINY_V2_MODEL_ID],+ suggestionLabels: Object.fromEntries(WEBGPU_MODEL_PRESETS.filter(option => option.id === WEBGPU_COMPASS_TINY_V2_MODEL_ID).map(option => [option.id,`${option.label} ā ${option.id}${option.supportsVision ? ` ā ${t('st.provider.field.supports_vision')}` : ''}`,])),},- CONTEXT_WINDOW_FIELD,+ WEBGPU_CONTEXT_WINDOW_FIELD,PROMPT_TIER_FIELD,],},@@ -3346,6 +3352,14 @@ function renderProviders() {input.style.display = 'none';input.value = sel.value;}+ if (providerId === 'webgpu' && sel.value !== '__custom__') {+ const preset = WEBGPU_MODEL_PRESETS.find(option => option.id === sel.value);+ if (preset?.contextWindow) {+ const contextInput = document.querySelector(`input[data-provider="${providerId}"][data-key="contextWindow"]`);+ if (contextInput) contextInput.value = String(preset.contextWindow);+ if (providersData[providerId]) providersData[providerId].contextWindow = preset.contextWindow;+ }+ }syncInferredOpenRouterRoutingVariant(providerId, input.value);markProviderDirty(providerId);refreshProviderCompatibilitySummary(providerId);diff --git a/src/chrome/src/ui/sidepanel.js b/src/chrome/src/ui/sidepanel.jsindex 127c00bb4..c4bfc348b 100644--- a/src/chrome/src/ui/sidepanel.js+++ b/src/chrome/src/ui/sidepanel.js@@ -7276,11 +7276,11 @@ function syncStandaloneWebgpuUi() {standaloneWebgpuBtn.classList.toggle('active', standaloneWebgpuActive);standaloneWebgpuBtn.setAttribute('aria-pressed', String(standaloneWebgpuActive));standaloneWebgpuBtn.title = !standaloneWebgpuEnabled- ? 'Enable Apocalypse Mode first'+ ? 'WebGPU is unavailable': standaloneWebgpuActive? standaloneWebgpuReady? 'Using WebGPU for this standalone chat'- : 'Using WebGPU for this standalone chat Ā· download LFM2.5 2.6B before sending'+ : 'Using WebGPU for this standalone chat Ā· download Compass Tiny v2.1 before sending': standaloneWebgpuReady? 'Use WebGPU for this standalone chat': 'Use WebGPU for this standalone chat Ā· model download required';diff --git a/test/run.js b/test/run.jsindex 2d88416f0..f8020d18d 100644--- a/test/run.js+++ b/test/run.js@@ -35580,9 +35580,10 @@ test('Apocalypse Mode keeps summary stats in its header and optional Wikipedia i'chrome: Emergency Box must render locked until basic setup is ready');assert.match(pageScript, /function updateEmergencyBoxGate\(readinessKind\)[\s\S]*?const locked = readinessKind !== 'ready'/,'chrome: Emergency Box is not gated by aggregate readiness');- assert.match(pageScript, /update_provider[\s\S]*?providerId: 'webgpu'[\s\S]*?model,[\s\S]*?contextWindow: preset\.contextWindow/, 'chrome: Apocalypse Mode does not configure the selected WebGPU download');+ assert.match(pageScript, /update_provider[\s\S]*?providerId: 'webgpu'[\s\S]*?model,[\s\S]*?contextWindow: preset\?\.contextWindow/, 'chrome: Apocalypse Mode does not configure the selected WebGPU download');assert.match(pageHtml, /data-webgpu-text-preset/, 'chrome: the local text model picker is missing');- assert.match(pageHtml, /value="prism-ml\/Bonsai-27B-gguf"/, 'chrome: the Bonsai 27B preset is missing');+ assert.match(pageHtml, /value="webbrain-one\/webbrain-compass-tiny-v2\.1"/, 'chrome: the Compass Tiny v2.1 preset is missing');+ assert.doesNotMatch(pageHtml, /value="prism-ml\/Bonsai-27B-gguf"/, 'chrome: only Compass Tiny v2.1 should be offered');assert.doesNotMatch(pageScript, /testWebgpuTextModel|providerCommand\('test_provider', \{ providerId: 'webgpu' \}\)/,'chrome: the removed local text Test action is still wired');assert.match(pageScript, /testWebgpuVisionModel[\s\S]*?providerCommand\('test_vision_provider'\)/,@@ -49062,15 +49063,15 @@ test('standalone WebGPU control uses a per-run provider without changing globalassert.match(panel, /providerSelect\.disabled = standaloneWebgpuActive[\s\S]*?providerPickerBtn\.disabled = standaloneWebgpuActive/,'the ordinary provider picker should lock while the WebGPU override is active');assert.match(panel, /standaloneWebgpuBtn\.disabled = !standaloneWebgpuEnabled/,- 'the nuclear control should be clickable whenever Apocalypse Mode is enabled');+ 'the nuclear control should be clickable whenever WebGPU is available');assert.match(panel, /function standaloneWebgpuRunPayload\(\) \{[\s\S]*?return isStandaloneWindow && standaloneWebgpuActive[\s\S]*?\? \{ providerId: 'webgpu', \.\.\.offlineRagRunPayload\(\) \}[\s\S]*?: \{\};/,'standalone WebGPU state is not carried as a run-scoped override');assert.doesNotMatch(background, /case 'get_providers': \{[\s\S]*?delete providers\.webgpu/,'WebGPU should remain available in the ordinary provider picker');assert.match(background, /case 'set_active_provider': \{\s*await providerManager\.setActive\(msg\.providerId\);/,'WebGPU should use the ordinary global provider activation path');- assert.match(background, /case 'get_standalone_webgpu_status': \{[\s\S]*?enabled: apocalypse\?\.enabled === true[\s\S]*?ready:/,- 'the standalone control should distinguish Apocalypse enablement from model readiness');+ assert.match(background, /case 'get_standalone_webgpu_status': \{[\s\S]*?enabled: true,[\s\S]*?ready:/,+ 'the standalone control should stay enabled independently of Apocalypse Mode and only track model readiness');assert.match(background, /type: 'apocalypse-mode-state'[\s\S]*?enabled: snapshot\.enabled === true/,'open standalone windows should be notified when Apocalypse Mode changes');assert.match(agentSource, /this\._runProviderOverrides = new Map\(\)/);@@ -49090,23 +49091,19 @@ test('standalone WebGPU control uses a per-run provider without changing globalconst helperStart = background.indexOf('async function standaloneRunProviderId(msg) {');const helperEnd = background.indexOf('\n}', helperStart) + 2;assert.ok(helperStart >= 0 && helperEnd > helperStart, 'standalone WebGPU background guard is missing');- const apocalypseState = { enabled: true };const webgpuState = { ready: true };- let webgpuModel = 'LiquidAI/LFM2.5-2.6B-ONNX';+ let webgpuModel = 'webbrain-one/webbrain-compass-tiny-v2.1';const standaloneRunProviderId = vm.runInNewContext(`(${background.slice(helperStart, helperEnd)})`,{WEBGPU_MODEL_ID: 'LiquidAI/LFM2.5-2.6B-ONNX',isShippedWebgpuPreset: (model) => [- 'LiquidAI/LFM2.5-2.6B-ONNX',+ 'webbrain-one/webbrain-compass-tiny-v2.1','prism-ml/Bonsai-27B-gguf',].includes(model),webgpuModelDisplayName: (model) => (- model === 'prism-ml/Bonsai-27B-gguf' ? 'Bonsai 27B' : 'LFM2.5 2.6B'+ model === 'prism-ml/Bonsai-27B-gguf' ? 'Bonsai 27B' : 'Compass Tiny v2.1'),- apocalypseController: {- handle: async () => ({ enabled: apocalypseState.enabled }),- },providerManager: {getAll: () => ({webgpu: { model: webgpuModel },@@ -49123,17 +49120,12 @@ test('standalone WebGPU control uses a per-run provider without changing globalassert.equal(await standaloneRunProviderId({ providerId: 'webgpu', standaloneChat: true }),'webgpu',+ 'Compass Tiny v2.1 must work without Apocalypse Mode enabled',);- apocalypseState.enabled = false;- await assert.rejects(- standaloneRunProviderId({ providerId: 'webgpu', standaloneChat: true }),- /Enable Apocalypse Mode/,- );- apocalypseState.enabled = true;webgpuState.ready = false;await assert.rejects(standaloneRunProviderId({ providerId: 'webgpu', standaloneChat: true }),- /Download LFM2\.5 2\.6B/,+ /Download Compass Tiny v2\.1/,);webgpuState.ready = true;webgpuModel = 'prism-ml/Bonsai-27B-gguf';@@ -62437,10 +62429,11 @@ test('Chrome exposes separate endpoint-free WebGPU text and vision providers', a'switching the shipped vision model must require explicit consent again');assert.equal(WEBGPU_VISION_READY_MARKER_VERSION, 2);assert.match(webgpuVisionReadyMarkerUrl(), /\/webgpu-vision-ready\/v2\/webbrain-one%2Fwebbrain-vl-2-450M-onnx$/);- assert.equal(webgpuConfig.model, WEBGPU_MODEL_ID);+ assert.equal(webgpuConfig.model, WEBGPU_COMPASS_TINY_V2_MODEL_ID);assert.equal(WEBGPU_MODEL_ID, WEBGPU_LFM25_MODEL_ID);assert.equal(webgpuConfig.baseUrl, '');assert.equal(webgpuConfig.dtype, WEBGPU_DTYPE);+ assert.equal(webgpuConfig.contextWindow, 32768);const generalProvider = manager._createProvider('webgpu', webgpuConfig);assert.ok(generalProvider instanceof WebGPUProvider);assert.equal(generalProvider.promptTier, 'compact');@@ -62463,7 +62456,7 @@ test('Chrome exposes separate endpoint-free WebGPU text and vision providers', a{ 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_COMPASS_TINY_V2_MODEL_ID, label: 'Compass Tiny v2', runtime: 'onnx', contextWindow: 16384, supportsVision: false },+ { id: WEBGPU_COMPASS_TINY_V2_MODEL_ID, label: 'Compass Tiny v2.1', runtime: 'onnx', contextWindow: 32768, 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');@@ -62490,13 +62483,13 @@ test('Chrome exposes separate endpoint-free WebGPU text and vision providers', aassert.deepEqual(localResult.toolCalls, returnedToolCalls);assert.deepEqual(sentMessages[1], {type: 'webgpu-download-status',- model: WEBGPU_MODEL_ID,+ model: WEBGPU_COMPASS_TINY_V2_MODEL_ID,runtime: 'onnx',dtype: WEBGPU_DTYPE,});assert.deepEqual(sentMessages[2], {type: 'webgpu-chat',- model: WEBGPU_MODEL_ID,+ model: WEBGPU_COMPASS_TINY_V2_MODEL_ID,runtime: 'onnx',device: 'webgpu',dtype: WEBGPU_DTYPE,@@ -62560,7 +62553,7 @@ test('Chrome exposes separate endpoint-free WebGPU text and vision providers', ageneralProvider.chat([{ role: 'user', content: 'Do not download implicitly.' }]),/not downloaded/,);- await assert.rejects(manager.setActive('webgpu'), /Download Minimal/);+ await assert.rejects(manager.setActive('webgpu'), /Download Compass Tiny/);assert.equal(manager.activeProviderId, 'remote', 'an uncached WebGPU provider must not become active');textModelReady = true;@@ -62570,7 +62563,7 @@ test('Chrome exposes separate endpoint-free WebGPU text and vision providers', aerror => error.isAskStreamTerminalError === true && /OrtRun/.test(error.message),'fatal WebGPU execution failures should bypass the generic network retry',);- webgpuExecutionError = `${WEBGPU_MODEL_ID} used its generation budget before finishing reasoning. Retry with a shorter prompt.`;+ webgpuExecutionError = `${WEBGPU_COMPASS_TINY_V2_MODEL_ID} used its generation budget before finishing reasoning. Retry with a shorter prompt.`;await assert.rejects(generalProvider.chat([{ role: 'user', content: 'Exercise the deterministic token limit.' }]),error => error.isAskStreamTerminalError === true && /generation budget/.test(error.message),@@ -63084,7 +63077,7 @@ test('local vision readiness probes cache before advertising a ready fallback',}});-test('Apocalypse text download fixes the LFM preset and avoids duplicate starts', async () => {+test('Apocalypse text download fixes the Compass preset and avoids duplicate starts', async () => {const previousChrome = globalThis.chrome;const sentMessages = [];const storageWrites = [];@@ -63092,7 +63085,7 @@ test('Apocalypse text download fixes the LFM preset and avoids duplicate starts'let downloadState = {status: 'not-downloaded',ready: false,- modelId: WEBGPU_MODEL_ID,+ modelId: WEBGPU_COMPASS_TINY_V2_MODEL_ID,dtype: WEBGPU_DTYPE,};try {@@ -63150,9 +63143,9 @@ test('Apocalypse text download fixes the LFM preset and avoids duplicate starts''webgpu-download-start',]);const config = manager.getAll().webgpu;- assert.equal(config.model, WEBGPU_MODEL_ID);+ assert.equal(config.model, WEBGPU_COMPASS_TINY_V2_MODEL_ID);assert.equal(config.dtype, WEBGPU_DTYPE);- assert.equal(config.contextWindow, 16384);+ assert.equal(config.contextWindow, 32768);assert.equal(config.promptTier, 'compact');assert.equal(config.configured, true);assert.equal(manager.activeProviderId, 'webbrain_cloud', 'automatic download must not select WebGPU for normal chat');@@ -63166,20 +63159,20 @@ test('Apocalypse text download fixes the LFM preset and avoids duplicate starts'assert.deepEqual(sentMessages.map(message => message.type), ['webgpu-probe','webgpu-download-status',- ], 'an in-progress LFM download must not be queued twice');+ ], 'an in-progress Compass download must not be queued twice');sentMessages.length = 0;hasWebGPU = false;downloadState = {status: 'not-downloaded',ready: false,- modelId: WEBGPU_MODEL_ID,+ modelId: WEBGPU_COMPASS_TINY_V2_MODEL_ID,dtype: WEBGPU_DTYPE,};const unsupported = await manager.enableAndStartWebgpuTextDownload();assert.equal(unsupported.ok, false);assert.deepEqual(sentMessages.map(message => message.type), ['webgpu-probe'],- 'unsupported hardware must fail before starting the LFM download');+ 'unsupported hardware must fail before starting the Compass download');} finally {if (previousChrome === undefined) delete globalThis.chrome;else globalThis.chrome = previousChrome;@@ -63292,19 +63285,24 @@ test('WebGPU worker follows local text-generation and WebBrain VL vision contracassert.ok(ortWasm.includes(Buffer.from('MatMulNBitsMlp')),'the vendored ONNX Runtime build must keep the WebGPU kernel the Nanbeige graph is fused around');for (const modelId of [+ WEBGPU_COMPASS_TINY_V2_MODEL_ID,+ ]) {+ assert.match(apocalypseHtml, new RegExp(modelId.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')),+ `${modelId} is missing from the Apocalypse WebGPU picker`);+ }+ for (const retiredId of [WEBGPU_LFM25_12B_INSTRUCT_MODEL_ID,WEBGPU_LFM25_12B_THINKING_MODEL_ID,WEBGPU_LFM25_VL_16B_MODEL_ID,WEBGPU_LFM25_VL_3B_MODEL_ID,WEBGPU_NANBEIGE42_3B_MODEL_ID,WEBGPU_MINICPM5_2B_MODEL_ID,- WEBGPU_COMPASS_TINY_V2_MODEL_ID,]) {- assert.match(apocalypseHtml, new RegExp(modelId.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')),- `${modelId} is missing from the Apocalypse WebGPU picker`);+ assert.doesNotMatch(apocalypseHtml, new RegExp(retiredId.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')),+ `${retiredId} should no longer be offered in the Apocalypse WebGPU picker`);}- assert.equal((apocalypseHtml.match(/class="webgpu-capability"/g) || []).length, 2,- 'both LFM2.5-VL presets must be visibly marked multimodal');+ assert.equal((apocalypseHtml.match(/class="webgpu-capability"/g) || []).length, 0,+ 'only the text-only Compass preset is offered, so no multimodal badge should remain');assert.match(worker, /decoder_model_merged:\s*'q4'/);assert.match(worker, /const blocks = \[\.\.\.imageBlocks, \.\.\.textBlocks\]/);assert.match(worker, /createVisionProbeImage\(runtime\.library\.RawImage\)/);@@ -63578,14 +63576,16 @@ test('WebGPU worker follows local text-generation and WebBrain VL vision contracassert.match(apocalypseCopy, /'ap\.models\.text\.title': 'Text Model'/);assert.match(apocalypseCopy, /'ap\.models\.vision\.title': 'Vision Model'/);assert.match(apocalypseCopy, /'ap\.models\.wikipedia\.title': 'Wikipedia in Simple English'/);- assert.match(apocalypseHtml, /1\.55 GB Ā· WebGPU/);+ assert.match(apocalypseHtml, /1\.87 GB Ā· WebGPU/);assert.match(apocalypseHtml, /data-webgpu-text-preset/);- assert.match(apocalypseHtml, /value="prism-ml\/Bonsai-27B-gguf"/);+ assert.match(apocalypseHtml, /value="webbrain-one\/webbrain-compass-tiny-v2\.1"/);+ assert.doesNotMatch(apocalypseHtml, /value="prism-ml\/Bonsai-27B-gguf"/);assert.match(apocalypseHtml, /data-i18n="ap\.models\.text\.bonsai_warning"/);assert.match(apocalypseCopy, /'ap\.models\.text\.lfm': 'Minimal text model'/);assert.match(apocalypseCopy, /'ap\.models\.text\.bonsai': 'Basic text model'/);- assert.match(apocalypseHtml, />Minimal text model<\/span>/);- assert.match(apocalypseHtml, />Basic text model<\/span>/);+ assert.match(apocalypseHtml, />Compass Tiny v2\.1<\/span>/);+ assert.doesNotMatch(apocalypseHtml, />Minimal text model<\/span>/);+ assert.doesNotMatch(apocalypseHtml, />Basic text model<\/span>/);assert.doesNotMatch(apocalypseHtml, /Ā· LFM2\.5 2\.6B/);assert.doesNotMatch(apocalypseHtml, /Ā· Bonsai 27B/);assert.match(emergencyCopy, /Runs LFM2\.5 2\.6B on your GPU/);@@ -63597,7 +63597,7 @@ test('WebGPU worker follows local text-generation and WebBrain VL vision contracassert.match(apocalypseScript, /function anyOtherWebgpuTextBusy/);assert.match(background, /getWebgpuDownloadStatus\(msg\)/,'download-status probes must be able to inspect an unselected shipped text model');- assert.match(apocalypseScript, /ap\.webgpu\.rag\.pro/);+ assert.doesNotMatch(apocalypseScript, /ap\.webgpu\.rag\.pro/);assert.match(apocalypseHtml, /data-webgpu-text-copy/);assert.doesNotMatch(apocalypseHtml, /id="webgpu-(?:model|context-window|prompt-tier|save|activate)/);assert.doesNotMatch(apocalypseHtml, /id="webgpu-test"/);@@ -63606,14 +63606,14 @@ test('WebGPU worker follows local text-generation and WebBrain VL vision contracassert.doesNotMatch(apocalypseScript, /normalizeWebgpuModelId|set_active_provider/);assert.doesNotMatch(apocalypseScript, /providerCommand\('test_provider', \{ providerId: 'webgpu' \}\)/);assert.match(apocalypseScript, /providerCommand\('test_vision_provider'\)/);- assert.match(apocalypseScript, /update_provider[\s\S]*?providerId: 'webgpu'[\s\S]*?model,[\s\S]*?contextWindow: preset\.contextWindow[\s\S]*?promptTier: 'compact'/);+ assert.match(apocalypseScript, /update_provider[\s\S]*?providerId: 'webgpu'[\s\S]*?model,[\s\S]*?contextWindow: preset\?\.contextWindow [\s\S]*?promptTier: 'compact'/);assert.doesNotMatch(profileSync, /webgpuVisionEnabled/, 'Chrome-only vision selection must not profile-sync to Firefox');assert.doesNotMatch(profileSync, /webgpuVisionAutoSelected/, 'automatic local-vision provenance must not profile-sync to Firefox');assert.match(englishLocale, /Selecting āUse local fallbackā checks WebGPU, records your consent,[\s\S]*Tasks report its status and never wait for it; keep Chrome open/);assert.match(apocalypseCopy, /Local vision is optional and never starts automatically/);assert.match(apocalypseDocs, /Apocalypse Mode never enables or downloads it/);assert.doesNotMatch(apocalypseDocs, /enabling Apocalypse Mode also enables[\s\S]{0,80}vision/i);- assert.match(englishLocale, /Download it in Apocalypse Mode, then use the nuclear control in standalone chat[\s\S]*It does not replace your selected provider/);+ assert.match(englishLocale, /Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat[\s\S]*It does not replace your selected provider/);const settings = fs.readFileSync(path.join(ROOT, 'src/chrome/src/ui/settings.html'), 'utf8');const multimodal = settings.indexOf('data-panel="multimodal"');@@ -63657,7 +63657,7 @@ test('WebGPU worker follows local text-generation and WebBrain VL vision contracassert.match(bonsaiWorker, /return \{ content, reasoningContent, toolCalls \}/);assert.match(bonsaiWorker, /if \(queuedTextDownload === request\) queuedTextDownload = null/,'a completed download request must not clear a newer queued resume for the same model');- assert.match(apocalypseScript, /if \(!preset\)[\s\S]*?setWebgpuDownloadState\(state\)[\s\S]*?ensureFixedWebgpuProvider\(\{ force: true \}\)[\s\S]*?get_webgpu_download_status/,+ assert.match(apocalypseScript, /if \(!preset \|\| preset\.id !== WEBGPU_COMPASS_TINY_V2_MODEL_ID\)[\s\S]*?setWebgpuDownloadState\(state\)[\s\S]*?ensureFixedWebgpuProvider\(\{ force: true \}\)[\s\S]*?get_webgpu_download_status/,'Apocalypse Mode must replace a persisted custom WebGPU model with the checked shipped preset');const resumeHelpersStart = bonsaiWorker.indexOf('function parseContentRange');const resumeHelpersEnd = bonsaiWorker.indexOf('\n\nasync function fetchGgufForStorage', resumeHelpersStart);