system HF Staff commited on
Commit
57fd109
ยท
verified ยท
1 Parent(s): 125276b

Sync from felladrin/MiniSearch@79128cb

Browse files
.env.example CHANGED
@@ -4,9 +4,12 @@ ACCESS_KEYS=""
4
  # The timeout in hours for access key validation. Set to 0 to require validation on every page load.
5
  ACCESS_KEY_TIMEOUT_HOURS="24"
6
 
7
- # The default model ID for Wllama.
8
  WLLAMA_DEFAULT_MODEL_ID="littlelamb-290m"
9
 
 
 
 
10
  # The base URL for the internal OpenAI compatible API. Example: `INTERNAL_OPENAI_COMPATIBLE_API_BASE_URL="https://api.openai.com/v1"`. Leave blank to disable internal OpenAI compatible API.
11
  INTERNAL_OPENAI_COMPATIBLE_API_BASE_URL=""
12
 
 
4
  # The timeout in hours for access key validation. Set to 0 to require validation on every page load.
5
  ACCESS_KEY_TIMEOUT_HOURS="24"
6
 
7
+ # The default model ID for Wllama in browsers without WebGPU, where the model runs on the CPU.
8
  WLLAMA_DEFAULT_MODEL_ID="littlelamb-290m"
9
 
10
+ # The default model ID for Wllama in browsers with WebGPU.
11
+ WLLAMA_DEFAULT_GPU_MODEL_ID="gemma-3-4b"
12
+
13
  # The base URL for the internal OpenAI compatible API. Example: `INTERNAL_OPENAI_COMPATIBLE_API_BASE_URL="https://api.openai.com/v1"`. Leave blank to disable internal OpenAI compatible API.
14
  INTERNAL_OPENAI_COMPATIBLE_API_BASE_URL=""
15
 
.github/CODE_OF_CONDUCT.md CHANGED
@@ -9,6 +9,7 @@ We pledge to act and interact in ways that contribute to an open, welcoming, div
9
  ## Our Standards
10
 
11
  Examples of behavior that contributes to a positive environment for our community include:
 
12
  - Demonstrating empathy and kindness toward other people
13
  - Being respectful of differing opinions, viewpoints, and experiences
14
  - Giving and gracefully accepting constructive feedback
@@ -16,6 +17,7 @@ Examples of behavior that contributes to a positive environment for our communit
16
  - Focusing on what is best not just for us as individuals, but for the overall community
17
 
18
  Examples of unacceptable behavior include:
 
19
  - The use of sexualized language or imagery, and sexual attention or advances of any kind
20
  - Trolling, insulting or derogatory comments, and personal or political attacks
21
  - Public or private harassment
@@ -35,6 +37,7 @@ This Code of Conduct applies within all community spaces, and also applies when
35
  ## Enforcement
36
 
37
  Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at:
 
38
  - GitHub: [@felladrin](https://github.com/felladrin)
39
  - Email: (private contact can be provided upon request)
40
 
 
9
  ## Our Standards
10
 
11
  Examples of behavior that contributes to a positive environment for our community include:
12
+
13
  - Demonstrating empathy and kindness toward other people
14
  - Being respectful of differing opinions, viewpoints, and experiences
15
  - Giving and gracefully accepting constructive feedback
 
17
  - Focusing on what is best not just for us as individuals, but for the overall community
18
 
19
  Examples of unacceptable behavior include:
20
+
21
  - The use of sexualized language or imagery, and sexual attention or advances of any kind
22
  - Trolling, insulting or derogatory comments, and personal or political attacks
23
  - Public or private harassment
 
37
  ## Enforcement
38
 
39
  Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at:
40
+
41
  - GitHub: [@felladrin](https://github.com/felladrin)
42
  - Email: (private contact can be provided upon request)
43
 
.github/CONTRIBUTING.md CHANGED
@@ -22,6 +22,7 @@ docker compose exec development-server npm run lint
22
  ```
23
 
24
  This runs:
 
25
  - Biome (formatting/linting)
26
  - TypeScript (type checking)
27
  - knip (dead code detection)
 
22
  ```
23
 
24
  This runs:
25
+
26
  - Biome (formatting/linting)
27
  - TypeScript (type checking)
28
  - knip (dead code detection)
.github/SECURITY.md CHANGED
@@ -20,6 +20,7 @@ Report security vulnerabilities through GitHub's [Private Vulnerability Reportin
20
  ### What to Include
21
 
22
  When reporting a vulnerability, please include:
 
23
  - A clear description of the vulnerability
24
  - Steps to reproduce the issue
25
  - Potential impact of the vulnerability
@@ -60,23 +61,27 @@ When reporting a vulnerability, please include:
60
  MiniSearch is designed as a privacy-focused search application with the following security assumptions:
61
 
62
  **Trust Boundaries:**
 
63
  - **Browser Environment**: The application runs entirely in the user's browser
64
  - **Server Component**: Optional backend for search and AI processing
65
  - **AI Models**: Local or remote AI processing with configurable endpoints
66
 
67
  **Data Flow:**
 
68
  - User queries are sent to SearXNG instances (configurable)
69
  - AI processing can be local (Wllama) or remote (API endpoints)
70
  - Search history is stored locally in the browser
71
  - No tracking or analytics by default
72
 
73
  **Security Controls:**
 
74
  - Optional access key protection for deployment
75
  - Configurable AI endpoints for privacy
76
  - Local-first data storage
77
  - No third-party tracking or analytics
78
 
79
  **Potential Risks:**
 
80
  - Malicious SearXNG instances could log queries
81
  - Remote AI endpoints could access user queries
82
  - Browser extensions could interfere with the application
@@ -118,6 +123,7 @@ A few of MiniSearch's dependencies ship native code or WebAssembly rather than a
118
  ### Approving a new install script
119
 
120
  Under `strict-allow-scripts`, any package that ships an install script without a recorded decision fails the install. To unblock it, a maintainer must:
 
121
  1. Read the script first (`npm view <pkg> scripts`, or the unpacked tarball) and decide whether it is acceptable.
122
  2. Record the decision: `npm approve-scripts <pkg>` writes a version-pinned `"<name>@<version>": true` entry to `package.json#allowScripts` (`allow-scripts-pin` is on); `npm deny-scripts <pkg>` writes `"<name>": false`, denying every version of the package.
123
  3. Update the decision list above in the same PR, with the reasoning.
@@ -156,6 +162,7 @@ Because native/WASM deps are exact pins, a Renovate bump arrives as a one-line v
156
  ## Security Updates
157
 
158
  Security updates will be:
 
159
  - Released as new versions
160
  - Announced in release notes
161
  - Coordinated with dependency updates when applicable
@@ -163,6 +170,7 @@ Security updates will be:
163
  ## Security Team
164
 
165
  The MiniSearch security team is currently the project maintainer:
 
166
  - [@felladrin](https://github.com/felladrin) - Project Maintainer
167
 
168
  ## Acknowledgments
 
20
  ### What to Include
21
 
22
  When reporting a vulnerability, please include:
23
+
24
  - A clear description of the vulnerability
25
  - Steps to reproduce the issue
26
  - Potential impact of the vulnerability
 
61
  MiniSearch is designed as a privacy-focused search application with the following security assumptions:
62
 
63
  **Trust Boundaries:**
64
+
65
  - **Browser Environment**: The application runs entirely in the user's browser
66
  - **Server Component**: Optional backend for search and AI processing
67
  - **AI Models**: Local or remote AI processing with configurable endpoints
68
 
69
  **Data Flow:**
70
+
71
  - User queries are sent to SearXNG instances (configurable)
72
  - AI processing can be local (Wllama) or remote (API endpoints)
73
  - Search history is stored locally in the browser
74
  - No tracking or analytics by default
75
 
76
  **Security Controls:**
77
+
78
  - Optional access key protection for deployment
79
  - Configurable AI endpoints for privacy
80
  - Local-first data storage
81
  - No third-party tracking or analytics
82
 
83
  **Potential Risks:**
84
+
85
  - Malicious SearXNG instances could log queries
86
  - Remote AI endpoints could access user queries
87
  - Browser extensions could interfere with the application
 
123
  ### Approving a new install script
124
 
125
  Under `strict-allow-scripts`, any package that ships an install script without a recorded decision fails the install. To unblock it, a maintainer must:
126
+
127
  1. Read the script first (`npm view <pkg> scripts`, or the unpacked tarball) and decide whether it is acceptable.
128
  2. Record the decision: `npm approve-scripts <pkg>` writes a version-pinned `"<name>@<version>": true` entry to `package.json#allowScripts` (`allow-scripts-pin` is on); `npm deny-scripts <pkg>` writes `"<name>": false`, denying every version of the package.
129
  3. Update the decision list above in the same PR, with the reasoning.
 
162
  ## Security Updates
163
 
164
  Security updates will be:
165
+
166
  - Released as new versions
167
  - Announced in release notes
168
  - Coordinated with dependency updates when applicable
 
170
  ## Security Team
171
 
172
  The MiniSearch security team is currently the project maintainer:
173
+
174
  - [@felladrin](https://github.com/felladrin) - Project Maintainer
175
 
176
  ## Acknowledgments
.github/SUPPORT.md CHANGED
@@ -7,6 +7,7 @@ If you need help with MiniSearch, these are the best support channels.
7
  ### GitHub Discussions
8
 
9
  For questions, feature requests, and general discussion, use [GitHub Discussions](https://github.com/felladrin/MiniSearch/discussions). This is the best place to:
 
10
  - Ask how to configure MiniSearch for your use case
11
  - Request new features
12
  - Share ideas and feedback
 
7
  ### GitHub Discussions
8
 
9
  For questions, feature requests, and general discussion, use [GitHub Discussions](https://github.com/felladrin/MiniSearch/discussions). This is the best place to:
10
+
11
  - Ask how to configure MiniSearch for your use case
12
  - Request new features
13
  - Share ideas and feedback
README.md CHANGED
@@ -37,7 +37,7 @@ The AI can run entirely inside your browser tab, on GPU or CPU, so a working set
37
  ## Features
38
 
39
  - **Private by design.** No tracking, no telemetry, no accounts. Search history, cached results, and chats are stored in your browser and never leave your machine.
40
- - **AI in your browser.** Pick from several curated models (135M to 4B parameters) that run on WebGPU where available and on CPU elsewhere. Models are downloaded once and cached by the browser.
41
  - **Any backend you like.** Connect an OpenAI-compatible API (Ollama, LM Studio, vLLM, llama.cpp server, or a hosted provider), use the crowdsourced AI Horde, or let the server proxy your own API without exposing its key.
42
  - **A real search pipeline.** Text and image results aggregated by SearXNG, reranked locally by a cross-encoder model, cached, and rate-limited; all inside the container.
43
  - **Answers you can verify.** Responses cite the sources they draw from, support follow-up questions with conversation memory, reveal the model's reasoning on demand, and can be read aloud.
 
37
  ## Features
38
 
39
  - **Private by design.** No tracking, no telemetry, no accounts. Search history, cached results, and chats are stored in your browser and never leave your machine.
40
+ - **AI in your browser.** Pick from several curated models that run on WebGPU where available and on CPU elsewhere. Models are downloaded once and cached by the browser.
41
  - **Any backend you like.** Connect an OpenAI-compatible API (Ollama, LM Studio, vLLM, llama.cpp server, or a hosted provider), use the crowdsourced AI Horde, or let the server proxy your own API without exposing its key.
42
  - **A real search pipeline.** Text and image results aggregated by SearXNG, reranked locally by a cross-encoder model, cached, and rate-limited; all inside the container.
43
  - **Answers you can verify.** Responses cite the sources they draw from, support follow-up questions with conversation memory, reveal the model's reasoning on demand, and can be read aloud.
agents.md CHANGED
@@ -5,11 +5,13 @@ This is your navigation hub. Start here, follow the links, and return when you n
5
  ## Before You Start
6
 
7
  **New to this codebase?** Read in this order:
 
8
  1. `docs/quick-start.md` - Get it running
9
  2. `docs/overview.md` - Understand the system
10
  3. `docs/project-structure.md` - Navigate the code
11
 
12
  **Making changes?** Check:
 
13
  - `docs/coding-conventions.md` - Code style
14
  - `docs/development-commands.md` - Available commands
15
  - `docs/pull-requests.md` - How to submit
@@ -32,6 +34,7 @@ This is your navigation hub. Start here, follow the links, and return when you n
32
 
33
  - **`docs/api.md`** - HTTP endpoint reference: parameters, responses, and error codes
34
  - **`docs/ai-integration.md`** - AI inference types (Wllama, OpenAI, AI Horde, Internal)
 
35
  - **`docs/ui-components.md`** - Component architecture and PubSub patterns
36
  - **`docs/search-history.md`** - History database schema and management
37
  - **`docs/conversation-memory.md`** - Token budgeting and rolling summaries
@@ -188,7 +191,7 @@ Need to:
188
 
189
  ### Add a new AI model
190
 
191
- 1. Check the wasm build can run it: the architecture must exist in `node_modules/@wllama/wllama/esm/wasm/wllama.wasm` (grep the binary for the arch name), and the quant must stay under the ceilings in `docs/ai-integration.md` (shard every file under 2000 MiB; total weights under ~3.7 GB)
192
  2. Shard the GGUF (`llama-gguf-split --split --size`, or an equivalent) and publish to a `Felladrin/gguf-sharded-<QUANT>-<Name>` repo
193
  3. Add to `client/modules/wllama.ts`; thinking-by-default templates need nothing extra (their `reasoning_content` channel is streamed into the thinking UI) but do need `reasoningBudgetTokens` so they cannot think past the context without answering
194
  4. Run `node scripts/wllama-catalog-check.cjs` and `npx vitest run client/modules/wllama.test.ts`
@@ -222,6 +225,7 @@ Need to:
222
  ## Quality Gates
223
 
224
  Before any change:
 
225
  ```bash
226
  npm run lint
227
  ```
@@ -229,6 +233,7 @@ npm run lint
229
  Inside the dev container, the same command is `docker compose exec development-server npm run lint`.
230
 
231
  This runs:
 
232
  - Biome (formatting/linting)
233
  - TypeScript (type checking)
234
  - knip (dead code detection)
@@ -251,21 +256,25 @@ So `npx tsc --noEmit` reports success while type errors sit in `server/` or `eva
251
  ## Agent-First Principles
252
 
253
  **Repository as System of Record:**
 
254
  - All knowledge lives in versioned docs/ structure
255
  - This file is your entry point - start here
256
  - Follow links, don't assume - verify in code
257
 
258
  **Context Efficiency:**
 
259
  - Use this map to navigate quickly
260
  - Return to this file when context drifts
261
  - Follow the decision tree for common tasks
262
 
263
  **Architecture & Boundaries:**
 
264
  - Respect PubSub boundaries - don't cross concerns
265
  - Client vs server - keep them separate
266
  - Feature-based organization - one folder per feature
267
 
268
  **Documentation Maintenance:**
 
269
  - Update these docs when you learn something new
270
  - Add cross-references when linking concepts
271
  - Keep examples current with actual code
 
5
  ## Before You Start
6
 
7
  **New to this codebase?** Read in this order:
8
+
9
  1. `docs/quick-start.md` - Get it running
10
  2. `docs/overview.md` - Understand the system
11
  3. `docs/project-structure.md` - Navigate the code
12
 
13
  **Making changes?** Check:
14
+
15
  - `docs/coding-conventions.md` - Code style
16
  - `docs/development-commands.md` - Available commands
17
  - `docs/pull-requests.md` - How to submit
 
34
 
35
  - **`docs/api.md`** - HTTP endpoint reference: parameters, responses, and error codes
36
  - **`docs/ai-integration.md`** - AI inference types (Wllama, OpenAI, AI Horde, Internal)
37
+ - **`docs/wllama-model-evaluation.md`** - How in-browser models are scored on MiniSearch's task
38
  - **`docs/ui-components.md`** - Component architecture and PubSub patterns
39
  - **`docs/search-history.md`** - History database schema and management
40
  - **`docs/conversation-memory.md`** - Token budgeting and rolling summaries
 
191
 
192
  ### Add a new AI model
193
 
194
+ 1. Check the wasm build can run it: the architecture must exist in `node_modules/@wllama/wllama/esm/wasm/wllama.wasm` (grep the binary for the arch name), and the quant must stay under the ceilings in `docs/ai-integration.md` (shard every file under 2000 MiB; total weights under ~3.7 GB). Then run it for real with `npm run bench:wllama -- --model owner/repo/file.gguf` (see `docs/development-commands.md#wllama-benchmark`), on both devices: speed and answer quality can rank differently on WebGPU and on CPU
195
  2. Shard the GGUF (`llama-gguf-split --split --size`, or an equivalent) and publish to a `Felladrin/gguf-sharded-<QUANT>-<Name>` repo
196
  3. Add to `client/modules/wllama.ts`; thinking-by-default templates need nothing extra (their `reasoning_content` channel is streamed into the thinking UI) but do need `reasoningBudgetTokens` so they cannot think past the context without answering
197
  4. Run `node scripts/wllama-catalog-check.cjs` and `npx vitest run client/modules/wllama.test.ts`
 
225
  ## Quality Gates
226
 
227
  Before any change:
228
+
229
  ```bash
230
  npm run lint
231
  ```
 
233
  Inside the dev container, the same command is `docker compose exec development-server npm run lint`.
234
 
235
  This runs:
236
+
237
  - Biome (formatting/linting)
238
  - TypeScript (type checking)
239
  - knip (dead code detection)
 
256
  ## Agent-First Principles
257
 
258
  **Repository as System of Record:**
259
+
260
  - All knowledge lives in versioned docs/ structure
261
  - This file is your entry point - start here
262
  - Follow links, don't assume - verify in code
263
 
264
  **Context Efficiency:**
265
+
266
  - Use this map to navigate quickly
267
  - Return to this file when context drifts
268
  - Follow the decision tree for common tasks
269
 
270
  **Architecture & Boundaries:**
271
+
272
  - Respect PubSub boundaries - don't cross concerns
273
  - Client vs server - keep them separate
274
  - Feature-based organization - one folder per feature
275
 
276
  **Documentation Maintenance:**
277
+
278
  - Update these docs when you learn something new
279
  - Add cross-references when linking concepts
280
  - Keep examples current with actual code
changelog.md CHANGED
@@ -2,6 +2,16 @@
2
 
3
  Notable changes, grouped by date, most recent first.
4
 
 
 
 
 
 
 
 
 
 
 
5
 
6
  ## 2026-11-05
7
 
@@ -10,34 +20,28 @@ Notable changes, grouped by date, most recent first.
10
  - A result from the site the query names gets a bonus on its semantic score before the score filter: +0.5 when a query word equals the domain's label ("disney" and disney.com, subdomains included), +0.75 when the label is the query's own words joined ("disney plus" and disneyplus.com, "coca cola" and coca-cola.com). The bonus is added rather than multiplied because the reranker returns a raw logit that is usually negative, where a factor above one would demote the named site instead of promoting it. Substrings do not count (disneyfan.com gets nothing), filler words never match on their own (plus.com, news.com), and a query that names a year will not promote a page that states a different year, so a brand's recap of last year's event cannot displace fresher reporting; a page that states no year at all keeps the bonus, because relative-time queries are anchored to a year before they reach the search. A label that spells only the start of the query leaves words unused and gets nothing (`tesla investor relations` and teslainvestor.com), a label that starts with a filler word is skipped (`the disney store` and thedisney.com), a split label counts from four characters, and a trailing dot on the hostname changes nothing. The site's name comes from the public suffix list, private section included (the `tldts` package), so bbc.co.uk answers "bbc" and a tenant of a shared host such as someone.github.io answers its own name, not "github". The pinned top result is never boosted, so the score spread the client reads relevance tags from keeps its shape. The reranker still never sees the URL, and a result the search did not return cannot be added here: the boost reorders and re-selects what the pipeline already holds, which is enough to move a page into the six the model reads. `server/authorityRanking.ts` holds the rule and `docs/reranking.md` records it.
11
  - A text search that asks for an official page can now reach the official site even when the engine's results never included it, behind a new setting, `SEARCH_OFFICIAL_LANE_ENABLED`, which is off by default because it sends the engines a second request. When it is on, the query carries navigation intent (`ๅฎ˜็ฝ‘`, `ๆŽ’็‰‡`, `่ฅไธšๆ—ถ้—ด`, `official`, `hours`, `showtimes` and the like, in Chinese and English only), and one of the returned results names a site, the server sends a second, `site:`-scoped query to SearXNG and merges up to three of its results, deduplicated by URL and kept to that registrable domain, behind the pinned first result: the ranking re-sorts only what follows the top result, so a page appended past that window would never be re-sorted at all. The domain has to come from the results themselves, by the same rule the score bonus uses, because guessing `<token>.com` from the query would turn a search box into a scanner; a query that names a brand whose official site is absent from every result gets no second query. The second query is one request with no retry, and its failures count toward neither the SearXNG circuit nor the engine health in `/status`, so it cannot slow down or degrade the searches users are waiting on. SearXNG still sees the extra request, so an engine that suspends the instance after a CAPTCHA does so for every search. It runs only when SearXNG served the search (never after the fallback), never uses the last five seconds of the search deadline, and is canceled at eight seconds; a failure only logs and is counted, so it can add results but never turn a served search into a 502. `/status` reports `searches.officialLane` (searches, `resultsAdded`, `failures`), and `server/officialLane.ts` holds the rule.
12
 
13
-
14
  ## 2026-11-03
15
 
16
  - The five thinking models added on 2026-11-02 (Spark X2.6 1.7B and 4B, Granite 4.2 3B, Qwen 3.5 4B, Gemma 4 E2B) no longer ship with thinking switched off. Their chain of thought arrives on wllama's `reasoning_content` channel and is now wrapped in the configured reasoning markers, so the existing thinking UI shows it while the model reasons and the answer streams in after. The model warmup counts a reasoning token as a working model, so thinking models no longer log a failed warmup.
17
  - The same five models now cap their chain of thought with `reasoningBudgetTokens` (wllama's `reasoning_budget_tokens`, 256 tokens): when the model has thought that long without answering, the engine closes the reasoning channel and forces the final answer. Without the cap, Spark X2.6 and Granite 4.2 could spend the whole 4096-token context on reasoning and deliver no answer at all.
18
 
19
-
20
  ## 2026-11-02
21
 
22
  - Five new browser models joined the Wllama catalog: Spark X2.6 1.7B, Granite 4.2 3B, Qwen 3.5 4B, Gemma 4 E2B and Spark X2.6 4B, each tested end to end against the shipped wasm build with the search-answer prompt. The Gemma 4 and Qwen 3.5 architectures were previously absent from the catalog, and the new entries run on the wasm engine's supported architectures (`gemma4`, `qwen35`, `spark2_5`, `granite`). Models whose chat template thinks by default ship with `chatTemplateKwargs: { enable_thinking: false }`, a new per-model field passed to wllama as `chat_template_kwargs`, because MiniSearch renders only the content channel and a thinking template would otherwise spend the whole token budget on reasoning and answer with nothing. `docs/ai-integration.md` now records the two measured ceilings a candidate must fit (shard files under 2000 MiB, since Chromium's OPFS silently truncates beyond it; total weights under ~3.7 GB, since the wasm linear memory caps at 4 GiB), and `npm run wllama-catalog-check` HEADs every shard of every catalog model on HuggingFace to verify the claimed sizes.
23
 
24
-
25
  ## 2026-10-10
26
 
27
  - The text-search fallback now cascades over Parallel and You.com instead of asking a single provider. On each search the configured providers are tried in a random order, one after the other, until one returns results, under the same 15-second budget, which is split across the providers still untried and not paused so a hanging one cannot starve the rest. A provider that answers HTTP 429 is paused until its `Retry-After` and skipped meanwhile, as You.com's acceptable use policy asks. A single search can now reach more than one provider; each sees the query text and this server's IP address, never the user's. `SEARCH_FALLBACK_PROVIDERS` picks the providers (all of them when empty), and `SEARCH_FALLBACK_PARALLEL_API_KEY` and `SEARCH_FALLBACK_YOUCOM_API_KEY` hold the optional keys. `SEARCH_FALLBACK_PROVIDER` and `SEARCH_FALLBACK_API_KEY` are removed: if either is still set while the fallback is enabled, the server stops at start with an error naming the replacement, and so does a provider key with a control character inside it. `/status` gained per-provider counters under `searches.fallbackProviders`.
28
 
29
-
30
  ## 2026-10-08
31
 
32
  - `/status` now reports `authorization.distinctRejectedTokens`, the number of distinct dead tokens the server has cached and keeps refusing. A steady stream of invalid-token rejections with a value of 1 there is one client replaying one stale token, not many old search links, which the existing counters could not tell apart.
33
  - Added an optional second source for text searches, so a SearXNG outage no longer has to end in a 502. It stays off unless `SEARCH_FALLBACK_ENABLED` is `true` or `1`, and flipping it takes a restart, since a process keeps the environment it was started with. When it is on, the second source is consulted only after SearXNG has failed (an HTTP error, a network error, every engine unresponsive, or an open circuit), under one 15-second budget for the whole exchange and under a 25-second deadline measured from the start of the search, and only for text searches: image searches still answer 502 as before. The query goes to `search.parallel.ai`, which sees the query text and this server's IP address, never the user's. A retry that comes back with nothing usable now answers HTTP 200 with no results, so the UI shows "No results found" rather than "Text search unavailable"; a retry that fails itself, or that the search deadline has left under two seconds for, falls through to the old 502. `SEARCH_FALLBACK_API_KEY` is optional and is sent as a Bearer token, which raises the provider's free-tier rate limits. `/status` gained `searchesServedByFallback` and `searchesFailedOnFallback`, plain counts that never carry a query, so you can see whether the second source is earning its place.
34
 
35
-
36
  ## 2026-10-07
37
 
38
  - Security: cleared the flagged copy of `postcss-selector-parser` that lives inside the npm the image ships. npm pins its own dependency tree exactly, so neither `npm install -g npm@latest` nor a dependency bump reaches a bundled copy, and the npm in the image still carried 7.1.4. This was the one of the image's three code scanning findings that no dependency bump could fix. The image's npm-bundle repair now lists that package among its targets, so the build replaces the bundled copy with the patched release and fails if any copy of that major line survives.
39
 
40
-
41
  ## 2026-09-23
42
 
43
  - Moved the Dictate control inside the search field, as an icon button at its right edge, and gave the follow-up question box the same control, so dictating a follow-up no longer means typing it. It shows a microphone when idle, a red stop button while it listens, and the model download progress in its tooltip and its accessible name. Pressing it never takes the focus off the field, so the caret stays where it was and a phone keeps its on-screen keyboard open. In the chat box it is disabled rather than hidden while an answer is generating, and a session still running when generation starts is stopped instead of writing into a field that has gone read-only.
 
2
 
3
  Notable changes, grouped by date, most recent first.
4
 
5
+ ## 2026-11-08
6
+
7
+ - A model download that was interrupted, for example by reloading the page halfway, no longer stops every model from loading. wllama 3.8.1 checks every model in its cache before loading any, and throws on the first one that misses a file; before each load, MiniSearch now deletes the files of models whose download did not finish, so only that model downloads again.
8
+ - The default system prompt's citation example is now a placeholder, `[example.com](https://example.com/page)`, instead of a real YouTube video link that small models copied as if it were a source. On the benchmark's eleven core questions, over 110 answers from five small models, links to URLs that are not among the results fell from 12 to 7, the YouTube link disappeared, and the share of answers citing a result stayed level (48% before, 50% after). A saved prompt that is exactly the previous default moves to the new one; an edited prompt stays as it is.
9
+ - Four models leave the Wllama catalog because they answer worse than LittleLamb 290M, the default for browsers without WebGPU and the catalog's quality floor: StableLM 2 Zephyr 1.6B, SmolLM 2 135M, Granite 4.0 350M and Pints 1.5B (16 to 25 points out of 84 on the benchmark, against 38 for LittleLamb). Granite 4.0 1B goes too: on WebGPU it writes only `@` characters until it is stopped, though it answers well on the CPU. `docs/wllama-model-evaluation.md` now holds the scores of every catalog model and the rule that decided.
10
+ - A browser whose saved settings point at a model that left the catalog switches to the default model on its next answer, and records the switch in the logs. Before, it failed to answer at all.
11
+ - Browsers with WebGPU now start on their own default model, Gemma 3 4B, set with the new `WLLAMA_DEFAULT_GPU_MODEL_ID`; browsers without it keep LittleLamb 290M from `WLLAMA_DEFAULT_MODEL_ID`, which runs well on the CPU. Both only seed a profile that never saved settings. The GPU variable does not fall back to the CPU one, because `.env.example` sets that one and most deployments would otherwise hand GPUs the CPU model; a deployment that pinned `WLLAMA_DEFAULT_MODEL_ID` and wants the same model on GPUs should set both. Gemma 3 4B scored highest of twelve GPU candidates on the benchmark (`docs/wllama-model-evaluation.md`), with every point in two runs of fifteen questions in eleven languages, and on WebGPU it started answering in about 8 seconds.
12
+ - Qwen 3.5 0.8B (533 MB) joins the Wllama catalog. On the benchmark's eleven core questions it scored 70 of 84 (one run), above larger models such as Qwen 3 1.7B (66) and Granite 4.2 3B (59), and on WebGPU it writes about 32 tokens per second. Like Qwen 3.5 4B it ignores `reasoning_effort`, so it thinks for the full 1024 tokens before most answers (about 33 seconds on an Apple M1 Max).
13
+ - The README and the docs no longer give a number of models or a size range, so adding or removing a model does not leave them out of date.
14
+ - Thinking models get a 1024-token reasoning budget instead of 256, because a chain of thought cut off that early degraded the answer. Every model is also asked for `reasoning_effort: "low"`, which Granite 4.2 and Spark X2.6 honor by thinking less; the other templates ignore it. Five models that think by default had no budget at all and now get the same 1024 tokens: LittleLamb 290M, Qwen 3 0.6B, Qwen 3 1.7B, Polaris 4B and DeepSeek R1 Distill Qwen 1.5B. LittleLamb, the default for browsers without WebGPU, thought for up to 3,663 tokens on a single answer and sometimes never answered; with the budget it answered all 33 questions of three benchmark runs.
15
 
16
  ## 2026-11-05
17
 
 
20
  - A result from the site the query names gets a bonus on its semantic score before the score filter: +0.5 when a query word equals the domain's label ("disney" and disney.com, subdomains included), +0.75 when the label is the query's own words joined ("disney plus" and disneyplus.com, "coca cola" and coca-cola.com). The bonus is added rather than multiplied because the reranker returns a raw logit that is usually negative, where a factor above one would demote the named site instead of promoting it. Substrings do not count (disneyfan.com gets nothing), filler words never match on their own (plus.com, news.com), and a query that names a year will not promote a page that states a different year, so a brand's recap of last year's event cannot displace fresher reporting; a page that states no year at all keeps the bonus, because relative-time queries are anchored to a year before they reach the search. A label that spells only the start of the query leaves words unused and gets nothing (`tesla investor relations` and teslainvestor.com), a label that starts with a filler word is skipped (`the disney store` and thedisney.com), a split label counts from four characters, and a trailing dot on the hostname changes nothing. The site's name comes from the public suffix list, private section included (the `tldts` package), so bbc.co.uk answers "bbc" and a tenant of a shared host such as someone.github.io answers its own name, not "github". The pinned top result is never boosted, so the score spread the client reads relevance tags from keeps its shape. The reranker still never sees the URL, and a result the search did not return cannot be added here: the boost reorders and re-selects what the pipeline already holds, which is enough to move a page into the six the model reads. `server/authorityRanking.ts` holds the rule and `docs/reranking.md` records it.
21
  - A text search that asks for an official page can now reach the official site even when the engine's results never included it, behind a new setting, `SEARCH_OFFICIAL_LANE_ENABLED`, which is off by default because it sends the engines a second request. When it is on, the query carries navigation intent (`ๅฎ˜็ฝ‘`, `ๆŽ’็‰‡`, `่ฅไธšๆ—ถ้—ด`, `official`, `hours`, `showtimes` and the like, in Chinese and English only), and one of the returned results names a site, the server sends a second, `site:`-scoped query to SearXNG and merges up to three of its results, deduplicated by URL and kept to that registrable domain, behind the pinned first result: the ranking re-sorts only what follows the top result, so a page appended past that window would never be re-sorted at all. The domain has to come from the results themselves, by the same rule the score bonus uses, because guessing `<token>.com` from the query would turn a search box into a scanner; a query that names a brand whose official site is absent from every result gets no second query. The second query is one request with no retry, and its failures count toward neither the SearXNG circuit nor the engine health in `/status`, so it cannot slow down or degrade the searches users are waiting on. SearXNG still sees the extra request, so an engine that suspends the instance after a CAPTCHA does so for every search. It runs only when SearXNG served the search (never after the fallback), never uses the last five seconds of the search deadline, and is canceled at eight seconds; a failure only logs and is counted, so it can add results but never turn a served search into a 502. `/status` reports `searches.officialLane` (searches, `resultsAdded`, `failures`), and `server/officialLane.ts` holds the rule.
22
 
 
23
  ## 2026-11-03
24
 
25
  - The five thinking models added on 2026-11-02 (Spark X2.6 1.7B and 4B, Granite 4.2 3B, Qwen 3.5 4B, Gemma 4 E2B) no longer ship with thinking switched off. Their chain of thought arrives on wllama's `reasoning_content` channel and is now wrapped in the configured reasoning markers, so the existing thinking UI shows it while the model reasons and the answer streams in after. The model warmup counts a reasoning token as a working model, so thinking models no longer log a failed warmup.
26
  - The same five models now cap their chain of thought with `reasoningBudgetTokens` (wllama's `reasoning_budget_tokens`, 256 tokens): when the model has thought that long without answering, the engine closes the reasoning channel and forces the final answer. Without the cap, Spark X2.6 and Granite 4.2 could spend the whole 4096-token context on reasoning and deliver no answer at all.
27
 
 
28
  ## 2026-11-02
29
 
30
  - Five new browser models joined the Wllama catalog: Spark X2.6 1.7B, Granite 4.2 3B, Qwen 3.5 4B, Gemma 4 E2B and Spark X2.6 4B, each tested end to end against the shipped wasm build with the search-answer prompt. The Gemma 4 and Qwen 3.5 architectures were previously absent from the catalog, and the new entries run on the wasm engine's supported architectures (`gemma4`, `qwen35`, `spark2_5`, `granite`). Models whose chat template thinks by default ship with `chatTemplateKwargs: { enable_thinking: false }`, a new per-model field passed to wllama as `chat_template_kwargs`, because MiniSearch renders only the content channel and a thinking template would otherwise spend the whole token budget on reasoning and answer with nothing. `docs/ai-integration.md` now records the two measured ceilings a candidate must fit (shard files under 2000 MiB, since Chromium's OPFS silently truncates beyond it; total weights under ~3.7 GB, since the wasm linear memory caps at 4 GiB), and `npm run wllama-catalog-check` HEADs every shard of every catalog model on HuggingFace to verify the claimed sizes.
31
 
 
32
  ## 2026-10-10
33
 
34
  - The text-search fallback now cascades over Parallel and You.com instead of asking a single provider. On each search the configured providers are tried in a random order, one after the other, until one returns results, under the same 15-second budget, which is split across the providers still untried and not paused so a hanging one cannot starve the rest. A provider that answers HTTP 429 is paused until its `Retry-After` and skipped meanwhile, as You.com's acceptable use policy asks. A single search can now reach more than one provider; each sees the query text and this server's IP address, never the user's. `SEARCH_FALLBACK_PROVIDERS` picks the providers (all of them when empty), and `SEARCH_FALLBACK_PARALLEL_API_KEY` and `SEARCH_FALLBACK_YOUCOM_API_KEY` hold the optional keys. `SEARCH_FALLBACK_PROVIDER` and `SEARCH_FALLBACK_API_KEY` are removed: if either is still set while the fallback is enabled, the server stops at start with an error naming the replacement, and so does a provider key with a control character inside it. `/status` gained per-provider counters under `searches.fallbackProviders`.
35
 
 
36
  ## 2026-10-08
37
 
38
  - `/status` now reports `authorization.distinctRejectedTokens`, the number of distinct dead tokens the server has cached and keeps refusing. A steady stream of invalid-token rejections with a value of 1 there is one client replaying one stale token, not many old search links, which the existing counters could not tell apart.
39
  - Added an optional second source for text searches, so a SearXNG outage no longer has to end in a 502. It stays off unless `SEARCH_FALLBACK_ENABLED` is `true` or `1`, and flipping it takes a restart, since a process keeps the environment it was started with. When it is on, the second source is consulted only after SearXNG has failed (an HTTP error, a network error, every engine unresponsive, or an open circuit), under one 15-second budget for the whole exchange and under a 25-second deadline measured from the start of the search, and only for text searches: image searches still answer 502 as before. The query goes to `search.parallel.ai`, which sees the query text and this server's IP address, never the user's. A retry that comes back with nothing usable now answers HTTP 200 with no results, so the UI shows "No results found" rather than "Text search unavailable"; a retry that fails itself, or that the search deadline has left under two seconds for, falls through to the old 502. `SEARCH_FALLBACK_API_KEY` is optional and is sent as a Bearer token, which raises the provider's free-tier rate limits. `/status` gained `searchesServedByFallback` and `searchesFailedOnFallback`, plain counts that never carry a query, so you can see whether the second source is earning its place.
40
 
 
41
  ## 2026-10-07
42
 
43
  - Security: cleared the flagged copy of `postcss-selector-parser` that lives inside the npm the image ships. npm pins its own dependency tree exactly, so neither `npm install -g npm@latest` nor a dependency bump reaches a bundled copy, and the npm in the image still carried 7.1.4. This was the one of the image's three code scanning findings that no dependency bump could fix. The image's npm-bundle repair now lists that package among its targets, so the build replaces the bundled copy with the patched release and fails if any copy of that major line survives.
44
 
 
45
  ## 2026-09-23
46
 
47
  - Moved the Dictate control inside the search field, as an icon button at its right edge, and gave the follow-up question box the same control, so dictating a follow-up no longer means typing it. It shows a microphone when idle, a red stop button while it listens, and the model download progress in its tooltip and its accessible name. Pressing it never takes the focus off the field, so the caret stays where it was and a phone keeps its on-screen keyboard open. In the chat box it is disabled rather than hidden while an answer is generating, and a session still running when generation starts is stopped instead of writing into a field that has gone read-only.
client/components/App/App.test.tsx CHANGED
@@ -25,6 +25,7 @@ const serverConfig: ServerConfig = {
25
  accessKeysEnabled: false,
26
  accessKeyTimeoutHours: 24,
27
  wllamaDefaultModelId: "littlelamb-290m",
 
28
  internalApiEnabled: false,
29
  internalApiName: "Internal API",
30
  defaultInferenceType: "browser",
 
25
  accessKeysEnabled: false,
26
  accessKeyTimeoutHours: 24,
27
  wllamaDefaultModelId: "littlelamb-290m",
28
+ wllamaDefaultGpuModelId: "gemma-3-4b",
29
  internalApiEnabled: false,
30
  internalApiName: "Internal API",
31
  defaultInferenceType: "browser",
client/components/App/App.tsx CHANGED
@@ -17,7 +17,9 @@ import {
17
  applyServerConfig,
18
  defaultSettings,
19
  hasStoredUserSettings,
 
20
  } from "@/modules/settings";
 
21
  import "@mantine/notifications/styles.css";
22
  import { verifyStoredAccessKey } from "@/modules/accessKey";
23
  import {
@@ -115,9 +117,10 @@ function useInitializeSettings(config: ConfigState) {
115
 
116
  setSettings(
117
  applyServerConfig(
118
- { ...defaultSettings, ...settings },
119
  config === "unavailable" ? FALLBACK_CONFIG : config,
120
  hasStoredUserSettings,
 
121
  ),
122
  );
123
  setSettingsInitialized(true);
 
17
  applyServerConfig,
18
  defaultSettings,
19
  hasStoredUserSettings,
20
+ upgradeUntouchedSystemPrompt,
21
  } from "@/modules/settings";
22
+ import { isWebGPUAvailable } from "@/modules/webGpu";
23
  import "@mantine/notifications/styles.css";
24
  import { verifyStoredAccessKey } from "@/modules/accessKey";
25
  import {
 
117
 
118
  setSettings(
119
  applyServerConfig(
120
+ upgradeUntouchedSystemPrompt({ ...defaultSettings, ...settings }),
121
  config === "unavailable" ? FALLBACK_CONFIG : config,
122
  hasStoredUserSettings,
123
+ isWebGPUAvailable,
124
  ),
125
  );
126
  setSettingsInitialized(true);
client/modules/config.test.ts CHANGED
@@ -8,6 +8,7 @@ const serverConfig: ServerConfig = {
8
  accessKeysEnabled: true,
9
  accessKeyTimeoutHours: 24,
10
  wllamaDefaultModelId: "some-model",
 
11
  internalApiEnabled: true,
12
  internalApiName: "Custom LLM",
13
  defaultInferenceType: "internal",
 
8
  accessKeysEnabled: true,
9
  accessKeyTimeoutHours: 24,
10
  wllamaDefaultModelId: "some-model",
11
+ wllamaDefaultGpuModelId: "some-gpu-model",
12
  internalApiEnabled: true,
13
  internalApiName: "Custom LLM",
14
  defaultInferenceType: "internal",
client/modules/config.ts CHANGED
@@ -9,6 +9,7 @@
9
  import {
10
  DEFAULT_INFERENCE_TYPE,
11
  DEFAULT_INTERNAL_API_NAME,
 
12
  DEFAULT_WLLAMA_MODEL_ID,
13
  type ServerConfig,
14
  } from "@shared/serverConfig";
@@ -28,6 +29,7 @@ export const FALLBACK_CONFIG: ServerConfig = {
28
  accessKeysEnabled: false,
29
  accessKeyTimeoutHours: 0,
30
  wllamaDefaultModelId: DEFAULT_WLLAMA_MODEL_ID,
 
31
  internalApiEnabled: false,
32
  internalApiName: DEFAULT_INTERNAL_API_NAME,
33
  defaultInferenceType: DEFAULT_INFERENCE_TYPE,
 
9
  import {
10
  DEFAULT_INFERENCE_TYPE,
11
  DEFAULT_INTERNAL_API_NAME,
12
+ DEFAULT_WLLAMA_GPU_MODEL_ID,
13
  DEFAULT_WLLAMA_MODEL_ID,
14
  type ServerConfig,
15
  } from "@shared/serverConfig";
 
29
  accessKeysEnabled: false,
30
  accessKeyTimeoutHours: 0,
31
  wllamaDefaultModelId: DEFAULT_WLLAMA_MODEL_ID,
32
+ wllamaDefaultGpuModelId: DEFAULT_WLLAMA_GPU_MODEL_ID,
33
  internalApiEnabled: false,
34
  internalApiName: DEFAULT_INTERNAL_API_NAME,
35
  defaultInferenceType: DEFAULT_INFERENCE_TYPE,
client/modules/pubSub.ts CHANGED
@@ -117,7 +117,8 @@ export const settingsPubSub = createLocalStoragePubSub(
117
  defaultSettings,
118
  );
119
 
120
- export const [, listenToSettingsChanges, getSettings] = settingsPubSub;
 
121
 
122
  export const modelSizeInMegabytesPubSub = createPubSub(0);
123
 
 
117
  defaultSettings,
118
  );
119
 
120
+ export const [updateSettings, listenToSettingsChanges, getSettings] =
121
+ settingsPubSub;
122
 
123
  export const modelSizeInMegabytesPubSub = createPubSub(0);
124
 
client/modules/settings.test.ts CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  import { describe, expect, it, vi } from "vitest";
2
  import type { ServerConfig } from "./config";
3
  import {
@@ -6,12 +10,14 @@ import {
6
  getDefaultCpuThreads,
7
  getInferenceTypes,
8
  prefersLocalDictationModel,
 
9
  } from "./settings";
10
 
11
  const mockConfig: ServerConfig = {
12
  accessKeysEnabled: false,
13
  accessKeyTimeoutHours: 0,
14
  wllamaDefaultModelId: "littlelamb-290m",
 
15
  internalApiEnabled: false,
16
  internalApiName: "Internal API",
17
  defaultInferenceType: "browser",
@@ -102,11 +108,25 @@ describe("Settings Module", () => {
102
  wllamaDefaultModelId: "custom-model",
103
  defaultInferenceType: "internal",
104
  };
105
- const applied = applyServerConfig(defaultSettings, config, false);
106
  expect(applied.wllamaModelId).toBe("custom-model");
107
  expect(applied.inferenceType).toBe("internal");
108
  });
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  it("should preserve stored settings that differ from the server defaults", () => {
111
  const config = {
112
  ...mockConfig,
@@ -118,7 +138,7 @@ describe("Settings Module", () => {
118
  wllamaModelId: "user-picked-model",
119
  inferenceType: "horde",
120
  };
121
- const applied = applyServerConfig(userSettings, config, true);
122
  expect(applied.wllamaModelId).toBe("user-picked-model");
123
  expect(applied.inferenceType).toBe("horde");
124
  });
@@ -129,7 +149,7 @@ describe("Settings Module", () => {
129
  wllamaDefaultModelId: "admin-preferred-model",
130
  defaultInferenceType: "internal",
131
  };
132
- const applied = applyServerConfig(defaultSettings, config, true);
133
  expect(applied.wllamaModelId).toBe(defaultSettings.wllamaModelId);
134
  expect(applied.inferenceType).toBe(defaultSettings.inferenceType);
135
  });
@@ -203,3 +223,27 @@ describe("dictation model default", () => {
203
  expect(settings.enableLocalDictationModel).toBe(true);
204
  });
205
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {
2
+ CITATION_EXAMPLE,
3
+ DEFAULT_SYSTEM_PROMPT,
4
+ } from "@shared/defaultSystemPrompt";
5
  import { describe, expect, it, vi } from "vitest";
6
  import type { ServerConfig } from "./config";
7
  import {
 
10
  getDefaultCpuThreads,
11
  getInferenceTypes,
12
  prefersLocalDictationModel,
13
+ upgradeUntouchedSystemPrompt,
14
  } from "./settings";
15
 
16
  const mockConfig: ServerConfig = {
17
  accessKeysEnabled: false,
18
  accessKeyTimeoutHours: 0,
19
  wllamaDefaultModelId: "littlelamb-290m",
20
+ wllamaDefaultGpuModelId: "gemma-3-4b",
21
  internalApiEnabled: false,
22
  internalApiName: "Internal API",
23
  defaultInferenceType: "browser",
 
108
  wllamaDefaultModelId: "custom-model",
109
  defaultInferenceType: "internal",
110
  };
111
+ const applied = applyServerConfig(defaultSettings, config, false, false);
112
  expect(applied.wllamaModelId).toBe("custom-model");
113
  expect(applied.inferenceType).toBe("internal");
114
  });
115
 
116
+ it("should seed the GPU model default when the browser has WebGPU", () => {
117
+ const config = {
118
+ ...mockConfig,
119
+ wllamaDefaultModelId: "cpu-model",
120
+ wllamaDefaultGpuModelId: "gpu-model",
121
+ };
122
+ expect(
123
+ applyServerConfig(defaultSettings, config, false, true).wllamaModelId,
124
+ ).toBe("gpu-model");
125
+ expect(
126
+ applyServerConfig(defaultSettings, config, false, false).wllamaModelId,
127
+ ).toBe("cpu-model");
128
+ });
129
+
130
  it("should preserve stored settings that differ from the server defaults", () => {
131
  const config = {
132
  ...mockConfig,
 
138
  wllamaModelId: "user-picked-model",
139
  inferenceType: "horde",
140
  };
141
+ const applied = applyServerConfig(userSettings, config, true, true);
142
  expect(applied.wllamaModelId).toBe("user-picked-model");
143
  expect(applied.inferenceType).toBe("horde");
144
  });
 
149
  wllamaDefaultModelId: "admin-preferred-model",
150
  defaultInferenceType: "internal",
151
  };
152
+ const applied = applyServerConfig(defaultSettings, config, true, true);
153
  expect(applied.wllamaModelId).toBe(defaultSettings.wllamaModelId);
154
  expect(applied.inferenceType).toBe(defaultSettings.inferenceType);
155
  });
 
223
  expect(settings.enableLocalDictationModel).toBe(true);
224
  });
225
  });
226
+
227
+ describe("upgradeUntouchedSystemPrompt", () => {
228
+ const previousDefault = DEFAULT_SYSTEM_PROMPT.replace(
229
+ CITATION_EXAMPLE,
230
+ "[youtube.com](https://www.youtube.com/watch?v=dQw4w9WgXcQ)",
231
+ );
232
+
233
+ it("replaces a saved prompt that is exactly the previous default", () => {
234
+ const upgraded = upgradeUntouchedSystemPrompt({
235
+ ...defaultSettings,
236
+ systemPrompt: previousDefault,
237
+ });
238
+ expect(upgraded.systemPrompt).toBe(DEFAULT_SYSTEM_PROMPT);
239
+ });
240
+
241
+ it("keeps a prompt the user edited", () => {
242
+ const edited = `${previousDefault}\nAlways answer in haiku.`;
243
+ const kept = upgradeUntouchedSystemPrompt({
244
+ ...defaultSettings,
245
+ systemPrompt: edited,
246
+ });
247
+ expect(kept.systemPrompt).toBe(edited);
248
+ });
249
+ });
client/modules/settings.ts CHANGED
@@ -1,6 +1,10 @@
1
- import { DEFAULT_SYSTEM_PROMPT } from "@shared/defaultSystemPrompt";
 
 
 
2
  import {
3
  DEFAULT_INFERENCE_TYPE,
 
4
  DEFAULT_WLLAMA_MODEL_ID,
5
  type ServerConfig,
6
  } from "@shared/serverConfig";
@@ -136,23 +140,51 @@ export function getInferenceTypes(config: ServerConfig) {
136
  ];
137
  }
138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  /**
140
  * Applies the server-provided defaults to a settings object.
141
  *
142
  * These are defaults, not overrides: they seed a profile that has never been
143
  * saved and are ignored once the user has settings of their own, since a stored
144
  * value is a choice even when it matches what the code ships with.
 
 
 
145
  */
146
  export function applyServerConfig(
147
  settings: typeof defaultSettings,
148
  config: ServerConfig,
149
  userSettingsWereStored: boolean,
 
150
  ): typeof defaultSettings {
151
  if (userSettingsWereStored) return settings;
152
 
153
  return {
154
  ...settings,
155
- wllamaModelId: config.wllamaDefaultModelId || DEFAULT_WLLAMA_MODEL_ID,
 
 
156
  inferenceType: config.defaultInferenceType || DEFAULT_INFERENCE_TYPE,
157
  };
158
  }
 
1
+ import {
2
+ CITATION_EXAMPLE,
3
+ DEFAULT_SYSTEM_PROMPT,
4
+ } from "@shared/defaultSystemPrompt";
5
  import {
6
  DEFAULT_INFERENCE_TYPE,
7
+ DEFAULT_WLLAMA_GPU_MODEL_ID,
8
  DEFAULT_WLLAMA_MODEL_ID,
9
  type ServerConfig,
10
  } from "@shared/serverConfig";
 
140
  ];
141
  }
