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
Docs: tiny Ask for in-browser models; fix stale offline-RAG model and budget
Claude33d4bec1c19a
diff --git a/docs/apocalypse-mode.md b/docs/apocalypse-mode.mdindex a8f17246d..846a04d8e 100644--- a/docs/apocalypse-mode.md+++ b/docs/apocalypse-mode.md@@ -18,10 +18,11 @@ fallback** control in **Settings → Assistive Models → Vision** checks WebGPUrecords explicit consent, and starts caching the approximately 810 MB modelfrom Hugging Face. The download continues in the background, but screenshotoperations report its status and never wait for it. Wikipedia archives still-require their own confirmation. The local **text** model is Compass Tiny v2.1-(`webbrain-one/webbrain-compass-tiny-v2.1`, about 1.87 GB, 32k context-window), and it is the only text preset the picker offers. That download-starts automatically when Apocalypse Mode is enabled. Once downloaded,+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+Mode is enabled. Once downloaded,Compass works without Apocalypse Mode enabled: it is selectable as a chatprovider under Settings → Providers and through the standalone chat control.Disablingdiff --git a/docs/fr/offline-rag.md b/docs/fr/offline-rag.mdindex 61d77ff79..727db7ecf 100644--- a/docs/fr/offline-rag.md+++ b/docs/fr/offline-rag.md@@ -9,9 +9,9 @@ publics couvrant des domaines médicaux, de survie, d'éducation et decommunication.Le chat WebGPU autonome n'a aucun outil. Les passages récupérés sont d'abord-injectés dans le prompt ; le modèle de texte local sélectionné (LFM2.5 2.6B par-défaut, ou Bonsai 27B en option) répond à partir de ces preuves ou indique-qu'il ne peut pas.+injectés dans le prompt ; le modèle de texte WebGPU sélectionné (Compass Tiny+v2.1 par défaut, ou un préréglage Ternary Bonsai 2) répond à partir de ces+preuves ou indique qu'il ne peut pas.## Nouveautés@@ -38,7 +38,7 @@ qu'il ne peut pas.- **Fusion réciproque des classements.** Les résultats lexicaux et sémantiquessont combinés par fusion réciproque, puis diversifiés pour limiter laredondance (max 8 passages, max 2 par document). Le chat WebGPU sur- l'appareil plafonne aussi les preuves injectées à environ 900 jetons pour que+ l'appareil plafonne aussi les preuves injectées à environ 1 800 jetons pour quele modèle local puisse terminer sa réponse.- **Lecteurs de citations locaux.** Les citations Wikipedia ouvrent`wikipedia-reader.html`. Les citations de passages Emergency Box ouvrentdiff --git a/docs/fr/providers-and-models.md b/docs/fr/providers-and-models.mdindex 234887761..f669bc6e0 100644--- a/docs/fr/providers-and-models.md+++ b/docs/fr/providers-and-models.md@@ -125,6 +125,13 @@ fonctionne sans qu’Apocalypse soit activé. Le fournisseur est texte seul, aveune fenêtre de contexte de 32k par défaut ; sur les GPU limités, réduisez-ladans 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+d’abord la page actuelle, la sélection, un onglet PDF et toute page liée dans+la question, puis envoie ce texte avec un prompt court (tiny Ask, voir+`docs/webgpu-models.md`). Les modes Act et Dev sont refusés pour ce+fournisseur ; choisissez-en un autre pour les actions dans le navigateur.+Neuf fournisseurs à terminaison locale sont activés par défaut. Les moteurs demodèles n'exigent pas de clé sauf si le serveur utilise l'authentification ; lacarte proxy générique exige une clé client :diff --git a/docs/offline-rag.md b/docs/offline-rag.mdindex 7538b7c58..b05fed3a8 100644--- a/docs/offline-rag.md+++ b/docs/offline-rag.md@@ -8,8 +8,8 @@ field-reference documents covering medical, survival, education, andcommunication topics.Standalone WebGPU chat has no tools. Retrieved passages are injected into the-prompt first; the selected local text model (LFM2.5 2.6B by default, or opt-in-Bonsai 27B) answers from that evidence or says it cannot.+prompt first; the selected WebGPU text model (Compass Tiny v2.1 by default, or+a Ternary Bonsai 2 preset) answers from that evidence or says it cannot.## What's new@@ -33,7 +33,7 @@ Bonsai 27B) answers from that evidence or says it cannot.- **Reciprocal Rank Fusion.** Lexical and semantic results are combined viareciprocal rank fusion, then diversified to limit redundancy (max 8 passages,max 2 per document). On-device WebGPU chat also caps injected evidence at- about 900 tokens so the local model can finish its answer.+ about 1,800 tokens so the local model can finish its answer.- **Local citation readers.** Wikipedia citations open `wikipedia-reader.html`.Emergency Box passage citations open `emergency-text.html` after re-hashingthe plaintext document. When the matching Emergency Box PDF is installed,diff --git a/docs/providers-and-models.md b/docs/providers-and-models.mdindex 1053290ae..7b1234e02 100644--- a/docs/providers-and-models.md+++ b/docs/providers-and-models.md@@ -433,6 +433,13 @@ context is larger; the browser defaults limit cache growth. Each model has itsown download and readiness state. Changing models preserves already downloadedfiles, and switching back can reuse them.+In-browser models answer questions only. In the side panel, each Ask turn+makes one tool-free call. WebBrain first reads the current page, the+selection, a PDF tab and any page linked in the question, then sends that text+with a short prompt (tiny Ask, see [`docs/webgpu-models.md`](webgpu-models.md)).+Act and Dev mode are refused for this provider; choose another provider for+browser actions. The standalone chat window keeps its own page-free profile.+- [`webbrain-one/webbrain-compass-tiny-v2.1`](https://huggingface.co/webbrain-one/webbrain-compass-tiny-v2.1)(`q4f16`, about 1.87 GB across two external-data shards), WebBrain's CompassTiny v2.1 fine-tune of MiniCPM5-2B for Compact tool routing. It runs greedydiff --git a/docs/webgpu-models.md b/docs/webgpu-models.mdindex 0165712b7..e7b6ab3d6 100644--- a/docs/webgpu-models.md+++ b/docs/webgpu-models.md@@ -32,9 +32,12 @@ stacked up:4. **One giant prefill pass.** Even with a fixed graph, a ~9k-token prompt in asingle decoder pass keeps a GPU that is shared with the display (Applesilicon, a display-attached card) busy for seconds, and the desktop stutters.-5. **Large prompts.** Ask mode sends the full Ask system prompt (~3k tokens)- plus 17 tool schemas (~6k tokens) to in-browser models on every call,- because the compact tier currently only changes Act mode.+5. **Large prompts.** Ask mode sent the full Ask system prompt (~3.4k tokens)+ plus 17 tool schemas (~5.7k tokens) to in-browser models on every call,+ because the compact tier only changes Act mode. The 2B model then often+ called a tool with invalid arguments, which cost another full call: "hello"+ took four calls and 108 s on the display GPU. Tiny Ask (below) replaces+ this path.Two process gaps let this ship. The production harness(`scripts/check-bonsai-webgpu.mjs`) only uses prompts of a few dozen tokens,@@ -109,13 +112,20 @@ Do all of these on the exact files you will publish.In a decoder-only benchmark, 4B prefilled 8,192 tokens in 16 s. Theoriginal Scan graph took 128 s for 1,024 tokens.-4. **Production harness.** Run `scripts/check-bonsai-webgpu.mjs` online and+4. **Ask eval.** Run `scripts/check-webgpu-ask.mjs` through the real extension+ before and after any change to the in-browser prompt, page context or+ runtime. It covers greeting, summary, a fact at the end of a long page,+ prices, a follow-up, arithmetic, a selection, Turkish, a prompt injection,+ an Act request, a linked URL and a browser page. To compare two builds,+ load both from the same `--extension` directory so they share the model+ cache.+5. **Production harness.** Run `scripts/check-bonsai-webgpu.mjs` online and`--offline` (with `--vision --image-history` for vision models) and recordthe evidence with `scripts/models/bonsai/record_browser_validation.py`.-5. **Memory.** Budget weights, plus KV and recurrent cache for the browser+6. **Memory.** Budget weights, plus KV and recurrent cache for the browsercontext, plus transient prefill buffers. Keep every single tensor under2 GB, the per-buffer limit on many adapters.-6. **Rollout.** Browsers keep files cached by URL. If a published file+7. **Rollout.** Browsers keep files cached by URL. If a published filechanges in place, existing installs never see it unless the workerrefreshes it explicitly (see "Updating a published graph").@@ -147,6 +157,28 @@ Use the tools in `scripts/models/bonsai/`:## Runtime behaviour to keep+- **Tiny Ask** (`src/chrome/src/agent/tiny-ask.js`). A side-panel Ask turn+ whose provider is the in-browser model makes one tool-free call.+ - WebBrain reads the current page before the call: `read_page` windows up to+ 60k characters, the selection, PDF text through the `read_pdf` redirect,+ and a page the user linked in the question (`fetch_url`). It sends a+ ~280-token system prompt with that text in untrusted-content wrappers.+ - A long page keeps its opening plus the chunks that share content words+ with the question, in ~9k characters (~2.5k tokens). The first call stays+ near 4k tokens, against ~10k before.+ - Page text is ephemeral: durable history keeps only the question, and each+ turn reads the page again. Offline Wikipedia and Emergency Box references+ are added only when there is no page text.+ - It reuses the standalone WebGPU run machinery but not its prompt or+ history: the standalone window still has no page access, and the two+ profiles' history segments never cross (`webbrainStandaloneChat` and+ `webbrainTinyAsk` markers).+ - Act and Dev are refused for in-browser models, in the agent before+ enrichment and in the side-panel mode toggle.+ - Selection shortcuts keep their own source-bound path.+ - Do not add tools or instructions back to this profile without+ re-running `scripts/check-webgpu-ask.mjs`. Every token is prefilled again+ on every call, and a 2B model picks tools unreliably.- **Sliced prefill.** For the Bonsai 2 Vision presets the worker prefillslong prompts in 512-token slices that carry the recurrent, conv and KVcache, then lets `generate()` continue from that cache.@@ -200,5 +232,5 @@ change in place, as the Bonsai 2 Vision decoders did:- The Bonsai 2 2B **text** preset still points at`danyalmalik/Ternary-Bonsai-2-2B-ONNX-WebGPU`, which fails the audit. Publisha rewritten text repository or point the preset at a passing graph.-- Ask mode should use a compact prompt and a smaller tool set for in-browser- models.+- Selection shortcuts (context-menu "explain", "summarize" and similar) on+ in-browser models still use the full Ask system prompt, without tools.diff --git a/docs/zh-CN/offline-rag.md b/docs/zh-CN/offline-rag.mdindex 4d1e226ec..0eaddd450 100644--- a/docs/zh-CN/offline-rag.md+++ b/docs/zh-CN/offline-rag.md@@ -2,8 +2,8 @@WebBrain 的离线检索增强生成(RAG)流水线允许扩展在没有任何网络连接的情况下,使用本地存储的参考材料回答问题。它建立在末日模式(Apocalypse Mode)的 Wikipedia 存档之上,并新增了紧急语料库(Emergency Box)文本集合——一份涵盖医疗、生存、教育和通信领域公共领域参考文档的精选合集。-独立 WebGPU 聊天没有工具。检索到的段落会先注入提示;所选本地文本模型(默认-LFM2.5 2.6B,或可选 Bonsai 27B)根据这些证据作答,或说明无法回答。切换文本模型+独立 WebGPU 聊天没有工具。检索到的段落会先注入提示;所选 WebGPU 文本模型(默认+Compass Tiny v2.1,或 Ternary Bonsai 2 预设)根据这些证据作答,或说明无法回答。切换文本模型只会改变本地答案生成引擎;检索、证据预算和本地引用流程保持不变。## 新增功能@@ -12,7 +12,7 @@ LFM2.5 2.6B,或可选 Bonsai 27B)根据这些证据作答,或说明无法- **两套检索引擎,不是一套。** Wikipedia 使用已安装的 Kiwix/ZIM **标题索引**(`title-only`),并在档案带有 Xapian 索引时使用已 vendored 的 GPL 全文 worker。Emergency Box 使用随语料库 ZIP 分发的预构建 SQLite **FTS5 BM25** 索引。Wikipedia 不是 FTS5。- **语义向量搜索(仅 Emergency Box)。** 可选的 int8 量化多语言 E5 模型(`Xenova/multilingual-e5-small`,约 140 MB 下载),在同样预计算并随 ZIP 分发的段落嵌入上提供余弦相似度搜索。- **E5 重排序。** 当预构建向量索引对某个源不可用时,可使用同一 E5 模型在设备上对 BM25 候选结果进行重排序。E5 缺失或超时会回退到 BM25,并报告为 `lexical-fallback`(聊天中显示为 “keyword fallback”)。-- **倒数排名融合。** 词汇和语义结果通过倒数排名融合进行合并,然后进行多样化处理以限制冗余(最多 8 个段落,每个文档最多 2 个)。设备端 WebGPU 聊天还会把注入证据限制在约 900 个 token,以便本地模型写完答案。+- **倒数排名融合。** 词汇和语义结果通过倒数排名融合进行合并,然后进行多样化处理以限制冗余(最多 8 个段落,每个文档最多 2 个)。设备端 WebGPU 聊天还会把注入证据限制在约 1,800 个 token,以便本地模型写完答案。- **本地引用阅读器。** Wikipedia 引用打开 `wikipedia-reader.html`。Emergency Box 段落引用在重新校验纯文本文档后打开 `emergency-text.html`。当对应的 Emergency Box PDF 已安装时,同一条引用还会链接到 `emergency-pdf.html`。没有任何引用会导航到在线网页。- **RAG 就绪仪表板。** 折叠在末日模式「应急箱」下的 4 格状态网格,以及侧面板中的同一网格,独立显示 Wikipedia 搜索、紧急库搜索、语义排序和本地答案生成。语料库与语义模型的安装在这里,不在 PDF 书架上。- **源和语言过滤器。** 复选框将检索限制在已安装的源和语言。过滤器在会话之间保持。独立聊天还会按查询路由:在同时选中两个源时,百科类问题只搜 Wikipedia;个人健康和急救问题可以使用两者。diff --git a/docs/zh-CN/providers-and-models.md b/docs/zh-CN/providers-and-models.mdindex aa2a9ffc2..cd5f6cde5 100644--- a/docs/zh-CN/providers-and-models.md+++ b/docs/zh-CN/providers-and-models.md@@ -113,6 +113,8 @@ WebBrain 会直接记录;若服务省略用量,则记录基于字符数的在 Chromium 上,**WebGPU(浏览器内)** 是无端点的本地提供商。末日模式文本选择器仅提供一个内置预设:**Compass Tiny v2.1**(`q4f16`,约 1.87 GB),走 Transformers.js / ONNX,启用末日模式时会自动开始下载。缓存完成后,即使未启用末日模式,Compass 也可正常使用。该提供商仅支持文本,默认上下文窗口为 32k;在显存受限的 GPU 上,可在 Settings → Providers 中将其调低。Firefox 不提供该卡片。+浏览器内模型只回答问题。在侧边栏中,每个 Ask 回合只进行一次不带工具的调用:WebBrain 先读取当前页面、选中文本、PDF 标签页以及问题中链接的页面,再把这些文本和一个简短提示一起发送(tiny Ask,见 `docs/webgpu-models.md`)。该提供商不支持 Act 和 Dev 模式;如需在浏览器中执行操作,请选择其他提供商。+九个本地端点提供商默认启用。模型运行时无需 API 密钥(除非服务器启用了认证);通用代理卡片必须填写客户端密钥: