Spaces:
Running
Running
Sync from felladrin/MiniSearch@79128cb
Browse filesFiles changed (40)
- .env.example+4-1
- .github/CODE_OF_CONDUCT.md+3
- .github/CONTRIBUTING.md+1
- .github/SECURITY.md+8
- .github/SUPPORT.md+1
- README.md+1-1
- agents.md+10-1
- changelog.md+10-6
- client/components/App/App.test.tsx+1
- client/components/App/App.tsx+4-1
- client/modules/config.test.ts+1
- client/modules/config.ts+2
- client/modules/pubSub.ts+2-1
- client/modules/settings.test.ts+47-3
- client/modules/settings.ts+34-2
- client/modules/textGenerationWithWllama.test.ts+35
- client/modules/textGenerationWithWllama.ts+34-4
- client/modules/wllama.test.ts+54-1
- client/modules/wllama.ts+55-40
- docs/ai-integration.md+30-2
- docs/api.md+1
- docs/coding-conventions.md+1
- docs/configuration.md+25-11
- docs/core-technologies.md+1
- docs/development-commands.md+36
- docs/glossary.md+7
- docs/overview.md+10
- docs/project-structure.md+1
- docs/pull-requests.md+6
- docs/quick-start.md+6
- docs/reranking.md+3
- docs/search-history.md+5
- docs/security.md+2
- docs/ui-components.md+25
- docs/wllama-model-evaluation.mdAdded+129
- e2e/main-thread-budget.spec.ts+1
- eval/README.md+2
- knip.json+2-1
- package-lock.json+184-136
- package.json+2-1
3 unmodified lines4567891011123 unmodified lines# The timeout in hours for access key validation. Set to 0 to require validation on every page load.ACCESS_KEY_TIMEOUT_HOURS="24"# The default model ID for Wllama.WLLAMA_DEFAULT_MODEL_ID="littlelamb-290m"# 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.INTERNAL_OPENAI_COMPATIBLE_API_BASE_URL=""3 unmodified lines4567891011121314153 unmodified lines# The timeout in hours for access key validation. Set to 0 to require validation on every page load.ACCESS_KEY_TIMEOUT_HOURS="24"# The default model ID for Wllama in browsers without WebGPU, where the model runs on the CPU.WLLAMA_DEFAULT_MODEL_ID="littlelamb-290m"# The default model ID for Wllama in browsers with WebGPU.WLLAMA_DEFAULT_GPU_MODEL_ID="gemma-3-4b"# 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.INTERNAL_OPENAI_COMPATIBLE_API_BASE_URL=""
8 unmodified lines910111213141 unmodified line16171819202113 unmodified lines3536373839408 unmodified lines## Our StandardsExamples of behavior that contributes to a positive environment for our community include:- Demonstrating empathy and kindness toward other people- Being respectful of differing opinions, viewpoints, and experiences- Giving and gracefully accepting constructive feedback1 unmodified line- Focusing on what is best not just for us as individuals, but for the overall communityExamples of unacceptable behavior include:- The use of sexualized language or imagery, and sexual attention or advances of any kind- Trolling, insulting or derogatory comments, and personal or political attacks- Public or private harassment13 unmodified lines## EnforcementInstances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at:- GitHub: [@felladrin](https://github.com/felladrin)- Email: (private contact can be provided upon request)8 unmodified lines91011121314151 unmodified line1718192021222313 unmodified lines373839404142438 unmodified lines## Our StandardsExamples of behavior that contributes to a positive environment for our community include:- Demonstrating empathy and kindness toward other people- Being respectful of differing opinions, viewpoints, and experiences- Giving and gracefully accepting constructive feedback1 unmodified line- Focusing on what is best not just for us as individuals, but for the overall communityExamples of unacceptable behavior include:- The use of sexualized language or imagery, and sexual attention or advances of any kind- Trolling, insulting or derogatory comments, and personal or political attacks- Public or private harassment13 unmodified lines## EnforcementInstances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at:- GitHub: [@felladrin](https://github.com/felladrin)- Email: (private contact can be provided upon request)
21 unmodified lines22232425262721 unmodified lines```This runs:- Biome (formatting/linting)- TypeScript (type checking)- knip (dead code detection)21 unmodified lines2223242526272821 unmodified lines```This runs:- Biome (formatting/linting)- TypeScript (type checking)- knip (dead code detection)
19 unmodified lines20212223242534 unmodified lines606162636465666768697071727374757677787980818235 unmodified lines11811912012112212332 unmodified lines1561571581591601611 unmodified line16316416516616716819 unmodified lines### What to IncludeWhen reporting a vulnerability, please include:- A clear description of the vulnerability- Steps to reproduce the issue- Potential impact of the vulnerability34 unmodified linesMiniSearch is designed as a privacy-focused search application with the following security assumptions:**Trust Boundaries:**- **Browser Environment**: The application runs entirely in the user's browser- **Server Component**: Optional backend for search and AI processing- **AI Models**: Local or remote AI processing with configurable endpoints**Data Flow:**- User queries are sent to SearXNG instances (configurable)- AI processing can be local (Wllama) or remote (API endpoints)- Search history is stored locally in the browser- No tracking or analytics by default**Security Controls:**- Optional access key protection for deployment- Configurable AI endpoints for privacy- Local-first data storage- No third-party tracking or analytics**Potential Risks:**- Malicious SearXNG instances could log queries- Remote AI endpoints could access user queries- Browser extensions could interfere with the application35 unmodified lines### Approving a new install scriptUnder `strict-allow-scripts`, any package that ships an install script without a recorded decision fails the install. To unblock it, a maintainer must:1. Read the script first (`npm view <pkg> scripts`, or the unpacked tarball) and decide whether it is acceptable.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.3. Update the decision list above in the same PR, with the reasoning.32 unmodified lines## Security UpdatesSecurity updates will be:- Released as new versions- Announced in release notes- Coordinated with dependency updates when applicable1 unmodified line## Security TeamThe MiniSearch security team is currently the project maintainer:- [@felladrin](https://github.com/felladrin) - Project Maintainer## Acknowledgments19 unmodified lines2021222324252634 unmodified lines61626364656667686970717273747576777879808182838485868735 unmodified lines12312412512612712812932 unmodified lines1621631641651661671681 unmodified line17017117217317417517619 unmodified lines### What to IncludeWhen reporting a vulnerability, please include:- A clear description of the vulnerability- Steps to reproduce the issue- Potential impact of the vulnerability34 unmodified linesMiniSearch is designed as a privacy-focused search application with the following security assumptions:**Trust Boundaries:**- **Browser Environment**: The application runs entirely in the user's browser- **Server Component**: Optional backend for search and AI processing- **AI Models**: Local or remote AI processing with configurable endpoints**Data Flow:**- User queries are sent to SearXNG instances (configurable)- AI processing can be local (Wllama) or remote (API endpoints)- Search history is stored locally in the browser- No tracking or analytics by default**Security Controls:**- Optional access key protection for deployment- Configurable AI endpoints for privacy- Local-first data storage- No third-party tracking or analytics**Potential Risks:**- Malicious SearXNG instances could log queries- Remote AI endpoints could access user queries- Browser extensions could interfere with the application35 unmodified lines### Approving a new install scriptUnder `strict-allow-scripts`, any package that ships an install script without a recorded decision fails the install. To unblock it, a maintainer must:1. Read the script first (`npm view <pkg> scripts`, or the unpacked tarball) and decide whether it is acceptable.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.3. Update the decision list above in the same PR, with the reasoning.32 unmodified lines## Security UpdatesSecurity updates will be:- Released as new versions- Announced in release notes- Coordinated with dependency updates when applicable1 unmodified line## Security TeamThe MiniSearch security team is currently the project maintainer:- [@felladrin](https://github.com/felladrin) - Project Maintainer## Acknowledgments
6 unmodified lines7891011126 unmodified lines### GitHub DiscussionsFor questions, feature requests, and general discussion, use [GitHub Discussions](https://github.com/felladrin/MiniSearch/discussions). This is the best place to:- Ask how to configure MiniSearch for your use case- Request new features- Share ideas and feedback6 unmodified lines789101112136 unmodified lines### GitHub DiscussionsFor questions, feature requests, and general discussion, use [GitHub Discussions](https://github.com/felladrin/MiniSearch/discussions). This is the best place to:- Ask how to configure MiniSearch for your use case- Request new features- Share ideas and feedback
36 unmodified lines3738394041424336 unmodified lines## Features- **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.- **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.- **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.- **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.- **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.36 unmodified lines3738394041424336 unmodified lines## Features- **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.- **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.- **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.- **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.- **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.
4 unmodified lines5678910111213141516 unmodified lines323334353637150 unmodified lines18818919019119219319427 unmodified lines2222232242252262271 unmodified line22923023123223323416 unmodified lines2512522532542552562572582592602612622632642652662672682692702714 unmodified lines## Before You Start**New to this codebase?** Read in this order:1. `docs/quick-start.md` - Get it running2. `docs/overview.md` - Understand the system3. `docs/project-structure.md` - Navigate the code**Making changes?** Check:- `docs/coding-conventions.md` - Code style- `docs/development-commands.md` - Available commands- `docs/pull-requests.md` - How to submit16 unmodified lines- **`docs/api.md`** - HTTP endpoint reference: parameters, responses, and error codes- **`docs/ai-integration.md`** - AI inference types (Wllama, OpenAI, AI Horde, Internal)- **`docs/ui-components.md`** - Component architecture and PubSub patterns- **`docs/search-history.md`** - History database schema and management- **`docs/conversation-memory.md`** - Token budgeting and rolling summaries150 unmodified lines### Add a new AI model1. 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)2. Shard the GGUF (`llama-gguf-split --split --size`, or an equivalent) and publish to a `Felladrin/gguf-sharded-<QUANT>-<Name>` repo3. 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 answering4. Run `node scripts/wllama-catalog-check.cjs` and `npx vitest run client/modules/wllama.test.ts`27 unmodified lines## Quality GatesBefore any change:```bashnpm run lint```1 unmodified lineInside the dev container, the same command is `docker compose exec development-server npm run lint`.This runs:- Biome (formatting/linting)- TypeScript (type checking)- knip (dead code detection)16 unmodified lines## Agent-First Principles**Repository as System of Record:**- All knowledge lives in versioned docs/ structure- This file is your entry point - start here- Follow links, don't assume - verify in code**Context Efficiency:**- Use this map to navigate quickly- Return to this file when context drifts- Follow the decision tree for common tasks**Architecture & Boundaries:**- Respect PubSub boundaries - don't cross concerns- Client vs server - keep them separate- Feature-based organization - one folder per feature**Documentation Maintenance:**- Update these docs when you learn something new- Add cross-references when linking concepts- Keep examples current with actual code4 unmodified lines56789101112131415161716 unmodified lines34353637383940150 unmodified lines19119219319419519619727 unmodified lines2252262272282292302311 unmodified line23323423523623723823916 unmodified lines2562572582592602612622632642652662672682692702712722732742752762772782792804 unmodified lines## Before You Start**New to this codebase?** Read in this order:1. `docs/quick-start.md` - Get it running2. `docs/overview.md` - Understand the system3. `docs/project-structure.md` - Navigate the code**Making changes?** Check:- `docs/coding-conventions.md` - Code style- `docs/development-commands.md` - Available commands- `docs/pull-requests.md` - How to submit16 unmodified lines- **`docs/api.md`** - HTTP endpoint reference: parameters, responses, and error codes- **`docs/ai-integration.md`** - AI inference types (Wllama, OpenAI, AI Horde, Internal)- **`docs/wllama-model-evaluation.md`** - How in-browser models are scored on MiniSearch's task- **`docs/ui-components.md`** - Component architecture and PubSub patterns- **`docs/search-history.md`** - History database schema and management- **`docs/conversation-memory.md`** - Token budgeting and rolling summaries150 unmodified lines### Add a new AI model1. 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 CPU2. Shard the GGUF (`llama-gguf-split --split --size`, or an equivalent) and publish to a `Felladrin/gguf-sharded-<QUANT>-<Name>` repo3. 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 answering4. Run `node scripts/wllama-catalog-check.cjs` and `npx vitest run client/modules/wllama.test.ts`27 unmodified lines## Quality GatesBefore any change:```bashnpm run lint```1 unmodified lineInside the dev container, the same command is `docker compose exec development-server npm run lint`.This runs:- Biome (formatting/linting)- TypeScript (type checking)- knip (dead code detection)16 unmodified lines## Agent-First Principles**Repository as System of Record:**- All knowledge lives in versioned docs/ structure- This file is your entry point - start here- Follow links, don't assume - verify in code**Context Efficiency:**- Use this map to navigate quickly- Return to this file when context drifts- Follow the decision tree for common tasks**Architecture & Boundaries:**- Respect PubSub boundaries - don't cross concerns- Client vs server - keep them separate- Feature-based organization - one folder per feature**Documentation Maintenance:**- Update these docs when you learn something new- Add cross-references when linking concepts- Keep examples current with actual code
1 unmodified line2345672 unmodified lines101112131415161718192021222324252627282930313233343536373839404142431 unmodified lineNotable changes, grouped by date, most recent first.## 2026-11-052 unmodified lines- 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.- 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.## 2026-11-03- 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.- 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.## 2026-11-02- 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.## 2026-10-10- 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`.## 2026-10-08- `/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.- 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.## 2026-10-07- 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.## 2026-09-23- 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.1 unmodified line2345678910111213141516172 unmodified lines202122232425262728293031323334353637383940414243444546471 unmodified lineNotable changes, grouped by date, most recent first.## 2026-11-08- 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.- 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.- 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.- 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.- 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.- 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).- 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.- 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.## 2026-11-052 unmodified lines- 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.- 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.## 2026-11-03- 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.- 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.## 2026-11-02- 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.## 2026-10-10- 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`.## 2026-10-08- `/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.- 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.## 2026-10-07- 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.## 2026-09-23- 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.
24 unmodified lines25262728293024 unmodified linesaccessKeysEnabled: false,accessKeyTimeoutHours: 24,wllamaDefaultModelId: "littlelamb-290m",internalApiEnabled: false,internalApiName: "Internal API",defaultInferenceType: "browser",24 unmodified lines2526272829303124 unmodified linesaccessKeysEnabled: false,accessKeyTimeoutHours: 24,wllamaDefaultModelId: "littlelamb-290m",wllamaDefaultGpuModelId: "gemma-3-4b",internalApiEnabled: false,internalApiName: "Internal API",defaultInferenceType: "browser",
16 unmodified lines1718192021222391 unmodified lines11511611711811912012112212316 unmodified linesapplyServerConfig,defaultSettings,hasStoredUserSettings,} from "@/modules/settings";import "@mantine/notifications/styles.css";import { verifyStoredAccessKey } from "@/modules/accessKey";import {91 unmodified linessetSettings(applyServerConfig({ ...defaultSettings, ...settings },config === "unavailable" ? FALLBACK_CONFIG : config,hasStoredUserSettings,),);setSettingsInitialized(true);16 unmodified lines17181920212223242591 unmodified lines11711811912012112212312412512616 unmodified linesapplyServerConfig,defaultSettings,hasStoredUserSettings,upgradeUntouchedSystemPrompt,} from "@/modules/settings";import { isWebGPUAvailable } from "@/modules/webGpu";import "@mantine/notifications/styles.css";import { verifyStoredAccessKey } from "@/modules/accessKey";import {91 unmodified linessetSettings(applyServerConfig(upgradeUntouchedSystemPrompt({ ...defaultSettings, ...settings }),config === "unavailable" ? FALLBACK_CONFIG : config,hasStoredUserSettings,isWebGPUAvailable,),);setSettingsInitialized(true);
7 unmodified lines89101112137 unmodified linesaccessKeysEnabled: true,accessKeyTimeoutHours: 24,wllamaDefaultModelId: "some-model",internalApiEnabled: true,internalApiName: "Custom LLM",defaultInferenceType: "internal",7 unmodified lines8910111213147 unmodified linesaccessKeysEnabled: true,accessKeyTimeoutHours: 24,wllamaDefaultModelId: "some-model",wllamaDefaultGpuModelId: "some-gpu-model",internalApiEnabled: true,internalApiName: "Custom LLM",defaultInferenceType: "internal",
8 unmodified lines9101112131413 unmodified lines2829303132338 unmodified linesimport {DEFAULT_INFERENCE_TYPE,DEFAULT_INTERNAL_API_NAME,DEFAULT_WLLAMA_MODEL_ID,type ServerConfig,} from "@shared/serverConfig";13 unmodified linesaccessKeysEnabled: false,accessKeyTimeoutHours: 0,wllamaDefaultModelId: DEFAULT_WLLAMA_MODEL_ID,internalApiEnabled: false,internalApiName: DEFAULT_INTERNAL_API_NAME,defaultInferenceType: DEFAULT_INFERENCE_TYPE,8 unmodified lines910111213141513 unmodified lines293031323334358 unmodified linesimport {DEFAULT_INFERENCE_TYPE,DEFAULT_INTERNAL_API_NAME,DEFAULT_WLLAMA_GPU_MODEL_ID,DEFAULT_WLLAMA_MODEL_ID,type ServerConfig,} from "@shared/serverConfig";13 unmodified linesaccessKeysEnabled: false,accessKeyTimeoutHours: 0,wllamaDefaultModelId: DEFAULT_WLLAMA_MODEL_ID,wllamaDefaultGpuModelId: DEFAULT_WLLAMA_GPU_MODEL_ID,internalApiEnabled: false,internalApiName: DEFAULT_INTERNAL_API_NAME,defaultInferenceType: DEFAULT_INFERENCE_TYPE,
116 unmodified lines117118119120121122123116 unmodified linesdefaultSettings,);export const [, listenToSettingsChanges, getSettings] = settingsPubSub;export const modelSizeInMegabytesPubSub = createPubSub(0);116 unmodified lines117118119120121122123124116 unmodified linesdefaultSettings,);export const [updateSettings, listenToSettingsChanges, getSettings] =settingsPubSub;export const modelSizeInMegabytesPubSub = createPubSub(0);
1232 unmodified lines6789101112131415161784 unmodified lines1021031041051061071081091101111125 unmodified lines1181191201211221231244 unmodified lines12913013113213313413567 unmodified lines203204205import { describe, expect, it, vi } from "vitest";import type { ServerConfig } from "./config";import {2 unmodified linesgetDefaultCpuThreads,getInferenceTypes,prefersLocalDictationModel,} from "./settings";const mockConfig: ServerConfig = {accessKeysEnabled: false,accessKeyTimeoutHours: 0,wllamaDefaultModelId: "littlelamb-290m",internalApiEnabled: false,internalApiName: "Internal API",defaultInferenceType: "browser",84 unmodified lineswllamaDefaultModelId: "custom-model",defaultInferenceType: "internal",};const applied = applyServerConfig(defaultSettings, config, false);expect(applied.wllamaModelId).toBe("custom-model");expect(applied.inferenceType).toBe("internal");});it("should preserve stored settings that differ from the server defaults", () => {const config = {...mockConfig,5 unmodified lineswllamaModelId: "user-picked-model",inferenceType: "horde",};const applied = applyServerConfig(userSettings, config, true);expect(applied.wllamaModelId).toBe("user-picked-model");expect(applied.inferenceType).toBe("horde");});4 unmodified lineswllamaDefaultModelId: "admin-preferred-model",defaultInferenceType: "internal",};const applied = applyServerConfig(defaultSettings, config, true);expect(applied.wllamaModelId).toBe(defaultSettings.wllamaModelId);expect(applied.inferenceType).toBe(defaultSettings.inferenceType);});67 unmodified linesexpect(settings.enableLocalDictationModel).toBe(true);});});12345672 unmodified lines101112131415161718192021222384 unmodified lines1081091101111121131141151161171181191201211221231241251261271281291301311325 unmodified lines1381391401411421431444 unmodified lines14915015115215315415567 unmodified lines223224225226227228229230231232233234235236237238239240241242243244245246247248249import {CITATION_EXAMPLE,DEFAULT_SYSTEM_PROMPT,} from "@shared/defaultSystemPrompt";import { describe, expect, it, vi } from "vitest";import type { ServerConfig } from "./config";import {2 unmodified linesgetDefaultCpuThreads,getInferenceTypes,prefersLocalDictationModel,upgradeUntouchedSystemPrompt,} from "./settings";const mockConfig: ServerConfig = {accessKeysEnabled: false,accessKeyTimeoutHours: 0,wllamaDefaultModelId: "littlelamb-290m",wllamaDefaultGpuModelId: "gemma-3-4b",internalApiEnabled: false,internalApiName: "Internal API",defaultInferenceType: "browser",84 unmodified lineswllamaDefaultModelId: "custom-model",defaultInferenceType: "internal",};const applied = applyServerConfig(defaultSettings, config, false, false);expect(applied.wllamaModelId).toBe("custom-model");expect(applied.inferenceType).toBe("internal");});it("should seed the GPU model default when the browser has WebGPU", () => {const config = {...mockConfig,wllamaDefaultModelId: "cpu-model",wllamaDefaultGpuModelId: "gpu-model",};expect(applyServerConfig(defaultSettings, config, false, true).wllamaModelId,).toBe("gpu-model");expect(applyServerConfig(defaultSettings, config, false, false).wllamaModelId,).toBe("cpu-model");});it("should preserve stored settings that differ from the server defaults", () => {const config = {...mockConfig,5 unmodified lineswllamaModelId: "user-picked-model",inferenceType: "horde",};const applied = applyServerConfig(userSettings, config, true, true);expect(applied.wllamaModelId).toBe("user-picked-model");expect(applied.inferenceType).toBe("horde");});4 unmodified lineswllamaDefaultModelId: "admin-preferred-model",defaultInferenceType: "internal",};const applied = applyServerConfig(defaultSettings, config, true, true);expect(applied.wllamaModelId).toBe(defaultSettings.wllamaModelId);expect(applied.inferenceType).toBe(defaultSettings.inferenceType);});67 unmodified linesexpect(settings.enableLocalDictationModel).toBe(true);});});describe("upgradeUntouchedSystemPrompt", () => {const previousDefault = DEFAULT_SYSTEM_PROMPT.replace(CITATION_EXAMPLE,"[youtube.com](https://www.youtube.com/watch?v=dQw4w9WgXcQ)",);it("replaces a saved prompt that is exactly the previous default", () => {const upgraded = upgradeUntouchedSystemPrompt({...defaultSettings,systemPrompt: previousDefault,});expect(upgraded.systemPrompt).toBe(DEFAULT_SYSTEM_PROMPT);});it("keeps a prompt the user edited", () => {const edited = `${previousDefault}\nAlways answer in haiku.`;const kept = upgradeUntouchedSystemPrompt({...defaultSettings,systemPrompt: edited,});expect(kept.systemPrompt).toBe(edited);});});
123456129 unmodified lines136137138139140141142143144145146147148149150151152153154155156157158import { DEFAULT_SYSTEM_PROMPT } from "@shared/defaultSystemPrompt";import {DEFAULT_INFERENCE_TYPE,DEFAULT_WLLAMA_MODEL_ID,type ServerConfig,} from "@shared/serverConfig";129 unmodified lines];}/*** Applies the server-provided defaults to a settings object.** These are defaults, not overrides: they seed a profile that has never been* saved and are ignored once the user has settings of their own, since a stored* value is a choice even when it matches what the code ships with.*/export function applyServerConfig(settings: typeof defaultSettings,config: ServerConfig,userSettingsWereStored: boolean,): typeof defaultSettings {if (userSettingsWereStored) return settings;return {...settings,wllamaModelId: config.wllamaDefaultModelId || DEFAULT_WLLAMA_MODEL_ID,inferenceType: config.defaultInferenceType || DEFAULT_INFERENCE_TYPE,};}12345678910129 unmodified lines140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190import {CITATION_EXAMPLE,DEFAULT_SYSTEM_PROMPT,} from "@shared/defaultSystemPrompt";import {DEFAULT_INFERENCE_TYPE,DEFAULT_WLLAMA_GPU_MODEL_ID,DEFAULT_WLLAMA_MODEL_ID,type ServerConfig,} from "@shared/serverConfig";129 unmodified lines];}/** The citation example the default prompt carried until 2026-11-08. */const PREVIOUS_CITATION_EXAMPLE ="[youtube.com](https://www.youtube.com/watch?v=dQw4w9WgXcQ)";/*** Moves a saved prompt that is exactly the previous default onto the current* one. Settings store the whole prompt, so without this a profile that saved* its settings would keep the old citation example forever. A prompt the user* edited is their choice and stays.*/export function upgradeUntouchedSystemPrompt(settings: typeof defaultSettings,): typeof defaultSettings {const previousDefault = DEFAULT_SYSTEM_PROMPT.replace(CITATION_EXAMPLE,PREVIOUS_CITATION_EXAMPLE,);return settings.systemPrompt === previousDefault? { ...settings, systemPrompt: DEFAULT_SYSTEM_PROMPT }: settings;}/*** Applies the server-provided defaults to a settings object.** These are defaults, not overrides: they seed a profile that has never been* saved and are ignored once the user has settings of their own, since a stored* value is a choice even when it matches what the code ships with.** The Wllama model default depends on `hasWebGpu`, because a model that* answers quickly on a GPU can take minutes per answer on the CPU.*/export function applyServerConfig(settings: typeof defaultSettings,config: ServerConfig,userSettingsWereStored: boolean,hasWebGpu: boolean,): typeof defaultSettings {if (userSettingsWereStored) return settings;return {...settings,wllamaModelId: hasWebGpu? config.wllamaDefaultGpuModelId || DEFAULT_WLLAMA_GPU_MODEL_ID: config.wllamaDefaultModelId || DEFAULT_WLLAMA_MODEL_ID,inferenceType: config.defaultInferenceType || DEFAULT_INFERENCE_TYPE,};}
123456716 unmodified lines24252627282930313269 unmodified lines102103104105106107import { beforeEach, describe, expect, it, vi } from "vitest";import {updateModelLoadingProgress,updateModelSizeInMegabytes,} from "./pubSub";import {composeStreamedText,16 unmodified linesupdateModelLoadingProgress: vi.fn(),updateModelSizeInMegabytes: vi.fn(),updateResponse: vi.fn(),updateTextGenerationState: vi.fn(),}));vi.mock("./systemPrompt", () => ({getSystemPrompt: vi.fn().mockReturnValue("system"),}));69 unmodified lines]);});it("keeps the last known size when the total is not available yet", async () => {mockDownload([{ loaded: 0, total: 0 }]);1234567891016 unmodified lines27282930313233343536373839404142434469 unmodified lines114115116117118119120121122123124125126127128129130131132133134135136137138139140141142import { beforeEach, describe, expect, it, vi } from "vitest";import { addLogEntry } from "./logEntries";import {getSettings,updateModelLoadingProgress,updateModelSizeInMegabytes,updateSettings,} from "./pubSub";import {composeStreamedText,16 unmodified linesupdateModelLoadingProgress: vi.fn(),updateModelSizeInMegabytes: vi.fn(),updateResponse: vi.fn(),updateSettings: vi.fn(),updateTextGenerationState: vi.fn(),}));vi.mock("./config", () => ({getConfig: vi.fn().mockResolvedValue({wllamaDefaultModelId: "test-model",wllamaDefaultGpuModelId: "test-gpu-model",}),FALLBACK_CONFIG: {},}));vi.mock("./systemPrompt", () => ({getSystemPrompt: vi.fn().mockReturnValue("system"),}));69 unmodified lines]);});it("switches to the default model when the saved one left the catalog", async () => {const savedSettings = getSettings();vi.mocked(getSettings).mockReturnValue({...savedSettings,wllamaModelId: "removed-model",});mockDownload([]);try {await generateTextWithWllama();} finally {vi.mocked(getSettings).mockReturnValue(savedSettings);}expect(vi.mocked(initializeWllama).mock.calls[0]?.[0]).toBe("repo");expect(updateSettings).toHaveBeenCalledWith(expect.objectContaining({ wllamaModelId: "test-model" }),);expect(addLogEntry).toHaveBeenCalledWith(expect.stringContaining("removed-model"),);});it("keeps the last known size when the total is not available yet", async () => {mockDownload([{ loaded: 0, total: 0 }]);
12341 unmodified line6789101121 unmodified lines3334353637383940139 unmodified lines180181182183184185186187188import type { Wllama } from "@wllama/wllama";import { addLogEntry } from "./logEntries";import {getSettings,1 unmodified lineupdateModelLoadingProgress,updateModelSizeInMegabytes,updateResponse,updateTextGenerationState,} from "./pubSub";import {21 unmodified linestry {const response = await generateWithWllama({messages: async () => {const settings = getSettings();const modelConfig = wllamaModels[settings.wllamaModelId];return getDefaultChatMessages(await getFormattedSearchResults(modelConfig.shouldIncludeUrlsOnPrompt,139 unmodified lines}}async function initializeWllamaInstance(progressCallback?: ProgressCallback) {const { initializeWllama, wllamaModels } = await import("./wllama");const model = wllamaModels[getSettings().wllamaModelId];updateModelSizeInMegabytes(model.fileSizeInMegabytes);123451 unmodified line7891011121321 unmodified lines35363738394041139 unmodified lines181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218import type { Wllama } from "@wllama/wllama";import { FALLBACK_CONFIG, getConfig } from "./config";import { addLogEntry } from "./logEntries";import {getSettings,1 unmodified lineupdateModelLoadingProgress,updateModelSizeInMegabytes,updateResponse,updateSettings,updateTextGenerationState,} from "./pubSub";import {21 unmodified linestry {const response = await generateWithWllama({messages: async () => {const modelConfig = await getSelectedWllamaModel();return getDefaultChatMessages(await getFormattedSearchResults(modelConfig.shouldIncludeUrlsOnPrompt,139 unmodified lines}}/*** The model the settings point at, or the default when that model has left* the catalog. Without this, removing a model from the catalog would break* every answer for whoever had picked it.*/async function getSelectedWllamaModel(): Promise<WllamaModel> {const { wllamaModelId } = getSettings();const model = wllamaModels[wllamaModelId];if (model) return model;// Safe without the server: the fallback is only a model to switch to.const config = await getConfig().catch(() => FALLBACK_CONFIG);const defaultId = isWebGPUAvailable? config.wllamaDefaultGpuModelId: config.wllamaDefaultModelId;const defaultModel = wllamaModels[defaultId];if (!defaultModel) {throw new Error(`Neither the selected model "${wllamaModelId}" nor the default "${defaultId}" is in the catalog`,);}addLogEntry(`Model "${wllamaModelId}" is no longer available; switched to "${defaultId}"`,);updateSettings({ ...getSettings(), wllamaModelId: defaultId });return defaultModel;}async function initializeWllamaInstance(progressCallback?: ProgressCallback) {const { initializeWllama } = await import("./wllama");const model = await getSelectedWllamaModel();updateModelSizeInMegabytes(model.fileSizeInMegabytes);
1234540 unmodified lines4647484950516 unmodified lines585960616263646566import { describe, expect, it, vi } from "vitest";import { wllamaModels } from "./wllama";vi.mock("./logEntries", () => ({ addLogEntry: vi.fn() }));vi.mock("./textGenerationUtilities", () => ({ defaultContextSize: 4096 }));40 unmodified lines}});it("keeps reasoning budgets small enough to leave room for the answer", () => {// The budget forces the final answer once the chain of thought runs// this long. It must stay far below the 4096-token context, or the6 unmodified lines}});it("uses the shared default context size for every model", () => {for (const [id, model] of models) {expect(model.contextSize, id).toBe(4096);}});});1234567891040 unmodified lines51525354555657585960616263646566676 unmodified lines7475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119import {DEFAULT_WLLAMA_GPU_MODEL_ID,DEFAULT_WLLAMA_MODEL_ID,} from "@shared/serverConfig";import type { CacheEntry, CacheManager } from "@wllama/wllama";import { describe, expect, it, vi } from "vitest";import { deleteIncompleteCachedModels, wllamaModels } from "./wllama";vi.mock("./logEntries", () => ({ addLogEntry: vi.fn() }));vi.mock("./textGenerationUtilities", () => ({ defaultContextSize: 4096 }));40 unmodified lines}});it("asks every thinking model for low reasoning effort", () => {// A chain of thought cut off by the budget degrades the answer, so the// budget is only a backstop; templates that read `reasoning_effort`// must be steered to think less in the first place.for (const [id, model] of models) {if (model.reasoningBudgetTokens !== undefined) {expect(model.chatTemplateKwargs?.reasoning_effort, id).toBe("low");}}});it("keeps reasoning budgets small enough to leave room for the answer", () => {// The budget forces the final answer once the chain of thought runs// this long. It must stay far below the 4096-token context, or the6 unmodified lines}});it("includes both default models", () => {expect(wllamaModels).toHaveProperty([DEFAULT_WLLAMA_MODEL_ID]);expect(wllamaModels).toHaveProperty([DEFAULT_WLLAMA_GPU_MODEL_ID]);});it("uses the shared default context size for every model", () => {for (const [id, model] of models) {expect(model.contextSize, id).toBe(4096);}});});describe("deleteIncompleteCachedModels", () => {const shard = (repo: string, index: number, total: number) =>`https://huggingface.co/${repo}/resolve/main/model-0000${index}-of-0000${total}.gguf`;const entry = (url: string): CacheEntry => ({name: url,size: 1,metadata: { originalURL: url, etag: "", originalSize: 1 },});it("deletes only the shards of a model whose download did not finish", async () => {let files = [entry(shard("complete", 1, 2)),entry(shard("complete", 2, 2)),entry(shard("interrupted", 1, 3)),entry(shard("interrupted", 3, 3)),];const cacheManager = {list: async () => files,deleteMany: async (predicate: (file: CacheEntry) => boolean) => {files = files.filter((file) => !predicate(file));},} as unknown as CacheManager;await deleteIncompleteCachedModels(cacheManager);expect(files.map((file) => file.metadata.originalURL)).toEqual([shard("complete", 1, 2),shard("complete", 2, 2),]);});});
1234527 unmodified lines3334353637388 unmodified lines474849505152108 unmodified lines1611621631641651661671681691701711721731741751761771 unmodified line17918018118218318418518618718818919019119219319419519619722 unmodified lines22022122222322422523 unmodified lines2492502512522532542552562572582592602611 unmodified line26326426526626726826927027127227327427527627727827928028128221 unmodified lines3043053063073083098 unmodified lines31831932032132232329 unmodified lines35335435535635735835929 unmodified lines38939039139239339439515 unmodified lines4114124134144154161 unmodified line4184194204214224234241 unmodified line4264274284294304314328 unmodified lines441442443444445446import {type LoadModelParams,type SamplingParams,Wllama,type WllamaConfig,27 unmodified lines}}/*** Initializes Wllama with a specific model from HuggingFace.* Performs a single-threaded warmup run before loading with the full config.8 unmodified linestry {const wllama = await createWllamaInstance(config?.wllama);await wllama.loadModelFromHF({ repo: hfRepoId, file: hfFilePath },{108 unmodified linesflash_attn: true,contextSize: defaultContextSize,shouldIncludeUrlsOnPrompt: true,getSampling: () => ({}),});export const wllamaModels: Readonly<Record<string, WllamaModel>> = {"smollm2-135m": {...createDefaultModelConfig(),label: "SmolLM 2 135M",hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-SmolLM2-135M-Instruct",hfFilePath: "model.shard-00001-of-00004.gguf",fileSizeInMegabytes: 102,},"lfm2.5-230m": {...createDefaultModelConfig(),label: "LFM2.5 230M",1 unmodified linehfFilePath: "LFM2.5-230M-Q4_K_XL-00001-of-00003.gguf",fileSizeInMegabytes: 160,},"granite-4.0-350m": {...createDefaultModelConfig(),label: "Granite 4.0 350M",hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-granite-4.0-350m",hfFilePath: "granite-4.0-350m-Q4_K_S-00001-of-00003.gguf",fileSizeInMegabytes: 229,},"littlelamb-290m": {...createDefaultModelConfig(),label: "LittleLamb 290M",hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-LittleLamb",hfFilePath: "LittleLamb-i1-Q4_K_S-00001-of-00003.gguf",fileSizeInMegabytes: 231,},"gemma-3-270m": {...createDefaultModelConfig(),22 unmodified lineshfRepoId: "Felladrin/gguf-sharded-UD-Q4_K_XL-Qwen3-0.6B",hfFilePath: "model.shard-00001-of-00004.gguf",fileSizeInMegabytes: 406,},"lfm2.5-1.2b-instruct": {...createDefaultModelConfig(),23 unmodified lineshfFilePath: "model.shard-00001-of-00003.gguf",fileSizeInMegabytes: 781,},"pints-1.5b": {...createDefaultModelConfig(),label: "Pints 1.5B",hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-1.5-Pints-16K-v0.1",hfFilePath: "model.shard-00001-of-00018.gguf",fileSizeInMegabytes: 905,},"olmo-2-0425-1b": {...createDefaultModelConfig(),label: "OLMo 2 1B",1 unmodified linehfFilePath: "model.shard-00001-of-00006.gguf",fileSizeInMegabytes: 967,},"granite-4.0-1b": {...createDefaultModelConfig(),label: "Granite 4.0 1B",hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-granite-4.0-1b",hfFilePath: "granite-4.0-1b-Q4_K_S-00001-of-00006.gguf",fileSizeInMegabytes: 981,},"stablelm-2-zephyr-1.6b": {...createDefaultModelConfig(),label: "StableLM 2 Zephyr 1.6B",hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-stablelm-2-zephyr-1.6b",hfFilePath: "model.shard-00001-of-00006.gguf",fileSizeInMegabytes: 989,},"smollm2-1.7b": {...createDefaultModelConfig(),label: "SmolLM 2 1.7B",21 unmodified lineshfRepoId: "Felladrin/gguf-sharded-Q4_K_S-DeepSeek-R1-Distill-Qwen-1.5B",hfFilePath: "model.shard-00001-of-00006.gguf",fileSizeInMegabytes: 1070,},"internlm-2.5-1.8b": {...createDefaultModelConfig(),8 unmodified lineshfRepoId: "Felladrin/gguf-sharded-UD-Q4_K_XL-Qwen3-1.7B",hfFilePath: "model.shard-00001-of-00005.gguf",fileSizeInMegabytes: 1140,},"granite-3.3-2b": {...createDefaultModelConfig(),29 unmodified lineshfRepoId: "Felladrin/gguf-sharded-Q4_K_M-Spark-X2.6-1.7B",hfFilePath: "Spark-X2.6-1.7B-Q4_K_M-00001-of-00004.gguf",fileSizeInMegabytes: 1769,reasoningBudgetTokens: 256,},"smollm3-3b": {...createDefaultModelConfig(),29 unmodified lineshfRepoId: "Felladrin/gguf-sharded-Q4_K_S-granite-4.2-3b",hfFilePath: "granite-4.2-3b-Q4_K_S-00001-of-00005.gguf",fileSizeInMegabytes: 2143,reasoningBudgetTokens: 256,},"phi-3.5-mini-3.8b": {...createDefaultModelConfig(),15 unmodified lineshfRepoId: "Felladrin/gguf-sharded-Q4_K_S-Polaris-4B-Preview",hfFilePath: "model.shard-00001-of-00008.gguf",fileSizeInMegabytes: 2380,},"qwen-3.5-4b": {...createDefaultModelConfig(),1 unmodified linehfRepoId: "Felladrin/gguf-sharded-UD-Q3_K_XL-Qwen3.5-4B",hfFilePath: "Qwen3.5-4B-UD-Q3_K_XL-00001-of-00005.gguf",fileSizeInMegabytes: 2436,reasoningBudgetTokens: 256,},"gemma-4-e2b": {...createDefaultModelConfig(),1 unmodified linehfRepoId: "Felladrin/gguf-sharded-Q3_K_S-gemma-4-e2b-it",hfFilePath: "gemma-4-e2b-it-Q3_K_S-00001-of-00005.gguf",fileSizeInMegabytes: 2446,reasoningBudgetTokens: 256,},"phi-4-mini-reasoning": {...createDefaultModelConfig(),8 unmodified lineshfRepoId: "Felladrin/gguf-sharded-Q4_K_M-Spark-X2.6-4B",hfFilePath: "Spark-X2.6-4B-Q4_K_M-00001-of-00007.gguf",fileSizeInMegabytes: 3543,reasoningBudgetTokens: 256,},};123456727 unmodified lines35363738394041424344454647484950515253545556575859606162636465666768698 unmodified lines7879808182838485108 unmodified lines1941951961971981992002012022032042052062071 unmodified line20921021121221321421521621721821922022122 unmodified lines24424524624724824925025125225325425525625725823 unmodified lines2822832842852862871 unmodified line28929029129229329421 unmodified lines3163173183193203213228 unmodified lines33133233333433533633729 unmodified lines36736836937037137237329 unmodified lines40340440540640740840915 unmodified lines4254264274284294304311 unmodified line4334344354364374384391 unmodified line4414424434444454464478 unmodified lines456457458459460461import {type CacheManager,type LoadModelParams,ModelManager,type SamplingParams,Wllama,type WllamaConfig,27 unmodified lines}}/*** Deletes the cached shards of every model whose download did not finish.* wllama 3.8.1 builds each cached model before checking it, and a missing* shard makes that throw, so one interrupted download would otherwise stop* every model from loading until the whole cache is cleared.*/export async function deleteIncompleteCachedModels(cacheManager: CacheManager) {const cachedUrls = new Set((await cacheManager.list()).map((file) => file.metadata.originalURL)// wllama skips files saved without one, so they cannot block a load..filter(Boolean),);const incompleteUrls = new Set([...cachedUrls].map((url) => ModelManager.parseModelUrl(url)).filter((shards) => shards.some((shard) => !cachedUrls.has(shard))).flat(),);if (incompleteUrls.size === 0) return;addLogEntry(`Deleting ${incompleteUrls.size} cached file(s) of models whose download did not finish`,);await cacheManager.deleteMany((file) =>incompleteUrls.has(file.metadata.originalURL),);}/*** Initializes Wllama with a specific model from HuggingFace.* Performs a single-threaded warmup run before loading with the full config.8 unmodified linestry {const wllama = await createWllamaInstance(config?.wllama);await deleteIncompleteCachedModels(wllama.cacheManager);await wllama.loadModelFromHF({ repo: hfRepoId, file: hfFilePath },{108 unmodified linesflash_attn: true,contextSize: defaultContextSize,shouldIncludeUrlsOnPrompt: true,// Templates that read it (Granite 4.2, Spark X2.6) think less, so they// reach the answer before `reasoningBudgetTokens` cuts them off; the others// ignore it.chatTemplateKwargs: { reasoning_effort: "low" },getSampling: () => ({}),});export const wllamaModels: Readonly<Record<string, WllamaModel>> = {"lfm2.5-230m": {...createDefaultModelConfig(),label: "LFM2.5 230M",1 unmodified linehfFilePath: "LFM2.5-230M-Q4_K_XL-00001-of-00003.gguf",fileSizeInMegabytes: 160,},"littlelamb-290m": {...createDefaultModelConfig(),label: "LittleLamb 290M",hfRepoId: "Felladrin/gguf-sharded-Q4_K_S-LittleLamb",hfFilePath: "LittleLamb-i1-Q4_K_S-00001-of-00003.gguf",fileSizeInMegabytes: 231,reasoningBudgetTokens: 1024,},"gemma-3-270m": {...createDefaultModelConfig(),22 unmodified lineshfRepoId: "Felladrin/gguf-sharded-UD-Q4_K_XL-Qwen3-0.6B",hfFilePath: "model.shard-00001-of-00004.gguf",fileSizeInMegabytes: 406,reasoningBudgetTokens: 1024,},"qwen-3.5-0.8b": {...createDefaultModelConfig(),label: "Qwen 3.5 0.8B",hfRepoId: "Felladrin/gguf-sharded-Q4_K_M-Qwen3.5-0.8B",hfFilePath: "Qwen3.5-0.8B-Q4_K_M-00001-of-00003.gguf",fileSizeInMegabytes: 533,reasoningBudgetTokens: 1024,},"lfm2.5-1.2b-instruct": {...createDefaultModelConfig(),23 unmodified lineshfFilePath: "model.shard-00001-of-00003.gguf",fileSizeInMegabytes: 781,},"olmo-2-0425-1b": {...createDefaultModelConfig(),label: "OLMo 2 1B",1 unmodified linehfFilePath: "model.shard-00001-of-00006.gguf",fileSizeInMegabytes: 967,},"smollm2-1.7b": {...createDefaultModelConfig(),label: "SmolLM 2 1.7B",21 unmodified lineshfRepoId: "Felladrin/gguf-sharded-Q4_K_S-DeepSeek-R1-Distill-Qwen-1.5B",hfFilePath: "model.shard-00001-of-00006.gguf",fileSizeInMegabytes: 1070,reasoningBudgetTokens: 1024,},"internlm-2.5-1.8b": {...createDefaultModelConfig(),8 unmodified lineshfRepoId: "Felladrin/gguf-sharded-UD-Q4_K_XL-Qwen3-1.7B",hfFilePath: "model.shard-00001-of-00005.gguf",fileSizeInMegabytes: 1140,reasoningBudgetTokens: 1024,},"granite-3.3-2b": {...createDefaultModelConfig(),29 unmodified lineshfRepoId: "Felladrin/gguf-sharded-Q4_K_M-Spark-X2.6-1.7B",hfFilePath: "Spark-X2.6-1.7B-Q4_K_M-00001-of-00004.gguf",fileSizeInMegabytes: 1769,reasoningBudgetTokens: 1024,},"smollm3-3b": {...createDefaultModelConfig(),29 unmodified lineshfRepoId: "Felladrin/gguf-sharded-Q4_K_S-granite-4.2-3b",hfFilePath: "granite-4.2-3b-Q4_K_S-00001-of-00005.gguf",fileSizeInMegabytes: 2143,reasoningBudgetTokens: 1024,},"phi-3.5-mini-3.8b": {...createDefaultModelConfig(),15 unmodified lineshfRepoId: "Felladrin/gguf-sharded-Q4_K_S-Polaris-4B-Preview",hfFilePath: "model.shard-00001-of-00008.gguf",fileSizeInMegabytes: 2380,reasoningBudgetTokens: 1024,},"qwen-3.5-4b": {...createDefaultModelConfig(),1 unmodified linehfRepoId: "Felladrin/gguf-sharded-UD-Q3_K_XL-Qwen3.5-4B",hfFilePath: "Qwen3.5-4B-UD-Q3_K_XL-00001-of-00005.gguf",fileSizeInMegabytes: 2436,reasoningBudgetTokens: 1024,},"gemma-4-e2b": {...createDefaultModelConfig(),1 unmodified linehfRepoId: "Felladrin/gguf-sharded-Q3_K_S-gemma-4-e2b-it",hfFilePath: "gemma-4-e2b-it-Q3_K_S-00001-of-00005.gguf",fileSizeInMegabytes: 2446,reasoningBudgetTokens: 1024,},"phi-4-mini-reasoning": {...createDefaultModelConfig(),8 unmodified lineshfRepoId: "Felladrin/gguf-sharded-Q4_K_M-Spark-X2.6-4B",hfFilePath: "Spark-X2.6-4B-Q4_K_M-00001-of-00007.gguf",fileSizeInMegabytes: 3543,reasoningBudgetTokens: 1024,},};
19 unmodified lines20212223242526272829301 unmodified line323334353637383940414243444546474849505152531 unmodified line5556575859603 unmodified lines6465666768697071727374757677787980818283848586874 unmodified lines9293949596973 unmodified lines1011021031041051061071081091101111 unmodified line1131141151161171181191201211221231243 unmodified lines1281291301311321334 unmodified lines1381391401411421431441451461471483 unmodified lines15215315415515615715815916016116216315 unmodified lines17918018118218318418518618718818919066 unmodified lines25725825926026126220 unmodified lines2832842852862872882 unmodified lines2912922932942952961 unmodified line29829930030130230360 unmodified lines36436536636736836913 unmodified lines38338438538638738819 unmodified linesUses `@wllama/wllama` for browser-based inference. Automatically uses WebGPU when available, falling back to CPU via WebAssembly.**Requirements:**- Any modern browser- ~300MB-2GB free RAM- WebGPU optional (Chrome 113+, Edge 113+) - enables GPU acceleration**How It Works:**1. Checks WebGPU availability via `"gpu" in navigator`2. Downloads model from HuggingFace (GGUF format, cached in the browser's Origin Private File System)3. Loads model with `n_gpu_layers: 99999` if WebGPU is present, else `0` for CPU-only1 unmodified line5. Streams tokens via the OAI-compatible `createChatCompletion` API**Pre-configured Models:**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.Two constraints decide what can join that list, both measured against the shipped wasm build:- **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.- **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.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.`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.**Configuration:**- Settings โ Inference Type: `Browser`- Settings โ Wllama Model: Select from dropdown- Settings โ CPU threads: Relevant only when WebGPU is unavailable**WebGPU Detection:**```typescript// client/modules/webGpu.ts/** Whether the browser supports the WebGPU API. */1 unmodified line```**Limitations:**- First load requires model download (progressive via sharded files)- Limited to smaller models (~4B params max due to browser memory)- CPU mode is 2-5x slower than WebGPU3 unmodified linesUses OpenAI's API or any OpenAI-compatible service.**Setup:**1. Get API key from OpenAI or compatible provider2. Settings โ Inference Type: `OpenAI`3. Settings โ OpenAI API Key: Enter key4. Settings โ OpenAI Model: Select or enter model ID**Supported Providers:**- OpenAI (gpt-4, gpt-3.5-turbo)- Anthropic (via OpenAI-compatible endpoint)- Google (Gemini via OpenAI-compatible endpoint)- Any custom provider with OpenAI-compatible API**Features:**- Streaming responses, built on the Vercel AI SDK (`ai` + `@ai-sdk/openai-compatible`)- Auto model selection (if blank)- 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)- Reasoning content support: reasoning/thinking output is wrapped between configurable `reasoningStartMarker`/`reasoningEndMarker` settings (default `<think>` / `</think>`)**Configuration:**```typescript{inferenceType: 'openai',4 unmodified lines```**Privacy Considerations:**- Search queries and results sent to OpenAI- Not suitable for sensitive data- Consider internal API for private data3 unmodified linesUses aihorde.net, a distributed volunteer GPU network.**Setup:**1. Settings โ Inference Type: `AI Horde`2. (Optional) Settings โ AI Horde API Key: Get from aihorde.net3. Settings โ AI Horde Model: Select preferred model**How It Works:**1. Request sent to AI Horde API2. Distributed to volunteer workers3. Multiple workers may process in parallel1 unmodified line5. Results streamed back**Features:**- Free to use (anonymous or authenticated)- Kudos-based priority system- Large model selection (70B+ params available)- No API key required (but recommended for priority)**Configuration:**```typescript{inferenceType: 'horde',3 unmodified lines```**Limitations:**- Variable latency (depends on worker availability)- Quality varies by worker- May queue during high demand4 unmodified linesSelf-hosted OpenAI-compatible API for teams and compliance.**Setup:**1. Host an OpenAI-compatible API (e.g., vLLM, llama.cpp server, Ollama with OpenAI compat)2. Configure environment variables (see `docs/configuration.md`)3. Settings โ Inference Type: `Internal`**Environment Variables:**```bashINTERNAL_OPENAI_COMPATIBLE_API_BASE_URL="https://llm.company.com/v1"INTERNAL_OPENAI_COMPATIBLE_API_KEY="sk-internal-xxx"3 unmodified lines**Server-Side Proxy:**The internal API uses a server-side proxy to:- Hide API keys from client- Add request logging/auditing- Apply rate limiting- Enable token-based authentication**Endpoint:**```POST /inference?token=<argon2-hashed-search-token>Content-Type: application/json15 unmodified linesthe `/status` section of `docs/overview.md` for the field reference.**Features:**- Private data stays in your infrastructure- Custom model selection- Server-side logging- Compatible with any OpenAI-compatible API**Recommended Self-Hosted Options:**- **vLLM**: High-performance, production-ready- **llama.cpp server**: Single binary, easy setup- **Ollama**: Simple, Docker-friendly66 unmodified lines### Response ThrottlingTwo PubSub update functions are throttled to 12 updates per second to ensure UI performance during high-frequency streaming:- `updateResponse` → `responsePubSub`- `updateReasoningContent` → `reasoningContentPubSub`20 unmodified lines- **Available for Context:** 75% (~3072 tokens)**Allocation Priority:**1. System prompt (with search results)2. Conversation summary (if exists)3. Recent chat messages (newest first)2 unmodified lines### Rolling SummariesWhen conversation exceeds token budget:1. **Detect Overflow:** Current tokens > 30722. **Generate Summary:** Call LLM with 800-token limit3. **Store Summary:** Save in conversationSummaryPubSub1 unmodified line5. **Continue:** Use summary + remaining messages for context**Summary Prompt:**```Summarize this conversation in 3-5 sentences, preserving key factsand user intent. Be concise but informative.60 unmodified lines### State RecoveryIf generation fails mid-stream:1. Set `textGenerationState` to `failed`2. Preserve partial response in `responsePubSub`3. Allow user to retry or modify query13 unmodified lines### Progressive Model LoadingWllama models are sharded (split into chunks):1. Download metadata first (small, fast)2. Download required shards progressively3. Start inference when first shards available19 unmodified lines202122232425262728293031321 unmodified line343536373839404142434445464748495051525354555657581 unmodified line606162636465663 unmodified lines707172737475767778798081828384858687888990919293949596974 unmodified lines1021031041051061071083 unmodified lines1121131141151161171181191201211221231241 unmodified line1261271281291301311321331341351361371381393 unmodified lines1431441451461471481494 unmodified lines1541551561571581591601611621631641651663 unmodified lines17017117217317417517617717817918018118218315 unmodified lines19920020120220320420520620720820921021121266 unmodified lines27928028128228328428520 unmodified lines3063073083093103113122 unmodified lines3153163173183193203211 unmodified line32332432532632732832960 unmodified lines39039139239339439539613 unmodified lines41041141241341441541619 unmodified linesUses `@wllama/wllama` for browser-based inference. Automatically uses WebGPU when available, falling back to CPU via WebAssembly.**Requirements:**- Any modern browser- ~300MB-2GB free RAM- WebGPU optional (Chrome 113+, Edge 113+) - enables GPU acceleration**How It Works:**1. Checks WebGPU availability via `"gpu" in navigator`2. Downloads model from HuggingFace (GGUF format, cached in the browser's Origin Private File System)3. Loads model with `n_gpu_layers: 99999` if WebGPU is present, else `0` for CPU-only1 unmodified line5. Streams tokens via the OAI-compatible `createChatCompletion` API**Pre-configured Models:**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.Two constraints decide what can join that list, both measured against the shipped wasm build:- **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.- **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.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.`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.**Configuration:**- Settings โ Inference Type: `Browser`- Settings โ Wllama Model: Select from dropdown- Settings โ CPU threads: Relevant only when WebGPU is unavailable**WebGPU Detection:**```typescript// client/modules/webGpu.ts/** Whether the browser supports the WebGPU API. */1 unmodified line```**Limitations:**- First load requires model download (progressive via sharded files)- Limited to smaller models (~4B params max due to browser memory)- CPU mode is 2-5x slower than WebGPU3 unmodified linesUses OpenAI's API or any OpenAI-compatible service.**Setup:**1. Get API key from OpenAI or compatible provider2. Settings โ Inference Type: `OpenAI`3. Settings โ OpenAI API Key: Enter key4. Settings โ OpenAI Model: Select or enter model ID**Supported Providers:**- OpenAI (gpt-4, gpt-3.5-turbo)- Anthropic (via OpenAI-compatible endpoint)- Google (Gemini via OpenAI-compatible endpoint)- Any custom provider with OpenAI-compatible API**Features:**- Streaming responses, built on the Vercel AI SDK (`ai` + `@ai-sdk/openai-compatible`)- Auto model selection (if blank)- 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)- Reasoning content support: reasoning/thinking output is wrapped between configurable `reasoningStartMarker`/`reasoningEndMarker` settings (default `<think>` / `</think>`)**Configuration:**```typescript{inferenceType: 'openai',4 unmodified lines```**Privacy Considerations:**- Search queries and results sent to OpenAI- Not suitable for sensitive data- Consider internal API for private data3 unmodified linesUses aihorde.net, a distributed volunteer GPU network.**Setup:**1. Settings โ Inference Type: `AI Horde`2. (Optional) Settings โ AI Horde API Key: Get from aihorde.net3. Settings โ AI Horde Model: Select preferred model**How It Works:**1. Request sent to AI Horde API2. Distributed to volunteer workers3. Multiple workers may process in parallel1 unmodified line5. Results streamed back**Features:**- Free to use (anonymous or authenticated)- Kudos-based priority system- Large model selection (70B+ params available)- No API key required (but recommended for priority)**Configuration:**```typescript{inferenceType: 'horde',3 unmodified lines```**Limitations:**- Variable latency (depends on worker availability)- Quality varies by worker- May queue during high demand4 unmodified linesSelf-hosted OpenAI-compatible API for teams and compliance.**Setup:**1. Host an OpenAI-compatible API (e.g., vLLM, llama.cpp server, Ollama with OpenAI compat)2. Configure environment variables (see `docs/configuration.md`)3. Settings โ Inference Type: `Internal`**Environment Variables:**```bashINTERNAL_OPENAI_COMPATIBLE_API_BASE_URL="https://llm.company.com/v1"INTERNAL_OPENAI_COMPATIBLE_API_KEY="sk-internal-xxx"3 unmodified lines**Server-Side Proxy:**The internal API uses a server-side proxy to:- Hide API keys from client- Add request logging/auditing- Apply rate limiting- Enable token-based authentication**Endpoint:**```POST /inference?token=<argon2-hashed-search-token>Content-Type: application/json15 unmodified linesthe `/status` section of `docs/overview.md` for the field reference.**Features:**- Private data stays in your infrastructure- Custom model selection- Server-side logging- Compatible with any OpenAI-compatible API**Recommended Self-Hosted Options:**- **vLLM**: High-performance, production-ready- **llama.cpp server**: Single binary, easy setup- **Ollama**: Simple, Docker-friendly66 unmodified lines### Response ThrottlingTwo PubSub update functions are throttled to 12 updates per second to ensure UI performance during high-frequency streaming:- `updateResponse` → `responsePubSub`- `updateReasoningContent` → `reasoningContentPubSub`20 unmodified lines- **Available for Context:** 75% (~3072 tokens)**Allocation Priority:**1. System prompt (with search results)2. Conversation summary (if exists)3. Recent chat messages (newest first)2 unmodified lines### Rolling SummariesWhen conversation exceeds token budget:1. **Detect Overflow:** Current tokens > 30722. **Generate Summary:** Call LLM with 800-token limit3. **Store Summary:** Save in conversationSummaryPubSub1 unmodified line5. **Continue:** Use summary + remaining messages for context**Summary Prompt:**```Summarize this conversation in 3-5 sentences, preserving key factsand user intent. Be concise but informative.60 unmodified lines### State RecoveryIf generation fails mid-stream:1. Set `textGenerationState` to `failed`2. Preserve partial response in `responsePubSub`3. Allow user to retry or modify query13 unmodified lines### Progressive Model LoadingWllama models are sharded (split into chunks):1. Download metadata first (small, fast)2. Download required shards progressively3. Start inference when first shards available
391 unmodified lines392393394395396397391 unmodified lines"accessKeysEnabled": false,"accessKeyTimeoutHours": 0,"wllamaDefaultModelId": "...","internalApiEnabled": false,"internalApiName": "...","defaultInferenceType": "...",391 unmodified lines392393394395396397398391 unmodified lines"accessKeysEnabled": false,"accessKeyTimeoutHours": 0,"wllamaDefaultModelId": "...","wllamaDefaultGpuModelId": "...","internalApiEnabled": false,"internalApiName": "...","defaultInferenceType": "...",
2 unmodified lines3456782 unmodified lines## Tech StackReact 19 + TypeScript + Mantine UI v9 (`@mantine/core`, `@mantine/hooks`, `@mantine/form`, `@mantine/notifications`, `@mantine/code-highlight`, `@mantine/carousel`)- **Build Tool**: Vite 8- **Linting/Formatting**: Biome 2- **Testing**: Vitest 5 + Testing Library2 unmodified lines34567892 unmodified lines## Tech StackReact 19 + TypeScript + Mantine UI v9 (`@mantine/core`, `@mantine/hooks`, `@mantine/form`, `@mantine/notifications`, `@mantine/code-highlight`, `@mantine/carousel`)- **Build Tool**: Vite 8- **Linting/Formatting**: Biome 2- **Testing**: Vitest 5 + Testing Library
11 unmodified lines1213141516173 unmodified lines21222324252627282925 unmodified lines55565758596042 unmodified lines10310410510610710833 unmodified lines1421431441451461471484 unmodified lines15315415515615715815916016116216316416516616716816914 unmodified lines1841851861871881891901911921931941951961971984 unmodified lines20320420520620720844 unmodified lines25325425525625725891 unmodified lines35035135235335435532 unmodified lines38838939039139239310 unmodified lines40440540640740840941 unmodified lines45145245345445545611 unmodified lines| `ACCESS_KEY_TIMEOUT_HOURS` | `24` | Hours to cache validated keys in browser. Set to `0` to require validation on every request |**Example:**```bashACCESS_KEYS="my-secret-key-1,my-secret-key-2"ACCESS_KEY_TIMEOUT_HOURS="24"3 unmodified linesConfigure default models for different inference types:| Variable | Default | Description || ------------------------- | ----------------- | ---------------------------------------------------------------------------- || `WLLAMA_DEFAULT_MODEL_ID` | `littlelamb-290m` | Default Wllama model ID (used for both WebGPU-accelerated and CPU inference) |### Server Model Request Configuration25 unmodified lines| `INTERNAL_OPENAI_COMPATIBLE_API_NAME` | `Internal API` | Display name shown in UI |**Example:**```bashINTERNAL_OPENAI_COMPATIBLE_API_BASE_URL="https://llm.internal.company.com/v1"INTERNAL_OPENAI_COMPATIBLE_API_KEY="sk-internal-xxx"42 unmodified lines`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`.Each provider has its own terms, and each operator is responsible for following them:- **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)).- **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)).33 unmodified lines| `inferenceType` | enum | `'browser'` | AI provider: `browser`, `openai`, `horde`, `internal` || `cpuThreads` | number | (auto) | Number of CPU threads for inference (Wllama), defaults to half the logical processors (`navigator.hardwareConcurrency / 2`), minimum 1 || `allowAiModelDownload` | boolean | `false` | Allow automatic AI model downloads || `wllamaModelId` | string | `WLLAMA_DEFAULT_MODEL_ID` env var | Default Wllama model ID || `hordeApiKey` | string | `'0000000000'` | AI Horde API key (default is anonymous) || `hordeModel` | string | `''` | Specific AI Horde model to request || `openAiApiBaseUrl` | string | `''` | Base URL for the OpenAI-compatible API |4 unmodified lines### Model Selection**Wllama Models:**- 39 pre-configured models- Range from 135M to 4B parameters- 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)- Stored at: `Felladrin/gguf-sharded-*` on HuggingFace, always as sharded GGUFs**OpenAI/Internal:**- Any OpenAI-compatible API- Auto-model detection if not specified- Supports streaming and reasoning models**AI Horde:**- Uses aihorde.net distributed network- Anonymous or authenticated access- Parallel generation with race conditions14 unmodified lines```typescript{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.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).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.Today's date is {{currentDate}}. Use it to resolve relative date references in both the question and the results.You are allowed to use these Markdown elements: anchor, bold, italic, code, quote, table.Search results:4 unmodified lines```**Placeholders:**- `{{currentDate}}`: Current date injected at generation time- `{{dateTime}}`: Alias for `{{currentDate}}` - both are replaced with the same current date value- `{{searchResults}}`: Formatted search results from the web search, including the page excerpts when `enablePageContentFetch` is on44 unmodified lines### Dockerfile EnvironmentThe Dockerfile sets up a single runtime stage:- Node.js LTS- Python 3 + SearXNG91 unmodified lines```Two things about that command are required, not optional:- **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.- **`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.32 unmodified lines"accessKeysEnabled": true,"accessKeyTimeoutHours": 24,"wllamaDefaultModelId": "littlelamb-290m","internalApiEnabled": true,"internalApiName": "Internal API","defaultInferenceType": "browser",10 unmodified lines| `ACCESS_KEYS` | Runtime | Read from `/api/config` || `ACCESS_KEY_TIMEOUT_HOURS` | Runtime | Read from `/api/config` || `WLLAMA_DEFAULT_MODEL_ID` | Runtime | Read from `/api/config` || `INTERNAL_OPENAI_COMPATIBLE_API_*` | Runtime | Read from `/api/config` (except `API_KEY` which is server-only) || `DEFAULT_INFERENCE_TYPE` | Runtime | Read from `/api/config` || Search token | Runtime | Read from `/api/config`, so a reload picks up the token of whichever server answers |41 unmodified lines**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.Check effective configuration:```typescript// In browser consoleconsole.log("Settings:", JSON.parse(localStorage.getItem("settings") || "{}"));11 unmodified lines121314151617183 unmodified lines22232425262728293031323325 unmodified lines5960616263646542 unmodified lines10810911011111211311433 unmodified lines1481491501511521531544 unmodified lines15916016116216316416516616716816917017117217317417517617714 unmodified lines1921931941951961971981992002012022032042052064 unmodified lines21121221321421521621744 unmodified lines26226326426526626726891 unmodified lines36036136236336436536632 unmodified lines39940040140240340440510 unmodified lines41641741841942042142241 unmodified lines46446546646746846947011 unmodified lines| `ACCESS_KEY_TIMEOUT_HOURS` | `24` | Hours to cache validated keys in browser. Set to `0` to require validation on every request |**Example:**```bashACCESS_KEYS="my-secret-key-1,my-secret-key-2"ACCESS_KEY_TIMEOUT_HOURS="24"3 unmodified linesConfigure default models for different inference types:| Variable | Default | Description || ----------------------------- | ----------------- | --------------------------------------------------------------------------------------------- || `WLLAMA_DEFAULT_MODEL_ID` | `littlelamb-290m` | Default Wllama model ID for browsers without WebGPU, where the model runs on the CPU || `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 |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`).### Server Model Request Configuration25 unmodified lines| `INTERNAL_OPENAI_COMPATIBLE_API_NAME` | `Internal API` | Display name shown in UI |**Example:**```bashINTERNAL_OPENAI_COMPATIBLE_API_BASE_URL="https://llm.internal.company.com/v1"INTERNAL_OPENAI_COMPATIBLE_API_KEY="sk-internal-xxx"42 unmodified lines`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`.Each provider has its own terms, and each operator is responsible for following them:- **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)).- **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)).33 unmodified lines| `inferenceType` | enum | `'browser'` | AI provider: `browser`, `openai`, `horde`, `internal` || `cpuThreads` | number | (auto) | Number of CPU threads for inference (Wllama), defaults to half the logical processors (`navigator.hardwareConcurrency / 2`), minimum 1 || `allowAiModelDownload` | boolean | `false` | Allow automatic AI model downloads || `wllamaModelId` | string | WebGPU or CPU default, see above. | Default Wllama model ID, chosen by whether the browser has WebGPU || `hordeApiKey` | string | `'0000000000'` | AI Horde API key (default is anonymous) || `hordeModel` | string | `''` | Specific AI Horde model to request || `openAiApiBaseUrl` | string | `''` | Base URL for the OpenAI-compatible API |4 unmodified lines### Model Selection**Wllama Models:**- Several pre-configured models, listed in `client/modules/wllama.ts`- 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)- Stored at: `Felladrin/gguf-sharded-*` on HuggingFace, always as sharded GGUFs**OpenAI/Internal:**- Any OpenAI-compatible API- Auto-model detection if not specified- Supports streaming and reasoning models**AI Horde:**- Uses aihorde.net distributed network- Anonymous or authenticated access- Parallel generation with race conditions14 unmodified lines```typescript{systemPrompt: `Answer the question using the search results below. Reply in the same language as the question.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).If you answer from your own knowledge because the results do not cover it, say so.Use only these Markdown elements: link, bold, italic, code, quote, table.Today's date is {{currentDate}}. Use it for relative dates such as "yesterday".Search results:4 unmodified lines```**Placeholders:**- `{{currentDate}}`: Current date injected at generation time- `{{dateTime}}`: Alias for `{{currentDate}}` - both are replaced with the same current date value- `{{searchResults}}`: Formatted search results from the web search, including the page excerpts when `enablePageContentFetch` is on44 unmodified lines### Dockerfile EnvironmentThe Dockerfile sets up a single runtime stage:- Node.js LTS- Python 3 + SearXNG91 unmodified lines```Two things about that command are required, not optional:- **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.- **`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.32 unmodified lines"accessKeysEnabled": true,"accessKeyTimeoutHours": 24,"wllamaDefaultModelId": "littlelamb-290m","wllamaDefaultGpuModelId": "gemma-3-4b","internalApiEnabled": true,"internalApiName": "Internal API","defaultInferenceType": "browser",10 unmodified lines| `ACCESS_KEYS` | Runtime | Read from `/api/config` || `ACCESS_KEY_TIMEOUT_HOURS` | Runtime | Read from `/api/config` || `WLLAMA_DEFAULT_MODEL_ID` | Runtime | Read from `/api/config` || `WLLAMA_DEFAULT_GPU_MODEL_ID` | Runtime | Read from `/api/config` || `INTERNAL_OPENAI_COMPATIBLE_API_*` | Runtime | Read from `/api/config` (except `API_KEY` which is server-only) || `DEFAULT_INFERENCE_TYPE` | Runtime | Read from `/api/config` || Search token | Runtime | Read from `/api/config`, so a reload picks up the token of whichever server answers |41 unmodified lines**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.Check effective configuration:```typescript// In browser consoleconsole.log("Settings:", JSON.parse(localStorage.getItem("settings") || "{}"));
28 unmodified lines29303132333428 unmodified lines## Technology Selection CriteriaTechnologies are chosen based on:- **Agent legibility**: Easy for agents to model and reason about- **Stability**: Mature, well-documented libraries- **Composability**: Clean APIs that work well together28 unmodified lines2930313233343528 unmodified lines## Technology Selection CriteriaTechnologies are chosen based on:- **Agent legibility**: Easy for agents to model and reason about- **Stability**: Mature, well-documented libraries- **Composability**: Clean APIs that work well together
25 unmodified lines2627282930313233343536373813 unmodified lines52535455565720 unmodified lines78798081828325 unmodified lines`eval/` is an offline eval that gives a regression signal for changes to thereranker, the system prompt, the search-results formatting, or the model. See`eval/README.md` for details and the LLM-judge environment variables.- **`npm run eval`**: Run the full eval (retrieval + answer)- **`npm run eval:retrieval`**: Retrieval eval (real ONNX reranker; local only, needs the model in `server/models/`)- **`npm run eval:answer`**: Answer eval (LLM judge; gated on `EVAL_LLM_API_KEY`, skips without one)### Coverage Reports for AI AnalysisAfter running `test:coverage`, AI agents can analyze these JSON files:- **`coverage/coverage-summary.json`**: Quick metrics view - overall percentages per file```json13 unmodified lines- Maps statement/branch/function IDs to source locationsAI agents can parse these to identify:- Files with coverage below thresholds- Uncovered lines and branches- Functions without tests20 unmodified lines### Reusable Workflow (`reusable-check-docker.yml`)Used by both `on-push-to-main` and `on-pull-request-to-main` to run the production container smoke test: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### Docker Image Builds25 unmodified lines262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717213 unmodified lines8687888990919220 unmodified lines11311411511611711811925 unmodified lines`eval/` is an offline eval that gives a regression signal for changes to thereranker, the system prompt, the search-results formatting, or the model. See`eval/README.md` for details and the LLM-judge environment variables.- **`npm run eval`**: Run the full eval (retrieval + answer)- **`npm run eval:retrieval`**: Retrieval eval (real ONNX reranker; local only, needs the model in `server/models/`)- **`npm run eval:answer`**: Answer eval (LLM judge; gated on `EVAL_LLM_API_KEY`, skips without one)## wllama benchmark`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).```bashnpm run bench:wllama -- --model qwen-3.5-0.8b --model granite-4.2-3b --device webgpunpm run bench:wllama -- --model owner/repo/Model-Q4_K_M-00001-of-00003.gguf --template-kwargs '{"enable_thinking":false}'```| Option | Default | Meaning || ---------------------- | -------------------- | -------------------------------------------------------------------------------------- || `--model` (repeatable) | required | A catalog id, or `owner/repo/file.gguf` on Hugging Face for a model not in the catalog || `--device` | `both` | `webgpu`, `cpu` (`n_gpu_layers: 0`, what MiniSearch does without WebGPU), or `both` || `--runs` | `1` | Repetitions per model and device || `--threads` | `cpuThreads` setting | CPU threads || `--template-kwargs` | catalog value | JSON for `chat_template_kwargs`; replaces the catalog's || `--reasoning-budget` | catalog value | `reasoning_budget_tokens`, applied at load time as the app does || `--chrome` | Playwright Chromium | Path to another Chromium binary || `--json` | none | Writes every result, including the full reasoning and answer, to this file || `--cases` | `cases.json` | Another question set with the same shape || `--case-timeout` | `300` | Seconds before an answer is cut off; the scorer counts the cut as a violation || `--profile` | see below | Browser profile directory; two runs at once need two, since Chromium locks one in use || `--system-prompt` | none | A file with another system prompt, to measure a change to it before shipping it || `--verbose` | off | Streams the page console, llama.cpp's log included |Things to know:- 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`).- 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.- 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.- On a failure the script prints the page's last console lines; llama.cpp's reason for an abort is usually among them.### Coverage Reports for AI AnalysisAfter running `test:coverage`, AI agents can analyze these JSON files:- **`coverage/coverage-summary.json`**: Quick metrics view - overall percentages per file```json13 unmodified lines- Maps statement/branch/function IDs to source locationsAI agents can parse these to identify:- Files with coverage below thresholds- Uncovered lines and branches- Functions without tests20 unmodified lines### Reusable Workflow (`reusable-check-docker.yml`)Used by both `on-push-to-main` and `on-pull-request-to-main` to run the production container smoke test: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### Docker Image Builds
6 unmodified lines78910111212 unmodified lines2526272829302 unmodified lines3334353637382 unmodified lines4142434445462 unmodified lines4950515253541 unmodified line56575859606111 unmodified lines7374757677786 unmodified lines### Search Token & HashA security mechanism used to authorize communication between the client and the internal search/AI endpoints.- **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.- **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.- **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>`.12 unmodified lines### PubSub (State Management)Instead of a heavy state management library like Redux, MiniSearch uses a minimalist Publish-Subscribe pattern powered by the `create-pubsub` library.- **Data Flow**: Components subscribe to "channels" (e.g., `queryPubSub`, `responsePubSub`)- **Tuple Pattern**: Each channel is a 3-element tuple: `[update, subscribe, get]`- **Persistence**: Some channels use `createLocalStoragePubSub` to automatically sync state with `localStorage`2 unmodified lines### RerankerA 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.- **Implementation**: Loads the model's ONNX export with `onnxruntime-node`; no child process- **Health Check**: Polls `/health` endpoint via `getRerankerStatus`- **Scoring**: Results filtered using standard deviation thresholds (`kStandardDeviationFactor = 0.3`)2 unmodified lines### WllamaA WebAssembly (WASM) based integration of `llama.cpp` for running LLMs on the CPU in the browser.- **Initialization**: Loads models from HuggingFace using `initializeWllama`- **Warmup**: Includes a warmup phase with a single token completion using `n_threads: 1`- **OPFS**: Uses the Origin Private File System via Wllama's cache manager to store model shards locally2 unmodified lines### AI HordeA crowdsourced distributed cluster of workers providing AI inference. MiniSearch integrates with it using a polling strategy against the `/generate/text/status` endpoint.- **Kudos**: Virtual currency used by the Horde. Default anonymous key is `0000000000`- **Polling**: Requests sent to async API, status checked periodically until completion- **Cancellation**: Can abort generation via `DELETE` on the status endpoint1 unmodified line### Conversation Memory & Rolling SummaryA mechanism to handle long chats that exceed the LLM context window.- **Summarization**: When older messages are dropped, `createLlmSummary` asks the LLM to condense them under a limit of 800 tokens- **Extractive Fallback**: If LLM summarization fails, `summarizeDroppedMessages` uses a token-counting extractive approach- **Token Budget**: Computed based on `openAiContextLength` setting and current message count11 unmodified lines### DexieA minimalist wrapper for IndexedDB used for client-side persistence. MiniSearch uses two Dexie databases:- **SearchCacheDatabase**: Temporary cache with TTL-based expiration- **HistoryDatabase**: Long-term search history with retention policies6 unmodified lines7891011121312 unmodified lines262728293031322 unmodified lines353637383940412 unmodified lines444546474849502 unmodified lines535455565758591 unmodified line6162636465666711 unmodified lines798081828384856 unmodified lines### Search Token & HashA security mechanism used to authorize communication between the client and the internal search/AI endpoints.- **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.- **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.- **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>`.12 unmodified lines### PubSub (State Management)Instead of a heavy state management library like Redux, MiniSearch uses a minimalist Publish-Subscribe pattern powered by the `create-pubsub` library.- **Data Flow**: Components subscribe to "channels" (e.g., `queryPubSub`, `responsePubSub`)- **Tuple Pattern**: Each channel is a 3-element tuple: `[update, subscribe, get]`- **Persistence**: Some channels use `createLocalStoragePubSub` to automatically sync state with `localStorage`2 unmodified lines### RerankerA 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.- **Implementation**: Loads the model's ONNX export with `onnxruntime-node`; no child process- **Health Check**: Polls `/health` endpoint via `getRerankerStatus`- **Scoring**: Results filtered using standard deviation thresholds (`kStandardDeviationFactor = 0.3`)2 unmodified lines### WllamaA WebAssembly (WASM) based integration of `llama.cpp` for running LLMs on the CPU in the browser.- **Initialization**: Loads models from HuggingFace using `initializeWllama`- **Warmup**: Includes a warmup phase with a single token completion using `n_threads: 1`- **OPFS**: Uses the Origin Private File System via Wllama's cache manager to store model shards locally2 unmodified lines### AI HordeA crowdsourced distributed cluster of workers providing AI inference. MiniSearch integrates with it using a polling strategy against the `/generate/text/status` endpoint.- **Kudos**: Virtual currency used by the Horde. Default anonymous key is `0000000000`- **Polling**: Requests sent to async API, status checked periodically until completion- **Cancellation**: Can abort generation via `DELETE` on the status endpoint1 unmodified line### Conversation Memory & Rolling SummaryA mechanism to handle long chats that exceed the LLM context window.- **Summarization**: When older messages are dropped, `createLlmSummary` asks the LLM to condense them under a limit of 800 tokens- **Extractive Fallback**: If LLM summarization fails, `summarizeDroppedMessages` uses a token-counting extractive approach- **Token Budget**: Computed based on `openAiContextLength` setting and current message count11 unmodified lines### DexieA minimalist wrapper for IndexedDB used for client-side persistence. MiniSearch uses two Dexie databases:- **SearchCacheDatabase**: Temporary cache with TTL-based expiration- **HistoryDatabase**: Long-term search history with retention policies
32 unmodified lines3334353637383 unmodified lines4243444546479 unmodified lines57585960616249 unmodified lines1121131141151161175 unmodified lines12312412512612712811 unmodified lines1401411421431441455 unmodified lines15115215315415515649 unmodified lines206207208209210211225 unmodified lines43743843944044144221 unmodified lines46446546646746846932 unmodified lines## Application Entry PointsThe application has three primary entry points:1. **Browser Entry**: `client/index.tsx` initializes the React application, mounting the root component and setting up error boundaries.2. **Server Entry**: `vite.config.ts` configures the Vite development and preview servers, registering server hooks for search and inference endpoints.3 unmodified lines## Multi-Service Container ArchitectureThe Docker container runs three services concurrently:- **SearXNG** - Privacy-focused metasearch engine- **ONNX Runtime** - In-process inference for result reranking- **Node.js application** - Main application server9 unmodified lines## Data Persistence StrategyMiniSearch employs a dual-layer persistence approach:- **IndexedDB** - Local storage for search history, settings, cached results, and saved AI transcripts- **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 fails49 unmodified lines### Web Search Service Reliability`server/webSearchService.ts` implements resilience patterns for SearXNG integration:- **Circuit Breaker**: Opens after 5 consecutive failures, blocking requests for 60 seconds before attempting reset- **Retry Logic**: Exponential backoff for HTTP 500 errors, up to 3 retries- **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.5 unmodified lines### Search Token LifecycleCSRF protection uses a token the server owns for its lifetime: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 truth2. **Storage**: The token is held in memory for the life of the process, and recorded at `{os.tempdir()}/minisearch-token` with `0600` permissions3. **Distribution**: Server serves the token to the client at runtime through `/api/config`, so a client always holds the token of the server answering it11 unmodified lines### State Machine Transitions**Text Generation States:**- `idle` - No active generation- `awaitingModelDownloadAllowance` - Waiting for user consent to download a browser model- `loadingModel` - Downloading or initializing the browser (Wllama) model5 unmodified lines- `failed` - Error occurred**Search States:**- `idle` - No active search- `running` - Search in progress- `completed` - Results received49 unmodified lines| `rerankerServiceHook` | `server/rerankerServiceHook.ts` | Reranker model lifecycle management for result reranking |Key server-side modules:- **`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).- **`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.- **`server/searchToken.ts`**: Manages a token at `{os.tempdir()}/minisearch-token` used for CSRF protection on search requests.225 unmodified lines### IndexedDB DatabasesTwo separate Dexie databases handle different persistence needs:1. **SearchCacheDatabase** (`client/modules/search.ts`): Temporary cache for search results with TTL-based expiration. Table schema:- `textSearchHistory`: Keyed by hashed query, indexed by timestamp- `imageSearchHistory`: Keyed by hashed query, indexed by timestamp21 unmodified lines### localStorage PersistenceLightweight state persisted across sessions via `createLocalStoragePubSub` pattern:- `settings`: Application preferences (inference type, model, UI options)- `querySuggestions`: Shuffled search suggestion pool- `lastSearchTokenHash`: Cached security token hash32 unmodified lines333435363738393 unmodified lines434445464748499 unmodified lines5960616263646549 unmodified lines1151161171181191201215 unmodified lines12712812913013113213311 unmodified lines1451461471481491501515 unmodified lines15715815916016116216349 unmodified lines213214215216217218219225 unmodified lines44544644744844945045121 unmodified lines47347447547647747847932 unmodified lines## Application Entry PointsThe application has three primary entry points:1. **Browser Entry**: `client/index.tsx` initializes the React application, mounting the root component and setting up error boundaries.2. **Server Entry**: `vite.config.ts` configures the Vite development and preview servers, registering server hooks for search and inference endpoints.3 unmodified lines## Multi-Service Container ArchitectureThe Docker container runs three services concurrently:- **SearXNG** - Privacy-focused metasearch engine- **ONNX Runtime** - In-process inference for result reranking- **Node.js application** - Main application server9 unmodified lines## Data Persistence StrategyMiniSearch employs a dual-layer persistence approach:- **IndexedDB** - Local storage for search history, settings, cached results, and saved AI transcripts- **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 fails49 unmodified lines### Web Search Service Reliability`server/webSearchService.ts` implements resilience patterns for SearXNG integration:- **Circuit Breaker**: Opens after 5 consecutive failures, blocking requests for 60 seconds before attempting reset- **Retry Logic**: Exponential backoff for HTTP 500 errors, up to 3 retries- **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.5 unmodified lines### Search Token LifecycleCSRF protection uses a token the server owns for its lifetime: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 truth2. **Storage**: The token is held in memory for the life of the process, and recorded at `{os.tempdir()}/minisearch-token` with `0600` permissions3. **Distribution**: Server serves the token to the client at runtime through `/api/config`, so a client always holds the token of the server answering it11 unmodified lines### State Machine Transitions**Text Generation States:**- `idle` - No active generation- `awaitingModelDownloadAllowance` - Waiting for user consent to download a browser model- `loadingModel` - Downloading or initializing the browser (Wllama) model5 unmodified lines- `failed` - Error occurred**Search States:**- `idle` - No active search- `running` - Search in progress- `completed` - Results received49 unmodified lines| `rerankerServiceHook` | `server/rerankerServiceHook.ts` | Reranker model lifecycle management for result reranking |Key server-side modules:- **`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).- **`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.- **`server/searchToken.ts`**: Manages a token at `{os.tempdir()}/minisearch-token` used for CSRF protection on search requests.225 unmodified lines### IndexedDB DatabasesTwo separate Dexie databases handle different persistence needs:1. **SearchCacheDatabase** (`client/modules/search.ts`): Temporary cache for search results with TTL-based expiration. Table schema:- `textSearchHistory`: Keyed by hashed query, indexed by timestamp- `imageSearchHistory`: Keyed by hashed query, indexed by timestamp21 unmodified lines### localStorage PersistenceLightweight state persisted across sessions via `createLocalStoragePubSub` pattern:- `settings`: Application preferences (inference type, model, UI options)- `querySuggestions`: Shuffled search suggestion pool- `lastSearchTokenHash`: Cached security token hash
23 unmodified lines24252627282923 unmodified lines## Component OrganizationComponents are organized by feature domain. Each component folder contains:- Component implementation- Related styles- Custom hooks23 unmodified lines2425262728293023 unmodified lines## Component OrganizationComponents are organized by feature domain. Each component folder contains:- Component implementation- Related styles- Custom hooks
20 unmodified lines21222324252627282930318 unmodified lines4041424344454647484950518 unmodified lines6061626364653 unmodified lines69707172737420 unmodified lines## Quality GatesBefore any change, run this command in the development container:```bashdocker compose exec development-server npm run lint```This comprehensive check includes:- **Biome**: Code formatting and linting- **TypeScript**: Type checking with strict mode- **knip**: Dead code detection8 unmodified linesThe 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.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:- anything under `client/`, `server/`, or `shared/`- `Dockerfile`, `docker-compose.yml`, `docker-compose.production.yml`, `searxng-settings.yml`Add your entry to `changelog.md` under a `## YYYY-MM-DD` heading for today's date in UTC, most recent date first.Two ways out:- 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.- Renovate and Dependabot PRs pass automatically. Renovate bumps the pinned SearXNG commit in the `Dockerfile` and cannot write an entry.8 unmodified lines## Merge PhilosophyIn high-throughput agent environments:- Minimize blocking merge gates- Keep PRs short-lived- Corrections are cheap, waiting is expensive3 unmodified lines## Commit Message FormatUse conventional commits:- `feat:` for new features- `fix:` for bug fixes- `docs:` for documentation changes20 unmodified lines212223242526272829303132338 unmodified lines42434445464748495051525354558 unmodified lines646566676869703 unmodified lines7475767778798020 unmodified lines## Quality GatesBefore any change, run this command in the development container:```bashdocker compose exec development-server npm run lint```This comprehensive check includes:- **Biome**: Code formatting and linting- **TypeScript**: Type checking with strict mode- **knip**: Dead code detection8 unmodified linesThe 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.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:- anything under `client/`, `server/`, or `shared/`- `Dockerfile`, `docker-compose.yml`, `docker-compose.production.yml`, `searxng-settings.yml`Add your entry to `changelog.md` under a `## YYYY-MM-DD` heading for today's date in UTC, most recent date first.Two ways out:- 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.- Renovate and Dependabot PRs pass automatically. Renovate bumps the pinned SearXNG commit in the `Dockerfile` and cannot write an entry.8 unmodified lines## Merge PhilosophyIn high-throughput agent environments:- Minimize blocking merge gates- Keep PRs short-lived- Corrections are cheap, waiting is expensive3 unmodified lines## Commit Message FormatUse conventional commits:- `feat:` for new features- `fix:` for bug fixes- `docs:` for documentation changes
22 unmodified lines23242526272810 unmodified lines3940414243441 unmodified line46474849505187 unmodified lines1391401411421431441 unmodified line1461471481491501517 unmodified lines15916016116216316422 unmodified linesAccess the application at `http://localhost:7860` (main). During development, HMR is available on `http://localhost:7861` for instant code changes.The development server includes:- Hot Module Replacement (HMR) on port 7861 for instant code changes- Full dev tools and source maps- Live code watching with volume mounts10 unmodified linesAccess at `http://localhost:7860`Production mode:- Pre-built optimized assets- No dev tools or HMR- Optimized Docker layer caching1 unmodified line## Container InternalsThe Docker container runs three services concurrently:- **SearXNG** - Privacy-focused metasearch engine (starts in background)- **ONNX Runtime** - In-process inference for result reranking- **Node.js (Vite)** - Main application server87 unmodified lines### Issue: Search returns no results**Solution**: Verify SearXNG is running. Check container logs:```bashdocker compose logs searxng```1 unmodified line### Issue: AI response never loads**Solution**: Check browser console for errors. Common causes:- WebGPU not supported (app will automatically fall back to Wllama)- Model download blocked by firewall or CORS- Insufficient disk space for model caching7 unmodified lines### Issue: Port already in use**Solution**: Change ports in `docker-compose.yml`:```yamlports:- "7862:7861" # Use 7862 instead of 7860 (HMR port)22 unmodified lines2324252627282910 unmodified lines404142434445461 unmodified line4849505152535487 unmodified lines1421431441451461471481 unmodified line1501511521531541551567 unmodified lines16416516616716816917022 unmodified linesAccess the application at `http://localhost:7860` (main). During development, HMR is available on `http://localhost:7861` for instant code changes.The development server includes:- Hot Module Replacement (HMR) on port 7861 for instant code changes- Full dev tools and source maps- Live code watching with volume mounts10 unmodified linesAccess at `http://localhost:7860`Production mode:- Pre-built optimized assets- No dev tools or HMR- Optimized Docker layer caching1 unmodified line## Container InternalsThe Docker container runs three services concurrently:- **SearXNG** - Privacy-focused metasearch engine (starts in background)- **ONNX Runtime** - In-process inference for result reranking- **Node.js (Vite)** - Main application server87 unmodified lines### Issue: Search returns no results**Solution**: Verify SearXNG is running. Check container logs:```bashdocker compose logs searxng```1 unmodified line### Issue: AI response never loads**Solution**: Check browser console for errors. Common causes:- WebGPU not supported (app will automatically fall back to Wllama)- Model download blocked by firewall or CORS- Insufficient disk space for model caching7 unmodified lines### Issue: Port already in use**Solution**: Change ports in `docker-compose.yml`:```yamlports:- "7862:7861" # Use 7862 instead of 7860 (HMR port)
17 unmodified lines18192021222355 unmodified lines7980818283845 unmodified lines90919293949517 unmodified lines### StartupThe `rerankerServiceHook` starts the reranker during server initialization:1. Downloads the model and tokenizer from HuggingFace if not present (`cross-encoder/mmarco-mMiniLMv2-L12-H384-v1`)2. Creates an ONNX Runtime inference session3. Performs a warmup inference (`query: "test"`, `documents: ["test document"]`) to ensure the graph is initialized55 unmodified lines### Scoring and FilteringThe 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:1. **Score Normalization**: Scores are shifted to positive range by adding the absolute value of the minimum score2. **Standard Deviation Filter**: Results below `mean - kStandardDeviationFactor * standardDeviation` are filtered out- `kStandardDeviationFactor = 0.3`5 unmodified lines### Preserve Top Results ModeWhen `preserveTopResults = true`, the ranking algorithm:1. Keeps the original top result (first from SearXNG) at position 12. Filters remaining results by score3. Takes up to 9 next-best results, sorted by reranker score17 unmodified lines1819202122232455 unmodified lines808182838485865 unmodified lines9293949596979817 unmodified lines### StartupThe `rerankerServiceHook` starts the reranker during server initialization:1. Downloads the model and tokenizer from HuggingFace if not present (`cross-encoder/mmarco-mMiniLMv2-L12-H384-v1`)2. Creates an ONNX Runtime inference session3. Performs a warmup inference (`query: "test"`, `documents: ["test document"]`) to ensure the graph is initialized55 unmodified lines### Scoring and FilteringThe 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:1. **Score Normalization**: Scores are shifted to positive range by adding the absolute value of the minimum score2. **Standard Deviation Filter**: Results below `mean - kStandardDeviationFactor * standardDeviation` are filtered out- `kStandardDeviationFactor = 0.3`5 unmodified lines### Preserve Top Results ModeWhen `preserveTopResults = true`, the ranking algorithm:1. Keeps the original top result (first from SearXNG) at position 12. Filters remaining results by score3. Takes up to 9 next-best results, sorted by reranker score
6 unmodified lines7891011123 unmodified lines1617181920213 unmodified lines25262728293020 unmodified lines5152535455565758596061626 unmodified lines## Data Model and StorageThe `HistoryDatabase` Dexie instance stores three related tables:1. `searches` โ canonical log of each query plus hydrated results payloads (text, image, run metadata, source, pin state).2. `llmResponses` โ snapshot of every AI answer tied to its originating search run, enabling restoration of the assistant output.3. `chatHistory` โ chronological record of chat turns (user/assistant roles) scoped by `conversationId` (the `searchRunId`).3 unmodified lines## Cleanup GuaranteesTo keep IndexedDB lean, inserts trigger `performCleanup()`, which enforces:- **Retention window** โ non-pinned entries older than `historyRetentionDays` are deleted in batches of 100.- **Max entries** โ if the total exceeds `historyMaxEntries`, the oldest unpinned rows past the limit are removed.- **Pin protection** โ pinned entries are skipped by both retention and max-entry sweeps.3 unmodified lines## Hook API`useSearchHistory` exposes the canonical API surface for components:- Fetches recent searches (optionally paginated) and exposes filtered/grouped views.- Provides fuzzy search, pin toggling, delete/clear operations, and error retry helpers.- Keeps derived state such as grouped sections (Today/Yesterday/etc.) in sync with the settings flag `historyGroupByDate`.20 unmodified linesAlongside the history database, MiniSearch uses a separate `SearchCacheDatabase` for temporary result caching:**Schema:**| Store | Key | Index | Entry Type || -------------------- | ------------ | --------- | ------------------ || `textSearchHistory` | hashed query | timestamp | `TextSearchCache` || `imageSearchHistory` | hashed query | timestamp | `ImageSearchCache` |**Configuration:**| Parameter | Value | Description || ------------------- | ---------- | ------------------------------------------------------------------------------------- || TTL | 15 minutes | Freshness window: a hit inside it skips the network |6 unmodified lines789101112133 unmodified lines171819202122233 unmodified lines2728293031323320 unmodified lines54555657585960616263646566676 unmodified lines## Data Model and StorageThe `HistoryDatabase` Dexie instance stores three related tables:1. `searches` โ canonical log of each query plus hydrated results payloads (text, image, run metadata, source, pin state).2. `llmResponses` โ snapshot of every AI answer tied to its originating search run, enabling restoration of the assistant output.3. `chatHistory` โ chronological record of chat turns (user/assistant roles) scoped by `conversationId` (the `searchRunId`).3 unmodified lines## Cleanup GuaranteesTo keep IndexedDB lean, inserts trigger `performCleanup()`, which enforces:- **Retention window** โ non-pinned entries older than `historyRetentionDays` are deleted in batches of 100.- **Max entries** โ if the total exceeds `historyMaxEntries`, the oldest unpinned rows past the limit are removed.- **Pin protection** โ pinned entries are skipped by both retention and max-entry sweeps.3 unmodified lines## Hook API`useSearchHistory` exposes the canonical API surface for components:- Fetches recent searches (optionally paginated) and exposes filtered/grouped views.- Provides fuzzy search, pin toggling, delete/clear operations, and error retry helpers.- Keeps derived state such as grouped sections (Today/Yesterday/etc.) in sync with the settings flag `historyGroupByDate`.20 unmodified linesAlongside the history database, MiniSearch uses a separate `SearchCacheDatabase` for temporary result caching:**Schema:**| Store | Key | Index | Entry Type || -------------------- | ------------ | --------- | ------------------ || `textSearchHistory` | hashed query | timestamp | `TextSearchCache` || `imageSearchHistory` | hashed query | timestamp | `ImageSearchCache` |**Configuration:**| Parameter | Value | Description || ------------------- | ---------- | ------------------------------------------------------------------------------------- || TTL | 15 minutes | Freshness window: a hit inside it skips the network |
31 unmodified lines32333435363727 unmodified lines65666768697031 unmodified lines### Search Token LifecycleEvery HTTP request from client to backend carries a `token` query parameter for CSRF protection: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 layer2. **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 page3. **Per-Request Auth**: Client includes token as `?token=` parameter on all `/search/text`, `/search/images`, `/page-content`, `/thumbnail` and `/inference` requests27 unmodified lines## Supply Chain: Native & WebAssembly ModulesThe full trust model lives in [`.github/SECURITY.md`](../.github/SECURITY.md) ("Native & WebAssembly Module Trust Model"); the operational parts are mirrored here.- **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- **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)- **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`31 unmodified lines3233343536373827 unmodified lines6667686970717231 unmodified lines### Search Token LifecycleEvery HTTP request from client to backend carries a `token` query parameter for CSRF protection: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 layer2. **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 page3. **Per-Request Auth**: Client includes token as `?token=` parameter on all `/search/text`, `/search/images`, `/page-content`, `/thumbnail` and `/inference` requests27 unmodified lines## Supply Chain: Native & WebAssembly ModulesThe full trust model lives in [`.github/SECURITY.md`](../.github/SECURITY.md) ("Native & WebAssembly Module Trust Model"); the operational parts are mirrored here.- **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- **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)- **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`
26 unmodified lines2728293031322 unmodified lines35363738394092 unmodified lines1331341351361371388 unmodified lines1471481491501511522 unmodified lines15515615715815916024 unmodified lines18518618718818919017 unmodified lines20820921021121221321421521617 unmodified lines23423523623723823915 unmodified lines25525625725825926028 unmodified lines2892902912922932942 unmodified lines2972982993003013023033043059 unmodified lines3153163173183193203213223235 unmodified lines32933033133233333433533633733833979 unmodified lines4194204214224234241 unmodified line4264274284294304312 unmodified lines4344354364374384396 unmodified lines4464474484494504518 unmodified lines4604614624634644654664674684694704712 unmodified lines47447547647747847948048148248348448526 unmodified lines```**Benefits:**- **Decoupling** โ Modules (text generation, search, React components) read and write shared state without importing each other directly- **No provider boilerplate** โ Unlike React Context or Redux, no `Provider` wrapper needed; any module imports a channel from `pubSub.ts`- **Selective subscriptions** โ Components subscribe only to channels they use; a streaming token update throttling `responsePubSub` does not trigger re-renders in unrelated components2 unmodified lines### localStorage PersistenceSome state must survive page reloads. The `createLocalStoragePubSub` helper wraps `createPubSub` with two behaviors: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 used2. **Persistence** โ A subscriber is immediately registered on the inner PubSub that calls `localStorage.setItem` with the JSON-serialized new value on every state change92 unmodified lines**Responsibility:** Application shell and routing**Logic:**```typescript// App.tsx// Access key validation is handled via useAccessKeyValidation hook8 unmodified lines**Responsibility:** Query input and search initiation**PubSub:**- **Subscribes:** `queryPubSub`, `textSearchStatePubSub`- **Updates:** `queryPubSub` (on type), triggers `searchAndRespond()` (on submit)2 unmodified lineswhen the row of buttons below the field changes height.**Logic:**```typescriptfunction SearchForm() {const [query, setQuery] = usePubSub(queryPubSub);24 unmodified linesthat appends each transcript without clobbering what the user typed meanwhile.**PubSub:**- **Subscribes:** `settingsPubSub` (`enableDictation`, `enableLocalDictationModel`)**Props:**17 unmodified lines**Responsibility:** Display search results (text and images)**PubSub:**- **Subscribes:** `textSearchResultsPubSub`, `imageSearchResultsPubSub`, `textSearchStatePubSub`**Logic:**```typescriptfunction SearchResultsSection() {const [textResults] = usePubSub(textSearchResultsPubSub);17 unmodified lines**Responsibility:** AI response display and chat interface**PubSub:**- **Subscribes:** `responsePubSub`, `textGenerationStatePubSub`, `chatMessagesPubSub`**State Machine (`textGenerationStatePubSub`):**15 unmodified linesWhen 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.**Logic:**```typescriptfunction AiResponseSection() {const [response] = usePubSub(responsePubSub);28 unmodified lines**Responsibility:** Application settings UI**Sub-components:**- **AISettingsForm:** Model selection, inference type, reasoning markers (sampling parameters such as temperature are hardcoded, not user-configurable)- **SearchSettingsForm:** Result limits, image search toggle- **InterfaceSettingsForm:** UI preferences2 unmodified lines- **ActionsForm:** Data management actions**PubSub:**- **Subscribes/Updates:** `settingsPubSub` (full settings object)**Persistence:**```typescript// client/modules/pubSub.tsexport const settingsPubSub = createLocalStoragePubSub(9 unmodified lines**Responsibility:** Search history display and management**PubSub:**- **Subscribes:** History loaded from IndexedDB (not via PubSub, via custom hook)**Hook:** `useSearchHistory()````typescriptconst {filteredSearches,5 unmodified lines```Restoring a past search (re-running its query) is handled separately by `useHistoryRestore`, used in `SearchForm`:```typescriptconst { restoreSearch } = useHistoryRestore(updateQuery, textAreaRef);```**Features:**- Fuzzy search through history- Date-based grouping (Today, Yesterday, Last Week, etc.)- Pin/unpin searches79 unmodified lines### usePubSubSubscribes to a PubSub channel:```typescriptconst [value, setValue] = usePubSub(channel);```1 unmodified line### useSearchHistoryManages search history from IndexedDB:```typescriptconst { searchHistory, groupedSearches, deleteEntry, togglePin } =useSearchHistory();2 unmodified lines### useDrawerStateManages open/close state for a drawer with log entry tracking:```typescriptconst { isDrawerOpen, openDrawer, closeDrawer } = useDrawerState("User opened the menu",6 unmodified linesHolds the [Screen Wake Lock](https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API)while the flag is true, so a phone left untouched during a long answer does notlock while the text streams in:```typescriptuseScreenWakeLock(statesKeepingTheScreenAwake.includes(textGenerationState));```8 unmodified lines**Framework:** Mantine UI v9**Theme Configuration:**```typescript// client/components/App/App.tsx<MantineProvider defaultColorScheme="dark">```**Dark Mode:**- Default color scheme is dark- All components support dark mode via Mantine2 unmodified lines**Standards:** WCAG 2.1 AA compliance**Features:**- All interactive elements keyboard accessible- ARIA labels on select interactive elements (e.g. chat input, message list, history actions, logs modal)- Focus management in drawers and modals- Screen reader announcements for loading states**Implementation:**```typescript// Using Mantine's accessibility props<Button aria-label="Search the web">26 unmodified lines272829303132332 unmodified lines3637383940414292 unmodified lines1351361371381391401418 unmodified lines1501511521531541551562 unmodified lines15916016116216316416524 unmodified lines19019119219319419519617 unmodified lines21421521621721821922022122222322417 unmodified lines24224324424524624724815 unmodified lines26426526626726826927028 unmodified lines2993003013023033043052 unmodified lines3083093103113123133143153163173189 unmodified lines3283293303313323333343353363373385 unmodified lines34434534634734834935035135235335435535679 unmodified lines4364374384394404414421 unmodified line4444454464474484494502 unmodified lines4534544554564574584596 unmodified lines4664674684694704714728 unmodified lines4814824834844854864874884894904914924934942 unmodified lines49749849950050150250350450550650750850951026 unmodified lines```**Benefits:**- **Decoupling** โ Modules (text generation, search, React components) read and write shared state without importing each other directly- **No provider boilerplate** โ Unlike React Context or Redux, no `Provider` wrapper needed; any module imports a channel from `pubSub.ts`- **Selective subscriptions** โ Components subscribe only to channels they use; a streaming token update throttling `responsePubSub` does not trigger re-renders in unrelated components2 unmodified lines### localStorage PersistenceSome state must survive page reloads. The `createLocalStoragePubSub` helper wraps `createPubSub` with two behaviors: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 used2. **Persistence** โ A subscriber is immediately registered on the inner PubSub that calls `localStorage.setItem` with the JSON-serialized new value on every state change92 unmodified lines**Responsibility:** Application shell and routing**Logic:**```typescript// App.tsx// Access key validation is handled via useAccessKeyValidation hook8 unmodified lines**Responsibility:** Query input and search initiation**PubSub:**- **Subscribes:** `queryPubSub`, `textSearchStatePubSub`- **Updates:** `queryPubSub` (on type), triggers `searchAndRespond()` (on submit)2 unmodified lineswhen the row of buttons below the field changes height.**Logic:**```typescriptfunction SearchForm() {const [query, setQuery] = usePubSub(queryPubSub);24 unmodified linesthat appends each transcript without clobbering what the user typed meanwhile.**PubSub:**- **Subscribes:** `settingsPubSub` (`enableDictation`, `enableLocalDictationModel`)**Props:**17 unmodified lines**Responsibility:** Display search results (text and images)**PubSub:**- **Subscribes:** `textSearchResultsPubSub`, `imageSearchResultsPubSub`, `textSearchStatePubSub`**Logic:**```typescriptfunction SearchResultsSection() {const [textResults] = usePubSub(textSearchResultsPubSub);17 unmodified lines**Responsibility:** AI response display and chat interface**PubSub:**- **Subscribes:** `responsePubSub`, `textGenerationStatePubSub`, `chatMessagesPubSub`**State Machine (`textGenerationStatePubSub`):**15 unmodified linesWhen 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.**Logic:**```typescriptfunction AiResponseSection() {const [response] = usePubSub(responsePubSub);28 unmodified lines**Responsibility:** Application settings UI**Sub-components:**- **AISettingsForm:** Model selection, inference type, reasoning markers (sampling parameters such as temperature are hardcoded, not user-configurable)- **SearchSettingsForm:** Result limits, image search toggle- **InterfaceSettingsForm:** UI preferences2 unmodified lines- **ActionsForm:** Data management actions**PubSub:**- **Subscribes/Updates:** `settingsPubSub` (full settings object)**Persistence:**```typescript// client/modules/pubSub.tsexport const settingsPubSub = createLocalStoragePubSub(9 unmodified lines**Responsibility:** Search history display and management**PubSub:**- **Subscribes:** History loaded from IndexedDB (not via PubSub, via custom hook)**Hook:** `useSearchHistory()````typescriptconst {filteredSearches,5 unmodified lines```Restoring a past search (re-running its query) is handled separately by `useHistoryRestore`, used in `SearchForm`:```typescriptconst { restoreSearch } = useHistoryRestore(updateQuery, textAreaRef);```**Features:**- Fuzzy search through history- Date-based grouping (Today, Yesterday, Last Week, etc.)- Pin/unpin searches79 unmodified lines### usePubSubSubscribes to a PubSub channel:```typescriptconst [value, setValue] = usePubSub(channel);```1 unmodified line### useSearchHistoryManages search history from IndexedDB:```typescriptconst { searchHistory, groupedSearches, deleteEntry, togglePin } =useSearchHistory();2 unmodified lines### useDrawerStateManages open/close state for a drawer with log entry tracking:```typescriptconst { isDrawerOpen, openDrawer, closeDrawer } = useDrawerState("User opened the menu",6 unmodified linesHolds the [Screen Wake Lock](https://developer.mozilla.org/en-US/docs/Web/API/Screen_Wake_Lock_API)while the flag is true, so a phone left untouched during a long answer does notlock while the text streams in:```typescriptuseScreenWakeLock(statesKeepingTheScreenAwake.includes(textGenerationState));```8 unmodified lines**Framework:** Mantine UI v9**Theme Configuration:**```typescript// client/components/App/App.tsx<MantineProvider defaultColorScheme="dark">```**Dark Mode:**- Default color scheme is dark- All components support dark mode via Mantine2 unmodified lines**Standards:** WCAG 2.1 AA compliance**Features:**- All interactive elements keyboard accessible- ARIA labels on select interactive elements (e.g. chat input, message list, history actions, logs modal)- Focus management in drawers and modals- Screen reader announcements for loading states**Implementation:**```typescript// Using Mantine's accessibility props<Button aria-label="Search the web">
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129# Wllama Model Evaluation
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).
## What it measures
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.
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:
- **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).- **Answering in one language from results in another** (`pt-from-en`, `zh-from-en`).- **Combining two results** (`de-synthesis`).- **Picking the right result among similar ones** (`es-distractor`).- **Saying so when the results do not answer** (`pt-not-covered`).- **Citing a result with a link, and never inventing one.**
## How it scores
`scripts/wllama-bench/score.mjs` scores every answer out of 4 points:
| Points | For || ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ || up to 2 | The required facts, split evenly. A wrong fact misleads more than a wrong language, so facts weigh double. || 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. || 1 | Citing at least one of the results with a Markdown link. || โ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. |
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.
### What the score cannot see
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.
## Results
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.
### The whole catalog, eleven core questions
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.
| Rank | Model | Size | Runs | Score | en | pt-from-en | es | fr | de | zh | ja | ko | ar | hi | ru || ---: | ----------------------------------------------------------------------------- | ------: | ---: | ------: | --: | ---------: | --: | --: | --: | --: | --: | --: | --: | --: | --: || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 |
### What the catalog keeps
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.
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.
### GPU default candidates, all fifteen questions
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.
| 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 || ---: | ----------------------- | ------: | ---: | --------: | --: | ---------: | --: | --: | --: | --: | --: | --: | --: | --: | --: | -----------: | ------------: | -------------: | ---------: || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 || 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 |
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.
## Why these languages
The catalog's model families and the common multilingual benchmarks agree on a core:
- 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)).- 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)).- 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)).- 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)).
## Running it
```bashnpm run bench:wllama -- --model littlelamb-290m --model qwen-3-0.6b --device webgpu --runs 2 --json results.jsonnode scripts/wllama-bench/score.mjs scripts/wllama-bench/cases.json results.json```
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`.230 unmodified lines231232233234235236230 unmodified linesaccessKeysEnabled: false,accessKeyTimeoutHours: 24,wllamaDefaultModelId: "littlelamb-290m",internalApiEnabled: false,internalApiName: "Internal API",defaultInferenceType: "openai",230 unmodified lines231232233234235236237230 unmodified linesaccessKeysEnabled: false,accessKeyTimeoutHours: 24,wllamaDefaultModelId: "littlelamb-290m",wllamaDefaultGpuModelId: "gemma-3-4b",internalApiEnabled: false,internalApiName: "Internal API",defaultInferenceType: "openai",
5 unmodified lines678910117 unmodified lines1920212223245 unmodified linesSome of it runs in the default `npm test` suite (and so in CI); the rest is alocal signal:- `metrics.test.ts`, `goldenSet.test.ts`, `promptConstruction.test.ts` run inthe default suite: pure math, golden-set structure, and prompt construction.No model, no API key.7 unmodified lines## The golden set`goldenSet.ts` is a fixed, hand-curated list of queries. Each entry has:- `query`: the search query.- `results`: realistic candidate results (title, snippet, url), mixedrelevant and irrelevant, the way a real search engine returns them.5 unmodified lines67891011127 unmodified lines202122232425265 unmodified linesSome of it runs in the default `npm test` suite (and so in CI); the rest is alocal signal:- `metrics.test.ts`, `goldenSet.test.ts`, `promptConstruction.test.ts` run inthe default suite: pure math, golden-set structure, and prompt construction.No model, no API key.7 unmodified lines## The golden set`goldenSet.ts` is a fixed, hand-curated list of queries. Each entry has:- `query`: the search query.- `results`: realistic candidate results (title, snippet, url), mixedrelevant and irrelevant, the way a real search engine returns them.
7 unmodified lines89101112137 unmodified lines"ignoreFiles": ["client/postcss.config.cjs","vitest.integration.config.ts","scripts/npm-bundle-overlay.cjs"]}7 unmodified lines8910111213147 unmodified lines"ignoreFiles": ["client/postcss.config.cjs","vitest.integration.config.ts","scripts/npm-bundle-overlay.cjs","scripts/wllama-bench/bench.ts"]}
95 unmodified lines969798991001011021031041051061071083 unmodified lines1121131141151161171181191201211221231241252 unmodified lines1281291301311321337 unmodified lines1411421431441451461471481491501511521531541551562 unmodified lines159160161162163164121 unmodified lines2862872882892902912922932947 unmodified lines3023033043053063073083093103113123133143153163173183193203213223238 unmodified lines3323333343353363373383393408 unmodified lines3493503513523533543553563578 unmodified lines3663673683693703713723733748 unmodified lines38338438538638738838939039111 unmodified lines40340440540640740840941041111 unmodified lines42342442542642742842943043111 unmodified lines44344444544644744844945045111 unmodified lines4634644654664674684694704718 unmodified lines480481482483484485486487488333 unmodified lines8228238248258268278288298308318328338341 unmodified line8368378388398408418428438448458468478488498508518528538548558568578588593 unmodified lines8638648658668678688698708718728738748758768775 unmodified lines8838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159161997 unmodified lines2914291529162917291829192920292129222923292429252926292729284 unmodified lines293329342935293629372938293929402 unmodified lines2943294429452946294729482949295029511 unmodified line29532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297914 unmodified lines29942995299629972998299930003001300222 unmodified lines302530263027302830293030303130323033303430353036303730382 unmodified lines3041304230433044304530463672 unmodified lines671967206721672267236724672567266727346 unmodified lines707470757076707770787079708070817082435 unmodified lines751875197520752175227523752475257526752775287529753075317532753375347535753675377538384 unmodified lines7923792479257926792779287929793079317932793379347935793619 unmodified lines79567957795879597960796179627963796479657966796795 unmodified lines"license": "MIT"},"node_modules/@ai-sdk/gateway": {"version": "4.0.133","resolved": "https://registry.npmjs.org/@ai-sdk/gateway/-/gateway-4.0.133.tgz","integrity": "sha512-6DmtrnwvTZG6RFhZscsnUX0XKxA+o2Y/EkZUGWWqFITez/gvOGG/PRKITjwPupUci5vbORThwqkbCj1/066Reg==","license": "Apache-2.0","dependencies": {"@ai-sdk/provider": "4.0.35","@ai-sdk/provider-utils": "5.0.72","@vercel/oidc": "3.2.0"},"engines": {3 unmodified lines"zod": "^3.25.76 || ^4.1.8"}},"node_modules/@ai-sdk/openai-compatible": {"version": "3.0.82","resolved": "https://registry.npmjs.org/@ai-sdk/openai-compatible/-/openai-compatible-3.0.82.tgz","integrity": "sha512-wey0CbujWRkZbbrJjw/GJHyjXpt0v44PQKaTGTVGmigqnM057G7GQHDyZQQj9O0lICY5qJxzpn4wCSftT8BSQg==","license": "Apache-2.0","dependencies": {"@ai-sdk/provider": "4.0.35","@ai-sdk/provider-utils": "5.0.72"},"engines": {"node": ">=22"2 unmodified lines"zod": "^3.25.76 || ^4.1.8"}},"node_modules/@ai-sdk/provider": {"version": "4.0.35","resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.35.tgz",7 unmodified lines}},"node_modules/@ai-sdk/provider-utils": {"version": "5.0.72","resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-5.0.72.tgz","integrity": "sha512-M6QAztI84jWumQSvKcGOL91DxhChsWxn3D3gYtV0/7E1TPQg9BmLdIerOolUC/jghQbMlQrHyzp0hqdIhUZ2Rw==","license": "Apache-2.0","dependencies": {"@ai-sdk/provider": "4.0.35","@standard-schema/spec": "^1.1.0","@workflow/serde": "4.1.0","eventsource-parser": "^3.0.8","undici": "^7.29.0"},"engines": {"node": ">=22"2 unmodified lines"zod": "^3.25.76 || ^4.1.8"}},"node_modules/@ai-sdk/provider-utils/node_modules/undici": {"version": "7.30.1","resolved": "https://registry.npmjs.org/undici/-/undici-7.30.1.tgz",121 unmodified lines}},"node_modules/@biomejs/biome": {"version": "2.6.4","resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.6.4.tgz","integrity": "sha512-8sKKwaNW4ot22awZ3lBjwWLHnUFXgXnrBPYS2gNlBAXRbDC++7kqjK2H7dR/FgCDtPvO1xfKpgEhJkGxAKYkxA==","dev": true,"license": "MIT OR Apache-2.0","bin": {7 unmodified lines"url": "https://opencollective.com/biome"},"optionalDependencies": {"@biomejs/cli-android-arm64": "2.6.4","@biomejs/cli-android-x64": "2.6.4","@biomejs/cli-darwin-arm64": "2.6.4","@biomejs/cli-darwin-x64": "2.6.4","@biomejs/cli-linux-arm64": "2.6.4","@biomejs/cli-linux-arm64-musl": "2.6.4","@biomejs/cli-linux-x64": "2.6.4","@biomejs/cli-linux-x64-musl": "2.6.4","@biomejs/cli-win32-arm64": "2.6.4","@biomejs/cli-win32-x64": "2.6.4"}},"node_modules/@biomejs/cli-android-arm64": {"version": "2.6.4","resolved": "https://registry.npmjs.org/@biomejs/cli-android-arm64/-/cli-android-arm64-2.6.4.tgz","integrity": "sha512-jwrwigP4tBcHxzuV8izioX/BOUhJL/4e2rNSOE5nCjBkVC018LQAQUGiH+CNkFYvLtQ1dcZo5/xXERmaAGc7JQ==","cpu": ["arm64"],8 unmodified lines}},"node_modules/@biomejs/cli-android-x64": {"version": "2.6.4","resolved": "https://registry.npmjs.org/@biomejs/cli-android-x64/-/cli-android-x64-2.6.4.tgz","integrity": "sha512-HdGInPJ4nZFwHxzvEtcp2nmSBtUyJrurmtIK43upFckuS3+ZqVM05HtsxQWnqGsuy/pxckIAjyKWlEKRlBXUyA==","cpu": ["x64"],8 unmodified lines}},"node_modules/@biomejs/cli-darwin-arm64": {"version": "2.6.4","resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.6.4.tgz","integrity": "sha512-0VvcUz46wbg59Q4TZ59KkIjDJrxEyu4Eoe79+F4SChxoWe+W7AEyIp6F5r72C9+p6MsB6dIovnZt1D30lGM3XA==","cpu": ["arm64"],8 unmodified lines}},"node_modules/@biomejs/cli-darwin-x64": {"version": "2.6.4","resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.6.4.tgz","integrity": "sha512-fxmvkF81srlS3DiMyfm+aG3J0eG+6/BjaxRyjy57KbLSafnq0PO+hHfVWmtH2ty0S7nm6yDXBRwySfFeaRJKRQ==","cpu": ["x64"],8 unmodified lines}},"node_modules/@biomejs/cli-linux-arm64": {"version": "2.6.4","resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.6.4.tgz","integrity": "sha512-6+bK1Y/evmIUiJr7auertuMbiaYVicJhqA1bZyL47lCMWugv8l0gFQCqvR/gN1vZMHYm+HwoTKgeMxdNFCoQTg==","cpu": ["arm64"],11 unmodified lines}},"node_modules/@biomejs/cli-linux-arm64-musl": {"version": "2.6.4","resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.6.4.tgz","integrity": "sha512-31ZaH/MHqPX+O+evRwRrCHQ8W5/9adY+/eMytGGWZnRx1T41QsWIF09+/WujynLBhWZUxNGS5CtsWLwgOFTAyg==","cpu": ["arm64"],11 unmodified lines}},"node_modules/@biomejs/cli-linux-x64": {"version": "2.6.4","resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.6.4.tgz","integrity": "sha512-tbFZMdL6dP/ws4edXxYG9WhvaVa1ZDzL4G5DzahnWW7Psib9H+VTdyU4XXVxpJk5j/nYZroSbvSNyYlpW3yCIw==","cpu": ["x64"],11 unmodified lines}},"node_modules/@biomejs/cli-linux-x64-musl": {"version": "2.6.4","resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.6.4.tgz","integrity": "sha512-bomSa2XdQAGGj6Cwdm4M13qE+lN9+AOlW8KtI4hdyVyRRF/Z71qPAi95T4wtdZK0QpBbkTW8hgbZZCwPi4xzIw==","cpu": ["x64"],11 unmodified lines}},"node_modules/@biomejs/cli-win32-arm64": {"version": "2.6.4","resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.6.4.tgz","integrity": "sha512-eCsqt8Ma3eVap+oyJCDnJZH60SIU464B66n3y38EUTJdM1T/HfZol1FJC9vb+sHToX0ix8XzqPcwJnOzyAJz0g==","cpu": ["arm64"],8 unmodified lines}},"node_modules/@biomejs/cli-win32-x64": {"version": "2.6.4","resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.6.4.tgz","integrity": "sha512-pYsMy5AThiHFOZAsngg8qN4PurM6nInKBhVX7sbj3eNpRQqo1Hb0MgCwPL7VqVMrmcEEMj9Ks3qbkallR65e8g==","cpu": ["x64"],333 unmodified lines"license": "MIT"},"node_modules/@mantine/carousel": {"version": "9.7.4","resolved": "https://registry.npmjs.org/@mantine/carousel/-/carousel-9.7.4.tgz","integrity": "sha512-UAEaIl5sQvqRB30nzPXgNFsCu8m+4I5wCZKemUBEtPxFECF03HEvekBWO8yMUFp6jyjJSEguqr/y5tJm2wgpUw==","license": "MIT","peerDependencies": {"@mantine/core": "9.7.4","@mantine/hooks": "9.7.4","embla-carousel": ">=8.0.0","embla-carousel-react": ">=8.0.0","react": "^19.2.0",1 unmodified line}},"node_modules/@mantine/code-highlight": {"version": "9.7.4","resolved": "https://registry.npmjs.org/@mantine/code-highlight/-/code-highlight-9.7.4.tgz","integrity": "sha512-YGmJI4IwR54z5MXTaRiw/BKpF2FJno2bRnYkelbrSB+ZFerqy2625AyOFv5Ey8LbT0ggr4aft7R/+SqWvcvE2w==","license": "MIT","dependencies": {"clsx": "^2.1.1"},"peerDependencies": {"@mantine/core": "9.7.4","@mantine/hooks": "9.7.4","react": "^19.2.0","react-dom": "^19.2.0"}},"node_modules/@mantine/core": {"version": "9.7.4","resolved": "https://registry.npmjs.org/@mantine/core/-/core-9.7.4.tgz","integrity": "sha512-c7aTGELNn74CxG9i5/tq9BHGh0lKdKmGGz+9iDF+gR7Ipt4U1TMM286lAmLpRrKL2bR+UEaN4blZ8UJmOuGJ4Q==","license": "MIT","dependencies": {"@floating-ui/react": "^0.27.20",3 unmodified lines"type-fest": "^5.10.0"},"peerDependencies": {"@mantine/hooks": "9.7.4","react": "^19.2.0","react-dom": "^19.2.0"}},"node_modules/@mantine/form": {"version": "9.7.4","resolved": "https://registry.npmjs.org/@mantine/form/-/form-9.7.4.tgz","integrity": "sha512-p8cImC+VgKKKRc6HJGlFtGAKNbKyHtKyDIgNJeoqUBQ1beUfQlEh0I6lmTmWCzGlijVUE+GdNJWveNr0PQKRIw==","license": "MIT","dependencies": {"@standard-schema/spec": "^1.1.0",5 unmodified lines}},"node_modules/@mantine/hooks": {"version": "9.7.4","resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-9.7.4.tgz","integrity": "sha512-j6Xf9Sc1fhhGEKXg6BZA2geyP/Czqvo6Rsi0IduOCWgwl/MAAJbKRjRc7xe2+9vePLdfqLZqRIAOY5rta88uNA==","license": "MIT","peerDependencies": {"react": "^19.2.0"}},"node_modules/@mantine/notifications": {"version": "9.7.4","resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-9.7.4.tgz","integrity": "sha512-LabOPnE/YtdpXHn49ZJjiJJBYnYXUMi6SFuzxje7XxpoxImZ+wdGh4R/+l89NnWTxKwGoQL51iUTL8PSgu2A1Q==","license": "MIT","dependencies": {"@mantine/store": "9.7.4","react-transition-group": "4.4.5"},"peerDependencies": {"@mantine/core": "9.7.4","@mantine/hooks": "9.7.4","react": "^19.2.0","react-dom": "^19.2.0"}},"node_modules/@mantine/store": {"version": "9.7.4","resolved": "https://registry.npmjs.org/@mantine/store/-/store-9.7.4.tgz","integrity": "sha512-tICEOzsaV2eiV4QAegdErRLtfd0da02DKqsEIzJLa+8T5dWDnBMCqlWxHfBMnaL7HBAmpx41koad0zUZPGw7pg==","license": "MIT","peerDependencies": {"react": "^19.2.0"1997 unmodified lines}},"node_modules/@vitest/coverage-v8": {"version": "5.0.5","resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-5.0.5.tgz","integrity": "sha512-4KpkGdIrSqBihx/JyP/e+S+IKB98etg1XDQiLAxksLfcShnwi1VReGeOT9NI43hLHbknosKp/1CCLn9Zgcs8mg==","dev": true,"license": "MIT","dependencies": {"@bcoe/v8-coverage": "^1.0.2","@vitest/istanbul-lib-coverage": "^1.0.2","@vitest/istanbul-lib-report": "^1.0.2","ast-v8-to-istanbul": "^1.0.7","magicast": "^0.5.5","obug": "^3.0.0",4 unmodified lines"url": "https://opencollective.com/vitest"},"peerDependencies": {"@vitest/browser": "5.0.5","vitest": "5.0.5"},"peerDependenciesMeta": {"@vitest/browser": {2 unmodified lines}},"node_modules/@vitest/istanbul-lib-coverage": {"version": "1.0.2","resolved": "https://registry.npmjs.org/@vitest/istanbul-lib-coverage/-/istanbul-lib-coverage-1.0.2.tgz","integrity": "sha512-9J/JMwOf9AoJhAywhrn7ScKTL38hsWQP/qPG60OtaAFcQ5OXPwKsxZFlbnuCKmZ61m8/lGgHYnFpdyQZUvG/iA==","dev": true,"license": "MIT","engines": {1 unmodified line}},"node_modules/@vitest/istanbul-lib-report": {"version": "1.0.2","resolved": "https://registry.npmjs.org/@vitest/istanbul-lib-report/-/istanbul-lib-report-1.0.2.tgz","integrity": "sha512-gUsfXZJbzPamoIY5TvHFiMMoXESBrUMo+xqaj+rYrWI69+EnvRlYBlP96ZnHPY4vX8kyUpgAnFUCg5wZG/HkDQ==","dev": true,"license": "MIT","dependencies": {"@vitest/istanbul-lib-coverage": "1.0.2"},"engines": {"node": ">=22"}},"node_modules/@vitest/mocker": {"version": "5.0.5","resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.5.tgz","integrity": "sha512-xLL3lkDegJZw+MGoGaCCsFayDZthGgpAtr3Vziyfc4p7xH89K7KRPcRBBh/kEYm0Aqkt5DtTmkYpBtRV/FrHZg==","dev": true,"license": "MIT","dependencies": {"@jridgewell/trace-mapping": "0.3.31","@vitest/spy": "5.0.5","estree-walker": "^3.0.3","magic-string": "^1.4.3"},14 unmodified lines}},"node_modules/@vitest/spy": {"version": "5.0.5","resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.0.5.tgz","integrity": "sha512-lwJRExuH417257Q5wv9QYugN9IMJkoxcrKrYxGPQkBzl7wlNpTUxD/5yNX4ESKVUIShKPgkGchYPFMWOOk0wzw==","dev": true,"license": "MIT","funding": {22 unmodified lines}},"node_modules/ai": {"version": "7.0.160","resolved": "https://registry.npmjs.org/ai/-/ai-7.0.160.tgz","integrity": "sha512-h48o8i8NTDuHUZhiLDm9NHufEk/L3dkrJ8E9liXMcd4K4hAdI8bfamtbRJylyQeKQ599mnWNplTvyH/SbtpolQ==","license": "Apache-2.0","dependencies": {"@ai-sdk/gateway": "4.0.133","@ai-sdk/provider": "4.0.35","@ai-sdk/provider-utils": "5.0.72"},"engines": {"node": ">=22"2 unmodified lines"zod": "^3.25.76 || ^4.1.8"}},"node_modules/ansi-regex": {"version": "5.0.1","resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",3672 unmodified lines}},"node_modules/rate-limiter-flexible": {"version": "11.2.3","resolved": "https://registry.npmjs.org/rate-limiter-flexible/-/rate-limiter-flexible-11.2.3.tgz","integrity": "sha512-w4HX4toAsEbu1VksOauZwI9d6URb6/4WqJJ5Hg1bESihMt2KJfQ2iTwvDkhIg+y2HetLh65DGu/8xIkUz/xNPA==","license": "ISC"},"node_modules/react": {346 unmodified lines}},"node_modules/rollup-plugin-visualizer": {"version": "7.1.1","resolved": "https://registry.npmjs.org/rollup-plugin-visualizer/-/rollup-plugin-visualizer-7.1.1.tgz","integrity": "sha512-ThaGiHTU8XW02OkK80TrTHATraJmM9OAduU4otal+7gyXLpYEtmGBLfx5kW+EHvvLwn03YGW2NnwKUIqsYlJAA==","license": "MIT","dependencies": {"open": "^11.0.0",435 unmodified lines}},"node_modules/tldts": {"version": "7.0.25","resolved": "https://registry.npmjs.org/tldts/-/tldts-7.0.25.tgz","integrity": "sha512-keinCnPbwXEUG3ilrWQZU+CqcTTzHq9m2HhoUP2l7Xmi8l1LuijAXLpAJ5zRW+ifKTNscs4NdCkfkDCBYm352w==","license": "MIT","dependencies": {"tldts-core": "^7.0.25"},"bin": {"tldts": "bin/cli.js"}},"node_modules/tldts-core": {"version": "7.0.25","resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.0.25.tgz","integrity": "sha512-ZjCZK0rppSBu7rjHYDYsEaMOIbbT+nWF57hKkv4IUmZWBNrBWBOjIElc0mKRgLM8bm7x/BBlof6t2gi/Oq/Asw==","license": "MIT"},"node_modules/tough-cookie": {384 unmodified lines}},"node_modules/vitest": {"version": "5.0.5","resolved": "https://registry.npmjs.org/vitest/-/vitest-5.0.5.tgz","integrity": "sha512-cPODOMF8YnkiiYtDdHo6n4wWmBrOBBbOIYH2d33M4l3CdNn72h+qMmO6uXffUN6A5AZFXNND/d+krS9mgkXRfg==","dev": true,"license": "MIT","dependencies": {"@types/chai": "^5.2.2","@vitest/mocker": "5.0.5","chai": "^6.3.0","es-module-lexer": "^2.3.2","expect-type": "^1.4.0",19 unmodified lines"@edge-runtime/vm": "*","@opentelemetry/api": "^1.9.0","@types/node": "^22.0.0 || >=24.0.0","@vitest/browser-playwright": "5.0.5","@vitest/browser-preview": "5.0.5","@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0","@vitest/coverage-istanbul": "5.0.5","@vitest/coverage-v8": "5.0.5","@vitest/ui": "5.0.5","happy-dom": "*","jsdom": "*","vite": "^6.4.0 || ^7.0.0 || ^8.0.0"95 unmodified lines969798991001011021031041051061071083 unmodified lines1121131141151161171181191201211221231241251261271281291301311321331341351361372 unmodified lines1401411421431441451461471481491501511521531541551561577 unmodified lines1651661671681691701711721731741751761771781791802 unmodified lines183184185186187188189190191192193194195196197198199200121 unmodified lines3223233243253263273283293307 unmodified lines3383393403413423433443453463473483493503513523533543553563573583598 unmodified lines3683693703713723733743753768 unmodified lines3853863873883893903913923938 unmodified lines4024034044054064074084094108 unmodified lines41942042142242342442542642711 unmodified lines43944044144244344444544644711 unmodified lines45946046146246346446546646711 unmodified lines47948048148248348448548648711 unmodified lines4995005015025035045055065078 unmodified lines516517518519520521522523524333 unmodified lines8588598608618628638648658668678688698701 unmodified line8728738748758768778788798808818828838848858868878888898908918928938948953 unmodified lines8999009019029039049059069079089099109119129135 unmodified lines9199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519521997 unmodified lines2950295129522953295429552956295729582959296029612962296329644 unmodified lines296929702971297229732974297529762 unmodified lines2979298029812982298329842985298629871 unmodified line29892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301514 unmodified lines30303031303230333034303530363037303822 unmodified lines306130623063306430653066306730683069307030713072307330742 unmodified lines3077307830793080308130823083308430853086308730883089309030913092309330943672 unmodified lines676767686769677067716772677367746775346 unmodified lines712271237124712571267127712871297130435 unmodified lines756675677568756975707571757275737574757575767577757875797580758175827583758475857586384 unmodified lines7971797279737974797579767977797879797980798179827983798419 unmodified lines80048005800680078008800980108011801280138014801595 unmodified lines"license": "MIT"},"node_modules/@ai-sdk/gateway": {"version": "4.0.136","resolved": "https://registry.npmjs.org/@ai-sdk/gateway/-/gateway-4.0.136.tgz","integrity": "sha512-P851NL80P85Ee6MhblRuuCzNlQdOYU5rKmdt/Wuo5dMtkzvIHhyVZY9wtfKG3wBJUUoxHxWKsI2aR6O75o8diA==","license": "Apache-2.0","dependencies": {"@ai-sdk/provider": "4.0.36","@ai-sdk/provider-utils": "5.0.75","@vercel/oidc": "3.2.0"},"engines": {3 unmodified lines"zod": "^3.25.76 || ^4.1.8"}},"node_modules/@ai-sdk/gateway/node_modules/@ai-sdk/provider": {"version": "4.0.36","resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.36.tgz","integrity": "sha512-GqvWZSZdBelCGughlBdOoupT258rgM3YMbaLAS9WSZJ0vlt8c9vm3My+ZT31mYhiReMCMCF2qF2axnGbILpk1A==","license": "Apache-2.0","dependencies": {"json-schema": "^0.4.0"},"engines": {"node": ">=22"}},"node_modules/@ai-sdk/openai-compatible": {"version": "3.0.85","resolved": "https://registry.npmjs.org/@ai-sdk/openai-compatible/-/openai-compatible-3.0.85.tgz","integrity": "sha512-vZx3MvZjc7h7Ud8GUEvS9Qngtoec+Zogv5Zxw8kVjXrZhp/OOHfEosXoqjScnokoCK/d5cQfurfNNUmTrbZOQQ==","license": "Apache-2.0","dependencies": {"@ai-sdk/provider": "4.0.36","@ai-sdk/provider-utils": "5.0.75"},"engines": {"node": ">=22"2 unmodified lines"zod": "^3.25.76 || ^4.1.8"}},"node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider": {"version": "4.0.36","resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.36.tgz","integrity": "sha512-GqvWZSZdBelCGughlBdOoupT258rgM3YMbaLAS9WSZJ0vlt8c9vm3My+ZT31mYhiReMCMCF2qF2axnGbILpk1A==","license": "Apache-2.0","dependencies": {"json-schema": "^0.4.0"},"engines": {"node": ">=22"}},"node_modules/@ai-sdk/provider": {"version": "4.0.35","resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.35.tgz",7 unmodified lines}},"node_modules/@ai-sdk/provider-utils": {"version": "5.0.75","resolved": "https://registry.npmjs.org/@ai-sdk/provider-utils/-/provider-utils-5.0.75.tgz","integrity": "sha512-k4yAsFliGZwoTpyTpm3ptxwIeaPvRh5vGh/UWoqDiLLXKoyz4zuBGS7p3ygf8to5Bh4fAOHynotLBsWLIYdu2A==","license": "Apache-2.0","dependencies": {"@ai-sdk/provider": "4.0.36","@standard-schema/spec": "^1.1.0","@workflow/serde": "4.1.0","eventsource-parser": "^3.0.8","undici": "^7.29.1"},"engines": {"node": ">=22"2 unmodified lines"zod": "^3.25.76 || ^4.1.8"}},"node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider": {"version": "4.0.36","resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.36.tgz","integrity": "sha512-GqvWZSZdBelCGughlBdOoupT258rgM3YMbaLAS9WSZJ0vlt8c9vm3My+ZT31mYhiReMCMCF2qF2axnGbILpk1A==","license": "Apache-2.0","dependencies": {"json-schema": "^0.4.0"},"engines": {"node": ">=22"}},"node_modules/@ai-sdk/provider-utils/node_modules/undici": {"version": "7.30.1","resolved": "https://registry.npmjs.org/undici/-/undici-7.30.1.tgz",121 unmodified lines}},"node_modules/@biomejs/biome": {"version": "2.6.5","resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.6.5.tgz","integrity": "sha512-n0sp74QbSVEkWXlH659TKv4oJNylwAvDeZ8K8vt/PbcF1xneuNWe57z/G0Bxfh00cufhWXF6DiStLM8+jcLUpg==","dev": true,"license": "MIT OR Apache-2.0","bin": {7 unmodified lines"url": "https://opencollective.com/biome"},"optionalDependencies": {"@biomejs/cli-android-arm64": "2.6.5","@biomejs/cli-android-x64": "2.6.5","@biomejs/cli-darwin-arm64": "2.6.5","@biomejs/cli-darwin-x64": "2.6.5","@biomejs/cli-linux-arm64": "2.6.5","@biomejs/cli-linux-arm64-musl": "2.6.5","@biomejs/cli-linux-x64": "2.6.5","@biomejs/cli-linux-x64-musl": "2.6.5","@biomejs/cli-win32-arm64": "2.6.5","@biomejs/cli-win32-x64": "2.6.5"}},"node_modules/@biomejs/cli-android-arm64": {"version": "2.6.5","resolved": "https://registry.npmjs.org/@biomejs/cli-android-arm64/-/cli-android-arm64-2.6.5.tgz","integrity": "sha512-fkLzc1WRU7wRIUNmAm7cxILb4dd6eESz/VycWvVFKVn6tXx0gFQKdUbPnwT42xys8AEvIJQpFGcK00kURwqorg==","cpu": ["arm64"],8 unmodified lines}},"node_modules/@biomejs/cli-android-x64": {"version": "2.6.5","resolved": "https://registry.npmjs.org/@biomejs/cli-android-x64/-/cli-android-x64-2.6.5.tgz","integrity": "sha512-fkZ9dPnDAzAcaPtPCiwqtkub5C9FQK/oGCGaU9sq+DysTaq13pE9FxBIMcEZ3ydn8/FfcMdXi/DDzKDP+qyn2Q==","cpu": ["x64"],8 unmodified lines}},"node_modules/@biomejs/cli-darwin-arm64": {"version": "2.6.5","resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.6.5.tgz","integrity": "sha512-bKd0EOREgnVjeZm4s9knQ+WdPOkWS3JHB+eWGHlx+Pq66bqQA1/KybwU0O+zuyAyXiphSCBcrLruZt3YtnJoaQ==","cpu": ["arm64"],8 unmodified lines}},"node_modules/@biomejs/cli-darwin-x64": {"version": "2.6.5","resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.6.5.tgz","integrity": "sha512-UkT9BECNOXSiW6SGddjyaRACy362Sc9n3vDaTFkccL0bC2gW7JzM16i4+JKPbEaDn1Sa+oETHV8KungnI/y40Q==","cpu": ["x64"],8 unmodified lines}},"node_modules/@biomejs/cli-linux-arm64": {"version": "2.6.5","resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.6.5.tgz","integrity": "sha512-H9cVMWBqW/lkFK9NHJdt0bpM2q7PacUDEjQoff9+m0dCV09H/jmBykfTCkbDthHf8+jCuWDJWiQFJ7bDkiGOcA==","cpu": ["arm64"],11 unmodified lines}},"node_modules/@biomejs/cli-linux-arm64-musl": {"version": "2.6.5","resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.6.5.tgz","integrity": "sha512-kfc3AePW1a0/d/gUpcIz95nf3Ce8YY2/xL0Fk3fLqAhKsotqUi6PN6BaVWss4p6ijWbiuacZ9NQ4NiQtpjbYpw==","cpu": ["arm64"],11 unmodified lines}},"node_modules/@biomejs/cli-linux-x64": {"version": "2.6.5","resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.6.5.tgz","integrity": "sha512-e6/WMSN/+FhH+ZOoBevps/euxFQmv6BXqYNuTn1+ITR6O4XYFjHF5PeVSNZnjkgSYmvhcDkfepSX5lXczMijGA==","cpu": ["x64"],11 unmodified lines}},"node_modules/@biomejs/cli-linux-x64-musl": {"version": "2.6.5","resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.6.5.tgz","integrity": "sha512-0mHVpLNt7/FugfZ2VPugUIEIiooWIyHGGJUqU9StxamBln9hz+maXRFIECU50jaf5/ZB93veGIViN5VKgw2AEA==","cpu": ["x64"],11 unmodified lines}},"node_modules/@biomejs/cli-win32-arm64": {"version": "2.6.5","resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.6.5.tgz","integrity": "sha512-uBbfpdR/cH5up1iRJFGAPP97xKMzrgMs685CSrY7NM+Q4Unw7chY0o3JulEvJdmU6c6hGQxwqotMq7DDH0DzxA==","cpu": ["arm64"],8 unmodified lines}},"node_modules/@biomejs/cli-win32-x64": {"version": "2.6.5","resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.6.5.tgz","integrity": "sha512-07LaCeN9vvmbAAMOMsUjMfL5UbsCDkvVeyMJIgwNRc0xYqhizBGkjVzx05LYEwCXl2AiHcdzqVPR4IOYAsI1QQ==","cpu": ["x64"],333 unmodified lines"license": "MIT"},"node_modules/@mantine/carousel": {"version": "9.7.5","resolved": "https://registry.npmjs.org/@mantine/carousel/-/carousel-9.7.5.tgz","integrity": "sha512-CVIMYhddQhS355bb4fKa8S0Dml9Frpg6qfgeakhyuQzRVov49vt8Zvr1KDTV0tKs6ktV0I9x5+M87PfUOPaRVg==","license": "MIT","peerDependencies": {"@mantine/core": "9.7.5","@mantine/hooks": "9.7.5","embla-carousel": ">=8.0.0","embla-carousel-react": ">=8.0.0","react": "^19.2.0",1 unmodified line}},"node_modules/@mantine/code-highlight": {"version": "9.7.5","resolved": "https://registry.npmjs.org/@mantine/code-highlight/-/code-highlight-9.7.5.tgz","integrity": "sha512-a9YhELhBNuqsVvbH2E40xVeyGrsV1lAZNj5wIaQYUc6MSNnu4Iq7fJVYk6Qt33G1+MCbfujYo3UGMoXoovoahw==","license": "MIT","dependencies": {"clsx": "^2.1.1"},"peerDependencies": {"@mantine/core": "9.7.5","@mantine/hooks": "9.7.5","react": "^19.2.0","react-dom": "^19.2.0"}},"node_modules/@mantine/core": {"version": "9.7.5","resolved": "https://registry.npmjs.org/@mantine/core/-/core-9.7.5.tgz","integrity": "sha512-NiOTHpAZssi1Z5ISZBvcXEA4XDn0BWcxwpmmUthFx/eL0CsJ18FXMn/ydRCJmoeMGcIKmRE+pjt90KM70GOsUw==","license": "MIT","dependencies": {"@floating-ui/react": "^0.27.20",3 unmodified lines"type-fest": "^5.10.0"},"peerDependencies": {"@mantine/hooks": "9.7.5","react": "^19.2.0","react-dom": "^19.2.0"}},"node_modules/@mantine/form": {"version": "9.7.5","resolved": "https://registry.npmjs.org/@mantine/form/-/form-9.7.5.tgz","integrity": "sha512-DbYsbSak59cwxFGRGBScWMzzVWKSUNPAJLMS8FDEyzpAJvywj4Bx07syFx1DgUJaIeMfjIERAVraPe3T2WxdJg==","license": "MIT","dependencies": {"@standard-schema/spec": "^1.1.0",5 unmodified lines}},"node_modules/@mantine/hooks": {"version": "9.7.5","resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-9.7.5.tgz","integrity": "sha512-+3cNisLOUkzF77SjRKkG/V+svZii9WDGvcwlaxFH58b14MNohz1zWbV+WfjZt9qfzrIPPUOedks/z6PMo5rAFA==","license": "MIT","peerDependencies": {"react": "^19.2.0"}},"node_modules/@mantine/notifications": {"version": "9.7.5","resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-9.7.5.tgz","integrity": "sha512-S7jApMXZhXmKLlwvvp5yfQ3AqfxQN9Y+GQK82f5vNWKLZVgQ3HdicpeSh1DmsNWdB4sJr0oIhWliCUPAC8ctyA==","license": "MIT","dependencies": {"@mantine/store": "9.7.5","react-transition-group": "4.4.5"},"peerDependencies": {"@mantine/core": "9.7.5","@mantine/hooks": "9.7.5","react": "^19.2.0","react-dom": "^19.2.0"}},"node_modules/@mantine/store": {"version": "9.7.5","resolved": "https://registry.npmjs.org/@mantine/store/-/store-9.7.5.tgz","integrity": "sha512-A+5/Y7+2EkkB8ByWSIxUpaXA0O7jFlhBKNrB8IAAkl0WADEhDh6UxDV/88p9fUfGP17vbWskEyMLT9t5vWmu4g==","license": "MIT","peerDependencies": {"react": "^19.2.0"1997 unmodified lines}},"node_modules/@vitest/coverage-v8": {"version": "5.1.0","resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-5.1.0.tgz","integrity": "sha512-OY9aShBQG5KOIw2zCo9fDoCHI9RHliNHJ//nM7m6jGg41Hyke9JOGWmeMlK74xYErsxMoK8mIB3gAeEyFVA7LA==","dev": true,"license": "MIT","dependencies": {"@bcoe/v8-coverage": "^1.0.2","@vitest/istanbul-lib-coverage": "^2.1.0","@vitest/istanbul-lib-report": "^2.1.0","ast-v8-to-istanbul": "^1.0.7","magicast": "^0.5.5","obug": "^3.0.0",4 unmodified lines"url": "https://opencollective.com/vitest"},"peerDependencies": {"@vitest/browser": "5.1.0","vitest": "5.1.0"},"peerDependenciesMeta": {"@vitest/browser": {2 unmodified lines}},"node_modules/@vitest/istanbul-lib-coverage": {"version": "2.1.0","resolved": "https://registry.npmjs.org/@vitest/istanbul-lib-coverage/-/istanbul-lib-coverage-2.1.0.tgz","integrity": "sha512-WOjuS+xcjSIy7ruYBQ+9BUcV7XZQ0FyVcbWbWxW9TRx/kLGx5SQaeFRIFDJxjNplb6YsT7SpKo2zuXXUo91OIQ==","dev": true,"license": "MIT","engines": {1 unmodified line}},"node_modules/@vitest/istanbul-lib-report": {"version": "2.1.0","resolved": "https://registry.npmjs.org/@vitest/istanbul-lib-report/-/istanbul-lib-report-2.1.0.tgz","integrity": "sha512-+ZFta25nWtGCOBG9/IET8w1RO5Oawsd6H8Uf6AJ9EA/StFuKVtKAEJEJ6uRt84OH+T4YkI0ASmIHAhRA+0KVxw==","dev": true,"license": "MIT","dependencies": {"@vitest/istanbul-lib-coverage": "2.1.0"},"engines": {"node": ">=22"}},"node_modules/@vitest/mocker": {"version": "5.1.0","resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.1.0.tgz","integrity": "sha512-5umB9/jlWcqVS6fsrFmv5Gdnpu6wAUio/lEOwAmvB7v+lFo/IW2B9FhAD0p19GCULTgMzLCdUmuCDCnAzWgppQ==","dev": true,"license": "MIT","dependencies": {"@jridgewell/trace-mapping": "0.3.31","@vitest/spy": "5.1.0","estree-walker": "^3.0.3","magic-string": "^1.4.3"},14 unmodified lines}},"node_modules/@vitest/spy": {"version": "5.1.0","resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.1.0.tgz","integrity": "sha512-2DPO5OMHWKrBngC+fCmTQqemNF0gidRhp3lxbBmRhW+M1XJrfgPpqNqWVevXtn2f2ufD5ZaR1B6B641aAlcX5A==","dev": true,"license": "MIT","funding": {22 unmodified lines}},"node_modules/ai": {"version": "7.0.163","resolved": "https://registry.npmjs.org/ai/-/ai-7.0.163.tgz","integrity": "sha512-nm8+qn36NQXO4Hjfj7SlbcNRhUyNXKtdoS9xhXr/z92lvdGFuPkzHmA2tFzhaUQy13IitNYrcw2QSNpEJC/iSA==","license": "Apache-2.0","dependencies": {"@ai-sdk/gateway": "4.0.136","@ai-sdk/provider": "4.0.36","@ai-sdk/provider-utils": "5.0.75"},"engines": {"node": ">=22"2 unmodified lines"zod": "^3.25.76 || ^4.1.8"}},"node_modules/ai/node_modules/@ai-sdk/provider": {"version": "4.0.36","resolved": "https://registry.npmjs.org/@ai-sdk/provider/-/provider-4.0.36.tgz","integrity": "sha512-GqvWZSZdBelCGughlBdOoupT258rgM3YMbaLAS9WSZJ0vlt8c9vm3My+ZT31mYhiReMCMCF2qF2axnGbILpk1A==","license": "Apache-2.0","dependencies": {"json-schema": "^0.4.0"},"engines": {"node": ">=22"}},"node_modules/ansi-regex": {"version": "5.0.1","resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",3672 unmodified lines}},"node_modules/rate-limiter-flexible": {"version": "11.2.4","resolved": "https://registry.npmjs.org/rate-limiter-flexible/-/rate-limiter-flexible-11.2.4.tgz","integrity": "sha512-z28uTq33lBUAszaKtX9Vq4Fwemf6Lfr06tw3jo5pkqjsxfFyqk4yx5T4bEHAeLr39ZS6VeVtfaIu35QhVNKAvA==","license": "ISC"},"node_modules/react": {346 unmodified lines}},"node_modules/rollup-plugin-visualizer": {"version": "7.1.2","resolved": "https://registry.npmjs.org/rollup-plugin-visualizer/-/rollup-plugin-visualizer-7.1.2.tgz","integrity": "sha512-+yrEz9LJ7fxd7T0yj4GPvcKHKfJNzTzKT7FHiF3f/US+7EaWlgB8PoGbUOlobD4Al8v6TeCCl/Fgbov5FV/DaA==","license": "MIT","dependencies": {"open": "^11.0.0",435 unmodified lines}},"node_modules/tldts": {"version": "7.4.19","resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.19.tgz","integrity": "sha512-48dH6aSpQnpbzDUc4vIQZ1VjB8tkK+e8c1yx05/SZK+rkssgjEOlxDd/yU8/a4vGYQ9vRgJr9dwMq9TJ0b3X2Q==","license": "MIT","dependencies": {"tldts-core": "^7.4.19"},"bin": {"tldts": "bin/cli.js"}},"node_modules/tldts-core": {"version": "7.4.20","resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.4.20.tgz","integrity": "sha512-C630TWXZCZmLq0F2bW4QqwnaaxCQ/svpAqvJwnC4JvgEM5ohhBnGsEzTLSOXcN+xjz+kEaHS5uoWIw2klnqd0A==","license": "MIT"},"node_modules/tough-cookie": {384 unmodified lines}},"node_modules/vitest": {"version": "5.1.0","resolved": "https://registry.npmjs.org/vitest/-/vitest-5.1.0.tgz","integrity": "sha512-MzmNFnrwa8v8lF1bLxw3UJ4EREwVOVb75VqJZmUDRjJ6EluK/x9th7qTbaeDk41WxE1GxWqmTXcdsfobfH5sOA==","dev": true,"license": "MIT","dependencies": {"@types/chai": "^5.2.2","@vitest/mocker": "5.1.0","chai": "^6.3.0","es-module-lexer": "^2.3.2","expect-type": "^1.4.0",19 unmodified lines"@edge-runtime/vm": "*","@opentelemetry/api": "^1.9.0","@types/node": "^22.0.0 || >=24.0.0","@vitest/browser-playwright": "5.1.0","@vitest/browser-preview": "5.1.0","@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0","@vitest/coverage-istanbul": "5.1.0","@vitest/coverage-v8": "5.1.0","@vitest/ui": "5.1.0","happy-dom": "*","jsdom": "*","vite": "^6.4.0 || ^7.0.0 || ^8.0.0"
32 unmodified lines3334353637383932 unmodified lines"changelog-guard": "node scripts/changelog-guard.cjs","license-check": "node scripts/license-check.cjs","native-module-check": "node scripts/native-module-integrity.cjs","wllama-catalog-check": "node scripts/wllama-catalog-check.cjs"},"allowScripts": {"onnxruntime-node": false,32 unmodified lines333435363738394032 unmodified lines"changelog-guard": "node scripts/changelog-guard.cjs","license-check": "node scripts/license-check.cjs","native-module-check": "node scripts/native-module-integrity.cjs","wllama-catalog-check": "node scripts/wllama-catalog-check.cjs","bench:wllama": "node scripts/wllama-bench/run.mjs"},"allowScripts": {"onnxruntime-node": false,
.env.example+4-1
.github/CODE_OF_CONDUCT.md+3
.github/CONTRIBUTING.md+1
.github/SECURITY.md+8
.github/SUPPORT.md+1
README.md+1-1
agents.md+10-1
changelog.md+10-6
client/components/App/App.test.tsx+1
client/components/App/App.tsx+4-1
client/modules/config.test.ts+1
client/modules/config.ts+2
client/modules/pubSub.ts+2-1
client/modules/settings.test.ts+47-3
client/modules/settings.ts+34-2
client/modules/textGenerationWithWllama.test.ts+35
client/modules/textGenerationWithWllama.ts+34-4
client/modules/wllama.test.ts+54-1
client/modules/wllama.ts+55-40
docs/ai-integration.md+30-2
docs/api.md+1
docs/coding-conventions.md+1
docs/configuration.md+25-11
docs/core-technologies.md+1
docs/development-commands.md+36
docs/glossary.md+7
docs/overview.md+10
docs/project-structure.md+1
docs/pull-requests.md+6
docs/quick-start.md+6
docs/reranking.md+3
docs/search-history.md+5
docs/security.md+2
docs/ui-components.md+25
docs/wllama-model-evaluation.mdAdded+129
e2e/main-thread-budget.spec.ts+1
eval/README.md+2
knip.json+2-1
package-lock.json+184-136
package.json+2-1