142
 
143
+ /** The citation example the default prompt carried until 2026-11-08. */
144
+ const PREVIOUS_CITATION_EXAMPLE =
145
+ "[youtube.com](https://www.youtube.com/watch?v=dQw4w9WgXcQ)";
146
+
147
+ /**
148
+ * Moves a saved prompt that is exactly the previous default onto the current
149
+ * one. Settings store the whole prompt, so without this a profile that saved
150
+ * its settings would keep the old citation example forever. A prompt the user
151
+ * edited is their choice and stays.
152
+ */
153
+ export function upgradeUntouchedSystemPrompt(
154
+ settings: typeof defaultSettings,
155
+ ): typeof defaultSettings {
156
+ const previousDefault = DEFAULT_SYSTEM_PROMPT.replace(
157
+ CITATION_EXAMPLE,
158
+ PREVIOUS_CITATION_EXAMPLE,
159
+ );
160
+ return settings.systemPrompt === previousDefault
161
+ ? { ...settings, systemPrompt: DEFAULT_SYSTEM_PROMPT }
162
+ : settings;
163
+ }
164
+
165
  /**
166
  * Applies the server-provided defaults to a settings object.
167
  *
168
  * These are defaults, not overrides: they seed a profile that has never been
169
  * saved and are ignored once the user has settings of their own, since a stored
170
  * value is a choice even when it matches what the code ships with.
171
+ *
172
+ * The Wllama model default depends on `hasWebGpu`, because a model that
173
+ * answers quickly on a GPU can take minutes per answer on the CPU.
174
  */
175
  export function applyServerConfig(
176
  settings: typeof defaultSettings,
177
  config: ServerConfig,
178
  userSettingsWereStored: boolean,
179
+ hasWebGpu: boolean,
180
  ): typeof defaultSettings {
181
  if (userSettingsWereStored) return settings;
182
 
183
  return {
184
  ...settings,
185
+ wllamaModelId: hasWebGpu
186
+ ? config.wllamaDefaultGpuModelId || DEFAULT_WLLAMA_GPU_MODEL_ID
187
+ : config.wllamaDefaultModelId || DEFAULT_WLLAMA_MODEL_ID,
188
  inferenceType: config.defaultInferenceType || DEFAULT_INFERENCE_TYPE,
189
  };
190
  }
client/modules/textGenerationWithWllama.test.ts CHANGED
@@ -1,7 +1,10 @@
1
  import { beforeEach, describe, expect, it, vi } from "vitest";
 
2
  import {
 
3
  updateModelLoadingProgress,
4
  updateModelSizeInMegabytes,
 
5
  } from "./pubSub";
6
  import {
7
  composeStreamedText,
@@ -24,9 +27,18 @@ vi.mock("./pubSub", () => ({
24
  updateModelLoadingProgress: vi.fn(),
25
  updateModelSizeInMegabytes: vi.fn(),
26
  updateResponse: vi.fn(),
 
27
  updateTextGenerationState: vi.fn(),
28
  }));
29
 
 
 
 
 
 
 
 
 
30
  vi.mock("./systemPrompt", () => ({
31
  getSystemPrompt: vi.fn().mockReturnValue("system"),
32
  }));
@@ -102,6 +114,29 @@ describe("generateTextWithWllama", () => {
102
  ]);
103
  });
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  it("keeps the last known size when the total is not available yet", async () => {
106
  mockDownload([{ loaded: 0, total: 0 }]);
107
 
 
1
  import { beforeEach, describe, expect, it, vi } from "vitest";
2
+ import { addLogEntry } from "./logEntries";
3
  import {
4
+ getSettings,
5
  updateModelLoadingProgress,
6
  updateModelSizeInMegabytes,
7
+ updateSettings,
8
  } from "./pubSub";
9
  import {
10
  composeStreamedText,
 
27
  updateModelLoadingProgress: vi.fn(),
28
  updateModelSizeInMegabytes: vi.fn(),
29
  updateResponse: vi.fn(),
30
+ updateSettings: vi.fn(),
31
  updateTextGenerationState: vi.fn(),
32
  }));
33
 
34
+ vi.mock("./config", () => ({
35
+ getConfig: vi.fn().mockResolvedValue({
36
+ wllamaDefaultModelId: "test-model",
37
+ wllamaDefaultGpuModelId: "test-gpu-model",
38
+ }),
39
+ FALLBACK_CONFIG: {},
40
+ }));
41
+
42
  vi.mock("./systemPrompt", () => ({
43
  getSystemPrompt: vi.fn().mockReturnValue("system"),
44
  }));
 
114
  ]);
115
  });
116
 
