Skip to content

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

Install guide downloads D1 first; Auto uses a downloaded D1 whatever the chat provider

Claude83b05800d738
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9a5c76f37..99c07e2a9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,7 @@ This changelog was generated from the repository Git history and release tags. V
- New tab page: WebBrain now provides a new tab with a clock, quick links, bundled backgrounds and a WebBrain box (Ask, Act or Search). Ask and Act both run in the side panel straight away (Act shows a warning that it starts working immediately; Plan before Act still applies). Based on Mue (BSD-3-Clause), with all of Mue's network calls and telemetry removed. Adds the `search` permission. See `docs/newtab.md`. The new tab is opt-in: the last onboarding step has a "Use WebBrain as my new tab page" checkbox (ticked by default, next to Help Improve WebBrain) and Settings → General has the same switch; when it is off, new tabs go to the browser's own new tab page. On Firefox the new tab stays on and has no switch in WebBrain, because Firefox cannot hand a tab to its own new tab page; change it in Firefox's settings.
### Changed
+- The first-install guide's **Download local models** button now downloads D1 first and Ternary Bonsai 2 2B Vision after it, and the progress bar follows whichever is downloading. If this GPU can't run D1, or D1's download stops, Bonsai starts anyway. Once D1 is downloaded, Auto uses it to check whether tasks and scheduled runs are finished even while WebBrain Cloud is your chat provider, so the guide no longer asks you to choose it in Settings. WebBrain Cloud's decision model still answers what a request asks for, and, as with any D1 answer, a "finished" from D1 is confirmed by the chat model. Chrome; the Auto change applies to Firefox too.
- Settings is reorganized. Its tabs are now General, Budgets, Memory, Skills, CAPTCHA, Bridge and Advanced. The providers and the assistive models moved to a new Providers page with LLM, Vision, Speech, Generative, Decision and SafeSocial tabs; open it from **More…** in the side panel's model menu or from the Providers link at the top of Settings. Site permissions moved to their own page, opened with **Manage site permissions** in the ⚠ menu next to the microphone. Advanced is now a tab instead of a drawer inside General, and the CAPTCHA solvers have a tab of their own. The new Budgets tab holds the cloud cost allowances, the question timeout and what happens when it runs out, Max Agent Steps, the LLM request timeout and the image budget. Screenshot redaction moved to Advanced. Language and UI zoom are chosen in the side panel only. The search box looks through General, Budgets, CAPTCHA and Advanced at once. Old links to the moved tabs open the new pages.
- Auto-screenshot now defaults to On navigation instead of On state change. A value already saved is kept, including one restored from an older configuration export, which records the old default.
- Record traces and Record full request details are now one switch: traces are recorded with their full request details, or not at all. An install that recorded traces without full details starts recording them after the update.
diff --git a/docs/privacy-and-data-flow.md b/docs/privacy-and-data-flow.md
index 775b12ccf..0d0789e4b 100644
--- a/docs/privacy-and-data-flow.md
+++ b/docs/privacy-and-data-flow.md
@@ -110,10 +110,11 @@ requests.
Providers → Decision has three decision-model modes. **Auto** (the
default) sends nothing anywhere new: it uses D1 on the device once D1 is
downloaded (with its explicit consent, on the Providers page or from the Chrome
-install guide), for completion and scheduled checks only, and while Compass is
-the conversation provider Compass's managed Cloud decision route answers
-completion checks and semantic decisions as before. With neither, no decision
-model is used. A downloaded chat or vision model never enables decisions.
+install guide), for completion and scheduled checks only, whatever the
+conversation provider. While Compass is the conversation provider, Compass's
+managed Cloud decision route answers semantic decisions as before, and
+completion checks too until D1 is downloaded. With neither, no decision model
+is used. A downloaded chat or vision model never enables decisions.
**Off** uses none, Compass's included.
**On** selects OpenRouter, TypeSafe, a local/custom System One endpoint, D1 or
the in-browser chat model; completion verification, watch checks, scheduled
diff --git a/docs/providers-and-models.md b/docs/providers-and-models.md
index 5b5ca9c27..4fc55f2f3 100644
--- a/docs/providers-and-models.md
+++ b/docs/providers-and-models.md
@@ -65,14 +65,16 @@ finished, did a watch find what it waited for, what does a request say about an
action) so the chat model does not have to. The Decision tab of the Providers
page asks one question first:
-- **Auto** (default) needs no setup. It uses D1 (below) once D1 is
- downloaded on this device, for completion checks and scheduled watch and
- completion checks only. The Chrome install guide's **Download local models**
- button downloads it next to Ternary Bonsai 2 2B Vision; **Download and load**
- under On → D1 does too, in both browsers. D1 serves Auto while that Download
- or Load stands: **Unload**, **Remove cached model** and Off end it. While
- Compass is the chat provider, Compass's managed decision model answers
- instead, as before. Otherwise no decision model is used. Readiness
+- **Auto** (default) needs no setup. Once D1 (below) is downloaded on this
+ device, it is Auto's decision model for completion checks and scheduled
+ watch and completion checks, whatever the chat provider. The Chrome install
+ guide's **Download local models** button downloads it first, then Ternary
+ Bonsai 2 2B Vision; **Download and load** under On → D1 does too, in both
+ browsers. D1 serves Auto while that Download or Load stands: **Unload**,
+ **Remove cached model** and Off end it. While Compass is the chat provider,
+ Compass's managed decision model keeps semantic decisions, and answers
+ completion checks too until D1 is downloaded. Otherwise no decision model is
+ used. Readiness
(`agent/decision-availability.js`) is D1's experimental-model consent, the
stored Load request and the package's ready marker in its OPFS directory
(`providers/d1-cache.js`), read without starting the offscreen document,
@@ -123,10 +125,12 @@ about 0.95 GB of pinned model data and tokenizer/configuration files from
the [Hugging Face model repository](https://huggingface.co/webbrain-one/d1-browser-decision-fp16)
into OPFS. In Chrome the first-install guide offers the same download: its
optional **Download local models** button, whose note names D1 and its size,
-is that consent, and it downloads D1 in D1's own Worker while Ternary Bonsai 2
-2B Vision downloads, then loads it. The guide reads D1's status, checks the GPU
-and starts or stops the download (the only `d1_control` commands it may send);
-it writes no decision settings, so Auto then uses D1 as described above. The package stores FP16 weights and computes in FP32; it is the
+is that consent. It downloads D1 first, in D1's own Worker, and loads it;
+Ternary Bonsai 2 2B Vision follows once D1 is ready, or at once when this GPU
+cannot run D1 or D1's download stops with an error. The guide reads D1's
+status, checks the GPU and starts or stops the download (the only
+`d1_control` commands it may send); it writes no decision settings, so Auto,
+the default, then uses D1 as described above, and the guide says so. The package stores FP16 weights and computes in FP32; it is the
[FP32 release](https://huggingface.co/webbrain-one/d1-browser-decision-fp32)
with its weights rounded once, and answers the same on its held-out test. A
cached FP32 package from an earlier version is removed on the next download. The repository name is not a production-readiness claim; this provider
@@ -155,7 +159,7 @@ stays loaded until it is unloaded, removed or switched off on the Providers
page (decisions Off, or another provider saved under On). Switching to Auto
keeps it, loaded or still downloading, while that request stands
(`releaseD1OnDecisionChange` in `background.js`); Auto uses it once it is
-downloaded unless Compass is the chat provider, and **Unload** releases it. A
+downloaded, and **Unload** releases it. A
decision that finds D1 unloaded (a browser restart, a discarded stalled
session, a lost GPU device) starts one reload from the verified cache in the
background and uses the fallback chain meanwhile. A reload never downloads. A decision whose caller
@@ -196,8 +200,9 @@ use the existing fallback chain; no synthetic answer is substituted.
Verify completion (`done`) defaults on when outsourcing is configured, with a
90% acceptance threshold separate from the scheduled-check threshold. Compass
uses its managed `/v1/decisions` route by default. An explicitly enabled and
-consented experimental D1 selection overrides only that decision route, not
-the main Compass provider. The fallback chain is decision model, active LLM, then existing
+consented experimental D1 selection, or in Auto a downloaded D1 for completion
+and scheduled checks, overrides only that decision route, not the main Compass
+provider. The fallback chain is decision model, active LLM, then existing
completion checks. These outsourcing toggles control the decision model only;
with outsourcing disabled or unconfigured, completion still uses a dedicated
call to the active LLM, subject to its normal cost allowance, followed by the
@@ -205,9 +210,9 @@ existing checks. Strict Secret Mode disables these additional calls.
| Active provider | First completion verifier | Fallback |
| --- | --- | --- |
-| WebBrain Compass (default) | Managed decision model | Active LLM, then existing checks |
+| WebBrain Compass (default), D1 not downloaded | Managed decision model | Active LLM, then existing checks |
| Explicitly enabled and consented D1, including with Compass | Experimental local D1; no sole success authority | Active LLM, then existing checks |
-| Auto, not Compass, D1 downloaded | Experimental local D1; no sole success authority | Active LLM, then existing checks |
+| Auto, D1 downloaded (Compass included) | Experimental local D1; no sole success authority | Active LLM, then existing checks |
| Other provider, completion outsourcing enabled | Selected decision model | Active LLM, then existing checks |
| Other provider, outsourcing disabled or unconfigured | Active LLM | Existing checks |
diff --git a/docs/security-model.md b/docs/security-model.md
index bc2f939a8..646de4d4e 100644
--- a/docs/security-model.md
+++ b/docs/security-model.md
@@ -74,8 +74,9 @@ handler accepts only the extension's own Providers page and, for status, the
GPU check, download and stop only, its own install guide page; load, unload,
removal and consent stay on the Providers page. The guide writes no decision
settings. Auto uses D1 only after that consent, while the download is complete
-and its Load request stands, and never in place of Compass's managed route or a
-saved choice. Chrome uses its shared offscreen
+and its Load request stands, and never in place of a saved choice; with Compass
+as the chat provider, D1 takes only the completion and scheduled checks, and
+Compass's managed route keeps semantic decisions. Chrome uses its shared offscreen
document and a separate Worker; Firefox attempts its background-page Worker only
when hardware WebGPU and OPFS are available. Software adapters and inadequate
buffer limits are rejected, but other capable devices are not declared validated.
@@ -219,7 +220,7 @@ The primary threat: a malicious page crafts content that, when read by the agent
| **Skill import boundary** | Skills can expose read-only HTTP tools and download-job tools through a `webbrain-tools` manifest. Importing or keeping the skill enabled is the trust decision for the declared HTTPS endpoint; declared skill tools use `credentials: "omit"` and should mark third-party results `resultPolicy: "untrusted"`. Download-job skill tools still require an action mode and the normal Downloads permission gate before saving files. |
| **WebMCP boundary** | Experimental WebMCP is on by default, so its tools and prompt guidance enter ordinary model requests unless the user opts out under Settings → Bridge. Chrome page-registered names, descriptions, schemas, frame URLs, annotations, outputs, and errors are page-controlled and always use the untrusted-content wrapper. Calls use opaque IDs. Ask may list tools but cannot invoke them. Because a callback can run arbitrary page logic, every invocation requires Act/Dev, fresh per-call confirmation, and a permission grant for the actual registration-frame origin; a page-authored `readOnly` hint never bypasses those gates. Missing/opaque frame identity fails closed, and the frame plus effective HTTP(S) security origin are revalidated immediately before dispatch to prevent navigation races from borrowing an old grant. |
| **API mutation override** | A per-conversation `/allow-api` flag, or the default-on persistent setting under Settings → Advanced, *waives* the permission prompt for write-method network egress (`fetch_url`/`research_url` with POST/PUT/PATCH/DELETE). Neither option waives GET egress or any other capability. Conversation reset clears only the slash-command override. |
-| **Decision models** | Auto (default) uses the downloaded in-browser model for completion and scheduled checks, or Compass's managed route while Compass is the chat provider; Off uses none. In On, OpenRouter, direct TypeSafe and local/custom System One endpoints share independent per-feature switches. Keys are optional for local servers. Compass completion uses its managed decision route unless D1 or the in-browser chat model is chosen. Bounded/redacted task and fresh page evidence are untrusted data. Judges have no browser executor; ordinary tool calls still pass policy, permission and completion layers. Strict Secret Mode, cancellation, quota and cost limits apply. Unavailable or malformed judgments fall through to the active LLM and existing checks. |
+| **Decision models** | Auto (default) uses a downloaded D1 for completion and scheduled checks, whatever the chat provider; while Compass is the chat provider, Compass's managed route answers semantic decisions, and completion checks until D1 is downloaded. Off uses none. In On, OpenRouter, direct TypeSafe and local/custom System One endpoints share independent per-feature switches. Keys are optional for local servers. Compass completion uses its managed decision route unless D1 is downloaded (Auto) or chosen, or the in-browser chat model is chosen. Bounded/redacted task and fresh page evidence are untrusted data. Judges have no browser executor; ordinary tool calls still pass policy, permission and completion layers. Strict Secret Mode, cancellation, quota and cost limits apply. Unavailable or malformed judgments fall through to the active LLM and existing checks. |
| **`done()` verification** | Decision and tool-free LLM checks prefer vision, then AX. Confident pending/failed outcomes require read-only recovery before another submission. Accepted task-bound proof can satisfy generic evidence despite an unrelated comment form, while explicit recipient, payment, download, authorization and workflow contracts remain required. Existing dialog/form checks are the final fallback. |
| **Grouped search approval** | A same-site GET form with no credential, payment or hidden token field, and no side-effect action address, shares one task-scoped approval for its navigation, typing and submit when the page's structure marks it as a search: a search landmark, a search-typed field or one whose keyboard says search, code names such as `q` or `query`, a search address, or a submit control a model read, in any language, as only searching or filtering. Words in a field's visible label decide nothing. Every other form keeps its fresh confirmation. |
| **Duplicate-submit guard** | A second text click on the same caption within 45 seconds on the same tab and URL is blocked when a model read the caption, in any language, as committing something (sending, saving, paying, publishing, creating, confirming and so on). A caption read as anything else, or that could not be read, stays repeatable; app-observed popups, links, fields and draft tools are always repeatable. Both builds. |
diff --git a/docs/webgpu-models.md b/docs/webgpu-models.md
index de9efeba8..f8792493a 100644
--- a/docs/webgpu-models.md
+++ b/docs/webgpu-models.md
@@ -256,15 +256,17 @@ Use the tools in `scripts/models/bonsai/`:
preload flows fetch model files: Providers → WebGPU, Apocalypse
Mode, and the first-install page (Chrome), which offers Ternary Bonsai 2 2B
Vision and D1, the decision model, behind its optional "Download local
- models" button. The two download at once, each in its own worker, and the
- page shows D1's progress on a line of its own; once the chat model is
+ models" button. D1 downloads first, in its own worker, and Bonsai follows
+ once D1 is ready (or at once when D1 cannot download here); while D1's
+ download runs, the button pauses or resumes it and the progress bar
+ follows it, and D1's progress has a line of its own. Once the chat model is
ready, the same button starts, pauses, resumes or retries D1 alone. The
install page checks for
hardware WebGPU before fetching anything (D1 runs its own adapter check, and
- a GPU it cannot use leaves the Bonsai download going), never changes the
+ a GPU it cannot use moves straight on to Bonsai), never changes the
active provider or the decision settings, and only points an idle WebGPU
provider at Bonsai when the configured model is not already downloaded.
- Auto decisions then use D1, not Bonsai
+ Auto decisions then use D1, not Bonsai, whatever the chat provider
([`providers-and-models.md`](providers-and-models.md#decision-models)).
## Decisions on WebGPU
@@ -325,10 +327,10 @@ The labelled set is d1's balanced-V3 held-out test (72 synthetic screenshots,
wrong destinations and unsubmitted drafts. The synthetic results below
do not establish reliability on real browser tasks.
- Completion checks no longer start Ternary's former 15-second decision
- request. Auto gives its former slot to D1: once D1 is downloaded, and
- while Compass is not the chat provider, D1 answers completion and
- scheduled checks, and a positive answer still needs independent proof;
- otherwise the active chat model checks. Ternary chat and screenshot
+ request. Auto gives its former slot to D1: once D1 is downloaded, D1
+ answers completion and scheduled checks, in place of Compass's managed
+ route too, and a positive answer still needs independent proof;
+ otherwise Compass's managed route or the active chat model checks. Ternary chat and screenshot
reading remain available. The diagnostic fixture/readout path is retained
for evaluating a future replacement; its results do not authorize actions.
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index 6f2a81642..b1ccfee50 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -9154,7 +9154,7 @@ export class Agent extends LoopDetector {
async _jevSettings(tabId, provider = this._activeProvider(tabId), feature = 'semantic') {
const stored = await chrome.storage.local.get([...JEV_FAST_KEYS, ...DECISION_SETTINGS_KEYS]);
const compass = provider?.config?.providerName === 'webbrain-cloud' ? provider.config : null;
- const decisionConfig = await resolveCurrentDecisionConfig(stored, compass);
+ const decisionConfig = await resolveCurrentDecisionConfig(stored, compass, { feature });
return decisionFeatureEnabled(decisionConfig, feature) && !this.strictSecretMode && (decisionConfig.local || globalThis.navigator?.onLine !== false) ? { ...stored, decisionConfig } : null;
}
diff --git a/src/chrome/src/agent/completion-runtime.js b/src/chrome/src/agent/completion-runtime.js
index ed732128f..28dcf0700 100644
--- a/src/chrome/src/agent/completion-runtime.js
+++ b/src/chrome/src/agent/completion-runtime.js
@@ -331,7 +331,7 @@ async function evaluateBrowserCompletion(agent, tabId, options = {}) {
}
const stored = await chrome.storage.local.get(DECISION_SETTINGS_KEYS);
const compass = provider.config?.providerName === 'webbrain-cloud' ? provider.config : null;
- const config = await resolveCurrentDecisionConfig(stored, compass);
+ const config = await resolveCurrentDecisionConfig(stored, compass, { feature: 'done' });
const context = agent.systemOneContext(tabId);
const signal = agent._runAbortSignal(tabId);
const guard = agent._planExecutionGuards.get(tabId);
@@ -343,7 +343,7 @@ async function evaluateBrowserCompletion(agent, tabId, options = {}) {
&& (!calculationEvidence || captureCalculationEvidence(agent, tabId, calculationEvidence))
&& scope === JSON.stringify([agent.completionInvariants.get(tabId)?.runToken, agent.completionInvariants.get(tabId)?.lastAction?.sequence, agent._progressTaskKeyHash(tabId), config.provider, config.model, config.url, provider.model, provider.supportsVision, JSON.stringify(config)]);
const currentIdentity = async evidence => !!evidence.identity && currentRun()
- && JSON.stringify(await resolveCurrentDecisionConfig(await chrome.storage.local.get(DECISION_SETTINGS_KEYS), compass)) === JSON.stringify(config)
+ && JSON.stringify(await resolveCurrentDecisionConfig(await chrome.storage.local.get(DECISION_SETTINGS_KEYS), compass, { feature: 'done' })) === JSON.stringify(config)
&& evidence.identity === await agent._completionDocumentStamp(tabId, true) && currentRun();
const current = async evidence => {
if (!await currentIdentity(evidence)) return false;
diff --git a/src/chrome/src/agent/decision-availability.js b/src/chrome/src/agent/decision-availability.js
index e5f40bc84..558e2133e 100644
--- a/src/chrome/src/agent/decision-availability.js
+++ b/src/chrome/src/agent/decision-availability.js
@@ -2,7 +2,7 @@ import { decisionNeedsLocalAssist, resolveDecisionConfig } from './decision-conf
import { D1_KEEP_LOADED_KEY } from '../providers/d1-config.js';
import { d1PackageReady } from '../providers/d1-cache.js';
-// Auto without Compass uses D1 once its package is downloaded and verified,
+// Auto uses D1 once its package is downloaded and verified, Compass or not,
// while the user's Download or Load stands: Unload, Remove cached model and
// switching decisions Off end it (background.js d1_control). The lookup is one
// storage read and D1's ready marker, without the offscreen document or the
@@ -15,8 +15,9 @@ export async function d1LocalAssistReady(api = globalThis.browser || globalThis.
} catch { return false; }
}
-// The decision configuration that applies right now.
-export async function resolveCurrentDecisionConfig(stored = {}, compass = null) {
- const localAssistReady = decisionNeedsLocalAssist(stored, compass) && await d1LocalAssistReady();
- return resolveDecisionConfig(stored, compass, { localAssistReady });
+// The decision configuration that applies right now, for `feature` when the
+// caller names the decision it asks (decision-config.js DECISION_FEATURES).
+export async function resolveCurrentDecisionConfig(stored = {}, compass = null, { feature = null } = {}) {
+ const localAssistReady = decisionNeedsLocalAssist(stored, compass, feature) && await d1LocalAssistReady();
+ return resolveDecisionConfig(stored, compass, { localAssistReady, feature });
}
diff --git a/src/chrome/src/agent/decision-config.js b/src/chrome/src/agent/decision-config.js
index bc5408c23..187e9a147 100644
--- a/src/chrome/src/agent/decision-config.js
+++ b/src/chrome/src/agent/decision-config.js
@@ -29,12 +29,16 @@ export const WEBGPU_CHAT_DECISION_MODEL = 'webbrain-one/Ternary-Bonsai-2-2B-ONNX
const NO_DECISION_FEATURES = Object.freeze(Object.fromEntries(DECISION_FEATURES.map(feature => [feature, false])));
// Auto with Compass keeps what Compass did before modes existed: completion
-// checks and semantic decisions on its managed model.
+// checks and semantic decisions on its managed model. A downloaded D1 takes
+// the completion checks (AUTO_LOCAL_FEATURES).
const AUTO_COMPASS_FEATURES = Object.freeze({ ...NO_DECISION_FEATURES, done: true, semantic: true });
-// Auto with D1 downloaded and no Compass: the checks D1 answers by itself, the
-// ones the in-browser chat model answered before its decisions were disabled.
-// Fast classifications, fast browser actions and semantic decisions need an
-// explicit On, so the experimental and guard-facing paths stay opt-in.
+// Auto with D1 downloaded: the checks D1 answers by itself, the ones the
+// in-browser chat model answered before its decisions were disabled. Once D1
+// is downloaded it is Auto's decision model for them, in place of Compass's
+// managed model too. Fast classifications, fast browser actions and semantic
+// decisions need an explicit On, so the experimental and guard-facing paths
+// stay opt-in; while Compass is the chat provider, its managed model keeps
+// semantic decisions.
const AUTO_LOCAL_FEATURES = Object.freeze({ ...NO_DECISION_FEATURES, done: true, watch: true, completion: true });
// A saved mode wins. Profiles saved before modes existed map an enabled
@@ -45,11 +49,13 @@ export function resolveDecisionMode(stored = {}) {
return stored?.systemOneEnabled === true ? 'on' : 'auto';
}
-// Only Auto without Compass, after D1's experimental-model consent, looks for
-// D1's download (decision-availability.js), so callers can skip that lookup
-// otherwise.
-export function decisionNeedsLocalAssist(stored = {}, compass = null) {
- return resolveDecisionMode(stored) === 'auto' && !compass && stored?.[D1_CONSENT_KEY] === D1_CONSENT_VERSION;
+// Only Auto, after D1's experimental-model consent, looks for D1's download
+// (decision-availability.js), so callers can skip that lookup otherwise. While
+// Compass is the chat provider, D1 takes only the decisions it answers in Auto:
+// `feature` names the one asked for, and none named means those checks.
+export function decisionNeedsLocalAssist(stored = {}, compass = null, feature = null) {
+ return resolveDecisionMode(stored) === 'auto' && stored?.[D1_CONSENT_KEY] === D1_CONSENT_VERSION
+ && (!compass || feature == null || AUTO_LOCAL_FEATURES[feature] === true);
}
// Whether the resolved configuration answers this decision. Every caller asks
@@ -84,12 +90,12 @@ function onDecisionFeatures(stored, config, legacy) {
// answered, so Settings and model discovery see the same configuration.
// Downloaded chat/vision weights do not establish reliable decision behavior;
// `localAssistReady` says D1, a decision model, is downloaded and the user's
-// Download or Load stands (decision-availability.js). Only Auto without
-// Compass reads it.
-export function resolveDecisionConfig(stored = {}, compass = null, { localAssistReady = false } = {}) {
+// Download or Load stands (decision-availability.js). Only Auto reads it, and
+// with Compass only for the decisions D1 answers there (`feature`).
+export function resolveDecisionConfig(stored = {}, compass = null, { localAssistReady = false, feature = null } = {}) {
stored = stored || {};
const mode = resolveDecisionMode(stored);
- if (localAssistReady === true && decisionNeedsLocalAssist(stored, compass)) {
+ if (localAssistReady === true && decisionNeedsLocalAssist(stored, compass, feature)) {
const config = selectedDecisionConfig({ ...stored, decisionProvider: 'webgpu_d1', decisionVisionMode: 'auto' }, null, true);
return { ...config, doneEnabled: true, mode, source: 'local_assist', features: { ...AUTO_LOCAL_FEATURES } };
}
diff --git a/src/chrome/src/agent/scheduler.js b/src/chrome/src/agent/scheduler.js
index 4ae933121..0b6835917 100644
--- a/src/chrome/src/agent/scheduler.js
+++ b/src/chrome/src/agent/scheduler.js
@@ -1736,7 +1736,7 @@ export class ScheduledJobManager {
|| null;
const compass = runMeta.compass
?? (String(activeProvider?.config?.providerName || '').trim().toLowerCase() === 'webbrain-cloud' ? activeProvider.config : null);
- const config = runMeta.decisionConfig || await resolveCurrentDecisionConfig(settings, compass);
+ const config = runMeta.decisionConfig || await resolveCurrentDecisionConfig(settings, compass, { feature: isWatch ? 'watch' : 'completion' });
if (!this.systemOneJudge || !decisionFeatureEnabled(config, isWatch ? 'watch' : 'completion')) return skip('disabled');
if (settings.strictSecretMode || runMeta.sidecarAllowed === false || runMeta.signal?.aborted) return skip('unavailable');
const state = systemOneEvidenceState(job.prompt || job.resumeInstruction || job.reason || '', runMeta.evidence, isWatch ? job.watch?.systemOneBaseline : null);
diff --git a/src/chrome/src/background.js b/src/chrome/src/background.js
index 2c84aede6..fc7a07a37 100644
--- a/src/chrome/src/background.js
+++ b/src/chrome/src/background.js
@@ -8,9 +8,8 @@ import { D1_CONSENT_KEY, D1_CONSENT_VERSION, D1_KEEP_LOADED_KEY } from './provid
// D1's Worker and GPU memory are released when decisions are switched Off,
// another decision provider is saved, consent changes or Strict Secret Mode
// starts. Leaving On for Auto keeps D1, loaded or still downloading, while the
-// user's Download or Load request stands: Auto uses it once it is downloaded,
-// unless Compass is the chat provider (decision-availability.js), and Unload
-// on the Providers page releases it.
+// user's Download or Load request stands: Auto uses it once it is downloaded
+// (decision-availability.js), and Unload on the Providers page releases it.
function releaseD1OnDecisionChange(changes, area) {
if (area !== 'local') return;
const reset = () => { void d1Request('reset').catch(() => {}); };
@@ -3469,8 +3468,8 @@ async function handleFailureRecoveryResponse(msg, sender) {
}
// Whether D1 answers this profile's decisions now, for the install guide: an
-// explicit On selection, or Auto once D1 is downloaded while Compass is not the
-// chat provider (decision-availability.js).
+// explicit On selection, or Auto once D1 is downloaded, whatever the chat
+// provider (decision-availability.js).
async function d1UsedForDecisions(api) {
try {
if (agent.strictSecretMode) return false;
diff --git a/src/chrome/src/ui/install.js b/src/chrome/src/ui/install.js
index 7c28a84d2..f9697d893 100644
--- a/src/chrome/src/ui/install.js
+++ b/src/chrome/src/ui/install.js
@@ -224,14 +224,21 @@ export async function pointWebgpuProviderAtModel(modelId, { runtime = globalThis
}
// ── D1, the on-device decision model ─────────────────────────────────────
-// The same button downloads D1, WebBrain's experimental decision model, next
-// to the chat model. D1 has its own worker, so both downloads run at once, and
-// D1 loads when its files are in. The click is the consent the note asks for.
-// The guide writes no decision settings: Auto uses a downloaded D1 for its
-// checks while Compass is not the chat provider (decision-availability.js).
+// The same button downloads D1, WebBrain's experimental decision model, and
+// then the chat model: D1 first, in its own worker, and the chat model once D1
+// is ready or saved, or cannot be downloaded here. D1 loads when its files are
+// in. The click is the consent the note asks for. The guide writes no decision
+// settings: once D1 is downloaded, Auto, the default mode, uses it for its
+// checks, whatever the chat provider (decision-availability.js).
const D1_POLL_MS = 1500;
const D1_POLLING_STATUSES = new Set(['checking', 'downloading']);
+// D1's download is under way: checking the GPU, transferring or paused. The
+// chat model waits for it.
+const D1_TRANSFER_STATUSES = new Set(['checking', 'downloading', 'paused']);
+// Chat model states in which a D1 transfer has the button: the chat model is
+// not downloading, so D1 goes first.
+const D1_FIRST_CHAT_STATUSES = new Set(['not-downloaded', 'error', 'busy', 'paused']);
export function normalizeD1Snapshot(snapshot = {}) {
const raw = String(snapshot?.status || '');
@@ -254,6 +261,8 @@ export function d1View(state = {}) {
case 'downloading': return { statusKey: 'install.local_model.d1_downloading', progress: state.progress };
case 'paused': return { statusKey: 'install.local_model.d1_paused', progress: state.progress };
// Saved but not loaded yet, D1 loads for the next decision it answers.
+ // A profile that turned decisions Off or chose another model under On is
+ // only told that D1 is on this device.
case 'ready': case 'saved': return { statusKey: state.usedForDecisions ? 'install.local_model.d1_ready' : 'install.local_model.d1_saved' };
case 'unsupported': return { statusKey: 'install.local_model.d1_unsupported' };
case 'error': return { statusKey: 'install.local_model.d1_error', isError: true };
@@ -262,13 +271,25 @@ export function d1View(state = {}) {
}
/**
- * The shared button: the chat model's, until that model is ready and needs
- * nothing more. Then the same button finishes D1's download, so a D1 that is
- * not downloaded yet, was paused or stopped with an error can still be
- * started, resumed or retried from the guide.
+ * The shared button. D1 downloads first: while its download is under way and
+ * the chat model is not downloading, the button and the progress bar follow
+ * D1 (`displayState` is what the block shows), and the chat model's own line
+ * keeps its own progress (`statusProgress`). Then the button is the chat
+ * model's, until that model is ready and needs nothing more; the same button
+ * then finishes D1's download, so a D1 that is not downloaded yet, was paused
+ * or stopped with an error can still be started, resumed or retried.
*/
export function localModelButtonView(view, chatStatus, d1State) {
- if (chatStatus !== 'ready' || !d1State) return view;
+ if (!d1State) return view;
+ if (D1_FIRST_CHAT_STATUSES.has(chatStatus) && D1_TRANSFER_STATUSES.has(d1State.status)) {
+ const d1 = { statusProgress: view.progress, progress: Math.round(Number(d1State.progress) || 0) };
+ switch (d1State.status) {
+ case 'checking': return { ...view, ...d1, labelKey: 'install.local_model.download', action: null, progress: null, displayState: 'checking' };
+ case 'downloading': return { ...view, ...d1, labelKey: 'install.local_model.pause', action: 'd1-pause', displayState: 'downloading' };
+ default: return { ...view, ...d1, labelKey: 'install.local_model.resume', action: 'd1-start', displayState: 'paused' };
+ }
+ }
+ if (chatStatus !== 'ready') return view;
switch (d1State.status) {
case 'idle': return { ...view, labelKey: 'install.local_model.download', action: 'd1-start' };
case 'paused': return { ...view, labelKey: 'install.local_model.resume', action: 'd1-start' };
@@ -386,18 +407,35 @@ export function initializeLocalModelDownload({
let pollTimer = null;
let disposed = false;
let rendered = false;
- // D1's own changes redraw the button once this controller has drawn it.
- const d1 = initializeD1Download({ documentLike, runtime, translate, pollMs, onChange: () => { if (rendered) render(); } });
+ // Set by the click that downloads both models: the chat model starts once
+ // D1's download is over (ready or saved, unsupported, or stopped with an
+ // error). A Pause of D1 keeps it set, so Resume carries on to the chat model.
+ let chatAfterD1 = false;
+ // The person paused D1 here. A D1 transfer stopped any other way (no bytes
+ // for two minutes, its time limit, a Stop on the Providers page) does not
+ // hold the chat model back.
+ let d1PausedHere = false;
+ // D1's own changes redraw the button once this controller has drawn it,
+ // and the end of D1's download starts the chat model.
+ const d1 = initializeD1Download({
+ documentLike, runtime, translate, pollMs,
+ onChange: () => {
+ if (rendered) render();
+ continueAfterD1();
+ },
+ });
const buttonView = () => localModelButtonView(localModelView(state), state.status, d1?.getState());
const render = () => {
rendered = true;
const view = buttonView();
- root.dataset.state = state.status;
+ root.dataset.state = view.displayState || state.status;
if (label) label.textContent = translate(view.labelKey);
if (button) {
button.disabled = inFlight || !view.action;
- const d1Busy = state.status === 'ready' && ['checking', 'downloading'].includes(d1?.getState().status);
+ const d1Status = d1?.getState().status;
+ const d1Busy = ['checking', 'downloading'].includes(d1Status)
+ && (state.status === 'ready' || D1_FIRST_CHAT_STATUSES.has(state.status));
if (inFlight || d1Busy || ['checking', 'downloading', 'stopping'].includes(state.status)) button.setAttribute('aria-busy', 'true');
else button.removeAttribute('aria-busy');
}
@@ -407,7 +445,7 @@ export function initializeLocalModelDownload({
bar.style?.setProperty?.('--local-model-progress', `${view.progress ?? 0}%`);
}
if (statusLine) {
- statusLine.textContent = view.statusKey ? translate(view.statusKey, { progress: view.progress ?? 0, error: state.error || '' }) : '';
+ statusLine.textContent = view.statusKey ? translate(view.statusKey, { progress: view.statusProgress ?? view.progress ?? 0, error: state.error || '' }) : '';
statusLine.classList?.toggle?.('is-error', view.isError === true);
}
};
@@ -423,6 +461,7 @@ export function initializeLocalModelDownload({
state = { progress: 0, error: '', ...next };
render();
schedulePoll();
+ continueAfterD1();
};
async function refresh({ quiet = false } = {}) {
@@ -436,12 +475,45 @@ export function initializeLocalModelDownload({
}
}
+ // The second download: the chat model, once D1's is over.
+ function continueAfterD1() {
+ if (!chatAfterD1 || inFlight || disposed) return;
+ const d1Status = d1?.getState().status;
+ if (['checking', 'downloading'].includes(d1Status) || (d1Status === 'paused' && d1PausedHere)) return;
+ // Another model holds the WebGPU download slot: start when it is free.
+ if (['busy', 'checking'].includes(state.status)) return;
+ chatAfterD1 = false;
+ // A chat model already downloading, paused elsewhere or ready is left as it is.
+ if (['not-downloaded', 'error'].includes(state.status)) void startChatModel();
+ }
+
+ async function startChatModel() {
+ inFlight = true;
+ render();
+ try {
+ try {
+ await pointWebgpuProviderAtModel(modelId, { runtime });
+ } catch {
+ // Only cosmetic for Settings; the download itself does not need it.
+ }
+ await backgroundCommand(runtime, 'start_webgpu_download', { model: modelId });
+ } catch (error) {
+ inFlight = false;
+ setState({ status: 'error', error: error?.message || String(error) });
+ return;
+ }
+ inFlight = false;
+ await refresh();
+ }
+
button?.addEventListener('click', async () => {
const view = buttonView();
if (!view.action || inFlight) return;
inFlight = true;
if (view.action === 'd1-start' || view.action === 'd1-pause') {
- // The chat model is ready; only D1 is downloaded, paused or resumed.
+ // Only D1 is downloaded, paused or resumed: before the chat model while
+ // D1 goes first, or after it once the chat model is ready.
+ d1PausedHere = view.action === 'd1-pause';
render();
try {
await (view.action === 'd1-start' ? d1.start() : d1.pause());
@@ -449,40 +521,47 @@ export function initializeLocalModelDownload({
inFlight = false;
render();
}
+ continueAfterD1();
return;
}
try {
if (view.action === 'pause') {
render();
+ if (['checking', 'downloading'].includes(d1?.getState().status)) d1PausedHere = true;
void d1?.pause();
await backgroundCommand(runtime, 'pause_webgpu_download');
+ } else if (view.action === 'resume') {
+ render();
+ await backgroundCommand(runtime, 'start_webgpu_download', { model: modelId });
} else {
- if (view.action === 'start') {
- state = { status: 'checking', progress: 0, error: '' };
- render();
- // A browser without hardware WebGPU could download the files but never
- // run them, so check the adapter first (no weights are fetched).
- const probe = await backgroundCommand(runtime, 'test_provider', { providerId: 'webgpu' });
- if (probe?.ok === false) {
- inFlight = false;
- setState({ status: 'unsupported', error: String(probe.error || '') });
- return;
- }
- try {
- await pointWebgpuProviderAtModel(modelId, { runtime });
- } catch {
- // Only cosmetic for Settings; the download itself does not need it.
- }
- } else {
+ state = { status: 'checking', progress: 0, error: '' };
+ render();
+ // A browser without hardware WebGPU could download the files but never
+ // run them, so check the adapter first (no weights are fetched).
+ const probe = await backgroundCommand(runtime, 'test_provider', { providerId: 'webgpu' });
+ if (probe?.ok === false) {
+ inFlight = false;
+ setState({ status: 'unsupported', error: String(probe.error || '') });
+ return;
+ }
+ // D1 downloads first; its line reports it, and the chat model follows
+ // (continueAfterD1). The button stays busy until D1's download has
+ // started, so a Pause always finds D1's transfer to stop.
+ chatAfterD1 = true;
+ d1PausedHere = false;
+ if (d1) {
+ state = { status: 'not-downloaded', progress: 0, error: '' };
render();
+ await d1.start();
+ }
+ // Nothing of D1's to wait for (no D1 here, already saved, or a GPU it
+ // cannot use): the chat model goes now.
+ if (!D1_TRANSFER_STATUSES.has(d1?.getState().status)) {
+ chatAfterD1 = false;
+ inFlight = false;
+ await startChatModel();
+ return;
}
- // D1 downloads alongside, in its own worker; its line reports it. The
- // button stays busy until both downloads have started, so a Pause
- // always finds D1's transfer to stop.
- await Promise.all([
- d1?.start(),
- backgroundCommand(runtime, 'start_webgpu_download', { model: modelId }),
- ]);
}
} catch (error) {
inFlight = false;
diff --git a/src/chrome/src/ui/locales/ar.js b/src/chrome/src/ui/locales/ar.js
index 69e642554..ec40157d1 100644
--- a/src/chrome/src/ui/locales/ar.js
+++ b/src/chrome/src/ui/locales/ar.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'جارٍ تنزيل D1، نموذج القرار · {progress}%',
'install.local_model.d1_paused': 'توقف D1 مؤقتًا عند {progress}%.',
'install.local_model.d1_ready': 'D1 جاهز ويجيب على هذا الجهاز عن أسئلة WebBrain السريعة، مثل «هل انتهت هذه المهمة؟».',
- 'install.local_model.d1_saved': 'تم حفظ D1 على هذا الجهاز. لاستخدامه، اختره في الإعدادات ضمن نماذج القرار.',
+ 'install.local_model.d1_saved': 'تم حفظ D1 على هذا الجهاز.',
'install.local_model.d1_unsupported': 'لا تستطيع وحدة معالجة الرسومات هذه تشغيل D1، لذا يواصل WebBrain فحوصه المعتادة.',
'install.local_model.d1_error': 'توقف D1: {error}',
diff --git a/src/chrome/src/ui/locales/bn.js b/src/chrome/src/ui/locales/bn.js
index 953637cc3..8f2cc6dd0 100644
--- a/src/chrome/src/ui/locales/bn.js
+++ b/src/chrome/src/ui/locales/bn.js
@@ -125,7 +125,7 @@ export default {
'install.local_model.d1_downloading': 'ডিসিশন মডেল D1 ডাউনলোড হচ্ছে · {progress}%',
'install.local_model.d1_paused': 'D1 {progress}%-এ বিরতি দেওয়া হয়েছে।',
'install.local_model.d1_ready': 'D1 প্রস্তুত, এবং এই ডিভাইসেই WebBrain-এর দ্রুত প্রশ্নের উত্তর দেয়, যেমন “এই কাজটি কি শেষ?”।',
- 'install.local_model.d1_saved': 'D1 এই ডিভাইসে সংরক্ষিত আছে। ব্যবহার করতে সেটিংসে ডিসিশন মডেল অংশ থেকে এটি বেছে নিন।',
+ 'install.local_model.d1_saved': 'D1 এই ডিভাইসে সংরক্ষিত আছে।',
'install.local_model.d1_unsupported': 'এই GPU D1 চালাতে পারে না, তাই WebBrain তার সাধারণ চেকগুলোই রাখে।',
'install.local_model.d1_error': 'D1 থেমে গেছে: {error}',
diff --git a/src/chrome/src/ui/locales/de.js b/src/chrome/src/ui/locales/de.js
index a7e20b412..5711a2d36 100644
--- a/src/chrome/src/ui/locales/de.js
+++ b/src/chrome/src/ui/locales/de.js
@@ -127,7 +127,7 @@ export default {
'install.local_model.d1_downloading': 'D1, das Entscheidungsmodell, wird heruntergeladen · {progress} %',
'install.local_model.d1_paused': 'D1 bei {progress} % pausiert.',
'install.local_model.d1_ready': 'D1 ist bereit und beantwortet die kurzen Fragen von WebBrain, etwa „Ist diese Aufgabe erledigt?“, auf diesem Gerät.',
- 'install.local_model.d1_saved': 'D1 ist auf diesem Gerät gespeichert. Um es zu nutzen, wählen Sie es in den Einstellungen unter Entscheidungsmodelle.',
+ 'install.local_model.d1_saved': 'D1 ist auf diesem Gerät gespeichert.',
'install.local_model.d1_unsupported': 'Diese GPU kann D1 nicht ausführen, daher behält WebBrain seine üblichen Prüfungen bei.',
'install.local_model.d1_error': 'D1 wurde gestoppt: {error}',
'sp.status.disconnected': 'Getrennt',
diff --git a/src/chrome/src/ui/locales/en.js b/src/chrome/src/ui/locales/en.js
index 84ad42571..f5fb5aaed 100644
--- a/src/chrome/src/ui/locales/en.js
+++ b/src/chrome/src/ui/locales/en.js
@@ -125,7 +125,7 @@ export default {
'install.local_model.d1_downloading': 'Downloading D1, the decision model · {progress}%',
'install.local_model.d1_paused': 'D1 paused at {progress}%.',
'install.local_model.d1_ready': 'D1 is ready and answers WebBrain’s quick questions, such as “Is this task finished?”, on this device.',
- 'install.local_model.d1_saved': 'D1 is saved on this device. To use it, choose it in Settings under Decision models.',
+ 'install.local_model.d1_saved': 'D1 is saved on this device.',
'install.local_model.d1_unsupported': 'This GPU can’t run D1, so WebBrain keeps its usual checks.',
'install.local_model.d1_error': 'D1 stopped: {error}',
diff --git a/src/chrome/src/ui/locales/es.js b/src/chrome/src/ui/locales/es.js
index 8f40ae4fb..8f8f3fc2e 100644
--- a/src/chrome/src/ui/locales/es.js
+++ b/src/chrome/src/ui/locales/es.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'Descargando D1, el modelo de decisión · {progress} %',
'install.local_model.d1_paused': 'D1 en pausa al {progress} %.',
'install.local_model.d1_ready': 'D1 está listo y responde en este dispositivo a las preguntas rápidas de WebBrain, como «¿Terminó esta tarea?».',
- 'install.local_model.d1_saved': 'D1 está guardado en este dispositivo. Para usarlo, elígelo en Ajustes, en Modelos de decisión.',
+ 'install.local_model.d1_saved': 'D1 está guardado en este dispositivo.',
'install.local_model.d1_unsupported': 'Esta GPU no puede ejecutar D1, así que WebBrain mantiene sus comprobaciones habituales.',
'install.local_model.d1_error': 'D1 se detuvo: {error}',
diff --git a/src/chrome/src/ui/locales/fa.js b/src/chrome/src/ui/locales/fa.js
index 46d650f8a..44e519612 100644
--- a/src/chrome/src/ui/locales/fa.js
+++ b/src/chrome/src/ui/locales/fa.js
@@ -125,7 +125,7 @@ export default {
'install.local_model.d1_downloading': 'در حال دانلود D1، مدل تصمیم · {progress}%',
'install.local_model.d1_paused': 'D1 در {progress}% متوقف شد.',
'install.local_model.d1_ready': 'D1 آماده است و روی همین دستگاه به پرسش‌های کوتاه WebBrain، مثل «آیا این کار تمام شد؟»، پاسخ می‌دهد.',
- 'install.local_model.d1_saved': 'D1 روی این دستگاه ذخیره شد. برای استفاده، آن را در تنظیمات، بخش مدل‌های تصمیم، انتخاب کنید.',
+ 'install.local_model.d1_saved': 'D1 روی این دستگاه ذخیره شد.',
'install.local_model.d1_unsupported': 'این GPU نمی‌تواند D1 را اجرا کند، بنابراین WebBrain بررسی‌های معمول خود را ادامه می‌دهد.',
'install.local_model.d1_error': 'D1 متوقف شد: {error}',
diff --git a/src/chrome/src/ui/locales/fr.js b/src/chrome/src/ui/locales/fr.js
index c713f8f7f..ec516271b 100644
--- a/src/chrome/src/ui/locales/fr.js
+++ b/src/chrome/src/ui/locales/fr.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'Téléchargement de D1, le modèle de décision · {progress} %',
'install.local_model.d1_paused': 'D1 en pause à {progress} %.',
'install.local_model.d1_ready': 'D1 est prêt et répond sur cet appareil aux questions rapides de WebBrain, comme « Cette tâche est-elle terminée ? ».',
- 'install.local_model.d1_saved': 'D1 est enregistré sur cet appareil. Pour l’utiliser, choisissez-le dans les Paramètres, sous Modèles de décision.',
+ 'install.local_model.d1_saved': 'D1 est enregistré sur cet appareil.',
'install.local_model.d1_unsupported': 'Ce GPU ne peut pas exécuter D1 : WebBrain garde ses vérifications habituelles.',
'install.local_model.d1_error': 'D1 s’est arrêté : {error}',
diff --git a/src/chrome/src/ui/locales/he.js b/src/chrome/src/ui/locales/he.js
index ebb0e58ab..aace96276 100644
--- a/src/chrome/src/ui/locales/he.js
+++ b/src/chrome/src/ui/locales/he.js
@@ -141,7 +141,7 @@ export default {
'install.local_model.d1_downloading': 'מוריד את D1, מודל ההחלטות · {progress}%',
'install.local_model.d1_paused': 'D1 הושהה ב-{progress}%.',
'install.local_model.d1_ready': 'D1 מוכן ועונה במכשיר הזה על השאלות המהירות של WebBrain, כמו „האם המשימה הסתיימה?”.',
- 'install.local_model.d1_saved': 'D1 נשמר במכשיר הזה. כדי להשתמש בו, בחרו בו בהגדרות, תחת מודלי החלטות.',
+ 'install.local_model.d1_saved': 'D1 נשמר במכשיר הזה.',
'install.local_model.d1_unsupported': 'ה-GPU הזה לא יכול להריץ את D1, ולכן WebBrain ממשיך בבדיקות הרגילות שלו.',
'install.local_model.d1_error': 'D1 נעצר: {error}',
"sp.status.disconnected": "לא מחובר",
diff --git a/src/chrome/src/ui/locales/hi.js b/src/chrome/src/ui/locales/hi.js
index 9efa3f7ec..9c5e1ddca 100644
--- a/src/chrome/src/ui/locales/hi.js
+++ b/src/chrome/src/ui/locales/hi.js
@@ -125,7 +125,7 @@ export default {
'install.local_model.d1_downloading': 'निर्णय मॉडल D1 डाउनलोड हो रहा है · {progress}%',
'install.local_model.d1_paused': 'D1 को {progress}% पर रोका गया।',
'install.local_model.d1_ready': 'D1 तैयार है और इसी डिवाइस पर WebBrain के छोटे सवालों के जवाब देता है, जैसे “क्या यह काम पूरा हो गया?”।',
- 'install.local_model.d1_saved': 'D1 इस डिवाइस पर सहेजा गया है। इसे इस्तेमाल करने के लिए सेटिंग्स में निर्णय मॉडल के अंतर्गत चुनें।',
+ 'install.local_model.d1_saved': 'D1 इस डिवाइस पर सहेजा गया है।',
'install.local_model.d1_unsupported': 'यह GPU D1 नहीं चला सकता, इसलिए WebBrain अपनी सामान्य जाँचें जारी रखता है।',
'install.local_model.d1_error': 'D1 रुक गया: {error}',
diff --git a/src/chrome/src/ui/locales/id.js b/src/chrome/src/ui/locales/id.js
index 02c6d92ea..1a4c8ed69 100644
--- a/src/chrome/src/ui/locales/id.js
+++ b/src/chrome/src/ui/locales/id.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'Mengunduh D1, model keputusan · {progress}%',
'install.local_model.d1_paused': 'D1 dijeda di {progress}%.',
'install.local_model.d1_ready': 'D1 siap dan menjawab pertanyaan cepat WebBrain, seperti “Apakah tugas ini sudah selesai?”, di perangkat ini.',
- 'install.local_model.d1_saved': 'D1 tersimpan di perangkat ini. Untuk memakainya, pilih di Pengaturan, bagian Model keputusan.',
+ 'install.local_model.d1_saved': 'D1 tersimpan di perangkat ini.',
'install.local_model.d1_unsupported': 'GPU ini tidak bisa menjalankan D1, jadi WebBrain tetap memakai pemeriksaan biasanya.',
'install.local_model.d1_error': 'D1 berhenti: {error}',
diff --git a/src/chrome/src/ui/locales/ja.js b/src/chrome/src/ui/locales/ja.js
index fd98c0cd0..67bc91a54 100644
--- a/src/chrome/src/ui/locales/ja.js
+++ b/src/chrome/src/ui/locales/ja.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': '判定モデル D1 をダウンロード中 · {progress}%',
'install.local_model.d1_paused': 'D1 を {progress}% で一時停止しました。',
'install.local_model.d1_ready': 'D1 の準備ができました。「このタスクは終わった?」のような WebBrain の簡単な質問に、このデバイス上で答えます。',
- 'install.local_model.d1_saved': 'D1 をこのデバイスに保存しました。使うには、設定の「判定モデル」で選んでください。',
+ 'install.local_model.d1_saved': 'D1 をこのデバイスに保存しました。',
'install.local_model.d1_unsupported': 'この GPU では D1 を実行できないため、WebBrain は通常のチェックを続けます。',
'install.local_model.d1_error': 'D1 が停止しました: {error}',
diff --git a/src/chrome/src/ui/locales/ko.js b/src/chrome/src/ui/locales/ko.js
index 03752ff59..28da245f9 100644
--- a/src/chrome/src/ui/locales/ko.js
+++ b/src/chrome/src/ui/locales/ko.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': '결정 모델 D1 다운로드 중 · {progress}%',
'install.local_model.d1_paused': 'D1이 {progress}%에서 일시중지됨.',
'install.local_model.d1_ready': 'D1이 준비되었습니다. "이 작업이 끝났나요?" 같은 WebBrain의 간단한 질문에 이 기기에서 답합니다.',
- 'install.local_model.d1_saved': 'D1이 이 기기에 저장되었습니다. 사용하려면 설정의 결정 모델에서 선택하세요.',
+ 'install.local_model.d1_saved': 'D1이 이 기기에 저장되었습니다.',
'install.local_model.d1_unsupported': '이 GPU에서는 D1을 실행할 수 없어 WebBrain은 평소의 확인을 계속합니다.',
'install.local_model.d1_error': 'D1이 중단되었습니다: {error}',
diff --git a/src/chrome/src/ui/locales/ms.js b/src/chrome/src/ui/locales/ms.js
index a0405d608..2eddf3818 100644
--- a/src/chrome/src/ui/locales/ms.js
+++ b/src/chrome/src/ui/locales/ms.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'Memuat turun D1, model keputusan · {progress}%',
'install.local_model.d1_paused': 'D1 dijeda pada {progress}%.',
'install.local_model.d1_ready': 'D1 sedia dan menjawab soalan pantas WebBrain, seperti “Adakah tugas ini sudah selesai?”, pada peranti ini.',
- 'install.local_model.d1_saved': 'D1 disimpan pada peranti ini. Untuk menggunakannya, pilih dalam Tetapan, di bawah Model keputusan.',
+ 'install.local_model.d1_saved': 'D1 disimpan pada peranti ini.',
'install.local_model.d1_unsupported': 'GPU ini tidak dapat menjalankan D1, jadi WebBrain kekal dengan semakan biasanya.',
'install.local_model.d1_error': 'D1 terhenti: {error}',
diff --git a/src/chrome/src/ui/locales/nl.js b/src/chrome/src/ui/locales/nl.js
index 3983b6a11..f97c116a3 100644
--- a/src/chrome/src/ui/locales/nl.js
+++ b/src/chrome/src/ui/locales/nl.js
@@ -127,7 +127,7 @@ export default {
'install.local_model.d1_downloading': 'D1, het beslismodel, downloaden · {progress}%',
'install.local_model.d1_paused': 'D1 gepauzeerd bij {progress}%.',
'install.local_model.d1_ready': 'D1 is klaar en beantwoordt op dit apparaat de snelle vragen van WebBrain, zoals ‘Is deze taak klaar?’.',
- 'install.local_model.d1_saved': 'D1 is op dit apparaat opgeslagen. Kies het in Instellingen onder Beslismodellen om het te gebruiken.',
+ 'install.local_model.d1_saved': 'D1 is op dit apparaat opgeslagen.',
'install.local_model.d1_unsupported': 'Deze GPU kan D1 niet draaien, dus WebBrain houdt zijn gewone controles aan.',
'install.local_model.d1_error': 'D1 is gestopt: {error}',
'sp.status.disconnected': 'Niet verbonden',
diff --git a/src/chrome/src/ui/locales/pl.js b/src/chrome/src/ui/locales/pl.js
index 306d56ed8..50f6ecff3 100644
--- a/src/chrome/src/ui/locales/pl.js
+++ b/src/chrome/src/ui/locales/pl.js
@@ -127,7 +127,7 @@ export default {
'install.local_model.d1_downloading': 'Pobieranie D1, modelu decyzyjnego · {progress}%',
'install.local_model.d1_paused': 'D1 wstrzymano przy {progress}%.',
'install.local_model.d1_ready': 'D1 jest gotowy i na tym urządzeniu odpowiada na krótkie pytania WebBrain, np. „Czy to zadanie jest skończone?”.',
- 'install.local_model.d1_saved': 'D1 jest zapisany na tym urządzeniu. Aby go używać, wybierz go w Ustawieniach, w sekcji Modele decyzyjne.',
+ 'install.local_model.d1_saved': 'D1 jest zapisany na tym urządzeniu.',
'install.local_model.d1_unsupported': 'Ten GPU nie uruchomi D1, więc WebBrain zostaje przy swoich zwykłych sprawdzeniach.',
'install.local_model.d1_error': 'D1 się zatrzymał: {error}',
'sp.status.disconnected': 'Rozłączono',
diff --git a/src/chrome/src/ui/locales/pt.js b/src/chrome/src/ui/locales/pt.js
index 4320c3e80..5042fd711 100644
--- a/src/chrome/src/ui/locales/pt.js
+++ b/src/chrome/src/ui/locales/pt.js
@@ -125,7 +125,7 @@ export default {
'install.local_model.d1_downloading': 'Baixando o D1, o modelo de decisão · {progress}%',
'install.local_model.d1_paused': 'D1 pausado em {progress}%.',
'install.local_model.d1_ready': 'O D1 está pronto e responde neste dispositivo às perguntas rápidas do WebBrain, como “Esta tarefa terminou?”.',
- 'install.local_model.d1_saved': 'O D1 está salvo neste dispositivo. Para usá-lo, escolha-o em Configurações, em Modelos de decisão.',
+ 'install.local_model.d1_saved': 'O D1 está salvo neste dispositivo.',
'install.local_model.d1_unsupported': 'Esta GPU não consegue rodar o D1, então o WebBrain mantém suas verificações de sempre.',
'install.local_model.d1_error': 'O D1 parou: {error}',
diff --git a/src/chrome/src/ui/locales/ru.js b/src/chrome/src/ui/locales/ru.js
index cdce27894..c2fac5527 100644
--- a/src/chrome/src/ui/locales/ru.js
+++ b/src/chrome/src/ui/locales/ru.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'Загрузка D1, модели решений · {progress}%',
'install.local_model.d1_paused': 'D1 приостановлена на {progress}%.',
'install.local_model.d1_ready': 'D1 готова и прямо на этом устройстве отвечает на короткие вопросы WebBrain, например «Задача выполнена?».',
- 'install.local_model.d1_saved': 'D1 сохранена на этом устройстве. Чтобы её использовать, выберите её в Настройках, в разделе «Модели решений».',
+ 'install.local_model.d1_saved': 'D1 сохранена на этом устройстве.',
'install.local_model.d1_unsupported': 'Этот GPU не может запустить D1, поэтому WebBrain оставляет свои обычные проверки.',
'install.local_model.d1_error': 'D1 остановилась: {error}',
diff --git a/src/chrome/src/ui/locales/th.js b/src/chrome/src/ui/locales/th.js
index 845956756..76d81f880 100644
--- a/src/chrome/src/ui/locales/th.js
+++ b/src/chrome/src/ui/locales/th.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'กำลังดาวน์โหลด D1 โมเดลการตัดสินใจ · {progress}%',
'install.local_model.d1_paused': 'D1 หยุดชั่วคราวที่ {progress}%',
'install.local_model.d1_ready': 'D1 พร้อมแล้ว และตอบคำถามสั้นๆ ของ WebBrain เช่น “งานนี้เสร็จหรือยัง” บนอุปกรณ์นี้',
- 'install.local_model.d1_saved': 'บันทึก D1 ไว้บนอุปกรณ์นี้แล้ว หากต้องการใช้ ให้เลือกในการตั้งค่า ใต้โมเดลการตัดสินใจ',
+ 'install.local_model.d1_saved': 'บันทึก D1 ไว้บนอุปกรณ์นี้แล้ว',
'install.local_model.d1_unsupported': 'GPU นี้รัน D1 ไม่ได้ WebBrain จึงใช้การตรวจสอบตามปกติต่อไป',
'install.local_model.d1_error': 'D1 หยุดทำงาน: {error}',
diff --git a/src/chrome/src/ui/locales/tl.js b/src/chrome/src/ui/locales/tl.js
index 034d0f599..946704d1d 100644
--- a/src/chrome/src/ui/locales/tl.js
+++ b/src/chrome/src/ui/locales/tl.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'Dina-download ang D1, ang decision model · {progress}%',
'install.local_model.d1_paused': 'Naka-pause ang D1 sa {progress}%.',
'install.local_model.d1_ready': 'Handa na ang D1 at sinasagot nito sa device na ito ang mabibilis na tanong ng WebBrain, gaya ng “Tapos na ba ang task na ito?”.',
- 'install.local_model.d1_saved': 'Naka-save ang D1 sa device na ito. Para gamitin ito, piliin ito sa Mga Setting, sa ilalim ng Mga decision model.',
+ 'install.local_model.d1_saved': 'Naka-save ang D1 sa device na ito.',
'install.local_model.d1_unsupported': 'Hindi kayang patakbuhin ng GPU na ito ang D1, kaya nananatili ang WebBrain sa karaniwang mga check nito.',
'install.local_model.d1_error': 'Huminto ang D1: {error}',
diff --git a/src/chrome/src/ui/locales/tr.js b/src/chrome/src/ui/locales/tr.js
index 3dddd518e..3f85ed46c 100644
--- a/src/chrome/src/ui/locales/tr.js
+++ b/src/chrome/src/ui/locales/tr.js
@@ -233,7 +233,7 @@ export default {
'install.local_model.d1_downloading': 'Karar modeli D1 indiriliyor · %{progress}',
'install.local_model.d1_paused': 'D1, %{progress} noktasında duraklatıldı.',
'install.local_model.d1_ready': 'D1 hazır; WebBrain’in “Bu görev bitti mi?” gibi hızlı sorularını bu cihazda yanıtlıyor.',
- 'install.local_model.d1_saved': 'D1 bu cihaza kaydedildi. Kullanmak için Ayarlar’da Karar modelleri bölümünden seç.',
+ 'install.local_model.d1_saved': 'D1 bu cihaza kaydedildi.',
'install.local_model.d1_unsupported': 'Bu GPU D1’i çalıştıramıyor; WebBrain her zamanki kontrollerini sürdürüyor.',
'install.local_model.d1_error': 'D1 durdu: {error}',
diff --git a/src/chrome/src/ui/locales/uk.js b/src/chrome/src/ui/locales/uk.js
index 71dc8a90e..6629f4fad 100644
--- a/src/chrome/src/ui/locales/uk.js
+++ b/src/chrome/src/ui/locales/uk.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'Завантаження D1, моделі рішень · {progress}%',
'install.local_model.d1_paused': 'D1 призупинено на {progress}%.',
'install.local_model.d1_ready': 'D1 готова й просто на цьому пристрої відповідає на короткі запитання WebBrain, як-от «Завдання виконано?».',
- 'install.local_model.d1_saved': 'D1 збережено на цьому пристрої. Щоб її використовувати, виберіть її в Налаштуваннях, у розділі «Моделі рішень».',
+ 'install.local_model.d1_saved': 'D1 збережено на цьому пристрої.',
'install.local_model.d1_unsupported': 'Цей GPU не може запустити D1, тож WebBrain лишає свої звичайні перевірки.',
'install.local_model.d1_error': 'D1 зупинилася: {error}',
diff --git a/src/chrome/src/ui/locales/vi.js b/src/chrome/src/ui/locales/vi.js
index 16cb4ce24..dc5079fc1 100644
--- a/src/chrome/src/ui/locales/vi.js
+++ b/src/chrome/src/ui/locales/vi.js
@@ -125,7 +125,7 @@ export default {
'install.local_model.d1_downloading': 'Đang tải D1, mô hình quyết định · {progress}%',
'install.local_model.d1_paused': 'D1 đã tạm dừng ở {progress}%.',
'install.local_model.d1_ready': 'D1 đã sẵn sàng và trả lời ngay trên thiết bị này những câu hỏi nhanh của WebBrain, như “Tác vụ này xong chưa?”.',
- 'install.local_model.d1_saved': 'D1 đã được lưu trên thiết bị này. Để dùng, hãy chọn nó trong Cài đặt, mục Mô hình quyết định.',
+ 'install.local_model.d1_saved': 'D1 đã được lưu trên thiết bị này.',
'install.local_model.d1_unsupported': 'GPU này không chạy được D1, nên WebBrain giữ các bước kiểm tra thông thường.',
'install.local_model.d1_error': 'D1 đã dừng: {error}',
diff --git a/src/chrome/src/ui/locales/zh.js b/src/chrome/src/ui/locales/zh.js
index ef9e28343..bbb5c68b8 100644
--- a/src/chrome/src/ui/locales/zh.js
+++ b/src/chrome/src/ui/locales/zh.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': '正在下载决策模型 D1 · {progress}%',
'install.local_model.d1_paused': 'D1 已在 {progress}% 处暂停。',
'install.local_model.d1_ready': 'D1 已就绪,会在此设备上回答 WebBrain 的快速问题,例如“这个任务完成了吗?”。',
- 'install.local_model.d1_saved': 'D1 已保存在此设备上。要使用它,请在设置的“决策模型”中选择。',
+ 'install.local_model.d1_saved': 'D1 已保存在此设备上。',
'install.local_model.d1_unsupported': '此 GPU 无法运行 D1,因此 WebBrain 继续使用常规检查。',
'install.local_model.d1_error': 'D1 已停止:{error}',
diff --git a/src/chrome/src/ui/settings.js b/src/chrome/src/ui/settings.js
index 6c1a06efa..d5d6ff2c5 100644
--- a/src/chrome/src/ui/settings.js
+++ b/src/chrome/src/ui/settings.js
@@ -267,9 +267,10 @@ function syncWebgpuDecisionProvider() {
if (systemOneApiKeyInput) systemOneApiKeyInput.disabled = fixed;
}
-// Auto, On or Off. Auto uses Compass's managed model while Compass is
-// the chat provider. Only On shows the provider fields and the per-decision
-// switches, so the card asks nothing until someone wants to configure it.
+// Auto, On or Off. Auto uses a downloaded D1, or else Compass's managed model
+// while Compass is the chat provider. Only On shows the provider fields and the
+// per-decision switches, so the card asks nothing until someone wants to
+// configure it.
const decisionModeInputs = [...document.querySelectorAll('input[name="decision-mode"]')];
function selectedDecisionMode() {
return decisionModeInputs.find(input => input.checked)?.value || 'auto';
@@ -309,12 +310,12 @@ async function syncDecisionStatus() {
// Strict Secret Mode keeps page content away from every decision model, so Auto has nothing to use.
const strict = strictSecretModeOn;
const compass = !strict && activeProviderIsCompass();
- // Without Compass, Auto uses D1 once it is downloaded (decision-availability.js).
- const local = !strict && !compass
+ // Auto uses D1 once it is downloaded, Compass or not (decision-availability.js).
+ const local = !strict
&& (await chrome.storage.local.get(D1_CONSENT_KEY).catch(() => ({})))?.[D1_CONSENT_KEY] === D1_CONSENT_VERSION
&& await d1LocalAssistReady();
if (sequence !== decisionStatusSequence || selectedDecisionMode() !== 'auto') return;
- const key = strict ? 'st.decision.status.strict' : compass ? 'st.decision.status.compass' : local ? 'st.decision.status.local' : 'st.decision.status.none';
+ const key = strict ? 'st.decision.status.strict' : local ? 'st.decision.status.local' : compass ? 'st.decision.status.compass' : 'st.decision.status.none';
if (status) {
status.dataset.i18n = key;
status.dataset.state = compass || local ? 'active' : 'inactive';
@@ -335,7 +336,7 @@ for (const input of decisionModeInputs) {
const legacyFeatures = materializeLegacyDecisionFeatures(await chrome.storage.local.get(DECISION_SETTINGS_KEYS));
await chrome.storage.local.set({ ...legacyFeatures, [DECISION_MODE_KEY]: mode, systemOneEnabled: mode === 'on' });
// Off ends D1's Download or Load; Auto keeps it, since Auto uses a
- // downloaded D1 while Compass is not the chat provider.
+ // downloaded D1.
if (mode === 'off') await sendToBackground('d1_control', { command: 'reset' }).catch(() => {});
showSystemOneResult('ok', t('st.providers.saved'));
});
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index 71cbfa5be..de573c895 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -8863,7 +8863,7 @@ export class Agent extends LoopDetector {
async _jevSettings(tabId, provider = this._activeProvider(tabId), feature = 'semantic') {
const stored = await browser.storage.local.get([...JEV_FAST_KEYS, ...DECISION_SETTINGS_KEYS]);
const compass = provider?.config?.providerName === 'webbrain-cloud' ? provider.config : null;
- const decisionConfig = await resolveCurrentDecisionConfig(stored, compass);
+ const decisionConfig = await resolveCurrentDecisionConfig(stored, compass, { feature });
return decisionFeatureEnabled(decisionConfig, feature) && !this.strictSecretMode && (decisionConfig.local || globalThis.navigator?.onLine !== false) ? { ...stored, decisionConfig } : null;
}
diff --git a/src/firefox/src/agent/completion-runtime.js b/src/firefox/src/agent/completion-runtime.js
index ed732128f..28dcf0700 100644
--- a/src/firefox/src/agent/completion-runtime.js
+++ b/src/firefox/src/agent/completion-runtime.js
@@ -331,7 +331,7 @@ async function evaluateBrowserCompletion(agent, tabId, options = {}) {
}
const stored = await chrome.storage.local.get(DECISION_SETTINGS_KEYS);
const compass = provider.config?.providerName === 'webbrain-cloud' ? provider.config : null;
- const config = await resolveCurrentDecisionConfig(stored, compass);
+ const config = await resolveCurrentDecisionConfig(stored, compass, { feature: 'done' });
const context = agent.systemOneContext(tabId);
const signal = agent._runAbortSignal(tabId);
const guard = agent._planExecutionGuards.get(tabId);
@@ -343,7 +343,7 @@ async function evaluateBrowserCompletion(agent, tabId, options = {}) {
&& (!calculationEvidence || captureCalculationEvidence(agent, tabId, calculationEvidence))
&& scope === JSON.stringify([agent.completionInvariants.get(tabId)?.runToken, agent.completionInvariants.get(tabId)?.lastAction?.sequence, agent._progressTaskKeyHash(tabId), config.provider, config.model, config.url, provider.model, provider.supportsVision, JSON.stringify(config)]);
const currentIdentity = async evidence => !!evidence.identity && currentRun()
- && JSON.stringify(await resolveCurrentDecisionConfig(await chrome.storage.local.get(DECISION_SETTINGS_KEYS), compass)) === JSON.stringify(config)
+ && JSON.stringify(await resolveCurrentDecisionConfig(await chrome.storage.local.get(DECISION_SETTINGS_KEYS), compass, { feature: 'done' })) === JSON.stringify(config)
&& evidence.identity === await agent._completionDocumentStamp(tabId, true) && currentRun();
const current = async evidence => {
if (!await currentIdentity(evidence)) return false;
diff --git a/src/firefox/src/agent/decision-availability.js b/src/firefox/src/agent/decision-availability.js
index e5f40bc84..558e2133e 100644
--- a/src/firefox/src/agent/decision-availability.js
+++ b/src/firefox/src/agent/decision-availability.js
@@ -2,7 +2,7 @@ import { decisionNeedsLocalAssist, resolveDecisionConfig } from './decision-conf
import { D1_KEEP_LOADED_KEY } from '../providers/d1-config.js';
import { d1PackageReady } from '../providers/d1-cache.js';
-// Auto without Compass uses D1 once its package is downloaded and verified,
+// Auto uses D1 once its package is downloaded and verified, Compass or not,
// while the user's Download or Load stands: Unload, Remove cached model and
// switching decisions Off end it (background.js d1_control). The lookup is one
// storage read and D1's ready marker, without the offscreen document or the
@@ -15,8 +15,9 @@ export async function d1LocalAssistReady(api = globalThis.browser || globalThis.
} catch { return false; }
}
-// The decision configuration that applies right now.
-export async function resolveCurrentDecisionConfig(stored = {}, compass = null) {
- const localAssistReady = decisionNeedsLocalAssist(stored, compass) && await d1LocalAssistReady();
- return resolveDecisionConfig(stored, compass, { localAssistReady });
+// The decision configuration that applies right now, for `feature` when the
+// caller names the decision it asks (decision-config.js DECISION_FEATURES).
+export async function resolveCurrentDecisionConfig(stored = {}, compass = null, { feature = null } = {}) {
+ const localAssistReady = decisionNeedsLocalAssist(stored, compass, feature) && await d1LocalAssistReady();
+ return resolveDecisionConfig(stored, compass, { localAssistReady, feature });
}
diff --git a/src/firefox/src/agent/decision-config.js b/src/firefox/src/agent/decision-config.js
index be2b8e1bf..367c22efb 100644
--- a/src/firefox/src/agent/decision-config.js
+++ b/src/firefox/src/agent/decision-config.js
@@ -30,12 +30,16 @@ export const WEBGPU_CHAT_DECISION_MODEL = 'webbrain-one/Ternary-Bonsai-2-2B-ONNX
const NO_DECISION_FEATURES = Object.freeze(Object.fromEntries(DECISION_FEATURES.map(feature => [feature, false])));
// Auto with Compass keeps what Compass did before modes existed: completion
-// checks and semantic decisions on its managed model.
+// checks and semantic decisions on its managed model. A downloaded D1 takes
+// the completion checks (AUTO_LOCAL_FEATURES).
const AUTO_COMPASS_FEATURES = Object.freeze({ ...NO_DECISION_FEATURES, done: true, semantic: true });
-// Auto with D1 downloaded and no Compass: the checks D1 answers by itself, the
-// ones the in-browser chat model answered before its decisions were disabled.
-// Fast classifications, fast browser actions and semantic decisions need an
-// explicit On, so the experimental and guard-facing paths stay opt-in.
+// Auto with D1 downloaded: the checks D1 answers by itself, the ones the
+// in-browser chat model answered before its decisions were disabled. Once D1
+// is downloaded it is Auto's decision model for them, in place of Compass's
+// managed model too. Fast classifications, fast browser actions and semantic
+// decisions need an explicit On, so the experimental and guard-facing paths
+// stay opt-in; while Compass is the chat provider, its managed model keeps
+// semantic decisions.
const AUTO_LOCAL_FEATURES = Object.freeze({ ...NO_DECISION_FEATURES, done: true, watch: true, completion: true });
// A saved mode wins. Profiles saved before modes existed map an enabled
@@ -46,11 +50,13 @@ export function resolveDecisionMode(stored = {}) {
return stored?.systemOneEnabled === true ? 'on' : 'auto';
}
-// Only Auto without Compass, after D1's experimental-model consent, looks for
-// D1's download (decision-availability.js), so callers can skip that lookup
-// otherwise.
-export function decisionNeedsLocalAssist(stored = {}, compass = null) {
- return resolveDecisionMode(stored) === 'auto' && !compass && stored?.[D1_CONSENT_KEY] === D1_CONSENT_VERSION;
+// Only Auto, after D1's experimental-model consent, looks for D1's download
+// (decision-availability.js), so callers can skip that lookup otherwise. While
+// Compass is the chat provider, D1 takes only the decisions it answers in Auto:
+// `feature` names the one asked for, and none named means those checks.
+export function decisionNeedsLocalAssist(stored = {}, compass = null, feature = null) {
+ return resolveDecisionMode(stored) === 'auto' && stored?.[D1_CONSENT_KEY] === D1_CONSENT_VERSION
+ && (!compass || feature == null || AUTO_LOCAL_FEATURES[feature] === true);
}
// Whether the resolved configuration answers this decision. Every caller asks
@@ -85,12 +91,12 @@ function onDecisionFeatures(stored, config, legacy) {
// answered, so Settings and model discovery see the same configuration.
// Downloaded chat/vision weights do not establish reliable decision behavior;
// `localAssistReady` says D1, a decision model, is downloaded and the user's
-// Download or Load stands (decision-availability.js). Only Auto without
-// Compass reads it.
-export function resolveDecisionConfig(stored = {}, compass = null, { localAssistReady = false } = {}) {
+// Download or Load stands (decision-availability.js). Only Auto reads it, and
+// with Compass only for the decisions D1 answers there (`feature`).
+export function resolveDecisionConfig(stored = {}, compass = null, { localAssistReady = false, feature = null } = {}) {
stored = stored || {};
const mode = resolveDecisionMode(stored);
- if (localAssistReady === true && decisionNeedsLocalAssist(stored, compass)) {
+ if (localAssistReady === true && decisionNeedsLocalAssist(stored, compass, feature)) {
const config = selectedDecisionConfig({ ...stored, decisionProvider: 'webgpu_d1', decisionVisionMode: 'auto' }, null, true);
return { ...config, doneEnabled: true, mode, source: 'local_assist', features: { ...AUTO_LOCAL_FEATURES } };
}
diff --git a/src/firefox/src/agent/scheduler.js b/src/firefox/src/agent/scheduler.js
index dadce56f6..330f50322 100644
--- a/src/firefox/src/agent/scheduler.js
+++ b/src/firefox/src/agent/scheduler.js
@@ -1712,7 +1712,7 @@ export class ScheduledJobManager {
|| null;
const compass = runMeta.compass
?? (String(activeProvider?.config?.providerName || '').trim().toLowerCase() === 'webbrain-cloud' ? activeProvider.config : null);
- const config = runMeta.decisionConfig || await resolveCurrentDecisionConfig(settings, compass);
+ const config = runMeta.decisionConfig || await resolveCurrentDecisionConfig(settings, compass, { feature: isWatch ? 'watch' : 'completion' });
if (!this.systemOneJudge || !decisionFeatureEnabled(config, isWatch ? 'watch' : 'completion')) return skip('disabled');
if (settings.strictSecretMode || runMeta.sidecarAllowed === false || runMeta.signal?.aborted) return skip('unavailable');
const state = systemOneEvidenceState(job.prompt || job.resumeInstruction || job.reason || '', runMeta.evidence, isWatch ? job.watch?.systemOneBaseline : null);
diff --git a/src/firefox/src/background.js b/src/firefox/src/background.js
index 3a2b9f13c..f4dc5c299 100644
--- a/src/firefox/src/background.js
+++ b/src/firefox/src/background.js
@@ -8,9 +8,8 @@ import { D1_CONSENT_KEY, D1_CONSENT_VERSION, D1_KEEP_LOADED_KEY } from './provid
// D1's Worker and GPU memory are released when decisions are switched Off,
// another decision provider is saved, consent changes or Strict Secret Mode
// starts. Leaving On for Auto keeps D1, loaded or still downloading, while the
-// user's Download or Load request stands: Auto uses it once it is downloaded,
-// unless Compass is the chat provider (decision-availability.js), and Unload
-// on the Providers page releases it.
+// user's Download or Load request stands: Auto uses it once it is downloaded
+// (decision-availability.js), and Unload on the Providers page releases it.
function releaseD1OnDecisionChange(changes, area) {
if (area !== 'local') return;
const reset = () => { void d1Request('reset').catch(() => {}); };
@@ -3067,8 +3066,8 @@ async function handleFailureRecoveryResponse(msg, sender) {
}
// Whether D1 answers this profile's decisions now, for the install guide: an
-// explicit On selection, or Auto once D1 is downloaded while Compass is not the
-// chat provider (decision-availability.js).
+// explicit On selection, or Auto once D1 is downloaded, whatever the chat
+// provider (decision-availability.js).
async function d1UsedForDecisions(api) {
try {
if (agent.strictSecretMode) return false;
diff --git a/src/firefox/src/ui/install.js b/src/firefox/src/ui/install.js
index 7c28a84d2..f9697d893 100644
--- a/src/firefox/src/ui/install.js
+++ b/src/firefox/src/ui/install.js
@@ -224,14 +224,21 @@ export async function pointWebgpuProviderAtModel(modelId, { runtime = globalThis
}
// ── D1, the on-device decision model ─────────────────────────────────────
-// The same button downloads D1, WebBrain's experimental decision model, next
-// to the chat model. D1 has its own worker, so both downloads run at once, and
-// D1 loads when its files are in. The click is the consent the note asks for.
-// The guide writes no decision settings: Auto uses a downloaded D1 for its
-// checks while Compass is not the chat provider (decision-availability.js).
+// The same button downloads D1, WebBrain's experimental decision model, and
+// then the chat model: D1 first, in its own worker, and the chat model once D1
+// is ready or saved, or cannot be downloaded here. D1 loads when its files are
+// in. The click is the consent the note asks for. The guide writes no decision
+// settings: once D1 is downloaded, Auto, the default mode, uses it for its
+// checks, whatever the chat provider (decision-availability.js).
const D1_POLL_MS = 1500;
const D1_POLLING_STATUSES = new Set(['checking', 'downloading']);
+// D1's download is under way: checking the GPU, transferring or paused. The
+// chat model waits for it.
+const D1_TRANSFER_STATUSES = new Set(['checking', 'downloading', 'paused']);
+// Chat model states in which a D1 transfer has the button: the chat model is
+// not downloading, so D1 goes first.
+const D1_FIRST_CHAT_STATUSES = new Set(['not-downloaded', 'error', 'busy', 'paused']);
export function normalizeD1Snapshot(snapshot = {}) {
const raw = String(snapshot?.status || '');
@@ -254,6 +261,8 @@ export function d1View(state = {}) {
case 'downloading': return { statusKey: 'install.local_model.d1_downloading', progress: state.progress };
case 'paused': return { statusKey: 'install.local_model.d1_paused', progress: state.progress };
// Saved but not loaded yet, D1 loads for the next decision it answers.
+ // A profile that turned decisions Off or chose another model under On is
+ // only told that D1 is on this device.
case 'ready': case 'saved': return { statusKey: state.usedForDecisions ? 'install.local_model.d1_ready' : 'install.local_model.d1_saved' };
case 'unsupported': return { statusKey: 'install.local_model.d1_unsupported' };
case 'error': return { statusKey: 'install.local_model.d1_error', isError: true };
@@ -262,13 +271,25 @@ export function d1View(state = {}) {
}
/**
- * The shared button: the chat model's, until that model is ready and needs
- * nothing more. Then the same button finishes D1's download, so a D1 that is
- * not downloaded yet, was paused or stopped with an error can still be
- * started, resumed or retried from the guide.
+ * The shared button. D1 downloads first: while its download is under way and
+ * the chat model is not downloading, the button and the progress bar follow
+ * D1 (`displayState` is what the block shows), and the chat model's own line
+ * keeps its own progress (`statusProgress`). Then the button is the chat
+ * model's, until that model is ready and needs nothing more; the same button
+ * then finishes D1's download, so a D1 that is not downloaded yet, was paused
+ * or stopped with an error can still be started, resumed or retried.
*/
export function localModelButtonView(view, chatStatus, d1State) {
- if (chatStatus !== 'ready' || !d1State) return view;
+ if (!d1State) return view;
+ if (D1_FIRST_CHAT_STATUSES.has(chatStatus) && D1_TRANSFER_STATUSES.has(d1State.status)) {
+ const d1 = { statusProgress: view.progress, progress: Math.round(Number(d1State.progress) || 0) };
+ switch (d1State.status) {
+ case 'checking': return { ...view, ...d1, labelKey: 'install.local_model.download', action: null, progress: null, displayState: 'checking' };
+ case 'downloading': return { ...view, ...d1, labelKey: 'install.local_model.pause', action: 'd1-pause', displayState: 'downloading' };
+ default: return { ...view, ...d1, labelKey: 'install.local_model.resume', action: 'd1-start', displayState: 'paused' };
+ }
+ }
+ if (chatStatus !== 'ready') return view;
switch (d1State.status) {
case 'idle': return { ...view, labelKey: 'install.local_model.download', action: 'd1-start' };
case 'paused': return { ...view, labelKey: 'install.local_model.resume', action: 'd1-start' };
@@ -386,18 +407,35 @@ export function initializeLocalModelDownload({
let pollTimer = null;
let disposed = false;
let rendered = false;
- // D1's own changes redraw the button once this controller has drawn it.
- const d1 = initializeD1Download({ documentLike, runtime, translate, pollMs, onChange: () => { if (rendered) render(); } });
+ // Set by the click that downloads both models: the chat model starts once
+ // D1's download is over (ready or saved, unsupported, or stopped with an
+ // error). A Pause of D1 keeps it set, so Resume carries on to the chat model.
+ let chatAfterD1 = false;
+ // The person paused D1 here. A D1 transfer stopped any other way (no bytes
+ // for two minutes, its time limit, a Stop on the Providers page) does not
+ // hold the chat model back.
+ let d1PausedHere = false;
+ // D1's own changes redraw the button once this controller has drawn it,
+ // and the end of D1's download starts the chat model.
+ const d1 = initializeD1Download({
+ documentLike, runtime, translate, pollMs,
+ onChange: () => {
+ if (rendered) render();
+ continueAfterD1();
+ },
+ });
const buttonView = () => localModelButtonView(localModelView(state), state.status, d1?.getState());
const render = () => {
rendered = true;
const view = buttonView();
- root.dataset.state = state.status;
+ root.dataset.state = view.displayState || state.status;
if (label) label.textContent = translate(view.labelKey);
if (button) {
button.disabled = inFlight || !view.action;
- const d1Busy = state.status === 'ready' && ['checking', 'downloading'].includes(d1?.getState().status);
+ const d1Status = d1?.getState().status;
+ const d1Busy = ['checking', 'downloading'].includes(d1Status)
+ && (state.status === 'ready' || D1_FIRST_CHAT_STATUSES.has(state.status));
if (inFlight || d1Busy || ['checking', 'downloading', 'stopping'].includes(state.status)) button.setAttribute('aria-busy', 'true');
else button.removeAttribute('aria-busy');
}
@@ -407,7 +445,7 @@ export function initializeLocalModelDownload({
bar.style?.setProperty?.('--local-model-progress', `${view.progress ?? 0}%`);
}
if (statusLine) {
- statusLine.textContent = view.statusKey ? translate(view.statusKey, { progress: view.progress ?? 0, error: state.error || '' }) : '';
+ statusLine.textContent = view.statusKey ? translate(view.statusKey, { progress: view.statusProgress ?? view.progress ?? 0, error: state.error || '' }) : '';
statusLine.classList?.toggle?.('is-error', view.isError === true);
}
};
@@ -423,6 +461,7 @@ export function initializeLocalModelDownload({
state = { progress: 0, error: '', ...next };
render();
schedulePoll();
+ continueAfterD1();
};
async function refresh({ quiet = false } = {}) {
@@ -436,12 +475,45 @@ export function initializeLocalModelDownload({
}
}
+ // The second download: the chat model, once D1's is over.
+ function continueAfterD1() {
+ if (!chatAfterD1 || inFlight || disposed) return;
+ const d1Status = d1?.getState().status;
+ if (['checking', 'downloading'].includes(d1Status) || (d1Status === 'paused' && d1PausedHere)) return;
+ // Another model holds the WebGPU download slot: start when it is free.
+ if (['busy', 'checking'].includes(state.status)) return;
+ chatAfterD1 = false;
+ // A chat model already downloading, paused elsewhere or ready is left as it is.
+ if (['not-downloaded', 'error'].includes(state.status)) void startChatModel();
+ }
+
+ async function startChatModel() {
+ inFlight = true;
+ render();
+ try {
+ try {
+ await pointWebgpuProviderAtModel(modelId, { runtime });
+ } catch {
+ // Only cosmetic for Settings; the download itself does not need it.
+ }
+ await backgroundCommand(runtime, 'start_webgpu_download', { model: modelId });
+ } catch (error) {
+ inFlight = false;
+ setState({ status: 'error', error: error?.message || String(error) });
+ return;
+ }
+ inFlight = false;
+ await refresh();
+ }
+
button?.addEventListener('click', async () => {
const view = buttonView();
if (!view.action || inFlight) return;
inFlight = true;
if (view.action === 'd1-start' || view.action === 'd1-pause') {
- // The chat model is ready; only D1 is downloaded, paused or resumed.
+ // Only D1 is downloaded, paused or resumed: before the chat model while
+ // D1 goes first, or after it once the chat model is ready.
+ d1PausedHere = view.action === 'd1-pause';
render();
try {
await (view.action === 'd1-start' ? d1.start() : d1.pause());
@@ -449,40 +521,47 @@ export function initializeLocalModelDownload({
inFlight = false;
render();
}
+ continueAfterD1();
return;
}
try {
if (view.action === 'pause') {
render();
+ if (['checking', 'downloading'].includes(d1?.getState().status)) d1PausedHere = true;
void d1?.pause();
await backgroundCommand(runtime, 'pause_webgpu_download');
+ } else if (view.action === 'resume') {
+ render();
+ await backgroundCommand(runtime, 'start_webgpu_download', { model: modelId });
} else {
- if (view.action === 'start') {
- state = { status: 'checking', progress: 0, error: '' };
- render();
- // A browser without hardware WebGPU could download the files but never
- // run them, so check the adapter first (no weights are fetched).
- const probe = await backgroundCommand(runtime, 'test_provider', { providerId: 'webgpu' });
- if (probe?.ok === false) {
- inFlight = false;
- setState({ status: 'unsupported', error: String(probe.error || '') });
- return;
- }
- try {
- await pointWebgpuProviderAtModel(modelId, { runtime });
- } catch {
- // Only cosmetic for Settings; the download itself does not need it.
- }
- } else {
+ state = { status: 'checking', progress: 0, error: '' };
+ render();
+ // A browser without hardware WebGPU could download the files but never
+ // run them, so check the adapter first (no weights are fetched).
+ const probe = await backgroundCommand(runtime, 'test_provider', { providerId: 'webgpu' });
+ if (probe?.ok === false) {
+ inFlight = false;
+ setState({ status: 'unsupported', error: String(probe.error || '') });
+ return;
+ }
+ // D1 downloads first; its line reports it, and the chat model follows
+ // (continueAfterD1). The button stays busy until D1's download has
+ // started, so a Pause always finds D1's transfer to stop.
+ chatAfterD1 = true;
+ d1PausedHere = false;
+ if (d1) {
+ state = { status: 'not-downloaded', progress: 0, error: '' };
render();
+ await d1.start();
+ }
+ // Nothing of D1's to wait for (no D1 here, already saved, or a GPU it
+ // cannot use): the chat model goes now.
+ if (!D1_TRANSFER_STATUSES.has(d1?.getState().status)) {
+ chatAfterD1 = false;
+ inFlight = false;
+ await startChatModel();
+ return;
}
- // D1 downloads alongside, in its own worker; its line reports it. The
- // button stays busy until both downloads have started, so a Pause
- // always finds D1's transfer to stop.
- await Promise.all([
- d1?.start(),
- backgroundCommand(runtime, 'start_webgpu_download', { model: modelId }),
- ]);
}
} catch (error) {
inFlight = false;
diff --git a/src/firefox/src/ui/locales/ar.js b/src/firefox/src/ui/locales/ar.js
index e974ef131..87b7c3a2a 100644
--- a/src/firefox/src/ui/locales/ar.js
+++ b/src/firefox/src/ui/locales/ar.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'جارٍ تنزيل D1، نموذج القرار · {progress}%',
'install.local_model.d1_paused': 'توقف D1 مؤقتًا عند {progress}%.',
'install.local_model.d1_ready': 'D1 جاهز ويجيب على هذا الجهاز عن أسئلة WebBrain السريعة، مثل «هل انتهت هذه المهمة؟».',
- 'install.local_model.d1_saved': 'تم حفظ D1 على هذا الجهاز. لاستخدامه، اختره في الإعدادات ضمن نماذج القرار.',
+ 'install.local_model.d1_saved': 'تم حفظ D1 على هذا الجهاز.',
'install.local_model.d1_unsupported': 'لا تستطيع وحدة معالجة الرسومات هذه تشغيل D1، لذا يواصل WebBrain فحوصه المعتادة.',
'install.local_model.d1_error': 'توقف D1: {error}',
diff --git a/src/firefox/src/ui/locales/bn.js b/src/firefox/src/ui/locales/bn.js
index 469a365d5..7f4a9c244 100644
--- a/src/firefox/src/ui/locales/bn.js
+++ b/src/firefox/src/ui/locales/bn.js
@@ -125,7 +125,7 @@ export default {
'install.local_model.d1_downloading': 'ডিসিশন মডেল D1 ডাউনলোড হচ্ছে · {progress}%',
'install.local_model.d1_paused': 'D1 {progress}%-এ বিরতি দেওয়া হয়েছে।',
'install.local_model.d1_ready': 'D1 প্রস্তুত, এবং এই ডিভাইসেই WebBrain-এর দ্রুত প্রশ্নের উত্তর দেয়, যেমন “এই কাজটি কি শেষ?”।',
- 'install.local_model.d1_saved': 'D1 এই ডিভাইসে সংরক্ষিত আছে। ব্যবহার করতে সেটিংসে ডিসিশন মডেল অংশ থেকে এটি বেছে নিন।',
+ 'install.local_model.d1_saved': 'D1 এই ডিভাইসে সংরক্ষিত আছে।',
'install.local_model.d1_unsupported': 'এই GPU D1 চালাতে পারে না, তাই WebBrain তার সাধারণ চেকগুলোই রাখে।',
'install.local_model.d1_error': 'D1 থেমে গেছে: {error}',
diff --git a/src/firefox/src/ui/locales/de.js b/src/firefox/src/ui/locales/de.js
index 1bd599bc1..ede99f71e 100644
--- a/src/firefox/src/ui/locales/de.js
+++ b/src/firefox/src/ui/locales/de.js
@@ -127,7 +127,7 @@ export default {
'install.local_model.d1_downloading': 'D1, das Entscheidungsmodell, wird heruntergeladen · {progress} %',
'install.local_model.d1_paused': 'D1 bei {progress} % pausiert.',
'install.local_model.d1_ready': 'D1 ist bereit und beantwortet die kurzen Fragen von WebBrain, etwa „Ist diese Aufgabe erledigt?“, auf diesem Gerät.',
- 'install.local_model.d1_saved': 'D1 ist auf diesem Gerät gespeichert. Um es zu nutzen, wählen Sie es in den Einstellungen unter Entscheidungsmodelle.',
+ 'install.local_model.d1_saved': 'D1 ist auf diesem Gerät gespeichert.',
'install.local_model.d1_unsupported': 'Diese GPU kann D1 nicht ausführen, daher behält WebBrain seine üblichen Prüfungen bei.',
'install.local_model.d1_error': 'D1 wurde gestoppt: {error}',
'sp.status.disconnected': 'Getrennt',
diff --git a/src/firefox/src/ui/locales/en.js b/src/firefox/src/ui/locales/en.js
index e97b0aedb..f7b891745 100644
--- a/src/firefox/src/ui/locales/en.js
+++ b/src/firefox/src/ui/locales/en.js
@@ -125,7 +125,7 @@ export default {
'install.local_model.d1_downloading': 'Downloading D1, the decision model · {progress}%',
'install.local_model.d1_paused': 'D1 paused at {progress}%.',
'install.local_model.d1_ready': 'D1 is ready and answers WebBrain’s quick questions, such as “Is this task finished?”, on this device.',
- 'install.local_model.d1_saved': 'D1 is saved on this device. To use it, choose it in Settings under Decision models.',
+ 'install.local_model.d1_saved': 'D1 is saved on this device.',
'install.local_model.d1_unsupported': 'This GPU can’t run D1, so WebBrain keeps its usual checks.',
'install.local_model.d1_error': 'D1 stopped: {error}',
diff --git a/src/firefox/src/ui/locales/es.js b/src/firefox/src/ui/locales/es.js
index 3644f6a9b..19d73caab 100644
--- a/src/firefox/src/ui/locales/es.js
+++ b/src/firefox/src/ui/locales/es.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'Descargando D1, el modelo de decisión · {progress} %',
'install.local_model.d1_paused': 'D1 en pausa al {progress} %.',
'install.local_model.d1_ready': 'D1 está listo y responde en este dispositivo a las preguntas rápidas de WebBrain, como «¿Terminó esta tarea?».',
- 'install.local_model.d1_saved': 'D1 está guardado en este dispositivo. Para usarlo, elígelo en Ajustes, en Modelos de decisión.',
+ 'install.local_model.d1_saved': 'D1 está guardado en este dispositivo.',
'install.local_model.d1_unsupported': 'Esta GPU no puede ejecutar D1, así que WebBrain mantiene sus comprobaciones habituales.',
'install.local_model.d1_error': 'D1 se detuvo: {error}',
diff --git a/src/firefox/src/ui/locales/fa.js b/src/firefox/src/ui/locales/fa.js
index f51b5f9a6..6174f0b2e 100644
--- a/src/firefox/src/ui/locales/fa.js
+++ b/src/firefox/src/ui/locales/fa.js
@@ -125,7 +125,7 @@ export default {
'install.local_model.d1_downloading': 'در حال دانلود D1، مدل تصمیم · {progress}%',
'install.local_model.d1_paused': 'D1 در {progress}% متوقف شد.',
'install.local_model.d1_ready': 'D1 آماده است و روی همین دستگاه به پرسش‌های کوتاه WebBrain، مثل «آیا این کار تمام شد؟»، پاسخ می‌دهد.',
- 'install.local_model.d1_saved': 'D1 روی این دستگاه ذخیره شد. برای استفاده، آن را در تنظیمات، بخش مدل‌های تصمیم، انتخاب کنید.',
+ 'install.local_model.d1_saved': 'D1 روی این دستگاه ذخیره شد.',
'install.local_model.d1_unsupported': 'این GPU نمی‌تواند D1 را اجرا کند، بنابراین WebBrain بررسی‌های معمول خود را ادامه می‌دهد.',
'install.local_model.d1_error': 'D1 متوقف شد: {error}',
diff --git a/src/firefox/src/ui/locales/fr.js b/src/firefox/src/ui/locales/fr.js
index f732f67b0..1790afa62 100644
--- a/src/firefox/src/ui/locales/fr.js
+++ b/src/firefox/src/ui/locales/fr.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'Téléchargement de D1, le modèle de décision · {progress} %',
'install.local_model.d1_paused': 'D1 en pause à {progress} %.',
'install.local_model.d1_ready': 'D1 est prêt et répond sur cet appareil aux questions rapides de WebBrain, comme « Cette tâche est-elle terminée ? ».',
- 'install.local_model.d1_saved': 'D1 est enregistré sur cet appareil. Pour l’utiliser, choisissez-le dans les Paramètres, sous Modèles de décision.',
+ 'install.local_model.d1_saved': 'D1 est enregistré sur cet appareil.',
'install.local_model.d1_unsupported': 'Ce GPU ne peut pas exécuter D1 : WebBrain garde ses vérifications habituelles.',
'install.local_model.d1_error': 'D1 s’est arrêté : {error}',
diff --git a/src/firefox/src/ui/locales/he.js b/src/firefox/src/ui/locales/he.js
index c08ba2837..456bed035 100644
--- a/src/firefox/src/ui/locales/he.js
+++ b/src/firefox/src/ui/locales/he.js
@@ -141,7 +141,7 @@ export default {
'install.local_model.d1_downloading': 'מוריד את D1, מודל ההחלטות · {progress}%',
'install.local_model.d1_paused': 'D1 הושהה ב-{progress}%.',
'install.local_model.d1_ready': 'D1 מוכן ועונה במכשיר הזה על השאלות המהירות של WebBrain, כמו „האם המשימה הסתיימה?”.',
- 'install.local_model.d1_saved': 'D1 נשמר במכשיר הזה. כדי להשתמש בו, בחרו בו בהגדרות, תחת מודלי החלטות.',
+ 'install.local_model.d1_saved': 'D1 נשמר במכשיר הזה.',
'install.local_model.d1_unsupported': 'ה-GPU הזה לא יכול להריץ את D1, ולכן WebBrain ממשיך בבדיקות הרגילות שלו.',
'install.local_model.d1_error': 'D1 נעצר: {error}',
"sp.status.disconnected": "לא מחובר",
diff --git a/src/firefox/src/ui/locales/hi.js b/src/firefox/src/ui/locales/hi.js
index 0047cb5eb..fcde98110 100644
--- a/src/firefox/src/ui/locales/hi.js
+++ b/src/firefox/src/ui/locales/hi.js
@@ -125,7 +125,7 @@ export default {
'install.local_model.d1_downloading': 'निर्णय मॉडल D1 डाउनलोड हो रहा है · {progress}%',
'install.local_model.d1_paused': 'D1 को {progress}% पर रोका गया।',
'install.local_model.d1_ready': 'D1 तैयार है और इसी डिवाइस पर WebBrain के छोटे सवालों के जवाब देता है, जैसे “क्या यह काम पूरा हो गया?”।',
- 'install.local_model.d1_saved': 'D1 इस डिवाइस पर सहेजा गया है। इसे इस्तेमाल करने के लिए सेटिंग्स में निर्णय मॉडल के अंतर्गत चुनें।',
+ 'install.local_model.d1_saved': 'D1 इस डिवाइस पर सहेजा गया है।',
'install.local_model.d1_unsupported': 'यह GPU D1 नहीं चला सकता, इसलिए WebBrain अपनी सामान्य जाँचें जारी रखता है।',
'install.local_model.d1_error': 'D1 रुक गया: {error}',
diff --git a/src/firefox/src/ui/locales/id.js b/src/firefox/src/ui/locales/id.js
index eb91419f3..c46704f86 100644
--- a/src/firefox/src/ui/locales/id.js
+++ b/src/firefox/src/ui/locales/id.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'Mengunduh D1, model keputusan · {progress}%',
'install.local_model.d1_paused': 'D1 dijeda di {progress}%.',
'install.local_model.d1_ready': 'D1 siap dan menjawab pertanyaan cepat WebBrain, seperti “Apakah tugas ini sudah selesai?”, di perangkat ini.',
- 'install.local_model.d1_saved': 'D1 tersimpan di perangkat ini. Untuk memakainya, pilih di Pengaturan, bagian Model keputusan.',
+ 'install.local_model.d1_saved': 'D1 tersimpan di perangkat ini.',
'install.local_model.d1_unsupported': 'GPU ini tidak bisa menjalankan D1, jadi WebBrain tetap memakai pemeriksaan biasanya.',
'install.local_model.d1_error': 'D1 berhenti: {error}',
diff --git a/src/firefox/src/ui/locales/ja.js b/src/firefox/src/ui/locales/ja.js
index 11391106d..725f14f92 100644
--- a/src/firefox/src/ui/locales/ja.js
+++ b/src/firefox/src/ui/locales/ja.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': '判定モデル D1 をダウンロード中 · {progress}%',
'install.local_model.d1_paused': 'D1 を {progress}% で一時停止しました。',
'install.local_model.d1_ready': 'D1 の準備ができました。「このタスクは終わった?」のような WebBrain の簡単な質問に、このデバイス上で答えます。',
- 'install.local_model.d1_saved': 'D1 をこのデバイスに保存しました。使うには、設定の「判定モデル」で選んでください。',
+ 'install.local_model.d1_saved': 'D1 をこのデバイスに保存しました。',
'install.local_model.d1_unsupported': 'この GPU では D1 を実行できないため、WebBrain は通常のチェックを続けます。',
'install.local_model.d1_error': 'D1 が停止しました: {error}',
diff --git a/src/firefox/src/ui/locales/ko.js b/src/firefox/src/ui/locales/ko.js
index a324befb9..be9aae327 100644
--- a/src/firefox/src/ui/locales/ko.js
+++ b/src/firefox/src/ui/locales/ko.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': '결정 모델 D1 다운로드 중 · {progress}%',
'install.local_model.d1_paused': 'D1이 {progress}%에서 일시중지됨.',
'install.local_model.d1_ready': 'D1이 준비되었습니다. "이 작업이 끝났나요?" 같은 WebBrain의 간단한 질문에 이 기기에서 답합니다.',
- 'install.local_model.d1_saved': 'D1이 이 기기에 저장되었습니다. 사용하려면 설정의 결정 모델에서 선택하세요.',
+ 'install.local_model.d1_saved': 'D1이 이 기기에 저장되었습니다.',
'install.local_model.d1_unsupported': '이 GPU에서는 D1을 실행할 수 없어 WebBrain은 평소의 확인을 계속합니다.',
'install.local_model.d1_error': 'D1이 중단되었습니다: {error}',
diff --git a/src/firefox/src/ui/locales/ms.js b/src/firefox/src/ui/locales/ms.js
index fa1799630..0577abbc1 100644
--- a/src/firefox/src/ui/locales/ms.js
+++ b/src/firefox/src/ui/locales/ms.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'Memuat turun D1, model keputusan · {progress}%',
'install.local_model.d1_paused': 'D1 dijeda pada {progress}%.',
'install.local_model.d1_ready': 'D1 sedia dan menjawab soalan pantas WebBrain, seperti “Adakah tugas ini sudah selesai?”, pada peranti ini.',
- 'install.local_model.d1_saved': 'D1 disimpan pada peranti ini. Untuk menggunakannya, pilih dalam Tetapan, di bawah Model keputusan.',
+ 'install.local_model.d1_saved': 'D1 disimpan pada peranti ini.',
'install.local_model.d1_unsupported': 'GPU ini tidak dapat menjalankan D1, jadi WebBrain kekal dengan semakan biasanya.',
'install.local_model.d1_error': 'D1 terhenti: {error}',
diff --git a/src/firefox/src/ui/locales/nl.js b/src/firefox/src/ui/locales/nl.js
index 81037f1e1..cf74f85a2 100644
--- a/src/firefox/src/ui/locales/nl.js
+++ b/src/firefox/src/ui/locales/nl.js
@@ -127,7 +127,7 @@ export default {
'install.local_model.d1_downloading': 'D1, het beslismodel, downloaden · {progress}%',
'install.local_model.d1_paused': 'D1 gepauzeerd bij {progress}%.',
'install.local_model.d1_ready': 'D1 is klaar en beantwoordt op dit apparaat de snelle vragen van WebBrain, zoals ‘Is deze taak klaar?’.',
- 'install.local_model.d1_saved': 'D1 is op dit apparaat opgeslagen. Kies het in Instellingen onder Beslismodellen om het te gebruiken.',
+ 'install.local_model.d1_saved': 'D1 is op dit apparaat opgeslagen.',
'install.local_model.d1_unsupported': 'Deze GPU kan D1 niet draaien, dus WebBrain houdt zijn gewone controles aan.',
'install.local_model.d1_error': 'D1 is gestopt: {error}',
'sp.status.disconnected': 'Niet verbonden',
diff --git a/src/firefox/src/ui/locales/pl.js b/src/firefox/src/ui/locales/pl.js
index 0b7dcd22c..043b5d5b5 100644
--- a/src/firefox/src/ui/locales/pl.js
+++ b/src/firefox/src/ui/locales/pl.js
@@ -127,7 +127,7 @@ export default {
'install.local_model.d1_downloading': 'Pobieranie D1, modelu decyzyjnego · {progress}%',
'install.local_model.d1_paused': 'D1 wstrzymano przy {progress}%.',
'install.local_model.d1_ready': 'D1 jest gotowy i na tym urządzeniu odpowiada na krótkie pytania WebBrain, np. „Czy to zadanie jest skończone?”.',
- 'install.local_model.d1_saved': 'D1 jest zapisany na tym urządzeniu. Aby go używać, wybierz go w Ustawieniach, w sekcji Modele decyzyjne.',
+ 'install.local_model.d1_saved': 'D1 jest zapisany na tym urządzeniu.',
'install.local_model.d1_unsupported': 'Ten GPU nie uruchomi D1, więc WebBrain zostaje przy swoich zwykłych sprawdzeniach.',
'install.local_model.d1_error': 'D1 się zatrzymał: {error}',
'sp.status.disconnected': 'Rozłączono',
diff --git a/src/firefox/src/ui/locales/pt.js b/src/firefox/src/ui/locales/pt.js
index 61414dae3..4e337f949 100644
--- a/src/firefox/src/ui/locales/pt.js
+++ b/src/firefox/src/ui/locales/pt.js
@@ -125,7 +125,7 @@ export default {
'install.local_model.d1_downloading': 'Baixando o D1, o modelo de decisão · {progress}%',
'install.local_model.d1_paused': 'D1 pausado em {progress}%.',
'install.local_model.d1_ready': 'O D1 está pronto e responde neste dispositivo às perguntas rápidas do WebBrain, como “Esta tarefa terminou?”.',
- 'install.local_model.d1_saved': 'O D1 está salvo neste dispositivo. Para usá-lo, escolha-o em Configurações, em Modelos de decisão.',
+ 'install.local_model.d1_saved': 'O D1 está salvo neste dispositivo.',
'install.local_model.d1_unsupported': 'Esta GPU não consegue rodar o D1, então o WebBrain mantém suas verificações de sempre.',
'install.local_model.d1_error': 'O D1 parou: {error}',
diff --git a/src/firefox/src/ui/locales/ru.js b/src/firefox/src/ui/locales/ru.js
index ca257d400..3ee0416d5 100644
--- a/src/firefox/src/ui/locales/ru.js
+++ b/src/firefox/src/ui/locales/ru.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'Загрузка D1, модели решений · {progress}%',
'install.local_model.d1_paused': 'D1 приостановлена на {progress}%.',
'install.local_model.d1_ready': 'D1 готова и прямо на этом устройстве отвечает на короткие вопросы WebBrain, например «Задача выполнена?».',
- 'install.local_model.d1_saved': 'D1 сохранена на этом устройстве. Чтобы её использовать, выберите её в Настройках, в разделе «Модели решений».',
+ 'install.local_model.d1_saved': 'D1 сохранена на этом устройстве.',
'install.local_model.d1_unsupported': 'Этот GPU не может запустить D1, поэтому WebBrain оставляет свои обычные проверки.',
'install.local_model.d1_error': 'D1 остановилась: {error}',
diff --git a/src/firefox/src/ui/locales/th.js b/src/firefox/src/ui/locales/th.js
index f576faa37..8859a0e5a 100644
--- a/src/firefox/src/ui/locales/th.js
+++ b/src/firefox/src/ui/locales/th.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'กำลังดาวน์โหลด D1 โมเดลการตัดสินใจ · {progress}%',
'install.local_model.d1_paused': 'D1 หยุดชั่วคราวที่ {progress}%',
'install.local_model.d1_ready': 'D1 พร้อมแล้ว และตอบคำถามสั้นๆ ของ WebBrain เช่น “งานนี้เสร็จหรือยัง” บนอุปกรณ์นี้',
- 'install.local_model.d1_saved': 'บันทึก D1 ไว้บนอุปกรณ์นี้แล้ว หากต้องการใช้ ให้เลือกในการตั้งค่า ใต้โมเดลการตัดสินใจ',
+ 'install.local_model.d1_saved': 'บันทึก D1 ไว้บนอุปกรณ์นี้แล้ว',
'install.local_model.d1_unsupported': 'GPU นี้รัน D1 ไม่ได้ WebBrain จึงใช้การตรวจสอบตามปกติต่อไป',
'install.local_model.d1_error': 'D1 หยุดทำงาน: {error}',
diff --git a/src/firefox/src/ui/locales/tl.js b/src/firefox/src/ui/locales/tl.js
index 41b4fb79a..e10471275 100644
--- a/src/firefox/src/ui/locales/tl.js
+++ b/src/firefox/src/ui/locales/tl.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'Dina-download ang D1, ang decision model · {progress}%',
'install.local_model.d1_paused': 'Naka-pause ang D1 sa {progress}%.',
'install.local_model.d1_ready': 'Handa na ang D1 at sinasagot nito sa device na ito ang mabibilis na tanong ng WebBrain, gaya ng “Tapos na ba ang task na ito?”.',
- 'install.local_model.d1_saved': 'Naka-save ang D1 sa device na ito. Para gamitin ito, piliin ito sa Mga Setting, sa ilalim ng Mga decision model.',
+ 'install.local_model.d1_saved': 'Naka-save ang D1 sa device na ito.',
'install.local_model.d1_unsupported': 'Hindi kayang patakbuhin ng GPU na ito ang D1, kaya nananatili ang WebBrain sa karaniwang mga check nito.',
'install.local_model.d1_error': 'Huminto ang D1: {error}',
diff --git a/src/firefox/src/ui/locales/tr.js b/src/firefox/src/ui/locales/tr.js
index bf706d018..30c702d78 100644
--- a/src/firefox/src/ui/locales/tr.js
+++ b/src/firefox/src/ui/locales/tr.js
@@ -233,7 +233,7 @@ export default {
'install.local_model.d1_downloading': 'Karar modeli D1 indiriliyor · %{progress}',
'install.local_model.d1_paused': 'D1, %{progress} noktasında duraklatıldı.',
'install.local_model.d1_ready': 'D1 hazır; WebBrain’in “Bu görev bitti mi?” gibi hızlı sorularını bu cihazda yanıtlıyor.',
- 'install.local_model.d1_saved': 'D1 bu cihaza kaydedildi. Kullanmak için Ayarlar’da Karar modelleri bölümünden seç.',
+ 'install.local_model.d1_saved': 'D1 bu cihaza kaydedildi.',
'install.local_model.d1_unsupported': 'Bu GPU D1’i çalıştıramıyor; WebBrain her zamanki kontrollerini sürdürüyor.',
'install.local_model.d1_error': 'D1 durdu: {error}',
diff --git a/src/firefox/src/ui/locales/uk.js b/src/firefox/src/ui/locales/uk.js
index d10e41970..860652324 100644
--- a/src/firefox/src/ui/locales/uk.js
+++ b/src/firefox/src/ui/locales/uk.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': 'Завантаження D1, моделі рішень · {progress}%',
'install.local_model.d1_paused': 'D1 призупинено на {progress}%.',
'install.local_model.d1_ready': 'D1 готова й просто на цьому пристрої відповідає на короткі запитання WebBrain, як-от «Завдання виконано?».',
- 'install.local_model.d1_saved': 'D1 збережено на цьому пристрої. Щоб її використовувати, виберіть її в Налаштуваннях, у розділі «Моделі рішень».',
+ 'install.local_model.d1_saved': 'D1 збережено на цьому пристрої.',
'install.local_model.d1_unsupported': 'Цей GPU не може запустити D1, тож WebBrain лишає свої звичайні перевірки.',
'install.local_model.d1_error': 'D1 зупинилася: {error}',
diff --git a/src/firefox/src/ui/locales/vi.js b/src/firefox/src/ui/locales/vi.js
index 87b832354..aec022408 100644
--- a/src/firefox/src/ui/locales/vi.js
+++ b/src/firefox/src/ui/locales/vi.js
@@ -125,7 +125,7 @@ export default {
'install.local_model.d1_downloading': 'Đang tải D1, mô hình quyết định · {progress}%',
'install.local_model.d1_paused': 'D1 đã tạm dừng ở {progress}%.',
'install.local_model.d1_ready': 'D1 đã sẵn sàng và trả lời ngay trên thiết bị này những câu hỏi nhanh của WebBrain, như “Tác vụ này xong chưa?”.',
- 'install.local_model.d1_saved': 'D1 đã được lưu trên thiết bị này. Để dùng, hãy chọn nó trong Cài đặt, mục Mô hình quyết định.',
+ 'install.local_model.d1_saved': 'D1 đã được lưu trên thiết bị này.',
'install.local_model.d1_unsupported': 'GPU này không chạy được D1, nên WebBrain giữ các bước kiểm tra thông thường.',
'install.local_model.d1_error': 'D1 đã dừng: {error}',
diff --git a/src/firefox/src/ui/locales/zh.js b/src/firefox/src/ui/locales/zh.js
index 059cf65f0..68abab0d0 100644
--- a/src/firefox/src/ui/locales/zh.js
+++ b/src/firefox/src/ui/locales/zh.js
@@ -197,7 +197,7 @@ export default {
'install.local_model.d1_downloading': '正在下载决策模型 D1 · {progress}%',
'install.local_model.d1_paused': 'D1 已在 {progress}% 处暂停。',
'install.local_model.d1_ready': 'D1 已就绪,会在此设备上回答 WebBrain 的快速问题,例如“这个任务完成了吗?”。',
- 'install.local_model.d1_saved': 'D1 已保存在此设备上。要使用它,请在设置的“决策模型”中选择。',
+ 'install.local_model.d1_saved': 'D1 已保存在此设备上。',
'install.local_model.d1_unsupported': '此 GPU 无法运行 D1,因此 WebBrain 继续使用常规检查。',
'install.local_model.d1_error': 'D1 已停止:{error}',
diff --git a/src/firefox/src/ui/settings.js b/src/firefox/src/ui/settings.js
index b3509d8e1..3f9877358 100644
--- a/src/firefox/src/ui/settings.js
+++ b/src/firefox/src/ui/settings.js
@@ -225,9 +225,10 @@ let decisionVisionSupported = false;
const decisionKeyDrafts = new Map();
let previousDecisionProvider = 'openrouter';
-// Auto, On or Off. Firefox has no in-browser model, so Auto uses only
-// Compass's managed model while Compass is the chat provider. Only On shows
-// the provider fields and the per-decision switches.
+// Auto, On or Off. Firefox has no in-browser chat model, so Auto uses a D1
+// downloaded on the Providers page, or else Compass's managed model while
+// Compass is the chat provider. Only On shows the provider fields and the
+// per-decision switches.
const decisionModeInputs = [...document.querySelectorAll('input[name="decision-mode"]')];
function selectedDecisionMode() {
return decisionModeInputs.find(input => input.checked)?.value || 'auto';
@@ -268,12 +269,12 @@ async function syncDecisionStatus() {
// Strict Secret Mode keeps page content away from every decision model, so Auto has nothing to use.
const strict = strictSecretModeOn;
const compass = !strict && activeProviderIsCompass();
- // Without Compass, Auto uses D1 once it is downloaded (decision-availability.js).
- const local = !strict && !compass
+ // Auto uses D1 once it is downloaded, Compass or not (decision-availability.js).
+ const local = !strict
&& (await browser.storage.local.get(D1_CONSENT_KEY).catch(() => ({})))?.[D1_CONSENT_KEY] === D1_CONSENT_VERSION
&& await d1LocalAssistReady();
if (sequence !== decisionStatusSequence || selectedDecisionMode() !== 'auto') return;
- const key = strict ? 'st.decision.status.strict' : compass ? 'st.decision.status.compass' : local ? 'st.decision.status.local' : 'st.decision.status.none_firefox';
+ const key = strict ? 'st.decision.status.strict' : local ? 'st.decision.status.local' : compass ? 'st.decision.status.compass' : 'st.decision.status.none_firefox';
if (status) {
status.dataset.i18n = key;
status.dataset.state = compass || local ? 'active' : 'inactive';
@@ -294,7 +295,7 @@ for (const input of decisionModeInputs) {
const legacyFeatures = materializeLegacyDecisionFeatures(await browser.storage.local.get(DECISION_SETTINGS_KEYS));
await browser.storage.local.set({ ...legacyFeatures, [DECISION_MODE_KEY]: mode, systemOneEnabled: mode === 'on' });
// Off ends D1's Download or Load; Auto keeps it, since Auto uses a
- // downloaded D1 while Compass is not the chat provider.
+ // downloaded D1.
if (mode === 'off') await sendToBackground('d1_control', { command: 'reset' }).catch(() => {});
showSystemOneResult('ok', t('st.providers.saved'));
});
diff --git a/test/d1-decision.mjs b/test/d1-decision.mjs
index 154689f15..cace6b323 100644
--- a/test/d1-decision.mjs
+++ b/test/d1-decision.mjs
@@ -296,7 +296,7 @@ for (const build of ['chrome', 'firefox']) {
const loaded = { [pin.D1_KEEP_LOADED_KEY]: true };
for (const [label, stored, options, expected] of [
['Auto with D1 downloaded', { ...consent, ...loaded }, {}, true],
- ['Auto while Compass chats', { ...consent, ...loaded }, { provider: compassProvider }, false],
+ ['Auto while Compass chats', { ...consent, ...loaded }, { provider: compassProvider }, true],
['Auto after Unload', { ...consent, [pin.D1_KEEP_LOADED_KEY]: false }, {}, false],
['Auto before the download finished', { ...consent, ...loaded }, { marker: 'missing' }, false],
['Strict Secret Mode', { ...consent, ...loaded }, { strict: true }, false],
diff --git a/test/decision-mode.mjs b/test/decision-mode.mjs
index 2de80916b..e36a28f25 100644
--- a/test/decision-mode.mjs
+++ b/test/decision-mode.mjs
@@ -76,7 +76,7 @@ for (const build of ['chrome', 'firefox']) {
for (const feature of config.DECISION_FEATURES) assert.equal(config.decisionFeatureEnabled(selected, feature), false, feature);
});
- test(`${build}: Auto with Compass keeps its managed completion checks and semantic decisions only`, () => {
+ test(`${build}: Auto with Compass and no D1 keeps its managed completion checks and semantic decisions only`, () => {
const selected = config.resolveDecisionConfig({ systemOneFastBrowser: true, systemOneFastClassifications: true }, COMPASS, { localAssistReady: true });
assert.equal(selected.provider, 'compass'); assert.equal(selected.source, 'compass'); assert.equal(selected.enabled, true);
assert.deepEqual(selected.features, { ...NO_FEATURES, done: true, semantic: true });
@@ -213,7 +213,7 @@ for (const build of ['chrome', 'firefox']) {
});
});
- test(`${build}: Auto uses a downloaded D1 for completion and scheduled checks only, never over Compass or a saved choice`, async () => {
+ test(`${build}: Auto uses a downloaded D1 for completion and scheduled checks only, Compass included, never over a saved choice`, async () => {
const consent = { [pin.D1_CONSENT_KEY]: pin.D1_CONSENT_VERSION };
const local = config.resolveDecisionConfig({ ...consent, decisionVisionMode: 'off', decisionProvider: 'openrouter', systemOneFastBrowser: true }, null, { localAssistReady: true });
assert.equal(local.provider, 'webgpu_d1'); assert.equal(local.source, 'local_assist'); assert.equal(local.mode, 'auto');
@@ -223,17 +223,36 @@ for (const build of ['chrome', 'firefox']) {
assert.deepEqual(local.features, { ...NO_FEATURES, done: true, watch: true, completion: true },
'fast classifications, fast browser actions and semantic decisions stay with On');
assert.equal(local.threshold, .9);
- // The download alone, or consent alone, is not enough; Compass, Off and On keep their own answer.
+ // The download alone, or consent alone, is not enough; Off and On keep their own answer.
assert.equal(config.resolveDecisionConfig(consent).source, 'none');
assert.equal(config.resolveDecisionConfig({}, null, { localAssistReady: true }).source, 'none', 'no consent, no D1');
- assert.equal(config.resolveDecisionConfig(consent, COMPASS, { localAssistReady: true }).provider, 'compass');
assert.equal(config.resolveDecisionConfig({ ...consent, decisionMode: 'off' }, null, { localAssistReady: true }).enabled, false);
const on = config.resolveDecisionConfig({ ...consent, decisionMode: 'on', decisionProvider: 'typesafe', typesafeApiKey: 'ts-key' }, null, { localAssistReady: true });
assert.equal(on.provider, 'typesafe'); assert.equal(on.source, 'configured');
assert.equal(config.decisionNeedsLocalAssist(consent), true);
- for (const [stored, compass] of [[{}, null], [consent, COMPASS], [{ ...consent, decisionMode: 'on' }, null], [{ ...consent, decisionMode: 'off' }, null], [{ ...consent, systemOneEnabled: true }, null]]) {
+ for (const [stored, compass] of [[{}, null], [{}, COMPASS], [{ ...consent, decisionMode: 'on' }, null], [{ ...consent, decisionMode: 'off' }, COMPASS], [{ ...consent, systemOneEnabled: true }, null]]) {
assert.equal(config.decisionNeedsLocalAssist(stored, compass), false, JSON.stringify([stored, compass]));
}
+ // While Compass is the chat provider, a downloaded D1 is Auto's decision
+ // model for the checks it answers; Compass's managed model keeps the rest.
+ const withCompass = config.resolveDecisionConfig(consent, COMPASS, { localAssistReady: true });
+ assert.equal(withCompass.provider, 'webgpu_d1'); assert.equal(withCompass.source, 'local_assist');
+ assert.deepEqual(withCompass.features, local.features);
+ for (const feature of ['done', 'watch', 'completion']) {
+ assert.equal(config.decisionNeedsLocalAssist(consent, COMPASS, feature), true, feature);
+ const answered = config.resolveDecisionConfig(consent, COMPASS, { localAssistReady: true, feature });
+ assert.equal(answered.provider, 'webgpu_d1', feature);
+ assert.equal(config.decisionFeatureEnabled(answered, feature), true, feature);
+ }
+ for (const feature of ['semantic', 'classifications', 'browser']) {
+ assert.equal(config.decisionNeedsLocalAssist(consent, COMPASS, feature), false, feature);
+ assert.equal(config.resolveDecisionConfig(consent, COMPASS, { localAssistReady: true, feature }).provider, 'compass', feature);
+ }
+ assert.equal(config.decisionFeatureEnabled(config.resolveDecisionConfig(consent, COMPASS, { localAssistReady: true, feature: 'semantic' }), 'semantic'), true,
+ "semantic decisions stay on Compass's managed model");
+ // Without Compass, D1 answers only its own checks whatever is asked.
+ assert.equal(config.decisionNeedsLocalAssist(consent, null, 'semantic'), true);
+ assert.equal(config.decisionFeatureEnabled(config.resolveDecisionConfig(consent, null, { localAssistReady: true, feature: 'semantic' }), 'semantic'), false);
});
test(`${build}: the current configuration reads D1's download only when Auto could use it`, async () => {
@@ -242,11 +261,16 @@ for (const build of ['chrome', 'firefox']) {
assert.equal(auto.provider, 'webgpu_d1'); assert.equal(auto.source, 'local_assist');
assert.deepEqual(reads, ['ready.json'], 'one marker read, no Worker or GPU');
reads.length = 0;
- assert.equal((await availability.resolveCurrentDecisionConfig(consent, COMPASS)).provider, 'compass');
+ // While Compass is the chat provider, D1 answers Auto's checks too.
+ assert.equal((await availability.resolveCurrentDecisionConfig(consent, COMPASS)).provider, 'webgpu_d1');
+ assert.equal((await availability.resolveCurrentDecisionConfig(consent, COMPASS, { feature: 'done' })).provider, 'webgpu_d1');
+ assert.deepEqual(reads, ['ready.json', 'ready.json']);
+ reads.length = 0;
+ assert.equal((await availability.resolveCurrentDecisionConfig(consent, COMPASS, { feature: 'semantic' })).provider, 'compass');
await availability.resolveCurrentDecisionConfig({ ...consent, decisionMode: 'off' });
await availability.resolveCurrentDecisionConfig({ ...consent, decisionMode: 'on', decisionProvider: 'local' });
assert.equal((await availability.resolveCurrentDecisionConfig({})).source, 'none');
- assert.deepEqual(reads, [], 'Compass, Off, On and a profile without consent never look');
+ assert.deepEqual(reads, [], "Compass's own decisions, Off, On and a profile without consent never look");
});
await withD1Download(pin, { keepLoaded: false }, async ({ reads, consent }) => {
assert.equal((await availability.resolveCurrentDecisionConfig(consent)).source, 'none', 'Unload, Remove and Off end what Auto uses');
@@ -270,8 +294,9 @@ for (const build of ['chrome', 'firefox']) {
const run = (source, runMeta = {}) => h.manager._evaluateSystemOne({ source, prompt: 'Watch status', tabId: 77 }, '', 'success', { settings: consent, evidence, ...runMeta });
assert.equal((await run('watch')).decision, 'keep', 'Auto checks a watch with the downloaded D1');
assert.equal((await run('scheduled')).decision, 'keep');
- assert.equal((await run('watch', { compass: COMPASS })).reason, 'disabled', 'Compass keeps watches with the main model');
- assert.equal(calls, 2);
+ assert.equal((await run('watch', { compass: COMPASS })).decision, 'keep', 'D1 checks watches while Compass chats too');
+ assert.equal((await run('scheduled', { compass: COMPASS })).decision, 'keep');
+ assert.equal(calls, 4);
});
const saved = globalThis.chrome;
const store = { [pin.D1_CONSENT_KEY]: pin.D1_CONSENT_VERSION };
@@ -284,7 +309,11 @@ for (const build of ['chrome', 'firefox']) {
const agent = new Agent({ getActive: () => ({ config: {} }) });
assert.equal((await agent._jevSettings(1, { config: {} }, 'done'))?.decisionConfig.provider, 'webgpu_d1');
for (const feature of ['semantic', 'classifications', 'browser']) assert.equal(await agent._jevSettings(1, { config: {} }, feature), null, feature);
- assert.equal(await agent._jevSettings(1, { config: { providerName: 'webbrain-cloud', baseUrl: COMPASS.baseUrl } }, 'watch'), null, 'Compass first');
+ const compassProvider = { config: { providerName: 'webbrain-cloud', baseUrl: COMPASS.baseUrl } };
+ assert.equal((await agent._jevSettings(1, compassProvider, 'watch'))?.decisionConfig.provider, 'webgpu_d1', 'D1 first, Compass or not');
+ assert.equal((await agent._jevSettings(1, compassProvider, 'semantic'))?.decisionConfig.provider, 'compass',
+ "Compass's managed model keeps semantic decisions");
+ for (const feature of ['classifications', 'browser']) assert.equal(await agent._jevSettings(1, compassProvider, feature), null, feature);
});
} finally {
globalThis.chrome = globalThis.browser = saved;
diff --git a/test/run.js b/test/run.js
index 64e262790..c7bb1388e 100644
--- a/test/run.js
+++ b/test/run.js
@@ -45566,7 +45566,7 @@ test('chrome install page offers the shipped in-browser model with progress inst
}
});
-test('chrome install page downloads D1 next to the chat model and says what D1 does', async () => {
+test('chrome install page downloads D1 first, then the chat model, and says what D1 does', async () => {
const install = await import(pathToFileURL(path.join(ROOT, 'src/chrome/src/ui/install.js')).href);
const webgpu = await import(pathToFileURL(path.join(ROOT, 'src/chrome/src/providers/webgpu.js')).href);
const d1Config = await import(pathToFileURL(path.join(ROOT, 'src/chrome/src/providers/d1-config.js')).href);
@@ -45589,7 +45589,10 @@ test('chrome install page downloads D1 next to the chat model and says what D1 d
assert.equal(view({ status: 'idle' }).statusKey, '', 'D1 says nothing until it starts');
assert.equal(view({ status: 'ready', usedForDecisions: true }).statusKey, 'install.local_model.d1_ready');
assert.equal(view({ status: 'saved', usedForDecisions: true }).statusKey, 'install.local_model.d1_ready', 'a kept-loaded D1 loads for its next decision');
- assert.equal(view({ status: 'ready', usedForDecisions: false }).statusKey, 'install.local_model.d1_saved', 'a profile with another decision model is told where D1 is');
+ assert.equal(view({ status: 'ready', usedForDecisions: false }).statusKey, 'install.local_model.d1_saved', 'a profile with another decision model is told D1 is on this device');
+ // Auto, the default, uses a downloaded D1 whatever the chat provider, so the
+ // guide never sends anyone to Settings to choose it.
+ assert.equal(english['install.local_model.d1_saved'], 'D1 is saved on this device.');
assert.equal(view({ status: 'error' }).isError, true);
for (const status of ['checking', 'downloading', 'paused', 'ready', 'saved', 'unsupported', 'error']) {
const { statusKey } = view({ status, usedForDecisions: status === 'ready' });
@@ -45649,8 +45652,12 @@ test('chrome install page downloads D1 next to the chat model and says what D1 d
pause_webgpu_download: () => { state.bonsai = { status: 'paused', modelId, progress: 10 }; return { ok: true }; },
});
+ const d1Commands = (runtime) => runtime.sent.filter((message) => message.action === 'd1_control' && message.command !== 'status').map((message) => message.command);
+ const chatStarts = (runtime) => runtime.sent.filter((message) => message.action === 'start_webgpu_download').length;
+
{
- // A new install: one click downloads both; Auto then uses D1 for its checks.
+ // A new install: one click downloads D1 first, then the chat model; Auto
+ // then uses D1 for its checks.
const state = { bonsai: { status: 'not-downloaded', modelId }, d1: { status: 'idle' } };
const runtime = fakeRuntime({
...bonsai(state),
@@ -45668,35 +45675,57 @@ test('chrome install page downloads D1 next to the chat model and says what D1 d
await nodes['local-model-button'].fire('click');
await settle();
+ assert.ok(runtime.sent.some((message) => message.action === 'test_provider'), 'hardware WebGPU is checked before anything downloads');
const d1Messages = runtime.sent.filter((message) => message.action === 'd1_control' && message.command !== 'status');
assert.deepEqual(d1Messages.map((message) => message.command), ['probe', 'download'], 'D1 checks the GPU, then downloads');
assert.deepEqual(d1Messages[1], { target: 'background', action: 'd1_control', command: 'download', consent: true,
consentVersion: d1Config.D1_CONSENT_VERSION }, 'the click is the consent the note asks for, and nothing else');
- assert.ok(runtime.sent.some((message) => message.action === 'start_webgpu_download'), 'the chat model downloads too');
+ assert.equal(chatStarts(runtime), 0, 'the chat model waits for D1');
+ // While D1 downloads, the button and the bar follow it.
assert.equal(nodes['local-model'].dataset.state, 'downloading');
+ assert.equal(nodes['local-model-label'].textContent, 'install.local_model.pause');
+ assert.equal(nodes['local-model-button'].disabled, false);
+ assert.equal(nodes['local-model-progress'].hidden, false);
+ assert.equal(nodes['local-model-progress'].getAttribute('aria-valuenow'), '5');
+ assert.equal(nodes['local-model-status'].textContent, '', 'the chat model has not started');
assert.equal(nodes['local-model-d1'].hidden, false);
assert.equal(nodes['local-model-d1'].textContent, 'install.local_model.d1_downloading|5');
- // Pause stops both; resume starts both again.
+ // Pause stops D1, and Resume carries on with it; the chat model still waits.
await nodes['local-model-button'].fire('click');
await settle();
- assert.ok(runtime.sent.some((message) => message.action === 'd1_control' && message.command === 'stop'));
- assert.ok(runtime.sent.some((message) => message.action === 'pause_webgpu_download'));
+ assert.deepEqual(d1Commands(runtime), ['probe', 'download', 'stop']);
+ assert.ok(!runtime.sent.some((message) => message.action === 'pause_webgpu_download'), 'no chat download to pause');
assert.equal(nodes['local-model-d1'].textContent, 'install.local_model.d1_paused|30');
+ assert.equal(nodes['local-model-label'].textContent, 'install.local_model.resume');
+ assert.equal(nodes['local-model'].dataset.state, 'paused');
+ assert.equal(chatStarts(runtime), 0);
await nodes['local-model-button'].fire('click');
await settle();
assert.equal(runtime.sent.filter((message) => message.action === 'd1_control' && message.command === 'download').length, 2,
'resume downloads what D1 still lacks');
+ assert.equal(chatStarts(runtime), 0);
+ // D1 is ready: now the chat model downloads.
state.d1 = { status: 'ready', loaded: true };
await controller.d1.refresh();
+ await settle();
assert.equal(nodes['local-model-d1'].textContent, 'install.local_model.d1_ready');
+ assert.equal(chatStarts(runtime), 1, 'the chat model follows D1');
+ assert.equal(nodes['local-model'].dataset.state, 'downloading');
+ assert.equal(nodes['local-model-status'].textContent, 'install.local_model.downloading|10');
+ assert.equal(nodes['local-model-progress'].getAttribute('aria-valuenow'), '10', 'the bar follows the chat model now');
+ // Its Pause pauses the chat model; D1 is done.
+ await nodes['local-model-button'].fire('click');
+ await settle();
+ assert.ok(runtime.sent.some((message) => message.action === 'pause_webgpu_download'));
+ assert.deepEqual(d1Commands(runtime), ['probe', 'download', 'stop', 'probe', 'download'], 'nothing more is asked of D1');
controller.dispose();
}
{
- // The button stays busy until D1 has asked for its download too, so a
- // Pause can never run before D1's transfer exists and leave D1 running.
+ // The button stays busy until D1's download has started, so a Pause can
+ // never run before D1's transfer exists; the chat model waits throughout.
const state = { bonsai: { status: 'not-downloaded', modelId }, d1: { status: 'idle' } };
let releaseProbe;
const probe = new Promise((resolve) => { releaseProbe = resolve; });
@@ -45712,18 +45741,45 @@ test('chrome install page downloads D1 next to the chat model and says what D1 d
const button = documentLike.nodes['local-model-button'];
const clicked = button.fire('click');
await settle();
- assert.ok(runtime.sent.some((message) => message.action === 'start_webgpu_download'), 'the chat model does not wait for D1');
+ assert.equal(chatStarts(runtime), 0, 'the chat model waits for D1');
assert.equal(button.disabled, true, 'busy while D1 still checks the GPU');
+ assert.equal(button.getAttribute('aria-busy'), 'true');
assert.equal(await Promise.race([clicked.then(() => 'done'), new Promise((resolve) => setTimeout(() => resolve('pending'), 20))]), 'pending');
releaseProbe({ success: true, result: { success: true } });
await clicked;
await settle();
assert.ok(runtime.sent.some((message) => message.action === 'd1_control' && message.command === 'download'));
- assert.equal(button.disabled, false, 'Pause is offered once both downloads have started');
+ assert.equal(button.disabled, false, 'Pause is offered once D1 is downloading');
+ assert.equal(documentLike.nodes['local-model-label'].textContent, 'install.local_model.pause');
assert.equal(documentLike.nodes['local-model'].dataset.state, 'downloading');
+ assert.equal(chatStarts(runtime), 0);
controller.dispose();
}
+ {
+ // The button follows a D1 download under way while the chat model is not
+ // downloading; the chat model keeps its own line and progress.
+ const buttonView = install.localModelButtonView;
+ const idle = install.localModelView({ status: 'not-downloaded' });
+ assert.deepEqual(buttonView(idle, 'not-downloaded', { status: 'downloading', progress: 40 }),
+ { ...idle, labelKey: 'install.local_model.pause', action: 'd1-pause', progress: 40, statusProgress: null, displayState: 'downloading' });
+ assert.equal(buttonView(idle, 'not-downloaded', { status: 'paused', progress: 40 }).action, 'd1-start');
+ assert.equal(buttonView(idle, 'not-downloaded', { status: 'paused', progress: 40 }).labelKey, 'install.local_model.resume');
+ assert.equal(buttonView(idle, 'not-downloaded', { status: 'checking' }).action, null);
+ assert.equal(buttonView(idle, 'not-downloaded', { status: 'checking' }).progress, null);
+ for (const status of ['idle', 'ready', 'saved', 'unsupported', 'error']) {
+ assert.deepEqual(buttonView(idle, 'not-downloaded', { status }), idle, `${status}: the click downloads both, D1 first`);
+ }
+ const chatPaused = install.localModelView({ status: 'paused', progress: 60 });
+ const pausedView = buttonView(chatPaused, 'paused', { status: 'downloading', progress: 20 });
+ assert.equal(pausedView.action, 'd1-pause');
+ assert.equal(pausedView.progress, 20, 'the bar follows D1');
+ assert.equal(pausedView.statusProgress, 60, 'the chat model line keeps its own progress');
+ const chatDownloading = install.localModelView({ status: 'downloading', progress: 10 });
+ assert.deepEqual(buttonView(chatDownloading, 'downloading', { status: 'downloading', progress: 20 }), chatDownloading,
+ 'a chat download that runs keeps the button');
+ }
+
{
// The chat model is already downloaded: the same button then starts,
// pauses, resumes and retries D1, and never touches the chat model.
@@ -45755,7 +45811,7 @@ test('chrome install page downloads D1 next to the chat model and says what D1 d
assert.equal(nodes['local-model-button'].disabled, false, 'D1 can still be downloaded');
await nodes['local-model-button'].fire('click');
await settle();
- assert.deepEqual(runtime.sent.filter((message) => message.action === 'd1_control' && message.command !== 'status').map((message) => message.command), ['probe', 'download']);
+ assert.deepEqual(d1Commands(runtime), ['probe', 'download']);
assert.ok(!runtime.sent.some((message) => ['test_provider', 'start_webgpu_download'].includes(message.action)), 'the ready chat model is left alone');
assert.equal(nodes['local-model-label'].textContent, 'install.local_model.pause');
assert.equal(nodes['local-model-d1'].textContent, 'install.local_model.d1_downloading|20');
@@ -45776,7 +45832,7 @@ test('chrome install page downloads D1 next to the chat model and says what D1 d
}
{
- // A GPU D1 cannot use: say so, and the chat model still downloads.
+ // A GPU D1 cannot use: say so, and the chat model downloads at once.
const state = { bonsai: { status: 'not-downloaded', modelId } };
const runtime = fakeRuntime({
...bonsai(state),
@@ -45789,11 +45845,113 @@ test('chrome install page downloads D1 next to the chat model and says what D1 d
await documentLike.nodes['local-model-button'].fire('click');
await settle();
assert.ok(!runtime.sent.some((message) => message.action === 'd1_control' && message.command === 'download'), 'nothing downloads that cannot run');
- assert.ok(runtime.sent.some((message) => message.action === 'start_webgpu_download'));
+ assert.equal(chatStarts(runtime), 1);
+ assert.equal(documentLike.nodes['local-model'].dataset.state, 'downloading');
assert.equal(documentLike.nodes['local-model-d1'].textContent, 'install.local_model.d1_unsupported');
controller.dispose();
}
+ {
+ // D1's download stops with an error: the chat model still follows, and the
+ // button offers to retry D1 once the chat model is ready.
+ const state = { bonsai: { status: 'not-downloaded', modelId }, d1: { status: 'idle' } };
+ const runtime = fakeRuntime({
+ ...bonsai(state),
+ 'd1_control:status': () => ({ success: true, result: { ...state.d1, usedForDecisions: false } }),
+ 'd1_control:probe': { success: true, result: { success: true } },
+ 'd1_control:download': () => { state.d1 = { status: 'downloading', progress: 50 }; return { success: true, result: { started: true, ...state.d1 } }; },
+ });
+ const documentLike = fakeDocument();
+ const controller = install.initializeLocalModelDownload({ documentLike, runtime, translate, pollMs: 60_000 });
+ await settle();
+ await documentLike.nodes['local-model-button'].fire('click');
+ await settle();
+ assert.equal(chatStarts(runtime), 0);
+ state.d1 = { status: 'error', error: 'D1 download made no byte progress for two minutes.' };
+ await controller.d1.refresh();
+ await settle();
+ assert.equal(documentLike.nodes['local-model-d1'].textContent, 'install.local_model.d1_error|D1 download made no byte progress for two minutes.');
+ assert.equal(chatStarts(runtime), 1, 'a failed D1 does not hold the chat model back');
+ state.bonsai = { status: 'ready', ready: true, modelId };
+ await controller.refresh();
+ assert.equal(documentLike.nodes['local-model-label'].textContent, 'install.local_model.retry');
+ controller.dispose();
+ }
+
+ {
+ // A D1 transfer that stops without a Pause here (no bytes for two minutes,
+ // say) does not hold the chat model back; a Pause here does.
+ const state = { bonsai: { status: 'not-downloaded', modelId }, d1: { status: 'idle' } };
+ const runtime = fakeRuntime({
+ ...bonsai(state),
+ 'd1_control:status': () => ({ success: true, result: { ...state.d1, usedForDecisions: false } }),
+ 'd1_control:probe': { success: true, result: { success: true } },
+ 'd1_control:download': () => { state.d1 = { status: 'downloading', progress: 25 }; return { success: true, result: { started: true, ...state.d1 } }; },
+ 'd1_control:stop': () => { state.d1 = { status: 'stopped', progress: 25 }; return { success: true, result: { stopped: true } }; },
+ });
+ const documentLike = fakeDocument();
+ const controller = install.initializeLocalModelDownload({ documentLike, runtime, translate, pollMs: 60_000 });
+ await settle();
+ const button = documentLike.nodes['local-model-button'];
+ await button.fire('click');
+ await settle();
+ await button.fire('click');
+ await settle();
+ assert.equal(documentLike.nodes['local-model-d1'].textContent, 'install.local_model.d1_paused|25');
+ assert.equal(chatStarts(runtime), 0, 'paused here: Resume carries on with D1 first');
+ await button.fire('click');
+ await settle();
+ assert.equal(chatStarts(runtime), 0);
+ state.d1 = { status: 'stopped', progress: 60, error: 'D1 download made no byte progress for two minutes.' };
+ await controller.d1.refresh();
+ await settle();
+ assert.equal(documentLike.nodes['local-model-d1'].textContent, 'install.local_model.d1_paused|60');
+ assert.equal(chatStarts(runtime), 1, 'a stalled D1 does not hold the chat model back');
+ assert.equal(documentLike.nodes['local-model-label'].textContent, 'install.local_model.pause', 'the chat download has the button');
+ controller.dispose();
+ }
+
+ {
+ // A reopened guide with D1 already downloaded: the click starts the chat
+ // model at once, and D1 is not downloaded again.
+ const state = { bonsai: { status: 'not-downloaded', modelId } };
+ const runtime = fakeRuntime({
+ ...bonsai(state),
+ 'd1_control:status': { success: true, result: { status: 'cached', usedForDecisions: true } },
+ });
+ const documentLike = fakeDocument();
+ const controller = install.initializeLocalModelDownload({ documentLike, runtime, translate, pollMs: 60_000 });
+ await settle();
+ assert.equal(documentLike.nodes['local-model-d1'].textContent, 'install.local_model.d1_ready');
+ assert.equal(documentLike.nodes['local-model-label'].textContent, 'install.local_model.download');
+ await documentLike.nodes['local-model-button'].fire('click');
+ await settle();
+ assert.deepEqual(d1Commands(runtime), [], 'D1 is already saved');
+ assert.equal(chatStarts(runtime), 1);
+ controller.dispose();
+ }
+
+ {
+ // A guide opened while D1 downloads (started on the Providers page, say)
+ // follows that download, but only a click here downloads the chat model.
+ const state = { bonsai: { status: 'not-downloaded', modelId }, d1: { status: 'downloading', progress: 70 } };
+ const runtime = fakeRuntime({
+ ...bonsai(state),
+ 'd1_control:status': () => ({ success: true, result: { ...state.d1, usedForDecisions: state.d1.status === 'ready' } }),
+ });
+ const documentLike = fakeDocument();
+ const controller = install.initializeLocalModelDownload({ documentLike, runtime, translate, pollMs: 60_000 });
+ await settle();
+ assert.equal(documentLike.nodes['local-model-label'].textContent, 'install.local_model.pause');
+ assert.equal(documentLike.nodes['local-model-d1'].textContent, 'install.local_model.d1_downloading|70');
+ state.d1 = { status: 'ready', loaded: true };
+ await controller.d1.refresh();
+ await settle();
+ assert.equal(chatStarts(runtime), 0, 'no click, no chat model download');
+ assert.equal(documentLike.nodes['local-model-label'].textContent, 'install.local_model.download');
+ controller.dispose();
+ }
+
{
// No hardware WebGPU at all: D1 is not even checked.
const runtime = fakeRuntime({
@@ -45807,12 +45965,13 @@ test('chrome install page downloads D1 next to the chat model and says what D1 d
await documentLike.nodes['local-model-button'].fire('click');
await settle();
assert.ok(!runtime.sent.some((message) => message.action === 'd1_control' && message.command !== 'status'));
+ assert.equal(chatStarts(runtime), 0);
assert.equal(documentLike.nodes['local-model-d1'].hidden, true);
controller.dispose();
}
{
- // Compass's managed model, or a saved choice, answers instead: D1 is saved, and the guide says where to choose it.
+ // Off, or another model chosen under On: the guide only says D1 is on this device.
const runtime = fakeRuntime({
get_webgpu_download_status: { status: 'ready', ready: true, modelId },
'd1_control:status': { success: true, result: { status: 'ready', loaded: true, usedForDecisions: false } },
diff --git a/test/systemone-ui.mjs b/test/systemone-ui.mjs
index 64cb576c3..49be5f957 100644
--- a/test/systemone-ui.mjs
+++ b/test/systemone-ui.mjs
@@ -75,7 +75,8 @@ function installStub({ lang, build, version, seed = {} }) {
storage: { local: storage, onChanged: { addListener: fn => listeners.push(fn) } },
runtime: { getURL: path => `${location.origin}/src/${build}/${path}`, getManifest: () => ({ version }), onMessage: { addListener() {} }, sendMessage(msg, callback) {
window.testRequests.push(msg);
- const result = msg.action === 'get_providers' ? { providers: { llamacpp: { label: 'llama.cpp', category: 'local', baseUrl: 'http://localhost:8080/v1', model: 'local-model', configured: true }, openai: { label: 'OpenAI', category: 'cloud', apiKey: '', model: 'gpt-4o-mini' } }, active: 'llamacpp' }
+ const result = msg.action === 'get_providers' ? { providers: { llamacpp: { label: 'llama.cpp', category: 'local', baseUrl: 'http://localhost:8080/v1', model: 'local-model', configured: true }, openai: { label: 'OpenAI', category: 'cloud', apiKey: '', model: 'gpt-4o-mini' },
+ webbrain_cloud: { label: 'WebBrain Cloud', category: 'cloud', providerName: 'webbrain-cloud', configured: true } }, active: sessionStorage.getItem('active-provider') || 'llamacpp' }
: msg.action === 'test_system_one' ? { success: true, model: msg.settings?.decisionModel || 'jev-1.13.0', visionVerified: msg.settings?.decisionProvider === 'openrouter' }
: msg.action === 'list_decision_models' ? { success: true, models: [{ id: 'cloudflare/clef-flash', name: 'Decider', supportsVision: true, inputRate: .02, outputRate: 0 }, { id: 'another/publisher', name: 'Another decision model', supportsVision: false, inputRate: .1, outputRate: 0 }] }
: msg.action === 'get_user_memory' ? { ok: true, enabled: true, records: [] } : {};
@@ -279,6 +280,31 @@ try {
assert.deepEqual(await page.evaluate(keys => Object.fromEntries(keys.map(key => [key, testStore[key]])), Object.keys(switches)), switches);
}
}
+ if (lang === 'en' && width === 1280) {
+ // While Compass is the chat provider, a downloaded D1 is still what Auto uses.
+ await page.evaluate(() => { sessionStorage.setItem('active-provider', 'webbrain_cloud'); sessionStorage.setItem('decision-profile', '{}'); });
+ await page.reload();
+ await page.waitForFunction(() => !document.querySelector('#decision-auto-status').hidden);
+ assert.match(await statusText(), /In use: WebBrain Cloud’s decision model/);
+ assert.equal(await page.locator('#btn-test-system-one').isVisible(), false, "Compass's managed model cannot be tested here");
+ await page.evaluate(async build => {
+ const { D1_CACHE_NAME, D1_RELEASE, D1_CONSENT_KEY, D1_CONSENT_VERSION, D1_KEEP_LOADED_KEY } = await import(`/src/${build}/src/providers/d1-config.js`);
+ const directory = await (await navigator.storage.getDirectory()).getDirectoryHandle(`${D1_CACHE_NAME}-${D1_RELEASE.revision}`, { create: true });
+ const writer = await (await directory.getFileHandle('ready.json', { create: true })).createWritable();
+ await writer.write(JSON.stringify({ revision: D1_RELEASE.revision, manifestSha256: D1_RELEASE.manifestSha256 }));
+ await writer.close();
+ Object.assign(testStore, { [D1_CONSENT_KEY]: D1_CONSENT_VERSION, [D1_KEEP_LOADED_KEY]: true });
+ dispatchEvent(new Event('focus'));
+ }, build);
+ await page.waitForFunction(() => /D1/.test(document.querySelector('#decision-auto-status').textContent));
+ assert.match(await statusText(), /In use: D1, on this device\./);
+ assert.equal(await page.locator('#btn-test-system-one').isVisible(), true, 'D1 runs here, so Auto can test it');
+ await page.evaluate(async build => {
+ const { D1_CACHE_NAME, D1_RELEASE } = await import(`/src/${build}/src/providers/d1-config.js`);
+ await (await navigator.storage.getDirectory()).removeEntry(`${D1_CACHE_NAME}-${D1_RELEASE.revision}`, { recursive: true });
+ sessionStorage.removeItem('active-provider');
+ }, build);
+ }
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true, 'settings fit viewport');
assert.deepEqual(errors, []);
await page.close(); console.log(`${build} ${lang} ${width}: settings save/test/clear passed`);