Skip to content

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

Settings: suggest the chat model for decisions when Bonsai chats, with D1 as the safer upgrade

Claude155ee96454fc
diff --git a/src/chrome/src/ui/locales/decision-copy.mjs b/src/chrome/src/ui/locales/decision-copy.mjs
index 4b5b1b919..d88814c8e 100644
--- a/src/chrome/src/ui/locales/decision-copy.mjs
+++ b/src/chrome/src/ui/locales/decision-copy.mjs
@@ -2,6 +2,10 @@ export const decisionEnglish = {
'st.d1.provider': 'Local decision model - Experimental',
'st.decision.webgpu_chat': 'In-browser chat model (Ternary Bonsai 2 2B Vision) - Experimental',
'st.decision.webgpu_chat_note': 'Answers decisions with the in-browser WebGPU chat model and a small trained readout, with no extra download. Download Ternary Bonsai 2 2B Vision under Providers first. The first decision after a browser restart loads the model and may fall back to the active model. Not a sole completion authority.',
+ 'st.decision.suggest_chat': 'Your chat model, Ternary Bonsai 2 2B Vision, can also make decisions on this device, with no extra download. For the most reliable completion checks, D1 is the safer choice: fewer false "done" calls and about 3× faster, as a separate 0.95 GB download.',
+ 'st.decision.suggest_upgrade': 'D1 is the safer choice for completion checks: fewer false "done" calls and about 3× faster, as a separate 0.95 GB download.',
+ 'st.decision.use_chat': 'Use my chat model', 'st.decision.use_d1': 'Use D1 (safer)', 'st.decision.suggest_dismiss': 'Not now',
+ 'st.decision.suggest_selected': 'Selected. Click Save to apply.',
'st.d1.warning': 'Experimental on-device decision model, about 0.95 GB download plus tokenizer. Requires hardware WebGPU and substantial GPU memory. Not a chat model or sole completion authority. CPU/WASM control operators may run. Browser support and model decisions are not universally validated.',
'st.d1.consent': 'I accept the experimental local model download from Hugging Face and its memory requirements.',
'st.d1.need_consent': 'Accept the experimental model download consent first.',
@@ -29,6 +33,10 @@ export const decisionTranslations = {
'st.d1.provider': 'Yerel karar modeli — Deneysel',
'st.decision.webgpu_chat': 'Tarayıcı içi sohbet modeli (Ternary Bonsai 2 2B Vision) — Deneysel',
'st.decision.webgpu_chat_note': 'Kararları tarayıcı içi WebGPU sohbet modeli ve küçük bir eğitilmiş okuma katmanıyla verir; ek indirme gerekmez. Önce Sağlayıcılar altında Ternary Bonsai 2 2B Vision modelini indirin. Tarayıcı yeniden başladıktan sonraki ilk karar modeli yükler ve etkin modele geri düşebilir. Tek başına tamamlanma yetkilisi değildir.',
+ 'st.decision.suggest_chat': 'Sohbet modeliniz Ternary Bonsai 2 2B Vision, ek indirme olmadan bu cihazda karar da verebilir. En güvenilir tamamlanma kontrolleri için D1 daha güvenli seçimdir: daha az yanlış "tamamlandı" kararı verir ve yaklaşık 3 kat hızlıdır; ayrıca 0,95 GB indirme gerekir.',
+ 'st.decision.suggest_upgrade': 'Tamamlanma kontrolleri için D1 daha güvenli seçimdir: daha az yanlış "tamamlandı" kararı verir ve yaklaşık 3 kat hızlıdır; ayrıca 0,95 GB indirme gerekir.',
+ 'st.decision.use_chat': 'Sohbet modelimi kullan', 'st.decision.use_d1': "D1'i kullan (daha güvenli)", 'st.decision.suggest_dismiss': 'Şimdi değil',
+ 'st.decision.suggest_selected': "Seçildi. Uygulamak için Kaydet'e tıklayın.",
'st.d1.warning': 'Deneysel yerel karar modeli; tokenizer ile birlikte yaklaşık 0,95 GB indirme. Donanım WebGPU ve yüksek GPU belleği gerekir. Sohbet modeli veya tek başına tamamlanma yetkilisi değildir. CPU/WASM kontrol işlemleri çalışabilir. Her tarayıcı, GPU ve model kararı doğrulanmış değildir.',
'st.d1.consent': 'Hugging Face üzerinden deneysel yerel model indirmesini ve bellek gereksinimlerini kabul ediyorum.',
'st.d1.need_consent': 'Önce deneysel model indirme onayını kabul edin.',
diff --git a/src/chrome/src/ui/settings.html b/src/chrome/src/ui/settings.html
index 1e3e8829c..c3010178e 100644
--- a/src/chrome/src/ui/settings.html
+++ b/src/chrome/src/ui/settings.html
@@ -2264,6 +2264,15 @@
<select id="decision-provider"><option value="openrouter">OpenRouter</option><option value="typesafe">TypeSafe</option><option value="local" data-i18n="st.decision.local"></option><option value="webgpu_d1" data-i18n="st.d1.provider"></option><option value="webgpu_chat" data-i18n="st.decision.webgpu_chat"></option></select>
</div>
<p class="settings-description" id="webgpu-decision-note" hidden data-i18n="st.decision.webgpu_chat_note"></p>
+ <div class="info-box" id="decision-suggestion" hidden style="margin-top:10px;">
+ <p id="decision-suggest-chat" data-i18n="st.decision.suggest_chat" style="margin:0"></p>
+ <p id="decision-suggest-upgrade" data-i18n="st.decision.suggest_upgrade" style="margin:0" hidden></p>
+ <div class="btn-row" style="margin-top:10px;flex-wrap:wrap">
+ <button class="btn-secondary" id="btn-decision-use-chat" data-i18n="st.decision.use_chat"></button>
+ <button class="btn-secondary" id="btn-decision-use-d1" data-i18n="st.decision.use_d1"></button>
+ <button class="btn-secondary" id="btn-decision-suggest-dismiss" data-i18n="st.decision.suggest_dismiss"></button>
+ </div>
+ </div>
<div id="d1-controls" hidden>
<p class="settings-description" data-i18n="st.d1.warning"></p>
<label><input type="checkbox" id="d1-consent"> <span data-i18n="st.d1.consent"></span></label>
diff --git a/src/chrome/src/ui/settings.js b/src/chrome/src/ui/settings.js
index 407d84930..3ce8d59a2 100644
--- a/src/chrome/src/ui/settings.js
+++ b/src/chrome/src/ui/settings.js
@@ -255,7 +255,45 @@ function syncWebgpuDecisionProvider() {
// Lock both controls for D1 and the chat model; restore them otherwise.
if (decisionModelInput) decisionModelInput.readOnly = fixed;
if (systemOneApiKeyInput) systemOneApiKeyInput.disabled = fixed;
-}
+ syncDecisionSuggestion();
+}
+
+// When the active chat model is Ternary Bonsai 2 2B Vision, suggest it as the
+// decision model too (already downloaded), with D1 as the safer, faster
+// completion checker. With the chat model selected, only the D1 upgrade shows.
+const DECISION_SUGGESTION_DISMISSED_KEY = 'webgpuDecisionSuggestionDismissed';
+let decisionSuggestionDismissed = false;
+function activeChatModelIsDecisionCapable() {
+ if (providerDefinitionId(activeProviderId) !== 'webgpu') return false;
+ try { return normalizeWebgpuModelId(providersData[activeProviderId]?.model) === WEBGPU_CHAT_DECISION_MODEL; } catch { return false; }
+}
+function syncDecisionSuggestion() {
+ const box = document.getElementById('decision-suggestion');
+ if (!box || !decisionProviderInput) return;
+ const provider = decisionProviderInput.value;
+ const mode = decisionSuggestionDismissed ? ''
+ : provider === 'webgpu_chat' ? 'upgrade'
+ : provider !== 'webgpu_d1' && activeChatModelIsDecisionCapable() ? 'suggest' : '';
+ box.hidden = !mode;
+ document.getElementById('decision-suggest-chat').hidden = mode !== 'suggest';
+ document.getElementById('decision-suggest-upgrade').hidden = mode !== 'upgrade';
+ document.getElementById('btn-decision-use-chat').hidden = mode !== 'suggest';
+}
+function chooseSuggestedDecisionProvider(provider) {
+ decisionProviderInput.value = provider;
+ decisionProviderInput.dispatchEvent(new Event('change'));
+ if (systemOneEnabledToggle) systemOneEnabledToggle.checked = true;
+ showSystemOneResult('', t('st.decision.suggest_selected'));
+ btnSaveSystemOne?.scrollIntoView({ block: 'center', behavior: 'smooth' });
+ btnSaveSystemOne?.focus({ preventScroll: true });
+}
+document.getElementById('btn-decision-use-chat')?.addEventListener('click', () => chooseSuggestedDecisionProvider('webgpu_chat'));
+document.getElementById('btn-decision-use-d1')?.addEventListener('click', () => chooseSuggestedDecisionProvider('webgpu_d1'));
+document.getElementById('btn-decision-suggest-dismiss')?.addEventListener('click', () => {
+ decisionSuggestionDismissed = true;
+ chrome.storage.local.set({ [DECISION_SUGGESTION_DISMISSED_KEY]: true }).catch(() => {});
+ syncDecisionSuggestion();
+});
const systemOneApiKeyInput = document.getElementById('system-one-api-key');
const systemOneEnabledToggle = document.getElementById('toggle-system-one');
@@ -647,7 +685,7 @@ async function init() {
chrome.storage.local.remove(['authToken', 'authEmail', 'authDefaultModel']).catch(() => {});
// Load display settings
- const stored = await chrome.storage.local.get([...DECISION_SETTINGS_KEYS, 'verboseMode', 'composerDeliveryMode', 'selectionShortcutEnabled', 'pdfViewerEnabled', AUTO_GROUP_TABS_KEY, 'helpImproveWebBrain', 'screenshotFallback', 'maxAgentSteps', 'autoScreenshot', 'useSiteAdapters', 'researchEscalationEnabled', 'researchEscalationEngine', 'voiceInputEnabled', 'alwaysAllowApiMutations', 'apiMutationObserverEnabled', 'webMcpEnabled', 'openaiAskStreamingEnabled', 'planBeforeActMode', 'planBeforeAct', 'planReviewMode', 'planReviewConfidenceThreshold', DOWNLOAD_DIRECTORY_STORAGE_KEY, 'notifySound', 'completionConfetti', 'completionFlashTab', 'tracingEnabled', 'feedbackDiagnosticsEnabled', 'losslessTrace', 'strictSecretMode', 'agentAllowLocalNetwork', 'scheduledTasksEnabled', 'scheduledRequireConsequentialConfirmation', 'systemOneEnabled', 'systemOneWatchEnabled', 'systemOneCompletionEnabled', 'systemOneFastClassifications', 'systemOneFastBrowser', 'systemOneWatchThreshold', 'systemOneCompletionThreshold', 'typesafeApiKey', 'providerFilter', 'requestTimeoutMs', 'clarifyTimeoutSec', 'clarifyTimeoutSemanticsV2', 'costAllowanceSessionUsd', 'costAllowanceTotalUsd', 'meteredProviderCostSpentUsd', 'screenshotRedaction', 'imageDetail', 'maxScreenshotsPerTurn', 'maxImageDimension']);
+ const stored = await chrome.storage.local.get([...DECISION_SETTINGS_KEYS, 'verboseMode', 'composerDeliveryMode', 'selectionShortcutEnabled', 'pdfViewerEnabled', AUTO_GROUP_TABS_KEY, 'helpImproveWebBrain', 'screenshotFallback', 'maxAgentSteps', 'autoScreenshot', 'useSiteAdapters', 'researchEscalationEnabled', 'researchEscalationEngine', 'voiceInputEnabled', 'alwaysAllowApiMutations', 'apiMutationObserverEnabled', 'webMcpEnabled', 'openaiAskStreamingEnabled', 'planBeforeActMode', 'planBeforeAct', 'planReviewMode', 'planReviewConfidenceThreshold', DOWNLOAD_DIRECTORY_STORAGE_KEY, 'notifySound', 'completionConfetti', 'completionFlashTab', 'tracingEnabled', 'feedbackDiagnosticsEnabled', 'losslessTrace', 'strictSecretMode', 'agentAllowLocalNetwork', 'scheduledTasksEnabled', 'scheduledRequireConsequentialConfirmation', 'systemOneEnabled', 'systemOneWatchEnabled', 'systemOneCompletionEnabled', 'systemOneFastClassifications', 'systemOneFastBrowser', 'systemOneWatchThreshold', 'systemOneCompletionThreshold', 'typesafeApiKey', DECISION_SUGGESTION_DISMISSED_KEY, 'providerFilter', 'requestTimeoutMs', 'clarifyTimeoutSec', 'clarifyTimeoutSemanticsV2', 'costAllowanceSessionUsd', 'costAllowanceTotalUsd', 'meteredProviderCostSpentUsd', 'screenshotRedaction', 'imageDetail', 'maxScreenshotsPerTurn', 'maxImageDimension']);
if (typeof stored.providerFilter === 'string' && ['all','active','local','cloud','router'].includes(stored.providerFilter)) {
providerFilter = stored.providerFilter;
}
@@ -758,6 +796,7 @@ async function init() {
decisionDoneToggle.checked = decisionConfig.doneEnabled;
decisionThresholdInput.value = String(decisionConfig.threshold * 100);
await refreshD1Settings();
+ decisionSuggestionDismissed = stored[DECISION_SUGGESTION_DISMISSED_KEY] === true;
syncWebgpuDecisionProvider();
decisionKeyDrafts.set('typesafe', stored.typesafeApiKey || '');
decisionKeyDrafts.set('openrouter', stored.decisionApiKey || '');
@@ -3178,6 +3217,7 @@ async function refreshWebbrainPaymentNotice() {
function renderProviders() {
providersContainer.innerHTML = '';
+ syncDecisionSuggestion();
// Field definitions reference i18n keys (labelKey) so switching languages
// re-renders with translated labels. Placeholders stay as raw values —
@@ -4375,6 +4415,7 @@ async function saveProvider(id, { showFlash = true, markConfigured = true } = {}
function refreshProviderCardStatus(id) {
// Saving a provider marks it configured without rebuilding the list. Keep
// the Active pill in sync even if the card disappeared during the request.
+ syncDecisionSuggestion();
refreshActiveProviderFilterCount();
const card = document.querySelector(`.provider-card[data-provider-id="${id}"]`);
if (!card) return;
diff --git a/src/firefox/src/ui/locales/decision-copy.mjs b/src/firefox/src/ui/locales/decision-copy.mjs
index 4b5b1b919..d88814c8e 100644
--- a/src/firefox/src/ui/locales/decision-copy.mjs
+++ b/src/firefox/src/ui/locales/decision-copy.mjs
@@ -2,6 +2,10 @@ export const decisionEnglish = {
'st.d1.provider': 'Local decision model - Experimental',
'st.decision.webgpu_chat': 'In-browser chat model (Ternary Bonsai 2 2B Vision) - Experimental',
'st.decision.webgpu_chat_note': 'Answers decisions with the in-browser WebGPU chat model and a small trained readout, with no extra download. Download Ternary Bonsai 2 2B Vision under Providers first. The first decision after a browser restart loads the model and may fall back to the active model. Not a sole completion authority.',
+ 'st.decision.suggest_chat': 'Your chat model, Ternary Bonsai 2 2B Vision, can also make decisions on this device, with no extra download. For the most reliable completion checks, D1 is the safer choice: fewer false "done" calls and about 3× faster, as a separate 0.95 GB download.',
+ 'st.decision.suggest_upgrade': 'D1 is the safer choice for completion checks: fewer false "done" calls and about 3× faster, as a separate 0.95 GB download.',
+ 'st.decision.use_chat': 'Use my chat model', 'st.decision.use_d1': 'Use D1 (safer)', 'st.decision.suggest_dismiss': 'Not now',
+ 'st.decision.suggest_selected': 'Selected. Click Save to apply.',
'st.d1.warning': 'Experimental on-device decision model, about 0.95 GB download plus tokenizer. Requires hardware WebGPU and substantial GPU memory. Not a chat model or sole completion authority. CPU/WASM control operators may run. Browser support and model decisions are not universally validated.',
'st.d1.consent': 'I accept the experimental local model download from Hugging Face and its memory requirements.',
'st.d1.need_consent': 'Accept the experimental model download consent first.',
@@ -29,6 +33,10 @@ export const decisionTranslations = {
'st.d1.provider': 'Yerel karar modeli — Deneysel',
'st.decision.webgpu_chat': 'Tarayıcı içi sohbet modeli (Ternary Bonsai 2 2B Vision) — Deneysel',
'st.decision.webgpu_chat_note': 'Kararları tarayıcı içi WebGPU sohbet modeli ve küçük bir eğitilmiş okuma katmanıyla verir; ek indirme gerekmez. Önce Sağlayıcılar altında Ternary Bonsai 2 2B Vision modelini indirin. Tarayıcı yeniden başladıktan sonraki ilk karar modeli yükler ve etkin modele geri düşebilir. Tek başına tamamlanma yetkilisi değildir.',
+ 'st.decision.suggest_chat': 'Sohbet modeliniz Ternary Bonsai 2 2B Vision, ek indirme olmadan bu cihazda karar da verebilir. En güvenilir tamamlanma kontrolleri için D1 daha güvenli seçimdir: daha az yanlış "tamamlandı" kararı verir ve yaklaşık 3 kat hızlıdır; ayrıca 0,95 GB indirme gerekir.',
+ 'st.decision.suggest_upgrade': 'Tamamlanma kontrolleri için D1 daha güvenli seçimdir: daha az yanlış "tamamlandı" kararı verir ve yaklaşık 3 kat hızlıdır; ayrıca 0,95 GB indirme gerekir.',
+ 'st.decision.use_chat': 'Sohbet modelimi kullan', 'st.decision.use_d1': "D1'i kullan (daha güvenli)", 'st.decision.suggest_dismiss': 'Şimdi değil',
+ 'st.decision.suggest_selected': "Seçildi. Uygulamak için Kaydet'e tıklayın.",
'st.d1.warning': 'Deneysel yerel karar modeli; tokenizer ile birlikte yaklaşık 0,95 GB indirme. Donanım WebGPU ve yüksek GPU belleği gerekir. Sohbet modeli veya tek başına tamamlanma yetkilisi değildir. CPU/WASM kontrol işlemleri çalışabilir. Her tarayıcı, GPU ve model kararı doğrulanmış değildir.',
'st.d1.consent': 'Hugging Face üzerinden deneysel yerel model indirmesini ve bellek gereksinimlerini kabul ediyorum.',
'st.d1.need_consent': 'Önce deneysel model indirme onayını kabul edin.',
diff --git a/test/webgpu-decisions.mjs b/test/webgpu-decisions.mjs
index 87189a42d..93de50121 100644
--- a/test/webgpu-decisions.mjs
+++ b/test/webgpu-decisions.mjs
@@ -328,17 +328,43 @@ test('in-browser decisions get their own timeout unless a caller sets a shorter
test('Settings locks the model and key fields for both fixed in-browser providers and restores them otherwise', async () => {
const settings = await readFile(new URL('../src/chrome/src/ui/settings.js', import.meta.url), 'utf8');
- const sync = settings.slice(settings.indexOf('function syncWebgpuDecisionProvider'), settings.indexOf('const systemOneApiKeyInput'));
+ const start = settings.indexOf('function syncWebgpuDecisionProvider');
+ const sync = settings.slice(start, settings.indexOf('\n}\n', start));
assert.match(settings, /const FIXED_WEBGPU_DECISION_PROVIDERS = \['webgpu_d1', 'webgpu_chat'\];/);
assert.match(sync, /const fixed = FIXED_WEBGPU_DECISION_PROVIDERS\.includes\(decisionProviderInput\?\.value\);/);
assert.match(sync, /decisionModelInput\.readOnly = fixed;/);
assert.match(sync, /systemOneApiKeyInput\.disabled = fixed;/);
assert.doesNotMatch(sync, /= true;/, 'nothing is locked only one way');
// d1-settings.js also sets these fields for D1 only; the sync must run after it.
- const awaited = [...settings.matchAll(/await refreshD1Settings\(\);\n\s*(\S+)/g)].map(match => match[1]);
+ const awaited = [...settings.matchAll(/await refreshD1Settings\(\);\n(?:\s*decisionSuggestionDismissed = [^\n]*\n)?\s*(\S+)/g)].map(match => match[1]);
assert.deepEqual(awaited, ['syncWebgpuDecisionProvider();', 'syncWebgpuDecisionProvider();'], 'load and Clear re-sync after D1');
const change = settings.slice(settings.indexOf("decisionProviderInput?.addEventListener('change'"));
assert.match(change.slice(0, change.indexOf('});')), /syncWebgpuDecisionProvider\(\);/);
assert.ok(settings.indexOf('initD1Settings(sendToBackground)') < settings.indexOf("decisionProviderInput?.addEventListener('change'"),
"D1's change listener is registered first, so this one runs last");
});
+
+test('Settings suggests the chat model for decisions when Bonsai chats, with D1 as the safer upgrade', async () => {
+ const html = await readFile(new URL('../src/chrome/src/ui/settings.html', import.meta.url), 'utf8');
+ for (const id of ['decision-suggestion', 'decision-suggest-chat', 'decision-suggest-upgrade', 'btn-decision-use-chat', 'btn-decision-use-d1', 'btn-decision-suggest-dismiss']) {
+ assert.match(html, new RegExp(`id="${id}"`), id);
+ }
+ assert.match(html, /id="decision-suggestion" hidden/, 'hidden until Settings decides');
+ const settings = await readFile(new URL('../src/chrome/src/ui/settings.js', import.meta.url), 'utf8');
+ const sync = settings.slice(settings.indexOf('function activeChatModelIsDecisionCapable'), settings.indexOf('function chooseSuggestedDecisionProvider'));
+ assert.match(sync, /providerDefinitionId\(activeProviderId\) !== 'webgpu'/, 'only when WebGPU is the active chat provider');
+ assert.match(sync, /=== WEBGPU_CHAT_DECISION_MODEL/, 'only for the model with a trained decision probe');
+ assert.match(sync, /provider === 'webgpu_chat' \? 'upgrade'/, 'with the chat model chosen, only the D1 upgrade shows');
+ assert.match(sync, /provider !== 'webgpu_d1' && activeChatModelIsDecisionCapable\(\) \? 'suggest'/, 'nothing once D1 is chosen');
+ assert.match(sync, /decisionSuggestionDismissed \? ''/, '"Not now" hides it');
+ const choose = settings.slice(settings.indexOf('function chooseSuggestedDecisionProvider'), settings.indexOf("document.getElementById('btn-decision-suggest-dismiss')"));
+ assert.match(choose, /dispatchEvent\(new Event\('change'\)\)/, 'uses the normal provider switch, so D1 consent and field locks apply');
+ assert.doesNotMatch(choose, /chrome\.storage\.local\.set/, 'nothing is saved until the user clicks Save');
+ assert.match(settings, /function renderProviders\(\) \{\n\s*providersContainer\.innerHTML = '';\n\s*syncDecisionSuggestion\(\);/, 'follows chat-provider changes');
+ const { decisionEnglish, decisionTranslations } = await import('../src/chrome/src/ui/locales/decision-copy.mjs');
+ for (const key of ['st.decision.suggest_chat', 'st.decision.suggest_upgrade', 'st.decision.use_chat', 'st.decision.use_d1', 'st.decision.suggest_dismiss', 'st.decision.suggest_selected']) {
+ assert.ok(decisionEnglish[key] && decisionTranslations.tr[key], key);
+ }
+ const firefoxHtml = await readFile(new URL('../src/firefox/src/ui/settings.html', import.meta.url), 'utf8');
+ assert.doesNotMatch(firefoxHtml, /decision-suggestion/, 'Chrome only');
+});