117
+ it("switches to the default model when the saved one left the catalog", async () => {
118
+ const savedSettings = getSettings();
119
+ vi.mocked(getSettings).mockReturnValue({
120
+ ...savedSettings,
121
+ wllamaModelId: "removed-model",
122
+ });
123
+ mockDownload([]);
124
+
125
+ try {
126
+ await generateTextWithWllama();
127
+ } finally {
128
+ vi.mocked(getSettings).mockReturnValue(savedSettings);
129
+ }
130
+
131
+ expect(vi.mocked(initializeWllama).mock.calls[0]?.[0]).toBe("repo");
132
+ expect(updateSettings).toHaveBeenCalledWith(
133
+ expect.objectContaining({ wllamaModelId: "test-model" }),
134
+ );
135
+ expect(addLogEntry).toHaveBeenCalledWith(
136
+ expect.stringContaining("removed-model"),
137
+ );
138
+ });
139
+
140
  it("keeps the last known size when the total is not available yet", async () => {
141
  mockDownload([{ loaded: 0, total: 0 }]);
142
 
client/modules/textGenerationWithWllama.ts CHANGED
@@ -1,4 +1,5 @@
1
  import type { Wllama } from "@wllama/wllama";
 
2
  import { addLogEntry } from "./logEntries";
3
  import {
4
  getSettings,
@@ -6,6 +7,7 @@ import {
6
  updateModelLoadingProgress,
7
  updateModelSizeInMegabytes,
8
  updateResponse,
 
9
  updateTextGenerationState,
10
  } from "./pubSub";
11
  import {
@@ -33,8 +35,7 @@ export async function generateTextWithWllama(): Promise<void> {
33
  try {
34
  const response = await generateWithWllama({
35
  messages: async () => {
36
- const settings = getSettings();
37
- const modelConfig = wllamaModels[settings.wllamaModelId];
38
  return getDefaultChatMessages(
39
  await getFormattedSearchResults(
40
  modelConfig.shouldIncludeUrlsOnPrompt,
@@ -180,9 +181,38 @@ async function generateWithWllama({
180
  }
181
  }
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  async function initializeWllamaInstance(progressCallback?: ProgressCallback) {
184
- const { initializeWllama, wllamaModels } = await import("./wllama");
185
- const model = wllamaModels[getSettings().wllamaModelId];
186
 
187
  updateModelSizeInMegabytes(model.fileSizeInMegabytes);
188
 
 
1
  import type { Wllama } from "@wllama/wllama";
2
+ import { FALLBACK_CONFIG, getConfig } from "./config";
3
  import { addLogEntry } from "./logEntries";
4
  import {
5
  getSettings,
 
7
  updateModelLoadingProgress,
8
  updateModelSizeInMegabytes,
9
  updateResponse,
10
+ updateSettings,
11
  updateTextGenerationState,
12
  } from "./pubSub";
13
  import {
 
35
  try {
36
  const response = await generateWithWllama({
37
  messages: async () => {
38
+ const modelConfig = await getSelectedWllamaModel();
 
39
  return getDefaultChatMessages(
40
  await getFormattedSearchResults(
41
  modelConfig.shouldIncludeUrlsOnPrompt,
 
181
  }
182
  }
183
 
184
+ /**
185
+ * The model the settings point at, or the default when that model has left
186
+ * the catalog. Without this, removing a model from the catalog would break
187
+ * every answer for whoever had picked it.
188
+ */
189
+ async function getSelectedWllamaModel(): Promise<WllamaModel> {
190
+ const { wllamaModelId } = getSettings();
191
+ const model = wllamaModels[wllamaModelId];
192
+ if (model) return model;
193
+
194
+ // Safe without the server: the fallback is only a model to switch to.
195
+ const config = await getConfig().catch(() => FALLBACK_CONFIG);
196
+ const defaultId = isWebGPUAvailable
197
+ ? config.wllamaDefaultGpuModelId
198
+ : config.wllamaDefaultModelId;
199
+ const defaultModel = wllamaModels[defaultId];
200
+ if (!defaultModel) {
201
+ throw new Error(
202
+ `Neither the selected model "${wllamaModelId}" nor the default "${defaultId}" is in the catalog`,
203
+ );
204
+ }
205
+
206
+ addLogEntry(
207
+ `Model "${wllamaModelId}" is no longer available; switched to "${defaultId}"`,
208
+ );
209
+ updateSettings({ ...getSettings(), wllamaModelId: defaultId });
210
+ return defaultModel;
211
+ }
212
+
213
  async function initializeWllamaInstance(progressCallback?: ProgressCallback) {
214
+ const { initializeWllama } = await import("./wllama");
215
+ const model = await getSelectedWllamaModel();
216
 
217
  updateModelSizeInMegabytes(model.fileSizeInMegabytes);
218
 
client/modules/wllama.test.ts CHANGED
@@ -1,5 +1,10 @@
 
 
 
 
 
1
  import { describe, expect, it, vi } from "vitest";
2
- import { wllamaModels } from "./wllama";
3
 
4
  vi.mock("./logEntries", () => ({ addLogEntry: vi.fn() }));
5
  vi.mock("./textGenerationUtilities", () => ({ defaultContextSize: 4096 }));
@@ -46,6 +51,17 @@ describe("wllamaModels catalog", () => {
46
  }
47
  });
48
 
 
 
 
 
 
 
 
 
 
 
 
49
  it("keeps reasoning budgets small enough to leave room for the answer", () => {
50
  // The budget forces the final answer once the chain of thought runs
51
  // this long. It must stay far below the 4096-token context, or the
@@ -58,9 +74,46 @@ describe("wllamaModels catalog", () => {
58
  }
59
  });
60
 
 
 
 
 
 
61
  it("uses the shared default context size for every model", () => {
62
  for (const [id, model] of models) {
63
  expect(model.contextSize, id).toBe(4096);
64
  }
65
  });
66
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {
2
+ DEFAULT_WLLAMA_GPU_MODEL_ID,
3
+ DEFAULT_WLLAMA_MODEL_ID,
4
+ } from "@shared/serverConfig";
5
+ import type { CacheEntry, CacheManager } from "@wllama/wllama";
6
  import { describe, expect, it, vi } from "vitest";
7
+ import { deleteIncompleteCachedModels, wllamaModels } from "./wllama";
8
 
9
  vi.mock("./logEntries", () => ({ addLogEntry: vi.fn() }));
10
  vi.mock("./textGenerationUtilities", () => ({ defaultContextSize: 4096 }));
 
51
  }
52
  });
53
 
54
+ it("asks every thinking model for low reasoning effort", () => {
55
+ // A chain of thought cut off by the budget degrades the answer, so the
56
+ // budget is only a backstop; templates that read `reasoning_effort`
57
+ // must be steered to think less in the first place.
58
+ for (const [id, model] of models) {
59
+ if (model.reasoningBudgetTokens !== undefined) {
60
+ expect(model.chatTemplateKwargs?.reasoning_effort, id).toBe("low");
61
+ }
62
+ }
63
+ });
64
+
65
  it("keeps reasoning budgets small enough to leave room for the answer", () => {
66
  // The budget forces the final answer once the chain of thought runs
67
  // this long. It must stay far below the 4096-token context, or the
 
74
  }
75
  });
76
 
77
+ it("includes both default models", () => {
78
+ expect(wllamaModels).toHaveProperty([DEFAULT_WLLAMA_MODEL_ID]);
79
+ expect(wllamaModels).toHaveProperty([DEFAULT_WLLAMA_GPU_MODEL_ID]);
80
+ });
81
+
82
  it("uses the shared default context size for every model", () => {
83
  for (const [id, model] of models) {
84
  expect(model.contextSize, id).toBe(4096);
85
  }
86
  });
87
  });
88
+
89
+ describe("deleteIncompleteCachedModels", () => {
90
+ const shard = (repo: string, index: number, total: number) =>
91
+ `https://huggingface.co/${repo}/resolve/main/model-0000${index}-of-0000${total}.gguf`;
92
+ const entry = (url: string): CacheEntry => ({
93
+ name: url,
94
+ size: 1,
95
+ metadata: { originalURL: url, etag: "", originalSize: 1 },
96
+ });
97
+
98
+ it("deletes only the shards of a model whose download did not finish", async () => {
99
+ let files = [
100
+ entry(shard("complete", 1, 2)),
101
+ entry(shard("complete", 2, 2)),
102
+ entry(shard("interrupted", 1, 3)),
103
+ entry(shard("interrupted", 3, 3)),
104
+ ];
105
+ const cacheManager = {
106
+ list: async () => files,
107
+ deleteMany: async (predicate: (file: CacheEntry) => boolean) => {
108
+ files = files.filter((file) => !predicate(file));
109
+ },
110
+ } as unknown as CacheManager;
111
+
112
+ await deleteIncompleteCachedModels(cacheManager);
113
+
114
+ expect(files.map((file) => file.metadata.originalURL)).toEqual([
115
+ shard("complete", 1, 2),
116
+ shard("complete", 2, 2),
117
+ ]);
118
+ });
119
+ });
client/modules/wllama.ts CHANGED
@@ -1,5 +1,7 @@
1
  import {
 
2
  type LoadModelParams,
 
3
  type SamplingParams,
4
  Wllama,
5
  type WllamaConfig,
@@ -33,6 +35,35 @@ async function createWllamaInstance(config?: WllamaConfig): Promise<Wllama> {
33
  }
34
  }
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  /**
37
  * Initializes Wllama with a specific model from HuggingFace.
38
  * Performs a single-threaded warmup run before loading with the full config.
@@ -47,6 +78,8 @@ export async function initializeWllama(
47
  try {
48
  const wllama = await createWllamaInstance(config?.wllama);
49
 
 
 
50
  await wllama.loadModelFromHF(
51
  { repo: hfRepoId, file: hfFilePath },
52
  {
@@ -161,17 +194,14 @@ const createDefaultModelConfig = (): Omit<
161
  flash_attn: true,
162
  contextSize: defaultContextSize,
163
  shouldIncludeUrlsOnPrompt: true,
 
 
 
 
164
  getSampling: () => ({}),
165
  });
166
 
167
  export const wllamaModels: Readonly<Record<string, WllamaModel>> = {
168
- "smollm2-135m": {
169
- ...createDefaultModelConfig(),
170
- label: "SmolLM 2 135M",
171
- hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-SmolLM2-135M-Instruct",
172
- hfFilePath: "model.shard-00001-of-00004.gguf",
173
- fileSizeInMegabytes: 102,
174
- },
175
  "lfm2.5-230m": {
176
  ...createDefaultModelConfig(),
177
  label: "LFM2.5 230M",
@@ -179,19 +209,13 @@ export const wllamaModels: Readonly<Record<string, WllamaModel>> = {
179
  hfFilePath: "LFM2.5-230M-Q4_K_XL-00001-of-00003.gguf",
180
  fileSizeInMegabytes: 160,
181
  },
182
- "granite-4.0-350m": {
183
- ...createDefaultModelConfig(),
184
- label: "Granite 4.0 350M",
185
- hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-granite-4.0-350m",
186
- hfFilePath: "granite-4.0-350m-Q4_K_S-00001-of-00003.gguf",
187
- fileSizeInMegabytes: 229,
188
- },
189
  "littlelamb-290m": {
190
  ...createDefaultModelConfig(),
191
  label: "LittleLamb 290M",
192
  hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-LittleLamb",
193
  hfFilePath: "LittleLamb-i1-Q4_K_S-00001-of-00003.gguf",
194
  fileSizeInMegabytes: 231,
 
195
  },
196
  "gemma-3-270m": {
197
  ...createDefaultModelConfig(),
@@ -220,6 +244,15 @@ export const wllamaModels: Readonly<Record<string, WllamaModel>> = {
220
  hfRepoId: "Felladrin/gguf-sharded-UD-Q4_K_XL-Qwen3-0.6B",
221
  hfFilePath: "model.shard-00001-of-00004.gguf",
222
  fileSizeInMegabytes: 406,
 
 
 
 
 
 
 
 
 
223
  },
224
  "lfm2.5-1.2b-instruct": {
225
  ...createDefaultModelConfig(),
@@ -249,13 +282,6 @@ export const wllamaModels: Readonly<Record<string, WllamaModel>> = {
249
  hfFilePath: "model.shard-00001-of-00003.gguf",
250
  fileSizeInMegabytes: 781,
251
  },
252
- "pints-1.5b": {
253
- ...createDefaultModelConfig(),
254
- label: "Pints 1.5B",
255
- hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-1.5-Pints-16K-v0.1",
256
- hfFilePath: "model.shard-00001-of-00018.gguf",
257
- fileSizeInMegabytes: 905,
258
- },
259
  "olmo-2-0425-1b": {
260
  ...createDefaultModelConfig(),
261
  label: "OLMo 2 1B",
@@ -263,20 +289,6 @@ export const wllamaModels: Readonly<Record<string, WllamaModel>> = {
263
  hfFilePath: "model.shard-00001-of-00006.gguf",
264
  fileSizeInMegabytes: 967,
265
  },
266
- "granite-4.0-1b": {
267
- ...createDefaultModelConfig(),
268
- label: "Granite 4.0 1B",
269
- hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-granite-4.0-1b",
270
- hfFilePath: "granite-4.0-1b-Q4_K_S-00001-of-00006.gguf",
271
- fileSizeInMegabytes: 981,
272
- },
273
- "stablelm-2-zephyr-1.6b": {
274
- ...createDefaultModelConfig(),
275
- label: "StableLM 2 Zephyr 1.6B",
276
- hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-stablelm-2-zephyr-1.6b",
277
- hfFilePath: "model.shard-00001-of-00006.gguf",
278
- fileSizeInMegabytes: 989,
279
- },
280
  "smollm2-1.7b": {
281
  ...createDefaultModelConfig(),
282
  label: "SmolLM 2 1.7B",
@@ -304,6 +316,7 @@ export const wllamaModels: Readonly<Record<string, WllamaModel>> = {
304
  hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-DeepSeek-R1-Distill-Qwen-1.5B",
305
  hfFilePath: "model.shard-00001-of-00006.gguf",
306
  fileSizeInMegabytes: 1070,
 
307
  },
308
  "internlm-2.5-1.8b": {
309
  ...createDefaultModelConfig(),
@@ -318,6 +331,7 @@ export const wllamaModels: Readonly<Record<string, WllamaModel>> = {
318
  hfRepoId: "Felladrin/gguf-sharded-UD-Q4_K_XL-Qwen3-1.7B",
319
  hfFilePath: "model.shard-00001-of-00005.gguf",
320
  fileSizeInMegabytes: 1140,
 
321
  },
322
  "granite-3.3-2b": {
323
  ...createDefaultModelConfig(),
@@ -353,7 +367,7 @@ export const wllamaModels: Readonly<Record<string, WllamaModel>> = {
353
  hfRepoId: "Felladrin/gguf-sharded-Q4_K_M-Spark-X2.6-1.7B",
354
  hfFilePath: "Spark-X2.6-1.7B-Q4_K_M-00001-of-00004.gguf",
355
  fileSizeInMegabytes: 1769,
356
- reasoningBudgetTokens: 256,
357
  },
358
  "smollm3-3b": {
359
  ...createDefaultModelConfig(),
@@ -389,7 +403,7 @@ export const wllamaModels: Readonly<Record<string, WllamaModel>> = {
389
  hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-granite-4.2-3b",
390
  hfFilePath: "granite-4.2-3b-Q4_K_S-00001-of-00005.gguf",
391
  fileSizeInMegabytes: 2143,
392
- reasoningBudgetTokens: 256,
393
  },
394
  "phi-3.5-mini-3.8b": {
395
  ...createDefaultModelConfig(),
@@ -411,6 +425,7 @@ export const wllamaModels: Readonly<Record<string, WllamaModel>> = {
411
  hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-Polaris-4B-Preview",
412
  hfFilePath: "model.shard-00001-of-00008.gguf",
413
  fileSizeInMegabytes: 2380,
 
414
  },
415
  "qwen-3.5-4b": {
416
  ...createDefaultModelConfig(),
@@ -418,7 +433,7 @@ export const wllamaModels: Readonly<Record<string, WllamaModel>> = {
418
  hfRepoId: "Felladrin/gguf-sharded-UD-Q3_K_XL-Qwen3.5-4B",
419
  hfFilePath: "Qwen3.5-4B-UD-Q3_K_XL-00001-of-00005.gguf",
420
  fileSizeInMegabytes: 2436,
421
- reasoningBudgetTokens: 256,
422
  },
423
  "gemma-4-e2b": {
424
  ...createDefaultModelConfig(),
@@ -426,7 +441,7 @@ export const wllamaModels: Readonly<Record<string, WllamaModel>> = {
426
  hfRepoId: "Felladrin/gguf-sharded-Q3_K_S-gemma-4-e2b-it",
427
  hfFilePath: "gemma-4-e2b-it-Q3_K_S-00001-of-00005.gguf",
428
  fileSizeInMegabytes: 2446,
429
- reasoningBudgetTokens: 256,
430
  },
431
  "phi-4-mini-reasoning": {
432
  ...createDefaultModelConfig(),
@@ -441,6 +456,6 @@ export const wllamaModels: Readonly<Record<string, WllamaModel>> = {
441
  hfRepoId: "Felladrin/gguf-sharded-Q4_K_M-Spark-X2.6-4B",
442
  hfFilePath: "Spark-X2.6-4B-Q4_K_M-00001-of-00007.gguf",
443
  fileSizeInMegabytes: 3543,
444
- reasoningBudgetTokens: 256,
445
  },
446
  };
 
1
  import {
2
+ type CacheManager,
3
  type LoadModelParams,
4
+ ModelManager,
5
  type SamplingParams,
6
  Wllama,
7
  type WllamaConfig,
 
35
  }
36
  }
37
 
38
+ /**
39
+ * Deletes the cached shards of every model whose download did not finish.
40
+ * wllama 3.8.1 builds each cached model before checking it, and a missing
41
+ * shard makes that throw, so one interrupted download would otherwise stop
42
+ * every model from loading until the whole cache is cleared.
43
+ */
44
+ export async function deleteIncompleteCachedModels(cacheManager: CacheManager) {
45
+ const cachedUrls = new Set(
46
+ (await cacheManager.list())
47
+ .map((file) => file.metadata.originalURL)
48
+ // wllama skips files saved without one, so they cannot block a load.
49
+ .filter(Boolean),
50
+ );
51
+ const incompleteUrls = new Set(
52
+ [...cachedUrls]
53
+ .map((url) => ModelManager.parseModelUrl(url))
54
+ .filter((shards) => shards.some((shard) => !cachedUrls.has(shard)))
55
+ .flat(),
56
+ );
57
+ if (incompleteUrls.size === 0) return;
58
+
59
+ addLogEntry(
60
+ `Deleting ${incompleteUrls.size} cached file(s) of models whose download did not finish`,
61
+ );
62
+ await cacheManager.deleteMany((file) =>
63
+ incompleteUrls.has(file.metadata.originalURL),
64
+ );
65
+ }
66
+
67
  /**
68
  * Initializes Wllama with a specific model from HuggingFace.
69
  * Performs a single-threaded warmup run before loading with the full config.
 
78
  try {
79
  const wllama = await createWllamaInstance(config?.wllama);
80
 
81
+ await deleteIncompleteCachedModels(wllama.cacheManager);
82
+
83
  await wllama.loadModelFromHF(
84
  { repo: hfRepoId, file: hfFilePath },
85
  {
 
194
  flash_attn: true,
195
  contextSize: defaultContextSize,
196
  shouldIncludeUrlsOnPrompt: true,
197
+ // Templates that read it (Granite 4.2, Spark X2.6) think less, so they
198
+ // reach the answer before `reasoningBudgetTokens` cuts them off; the others
199
+ // ignore it.
200
+ chatTemplateKwargs: { reasoning_effort: "low" },
201
  getSampling: () => ({}),
202
  });
203
 
204
  export const wllamaModels: Readonly<Record<string, WllamaModel>> = {
 
 
 
 
 
 
 
205
  "lfm2.5-230m": {
206
  ...createDefaultModelConfig(),
207
  label: "LFM2.5 230M",
 
209
  hfFilePath: "LFM2.5-230M-Q4_K_XL-00001-of-00003.gguf",
210
  fileSizeInMegabytes: 160,
211
  },
 
 
 
 
 
 
 
212
  "littlelamb-290m": {
213
  ...createDefaultModelConfig(),
214
  label: "LittleLamb 290M",
215
  hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-LittleLamb",
216
  hfFilePath: "LittleLamb-i1-Q4_K_S-00001-of-00003.gguf",
217
  fileSizeInMegabytes: 231,
218
+ reasoningBudgetTokens: 1024,
219
  },
220
  "gemma-3-270m": {
221
  ...createDefaultModelConfig(),
 
244
  hfRepoId: "Felladrin/gguf-sharded-UD-Q4_K_XL-Qwen3-0.6B",
245
  hfFilePath: "model.shard-00001-of-00004.gguf",
246
  fileSizeInMegabytes: 406,
247
+ reasoningBudgetTokens: 1024,
248
+ },
249
+ "qwen-3.5-0.8b": {
250
+ ...createDefaultModelConfig(),
251
+ label: "Qwen 3.5 0.8B",
252
+ hfRepoId: "Felladrin/gguf-sharded-Q4_K_M-Qwen3.5-0.8B",
253
+ hfFilePath: "Qwen3.5-0.8B-Q4_K_M-00001-of-00003.gguf",
254
+ fileSizeInMegabytes: 533,
255
+ reasoningBudgetTokens: 1024,
256
  },
257
  "lfm2.5-1.2b-instruct": {
258
  ...createDefaultModelConfig(),
 
282
  hfFilePath: "model.shard-00001-of-00003.gguf",
283
  fileSizeInMegabytes: 781,
284
  },
 
 
 
 
 
 
 
285
  "olmo-2-0425-1b": {
286
  ...createDefaultModelConfig(),
287
  label: "OLMo 2 1B",
 
289
  hfFilePath: "model.shard-00001-of-00006.gguf",
290
  fileSizeInMegabytes: 967,
291
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  "smollm2-1.7b": {
293
  ...createDefaultModelConfig(),
294
  label: "SmolLM 2 1.7B",
 
316
  hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-DeepSeek-R1-Distill-Qwen-1.5B",
317
  hfFilePath: "model.shard-00001-of-00006.gguf",
318
  fileSizeInMegabytes: 1070,
319
+ reasoningBudgetTokens: 1024,
320
  },
321
  "internlm-2.5-1.8b": {
322
  ...createDefaultModelConfig(),
 
331
  hfRepoId: "Felladrin/gguf-sharded-UD-Q4_K_XL-Qwen3-1.7B",
332
  hfFilePath: "model.shard-00001-of-00005.gguf",
333
  fileSizeInMegabytes: 1140,
334
+ reasoningBudgetTokens: 1024,
335
  },
336
  "granite-3.3-2b": {
337
  ...createDefaultModelConfig(),
 
367
  hfRepoId: "Felladrin/gguf-sharded-Q4_K_M-Spark-X2.6-1.7B",
368
  hfFilePath: "Spark-X2.6-1.7B-Q4_K_M-00001-of-00004.gguf",
369
  fileSizeInMegabytes: 1769,
370
+ reasoningBudgetTokens: 1024,
371
  },
372
  "smollm3-3b": {
373
  ...createDefaultModelConfig(),
 
403
  hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-granite-4.2-3b",
404
  hfFilePath: "granite-4.2-3b-Q4_K_S-00001-of-00005.gguf",
405
  fileSizeInMegabytes: 2143,
406
+ reasoningBudgetTokens: 1024,
407
  },
408
  "phi-3.5-mini-3.8b": {
409
  ...createDefaultModelConfig(),
 
425
  hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-Polaris-4B-Preview",
426
  hfFilePath: "model.shard-00001-of-00008.gguf",
427
  fileSizeInMegabytes: 2380,
428
+ reasoningBudgetTokens: 1024,
429
  },
430
  "qwen-3.5-4b": {
431
  ...createDefaultModelConfig(),
 
433
  hfRepoId: "Felladrin/gguf-sharded-UD-Q3_K_XL-Qwen3.5-4B",
434
  hfFilePath: "Qwen3.5-4B-UD-Q3_K_XL-00001-of-00005.gguf",
435
  fileSizeInMegabytes: 2436,
436
+ reasoningBudgetTokens: 1024,
437
  },
438
  "gemma-4-e2b": {
439
  ...createDefaultModelConfig(),
 
441
  hfRepoId: "Felladrin/gguf-sharded-Q3_K_S-gemma-4-e2b-it",
442
  hfFilePath: "gemma-4-e2b-it-Q3_K_S-00001-of-00005.gguf",
443
  fileSizeInMegabytes: 2446,
444
+ reasoningBudgetTokens: 1024,
445
  },
446
  "phi-4-mini-reasoning": {
447
  ...createDefaultModelConfig(),
 
456
  hfRepoId: "Felladrin/gguf-sharded-Q4_K_M-Spark-X2.6-4B",
457
  hfFilePath: "Spark-X2.6-4B-Q4_K_M-00001-of-00007.gguf",
458
  fileSizeInMegabytes: 3543,
459
+ reasoningBudgetTokens: 1024,
460
  },
461
  };
docs/ai-integration.md CHANGED
@@ -20,11 +20,13 @@ Runs AI models entirely in the browser using WebAssembly or WebGPU. No data leav
20
  Uses `@wllama/wllama` for browser-based inference. Automatically uses WebGPU when available, falling back to CPU via WebAssembly.
21
 
22
  **Requirements:**
 
23
  - Any modern browser
24
  - ~300MB-2GB free RAM
25
  - WebGPU optional (Chrome 113+, Edge 113+) - enables GPU acceleration
26
 
27
  **How It Works:**
 
28
  1. Checks WebGPU availability via `"gpu" in navigator`
29
  2. Downloads model from HuggingFace (GGUF format, cached in the browser's Origin Private File System)
30
  3. Loads model with `n_gpu_layers: 99999` if WebGPU is present, else `0` for CPU-only
@@ -32,22 +34,25 @@ Uses `@wllama/wllama` for browser-based inference. Automatically uses WebGPU whe
32
  5. Streams tokens via the OAI-compatible `createChatCompletion` API
33
 
34
  **Pre-configured Models:**
35
- 30+ stored at `Felladrin/gguf-sharded-*` on HuggingFace. MiniSearch currently ships 39 pre-configured models, ranging from SmolLM 2 135M (~100MB) up to Spark X2.6 4B (~3.5GB). The full, authoritative list with HuggingFace repo IDs and sizes lives in `client/modules/wllama.ts` (`wllamaModels`) and is rendered in the Settings dropdown; refer to that file rather than a static table here, since models are added/swapped frequently.
36
 
37
  Two constraints decide what can join that list, both measured against the shipped wasm build:
 
38
  - **Every model file must be a shard.** Chromium's OPFS storage silently truncates files past 2000 MiB, so a monolithic GGUF above that size arrives corrupted in the browser. Shards also keep progressive download working.
39
  - **The wasm linear memory ceiling is 4 GiB.** Models at ~3.5 GB and above OOM during buffer reserve, so the practical catalog ceiling is around 3.7 GB of weights.
40
 
41
- Models whose chat template thinks by default (Granite 4.2, Gemma 4, Spark X2.6, Qwen 3.5) keep thinking: wllama splits their chain of thought into a `reasoning_content` channel, and MiniSearch wraps it in the configured reasoning markers so the thinking UI shows it while the answer follows. Thinking spends the same token budget as the answer, so these models are slower. To keep a long-winded model from thinking its way out of the context window without ever answering, thinking models ship with `reasoningBudgetTokens` (wllama's `reasoning_budget_tokens`, currently 256): once the chain of thought runs that long, the engine closes the reasoning channel and forces the final answer.
42
 
43
  `node scripts/wllama-catalog-check.cjs` HEADs every shard of every catalog model on HuggingFace and verifies the claimed sizes; run it after adding or re-sharding a model.
44
 
45
  **Configuration:**
 
46
  - Settings โ†’ Inference Type: `Browser`
47
  - Settings โ†’ Wllama Model: Select from dropdown
48
  - Settings โ†’ CPU threads: Relevant only when WebGPU is unavailable
49
 
50
  **WebGPU Detection:**
 
51
  ```typescript
52
  // client/modules/webGpu.ts
53
  /** Whether the browser supports the WebGPU API. */
@@ -55,6 +60,7 @@ export const isWebGPUAvailable = "gpu" in navigator;
55
  ```
56
 
57
  **Limitations:**
 
58
  - First load requires model download (progressive via sharded files)
59
  - Limited to smaller models (~4B params max due to browser memory)
60
  - CPU mode is 2-5x slower than WebGPU
@@ -64,24 +70,28 @@ export const isWebGPUAvailable = "gpu" in navigator;
64
  Uses OpenAI's API or any OpenAI-compatible service.
65
 
66
  **Setup:**
 
67
  1. Get API key from OpenAI or compatible provider
68
  2. Settings โ†’ Inference Type: `OpenAI`
69
  3. Settings โ†’ OpenAI API Key: Enter key
70
  4. Settings โ†’ OpenAI Model: Select or enter model ID
71
 
72
  **Supported Providers:**
 
73
  - OpenAI (gpt-4, gpt-3.5-turbo)
74
  - Anthropic (via OpenAI-compatible endpoint)
75
  - Google (Gemini via OpenAI-compatible endpoint)
76
  - Any custom provider with OpenAI-compatible API
77
 
78
  **Features:**
 
79
  - Streaming responses, built on the Vercel AI SDK (`ai` + `@ai-sdk/openai-compatible`)
80
  - Auto model selection (if blank)
81
  - On a request error, automatically retries up to 5 times, switching to a different model fetched from the provider's `/models` endpoint each time (100ms ร— attempt backoff between retries)
82
  - Reasoning content support: reasoning/thinking output is wrapped between configurable `reasoningStartMarker`/`reasoningEndMarker` settings (default `<think>` / `</think>`)
83
 
84
  **Configuration:**
 
85
  ```typescript
86
  {
87
  inferenceType: 'openai',
@@ -92,6 +102,7 @@ Uses OpenAI's API or any OpenAI-compatible service.
92
  ```
93
 
94
  **Privacy Considerations:**
 
95
  - Search queries and results sent to OpenAI
96
  - Not suitable for sensitive data
97
  - Consider internal API for private data
@@ -101,11 +112,13 @@ Uses OpenAI's API or any OpenAI-compatible service.
101
  Uses aihorde.net, a distributed volunteer GPU network.
102
 
103
  **Setup:**
 
104
  1. Settings โ†’ Inference Type: `AI Horde`
105
  2. (Optional) Settings โ†’ AI Horde API Key: Get from aihorde.net
106
  3. Settings โ†’ AI Horde Model: Select preferred model
107
 
108
  **How It Works:**
 
109
  1. Request sent to AI Horde API
110
  2. Distributed to volunteer workers
111
  3. Multiple workers may process in parallel
@@ -113,12 +126,14 @@ Uses aihorde.net, a distributed volunteer GPU network.
113
  5. Results streamed back
114
 
115
  **Features:**
 
116
  - Free to use (anonymous or authenticated)
117
  - Kudos-based priority system
118
  - Large model selection (70B+ params available)
119
  - No API key required (but recommended for priority)
120
 
121
  **Configuration:**
 
122
  ```typescript
123
  {
124
  inferenceType: 'horde',
@@ -128,6 +143,7 @@ Uses aihorde.net, a distributed volunteer GPU network.
128
  ```
129
 
130
  **Limitations:**
 
131
  - Variable latency (depends on worker availability)
132
  - Quality varies by worker
133
  - May queue during high demand
@@ -138,11 +154,13 @@ Uses aihorde.net, a distributed volunteer GPU network.
138
  Self-hosted OpenAI-compatible API for teams and compliance.
139
 
140
  **Setup:**
 
141
  1. Host an OpenAI-compatible API (e.g., vLLM, llama.cpp server, Ollama with OpenAI compat)
142
  2. Configure environment variables (see `docs/configuration.md`)
143
  3. Settings โ†’ Inference Type: `Internal`
144
 
145
  **Environment Variables:**
 
146
  ```bash
147
  INTERNAL_OPENAI_COMPATIBLE_API_BASE_URL="https://llm.company.com/v1"
148
  INTERNAL_OPENAI_COMPATIBLE_API_KEY="sk-internal-xxx"
@@ -152,12 +170,14 @@ INTERNAL_OPENAI_COMPATIBLE_API_NAME="Company LLM"
152
 
153
  **Server-Side Proxy:**
154
  The internal API uses a server-side proxy to:
 
155
  - Hide API keys from client
156
  - Add request logging/auditing
157
  - Apply rate limiting
158
  - Enable token-based authentication
159
 
160
  **Endpoint:**
 
161
  ```
162
  POST /inference?token=<argon2-hashed-search-token>
163
  Content-Type: application/json
@@ -179,12 +199,14 @@ the first token, how many models were tried, and which model ids failed. See
179
  the `/status` section of `docs/overview.md` for the field reference.
180
 
181
  **Features:**
 
182
  - Private data stays in your infrastructure
183
  - Custom model selection
184
  - Server-side logging
185
  - Compatible with any OpenAI-compatible API
186
 
187
  **Recommended Self-Hosted Options:**
 
188
  - **vLLM**: High-performance, production-ready
189
  - **llama.cpp server**: Single binary, easy setup
190
  - **Ollama**: Simple, Docker-friendly
@@ -257,6 +279,7 @@ For non-browser inference types (`openai`, `internal`, `horde`), the state skips
257
  ### Response Throttling
258
 
259
  Two PubSub update functions are throttled to 12 updates per second to ensure UI performance during high-frequency streaming:
 
260
  - `updateResponse` &rarr; `responsePubSub`
261
  - `updateReasoningContent` &rarr; `reasoningContentPubSub`
262
 
@@ -283,6 +306,7 @@ For browser inference, the system first loads the model from HuggingFace with a
283
  - **Available for Context:** 75% (~3072 tokens)
284
 
285
  **Allocation Priority:**
 
286
  1. System prompt (with search results)
287
  2. Conversation summary (if exists)
288
  3. Recent chat messages (newest first)
@@ -291,6 +315,7 @@ For browser inference, the system first loads the model from HuggingFace with a
291
  ### Rolling Summaries
292
 
293
  When conversation exceeds token budget:
 
294
  1. **Detect Overflow:** Current tokens > 3072
295
  2. **Generate Summary:** Call LLM with 800-token limit
296
  3. **Store Summary:** Save in conversationSummaryPubSub
@@ -298,6 +323,7 @@ When conversation exceeds token budget:
298
  5. **Continue:** Use summary + remaining messages for context
299
 
300
  **Summary Prompt:**
 
301
  ```
302
  Summarize this conversation in 3-5 sentences, preserving key facts
303
  and user intent. Be concise but informative.
@@ -364,6 +390,7 @@ Wllama handles both WebGPU and CPU paths internally. If the model fails to load
364
  ### State Recovery
365
 
366
  If generation fails mid-stream:
 
367
  1. Set `textGenerationState` to `failed`
368
  2. Preserve partial response in `responsePubSub`
369
  3. Allow user to retry or modify query
@@ -383,6 +410,7 @@ Wllama model shards are cached in the browser's Origin Private File System after
383
  ### Progressive Model Loading
384
 
385
  Wllama models are sharded (split into chunks):
 
386
  1. Download metadata first (small, fast)
387
  2. Download required shards progressively
388
  3. Start inference when first shards available
 
20
  Uses `@wllama/wllama` for browser-based inference. Automatically uses WebGPU when available, falling back to CPU via WebAssembly.
21
 
22
  **Requirements:**
23
+
24
  - Any modern browser
25
  - ~300MB-2GB free RAM
26
  - WebGPU optional (Chrome 113+, Edge 113+) - enables GPU acceleration
27
 
28
  **How It Works:**
29
+
30
  1. Checks WebGPU availability via `"gpu" in navigator`
31
  2. Downloads model from HuggingFace (GGUF format, cached in the browser's Origin Private File System)
32
  3. Loads model with `n_gpu_layers: 99999` if WebGPU is present, else `0` for CPU-only
 
34
  5. Streams tokens via the OAI-compatible `createChatCompletion` API
35
 
36
  **Pre-configured Models:**
37
+ Several, stored at `Felladrin/gguf-sharded-*` on HuggingFace. The full, authoritative list with HuggingFace repo IDs and sizes lives in `client/modules/wllama.ts` (`wllamaModels`) and is rendered in the Settings dropdown; refer to that file rather than a static table here, since models are added/swapped frequently.
38
 
39
  Two constraints decide what can join that list, both measured against the shipped wasm build:
40
+
41
  - **Every model file must be a shard.** Chromium's OPFS storage silently truncates files past 2000 MiB, so a monolithic GGUF above that size arrives corrupted in the browser. Shards also keep progressive download working.
42
  - **The wasm linear memory ceiling is 4 GiB.** Models at ~3.5 GB and above OOM during buffer reserve, so the practical catalog ceiling is around 3.7 GB of weights.
43
 
44
+ Models whose chat template thinks by default (Granite 4.2, Gemma 4, Spark X2.6, Qwen 3 and 3.5, Polaris, DeepSeek R1 Distill, LittleLamb) keep thinking: wllama splits their chain of thought into a `reasoning_content` channel, and MiniSearch wraps it in the configured reasoning markers so the thinking UI shows it while the answer follows. Thinking spends the same token budget as the answer, so these models are slower. To keep a long-winded model from thinking its way out of the context window without ever answering, thinking models ship with `reasoningBudgetTokens` (wllama's `reasoning_budget_tokens`, currently 1024): once the chain of thought runs that long, the engine closes the reasoning channel and forces the final answer. A cut-off chain of thought degrades the answer, so the budget is a backstop, not a target: every model also gets `reasoning_effort: "low"` in its chat template variables, which templates that support it (Granite 4.2, Spark X2.6) answer by thinking less, and the others ignore.
45
 
46
  `node scripts/wllama-catalog-check.cjs` HEADs every shard of every catalog model on HuggingFace and verifies the claimed sizes; run it after adding or re-sharding a model.
47
 
48
  **Configuration:**
49
+
50
  - Settings โ†’ Inference Type: `Browser`
51
  - Settings โ†’ Wllama Model: Select from dropdown
52
  - Settings โ†’ CPU threads: Relevant only when WebGPU is unavailable
53
 
54
  **WebGPU Detection:**
55
+
56
  ```typescript
57
  // client/modules/webGpu.ts
58
  /** Whether the browser supports the WebGPU API. */
 
60
  ```
61
 
62
  **Limitations:**
63
+
64
  - First load requires model download (progressive via sharded files)
65
  - Limited to smaller models (~4B params max due to browser memory)
66
  - CPU mode is 2-5x slower than WebGPU
 
70
  Uses OpenAI's API or any OpenAI-compatible service.
71
 
72
  **Setup:**
73
+
74
  1. Get API key from OpenAI or compatible provider
75
  2. Settings โ†’ Inference Type: `OpenAI`
76
  3. Settings โ†’ OpenAI API Key: Enter key
77
  4. Settings โ†’ OpenAI Model: Select or enter model ID
78
 
79
  **Supported Providers:**
80
+
81
  - OpenAI (gpt-4, gpt-3.5-turbo)
82
  - Anthropic (via OpenAI-compatible endpoint)
83
  - Google (Gemini via OpenAI-compatible endpoint)
84
  - Any custom provider with OpenAI-compatible API
85
 
86
  **Features:**
87
+
88
  - Streaming responses, built on the Vercel AI SDK (`ai` + `@ai-sdk/openai-compatible`)
89
  - Auto model selection (if blank)
90
  - On a request error, automatically retries up to 5 times, switching to a different model fetched from the provider's `/models` endpoint each time (100ms ร— attempt backoff between retries)
91
  - Reasoning content support: reasoning/thinking output is wrapped between configurable `reasoningStartMarker`/`reasoningEndMarker` settings (default `<think>` / `</think>`)
92
 
93
  **Configuration:**
94
+
95
  ```typescript
96
  {
97
  inferenceType: 'openai',
 
102
  ```
103
 
104
  **Privacy Considerations:**
105
+
106
  - Search queries and results sent to OpenAI
107
  - Not suitable for sensitive data
108
  - Consider internal API for private data
 
112
  Uses aihorde.net, a distributed volunteer GPU network.
113
 
114
  **Setup:**
115
+
116
  1. Settings โ†’ Inference Type: `AI Horde`
117
  2. (Optional) Settings โ†’ AI Horde API Key: Get from aihorde.net
118
  3. Settings โ†’ AI Horde Model: Select preferred model
119
 
120
  **How It Works:**
121
+
122
  1. Request sent to AI Horde API
123
  2. Distributed to volunteer workers
124
  3. Multiple workers may process in parallel
 
126
  5. Results streamed back
127
 
128
  **Features:**
129
+
130
  - Free to use (anonymous or authenticated)
131
  - Kudos-based priority system
132
  - Large model selection (70B+ params available)
133
  - No API key required (but recommended for priority)
134
 
135
  **Configuration:**
136
+
137
  ```typescript
138
  {
139
  inferenceType: 'horde',
 
143
  ```
144
 
145
  **Limitations:**
146
+
147
  - Variable latency (depends on worker availability)
148
  - Quality varies by worker
149
  - May queue during high demand
 
154
  Self-hosted OpenAI-compatible API for teams and compliance.
155
 
156
  **Setup:**
157
+
158
  1. Host an OpenAI-compatible API (e.g., vLLM, llama.cpp server, Ollama with OpenAI compat)
159
  2. Configure environment variables (see `docs/configuration.md`)
160
  3. Settings โ†’ Inference Type: `Internal`
161
 
162
  **Environment Variables:**
163
+
164
  ```bash
165
  INTERNAL_OPENAI_COMPATIBLE_API_BASE_URL="https://llm.company.com/v1"
166
  INTERNAL_OPENAI_COMPATIBLE_API_KEY="sk-internal-xxx"
 
170
 
171
  **Server-Side Proxy:**
172
  The internal API uses a server-side proxy to:
173
+
174
  - Hide API keys from client
175
  - Add request logging/auditing
176
  - Apply rate limiting
177
  - Enable token-based authentication
178
 
179
  **Endpoint:**
180
+
181
  ```
182
  POST /inference?token=<argon2-hashed-search-token>
183
  Content-Type: application/json
 
199
  the `/status` section of `docs/overview.md` for the field reference.
200
 
201
  **Features:**
202
+
203
  - Private data stays in your infrastructure
204
  - Custom model selection
205
  - Server-side logging
206
  - Compatible with any OpenAI-compatible API
207
 
208
  **Recommended Self-Hosted Options:**
209
+
210
  - **vLLM**: High-performance, production-ready
211
  - **llama.cpp server**: Single binary, easy setup
212
  - **Ollama**: Simple, Docker-friendly
 
279
  ### Response Throttling
280
 
281
  Two PubSub update functions are throttled to 12 updates per second to ensure UI performance during high-frequency streaming:
282
+
283
  - `updateResponse` &rarr; `responsePubSub`
284
  - `updateReasoningContent` &rarr; `reasoningContentPubSub`
285
 
 
306
  - **Available for Context:** 75% (~3072 tokens)
307
 
308
  **Allocation Priority:**
309
+
310
  1. System prompt (with search results)
311
  2. Conversation summary (if exists)
312
  3. Recent chat messages (newest first)
 
315
  ### Rolling Summaries
316
 
317
  When conversation exceeds token budget:
318
+
319
  1. **Detect Overflow:** Current tokens > 3072
320
  2. **Generate Summary:** Call LLM with 800-token limit
321
  3. **Store Summary:** Save in conversationSummaryPubSub
 
323
  5. **Continue:** Use summary + remaining messages for context
324
 
325
  **Summary Prompt:**
326
+
327
  ```
328
  Summarize this conversation in 3-5 sentences, preserving key facts
329
  and user intent. Be concise but informative.
 
390
  ### State Recovery
391
 
392
  If generation fails mid-stream:
393
+
394
  1. Set `textGenerationState` to `failed`
395
  2. Preserve partial response in `responsePubSub`
396
  3. Allow user to retry or modify query
 
410
  ### Progressive Model Loading
411
 
412
  Wllama models are sharded (split into chunks):
413
+
414
  1. Download metadata first (small, fast)
415
  2. Download required shards progressively
416
  3. Start inference when first shards available
docs/api.md CHANGED
@@ -392,6 +392,7 @@ a restart with different environment variables takes effect on the next reload.
392
  "accessKeysEnabled": false,
393
  "accessKeyTimeoutHours": 0,
394
  "wllamaDefaultModelId": "...",
 
395
  "internalApiEnabled": false,
396
  "internalApiName": "...",
397
  "defaultInferenceType": "...",
 
392
  "accessKeysEnabled": false,
393
  "accessKeyTimeoutHours": 0,
394
  "wllamaDefaultModelId": "...",
395
+ "wllamaDefaultGpuModelId": "...",
396
  "internalApiEnabled": false,
397
  "internalApiName": "...",
398
  "defaultInferenceType": "...",
docs/coding-conventions.md CHANGED
@@ -3,6 +3,7 @@
3
  ## Tech Stack
4
 
5
  React 19 + TypeScript + Mantine UI v9 (`@mantine/core`, `@mantine/hooks`, `@mantine/form`, `@mantine/notifications`, `@mantine/code-highlight`, `@mantine/carousel`)
 
6
  - **Build Tool**: Vite 8
7
  - **Linting/Formatting**: Biome 2
8
  - **Testing**: Vitest 5 + Testing Library
 
3
  ## Tech Stack
4
 
5
  React 19 + TypeScript + Mantine UI v9 (`@mantine/core`, `@mantine/hooks`, `@mantine/form`, `@mantine/notifications`, `@mantine/code-highlight`, `@mantine/carousel`)
6
+
7
  - **Build Tool**: Vite 8
8
  - **Linting/Formatting**: Biome 2
9
  - **Testing**: Vitest 5 + Testing Library
docs/configuration.md CHANGED
@@ -12,6 +12,7 @@ All configuration is done via environment variables. Create a `.env` file in the
12
  | `ACCESS_KEY_TIMEOUT_HOURS` | `24` | Hours to cache validated keys in browser. Set to `0` to require validation on every request |
13
 
14
  **Example:**
 
15
  ```bash
16
  ACCESS_KEYS="my-secret-key-1,my-secret-key-2"
17
  ACCESS_KEY_TIMEOUT_HOURS="24"
@@ -21,9 +22,12 @@ ACCESS_KEY_TIMEOUT_HOURS="24"
21
 
22
  Configure default models for different inference types:
23
 
24
- | Variable | Default | Description |
25
- | ------------------------- | ----------------- | ---------------------------------------------------------------------------- |
26
- | `WLLAMA_DEFAULT_MODEL_ID` | `littlelamb-290m` | Default Wllama model ID (used for both WebGPU-accelerated and CPU inference) |
 
 
 
27
 
28
  ### Server Model Request Configuration
29
 
@@ -55,6 +59,7 @@ For self-hosted OpenAI-compatible APIs:
55
  | `INTERNAL_OPENAI_COMPATIBLE_API_NAME` | `Internal API` | Display name shown in UI |
56
 
57
  **Example:**
 
58
  ```bash
59
  INTERNAL_OPENAI_COMPATIBLE_API_BASE_URL="https://llm.internal.company.com/v1"
60
  INTERNAL_OPENAI_COMPATIBLE_API_KEY="sk-internal-xxx"
@@ -103,6 +108,7 @@ When SearXNG fails on a text search, the server can retry that search against se
103
  `SEARCH_FALLBACK_PROVIDER` and `SEARCH_FALLBACK_API_KEY` are gone. If either is still set to a non-empty value while `SEARCH_FALLBACK_ENABLED` is on, the server stops at start with an error that names the variable to use instead, so an upgrade cannot silently drop a key: move the key to `SEARCH_FALLBACK_PARALLEL_API_KEY` or `SEARCH_FALLBACK_YOUCOM_API_KEY`, and the provider choice to `SEARCH_FALLBACK_PROVIDERS`.
104
 
105
  Each provider has its own terms, and each operator is responsible for following them:
 
106
  - **Parallel**: Parallel describes its keyless tier as for exploration and light use, and asks for an account and an API key for production use ([docs.parallel.ai](https://docs.parallel.ai/integrations/mcp/search-mcp)).
107
  - **You.com**: the keyless `profile=free` endpoint allows 100 queries per day ([you.com](https://you.com/docs/build-with-agents/mcp-server)). Its API acceptable use policy asks integrations to honor 429 responses ([you.com](https://you.com/acceptable-use-policy-may-2026)).
108
 
@@ -142,7 +148,7 @@ Settings are stored in browser localStorage and can be changed via the Settings
142
  | `inferenceType` | enum | `'browser'` | AI provider: `browser`, `openai`, `horde`, `internal` |
143
  | `cpuThreads` | number | (auto) | Number of CPU threads for inference (Wllama), defaults to half the logical processors (`navigator.hardwareConcurrency / 2`), minimum 1 |
144
  | `allowAiModelDownload` | boolean | `false` | Allow automatic AI model downloads |
145
- | `wllamaModelId` | string | `WLLAMA_DEFAULT_MODEL_ID` env var | Default Wllama model ID |
146
  | `hordeApiKey` | string | `'0000000000'` | AI Horde API key (default is anonymous) |
147
  | `hordeModel` | string | `''` | Specific AI Horde model to request |
148
  | `openAiApiBaseUrl` | string | `''` | Base URL for the OpenAI-compatible API |
@@ -153,17 +159,19 @@ Settings are stored in browser localStorage and can be changed via the Settings
153
  ### Model Selection
154
 
155
  **Wllama Models:**
156
- - 39 pre-configured models
157
- - Range from 135M to 4B parameters
158
  - All quantized to a Q3/Q4-class quant (Q4_K_S, Q4_K_M, Q3_K_S, UD-Q3_K_XL or UD-Q4_K_XL)
159
  - Stored at: `Felladrin/gguf-sharded-*` on HuggingFace, always as sharded GGUFs
160
 
161
  **OpenAI/Internal:**
 
162
  - Any OpenAI-compatible API
163
  - Auto-model detection if not specified
164
  - Supports streaming and reasoning models
165
 
166
  **AI Horde:**
 
167
  - Uses aihorde.net distributed network
168
  - Anonymous or authenticated access
169
  - Parallel generation with race conditions
@@ -184,15 +192,15 @@ The default system prompt supports template placeholders populated at runtime:
184
 
185
  ```typescript
186
  {
187
- systemPrompt: `Answer using the search results below as your primary source, supplemented by your own knowledge when needed. Write your response in the same language as the query.
188
 
189
- Cite every fact taken from the search results with an inline Markdown link immediately after it. Format: [domain.com](https://full-url). Use only the top-level domain (no https://, www., or paths) as link text. Example: [youtube.com](https://www.youtube.com/watch?v=dQw4w9WgXcQ).
190
 
191
- When the search results disagree with each other, point out the conflict. When you rely on your own knowledge because the results don't cover something, make that clear rather than presenting it as sourced.
192
 
193
- Today's date is {{currentDate}}. Use it to resolve relative date references in both the question and the results.
194
 
195
- You are allowed to use these Markdown elements: anchor, bold, italic, code, quote, table.
196
 
197
  Search results:
198
 
@@ -203,6 +211,7 @@ Search results:
203
  ```
204
 
205
  **Placeholders:**
 
206
  - `{{currentDate}}`: Current date injected at generation time
207
  - `{{dateTime}}`: Alias for `{{currentDate}}` - both are replaced with the same current date value
208
  - `{{searchResults}}`: Formatted search results from the web search, including the page excerpts when `enablePageContentFetch` is on
@@ -253,6 +262,7 @@ Same structure but without volume mounts and with pre-built assets.
253
  ### Dockerfile Environment
254
 
255
  The Dockerfile sets up a single runtime stage:
 
256
  - Node.js LTS
257
  - Python 3 + SearXNG
258
 
@@ -350,6 +360,7 @@ services:
350
  ```
351
 
352
  Two things about that command are required, not optional:
 
353
  - **The file must be readable by uid 1000.** The container runs as `node`, and a file readable only by its owner on the host is invisible to it.
354
  - **`secret_key` must be set to your own random value.** SearXNG refuses to start on the `ultrasecretkey` placeholder and logs `server.secret_key is not changed. Please use something else instead of ultrasecretkey.` The image's own file never carries the placeholder, because the Dockerfile replaces it at build time, but a file you write has to carry a real key.
355
 
@@ -388,6 +399,7 @@ Client-facing configuration (access keys, inference type, internal API settings)
388
  "accessKeysEnabled": true,
389
  "accessKeyTimeoutHours": 24,
390
  "wllamaDefaultModelId": "littlelamb-290m",
 
391
  "internalApiEnabled": true,
392
  "internalApiName": "Internal API",
393
  "defaultInferenceType": "browser",
@@ -404,6 +416,7 @@ Client-facing configuration (access keys, inference type, internal API settings)
404
  | `ACCESS_KEYS` | Runtime | Read from `/api/config` |
405
  | `ACCESS_KEY_TIMEOUT_HOURS` | Runtime | Read from `/api/config` |
406
  | `WLLAMA_DEFAULT_MODEL_ID` | Runtime | Read from `/api/config` |
 
407
  | `INTERNAL_OPENAI_COMPATIBLE_API_*` | Runtime | Read from `/api/config` (except `API_KEY` which is server-only) |
408
  | `DEFAULT_INFERENCE_TYPE` | Runtime | Read from `/api/config` |
409
  | Search token | Runtime | Read from `/api/config`, so a reload picks up the token of whichever server answers |
@@ -451,6 +464,7 @@ MiniSearch logs internal events to an in-app log panel (see the Logs section of
451
  **Diagnosing empty search results:** the client distinguishes a search that returned no results (a no-results alert, state stays `completed`) from one that failed outright on an outage (a distinct failed state, with a retry on text searches). An empty response that names unresponsive engines is retried within the same budget as a 500 and counts as the second if it is still empty when the retries are spent, since a rate-limited, suspended or CAPTCHA-challenged engine is reported that way and not with a status code. The actual reason is printed to the server's console (via `server/webSearchService.ts`, always-on `debug` logging), either the SearXNG engines that failed (timeouts, suspensions, rate limits, from SearXNG's `unresponsive_engines` field) or a note that all returned results were discarded during processing (missing title, snippet, or media source). Check the server logs (`docker compose logs`) when troubleshooting failed searches.
452
 
453
  Check effective configuration:
 
454
  ```typescript
455
  // In browser console
456
  console.log("Settings:", JSON.parse(localStorage.getItem("settings") || "{}"));
 
12
  | `ACCESS_KEY_TIMEOUT_HOURS` | `24` | Hours to cache validated keys in browser. Set to `0` to require validation on every request |
13
 
14
  **Example:**
15
+
16
  ```bash
17
  ACCESS_KEYS="my-secret-key-1,my-secret-key-2"
18
  ACCESS_KEY_TIMEOUT_HOURS="24"
 
22
 
23
  Configure default models for different inference types:
24
 
25
+ | Variable | Default | Description |
26
+ | ----------------------------- | ----------------- | --------------------------------------------------------------------------------------------- |
27
+ | `WLLAMA_DEFAULT_MODEL_ID` | `littlelamb-290m` | Default Wllama model ID for browsers without WebGPU, where the model runs on the CPU |
28
+ | `WLLAMA_DEFAULT_GPU_MODEL_ID` | `gemma-3-4b` | Default Wllama model ID for browsers with WebGPU. It does not fall back to the variable above |
29
+
30
+ Both only seed a profile that has never saved settings; a user's own choice always wins. Detection is the same `"gpu" in navigator` check that decides whether the model's layers go to the GPU (`client/modules/webGpu.ts`).
31
 
32
  ### Server Model Request Configuration
33
 
 
59
  | `INTERNAL_OPENAI_COMPATIBLE_API_NAME` | `Internal API` | Display name shown in UI |
60
 
61
  **Example:**
62
+
63
  ```bash
64
  INTERNAL_OPENAI_COMPATIBLE_API_BASE_URL="https://llm.internal.company.com/v1"
65
  INTERNAL_OPENAI_COMPATIBLE_API_KEY="sk-internal-xxx"
 
108
  `SEARCH_FALLBACK_PROVIDER` and `SEARCH_FALLBACK_API_KEY` are gone. If either is still set to a non-empty value while `SEARCH_FALLBACK_ENABLED` is on, the server stops at start with an error that names the variable to use instead, so an upgrade cannot silently drop a key: move the key to `SEARCH_FALLBACK_PARALLEL_API_KEY` or `SEARCH_FALLBACK_YOUCOM_API_KEY`, and the provider choice to `SEARCH_FALLBACK_PROVIDERS`.
109
 
110
  Each provider has its own terms, and each operator is responsible for following them:
111
+
112
  - **Parallel**: Parallel describes its keyless tier as for exploration and light use, and asks for an account and an API key for production use ([docs.parallel.ai](https://docs.parallel.ai/integrations/mcp/search-mcp)).
113
  - **You.com**: the keyless `profile=free` endpoint allows 100 queries per day ([you.com](https://you.com/docs/build-with-agents/mcp-server)). Its API acceptable use policy asks integrations to honor 429 responses ([you.com](https://you.com/acceptable-use-policy-may-2026)).
114
 
 
148
  | `inferenceType` | enum | `'browser'` | AI provider: `browser`, `openai`, `horde`, `internal` |
149
  | `cpuThreads` | number | (auto) | Number of CPU threads for inference (Wllama), defaults to half the logical processors (`navigator.hardwareConcurrency / 2`), minimum 1 |
150
  | `allowAiModelDownload` | boolean | `false` | Allow automatic AI model downloads |
151
+ | `wllamaModelId` | string | WebGPU or CPU default, see above. | Default Wllama model ID, chosen by whether the browser has WebGPU |
152
  | `hordeApiKey` | string | `'0000000000'` | AI Horde API key (default is anonymous) |
153
  | `hordeModel` | string | `''` | Specific AI Horde model to request |
154
  | `openAiApiBaseUrl` | string | `''` | Base URL for the OpenAI-compatible API |
 
159
  ### Model Selection
160
 
161
  **Wllama Models:**
162
+
163
+ - Several pre-configured models, listed in `client/modules/wllama.ts`
164
  - All quantized to a Q3/Q4-class quant (Q4_K_S, Q4_K_M, Q3_K_S, UD-Q3_K_XL or UD-Q4_K_XL)
165
  - Stored at: `Felladrin/gguf-sharded-*` on HuggingFace, always as sharded GGUFs
166
 
167
  **OpenAI/Internal:**
168
+
169
  - Any OpenAI-compatible API
170
  - Auto-model detection if not specified
171
  - Supports streaming and reasoning models
172
 
173
  **AI Horde:**
174
+
175
  - Uses aihorde.net distributed network
176
  - Anonymous or authenticated access
177
  - Parallel generation with race conditions
 
192
 
193
  ```typescript
194
  {
195
+ systemPrompt: `Answer the question using the search results below. Reply in the same language as the question.
196
 
197
+ Cite each fact with a Markdown link right after it, using the site's domain as the link text. Example: [example.com](https://example.com/page).
198
 
199
+ If you answer from your own knowledge because the results do not cover it, say so.
200
 
201
+ Use only these Markdown elements: link, bold, italic, code, quote, table.
202
 
203
+ Today's date is {{currentDate}}. Use it for relative dates such as "yesterday".
204
 
205
  Search results:
206
 
 
211
  ```
212
 
213
  **Placeholders:**
214
+
215
  - `{{currentDate}}`: Current date injected at generation time
216
  - `{{dateTime}}`: Alias for `{{currentDate}}` - both are replaced with the same current date value
217
  - `{{searchResults}}`: Formatted search results from the web search, including the page excerpts when `enablePageContentFetch` is on
 
262
  ### Dockerfile Environment
263
 
264
  The Dockerfile sets up a single runtime stage:
265
+
266
  - Node.js LTS
267
  - Python 3 + SearXNG
268
 
 
360
  ```
361
 
362
  Two things about that command are required, not optional:
363
+
364
  - **The file must be readable by uid 1000.** The container runs as `node`, and a file readable only by its owner on the host is invisible to it.
365
  - **`secret_key` must be set to your own random value.** SearXNG refuses to start on the `ultrasecretkey` placeholder and logs `server.secret_key is not changed. Please use something else instead of ultrasecretkey.` The image's own file never carries the placeholder, because the Dockerfile replaces it at build time, but a file you write has to carry a real key.
366
 
 
399
  "accessKeysEnabled": true,
400
  "accessKeyTimeoutHours": 24,
401
  "wllamaDefaultModelId": "littlelamb-290m",
402
+ "wllamaDefaultGpuModelId": "gemma-3-4b",
403
  "internalApiEnabled": true,
404
  "internalApiName": "Internal API",
405
  "defaultInferenceType": "browser",
 
416
  | `ACCESS_KEYS` | Runtime | Read from `/api/config` |
417
  | `ACCESS_KEY_TIMEOUT_HOURS` | Runtime | Read from `/api/config` |
418
  | `WLLAMA_DEFAULT_MODEL_ID` | Runtime | Read from `/api/config` |
419
+ | `WLLAMA_DEFAULT_GPU_MODEL_ID` | Runtime | Read from `/api/config` |
420
  | `INTERNAL_OPENAI_COMPATIBLE_API_*` | Runtime | Read from `/api/config` (except `API_KEY` which is server-only) |
421
  | `DEFAULT_INFERENCE_TYPE` | Runtime | Read from `/api/config` |
422
  | Search token | Runtime | Read from `/api/config`, so a reload picks up the token of whichever server answers |
 
464
  **Diagnosing empty search results:** the client distinguishes a search that returned no results (a no-results alert, state stays `completed`) from one that failed outright on an outage (a distinct failed state, with a retry on text searches). An empty response that names unresponsive engines is retried within the same budget as a 500 and counts as the second if it is still empty when the retries are spent, since a rate-limited, suspended or CAPTCHA-challenged engine is reported that way and not with a status code. The actual reason is printed to the server's console (via `server/webSearchService.ts`, always-on `debug` logging), either the SearXNG engines that failed (timeouts, suspensions, rate limits, from SearXNG's `unresponsive_engines` field) or a note that all returned results were discarded during processing (missing title, snippet, or media source). Check the server logs (`docker compose logs`) when troubleshooting failed searches.
465
 
466
  Check effective configuration:
467
+
468
  ```typescript
469
  // In browser console
470
  console.log("Settings:", JSON.parse(localStorage.getItem("settings") || "{}"));
docs/core-technologies.md CHANGED
@@ -29,6 +29,7 @@
29
  ## Technology Selection Criteria
30
 
31
  Technologies are chosen based on:
 
32
  - **Agent legibility**: Easy for agents to model and reason about
33
  - **Stability**: Mature, well-documented libraries
34
  - **Composability**: Clean APIs that work well together
 
29
  ## Technology Selection Criteria
30
 
31
  Technologies are chosen based on:
32
+
33
  - **Agent legibility**: Easy for agents to model and reason about
34
  - **Stability**: Mature, well-documented libraries
35
  - **Composability**: Clean APIs that work well together
docs/development-commands.md CHANGED
@@ -26,13 +26,47 @@ Failure-injection cases (dependency down, empty results, aborted stream) are cat
26
  `eval/` is an offline eval that gives a regression signal for changes to the
27
  reranker, the system prompt, the search-results formatting, or the model. See
28
  `eval/README.md` for details and the LLM-judge environment variables.
 
29
  - **`npm run eval`**: Run the full eval (retrieval + answer)
30
  - **`npm run eval:retrieval`**: Retrieval eval (real ONNX reranker; local only, needs the model in `server/models/`)
31
  - **`npm run eval:answer`**: Answer eval (LLM judge; gated on `EVAL_LLM_API_KEY`, skips without one)
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  ### Coverage Reports for AI Analysis
34
 
35
  After running `test:coverage`, AI agents can analyze these JSON files:
 
36
  - **`coverage/coverage-summary.json`**: Quick metrics view - overall percentages per file
37
 
38
  ```json
@@ -52,6 +86,7 @@ After running `test:coverage`, AI agents can analyze these JSON files:
52
  - Maps statement/branch/function IDs to source locations
53
 
54
  AI agents can parse these to identify:
 
55
  - Files with coverage below thresholds
56
  - Uncovered lines and branches
57
  - Functions without tests
@@ -78,6 +113,7 @@ The repository uses nine GitHub Actions workflows for continuous integration, de
78
  ### Reusable Workflow (`reusable-check-docker.yml`)
79
 
80
  Used by both `on-push-to-main` and `on-pull-request-to-main` to run the production container smoke test:
 
81
  1. **check-docker-container** - Builds and starts the production container with `docker compose -f docker-compose.production.yml up -d`, then verifies the main page returns HTTP 200 within 60 seconds
82
 
83
  ### Docker Image Builds
 
26
  `eval/` is an offline eval that gives a regression signal for changes to the
27
  reranker, the system prompt, the search-results formatting, or the model. See
28
  `eval/README.md` for details and the LLM-judge environment variables.
29
+
30
  - **`npm run eval`**: Run the full eval (retrieval + answer)
31
  - **`npm run eval:retrieval`**: Retrieval eval (real ONNX reranker; local only, needs the model in `server/models/`)
32
  - **`npm run eval:answer`**: Answer eval (LLM judge; gated on `EVAL_LLM_API_KEY`, skips without one)
33
 
34
+ ## wllama benchmark
35
+
36
+ `npm run bench:wllama` loads a wllama model in headless Chromium, times it on the questions in `scripts/wllama-bench/cases.json`, and scores the answers. It goes through MiniSearch's own code: the catalog entry in `client/modules/wllama.ts`, the warmup-then-load in `initializeWllama`, and the chat messages built from search results and page excerpts. So the numbers and answers are the ones a user would get. Use it to vet a model before it joins the catalog, or to compare catalog models. The scoring rules and the latest results are in [wllama-model-evaluation.md](wllama-model-evaluation.md).
37
+
38
+ ```bash
39
+ npm run bench:wllama -- --model qwen-3.5-0.8b --model granite-4.2-3b --device webgpu
40
+ npm run bench:wllama -- --model owner/repo/Model-Q4_K_M-00001-of-00003.gguf --template-kwargs '{"enable_thinking":false}'
41
+ ```
42
+
43
+ | Option | Default | Meaning |
44
+ | ---------------------- | -------------------- | -------------------------------------------------------------------------------------- |
45
+ | `--model` (repeatable) | required | A catalog id, or `owner/repo/file.gguf` on Hugging Face for a model not in the catalog |
46
+ | `--device` | `both` | `webgpu`, `cpu` (`n_gpu_layers: 0`, what MiniSearch does without WebGPU), or `both` |
47
+ | `--runs` | `1` | Repetitions per model and device |
48
+ | `--threads` | `cpuThreads` setting | CPU threads |
49
+ | `--template-kwargs` | catalog value | JSON for `chat_template_kwargs`; replaces the catalog's |
50
+ | `--reasoning-budget` | catalog value | `reasoning_budget_tokens`, applied at load time as the app does |
51
+ | `--chrome` | Playwright Chromium | Path to another Chromium binary |
52
+ | `--json` | none | Writes every result, including the full reasoning and answer, to this file |
53
+ | `--cases` | `cases.json` | Another question set with the same shape |
54
+ | `--case-timeout` | `300` | Seconds before an answer is cut off; the scorer counts the cut as a violation |
55
+ | `--profile` | see below | Browser profile directory; two runs at once need two, since Chromium locks one in use |
56
+ | `--system-prompt` | none | A file with another system prompt, to measure a change to it before shipping it |
57
+ | `--verbose` | off | Streams the page console, llama.cpp's log included |
58
+
59
+ Things to know:
60
+
61
+ - Run it on the host, not in the dev container, which has no browser or GPU. It needs the host's `npm install` and Playwright's Chromium (`npx playwright install chromium`).
62
+ - An old system Chrome is not a stand-in: Chrome 137 rejects the `subgroup_id` WGSL builtin that wllama's WebGPU shaders use, so every model aborts on WebGPU there.
63
+ - The browser profile lives in `<system temp>/minisearch-wllama-bench-profile`, so OPFS keeps each model after its first download. Delete that folder to reclaim the space.
64
+ - On a failure the script prints the page's last console lines; llama.cpp's reason for an abort is usually among them.
65
+
66
  ### Coverage Reports for AI Analysis
67
 
68
  After running `test:coverage`, AI agents can analyze these JSON files:
69
+
70
  - **`coverage/coverage-summary.json`**: Quick metrics view - overall percentages per file
71
 
72
  ```json
 
86
  - Maps statement/branch/function IDs to source locations
87
 
88
  AI agents can parse these to identify:
89
+
90
  - Files with coverage below thresholds
91
  - Uncovered lines and branches
92
  - Functions without tests
 
113
  ### Reusable Workflow (`reusable-check-docker.yml`)
114
 
115
  Used by both `on-push-to-main` and `on-pull-request-to-main` to run the production container smoke test:
116
+
117
  1. **check-docker-container** - Builds and starts the production container with `docker compose -f docker-compose.production.yml up -d`, then verifies the main page returns HTTP 200 within 60 seconds
118
 
119
  ### Docker Image Builds
docs/glossary.md CHANGED
@@ -7,6 +7,7 @@ Codebase-specific terms, jargon, and domain concepts used in MiniSearch.
7
  ### Search Token & Hash
8
 
9
  A security mechanism used to authorize communication between the client and the internal search/AI endpoints.
 
10
  - **Search Token**: A random string held by the running server, served to the client at runtime through `/api/config`. Used to verify that requests to the server come from a client that server handed the token to.
11
  - **Search Token Hash**: To avoid exposing the raw token in all requests, the client generates a hash of the token. Managed via the `lastSearchTokenHashPubSub` channel.
12
  - **Verification**: The server verifies these tokens to prevent unauthorized access to the search API. Stored in `server/verifiedTokens.ts` as an in-memory `Set<string>`.
@@ -25,6 +26,7 @@ MiniSearch supports multiple backends for Large Language Model (LLM) inference,
25
  ### PubSub (State Management)
26
 
27
  Instead of a heavy state management library like Redux, MiniSearch uses a minimalist Publish-Subscribe pattern powered by the `create-pubsub` library.
 
28
  - **Data Flow**: Components subscribe to "channels" (e.g., `queryPubSub`, `responsePubSub`)
29
  - **Tuple Pattern**: Each channel is a 3-element tuple: `[update, subscribe, get]`
30
  - **Persistence**: Some channels use `createLocalStoragePubSub` to automatically sync state with `localStorage`
@@ -33,6 +35,7 @@ Instead of a heavy state management library like Redux, MiniSearch uses a minima
33
  ### Reranker
34
 
35
  A secondary search stage that takes initial results from SearXNG and re-orders them based on relevance to the query using a multilingual cross-encoder model (`mmarco-mMiniLMv2-L12-H384-v1`) running in-process via ONNX Runtime.
 
36
  - **Implementation**: Loads the model's ONNX export with `onnxruntime-node`; no child process
37
  - **Health Check**: Polls `/health` endpoint via `getRerankerStatus`
38
  - **Scoring**: Results filtered using standard deviation thresholds (`kStandardDeviationFactor = 0.3`)
@@ -41,6 +44,7 @@ A secondary search stage that takes initial results from SearXNG and re-orders t
41
  ### Wllama
42
 
43
  A WebAssembly (WASM) based integration of `llama.cpp` for running LLMs on the CPU in the browser.
 
44
  - **Initialization**: Loads models from HuggingFace using `initializeWllama`
45
  - **Warmup**: Includes a warmup phase with a single token completion using `n_threads: 1`
46
  - **OPFS**: Uses the Origin Private File System via Wllama's cache manager to store model shards locally
@@ -49,6 +53,7 @@ A WebAssembly (WASM) based integration of `llama.cpp` for running LLMs on the CP
49
  ### AI Horde
50
 
51
  A crowdsourced distributed cluster of workers providing AI inference. MiniSearch integrates with it using a polling strategy against the `/generate/text/status` endpoint.
 
52
  - **Kudos**: Virtual currency used by the Horde. Default anonymous key is `0000000000`
53
  - **Polling**: Requests sent to async API, status checked periodically until completion
54
  - **Cancellation**: Can abort generation via `DELETE` on the status endpoint
@@ -56,6 +61,7 @@ A crowdsourced distributed cluster of workers providing AI inference. MiniSearch
56
  ### Conversation Memory & Rolling Summary
57
 
58
  A mechanism to handle long chats that exceed the LLM context window.
 
59
  - **Summarization**: When older messages are dropped, `createLlmSummary` asks the LLM to condense them under a limit of 800 tokens
60
  - **Extractive Fallback**: If LLM summarization fails, `summarizeDroppedMessages` uses a token-counting extractive approach
61
  - **Token Budget**: Computed based on `openAiContextLength` setting and current message count
@@ -73,6 +79,7 @@ GPT-Generated Unified Format. Binary format for storing LLM weights, optimized f
73
  ### Dexie
74
 
75
  A minimalist wrapper for IndexedDB used for client-side persistence. MiniSearch uses two Dexie databases:
 
76
  - **SearchCacheDatabase**: Temporary cache with TTL-based expiration
77
  - **HistoryDatabase**: Long-term search history with retention policies
78
 
 
7
  ### Search Token & Hash
8
 
9
  A security mechanism used to authorize communication between the client and the internal search/AI endpoints.
10
+
11
  - **Search Token**: A random string held by the running server, served to the client at runtime through `/api/config`. Used to verify that requests to the server come from a client that server handed the token to.
12
  - **Search Token Hash**: To avoid exposing the raw token in all requests, the client generates a hash of the token. Managed via the `lastSearchTokenHashPubSub` channel.
13
  - **Verification**: The server verifies these tokens to prevent unauthorized access to the search API. Stored in `server/verifiedTokens.ts` as an in-memory `Set<string>`.
 
26
  ### PubSub (State Management)
27
 
28
  Instead of a heavy state management library like Redux, MiniSearch uses a minimalist Publish-Subscribe pattern powered by the `create-pubsub` library.
29
+
30
  - **Data Flow**: Components subscribe to "channels" (e.g., `queryPubSub`, `responsePubSub`)
31
  - **Tuple Pattern**: Each channel is a 3-element tuple: `[update, subscribe, get]`
32
  - **Persistence**: Some channels use `createLocalStoragePubSub` to automatically sync state with `localStorage`
 
35
  ### Reranker
36
 
37
  A secondary search stage that takes initial results from SearXNG and re-orders them based on relevance to the query using a multilingual cross-encoder model (`mmarco-mMiniLMv2-L12-H384-v1`) running in-process via ONNX Runtime.
38
+
39
  - **Implementation**: Loads the model's ONNX export with `onnxruntime-node`; no child process
40
  - **Health Check**: Polls `/health` endpoint via `getRerankerStatus`
41
  - **Scoring**: Results filtered using standard deviation thresholds (`kStandardDeviationFactor = 0.3`)
 
44
  ### Wllama
45
 
46
  A WebAssembly (WASM) based integration of `llama.cpp` for running LLMs on the CPU in the browser.
47
+
48
  - **Initialization**: Loads models from HuggingFace using `initializeWllama`
49
  - **Warmup**: Includes a warmup phase with a single token completion using `n_threads: 1`
50
  - **OPFS**: Uses the Origin Private File System via Wllama's cache manager to store model shards locally
 
53
  ### AI Horde
54
 
55
  A crowdsourced distributed cluster of workers providing AI inference. MiniSearch integrates with it using a polling strategy against the `/generate/text/status` endpoint.
56
+
57
  - **Kudos**: Virtual currency used by the Horde. Default anonymous key is `0000000000`
58
  - **Polling**: Requests sent to async API, status checked periodically until completion
59
  - **Cancellation**: Can abort generation via `DELETE` on the status endpoint
 
61
  ### Conversation Memory & Rolling Summary
62
 
63
  A mechanism to handle long chats that exceed the LLM context window.
64
+
65
  - **Summarization**: When older messages are dropped, `createLlmSummary` asks the LLM to condense them under a limit of 800 tokens
66
  - **Extractive Fallback**: If LLM summarization fails, `summarizeDroppedMessages` uses a token-counting extractive approach
67
  - **Token Budget**: Computed based on `openAiContextLength` setting and current message count
 
79
  ### Dexie
80
 
81
  A minimalist wrapper for IndexedDB used for client-side persistence. MiniSearch uses two Dexie databases:
82
+
83
  - **SearchCacheDatabase**: Temporary cache with TTL-based expiration
84
  - **HistoryDatabase**: Long-term search history with retention policies
85
 
docs/overview.md CHANGED
@@ -33,6 +33,7 @@ MiniSearch integrates multiple technology stacks within a unified deployment con
33
  ## Application Entry Points
34
 
35
  The application has three primary entry points:
 
36
  1. **Browser Entry**: `client/index.tsx` initializes the React application, mounting the root component and setting up error boundaries.
37
 
38
  2. **Server Entry**: `vite.config.ts` configures the Vite development and preview servers, registering server hooks for search and inference endpoints.
@@ -42,6 +43,7 @@ The application has three primary entry points:
42
  ## Multi-Service Container Architecture
43
 
44
  The Docker container runs three services concurrently:
 
45
  - **SearXNG** - Privacy-focused metasearch engine
46
  - **ONNX Runtime** - In-process inference for result reranking
47
  - **Node.js application** - Main application server
@@ -57,6 +59,7 @@ PubSub channels are created using the create-pubsub package and provide type-saf
57
  ## Data Persistence Strategy
58
 
59
  MiniSearch employs a dual-layer persistence approach:
 
60
  - **IndexedDB** - Local storage for search history, settings, cached results, and saved AI transcripts
61
  - **TTL-based caching** - 15-minute freshness cache for search results to minimize API calls, with a 24-hour stale retention as a fallback when the live search fails
62
 
@@ -112,6 +115,7 @@ The `textGeneration` module orchestrates the entire search-to-response flow, man
112
  ### Web Search Service Reliability
113
 
114
  `server/webSearchService.ts` implements resilience patterns for SearXNG integration:
 
115
  - **Circuit Breaker**: Opens after 5 consecutive failures, blocking requests for 60 seconds before attempting reset
116
  - **Retry Logic**: Exponential backoff for HTTP 500 errors, up to 3 retries
117
  - **Fail-Fast on Suspending Engines**: An empty response in which every unresponsive engine is under a long suspension (CAPTCHA, rate limit, access denied; SearXNG suspends them for an hour to a day) throws on the first attempt instead of spending the retry budget, which it could not possibly outlast. Transient engine errors (timeouts, server API errors) keep the full retry budget.
@@ -123,6 +127,7 @@ None of this changes which engines answer. That is decided inside SearXNG, and w
123
  ### Search Token Lifecycle
124
 
125
  CSRF protection uses a token the server owns for its lifetime:
 
126
  1. **Generation**: `regenerateSearchToken()` draws 32 random bytes on first use in a process and writes them to the token file; the file is a record, never read back as a source of truth
127
  2. **Storage**: The token is held in memory for the life of the process, and recorded at `{os.tempdir()}/minisearch-token` with `0600` permissions
128
  3. **Distribution**: Server serves the token to the client at runtime through `/api/config`, so a client always holds the token of the server answering it
@@ -140,6 +145,7 @@ MiniSearch uses a PubSub-based architecture where state flows through independen
140
  ### State Machine Transitions
141
 
142
  **Text Generation States:**
 
143
  - `idle` - No active generation
144
  - `awaitingModelDownloadAllowance` - Waiting for user consent to download a browser model
145
  - `loadingModel` - Downloading or initializing the browser (Wllama) model
@@ -151,6 +157,7 @@ MiniSearch uses a PubSub-based architecture where state flows through independen
151
  - `failed` - Error occurred
152
 
153
  **Search States:**
 
154
  - `idle` - No active search
155
  - `running` - Search in progress
156
  - `completed` - Results received
@@ -206,6 +213,7 @@ MiniSearch implements all server-side logic as Vite plugin hooks. Each hook regi
206
  | `rerankerServiceHook` | `server/rerankerServiceHook.ts` | Reranker model lifecycle management for result reranking |
207
 
208
  Key server-side modules:
 
209
  - **`server/webSearchService.ts`**: Integrates with SearXNG at `http://127.0.0.1:8888`. Implements a circuit breaker (opens after 5 failures, resets after 60s) and retry logic (up to 3 retries with exponential backoff, for 500s and for empty responses naming transiently unresponsive engines; an all-suspended set fails fast on the first attempt, since SearXNG suspensions last an hour to a day).
210
  - **`server/pageContentService.ts`**: Reads result pages for answer grounding: SSRF-guarded fetches with a byte cap, readable-text extraction, and query-relevant passage selection. Reads run under a per-host circuit breaker (`server/pageReadHostBreaker.ts`) that skips a host for 5 minutes after 3 refusals in a row, then probes it with one read.
211
  - **`server/searchToken.ts`**: Manages a token at `{os.tempdir()}/minisearch-token` used for CSRF protection on search requests.
@@ -437,6 +445,7 @@ MiniSearch uses a multi-layered client-side persistence strategy:
437
  ### IndexedDB Databases
438
 
439
  Two separate Dexie databases handle different persistence needs:
 
440
  1. **SearchCacheDatabase** (`client/modules/search.ts`): Temporary cache for search results with TTL-based expiration. Table schema:
441
  - `textSearchHistory`: Keyed by hashed query, indexed by timestamp
442
  - `imageSearchHistory`: Keyed by hashed query, indexed by timestamp
@@ -464,6 +473,7 @@ Two separate Dexie databases handle different persistence needs:
464
  ### localStorage Persistence
465
 
466
  Lightweight state persisted across sessions via `createLocalStoragePubSub` pattern:
 
467
  - `settings`: Application preferences (inference type, model, UI options)
468
  - `querySuggestions`: Shuffled search suggestion pool
469
  - `lastSearchTokenHash`: Cached security token hash
 
33
  ## Application Entry Points
34
 
35
  The application has three primary entry points:
36
+
37
  1. **Browser Entry**: `client/index.tsx` initializes the React application, mounting the root component and setting up error boundaries.
38
 
39
  2. **Server Entry**: `vite.config.ts` configures the Vite development and preview servers, registering server hooks for search and inference endpoints.
 
43
  ## Multi-Service Container Architecture
44
 
45
  The Docker container runs three services concurrently:
46
+
47
  - **SearXNG** - Privacy-focused metasearch engine
48
  - **ONNX Runtime** - In-process inference for result reranking
49
  - **Node.js application** - Main application server
 
59
  ## Data Persistence Strategy
60
 
61
  MiniSearch employs a dual-layer persistence approach:
62
+
63
  - **IndexedDB** - Local storage for search history, settings, cached results, and saved AI transcripts
64
  - **TTL-based caching** - 15-minute freshness cache for search results to minimize API calls, with a 24-hour stale retention as a fallback when the live search fails
65
 
 
115
  ### Web Search Service Reliability
116
 
117
  `server/webSearchService.ts` implements resilience patterns for SearXNG integration:
118
+
119
  - **Circuit Breaker**: Opens after 5 consecutive failures, blocking requests for 60 seconds before attempting reset
120
  - **Retry Logic**: Exponential backoff for HTTP 500 errors, up to 3 retries
121
  - **Fail-Fast on Suspending Engines**: An empty response in which every unresponsive engine is under a long suspension (CAPTCHA, rate limit, access denied; SearXNG suspends them for an hour to a day) throws on the first attempt instead of spending the retry budget, which it could not possibly outlast. Transient engine errors (timeouts, server API errors) keep the full retry budget.
 
127
  ### Search Token Lifecycle
128
 
129
  CSRF protection uses a token the server owns for its lifetime:
130
+
131
  1. **Generation**: `regenerateSearchToken()` draws 32 random bytes on first use in a process and writes them to the token file; the file is a record, never read back as a source of truth
132
  2. **Storage**: The token is held in memory for the life of the process, and recorded at `{os.tempdir()}/minisearch-token` with `0600` permissions
133
  3. **Distribution**: Server serves the token to the client at runtime through `/api/config`, so a client always holds the token of the server answering it
 
145
  ### State Machine Transitions
146
 
147
  **Text Generation States:**
148
+
149
  - `idle` - No active generation
150
  - `awaitingModelDownloadAllowance` - Waiting for user consent to download a browser model
151
  - `loadingModel` - Downloading or initializing the browser (Wllama) model
 
157
  - `failed` - Error occurred
158
 
159
  **Search States:**
160
+
161
  - `idle` - No active search
162
  - `running` - Search in progress
163
  - `completed` - Results received
 
213
  | `rerankerServiceHook` | `server/rerankerServiceHook.ts` | Reranker model lifecycle management for result reranking |
214
 
215
  Key server-side modules:
216
+
217
  - **`server/webSearchService.ts`**: Integrates with SearXNG at `http://127.0.0.1:8888`. Implements a circuit breaker (opens after 5 failures, resets after 60s) and retry logic (up to 3 retries with exponential backoff, for 500s and for empty responses naming transiently unresponsive engines; an all-suspended set fails fast on the first attempt, since SearXNG suspensions last an hour to a day).
218
  - **`server/pageContentService.ts`**: Reads result pages for answer grounding: SSRF-guarded fetches with a byte cap, readable-text extraction, and query-relevant passage selection. Reads run under a per-host circuit breaker (`server/pageReadHostBreaker.ts`) that skips a host for 5 minutes after 3 refusals in a row, then probes it with one read.
219
  - **`server/searchToken.ts`**: Manages a token at `{os.tempdir()}/minisearch-token` used for CSRF protection on search requests.
 
445
  ### IndexedDB Databases
446
 
447
  Two separate Dexie databases handle different persistence needs:
448
+
449
  1. **SearchCacheDatabase** (`client/modules/search.ts`): Temporary cache for search results with TTL-based expiration. Table schema:
450
  - `textSearchHistory`: Keyed by hashed query, indexed by timestamp
451
  - `imageSearchHistory`: Keyed by hashed query, indexed by timestamp
 
473
  ### localStorage Persistence
474
 
475
  Lightweight state persisted across sessions via `createLocalStoragePubSub` pattern:
476
+
477
  - `settings`: Application preferences (inference type, model, UI options)
478
  - `querySuggestions`: Shuffled search suggestion pool
479
  - `lastSearchTokenHash`: Cached security token hash
docs/project-structure.md CHANGED
@@ -24,6 +24,7 @@
24
  ## Component Organization
25
 
26
  Components are organized by feature domain. Each component folder contains:
 
27
  - Component implementation
28
  - Related styles
29
  - Custom hooks
 
24
  ## Component Organization
25
 
26
  Components are organized by feature domain. Each component folder contains:
27
+
28
  - Component implementation
29
  - Related styles
30
  - Custom hooks
docs/pull-requests.md CHANGED
@@ -21,11 +21,13 @@
21
  ## Quality Gates
22
 
23
  Before any change, run this command in the development container:
 
24
  ```bash
25
  docker compose exec development-server npm run lint
26
  ```
27
 
28
  This comprehensive check includes:
 
29
  - **Biome**: Code formatting and linting
30
  - **TypeScript**: Type checking with strict mode
31
  - **knip**: Dead code detection
@@ -40,12 +42,14 @@ This comprehensive check includes:
40
  The GitHub Release body is built from `changelog.md`, not from GitHub's generated notes: the publish workflow takes every changelog line that was not there at the previous release tag, under its `## YYYY-MM-DD` heading. A change with no entry therefore ships with no mention in the Release.
41
 
42
  The `changelog-guard` job on every PR to `main` fails when the PR changes a user-facing path and does not touch `changelog.md`. The trigger paths are:
 
43
  - anything under `client/`, `server/`, or `shared/`
44
  - `Dockerfile`, `docker-compose.yml`, `docker-compose.production.yml`, `searxng-settings.yml`
45
 
46
  Add your entry to `changelog.md` under a `## YYYY-MM-DD` heading for today's date in UTC, most recent date first.
47
 
48
  Two ways out:
 
49
  - Add the `skip-changelog` label when the change touches a trigger path but is not notable for users - an internal refactor, a rename, a CI-only edit inside a trigger path.
50
  - Renovate and Dependabot PRs pass automatically. Renovate bumps the pinned SearXNG commit in the `Dockerfile` and cannot write an entry.
51
 
@@ -60,6 +64,7 @@ The three-dot diff compares merge bases, so before the branch has its first comm
60
  ## Merge Philosophy
61
 
62
  In high-throughput agent environments:
 
63
  - Minimize blocking merge gates
64
  - Keep PRs short-lived
65
  - Corrections are cheap, waiting is expensive
@@ -69,6 +74,7 @@ In high-throughput agent environments:
69
  ## Commit Message Format
70
 
71
  Use conventional commits:
 
72
  - `feat:` for new features
73
  - `fix:` for bug fixes
74
  - `docs:` for documentation changes
 
21
  ## Quality Gates
22
 
23
  Before any change, run this command in the development container:
24
+
25
  ```bash
26
  docker compose exec development-server npm run lint
27
  ```
28
 
29
  This comprehensive check includes:
30
+
31
  - **Biome**: Code formatting and linting
32
  - **TypeScript**: Type checking with strict mode
33
  - **knip**: Dead code detection
 
42
  The GitHub Release body is built from `changelog.md`, not from GitHub's generated notes: the publish workflow takes every changelog line that was not there at the previous release tag, under its `## YYYY-MM-DD` heading. A change with no entry therefore ships with no mention in the Release.
43
 
44
  The `changelog-guard` job on every PR to `main` fails when the PR changes a user-facing path and does not touch `changelog.md`. The trigger paths are:
45
+
46
  - anything under `client/`, `server/`, or `shared/`
47
  - `Dockerfile`, `docker-compose.yml`, `docker-compose.production.yml`, `searxng-settings.yml`
48
 
49
  Add your entry to `changelog.md` under a `## YYYY-MM-DD` heading for today's date in UTC, most recent date first.
50
 
51
  Two ways out:
52
+
53
  - Add the `skip-changelog` label when the change touches a trigger path but is not notable for users - an internal refactor, a rename, a CI-only edit inside a trigger path.
54
  - Renovate and Dependabot PRs pass automatically. Renovate bumps the pinned SearXNG commit in the `Dockerfile` and cannot write an entry.
55
 
 
64
  ## Merge Philosophy
65
 
66
  In high-throughput agent environments:
67
+
68
  - Minimize blocking merge gates
69
  - Keep PRs short-lived
70
  - Corrections are cheap, waiting is expensive
 
74
  ## Commit Message Format
75
 
76
  Use conventional commits:
77
+
78
  - `feat:` for new features
79
  - `fix:` for bug fixes
80
  - `docs:` for documentation changes
docs/quick-start.md CHANGED
@@ -23,6 +23,7 @@ docker compose up
23
  Access the application at `http://localhost:7860` (main). During development, HMR is available on `http://localhost:7861` for instant code changes.
24
 
25
  The development server includes:
 
26
  - Hot Module Replacement (HMR) on port 7861 for instant code changes
27
  - Full dev tools and source maps
28
  - Live code watching with volume mounts
@@ -39,6 +40,7 @@ docker compose -f docker-compose.production.yml up --build
39
  Access at `http://localhost:7860`
40
 
41
  Production mode:
 
42
  - Pre-built optimized assets
43
  - No dev tools or HMR
44
  - Optimized Docker layer caching
@@ -46,6 +48,7 @@ Production mode:
46
  ## Container Internals
47
 
48
  The Docker container runs three services concurrently:
 
49
  - **SearXNG** - Privacy-focused metasearch engine (starts in background)
50
  - **ONNX Runtime** - In-process inference for result reranking
51
  - **Node.js (Vite)** - Main application server
@@ -139,6 +142,7 @@ Access at `http://localhost:7860`
139
  ### Issue: Search returns no results
140
 
141
  **Solution**: Verify SearXNG is running. Check container logs:
 
142
  ```bash
143
  docker compose logs searxng
144
  ```
@@ -146,6 +150,7 @@ docker compose logs searxng
146
  ### Issue: AI response never loads
147
 
148
  **Solution**: Check browser console for errors. Common causes:
 
149
  - WebGPU not supported (app will automatically fall back to Wllama)
150
  - Model download blocked by firewall or CORS
151
  - Insufficient disk space for model caching
@@ -159,6 +164,7 @@ docker compose logs searxng
159
  ### Issue: Port already in use
160
 
161
  **Solution**: Change ports in `docker-compose.yml`:
 
162
  ```yaml
163
  ports:
164
  - "7862:7861" # Use 7862 instead of 7860 (HMR port)
 
23
  Access the application at `http://localhost:7860` (main). During development, HMR is available on `http://localhost:7861` for instant code changes.
24
 
25
  The development server includes:
26
+
27
  - Hot Module Replacement (HMR) on port 7861 for instant code changes
28
  - Full dev tools and source maps
29
  - Live code watching with volume mounts
 
40
  Access at `http://localhost:7860`
41
 
42
  Production mode:
43
+
44
  - Pre-built optimized assets
45
  - No dev tools or HMR
46
  - Optimized Docker layer caching
 
48
  ## Container Internals
49
 
50
  The Docker container runs three services concurrently:
51
+
52
  - **SearXNG** - Privacy-focused metasearch engine (starts in background)
53
  - **ONNX Runtime** - In-process inference for result reranking
54
  - **Node.js (Vite)** - Main application server
 
142
  ### Issue: Search returns no results
143
 
144
  **Solution**: Verify SearXNG is running. Check container logs:
145
+
146
  ```bash
147
  docker compose logs searxng
148
  ```
 
150
  ### Issue: AI response never loads
151
 
152
  **Solution**: Check browser console for errors. Common causes:
153
+
154
  - WebGPU not supported (app will automatically fall back to Wllama)
155
  - Model download blocked by firewall or CORS
156
  - Insufficient disk space for model caching
 
164
  ### Issue: Port already in use
165
 
166
  **Solution**: Change ports in `docker-compose.yml`:
167
+
168
  ```yaml
169
  ports:
170
  - "7862:7861" # Use 7862 instead of 7860 (HMR port)
docs/reranking.md CHANGED
@@ -18,6 +18,7 @@ The reranking subsystem consists of four components:
18
  ### Startup
19
 
20
  The `rerankerServiceHook` starts the reranker during server initialization:
 
21
  1. Downloads the model and tokenizer from HuggingFace if not present (`cross-encoder/mmarco-mMiniLMv2-L12-H384-v1`)
22
  2. Creates an ONNX Runtime inference session
23
  3. Performs a warmup inference (`query: "test"`, `documents: ["test document"]`) to ensure the graph is initialized
@@ -79,6 +80,7 @@ Documents are sent to the reranker whole. Truncation happens by tokens inside th
79
  ### Scoring and Filtering
80
 
81
  The reranker returns the classifier's raw relevance logit for each document. Scores are deliberately not passed through a sigmoid, because the filter below is calibrated against the raw scale. Results are then filtered using a two-stage statistical approach:
 
82
  1. **Score Normalization**: Scores are shifted to positive range by adding the absolute value of the minimum score
83
  2. **Standard Deviation Filter**: Results below `mean - kStandardDeviationFactor * standardDeviation` are filtered out
84
  - `kStandardDeviationFactor = 0.3`
@@ -90,6 +92,7 @@ This filter is invariant to linear rescaling of the scores, since both the score
90
  ### Preserve Top Results Mode
91
 
92
  When `preserveTopResults = true`, the ranking algorithm:
 
93
  1. Keeps the original top result (first from SearXNG) at position 1
94
  2. Filters remaining results by score
95
  3. Takes up to 9 next-best results, sorted by reranker score
 
18
  ### Startup
19
 
20
  The `rerankerServiceHook` starts the reranker during server initialization:
21
+
22
  1. Downloads the model and tokenizer from HuggingFace if not present (`cross-encoder/mmarco-mMiniLMv2-L12-H384-v1`)
23
  2. Creates an ONNX Runtime inference session
24
  3. Performs a warmup inference (`query: "test"`, `documents: ["test document"]`) to ensure the graph is initialized
 
80
  ### Scoring and Filtering
81
 
82
  The reranker returns the classifier's raw relevance logit for each document. Scores are deliberately not passed through a sigmoid, because the filter below is calibrated against the raw scale. Results are then filtered using a two-stage statistical approach:
83
+
84
  1. **Score Normalization**: Scores are shifted to positive range by adding the absolute value of the minimum score
85
  2. **Standard Deviation Filter**: Results below `mean - kStandardDeviationFactor * standardDeviation` are filtered out
86
  - `kStandardDeviationFactor = 0.3`
 
92
  ### Preserve Top Results Mode
93
 
94
  When `preserveTopResults = true`, the ranking algorithm:
95
+
96
  1. Keeps the original top result (first from SearXNG) at position 1
97
  2. Filters remaining results by score
98
  3. Takes up to 9 next-best results, sorted by reranker score
docs/search-history.md CHANGED
@@ -7,6 +7,7 @@ MiniSearch keeps a local-first record of every search so agents can resurface te
7
  ## Data Model and Storage
8
 
9
  The `HistoryDatabase` Dexie instance stores three related tables:
 
10
  1. `searches` โ€“ canonical log of each query plus hydrated results payloads (text, image, run metadata, source, pin state).
11
  2. `llmResponses` โ€“ snapshot of every AI answer tied to its originating search run, enabling restoration of the assistant output.
12
  3. `chatHistory` โ€“ chronological record of chat turns (user/assistant roles) scoped by `conversationId` (the `searchRunId`).
@@ -16,6 +17,7 @@ All three tables share a `searchRunId` foreign key so restoring a specific run c
16
  ## Cleanup Guarantees
17
 
18
  To keep IndexedDB lean, inserts trigger `performCleanup()`, which enforces:
 
19
  - **Retention window** โ€“ non-pinned entries older than `historyRetentionDays` are deleted in batches of 100.
20
  - **Max entries** โ€“ if the total exceeds `historyMaxEntries`, the oldest unpinned rows past the limit are removed.
21
  - **Pin protection** โ€“ pinned entries are skipped by both retention and max-entry sweeps.
@@ -25,6 +27,7 @@ Cleanup is gated by `historyAutoCleanup`, so advanced users can opt out. These k
25
  ## Hook API
26
 
27
  `useSearchHistory` exposes the canonical API surface for components:
 
28
  - Fetches recent searches (optionally paginated) and exposes filtered/grouped views.
29
  - Provides fuzzy search, pin toggling, delete/clear operations, and error retry helpers.
30
  - Keeps derived state such as grouped sections (Today/Yesterday/etc.) in sync with the settings flag `historyGroupByDate`.
@@ -51,12 +54,14 @@ The History Drawer Analytics tab renders the compact `SearchStats` cards scoped
51
  Alongside the history database, MiniSearch uses a separate `SearchCacheDatabase` for temporary result caching:
52
 
53
  **Schema:**
 
54
  | Store | Key | Index | Entry Type |
55
  | -------------------- | ------------ | --------- | ------------------ |
56
  | `textSearchHistory` | hashed query | timestamp | `TextSearchCache` |
57
  | `imageSearchHistory` | hashed query | timestamp | `ImageSearchCache` |
58
 
59
  **Configuration:**
 
60
  | Parameter | Value | Description |
61
  | ------------------- | ---------- | ------------------------------------------------------------------------------------- |
62
  | TTL | 15 minutes | Freshness window: a hit inside it skips the network |
 
7
  ## Data Model and Storage
8
 
9
  The `HistoryDatabase` Dexie instance stores three related tables:
10
+
11
  1. `searches` โ€“ canonical log of each query plus hydrated results payloads (text, image, run metadata, source, pin state).
12
  2. `llmResponses` โ€“ snapshot of every AI answer tied to its originating search run, enabling restoration of the assistant output.
13
  3. `chatHistory` โ€“ chronological record of chat turns (user/assistant roles) scoped by `conversationId` (the `searchRunId`).
 
17
  ## Cleanup Guarantees
18
 
19
  To keep IndexedDB lean, inserts trigger `performCleanup()`, which enforces:
20
+
21
  - **Retention window** โ€“ non-pinned entries older than `historyRetentionDays` are deleted in batches of 100.
22
  - **Max entries** โ€“ if the total exceeds `historyMaxEntries`, the oldest unpinned rows past the limit are removed.
23
  - **Pin protection** โ€“ pinned entries are skipped by both retention and max-entry sweeps.
 
27
  ## Hook API
28
 
29
  `useSearchHistory` exposes the canonical API surface for components:
30
+
31
  - Fetches recent searches (optionally paginated) and exposes filtered/grouped views.
32
  - Provides fuzzy search, pin toggling, delete/clear operations, and error retry helpers.
33
  - Keeps derived state such as grouped sections (Today/Yesterday/etc.) in sync with the settings flag `historyGroupByDate`.
 
54
  Alongside the history database, MiniSearch uses a separate `SearchCacheDatabase` for temporary result caching:
55
 
56
  **Schema:**
57
+
58
  | Store | Key | Index | Entry Type |
59
  | -------------------- | ------------ | --------- | ------------------ |
60
  | `textSearchHistory` | hashed query | timestamp | `TextSearchCache` |
61
  | `imageSearchHistory` | hashed query | timestamp | `ImageSearchCache` |
62
 
63
  **Configuration:**
64
+
65
  | Parameter | Value | Description |
66
  | ------------------- | ---------- | ------------------------------------------------------------------------------------- |
67
  | TTL | 15 minutes | Freshness window: a hit inside it skips the network |
docs/security.md CHANGED
@@ -32,6 +32,7 @@ can reach the instance, so keep secrets out of that interface.
32
  ### Search Token Lifecycle
33
 
34
  Every HTTP request from client to backend carries a `token` query parameter for CSRF protection:
 
35
  1. **Token Generation**: On first use in a process, `regenerateSearchToken()` draws 32 random bytes and writes them to `{os.tempdir()}/minisearch-token` with `0600`. The file is never read back as a source of truth: a token that survives into a published image is one every container of that build shares, and anyone who pulls the image can read it out of the layer
36
  2. **Client Distribution**: The server holds the token it generated for the life of the process and serves it as `searchToken` in `/api/config`. Each process generates its own, so a restart or a second instance means a new token, which is why a bookmarked or shared search URL stops working and lands on the expired-link page
37
  3. **Per-Request Auth**: Client includes token as `?token=` parameter on all `/search/text`, `/search/images`, `/page-content`, `/thumbnail` and `/inference` requests
@@ -65,6 +66,7 @@ Every HTTP request from client to backend carries a `token` query parameter for
65
  ## Supply Chain: Native & WebAssembly Modules
66
 
67
  The full trust model lives in [`.github/SECURITY.md`](../.github/SECURITY.md) ("Native & WebAssembly Module Trust Model"); the operational parts are mirrored here.
 
68
  - **Exact pins**: the native/WASM dependencies โ€” `onnxruntime-node@1.29.0`, `@wllama/wllama@3.6.1`, `@huggingface/tokenizers@0.2.0`, `hash-wasm@4.12.0` and `@moonshine-ai/moonshine-wasm@0.1.5` โ€” are declared with single exact versions in `package.json` (no caret ranges), and `package-lock.json` pins each tarball's SHA-512 integrity hash
69
  - **Install-script policy**: `package.json#allowScripts` carries an explicit decision for every package in the tree that ships an install script โ€” `onnxruntime-node` **denied** (its postinstall downloads CUDA 12 nupkgs unpacked by symlink-following `adm-zip`, GHSA-vwc7-r8mq-g2x9; both inference services run `executionProviders: ["cpu"]` and the CPU runtime ships in the tarball), `protobufjs` **denied** (its postinstall only prints a version-scheme advisory), `fsevents@2.3.3` **allowed** (the optional macOS file watcher must compile at install)
70
  - **Strict mode**: `.npmrc` sets `strict-allow-scripts = true`, so an install script with no recorded decision fails `npm ci` instead of warning; the `.npmrc` layer itself can only allow, never deny, which is why the policy lives in `package.json`
 
32
  ### Search Token Lifecycle
33
 
34
  Every HTTP request from client to backend carries a `token` query parameter for CSRF protection:
35
+
36
  1. **Token Generation**: On first use in a process, `regenerateSearchToken()` draws 32 random bytes and writes them to `{os.tempdir()}/minisearch-token` with `0600`. The file is never read back as a source of truth: a token that survives into a published image is one every container of that build shares, and anyone who pulls the image can read it out of the layer
37
  2. **Client Distribution**: The server holds the token it generated for the life of the process and serves it as `searchToken` in `/api/config`. Each process generates its own, so a restart or a second instance means a new token, which is why a bookmarked or shared search URL stops working and lands on the expired-link page
38
  3. **Per-Request Auth**: Client includes token as `?token=` parameter on all `/search/text`, `/search/images`, `/page-content`, `/thumbnail` and `/inference` requests
 
66
  ## Supply Chain: Native & WebAssembly Modules
67
 
68
  The full trust model lives in [`.github/SECURITY.md`](../.github/SECURITY.md) ("Native & WebAssembly Module Trust Model"); the operational parts are mirrored here.
69
+
70
  - **Exact pins**: the native/WASM dependencies โ€” `onnxruntime-node@1.29.0`, `@wllama/wllama@3.6.1`, `@huggingface/tokenizers@0.2.0`, `hash-wasm@4.12.0` and `@moonshine-ai/moonshine-wasm@0.1.5` โ€” are declared with single exact versions in `package.json` (no caret ranges), and `package-lock.json` pins each tarball's SHA-512 integrity hash
71
  - **Install-script policy**: `package.json#allowScripts` carries an explicit decision for every package in the tree that ships an install script โ€” `onnxruntime-node` **denied** (its postinstall downloads CUDA 12 nupkgs unpacked by symlink-following `adm-zip`, GHSA-vwc7-r8mq-g2x9; both inference services run `executionProviders: ["cpu"]` and the CPU runtime ships in the tarball), `protobufjs` **denied** (its postinstall only prints a version-scheme advisory), `fsevents@2.3.3` **allowed** (the optional macOS file watcher must compile at install)
72
  - **Strict mode**: `.npmrc` sets `strict-allow-scripts = true`, so an install script with no recorded decision fails `npm ci` instead of warning; the `.npmrc` layer itself can only allow, never deny, which is why the policy lives in `package.json`
docs/ui-components.md CHANGED
@@ -27,6 +27,7 @@ updateQuery("new query");
27
  ```
28
 
29
  **Benefits:**
 
30
  - **Decoupling** โ€” Modules (text generation, search, React components) read and write shared state without importing each other directly
31
  - **No provider boilerplate** โ€” Unlike React Context or Redux, no `Provider` wrapper needed; any module imports a channel from `pubSub.ts`
32
  - **Selective subscriptions** โ€” Components subscribe only to channels they use; a streaming token update throttling `responsePubSub` does not trigger re-renders in unrelated components
@@ -35,6 +36,7 @@ updateQuery("new query");
35
  ### localStorage Persistence
36
 
37
  Some state must survive page reloads. The `createLocalStoragePubSub` helper wraps `createPubSub` with two behaviors:
 
38
  1. **Hydration** โ€” On first call, reads existing value from `localStorage` via `localStorage.getItem(key)`. If a stored JSON string is found, it is parsed and used as the initial value; otherwise the default value is used
39
  2. **Persistence** โ€” A subscriber is immediately registered on the inner PubSub that calls `localStorage.setItem` with the JSON-serialized new value on every state change
40
 
@@ -133,6 +135,7 @@ App
133
  **Responsibility:** Application shell and routing
134
 
135
  **Logic:**
 
136
  ```typescript
137
  // App.tsx
138
  // Access key validation is handled via useAccessKeyValidation hook
@@ -147,6 +150,7 @@ App
147
  **Responsibility:** Query input and search initiation
148
 
149
  **PubSub:**
 
150
  - **Subscribes:** `queryPubSub`, `textSearchStatePubSub`
151
  - **Updates:** `queryPubSub` (on type), triggers `searchAndRespond()` (on submit)
152
 
@@ -155,6 +159,7 @@ The query field is wrapped in its own `position: relative` element so
155
  when the row of buttons below the field changes height.
156
 
157
  **Logic:**
 
158
  ```typescript
159
  function SearchForm() {
160
  const [query, setQuery] = usePubSub(queryPubSub);
@@ -185,6 +190,7 @@ dictation session: the engine choice, the microphone lifecycle, and the splice
185
  that appends each transcript without clobbering what the user typed meanwhile.
186
 
187
  **PubSub:**
 
188
  - **Subscribes:** `settingsPubSub` (`enableDictation`, `enableLocalDictationModel`)
189
 
190
  **Props:**
@@ -208,9 +214,11 @@ effect never runs.
208
  **Responsibility:** Display search results (text and images)
209
 
210
  **PubSub:**
 
211
  - **Subscribes:** `textSearchResultsPubSub`, `imageSearchResultsPubSub`, `textSearchStatePubSub`
212
 
213
  **Logic:**
 
214
  ```typescript
215
  function SearchResultsSection() {
216
  const [textResults] = usePubSub(textSearchResultsPubSub);
@@ -234,6 +242,7 @@ function SearchResultsSection() {
234
  **Responsibility:** AI response display and chat interface
235
 
236
  **PubSub:**
 
237
  - **Subscribes:** `responsePubSub`, `textGenerationStatePubSub`, `chatMessagesPubSub`
238
 
239
  **State Machine (`textGenerationStatePubSub`):**
@@ -255,6 +264,7 @@ function SearchResultsSection() {
255
  When models output internal thought processes, the UI extracts reasoning content bounded by `reasoningStartMarker` and `reasoningEndMarker` markers. Reasoning is displayed separately from the final response in a collapsible section.
256
 
257
  **Logic:**
 
258
  ```typescript
259
  function AiResponseSection() {
260
  const [response] = usePubSub(responsePubSub);
@@ -289,6 +299,7 @@ function AiResponseSection() {
289
  **Responsibility:** Application settings UI
290
 
291
  **Sub-components:**
 
292
  - **AISettingsForm:** Model selection, inference type, reasoning markers (sampling parameters such as temperature are hardcoded, not user-configurable)
293
  - **SearchSettingsForm:** Result limits, image search toggle
294
  - **InterfaceSettingsForm:** UI preferences
@@ -297,9 +308,11 @@ function AiResponseSection() {
297
  - **ActionsForm:** Data management actions
298
 
299
  **PubSub:**
 
300
  - **Subscribes/Updates:** `settingsPubSub` (full settings object)
301
 
302
  **Persistence:**
 
303
  ```typescript
304
  // client/modules/pubSub.ts
305
  export const settingsPubSub = createLocalStoragePubSub(
@@ -315,9 +328,11 @@ export const settingsPubSub = createLocalStoragePubSub(
315
  **Responsibility:** Search history display and management
316
 
317
  **PubSub:**
 
318
  - **Subscribes:** History loaded from IndexedDB (not via PubSub, via custom hook)
319
 
320
  **Hook:** `useSearchHistory()`
 
321
  ```typescript
322
  const {
323
  filteredSearches,
@@ -329,11 +344,13 @@ const {
329
  ```
330
 
331
  Restoring a past search (re-running its query) is handled separately by `useHistoryRestore`, used in `SearchForm`:
 
332
  ```typescript
333
  const { restoreSearch } = useHistoryRestore(updateQuery, textAreaRef);
334
  ```
335
 
336
  **Features:**
 
337
  - Fuzzy search through history
338
  - Date-based grouping (Today, Yesterday, Last Week, etc.)
339
  - Pin/unpin searches
@@ -419,6 +436,7 @@ Saved to IndexedDB
419
  ### usePubSub
420
 
421
  Subscribes to a PubSub channel:
 
422
  ```typescript
423
  const [value, setValue] = usePubSub(channel);
424
  ```
@@ -426,6 +444,7 @@ const [value, setValue] = usePubSub(channel);
426
  ### useSearchHistory
427
 
428
  Manages search history from IndexedDB:
 
429
  ```typescript
430
  const { searchHistory, groupedSearches, deleteEntry, togglePin } =
431
  useSearchHistory();
@@ -434,6 +453,7 @@ const { searchHistory, groupedSearches, deleteEntry, togglePin } =
434
  ### useDrawerState
435
 
436
  Manages open/close state for a drawer with log entry tracking:
 
437
  ```typescript
438
  const { isDrawerOpen, openDrawer, closeDrawer } = useDrawerState(
439
  "User opened the menu",
@@ -446,6 +466,7 @@ const { isDrawerOpen, openDrawer, closeDrawer } = useDrawerState(
446
  Holds the [Screen Wake Lock](https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API)
447
  while the flag is true, so a phone left untouched during a long answer does not
448
  lock while the text streams in:
 
449
  ```typescript
450
  useScreenWakeLock(statesKeepingTheScreenAwake.includes(textGenerationState));
451
  ```
@@ -460,12 +481,14 @@ lock and no error.
460
  **Framework:** Mantine UI v9
461
 
462
  **Theme Configuration:**
 
463
  ```typescript
464
  // client/components/App/App.tsx
465
  <MantineProvider defaultColorScheme="dark">
466
  ```
467
 
468
  **Dark Mode:**
 
469
  - Default color scheme is dark
470
  - All components support dark mode via Mantine
471
 
@@ -474,12 +497,14 @@ lock and no error.
474
  **Standards:** WCAG 2.1 AA compliance
475
 
476
  **Features:**
 
477
  - All interactive elements keyboard accessible
478
  - ARIA labels on select interactive elements (e.g. chat input, message list, history actions, logs modal)
479
  - Focus management in drawers and modals
480
  - Screen reader announcements for loading states
481
 
482
  **Implementation:**
 
483
  ```typescript
484
  // Using Mantine's accessibility props
485
  <Button aria-label="Search the web">
 
27
  ```
28
 
29
  **Benefits:**
30
+
31
  - **Decoupling** โ€” Modules (text generation, search, React components) read and write shared state without importing each other directly
32
  - **No provider boilerplate** โ€” Unlike React Context or Redux, no `Provider` wrapper needed; any module imports a channel from `pubSub.ts`
33
  - **Selective subscriptions** โ€” Components subscribe only to channels they use; a streaming token update throttling `responsePubSub` does not trigger re-renders in unrelated components
 
36
  ### localStorage Persistence
37
 
38
  Some state must survive page reloads. The `createLocalStoragePubSub` helper wraps `createPubSub` with two behaviors:
39
+
40
  1. **Hydration** โ€” On first call, reads existing value from `localStorage` via `localStorage.getItem(key)`. If a stored JSON string is found, it is parsed and used as the initial value; otherwise the default value is used
41
  2. **Persistence** โ€” A subscriber is immediately registered on the inner PubSub that calls `localStorage.setItem` with the JSON-serialized new value on every state change
42
 
 
135
  **Responsibility:** Application shell and routing
136
 
137
  **Logic:**
138
+
139
  ```typescript
140
  // App.tsx
141
  // Access key validation is handled via useAccessKeyValidation hook
 
150
  **Responsibility:** Query input and search initiation
151
 
152
  **PubSub:**
153
+
154
  - **Subscribes:** `queryPubSub`, `textSearchStatePubSub`
155
  - **Updates:** `queryPubSub` (on type), triggers `searchAndRespond()` (on submit)
156
 
 
159
  when the row of buttons below the field changes height.
160
 
161
  **Logic:**
162
+
163
  ```typescript
164
  function SearchForm() {
165
  const [query, setQuery] = usePubSub(queryPubSub);
 
190
  that appends each transcript without clobbering what the user typed meanwhile.
191
 
192
  **PubSub:**
193
+
194
  - **Subscribes:** `settingsPubSub` (`enableDictation`, `enableLocalDictationModel`)
195
 
196
  **Props:**
 
214
  **Responsibility:** Display search results (text and images)
215
 
216
  **PubSub:**
217
+
218
  - **Subscribes:** `textSearchResultsPubSub`, `imageSearchResultsPubSub`, `textSearchStatePubSub`
219
 
220
  **Logic:**
221
+
222
  ```typescript
223
  function SearchResultsSection() {
224
  const [textResults] = usePubSub(textSearchResultsPubSub);
 
242
  **Responsibility:** AI response display and chat interface
243
 
244
  **PubSub:**
245
+
246
  - **Subscribes:** `responsePubSub`, `textGenerationStatePubSub`, `chatMessagesPubSub`
247
 
248
  **State Machine (`textGenerationStatePubSub`):**
 
264
  When models output internal thought processes, the UI extracts reasoning content bounded by `reasoningStartMarker` and `reasoningEndMarker` markers. Reasoning is displayed separately from the final response in a collapsible section.
265
 
266
  **Logic:**
267
+
268
  ```typescript
269
  function AiResponseSection() {
270
  const [response] = usePubSub(responsePubSub);
 
299
  **Responsibility:** Application settings UI
300
 
301
  **Sub-components:**
302
+
303
  - **AISettingsForm:** Model selection, inference type, reasoning markers (sampling parameters such as temperature are hardcoded, not user-configurable)
304
  - **SearchSettingsForm:** Result limits, image search toggle
305
  - **InterfaceSettingsForm:** UI preferences
 
308
  - **ActionsForm:** Data management actions
309
 
310
  **PubSub:**
311
+
312
  - **Subscribes/Updates:** `settingsPubSub` (full settings object)
313
 
314
  **Persistence:**
315
+
316
  ```typescript
317
  // client/modules/pubSub.ts
318
  export const settingsPubSub = createLocalStoragePubSub(
 
328
  **Responsibility:** Search history display and management
329
 
330
  **PubSub:**
331
+
332
  - **Subscribes:** History loaded from IndexedDB (not via PubSub, via custom hook)
333
 
334
  **Hook:** `useSearchHistory()`
335
+
336
  ```typescript
337
  const {
338
  filteredSearches,
 
344
  ```
345
 
346
  Restoring a past search (re-running its query) is handled separately by `useHistoryRestore`, used in `SearchForm`:
347
+
348
  ```typescript
349
  const { restoreSearch } = useHistoryRestore(updateQuery, textAreaRef);
350
  ```
351
 
352
  **Features:**
353
+
354
  - Fuzzy search through history
355
  - Date-based grouping (Today, Yesterday, Last Week, etc.)
356
  - Pin/unpin searches
 
436
  ### usePubSub
437
 
438
  Subscribes to a PubSub channel:
439
+
440
  ```typescript
441
  const [value, setValue] = usePubSub(channel);
442
  ```
 
444
  ### useSearchHistory
445
 
446
  Manages search history from IndexedDB:
447
+
448
  ```typescript
449
  const { searchHistory, groupedSearches, deleteEntry, togglePin } =
450
  useSearchHistory();
 
453
  ### useDrawerState
454
 
455
  Manages open/close state for a drawer with log entry tracking:
456
+
457
  ```typescript
458
  const { isDrawerOpen, openDrawer, closeDrawer } = useDrawerState(
459
  "User opened the menu",
 
466
  Holds the [Screen Wake Lock](https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API)
467
  while the flag is true, so a phone left untouched during a long answer does not
468
  lock while the text streams in:
469
+
470
  ```typescript
471
  useScreenWakeLock(statesKeepingTheScreenAwake.includes(textGenerationState));
472
  ```
 
481
  **Framework:** Mantine UI v9
482
 
483
  **Theme Configuration:**
484
+
485
  ```typescript
486
  // client/components/App/App.tsx
487
  <MantineProvider defaultColorScheme="dark">
488
  ```
489
 
490
  **Dark Mode:**
491
+
492
  - Default color scheme is dark
493
  - All components support dark mode via Mantine
494
 
 
497
  **Standards:** WCAG 2.1 AA compliance
498
 
499
  **Features:**
500
+
501
  - All interactive elements keyboard accessible
502
  - ARIA labels on select interactive elements (e.g. chat input, message list, history actions, logs modal)
503
  - Focus management in drawers and modals
504
  - Screen reader announcements for loading states
505
 
506
  **Implementation:**
507
+
508
  ```typescript
509
  // Using Mantine's accessibility props
510
  <Button aria-label="Search the web">
docs/wllama-model-evaluation.md ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Wllama Model Evaluation
2
+
3
+ How the in-browser models in `client/modules/wllama.ts` are measured, and how they scored. The catalog keeps a model unless it answers worse than LittleLamb 290M, the default for browsers without WebGPU; see [What the catalog keeps](#what-the-catalog-keeps).
4
+
5
+ ## What it measures
6
+
7
+ MiniSearch's own task, not a general benchmark. `npm run bench:wllama` (see [development-commands.md](development-commands.md#wllama-benchmark)) loads each model in headless Chromium through the app's code: the catalog entry, `initializeWllama`, and the chat messages that `getFormattedSearchResults` and `getDefaultChatMessages` build from the default system prompt (`shared/defaultSystemPrompt.ts`), the search results, and the page excerpts. The model answers the way it would in the app, with the app's sampling, thinking budget and chat template settings.
8
+
9
+ The questions live in `scripts/wllama-bench/cases.json`. Each one carries its own search results, written for the test so the right answer is known, the facts a correct answer must contain, and the language it must be in. They cover what the system prompt asks of a model:
10
+
11
+ - **Answering in the question's language**, across eleven languages: English, Portuguese, Spanish, French, German, Chinese, Japanese, Korean, Arabic, Hindi and Russian. They are the languages most often listed as supported by the model families in the catalog and by multilingual benchmarks, with Russian added for its share of web text; see [Why these languages](#why-these-languages).
12
+ - **Answering in one language from results in another** (`pt-from-en`, `zh-from-en`).
13
+ - **Combining two results** (`de-synthesis`).
14
+ - **Picking the right result among similar ones** (`es-distractor`).
15
+ - **Saying so when the results do not answer** (`pt-not-covered`).
16
+ - **Citing a result with a link, and never inventing one.**
17
+
18
+ ## How it scores
19
+
20
+ `scripts/wllama-bench/score.mjs` scores every answer out of 4 points:
21
+
22
+ | Points | For |
23
+ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
24
+ | up to 2 | The required facts, split evenly. A wrong fact misleads more than a wrong language, so facts weigh double. |
25
+ | 1 | Answering in the question's language. Text copied from the results does not count, so a quoted snippet cannot pass for an answer written in that language. |
26
+ | 1 | Citing at least one of the results with a Markdown link. |
27
+ | โˆ’1 each | A violation: a link to a URL that is not among the results, an echoed instruction from the prompt, a repeated sentence, a third script mixed in (Cyrillic in a Hindi answer), a number that appears in no result, a fact from the distractor result, or an answer cut off after 5 minutes. |
28
+
29
+ The score never goes below 0. English questions count once and the others twice, because MiniSearch takes queries in any language. A model's score is the sum over the questions, averaged over its runs.
30
+
31
+ ### What the score cannot see
32
+
33
+ The checks are mechanical. Text that is garbled but in the right language and carrying the right facts passes them, and so does a correct answer that only restates the result it was given. Before the scorer was adopted, 176 answers were graded by hand as fluent and correct or not, and the scorer agreed with the hand grade on 149 of them (85%) with a pass mark of 2 points. Nearly all of the disagreements were about fluency. Treat a gap of a few points between two models as noise: the app samples, so a second run differs.
34
+
35
+ ## Results
36
+
37
+ Measured on 2026-11-07 on an Apple M1 Max, in headless Chromium 151 on WebGPU, with wllama 3.8.1, the catalog's settings (a 1024-token thinking budget and `reasoning_effort: "low"`), and the app's sampling. Several models ran at once on the same GPU, so the run times are not comparable and are left out.
38
+
39
+ ### The whole catalog, eleven core questions
40
+
41
+ Every model answered the first eleven questions (`en` to `ru`) once. LittleLamb and the models near its score ran three or four times, because the app samples and a single run can land 10 points either way: the spread between runs of one model averaged 5.5 points. Scores are out of 84.
42
+
43
+ | Rank | Model | Size | Runs | Score | en | pt-from-en | es | fr | de | zh | ja | ko | ar | hi | ru |
44
+ | ---: | ----------------------------------------------------------------------------- | ------: | ---: | ------: | --: | ---------: | --: | --: | --: | --: | --: | --: | --: | --: | --: |
45
+ | 1 | Gemma 3 4B | 2380 MB | 1 | 84.0/84 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 |
46
+ | 2 | Granite 3.3 2B | 1460 MB | 1 | 84.0/84 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 |
47
+ | 3 | Llama 3.2 3B | 1930 MB | 1 | 84.0/84 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 |
48
+ | 4 | Polaris 4B | 2380 MB | 1 | 82.0/84 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 3.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 |
49
+ | 5 | Spark X2.6 1.7B | 1769 MB | 1 | 82.0/84 | 4.0 | 3.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 |
50
+ | 6 | Gemma 2 2B | 1640 MB | 1 | 79.3/84 | 3.3 | 4.0 | 4.0 | 4.0 | 4.0 | 3.0 | 4.0 | 4.0 | 4.0 | 3.0 | 4.0 |
51
+ | 7 | Qwen 3.5 4B | 2436 MB | 1 | 77.0/84 | 3.0 | 3.0 | 3.0 | 4.0 | 3.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 |
52
+ | 8 | Falcon 3 3B | 1930 MB | 1 | 74.0/84 | 4.0 | 3.0 | 3.0 | 4.0 | 3.0 | 4.0 | 4.0 | 4.0 | 4.0 | 3.0 | 3.0 |
53
+ | 9 | Phi 3.5 Mini 3.8B | 2190 MB | 1 | 74.0/84 | 4.0 | 4.0 | 1.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 3.0 | 4.0 | 3.0 |
54
+ | 10 | LFM2.5 1.2B Instruct | 700 MB | 1 | 70.0/84 | 4.0 | 3.0 | 4.0 | 4.0 | 3.0 | 3.0 | 3.0 | 3.0 | 4.0 | 3.0 | 3.0 |
55
+ | 11 | Qwen 3.5 0.8B | 533 MB | 1 | 70.0/84 | 4.0 | 1.0 | 2.0 | 4.0 | 4.0 | 4.0 | 3.0 | 4.0 | 3.0 | 4.0 | 4.0 |
56
+ | 12 | EXAONE 3.5 2.4B | 1580 MB | 1 | 67.0/84 | 1.0 | 1.0 | 4.0 | 4.0 | 0.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 |
57
+ | 13 | Qwen 3 1.7B | 1140 MB | 1 | 66.0/84 | 4.0 | 3.0 | 4.0 | 3.0 | 3.0 | 3.0 | 3.0 | 3.0 | 3.0 | 3.0 | 3.0 |
58
+ | 14 | SmolLM 3 3B | 1820 MB | 1 | 65.0/84 | 3.0 | 4.0 | 3.0 | 4.0 | 3.0 | 3.0 | 3.0 | 3.0 | 2.0 | 3.0 | 3.0 |
59
+ | 15 | Qwen 3 0.6B | 406 MB | 1 | 63.0/84 | 3.0 | 2.0 | 4.0 | 3.0 | 3.0 | 3.0 | 4.0 | 3.0 | 2.0 | 3.0 | 3.0 |
60
+ | 16 | Granite 3.1 1B [400M] | 775 MB | 1 | 61.0/84 | 3.0 | 1.0 | 3.0 | 3.0 | 3.0 | 3.0 | 3.0 | 4.0 | 4.0 | 2.0 | 3.0 |
61
+ | 17 | AceInstruct 1.5B | 1070 MB | 1 | 60.3/84 | 2.3 | 1.0 | 3.0 | 3.0 | 3.0 | 3.0 | 4.0 | 4.0 | 3.0 | 3.0 | 2.0 |
62
+ | 18 | SmolLM 2 1.7B | 999 MB | 1 | 60.3/84 | 2.3 | 1.0 | 3.0 | 3.0 | 3.0 | 4.0 | 3.0 | 3.0 | 3.0 | 2.0 | 4.0 |
63
+ | 19 | Granite 3.1 3B [800M] | 1900 MB | 1 | 59.3/84 | 1.3 | 1.0 | 3.0 | 2.0 | 3.0 | 4.0 | 4.0 | 4.0 | 3.0 | 3.0 | 2.0 |
64
+ | 20 | Granite 4.2 3B | 2143 MB | 1 | 59.3/84 | 3.3 | 2.0 | 3.0 | 2.0 | 3.0 | 2.0 | 2.0 | 4.0 | 3.0 | 3.0 | 4.0 |
65
+ | 21 | Llama 3.2 1B | 776 MB | 3 | 59.2/84 | 2.6 | 3.3 | 3.0 | 3.3 | 3.0 | 2.3 | 2.0 | 2.0 | 3.0 | 3.7 | 2.7 |
66
+ | 22 | InternLM 2.5 1.8B | 1120 MB | 3 | 58.7/84 | 2.0 | 2.7 | 3.0 | 3.3 | 3.0 | 3.0 | 2.3 | 3.3 | 3.7 | 1.3 | 2.7 |
67
+ | 23 | Spark X2.6 4B | 3543 MB | 1 | 57.0/84 | 3.0 | 4.0 | 0.0 | 0.0 | 0.0 | 4.0 | 4.0 | 4.0 | 4.0 | 3.0 | 4.0 |
68
+ | 24 | ~~Granite 4.0 1B~~ (removed: scored on the CPU; on WebGPU it writes only `@`) | 981 MB | 1 | 56.0/84 | 4.0 | 3.0 | 3.0 | 4.0 | 2.0 | 3.0 | 1.0 | 2.0 | 4.0 | 0.0 | 4.0 |
69
+ | 25 | Megrez 3B | 1740 MB | 3 | 55.7/84 | 3.0 | 2.0 | 2.3 | 3.0 | 3.3 | 3.0 | 3.0 | 3.0 | 2.0 | 1.0 | 3.7 |
70
+ | 26 | Gemma 4 E2B | 2446 MB | 1 | 55.0/84 | 1.0 | 0.0 | 0.0 | 1.0 | 3.0 | 4.0 | 4.0 | 4.0 | 4.0 | 3.0 | 4.0 |
71
+ | 27 | Falcon 3 1B | 1020 MB | 3 | 54.3/84 | 2.3 | 1.7 | 3.7 | 2.7 | 3.0 | 1.3 | 2.0 | 3.0 | 3.3 | 3.0 | 2.3 |
72
+ | 28 | Phi 4 Mini Reasoning 3.8B | 2460 MB | 3 | 50.7/84 | 2.7 | 0.7 | 2.3 | 2.7 | 1.3 | 3.3 | 3.0 | 3.7 | 2.7 | 2.0 | 2.3 |
73
+ | 29 | Gemma 3 1B | 781 MB | 3 | 49.7/84 | 3.0 | 3.0 | 3.0 | 2.3 | 2.0 | 2.3 | 3.0 | 3.3 | 1.3 | 0.3 | 2.7 |
74
+ | 30 | LFM2.5 230M | 160 MB | 3 | 49.0/84 | 3.0 | 3.0 | 3.0 | 3.0 | 3.0 | 0.0 | 3.0 | 2.0 | 2.7 | 2.3 | 1.0 |
75
+ | 31 | DeepSeek R1 Distill Qwen 1.5B | 1070 MB | 3 | 45.4/84 | 2.1 | 2.0 | 3.3 | 2.3 | 2.0 | 3.7 | 2.7 | 3.0 | 1.0 | 1.0 | 0.7 |
76
+ | 32 | SmolLM 2 360M | 260 MB | 3 | 44.8/84 | 2.1 | 2.0 | 2.7 | 2.7 | 1.0 | 2.3 | 2.3 | 2.0 | 1.7 | 1.7 | 3.0 |
77
+ | 33 | MiniCPM4 0.5B | 267 MB | 3 | 41.6/84 | 2.2 | 0.3 | 2.7 | 1.7 | 0.7 | 2.0 | 3.3 | 2.3 | 1.7 | 2.0 | 3.0 |
78
+ | 34 | OLMo 2 1B | 967 MB | 3 | 41.6/84 | 0.9 | 0.0 | 2.0 | 2.7 | 1.0 | 2.3 | 1.7 | 2.3 | 3.0 | 3.3 | 2.0 |
79
+ | 35 | Gemma 3 270M | 250 MB | 3 | 40.1/84 | 2.1 | 2.0 | 2.0 | 2.0 | 0.0 | 3.0 | 0.0 | 3.0 | 3.0 | 1.0 | 3.0 |
80
+ | 36 | LittleLamb 290M | 231 MB | 4 | 38.0/84 | 2.5 | 1.5 | 2.5 | 2.3 | 3.0 | 2.5 | 2.0 | 1.3 | 1.0 | 0.3 | 1.5 |
81
+ | 37 | ~~Pints 1.5B~~ (removed) | 905 MB | 1 | 25.3/84 | 1.3 | 1.0 | 3.0 | 2.0 | 0.0 | 0.0 | 3.0 | 1.0 | 1.0 | 0.0 | 1.0 |
82
+ | 38 | ~~Granite 4.0 350M~~ (removed) | 229 MB | 1 | 25.0/84 | 3.0 | 2.0 | 2.0 | 2.0 | 0.0 | 0.0 | 0.0 | 2.0 | 1.0 | 1.0 | 1.0 |
83
+ | 39 | ~~SmolLM 2 135M~~ (removed) | 102 MB | 1 | 24.7/84 | 0.7 | 1.0 | 1.0 | 2.0 | 1.0 | 3.0 | 0.0 | 1.0 | 1.0 | 1.0 | 1.0 |
84
+ | 40 | ~~StableLM 2 Zephyr 1.6B~~ (removed) | 989 MB | 1 | 16.3/84 | 0.3 | 0.0 | 1.0 | 4.0 | 1.0 | 0.0 | 0.0 | 1.0 | 0.0 | 1.0 | 0.0 |
85
+
86
+ ### What the catalog keeps
87
+
88
+ LittleLamb 290M is the catalog's floor: it is the default for browsers without WebGPU because it runs well on a CPU, and its answers are the least the catalog accepts. A model whose mean score falls below LittleLamb's (38.0, measured before LittleLamb got a thinking budget) leaves the catalog. A model that ties with it stays, because the score cannot see how a model writes, and some people prefer one model's style. On 2026-11-08 that removed StableLM 2 Zephyr 1.6B, SmolLM 2 135M, Granite 4.0 350M and Pints 1.5B, all far below the floor (16 to 25). Granite 4.0 1B scored above it on the CPU but was removed anyway, because on WebGPU it writes only `@` characters until it is stopped.
89
+
90
+ LittleLamb itself is the most erratic model measured (its four runs scored 49.0, 44.3, 33.7 and 25.0): it often answers in English, sometimes not at all, and its Arabic and Hindi answers are rarely usable. With the 1024-token thinking budget it scored 41.4 over three runs and left no answer empty.
91
+
92
+ ### GPU default candidates, all fifteen questions
93
+
94
+ The eleven questions above are direct, and several models answered all of them, so they cannot rank the best ones. The twelve strongest candidates for the GPU default also answered the four harder questions (`de-synthesis`, `es-distractor`, `pt-not-covered`, `zh-from-en`), twice each. Scores are out of 116.
95
+
96
+ | Rank | Model | Size | Runs | Score | en | pt-from-en | es | fr | de | zh | ja | ko | ar | hi | ru | de-synthesis | es-distractor | pt-not-covered | zh-from-en |
97
+ | ---: | ----------------------- | ------: | ---: | --------: | --: | ---------: | --: | --: | --: | --: | --: | --: | --: | --: | --: | -----------: | ------------: | -------------: | ---------: |
98
+ | 1 | Gemma 3 4B | 2380 MB | 2 | 116.0/116 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 |
99
+ | 2 | Spark X2.6 1.7B | 1769 MB | 2 | 113.0/116 | 4.0 | 3.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 3.5 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 |
100
+ | 3 | Llama 3.2 3B | 1930 MB | 2 | 110.5/116 | 3.5 | 3.5 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 3.0 | 3.0 | 4.0 | 4.0 | 4.0 |
101
+ | 4 | Polaris 4B | 2380 MB | 2 | 106.0/116 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 3.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 3.5 | 4.0 | 1.0 | 3.5 |
102
+ | 5 | Granite 3.3 2B | 1460 MB | 2 | 105.0/116 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | 2.0 | 4.0 | 0.5 | 4.0 |
103
+ | 6 | Gemma 2 2B | 1640 MB | 2 | 102.7/116 | 3.7 | 4.0 | 4.0 | 4.0 | 4.0 | 3.0 | 4.0 | 4.0 | 3.5 | 4.0 | 4.0 | 3.0 | 4.0 | 0.5 | 3.5 |
104
+ | 7 | Granite 4.2 3B | 2143 MB | 2 | 95.0/116 | 4.0 | 1.5 | 3.0 | 3.5 | 3.0 | 3.0 | 4.0 | 4.0 | 4.0 | 4.0 | 3.5 | 4.0 | 3.0 | 2.0 | 3.0 |
105
+ | 8 | Falcon 3 3B | 1930 MB | 2 | 93.5/116 | 3.5 | 2.5 | 3.5 | 4.0 | 3.0 | 4.0 | 4.0 | 4.0 | 2.5 | 2.5 | 4.0 | 2.5 | 4.0 | 0.5 | 4.0 |
106
+ | 9 | Phi 3.5 Mini 3.8B | 2190 MB | 2 | 93.5/116 | 2.5 | 3.5 | 1.5 | 3.0 | 2.5 | 4.0 | 4.0 | 4.0 | 4.0 | 3.0 | 3.5 | 3.0 | 3.5 | 2.5 | 3.5 |
107
+ | 10 | Qwen 3.5 4B (see below) | 2436 MB | 2 | 90.0/116 | 2.0 | 2.0 | 1.5 | 2.0 | 1.5 | 4.0 | 4.0 | 4.0 | 4.0 | 3.0 | 3.0 | 3.5 | 4.0 | 3.5 | 4.0 |
108
+ | 11 | Qwen 3.5 0.8B | 533 MB | 2 | 76.7/116 | 2.7 | 2.0 | 3.5 | 3.0 | 1.0 | 4.0 | 4.0 | 0.5 | 3.5 | 2.0 | 2.5 | 3.5 | 3.5 | 2.0 | 2.0 |
109
+ | 12 | LFM2.5 1.2B Instruct | 700 MB | 2 | 74.0/116 | 4.0 | 3.0 | 3.5 | 2.5 | 2.5 | 2.5 | 3.0 | 2.5 | 3.0 | 2.0 | 2.0 | 1.0 | 2.5 | 2.0 | 3.0 |
110
+
111
+ Gemma 3 4B, the GPU default, scored every point in both runs. The harder questions separate the rest: `pt-not-covered` is the one most models fail, inventing Curitiba's population instead of saying the results do not give it, and `de-synthesis` catches models that compute the difference between the two mountains wrong. Qwen 3.5 4B's first run shared the GPU with other runs and hit the 5-minute limit on six questions; its second run, alone, scored 108.
112
+
113
+ ## Why these languages
114
+
115
+ The catalog's model families and the common multilingual benchmarks agree on a core:
116
+
117
+ - Llama 3.2 officially supports English, German, French, Italian, Portuguese, Hindi, Spanish and Thai ([model card](https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct)).
118
+ - OpenAI's MMMLU translates MMLU into Arabic, Bengali, German, Spanish, French, Hindi, Indonesian, Italian, Japanese, Korean, Portuguese, Swahili, Yoruba and Chinese ([dataset card](https://huggingface.co/datasets/openai/MMMLU/blob/main/README.md)).
119
+ - LFM2 lists English, Arabic, Chinese, French, German, Japanese, Korean and Spanish ([model card](https://huggingface.co/LiquidAI/LFM2-2.6B/blob/refs%2Fpr%2F7/README.md)).
120
+ - Russian is among the largest languages in Common Crawl after English, in the group that each makes up a few percent of its pages ([Common Crawl](https://en.wikipedia.org/wiki/Common_Crawl)).
121
+
122
+ ## Running it
123
+
124
+ ```bash
125
+ npm run bench:wllama -- --model littlelamb-290m --model qwen-3-0.6b --device webgpu --runs 2 --json results.json
126
+ node scripts/wllama-bench/score.mjs scripts/wllama-bench/cases.json results.json
127
+ ```
128
+
129
+ The first command prints the score at the end; the second re-scores saved results, for example after a change to the scorer. To vet a model that is not in the catalog yet, pass `--model owner/repo/file-00001-of-0000N.gguf`.
e2e/main-thread-budget.spec.ts CHANGED
@@ -231,6 +231,7 @@ function stubEndpoints(page: Page) {
231
  accessKeysEnabled: false,
232
  accessKeyTimeoutHours: 24,
233
  wllamaDefaultModelId: "littlelamb-290m",
 
234
  internalApiEnabled: false,
235
  internalApiName: "Internal API",
236
  defaultInferenceType: "openai",
 
231
  accessKeysEnabled: false,
232
  accessKeyTimeoutHours: 24,
233
  wllamaDefaultModelId: "littlelamb-290m",
234
+ wllamaDefaultGpuModelId: "gemma-3-4b",
235
  internalApiEnabled: false,
236
  internalApiName: "Internal API",
237
  defaultInferenceType: "openai",
eval/README.md CHANGED
@@ -6,6 +6,7 @@ has two parts, both driven by a single fixed golden set (`goldenSet.ts`).
6
 
7
  Some of it runs in the default `npm test` suite (and so in CI); the rest is a
8
  local signal:
 
9
  - `metrics.test.ts`, `goldenSet.test.ts`, `promptConstruction.test.ts` run in
10
  the default suite: pure math, golden-set structure, and prompt construction.
11
  No model, no API key.
@@ -19,6 +20,7 @@ change, not an absolute quality score.
19
  ## The golden set
20
 
21
  `goldenSet.ts` is a fixed, hand-curated list of queries. Each entry has:
 
22
  - `query`: the search query.
23
  - `results`: realistic candidate results (title, snippet, url), mixed
24
  relevant and irrelevant, the way a real search engine returns them.
 
6
 
7
  Some of it runs in the default `npm test` suite (and so in CI); the rest is a
8
  local signal:
9
+
10
  - `metrics.test.ts`, `goldenSet.test.ts`, `promptConstruction.test.ts` run in
11
  the default suite: pure math, golden-set structure, and prompt construction.
12
  No model, no API key.
 
20
  ## The golden set
21
 
22
  `goldenSet.ts` is a fixed, hand-curated list of queries. Each entry has:
23
+
24
  - `query`: the search query.
25
  - `results`: realistic candidate results (title, snippet, url), mixed
26
  relevant and irrelevant, the way a real search engine returns them.
knip.json CHANGED
@@ -8,6 +8,7 @@
8
  "ignoreFiles": [
9
  "client/postcss.config.cjs",
10
  "vitest.integration.config.ts",
11
- "scripts/npm-bundle-overlay.cjs"
 
12
  ]
13
  }
 
8
  "ignoreFiles": [
9
  "client/postcss.config.cjs",
10
  "vitest.integration.config.ts",
11
+ "scripts/npm-bundle-overlay.cjs",
12
+ "scripts/wllama-bench/bench.ts"
13
  ]
14
  }
package-lock.json CHANGED
@@ -96,13 +96,13 @@
96
  "license": "MIT"
97
  },
98
  "node_modules/@ai-sdk/gateway": {
99
- "version": "4.0.133",
100
- "resolved": "https://registry.npmjs.org/@ai-sdk/gateway/-/gateway-4.0.133.tgz",
101
- "integrity": "sha512-6DmtrnwvTZG6RFhZscsnUX0XKxA+o2Y/EkZUGWWqFITez/gvOGG/PRKITjwPupUci5vbORThwqkbCj1/066Reg==",
102
  "license": "Apache-2.0",
103
  "dependencies": {
104
- "@ai-sdk/provider": "4.0.35",
105
- "@ai-sdk/provider-utils": "5.0.72",
106
  "@vercel/oidc": "3.2.0"
107
  },
108
  "engines": {
@@ -112,14 +112,26 @@
112
  "zod": "^3.25.76 || ^4.1.8"
113
  }
114
  },
 
 
 
 
 
 
 
 
 
 
 
 
115
  "node_modules/@ai-sdk/openai-compatible": {
116
- "version": "3.0.82",
117
- "resolved": "https://registry.npmjs.org/@ai-sdk/openai-compatible/-/openai-compatible-3.0.82.tgz",
118
- "integrity": "sha512-wey0CbujWRkZbbrJjw/GJHyjXpt0v44PQKaTGTVGmigqnM057G7GQHDyZQQj9O0lICY5qJxzpn4wCSftT8BSQg==",
119
  "license": "Apache-2.0",
120
  "dependencies": {
121
- "@ai-sdk/provider": "4.0.35",
122
- "@ai-sdk/provider-utils": "5.0.72"
123
  },
124
  "engines": {
125
  "node": ">=22"
@@ -128,6 +140,18 @@
128
  "zod": "^3.25.76 || ^4.1.8"
129
  }
130
  },
 
 
 
 
 
 
 
 
 
 
 
 
131
  "node_modules/@ai-sdk/provider": {
132
  "version": "4.0.35",
133
  "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.35.tgz",
@@ -141,16 +165,16 @@
141
  }
142
  },
143
  "node_modules/@ai-sdk/provider-utils": {
144
- "version": "5.0.72",
145
- "resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-5.0.72.tgz",
146
- "integrity": "sha512-M6QAztI84jWumQSvKcGOL91DxhChsWxn3D3gYtV0/7E1TPQg9BmLdIerOolUC/jghQbMlQrHyzp0hqdIhUZ2Rw==",
147
  "license": "Apache-2.0",
148
  "dependencies": {
149
- "@ai-sdk/provider": "4.0.35",
150
  "@standard-schema/spec": "^1.1.0",
151
  "@workflow/serde": "4.1.0",
152
  "eventsource-parser": "^3.0.8",
153
- "undici": "^7.29.0"
154
  },
155
  "engines": {
156
  "node": ">=22"
@@ -159,6 +183,18 @@
159
  "zod": "^3.25.76 || ^4.1.8"
160
  }
161
  },
 
 
 
 
 
 
 
 
 
 
 
 
162
  "node_modules/@ai-sdk/provider-utils/node_modules/undici": {
163
  "version": "7.30.1",
164
  "resolved": "https://registry.npmjs.org/undici/-/undici-7.30.1.tgz",
@@ -286,9 +322,9 @@
286
  }
287
  },
288
  "node_modules/@biomejs/biome": {
289
- "version": "2.6.4",
290
- "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.6.4.tgz",
291
- "integrity": "sha512-8sKKwaNW4ot22awZ3lBjwWLHnUFXgXnrBPYS2gNlBAXRbDC++7kqjK2H7dR/FgCDtPvO1xfKpgEhJkGxAKYkxA==",
292
  "dev": true,
293
  "license": "MIT OR Apache-2.0",
294
  "bin": {
@@ -302,22 +338,22 @@
302
  "url": "https://opencollective.com/biome"
303
  },
304
  "optionalDependencies": {
305
- "@biomejs/cli-android-arm64": "2.6.4",
306
- "@biomejs/cli-android-x64": "2.6.4",
307
- "@biomejs/cli-darwin-arm64": "2.6.4",
308
- "@biomejs/cli-darwin-x64": "2.6.4",
309
- "@biomejs/cli-linux-arm64": "2.6.4",
310
- "@biomejs/cli-linux-arm64-musl": "2.6.4",
311
- "@biomejs/cli-linux-x64": "2.6.4",
312
- "@biomejs/cli-linux-x64-musl": "2.6.4",
313
- "@biomejs/cli-win32-arm64": "2.6.4",
314
- "@biomejs/cli-win32-x64": "2.6.4"
315
  }
316
  },
317
  "node_modules/@biomejs/cli-android-arm64": {
318
- "version": "2.6.4",
319
- "resolved": "https://registry.npmjs.org/@biomejs/cli-android-arm64/-/cli-android-arm64-2.6.4.tgz",
320
- "integrity": "sha512-jwrwigP4tBcHxzuV8izioX/BOUhJL/4e2rNSOE5nCjBkVC018LQAQUGiH+CNkFYvLtQ1dcZo5/xXERmaAGc7JQ==",
321
  "cpu": [
322
  "arm64"
323
  ],
@@ -332,9 +368,9 @@
332
  }
333
  },
334
  "node_modules/@biomejs/cli-android-x64": {
335
- "version": "2.6.4",
336
- "resolved": "https://registry.npmjs.org/@biomejs/cli-android-x64/-/cli-android-x64-2.6.4.tgz",
337
- "integrity": "sha512-HdGInPJ4nZFwHxzvEtcp2nmSBtUyJrurmtIK43upFckuS3+ZqVM05HtsxQWnqGsuy/pxckIAjyKWlEKRlBXUyA==",
338
  "cpu": [
339
  "x64"
340
  ],
@@ -349,9 +385,9 @@
349
  }
350
  },
351
  "node_modules/@biomejs/cli-darwin-arm64": {
352
- "version": "2.6.4",
353
- "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.6.4.tgz",
354
- "integrity": "sha512-0VvcUz46wbg59Q4TZ59KkIjDJrxEyu4Eoe79+F4SChxoWe+W7AEyIp6F5r72C9+p6MsB6dIovnZt1D30lGM3XA==",
355
  "cpu": [
356
  "arm64"
357
  ],
@@ -366,9 +402,9 @@
366
  }
367
  },
368
  "node_modules/@biomejs/cli-darwin-x64": {
369
- "version": "2.6.4",
370
- "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.6.4.tgz",
371
- "integrity": "sha512-fxmvkF81srlS3DiMyfm+aG3J0eG+6/BjaxRyjy57KbLSafnq0PO+hHfVWmtH2ty0S7nm6yDXBRwySfFeaRJKRQ==",
372
  "cpu": [
373
  "x64"
374
  ],
@@ -383,9 +419,9 @@
383
  }
384
  },
385
  "node_modules/@biomejs/cli-linux-arm64": {
386
- "version": "2.6.4",
387
- "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.6.4.tgz",
388
- "integrity": "sha512-6+bK1Y/evmIUiJr7auertuMbiaYVicJhqA1bZyL47lCMWugv8l0gFQCqvR/gN1vZMHYm+HwoTKgeMxdNFCoQTg==",
389
  "cpu": [
390
  "arm64"
391
  ],
@@ -403,9 +439,9 @@
403
  }
404
  },
405
  "node_modules/@biomejs/cli-linux-arm64-musl": {
406
- "version": "2.6.4",
407
- "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.6.4.tgz",
408
- "integrity": "sha512-31ZaH/MHqPX+O+evRwRrCHQ8W5/9adY+/eMytGGWZnRx1T41QsWIF09+/WujynLBhWZUxNGS5CtsWLwgOFTAyg==",
409
  "cpu": [
410
  "arm64"
411
  ],
@@ -423,9 +459,9 @@
423
  }
424
  },
425
  "node_modules/@biomejs/cli-linux-x64": {
426
- "version": "2.6.4",
427
- "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.6.4.tgz",
428
- "integrity": "sha512-tbFZMdL6dP/ws4edXxYG9WhvaVa1ZDzL4G5DzahnWW7Psib9H+VTdyU4XXVxpJk5j/nYZroSbvSNyYlpW3yCIw==",
429
  "cpu": [
430
  "x64"
431
  ],
@@ -443,9 +479,9 @@
443
  }
444
  },
445
  "node_modules/@biomejs/cli-linux-x64-musl": {
446
- "version": "2.6.4",
447
- "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.6.4.tgz",
448
- "integrity": "sha512-bomSa2XdQAGGj6Cwdm4M13qE+lN9+AOlW8KtI4hdyVyRRF/Z71qPAi95T4wtdZK0QpBbkTW8hgbZZCwPi4xzIw==",
449
  "cpu": [
450
  "x64"
451
  ],
@@ -463,9 +499,9 @@
463
  }
464
  },
465
  "node_modules/@biomejs/cli-win32-arm64": {
466
- "version": "2.6.4",
467
- "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.6.4.tgz",
468
- "integrity": "sha512-eCsqt8Ma3eVap+oyJCDnJZH60SIU464B66n3y38EUTJdM1T/HfZol1FJC9vb+sHToX0ix8XzqPcwJnOzyAJz0g==",
469
  "cpu": [
470
  "arm64"
471
  ],
@@ -480,9 +516,9 @@
480
  }
481
  },
482
  "node_modules/@biomejs/cli-win32-x64": {
483
- "version": "2.6.4",
484
- "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.6.4.tgz",
485
- "integrity": "sha512-pYsMy5AThiHFOZAsngg8qN4PurM6nInKBhVX7sbj3eNpRQqo1Hb0MgCwPL7VqVMrmcEEMj9Ks3qbkallR65e8g==",
486
  "cpu": [
487
  "x64"
488
  ],
@@ -822,13 +858,13 @@
822
  "license": "MIT"
823
  },
824
  "node_modules/@mantine/carousel": {
825
- "version": "9.7.4",
826
- "resolved": "https://registry.npmjs.org/@mantine/carousel/-/carousel-9.7.4.tgz",
827
- "integrity": "sha512-UAEaIl5sQvqRB30nzPXgNFsCu8m+4I5wCZKemUBEtPxFECF03HEvekBWO8yMUFp6jyjJSEguqr/y5tJm2wgpUw==",
828
  "license": "MIT",
829
  "peerDependencies": {
830
- "@mantine/core": "9.7.4",
831
- "@mantine/hooks": "9.7.4",
832
  "embla-carousel": ">=8.0.0",
833
  "embla-carousel-react": ">=8.0.0",
834
  "react": "^19.2.0",
@@ -836,24 +872,24 @@
836
  }
837
  },
838
  "node_modules/@mantine/code-highlight": {
839
- "version": "9.7.4",
840
- "resolved": "https://registry.npmjs.org/@mantine/code-highlight/-/code-highlight-9.7.4.tgz",
841
- "integrity": "sha512-YGmJI4IwR54z5MXTaRiw/BKpF2FJno2bRnYkelbrSB+ZFerqy2625AyOFv5Ey8LbT0ggr4aft7R/+SqWvcvE2w==",
842
  "license": "MIT",
843
  "dependencies": {
844
  "clsx": "^2.1.1"
845
  },
846
  "peerDependencies": {
847
- "@mantine/core": "9.7.4",
848
- "@mantine/hooks": "9.7.4",
849
  "react": "^19.2.0",
850
  "react-dom": "^19.2.0"
851
  }
852
  },
853
  "node_modules/@mantine/core": {
854
- "version": "9.7.4",
855
- "resolved": "https://registry.npmjs.org/@mantine/core/-/core-9.7.4.tgz",
856
- "integrity": "sha512-c7aTGELNn74CxG9i5/tq9BHGh0lKdKmGGz+9iDF+gR7Ipt4U1TMM286lAmLpRrKL2bR+UEaN4blZ8UJmOuGJ4Q==",
857
  "license": "MIT",
858
  "dependencies": {
859
  "@floating-ui/react": "^0.27.20",
@@ -863,15 +899,15 @@
863
  "type-fest": "^5.10.0"
864
  },
865
  "peerDependencies": {
866
- "@mantine/hooks": "9.7.4",
867
  "react": "^19.2.0",
868
  "react-dom": "^19.2.0"
869
  }
870
  },
871
  "node_modules/@mantine/form": {
872
- "version": "9.7.4",
873
- "resolved": "https://registry.npmjs.org/@mantine/form/-/form-9.7.4.tgz",
874
- "integrity": "sha512-p8cImC+VgKKKRc6HJGlFtGAKNbKyHtKyDIgNJeoqUBQ1beUfQlEh0I6lmTmWCzGlijVUE+GdNJWveNr0PQKRIw==",
875
  "license": "MIT",
876
  "dependencies": {
877
  "@standard-schema/spec": "^1.1.0",
@@ -883,34 +919,34 @@
883
  }
884
  },
885
  "node_modules/@mantine/hooks": {
886
- "version": "9.7.4",
887
- "resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-9.7.4.tgz",
888
- "integrity": "sha512-j6Xf9Sc1fhhGEKXg6BZA2geyP/Czqvo6Rsi0IduOCWgwl/MAAJbKRjRc7xe2+9vePLdfqLZqRIAOY5rta88uNA==",
889
  "license": "MIT",
890
  "peerDependencies": {
891
  "react": "^19.2.0"
892
  }
893
  },
894
  "node_modules/@mantine/notifications": {
895
- "version": "9.7.4",
896
- "resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-9.7.4.tgz",
897
- "integrity": "sha512-LabOPnE/YtdpXHn49ZJjiJJBYnYXUMi6SFuzxje7XxpoxImZ+wdGh4R/+l89NnWTxKwGoQL51iUTL8PSgu2A1Q==",
898
  "license": "MIT",
899
  "dependencies": {
900
- "@mantine/store": "9.7.4",
901
  "react-transition-group": "4.4.5"
902
  },
903
  "peerDependencies": {
904
- "@mantine/core": "9.7.4",
905
- "@mantine/hooks": "9.7.4",
906
  "react": "^19.2.0",
907
  "react-dom": "^19.2.0"
908
  }
909
  },
910
  "node_modules/@mantine/store": {
911
- "version": "9.7.4",
912
- "resolved": "https://registry.npmjs.org/@mantine/store/-/store-9.7.4.tgz",
913
- "integrity": "sha512-tICEOzsaV2eiV4QAegdErRLtfd0da02DKqsEIzJLa+8T5dWDnBMCqlWxHfBMnaL7HBAmpx41koad0zUZPGw7pg==",
914
  "license": "MIT",
915
  "peerDependencies": {
916
  "react": "^19.2.0"
@@ -2914,15 +2950,15 @@
2914
  }
2915
  },
2916
  "node_modules/@vitest/coverage-v8": {
2917
- "version": "5.0.5",
2918
- "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-5.0.5.tgz",
2919
- "integrity": "sha512-4KpkGdIrSqBihx/JyP/e+S+IKB98etg1XDQiLAxksLfcShnwi1VReGeOT9NI43hLHbknosKp/1CCLn9Zgcs8mg==",
2920
  "dev": true,
2921
  "license": "MIT",
2922
  "dependencies": {
2923
  "@bcoe/v8-coverage": "^1.0.2",
2924
- "@vitest/istanbul-lib-coverage": "^1.0.2",
2925
- "@vitest/istanbul-lib-report": "^1.0.2",
2926
  "ast-v8-to-istanbul": "^1.0.7",
2927
  "magicast": "^0.5.5",
2928
  "obug": "^3.0.0",
@@ -2933,8 +2969,8 @@
2933
  "url": "https://opencollective.com/vitest"
2934
  },
2935
  "peerDependencies": {
2936
- "@vitest/browser": "5.0.5",
2937
- "vitest": "5.0.5"
2938
  },
2939
  "peerDependenciesMeta": {
2940
  "@vitest/browser": {
@@ -2943,9 +2979,9 @@
2943
  }
2944
  },
2945
  "node_modules/@vitest/istanbul-lib-coverage": {
2946
- "version": "1.0.2",
2947
- "resolved": "https://registry.npmjs.org/@vitest/istanbul-lib-coverage/-/istanbul-lib-coverage-1.0.2.tgz",
2948
- "integrity": "sha512-9J/JMwOf9AoJhAywhrn7ScKTL38hsWQP/qPG60OtaAFcQ5OXPwKsxZFlbnuCKmZ61m8/lGgHYnFpdyQZUvG/iA==",
2949
  "dev": true,
2950
  "license": "MIT",
2951
  "engines": {
@@ -2953,27 +2989,27 @@
2953
  }
2954
  },
2955
  "node_modules/@vitest/istanbul-lib-report": {
2956
- "version": "1.0.2",
2957
- "resolved": "https://registry.npmjs.org/@vitest/istanbul-lib-report/-/istanbul-lib-report-1.0.2.tgz",
2958
- "integrity": "sha512-gUsfXZJbzPamoIY5TvHFiMMoXESBrUMo+xqaj+rYrWI69+EnvRlYBlP96ZnHPY4vX8kyUpgAnFUCg5wZG/HkDQ==",
2959
  "dev": true,
2960
  "license": "MIT",
2961
  "dependencies": {
2962
- "@vitest/istanbul-lib-coverage": "1.0.2"
2963
  },
2964
  "engines": {
2965
  "node": ">=22"
2966
  }
2967
  },
2968
  "node_modules/@vitest/mocker": {
2969
- "version": "5.0.5",
2970
- "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.5.tgz",
2971
- "integrity": "sha512-xLL3lkDegJZw+MGoGaCCsFayDZthGgpAtr3Vziyfc4p7xH89K7KRPcRBBh/kEYm0Aqkt5DtTmkYpBtRV/FrHZg==",
2972
  "dev": true,
2973
  "license": "MIT",
2974
  "dependencies": {
2975
  "@jridgewell/trace-mapping": "0.3.31",
2976
- "@vitest/spy": "5.0.5",
2977
  "estree-walker": "^3.0.3",
2978
  "magic-string": "^1.4.3"
2979
  },
@@ -2994,9 +3030,9 @@
2994
  }
2995
  },
2996
  "node_modules/@vitest/spy": {
2997
- "version": "5.0.5",
2998
- "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.0.5.tgz",
2999
- "integrity": "sha512-lwJRExuH417257Q5wv9QYugN9IMJkoxcrKrYxGPQkBzl7wlNpTUxD/5yNX4ESKVUIShKPgkGchYPFMWOOk0wzw==",
3000
  "dev": true,
3001
  "license": "MIT",
3002
  "funding": {
@@ -3025,14 +3061,14 @@
3025
  }
3026
  },
3027
  "node_modules/ai": {
3028
- "version": "7.0.160",
3029
- "resolved": "https://registry.npmjs.org/ai/-/ai-7.0.160.tgz",
3030
- "integrity": "sha512-h48o8i8NTDuHUZhiLDm9NHufEk/L3dkrJ8E9liXMcd4K4hAdI8bfamtbRJylyQeKQ599mnWNplTvyH/SbtpolQ==",
3031
  "license": "Apache-2.0",
3032
  "dependencies": {
3033
- "@ai-sdk/gateway": "4.0.133",
3034
- "@ai-sdk/provider": "4.0.35",
3035
- "@ai-sdk/provider-utils": "5.0.72"
3036
  },
3037
  "engines": {
3038
  "node": ">=22"
@@ -3041,6 +3077,18 @@
3041
  "zod": "^3.25.76 || ^4.1.8"
3042
  }
3043
  },
 
 
 
 
 
 
 
 
 
 
 
 
3044
  "node_modules/ansi-regex": {
3045
  "version": "5.0.1",
3046
  "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
@@ -6719,9 +6767,9 @@
6719
  }
6720
  },
6721
  "node_modules/rate-limiter-flexible": {
6722
- "version": "11.2.3",
6723
- "resolved": "https://registry.npmjs.org/rate-limiter-flexible/-/rate-limiter-flexible-11.2.3.tgz",
6724
- "integrity": "sha512-w4HX4toAsEbu1VksOauZwI9d6URb6/4WqJJ5Hg1bESihMt2KJfQ2iTwvDkhIg+y2HetLh65DGu/8xIkUz/xNPA==",
6725
  "license": "ISC"
6726
  },
6727
  "node_modules/react": {
@@ -7074,9 +7122,9 @@
7074
  }
7075
  },
7076
  "node_modules/rollup-plugin-visualizer": {
7077
- "version": "7.1.1",
7078
- "resolved": "https://registry.npmjs.org/rollup-plugin-visualizer/-/rollup-plugin-visualizer-7.1.1.tgz",
7079
- "integrity": "sha512-ThaGiHTU8XW02OkK80TrTHATraJmM9OAduU4otal+7gyXLpYEtmGBLfx5kW+EHvvLwn03YGW2NnwKUIqsYlJAA==",
7080
  "license": "MIT",
7081
  "dependencies": {
7082
  "open": "^11.0.0",
@@ -7518,21 +7566,21 @@
7518
  }
7519
  },
7520
  "node_modules/tldts": {
7521
- "version": "7.0.25",
7522
- "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.0.25.tgz",
7523
- "integrity": "sha512-keinCnPbwXEUG3ilrWQZU+CqcTTzHq9m2HhoUP2l7Xmi8l1LuijAXLpAJ5zRW+ifKTNscs4NdCkfkDCBYm352w==",
7524
  "license": "MIT",
7525
  "dependencies": {
7526
- "tldts-core": "^7.0.25"
7527
  },
7528
  "bin": {
7529
  "tldts": "bin/cli.js"
7530
  }
7531
  },
7532
  "node_modules/tldts-core": {
7533
- "version": "7.0.25",
7534
- "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.0.25.tgz",
7535
- "integrity": "sha512-ZjCZK0rppSBu7rjHYDYsEaMOIbbT+nWF57hKkv4IUmZWBNrBWBOjIElc0mKRgLM8bm7x/BBlof6t2gi/Oq/Asw==",
7536
  "license": "MIT"
7537
  },
7538
  "node_modules/tough-cookie": {
@@ -7923,14 +7971,14 @@
7923
  }
7924
  },
7925
  "node_modules/vitest": {
7926
- "version": "5.0.5",
7927
- "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.0.5.tgz",
7928
- "integrity": "sha512-cPODOMF8YnkiiYtDdHo6n4wWmBrOBBbOIYH2d33M4l3CdNn72h+qMmO6uXffUN6A5AZFXNND/d+krS9mgkXRfg==",
7929
  "dev": true,
7930
  "license": "MIT",
7931
  "dependencies": {
7932
  "@types/chai": "^5.2.2",
7933
- "@vitest/mocker": "5.0.5",
7934
  "chai": "^6.3.0",
7935
  "es-module-lexer": "^2.3.2",
7936
  "expect-type": "^1.4.0",
@@ -7956,12 +8004,12 @@
7956
  "@edge-runtime/vm": "*",
7957
  "@opentelemetry/api": "^1.9.0",
7958
  "@types/node": "^22.0.0 || >=24.0.0",
7959
- "@vitest/browser-playwright": "5.0.5",
7960
- "@vitest/browser-preview": "5.0.5",
7961
  "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0",
7962
- "@vitest/coverage-istanbul": "5.0.5",
7963
- "@vitest/coverage-v8": "5.0.5",
7964
- "@vitest/ui": "5.0.5",
7965
  "happy-dom": "*",
7966
  "jsdom": "*",
7967
  "vite": "^6.4.0 || ^7.0.0 || ^8.0.0"
 
96
  "license": "MIT"
97
  },
98
  "node_modules/@ai-sdk/gateway": {
99
+ "version": "4.0.136",
100
+ "resolved": "https://registry.npmjs.org/@ai-sdk/gateway/-/gateway-4.0.136.tgz",
101
+ "integrity": "sha512-P851NL80P85Ee6MhblRuuCzNlQdOYU5rKmdt/Wuo5dMtkzvIHhyVZY9wtfKG3wBJUUoxHxWKsI2aR6O75o8diA==",
102
  "license": "Apache-2.0",
103
  "dependencies": {
104
+ "@ai-sdk/provider": "4.0.36",
105
+ "@ai-sdk/provider-utils": "5.0.75",
106
  "@vercel/oidc": "3.2.0"
107
  },
108
  "engines": {
 
112
  "zod": "^3.25.76 || ^4.1.8"
113
  }
114
  },
115
+ "node_modules/@ai-sdk/gateway/node_modules/@ai-sdk/provider": {
116
+ "version": "4.0.36",
117
+ "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.36.tgz",
118
+ "integrity": "sha512-GqvWZSZdBelCGughlBdOoupT258rgM3YMbaLAS9WSZJ0vlt8c9vm3My+ZT31mYhiReMCMCF2qF2axnGbILpk1A==",
119
+ "license": "Apache-2.0",
120
+ "dependencies": {
121
+ "json-schema": "^0.4.0"
122
+ },
123
+ "engines": {
124
+ "node": ">=22"
125
+ }
126
+ },
127
  "node_modules/@ai-sdk/openai-compatible": {
128
+ "version": "3.0.85",
129
+ "resolved": "https://registry.npmjs.org/@ai-sdk/openai-compatible/-/openai-compatible-3.0.85.tgz",
130
+ "integrity": "sha512-vZx3MvZjc7h7Ud8GUEvS9Qngtoec+Zogv5Zxw8kVjXrZhp/OOHfEosXoqjScnokoCK/d5cQfurfNNUmTrbZOQQ==",
131
  "license": "Apache-2.0",
132
  "dependencies": {
133
+ "@ai-sdk/provider": "4.0.36",
134
+ "@ai-sdk/provider-utils": "5.0.75"
135
  },
136
  "engines": {
137
  "node": ">=22"
 
140
  "zod": "^3.25.76 || ^4.1.8"
141
  }
142
  },
143
+ "node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider": {
144
+ "version": "4.0.36",
145
+ "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.36.tgz",
146
+ "integrity": "sha512-GqvWZSZdBelCGughlBdOoupT258rgM3YMbaLAS9WSZJ0vlt8c9vm3My+ZT31mYhiReMCMCF2qF2axnGbILpk1A==",
147
+ "license": "Apache-2.0",
148
+ "dependencies": {
149
+ "json-schema": "^0.4.0"
150
+ },
151
+ "engines": {
152
+ "node": ">=22"
153
+ }
154
+ },
155
  "node_modules/@ai-sdk/provider": {
156
  "version": "4.0.35",
157
  "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.35.tgz",
 
165
  }
166
  },
167
  "node_modules/@ai-sdk/provider-utils": {
168
+ "version": "5.0.75",
169
+ "resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-5.0.75.tgz",
170
+ "integrity": "sha512-k4yAsFliGZwoTpyTpm3ptxwIeaPvRh5vGh/UWoqDiLLXKoyz4zuBGS7p3ygf8to5Bh4fAOHynotLBsWLIYdu2A==",
171
  "license": "Apache-2.0",
172
  "dependencies": {
173
+ "@ai-sdk/provider": "4.0.36",
174
  "@standard-schema/spec": "^1.1.0",
175
  "@workflow/serde": "4.1.0",
176
  "eventsource-parser": "^3.0.8",
177
+ "undici": "^7.29.1"
178
  },
179
  "engines": {
180
  "node": ">=22"
 
183
  "zod": "^3.25.76 || ^4.1.8"
184
  }
185
  },
186
+ "node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider": {
187
+ "version": "4.0.36",
188
+ "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.36.tgz",
189
+ "integrity": "sha512-GqvWZSZdBelCGughlBdOoupT258rgM3YMbaLAS9WSZJ0vlt8c9vm3My+ZT31mYhiReMCMCF2qF2axnGbILpk1A==",
190
+ "license": "Apache-2.0",
191
+ "dependencies": {
192
+ "json-schema": "^0.4.0"
193
+ },
194
+ "engines": {
195
+ "node": ">=22"
196
+ }
197
+ },
198
  "node_modules/@ai-sdk/provider-utils/node_modules/undici": {
199
  "version": "7.30.1",
200
  "resolved": "https://registry.npmjs.org/undici/-/undici-7.30.1.tgz",
 
322
  }
323
  },
324
  "node_modules/@biomejs/biome": {
325
+ "version": "2.6.5",
326
+ "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.6.5.tgz",
327
+ "integrity": "sha512-n0sp74QbSVEkWXlH659TKv4oJNylwAvDeZ8K8vt/PbcF1xneuNWe57z/G0Bxfh00cufhWXF6DiStLM8+jcLUpg==",
328
  "dev": true,
329
  "license": "MIT OR Apache-2.0",
330
  "bin": {
 
338
  "url": "https://opencollective.com/biome"
339
  },
340
  "optionalDependencies": {
341
+ "@biomejs/cli-android-arm64": "2.6.5",
342
+ "@biomejs/cli-android-x64": "2.6.5",
343
+ "@biomejs/cli-darwin-arm64": "2.6.5",
344
+ "@biomejs/cli-darwin-x64": "2.6.5",
345
+ "@biomejs/cli-linux-arm64": "2.6.5",
346
+ "@biomejs/cli-linux-arm64-musl": "2.6.5",
347
+ "@biomejs/cli-linux-x64": "2.6.5",
348
+ "@biomejs/cli-linux-x64-musl": "2.6.5",
349
+ "@biomejs/cli-win32-arm64": "2.6.5",
350
+ "@biomejs/cli-win32-x64": "2.6.5"
351
  }
352
  },
353
  "node_modules/@biomejs/cli-android-arm64": {
354
+ "version": "2.6.5",
355
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-android-arm64/-/cli-android-arm64-2.6.5.tgz",
356
+ "integrity": "sha512-fkLzc1WRU7wRIUNmAm7cxILb4dd6eESz/VycWvVFKVn6tXx0gFQKdUbPnwT42xys8AEvIJQpFGcK00kURwqorg==",
357
  "cpu": [
358
  "arm64"
359
  ],
 
368
  }
369
  },
370
  "node_modules/@biomejs/cli-android-x64": {
371
+ "version": "2.6.5",
372
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-android-x64/-/cli-android-x64-2.6.5.tgz",
373
+ "integrity": "sha512-fkZ9dPnDAzAcaPtPCiwqtkub5C9FQK/oGCGaU9sq+DysTaq13pE9FxBIMcEZ3ydn8/FfcMdXi/DDzKDP+qyn2Q==",
374
  "cpu": [
375
  "x64"
376
  ],
 
385
  }
386
  },
387
  "node_modules/@biomejs/cli-darwin-arm64": {
388
+ "version": "2.6.5",
389
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.6.5.tgz",
390
+ "integrity": "sha512-bKd0EOREgnVjeZm4s9knQ+WdPOkWS3JHB+eWGHlx+Pq66bqQA1/KybwU0O+zuyAyXiphSCBcrLruZt3YtnJoaQ==",
391
  "cpu": [
392
  "arm64"
393
  ],
 
402
  }
403
  },
404
  "node_modules/@biomejs/cli-darwin-x64": {
405
+ "version": "2.6.5",
406
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.6.5.tgz",
407
+ "integrity": "sha512-UkT9BECNOXSiW6SGddjyaRACy362Sc9n3vDaTFkccL0bC2gW7JzM16i4+JKPbEaDn1Sa+oETHV8KungnI/y40Q==",
408
  "cpu": [
409
  "x64"
410
  ],
 
419
  }
420
  },
421
  "node_modules/@biomejs/cli-linux-arm64": {
422
+ "version": "2.6.5",
423
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.6.5.tgz",
424
+ "integrity": "sha512-H9cVMWBqW/lkFK9NHJdt0bpM2q7PacUDEjQoff9+m0dCV09H/jmBykfTCkbDthHf8+jCuWDJWiQFJ7bDkiGOcA==",
425
  "cpu": [
426
  "arm64"
427
  ],
 
439
  }
440
  },
441
  "node_modules/@biomejs/cli-linux-arm64-musl": {
442
+ "version": "2.6.5",
443
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.6.5.tgz",
444
+ "integrity": "sha512-kfc3AePW1a0/d/gUpcIz95nf3Ce8YY2/xL0Fk3fLqAhKsotqUi6PN6BaVWss4p6ijWbiuacZ9NQ4NiQtpjbYpw==",
445
  "cpu": [
446
  "arm64"
447
  ],
 
459
  }
460
  },
461
  "node_modules/@biomejs/cli-linux-x64": {
462
+ "version": "2.6.5",
463
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.6.5.tgz",
464
+ "integrity": "sha512-e6/WMSN/+FhH+ZOoBevps/euxFQmv6BXqYNuTn1+ITR6O4XYFjHF5PeVSNZnjkgSYmvhcDkfepSX5lXczMijGA==",
465
  "cpu": [
466
  "x64"
467
  ],
 
479
  }
480
  },
481
  "node_modules/@biomejs/cli-linux-x64-musl": {
482
+ "version": "2.6.5",
483
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.6.5.tgz",
484
+ "integrity": "sha512-0mHVpLNt7/FugfZ2VPugUIEIiooWIyHGGJUqU9StxamBln9hz+maXRFIECU50jaf5/ZB93veGIViN5VKgw2AEA==",
485
  "cpu": [
486
  "x64"
487
  ],
 
499
  }
500
  },
501
  "node_modules/@biomejs/cli-win32-arm64": {
502
+ "version": "2.6.5",
503
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.6.5.tgz",
504
+ "integrity": "sha512-uBbfpdR/cH5up1iRJFGAPP97xKMzrgMs685CSrY7NM+Q4Unw7chY0o3JulEvJdmU6c6hGQxwqotMq7DDH0DzxA==",
505
  "cpu": [
506
  "arm64"
507
  ],
 
516
  }
517
  },
518
  "node_modules/@biomejs/cli-win32-x64": {
519
+ "version": "2.6.5",
520
+ "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.6.5.tgz",
521
+ "integrity": "sha512-07LaCeN9vvmbAAMOMsUjMfL5UbsCDkvVeyMJIgwNRc0xYqhizBGkjVzx05LYEwCXl2AiHcdzqVPR4IOYAsI1QQ==",
522
  "cpu": [
523
  "x64"
524
  ],
 
858
  "license": "MIT"
859
  },
860
  "node_modules/@mantine/carousel": {
861
+ "version": "9.7.5",
862
+ "resolved": "https://registry.npmjs.org/@mantine/carousel/-/carousel-9.7.5.tgz",
863
+ "integrity": "sha512-CVIMYhddQhS355bb4fKa8S0Dml9Frpg6qfgeakhyuQzRVov49vt8Zvr1KDTV0tKs6ktV0I9x5+M87PfUOPaRVg==",
864
  "license": "MIT",
865
  "peerDependencies": {
866
+ "@mantine/core": "9.7.5",
867
+ "@mantine/hooks": "9.7.5",
868
  "embla-carousel": ">=8.0.0",
869
  "embla-carousel-react": ">=8.0.0",
870
  "react": "^19.2.0",
 
872
  }
873
  },
874
  "node_modules/@mantine/code-highlight": {
875
+ "version": "9.7.5",
876
+ "resolved": "https://registry.npmjs.org/@mantine/code-highlight/-/code-highlight-9.7.5.tgz",
877
+ "integrity": "sha512-a9YhELhBNuqsVvbH2E40xVeyGrsV1lAZNj5wIaQYUc6MSNnu4Iq7fJVYk6Qt33G1+MCbfujYo3UGMoXoovoahw==",
878
  "license": "MIT",
879
  "dependencies": {
880
  "clsx": "^2.1.1"
881
  },
882
  "peerDependencies": {
883
+ "@mantine/core": "9.7.5",
884
+ "@mantine/hooks": "9.7.5",
885
  "react": "^19.2.0",
886
  "react-dom": "^19.2.0"
887
  }
888
  },
889
  "node_modules/@mantine/core": {
890
+ "version": "9.7.5",
891
+ "resolved": "https://registry.npmjs.org/@mantine/core/-/core-9.7.5.tgz",
892
+ "integrity": "sha512-NiOTHpAZssi1Z5ISZBvcXEA4XDn0BWcxwpmmUthFx/eL0CsJ18FXMn/ydRCJmoeMGcIKmRE+pjt90KM70GOsUw==",
893
  "license": "MIT",
894
  "dependencies": {
895
  "@floating-ui/react": "^0.27.20",
 
899
  "type-fest": "^5.10.0"
900
  },
901
  "peerDependencies": {
902
+ "@mantine/hooks": "9.7.5",
903
  "react": "^19.2.0",
904
  "react-dom": "^19.2.0"
905
  }
906
  },
907
  "node_modules/@mantine/form": {
908
+ "version": "9.7.5",
909
+ "resolved": "https://registry.npmjs.org/@mantine/form/-/form-9.7.5.tgz",
910
+ "integrity": "sha512-DbYsbSak59cwxFGRGBScWMzzVWKSUNPAJLMS8FDEyzpAJvywj4Bx07syFx1DgUJaIeMfjIERAVraPe3T2WxdJg==",
911
  "license": "MIT",
912
  "dependencies": {
913
  "@standard-schema/spec": "^1.1.0",
 
919
  }
920
  },
921
  "node_modules/@mantine/hooks": {
922
+ "version": "9.7.5",
923
+ "resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-9.7.5.tgz",
924
+ "integrity": "sha512-+3cNisLOUkzF77SjRKkG/V+svZii9WDGvcwlaxFH58b14MNohz1zWbV+WfjZt9qfzrIPPUOedks/z6PMo5rAFA==",
925
  "license": "MIT",
926
  "peerDependencies": {
927
  "react": "^19.2.0"
928
  }
929
  },
930
  "node_modules/@mantine/notifications": {
931
+ "version": "9.7.5",
932
+ "resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-9.7.5.tgz",
933
+ "integrity": "sha512-S7jApMXZhXmKLlwvvp5yfQ3AqfxQN9Y+GQK82f5vNWKLZVgQ3HdicpeSh1DmsNWdB4sJr0oIhWliCUPAC8ctyA==",
934
  "license": "MIT",
935
  "dependencies": {
936
+ "@mantine/store": "9.7.5",
937
  "react-transition-group": "4.4.5"
938
  },
939
  "peerDependencies": {
940
+ "@mantine/core": "9.7.5",
941
+ "@mantine/hooks": "9.7.5",
942
  "react": "^19.2.0",
943
  "react-dom": "^19.2.0"
944
  }
945
  },
946
  "node_modules/@mantine/store": {
947
+ "version": "9.7.5",
948
+ "resolved": "https://registry.npmjs.org/@mantine/store/-/store-9.7.5.tgz",
949
+ "integrity": "sha512-A+5/Y7+2EkkB8ByWSIxUpaXA0O7jFlhBKNrB8IAAkl0WADEhDh6UxDV/88p9fUfGP17vbWskEyMLT9t5vWmu4g==",
950
  "license": "MIT",
951
  "peerDependencies": {
952
  "react": "^19.2.0"
 
2950
  }
2951
  },
2952
  "node_modules/@vitest/coverage-v8": {
2953
+ "version": "5.1.0",
2954
+ "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-5.1.0.tgz",
2955
+ "integrity": "sha512-OY9aShBQG5KOIw2zCo9fDoCHI9RHliNHJ//nM7m6jGg41Hyke9JOGWmeMlK74xYErsxMoK8mIB3gAeEyFVA7LA==",
2956
  "dev": true,
2957
  "license": "MIT",
2958
  "dependencies": {
2959
  "@bcoe/v8-coverage": "^1.0.2",
2960
+ "@vitest/istanbul-lib-coverage": "^2.1.0",
2961
+ "@vitest/istanbul-lib-report": "^2.1.0",
2962
  "ast-v8-to-istanbul": "^1.0.7",
2963
  "magicast": "^0.5.5",
2964
  "obug": "^3.0.0",
 
2969
  "url": "https://opencollective.com/vitest"
2970
  },
2971
  "peerDependencies": {
2972
+ "@vitest/browser": "5.1.0",
2973
+ "vitest": "5.1.0"
2974
  },
2975
  "peerDependenciesMeta": {
2976
  "@vitest/browser": {
 
2979
  }
2980
  },
2981
  "node_modules/@vitest/istanbul-lib-coverage": {
2982
+ "version": "2.1.0",
2983
+ "resolved": "https://registry.npmjs.org/@vitest/istanbul-lib-coverage/-/istanbul-lib-coverage-2.1.0.tgz",
2984
+ "integrity": "sha512-WOjuS+xcjSIy7ruYBQ+9BUcV7XZQ0FyVcbWbWxW9TRx/kLGx5SQaeFRIFDJxjNplb6YsT7SpKo2zuXXUo91OIQ==",
2985
  "dev": true,
2986
  "license": "MIT",
2987
  "engines": {
 
2989
  }
2990
  },
2991
  "node_modules/@vitest/istanbul-lib-report": {
2992
+ "version": "2.1.0",
2993
+ "resolved": "https://registry.npmjs.org/@vitest/istanbul-lib-report/-/istanbul-lib-report-2.1.0.tgz",
2994
+ "integrity": "sha512-+ZFta25nWtGCOBG9/IET8w1RO5Oawsd6H8Uf6AJ9EA/StFuKVtKAEJEJ6uRt84OH+T4YkI0ASmIHAhRA+0KVxw==",
2995
  "dev": true,
2996
  "license": "MIT",
2997
  "dependencies": {
2998
+ "@vitest/istanbul-lib-coverage": "2.1.0"
2999
  },
3000
  "engines": {
3001
  "node": ">=22"
3002
  }
3003
  },
3004
  "node_modules/@vitest/mocker": {
3005
+ "version": "5.1.0",
3006
+ "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.1.0.tgz",
3007
+ "integrity": "sha512-5umB9/jlWcqVS6fsrFmv5Gdnpu6wAUio/lEOwAmvB7v+lFo/IW2B9FhAD0p19GCULTgMzLCdUmuCDCnAzWgppQ==",
3008
  "dev": true,
3009
  "license": "MIT",
3010
  "dependencies": {
3011
  "@jridgewell/trace-mapping": "0.3.31",
3012
+ "@vitest/spy": "5.1.0",
3013
  "estree-walker": "^3.0.3",
3014
  "magic-string": "^1.4.3"
3015
  },
 
3030
  }
3031
  },
3032
  "node_modules/@vitest/spy": {
3033
+ "version": "5.1.0",
3034
+ "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.1.0.tgz",
3035
+ "integrity": "sha512-2DPO5OMHWKrBngC+fCmTQqemNF0gidRhp3lxbBmRhW+M1XJrfgPpqNqWVevXtn2f2ufD5ZaR1B6B641aAlcX5A==",
3036
  "dev": true,
3037
  "license": "MIT",
3038
  "funding": {
 
3061
  }
3062
  },
3063
  "node_modules/ai": {
3064
+ "version": "7.0.163",
3065
+ "resolved": "https://registry.npmjs.org/ai/-/ai-7.0.163.tgz",
3066
+ "integrity": "sha512-nm8+qn36NQXO4Hjfj7SlbcNRhUyNXKtdoS9xhXr/z92lvdGFuPkzHmA2tFzhaUQy13IitNYrcw2QSNpEJC/iSA==",
3067
  "license": "Apache-2.0",
3068
  "dependencies": {
3069
+ "@ai-sdk/gateway": "4.0.136",
3070
+ "@ai-sdk/provider": "4.0.36",
3071
+ "@ai-sdk/provider-utils": "5.0.75"
3072
  },
3073
  "engines": {
3074
  "node": ">=22"
 
3077
  "zod": "^3.25.76 || ^4.1.8"
3078
  }
3079
  },
3080
+ "node_modules/ai/node_modules/@ai-sdk/provider": {
3081
+ "version": "4.0.36",
3082
+ "resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.36.tgz",
3083
+ "integrity": "sha512-GqvWZSZdBelCGughlBdOoupT258rgM3YMbaLAS9WSZJ0vlt8c9vm3My+ZT31mYhiReMCMCF2qF2axnGbILpk1A==",
3084
+ "license": "Apache-2.0",
3085
+ "dependencies": {
3086
+ "json-schema": "^0.4.0"
3087
+ },
3088
+ "engines": {
3089
+ "node": ">=22"
3090
+ }
3091
+ },
3092
  "node_modules/ansi-regex": {
3093
  "version": "5.0.1",
3094
  "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
 
6767
  }
6768
  },
6769
  "node_modules/rate-limiter-flexible": {
6770
+ "version": "11.2.4",
6771
+ "resolved": "https://registry.npmjs.org/rate-limiter-flexible/-/rate-limiter-flexible-11.2.4.tgz",
6772
+ "integrity": "sha512-z28uTq33lBUAszaKtX9Vq4Fwemf6Lfr06tw3jo5pkqjsxfFyqk4yx5T4bEHAeLr39ZS6VeVtfaIu35QhVNKAvA==",
6773
  "license": "ISC"
6774
  },
6775
  "node_modules/react": {
 
7122
  }
7123
  },
7124
  "node_modules/rollup-plugin-visualizer": {
7125
+ "version": "7.1.2",
7126
+ "resolved": "https://registry.npmjs.org/rollup-plugin-visualizer/-/rollup-plugin-visualizer-7.1.2.tgz",
7127
+ "integrity": "sha512-+yrEz9LJ7fxd7T0yj4GPvcKHKfJNzTzKT7FHiF3f/US+7EaWlgB8PoGbUOlobD4Al8v6TeCCl/Fgbov5FV/DaA==",
7128
  "license": "MIT",
7129
  "dependencies": {
7130
  "open": "^11.0.0",
 
7566
  }
7567
  },
7568
  "node_modules/tldts": {
7569
+ "version": "7.4.19",
7570
+ "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.19.tgz",
7571
+ "integrity": "sha512-48dH6aSpQnpbzDUc4vIQZ1VjB8tkK+e8c1yx05/SZK+rkssgjEOlxDd/yU8/a4vGYQ9vRgJr9dwMq9TJ0b3X2Q==",
7572
  "license": "MIT",
7573
  "dependencies": {
7574
+ "tldts-core": "^7.4.19"
7575
  },
7576
  "bin": {
7577
  "tldts": "bin/cli.js"
7578
  }
7579
  },
7580
  "node_modules/tldts-core": {
7581
+ "version": "7.4.20",
7582
+ "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.4.20.tgz",
7583
+ "integrity": "sha512-C630TWXZCZmLq0F2bW4QqwnaaxCQ/svpAqvJwnC4JvgEM5ohhBnGsEzTLSOXcN+xjz+kEaHS5uoWIw2klnqd0A==",
7584
  "license": "MIT"
7585
  },
7586
  "node_modules/tough-cookie": {
 
7971
  }
7972
  },
7973
  "node_modules/vitest": {
7974
+ "version": "5.1.0",
7975
+ "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.1.0.tgz",
7976
+ "integrity": "sha512-MzmNFnrwa8v8lF1bLxw3UJ4EREwVOVb75VqJZmUDRjJ6EluK/x9th7qTbaeDk41WxE1GxWqmTXcdsfobfH5sOA==",
7977
  "dev": true,
7978
  "license": "MIT",
7979
  "dependencies": {
7980
  "@types/chai": "^5.2.2",
7981
+ "@vitest/mocker": "5.1.0",
7982
  "chai": "^6.3.0",
7983
  "es-module-lexer": "^2.3.2",
7984
  "expect-type": "^1.4.0",
 
8004
  "@edge-runtime/vm": "*",
8005
  "@opentelemetry/api": "^1.9.0",
8006
  "@types/node": "^22.0.0 || >=24.0.0",
8007
+ "@vitest/browser-playwright": "5.1.0",
8008
+ "@vitest/browser-preview": "5.1.0",
8009
  "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0",
8010
+ "@vitest/coverage-istanbul": "5.1.0",
8011
+ "@vitest/coverage-v8": "5.1.0",
8012
+ "@vitest/ui": "5.1.0",
8013
  "happy-dom": "*",
8014
  "jsdom": "*",
8015
  "vite": "^6.4.0 || ^7.0.0 || ^8.0.0"
package.json CHANGED
@@ -33,7 +33,8 @@
33
  "changelog-guard": "node scripts/changelog-guard.cjs",
34
  "license-check": "node scripts/license-check.cjs",
35
  "native-module-check": "node scripts/native-module-integrity.cjs",
36
- "wllama-catalog-check": "node scripts/wllama-catalog-check.cjs"
 
37
  },
38
  "allowScripts": {
39
  "onnxruntime-node": false,
 
33
  "changelog-guard": "node scripts/changelog-guard.cjs",
34
  "license-check": "node scripts/license-check.cjs",
35
  "native-module-check": "node scripts/native-module-integrity.cjs",
36
+ "wllama-catalog-check": "node scripts/wllama-catalog-check.cjs",
37
+ "bench:wllama": "node scripts/wllama-bench/run.mjs"
38
  },
39
  "allowScripts": {
40
  "onnxruntime-node": false,