Open-source AI browser agent for Chrome and Firefox (monorepo) π§
JavaScript ai-agentai-agentsai-toolsbrowser-aibrowser-automationbrowser-extensionchrome-aichrome-devtoolschrome-extensionchrome-extensionsfirefox-addonfirefox-addonsfirefox-extensionfirefox-extensionsgemmagemma4minimaxoffline-aioffline-llmqwen
Make Automatic the default and rearrange the side panel
Claudef902ac7e9f5b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 547cf3e13..b85add1e8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,7 +7,10 @@ This changelog was generated from the repository Git history and release tags. V## [Unreleased]### Added-- Automatic mode selection, off by default: Settings β Mode selection β Automatic hides the Ask, Act and Dev buttons, and WebBrain picks the mode for each message. It stays read-only unless your message asks it to do something in the browser. With a decision model configured (WebBrain Cloud includes one), the choice is made while the page is being read, so a message waits at most a quarter of a second longer. Without one, or when the decision model is unsure, the message starts in Ask; if it needs clicking, typing or opening pages, the model hands it over to Act, quoting your words. That hand-off counts only when your words, read again without the page, also ask for an action; the same message then restarts in Act with the usual plan review and permission prompts. Page content can never switch a message into Act, and right-click and selection prompts stay in Ask. Start a message with /ask, /act or /dev, or press Ctrl+Shift+A, X or D, to choose the mode for that message yourself. Text you selected on the page and the standalone window always stay in Ask.+- Automatic mode selection: WebBrain now picks Ask, Act or Dev for each message, and the Ask, Act and Dev buttons are gone. Settings β General β Mode selection β Manual brings them back. It stays read-only unless your message asks it to do something in the browser. With a decision model configured (WebBrain Cloud includes one), the choice is made while the page is being read, so a message waits at most a quarter of a second longer. Without one, or when the decision model is unsure, the message starts in Ask; if it needs clicking, typing or opening pages, the model hands it over to Act, quoting your words. That hand-off counts only when your words, read again without the page, also ask for an action; the same message then restarts in Act with the usual plan review and permission prompts. Page content can never switch a message into Act, and right-click and selection prompts stay in Ask. Start a message with /ask, /act or /dev, or press Ctrl+Shift+A, X or D, to choose the mode for that message yourself. Text you selected on the page and the standalone window always stay in Ask.++### Changed+- The side panel layout is rearranged. The language, text size, Settings and pop-out buttons moved to the top left, and History and New chat to the top right, where History opens its list downward. The model picker moved into the message box, next to the attach button below your text, and its list opens upward. With Mode selection set to Manual, the Ask, Act and Dev buttons stay above the message box.### Fixed- Stopping a task while WebBrain was waiting for page navigation to settle now stops it immediately. The pending settle step previously kept waiting and could let the run continue after you chose Stop.diff --git a/README.md b/README.mdindex 28d6f8022..af17537c7 100644--- a/README.md+++ b/README.md@@ -75,6 +75,11 @@ Three modes control what the agent is allowed to do:| **Act** | Clicks, types, navigates, uploads, downloads, fills forms. || **Dev** | Adds page source, styles, console, network, and reversible page edits. |+WebBrain picks the mode for each message: it stays in Ask unless your message+asks it to do something in the browser. Start a message with `/ask`, `/act` or+`/dev` to choose yourself, or set Settings β General β Mode selection to Manual+to bring back the Ask, Act and Dev buttons.+## Pick a model**WebBrain Compass 1.0** is the default and needs no API key or local setup.@@ -201,9 +206,9 @@ Chrome side panel shortcuts work when the WebBrain side panel has focus.| Shortcut | What it does || ------------------------------- | ---------------------------------------------------------------------------- || `Ctrl+/` or `Cmd+/` | Focus the input |-| `Ctrl+Shift+A` or `Cmd+Shift+A` | Switch to Ask mode |-| `Ctrl+Shift+X` or `Cmd+Shift+X` | Switch to Act mode |-| `Ctrl+Shift+D` or `Cmd+Shift+D` | Switch to Dev mode |+| `Ctrl+Shift+A` or `Cmd+Shift+A` | Choose Ask mode (Automatic adds `/ask` to your message) |+| `Ctrl+Shift+X` or `Cmd+Shift+X` | Choose Act mode (Automatic adds `/act` to your message) |+| `Ctrl+Shift+D` or `Cmd+Shift+D` | Choose Dev mode (Automatic adds `/dev` to your message) || `Escape` | Stop the active run, unless it is only dismissing slash-command autocomplete || `Escape` twice | Stop an active recording from WebBrain or browser pages |diff --git a/docs/architecture.md b/docs/architecture.mdindex 2d1493824..a283f437f 100644--- a/docs/architecture.md+++ b/docs/architecture.md@@ -71,7 +71,7 @@ The chat UI. Communicates with the background script via `chrome.runtime.sendMesModel tiering is separate from mode: `compact | mid | full` controls how many normal tools the model sees, while `ask | act | dev` controls what kind of task the user is allowing.-**Automatic mode selection** (Settings β Mode selection β Automatic; Manual is the default) hides the Ask/Act/Dev toggle and sends `mode: 'auto'`. The agent routes the turn in `auto-mode.js`, shared by both builds:+**Automatic mode selection** (Settings β Mode selection; Automatic is the default, Manual restores the toggle) hides the Ask/Act/Dev toggle and sends `mode: 'auto'`. The agent routes the turn in `auto-mode.js`, shared by both builds:1. Run state decides alone when it can: a continuation keeps its run's mode; a selected-text scope, the standalone window, a Cloud run and a message that carries an `<untrusted_page_content>` block (a selection shortcut with page context) stay in Ask; and a video attachment, which can only be uploaded, needs Act. Context-menu and selection prompts are sent as Ask, as in Manual.2. Otherwise the decision model answers the fixed-choice `run_mode` question (`semantic-decisions.js`) about the user's own words, the previous turn's mode and the earlier task. It never sees page text, title or address. The question starts as soon as the turn's cost state exists and is awaited after `_enrichUserMessageWithCurrentPage`, so it overlaps page capture; after capture the turn waits at most `AUTO_MODE_ROUTE_GRACE_MS` (250 ms). Only a sure `act` or `dev` answer (the choices are `authorizing`) selects an action mode; Compact maps Dev to Act. The routed mode replaces the provisional Ask setup: run mode, system prompt, the turn's trusted runtime line and dialog handling (Chrome) or the BiDi run (Firefox).diff --git a/docs/privacy-and-data-flow.md b/docs/privacy-and-data-flow.mdindex 68dcc9c58..0d9f9ba24 100644--- a/docs/privacy-and-data-flow.md+++ b/docs/privacy-and-data-flow.md@@ -112,7 +112,7 @@ OpenRouter Decider with completion verification enabled once outsourcing isconfigured. Compass completion uses its managed Cloud decision route by default;an explicitly enabled and consented D1 selection changes that decision route only.-With Settings β Mode selection set to Automatic, each turn the user sends also+With Settings β Mode selection set to Automatic (the default), each turn the user sends alsoasks the configured decision model one `run_mode` question: the text of thatmessage, the previous turn's mode and the user's earlier task in theconversation. No page text, title, address or screenshot is included, and thediff --git a/docs/security-model.md b/docs/security-model.mdindex dc3dda6b9..ce42c42a4 100644--- a/docs/security-model.md+++ b/docs/security-model.md@@ -203,7 +203,7 @@ The primary threat: a malicious page crafts content that, when read by the agent| **Capability Γ origin gate** | Before a consequential tool runs (click/type/navigate/execute_js/network/download/β¦), the agent requires a `(capability, host)` grant β Allow once / Always / Deny. Language-agnostic, deterministic, human-in-the-loop (`permission-gate.js`). || **Tool result cap** | Individual tool results truncated at 8,000 chars (`_limitToolResult`). Injected text beyond that is silently dropped. || **Ask/Act/Dev mode** | Ask mode exposes only semantic read-only tools. The user must explicitly switch to an action mode for clicks/types/navigation. Act exposes the selected provider tier's normal tools. Dev requires Mid/Full tier and adds source/style/page-inspection tools for developer debugging. |-| **Automatic mode selection** | Opt-in (Settings β Mode selection). The user's own request takes the place of the toggle as the action authorization: a turn enters Act or Dev only on a sure decision-model answer to `run_mode` about the user's words and run state, or on a `request_action_mode` call from a read-only Ask turn that quotes the user's latest message exactly and that the page-free `run_mode` question, asked again, confirms. Page text, titles and addresses never reach the route, and an unsure, slow or failed route starts read-only. A selected-text scope, the standalone window, Cloud runs, context-menu prompts and messages that carry page text always stay in Ask. The action run's planner gate, permission gates and confirmation cards apply unchanged. |+| **Automatic mode selection** | On by default; Settings β Mode selection β Manual restores the explicit toggle. The user's own request takes the place of the toggle as the action authorization: a turn enters Act or Dev only on a sure decision-model answer to `run_mode` about the user's words and run state, or on a `request_action_mode` call from a read-only Ask turn that quotes the user's latest message exactly and that the page-free `run_mode` question, asked again, confirms. Page text, titles and addresses never reach the route, and an unsure, slow or failed route starts read-only. A selected-text scope, the standalone window, Cloud runs, context-menu prompts and messages that carry page text always stay in Ask. The action run's planner gate, permission gates and confirmation cards apply unchanged. || **Tiered tool exposure** | Provider tiers (`compact | mid | full`) limit the normal browser-agent surface for smaller models. Compact gets the smallest action surface; Mid adds common task tools; Full adds advanced UI/DOM fallbacks. Compact Dev is blocked. || **Plan before Act** | When enabled, action-mode runs first produce a structured plan and wait for side-panel approval before any browser tool executes. In Try mode, planner JSON that remains invalid after repair degrades that turn to Ask/read-only; Strict stops. Scheduled runs can auto-approve the plan only through scheduler policy. || **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. |diff --git a/src/chrome/src/config-transfer.js b/src/chrome/src/config-transfer.jsindex 93f2d304d..6964be6a3 100644--- a/src/chrome/src/config-transfer.js+++ b/src/chrome/src/config-transfer.js@@ -27,7 +27,7 @@ export const DEFAULT_CONFIG_SETTINGS = Object.freeze({[UI_SCALE_STORAGE_KEY]: 100,verboseMode: false,composerDeliveryMode: 'queue',- modeSelection: 'manual',+ modeSelection: 'auto',selectionShortcutEnabled: true,[AUTO_GROUP_TABS_KEY]: true,helpImproveWebBrain: true,diff --git a/src/chrome/src/ui/settings.html b/src/chrome/src/ui/settings.htmlindex 47b66d354..3eb612dc7 100644--- a/src/chrome/src/ui/settings.html+++ b/src/chrome/src/ui/settings.html@@ -1513,8 +1513,8 @@<div class="setting-desc" data-i18n="st.display.mode_selection.desc"></div></div><select id="select-mode-selection" data-i18n-aria-label="st.display.mode_selection.label">- <option value="manual" data-i18n="st.display.mode_selection.manual"></option><option value="auto" data-i18n="st.display.mode_selection.auto"></option>+ <option value="manual" data-i18n="st.display.mode_selection.manual"></option></select></div><div class="setting-row">diff --git a/src/chrome/src/ui/settings.js b/src/chrome/src/ui/settings.jsindex a99634bb1..da498e30c 100644--- a/src/chrome/src/ui/settings.js+++ b/src/chrome/src/ui/settings.js@@ -634,7 +634,7 @@ async function init() {providerFilter = stored.providerFilter;}verboseToggle.checked = stored.verboseMode || false;- if (modeSelectionSelect) modeSelectionSelect.value = stored.modeSelection === 'auto' ? 'auto' : 'manual';+ if (modeSelectionSelect) modeSelectionSelect.value = stored.modeSelection === 'manual' ? 'manual' : 'auto';if (composerDeliveryModeSelect) {composerDeliveryModeSelect.value = stored.composerDeliveryMode === 'steer' ? 'steer' : 'queue';}@@ -1291,7 +1291,7 @@ if (globalThis.chrome?.storage?.onChanged) {// --- Display Settings ---modeSelectionSelect?.addEventListener('change', async () => {- const modeSelection = modeSelectionSelect.value === 'auto' ? 'auto' : 'manual';+ const modeSelection = modeSelectionSelect.value === 'manual' ? 'manual' : 'auto';await chrome.storage.local.set({ modeSelection }).catch(() => {});});diff --git a/src/chrome/src/ui/sidepanel.html b/src/chrome/src/ui/sidepanel.htmlindex f30a68cea..19dc57d26 100644--- a/src/chrome/src/ui/sidepanel.html+++ b/src/chrome/src/ui/sidepanel.html@@ -173,33 +173,7 @@<!-- Header --><div class="header-shell"><header id="header">- <div class="header-left">- <div class="provider-picker" id="provider-picker">- <!-- Native select kept as the value source for existing handlers.- Closed button is text-only; brand icons show only in the open menu. -->- <select id="provider-select" class="provider-select-native" title="LLM Provider" tabindex="-1" aria-hidden="true"></select>- <button type="button" id="provider-picker-btn" class="provider-picker-btn" aria-haspopup="listbox" aria-expanded="false" aria-controls="provider-picker-menu" aria-label="LLM Provider">- <span class="provider-picker-label" id="provider-picker-label"></span>- <span class="provider-picker-caret" aria-hidden="true">- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">- <polyline points="6 9 12 15 18 9"/>- </svg>- </span>- </button>- <div class="provider-picker-menu hidden" id="provider-picker-menu" role="listbox" tabindex="-1"></div>- </div>- <button- type="button"- id="btn-webgpu-standalone"- class="standalone-webgpu-toggle"- title="Enable Apocalypse Mode first"- aria-label="Use WebGPU for this standalone chat"- aria-pressed="false"- hidden- ><span aria-hidden="true">β’</span></button>- <span id="status-dot" class="status-dot offline" data-i18n-title="sp.status.disconnected"></span>- </div>- <div class="header-right">+ <div class="header-tools"><div id="language-picker" class="language-picker"><select id="language-select" class="language-select-native" tabindex="-1" aria-hidden="true"></select><button type="button" id="language-picker-btn" class="language-picker-btn" aria-haspopup="listbox" aria-expanded="false" aria-controls="language-picker-menu" data-i18n-aria-label="sp.btn.language">@@ -241,6 +215,22 @@</svg></button></div>+ <div class="conversation-action-group header-conversation">+ <button id="btn-history" aria-haspopup="dialog" aria-controls="history-popover" aria-expanded="false" class="conversation-action" type="button" data-i18n-title="sp.btn.history_short" data-i18n-aria-label="sp.btn.history_short">+ <svg data-icon="history" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/>+ <path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>+ </svg>+ <span class="conversation-action-label" data-i18n="sp.btn.history_short">History</span>+ </button>+ <div id="history-popover" class="history-popover" popover="auto" role="dialog" aria-label="History" data-i18n-aria-label="sp.btn.history_short"></div>+ <button id="btn-clear" class="conversation-action" type="button" data-i18n-title="sp.btn.clear_short" data-i18n-aria-label="sp.btn.clear_short">+ <svg data-icon="plus" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <path d="M5 12h14"/><path d="M12 5v14"/>+ </svg>+ <span class="conversation-action-label" data-i18n="sp.btn.clear_short">New chat</span>+ </button>+ </div></header></div>@@ -376,50 +366,61 @@<button id="btn-mode-act" class="mode-btn" data-i18n="sp.mode.act" data-i18n-title="sp.mode.act.title"></button><button id="btn-mode-dev" class="mode-btn" data-i18n="sp.mode.dev" data-i18n-title="sp.mode.dev.title"></button></div>- <div class="conversation-action-group">- <button id="btn-history" aria-haspopup="dialog" aria-controls="history-popover" aria-expanded="false" class="conversation-action" type="button" data-i18n-title="sp.btn.history_short" data-i18n-aria-label="sp.btn.history_short">- <svg data-icon="history" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">- <path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/>- <path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>- </svg>- <span class="conversation-action-label" data-i18n="sp.btn.history_short">History</span>- </button>- <div id="history-popover" class="history-popover" popover="auto" role="dialog" aria-label="History" data-i18n-aria-label="sp.btn.history_short"></div>- <button id="btn-clear" class="conversation-action" type="button" data-i18n-title="sp.btn.clear_short" data-i18n-aria-label="sp.btn.clear_short">- <svg data-icon="plus" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">- <path d="M5 12h14"/><path d="M12 5v14"/>- </svg>- <span class="conversation-action-label" data-i18n="sp.btn.clear_short">New chat</span>- </button>- </div></div><div id="queued-messages" class="queued-messages hidden" role="list" aria-live="polite"></div><div id="slash-command-menu" class="slash-command-menu hidden" role="listbox" data-i18n-aria-label="sp.slash.commands_label"></div><div id="attachment-preview-list" class="attachment-preview-list hidden"></div><input type="file" id="file-attach-input" accept="image/*,application/pdf,application/json,text/plain,text/csv,text/markdown,video/mp4,video/quicktime,video/webm,.json,.txt,.csv,.md,.mp4,.m4v,.mov,.webm" multiple hidden><div id="input-wrapper">- <button id="btn-attach" data-i18n-title="sp.btn.attach">- <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round">- <path d="m16 6-8.4 8.6a2 2 0 0 0 2.8 2.8l8.4-8.6a4 4 0 0 0-5.6-5.6l-8.4 8.6a6 6 0 0 0 8.5 8.5l8.4-8.6"/>- </svg>- </button><div id="input-text-layer"><div id="input-highlight" aria-hidden="true"></div><textarea id="user-input" data-i18n-placeholder="sp.input.ask_placeholder" rows="1"></textarea></div>- <button id="btn-mic" data-i18n-title="sp.btn.mic">- <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round">- <path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z"/>- <path d="M19 10v2a7 7 0 0 1-14 0v-2"/>- <path d="M12 19v3"/>- <path d="M8 22h8"/>- </svg>- </button>- <button id="btn-send" data-i18n-title="sp.btn.send">- <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor">- <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/>- </svg>- </button>+ <div class="composer-toolbar">+ <button id="btn-attach" data-i18n-title="sp.btn.attach">+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round">+ <path d="m16 6-8.4 8.6a2 2 0 0 0 2.8 2.8l8.4-8.6a4 4 0 0 0-5.6-5.6l-8.4 8.6a6 6 0 0 0 8.5 8.5l8.4-8.6"/>+ </svg>+ </button>+ <div class="provider-picker" id="provider-picker">+ <!-- Native select kept as the value source for existing handlers.+ Closed button is text-only; brand icons show only in the open menu. -->+ <select id="provider-select" class="provider-select-native" title="LLM Provider" tabindex="-1" aria-hidden="true"></select>+ <button type="button" id="provider-picker-btn" class="provider-picker-btn" aria-haspopup="listbox" aria-expanded="false" aria-controls="provider-picker-menu" aria-label="LLM Provider">+ <span class="provider-picker-label" id="provider-picker-label"></span>+ <span class="provider-picker-caret" aria-hidden="true">+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">+ <polyline points="6 9 12 15 18 9"/>+ </svg>+ </span>+ </button>+ <div class="provider-picker-menu hidden" id="provider-picker-menu" role="listbox" tabindex="-1"></div>+ </div>+ <button+ type="button"+ id="btn-webgpu-standalone"+ class="standalone-webgpu-toggle"+ title="Enable Apocalypse Mode first"+ aria-label="Use WebGPU for this standalone chat"+ aria-pressed="false"+ hidden+ ><span aria-hidden="true">β’</span></button>+ <span id="status-dot" class="status-dot offline" data-i18n-title="sp.status.disconnected"></span>+ <span class="composer-toolbar-spacer" aria-hidden="true"></span>+ <button id="btn-mic" data-i18n-title="sp.btn.mic">+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round">+ <path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z"/>+ <path d="M19 10v2a7 7 0 0 1-14 0v-2"/>+ <path d="M12 19v3"/>+ <path d="M8 22h8"/>+ </svg>+ </button>+ <button id="btn-send" data-i18n-title="sp.btn.send">+ <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor">+ <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/>+ </svg>+ </button>+ </div></div></div></div>diff --git a/src/chrome/src/ui/sidepanel.js b/src/chrome/src/ui/sidepanel.jsindex db064e6fe..f7a8e82e3 100644--- a/src/chrome/src/ui/sidepanel.js+++ b/src/chrome/src/ui/sidepanel.js@@ -1254,10 +1254,11 @@ let currentAssistantEl = null;let verboseMode = false;let compactProgressVisible = true;let agentMode = 'ask'; // 'ask' | 'act' | 'dev'-// Settings β Mode selection. In Automatic the toggle is hidden, the composer-// sends "auto" and the agent routes each turn (src/*/src/agent/auto-mode.js);-// slash commands and the mode shortcuts choose a mode for one message.-let autoModeSelection = false;+// Settings β Mode selection, Automatic unless set to Manual. In Automatic the+// toggle is hidden, the composer sends "auto" and the agent routes each turn+// (src/*/src/agent/auto-mode.js); slash commands and the mode shortcuts+// choose a mode for one message. The standalone window always stays in Ask.+let autoModeSelection = !isStandaloneWindow;// Set when switching to Automatic left Dev while a run was still active:// that run keeps its console and network capture until the panel has no// run left, then the drain that leaving Dev asks for runs.@@ -2128,7 +2129,7 @@ chrome.storage.onChanged.addListener((changes, area) => {});function applyModeSelection(value) {- autoModeSelection = value === 'auto' && !isStandaloneWindow;+ autoModeSelection = value !== 'manual' && !isStandaloneWindow;document.documentElement.dataset.modeSelection = autoModeSelection ? 'auto' : 'manual';// A mode pinned before switching to Automatic must not linger in the// composer styling; Automatic chooses per turn. A run still going keeps@@ -15972,10 +15973,17 @@ historyBtn?.addEventListener('click', async () => {if (historyPopover.matches(':popover-open')) { historyPopover.hidePopover(); return; }const request = ++historyPopoverRequest;const tabId = currentTabId;+ // History sits in the header: open below it, end-aligned with the button.+ // The rect is in zoomed pixels, while the popover's own lengths are not.+ const zoom = uiScaleZoom();const anchor = historyBtn.getBoundingClientRect();- historyPopover.style.left = `${Math.max(8, Math.min(anchor.right - 320, window.innerWidth - 328))}px`;- historyPopover.style.bottom = `${window.innerHeight - anchor.top + 8}px`;- historyPopover.style.maxHeight = `${Math.max(60, Math.min(420, anchor.top - 16))}px`;+ const width = 320 * zoom;+ const left = Math.max(8, Math.min(anchor.right - width, window.innerWidth - width - 8));+ const top = anchor.bottom + 8;+ historyPopover.style.left = `${left / zoom}px`;+ historyPopover.style.top = `${top / zoom}px`;+ historyPopover.style.bottom = 'auto';+ historyPopover.style.maxHeight = `${Math.max(60, Math.min(420, (window.innerHeight - top - 8) / zoom))}px`;historyPopover.replaceChildren();const status = document.createElement('p');status.textContent = t('sp.history.loading');diff --git a/src/chrome/src/ui/theme-bootstrap.js b/src/chrome/src/ui/theme-bootstrap.jsindex ecfdaf816..e1d6a7cbe 100644--- a/src/chrome/src/ui/theme-bootstrap.js+++ b/src/chrome/src/ui/theme-bootstrap.js@@ -13,15 +13,9 @@try {var params = new URLSearchParams(window.location.search);if (params.get('standalone') === 'true') {+ // Standalone chat has no History; its stylesheet hides History and+ // the pop-out button and keeps New chat in the header.document.documentElement.setAttribute('data-standalone', 'true');- // Standalone chat has no History strip. Reuse the existing New chat- // button so its confirmation and event wiring remain unchanged.- window.addEventListener('DOMContentLoaded', function () {- var headerActions = document.querySelector('#header .header-right');- var newChat = document.getElementById('btn-clear');- var expand = document.getElementById('btn-expand');- if (headerActions && newChat) headerActions.insertBefore(newChat, expand);- }, { once: true });}} catch (_) { /* ignore */ }diff --git a/src/chrome/styles/sidepanel.css b/src/chrome/styles/sidepanel.cssindex 52f599c76..e4bb75847 100644--- a/src/chrome/styles/sidepanel.css+++ b/src/chrome/styles/sidepanel.css@@ -831,23 +831,19 @@ html[data-ui-scale-ready="false"] body { visibility: hidden; }flex-shrink: 0;}-.header-left {- display: flex;- align-items: center;- gap: 6px;- flex: 1;- min-width: 0;- /* Keep the status-dot glued to the provider picker β don't let the- picker stretch across the header and park the dot next to language. */-}--.header-right {+/* Display tools (language, scale, Settings, pop-out) sit at the start of the+ header and the conversation actions (History, New chat) at its end. */+.header-tools {display: flex;align-items: center;gap: 2px;flex-shrink: 0;}+.header-conversation {+ margin-inline-start: auto;+}+.ui-scale-menu {position: relative;}@@ -856,9 +852,10 @@ html[data-ui-scale-ready="false"] body { visibility: hidden; }position: absolute;z-index: 30;top: calc(100% + 7px);- /* Logical, so the popover opens inward from the trigger in RTL locales+ /* The trigger sits at the start of the header: align the popover to the+ trigger's start edge (logical, so RTL locales also open it inward)instead of off the panel edge. */- inset-inline-end: 0;+ inset-inline-start: 0;display: flex;align-items: center;gap: 5px;@@ -872,9 +869,9 @@ html[data-ui-scale-ready="false"] body { visibility: hidden; }.ui-scale-popover.hidden { display: none; }-/* Two ids: the generic `#header .header-right button:not(...)` rule below is+/* Two ids: the generic `#header .header-tools button:not(...)` rule below ismore specific than a class-based selector, and these chips live inside- .header-right. */+ .header-tools. */#header #ui-scale-popover button {min-width: 28px;min-height: 28px;@@ -886,7 +883,7 @@ html[data-ui-scale-ready="false"] body { visibility: hidden; }font: inherit;}-/* The base rule above (two ids) outranks the generic `.header-right+/* The base rule above (two ids) outranks the generic `.header-toolsbutton:hover`, so these chips need their own hover to react at all. */#header #ui-scale-popover button:hover:not(:disabled) { background: var(--accent-dim); }#header #ui-scale-popover button:disabled { opacity: 0.45; cursor: default; }@@ -1184,9 +1181,9 @@ html[data-ui-scale-ready="false"] body { visibility: hidden; }flex: 0 0 auto;}-/* Two selectors deep: the generic `#header .header-right button:not(...)` rule- below outranks a bare class selector, and this trigger lives in .header-right. */-#header .header-right button.language-picker-btn[aria-expanded="true"] {+/* Two selectors deep: the generic `#header .header-tools button:not(...)` rule+ below outranks a bare class selector, and this trigger lives in .header-tools. */+#header .header-tools button.language-picker-btn[aria-expanded="true"] {color: var(--text-primary);background: var(--accent-dim);}@@ -1204,15 +1201,22 @@ html[data-ui-scale-ready="false"] body { visibility: hidden; }background: var(--bg-input);}+/* Opens inward from the start of the header. The menu itself is always+ LTR, so its side follows the document direction explicitly. */.language-picker-menu {- right: 0;- left: auto;+ left: 0;+ right: auto;min-width: 224px;max-width: min(272px, calc(100vw / var(--ui-scale-zoom, 1) - 16px));max-height: min(352px, calc(60vh / var(--ui-scale-zoom, 1)));direction: ltr;}+html[dir="rtl"] .language-picker-menu {+ left: auto;+ right: 0;+}+.language-picker-option {direction: ltr;text-align: left;@@ -1282,9 +1286,9 @@ html[data-ui-scale-ready="false"] body { visibility: hidden; }background: var(--border);}-/* Icon buttons in the header-right cluster only. The language trigger is one+/* Icon buttons in the header tools cluster only. The language trigger is oneof them; its menu options keep their own option styling. */-#header .header-right button:not(.language-picker-option) {+#header .header-tools button:not(.language-picker-option) {background: none;border: none;color: var(--text-secondary);@@ -1296,12 +1300,12 @@ html[data-ui-scale-ready="false"] body { visibility: hidden; }transition: color 0.2s, background 0.2s;}-#header .header-right button:not(.language-picker-option):hover {+#header .header-tools button:not(.language-picker-option):hover {color: var(--text-primary);background: var(--accent-dim);}-#header .header-right button:not(.language-picker-option).active {+#header .header-tools button:not(.language-picker-option).active {color: var(--accent);background: var(--accent-dim);}@@ -3042,15 +3046,8 @@ html[data-standalone="true"] #header #btn-expand {display: none;}-html[data-standalone="true"] #header #btn-clear {- width: 26px;- min-width: 26px;- height: 26px;- padding: 0;- justify-content: center;-}--html[data-standalone="true"] #header #btn-clear .conversation-action-label {+/* Standalone chat has no History; New chat stays in the header. */+html[data-standalone="true"] #header #btn-history {display: none;}@@ -3061,16 +3058,12 @@ html[data-standalone="true"] #header #btn-clear .conversation-action-label {margin-bottom: 8px;}-/* Settings -> Mode selection: Automatic. The agent routes each turn, so the- Ask/Act/Dev toggle is hidden and the conversation actions keep the row. */-html[data-mode-selection="auto"] #mode-toggle {+/* Settings -> Mode selection is Automatic unless set to Manual. The agent+ routes each turn, so the Ask/Act/Dev row shows only in Manual. */+html:not([data-mode-selection="manual"]) .composer-control-row {display: none;}-html[data-mode-selection="auto"] .composer-control-row {- justify-content: flex-end;-}-#mode-toggle {display: flex;flex: 1 1 auto;@@ -3218,17 +3211,60 @@ html[data-ui-scale="175"] .conversation-action-label {flex-shrink: 0;}+/* Two rows: the message on top, then attach, the model picker and its+ status, and mic and send at the end. */#input-wrapper {display: flex;- align-items: center;- gap: 8px;+ flex-direction: column;+ align-items: stretch;+ gap: 4px;background: var(--bg-input);border: 1px solid var(--border);border-radius: var(--radius);- padding: 6px 8px;+ padding: 8px 8px 6px;transition: border-color 0.2s;}+.composer-toolbar {+ display: flex;+ align-items: center;+ gap: 6px;+ min-width: 0;+}++.composer-toolbar-spacer {+ flex: 1 1 0;+}++/* The model picker stays quiet until hovered; its menu opens upward. */+.composer-toolbar .provider-picker {+ max-width: 220px;+}++.composer-toolbar .provider-picker-btn {+ background: transparent;+ border-color: transparent;+ color: var(--text-secondary);+ padding: 4px 6px;+}++.composer-toolbar .provider-picker-btn:hover,+.composer-toolbar .provider-picker-btn[aria-expanded="true"] {+ background: var(--bg-secondary);+ border-color: var(--border);+ color: var(--text-primary);+}++.composer-toolbar .provider-picker-menu {+ top: auto;+ bottom: calc(100% + 6px);+}++html[dir="rtl"] .composer-toolbar .provider-picker-menu {+ left: auto;+ right: 0;+}+#input-wrapper:focus-within {border-color: var(--accent);}@@ -3443,8 +3479,8 @@ html[data-ui-scale="175"] .conversation-action-label {}#input-text-layer {- flex: 1;display: grid;+ padding-inline: 4px;min-width: 0;position: relative;}diff --git a/src/firefox/src/config-transfer.js b/src/firefox/src/config-transfer.jsindex 93f2d304d..6964be6a3 100644--- a/src/firefox/src/config-transfer.js+++ b/src/firefox/src/config-transfer.js@@ -27,7 +27,7 @@ export const DEFAULT_CONFIG_SETTINGS = Object.freeze({[UI_SCALE_STORAGE_KEY]: 100,verboseMode: false,composerDeliveryMode: 'queue',- modeSelection: 'manual',+ modeSelection: 'auto',selectionShortcutEnabled: true,[AUTO_GROUP_TABS_KEY]: true,helpImproveWebBrain: true,diff --git a/src/firefox/src/ui/settings.html b/src/firefox/src/ui/settings.htmlindex b05095598..7836d4020 100644--- a/src/firefox/src/ui/settings.html+++ b/src/firefox/src/ui/settings.html@@ -1404,8 +1404,8 @@<div class="setting-desc" data-i18n="st.display.mode_selection.desc"></div></div><select id="select-mode-selection" data-i18n-aria-label="st.display.mode_selection.label">- <option value="manual" data-i18n="st.display.mode_selection.manual"></option><option value="auto" data-i18n="st.display.mode_selection.auto"></option>+ <option value="manual" data-i18n="st.display.mode_selection.manual"></option></select></div><div class="setting-row">diff --git a/src/firefox/src/ui/settings.js b/src/firefox/src/ui/settings.jsindex cd22a3260..35053627a 100644--- a/src/firefox/src/ui/settings.js+++ b/src/firefox/src/ui/settings.js@@ -612,7 +612,7 @@ async function init() {providerFilter = stored.providerFilter;}verboseToggle.checked = stored.verboseMode || false;- if (modeSelectionSelect) modeSelectionSelect.value = stored.modeSelection === 'auto' ? 'auto' : 'manual';+ if (modeSelectionSelect) modeSelectionSelect.value = stored.modeSelection === 'manual' ? 'manual' : 'auto';if (composerDeliveryModeSelect) {composerDeliveryModeSelect.value = stored.composerDeliveryMode === 'steer' ? 'steer' : 'queue';}@@ -1258,7 +1258,7 @@ if (globalThis.browser?.storage?.onChanged) {// --- Display Settings ---modeSelectionSelect?.addEventListener('change', async () => {- const modeSelection = modeSelectionSelect.value === 'auto' ? 'auto' : 'manual';+ const modeSelection = modeSelectionSelect.value === 'manual' ? 'manual' : 'auto';await browser.storage.local.set({ modeSelection }).catch(() => {});});diff --git a/src/firefox/src/ui/sidepanel.html b/src/firefox/src/ui/sidepanel.htmlindex 0e7625bc0..cda2eecde 100644--- a/src/firefox/src/ui/sidepanel.html+++ b/src/firefox/src/ui/sidepanel.html@@ -148,24 +148,7 @@<!-- Header --><div class="header-shell"><header id="header">- <div class="header-left">- <div class="provider-picker" id="provider-picker">- <!-- Native select kept as the value source for existing handlers.- Closed button is text-only; brand icons show only in the open menu. -->- <select id="provider-select" class="provider-select-native" title="LLM Provider" tabindex="-1" aria-hidden="true"></select>- <button type="button" id="provider-picker-btn" class="provider-picker-btn" aria-haspopup="listbox" aria-expanded="false" aria-controls="provider-picker-menu" aria-label="LLM Provider">- <span class="provider-picker-label" id="provider-picker-label"></span>- <span class="provider-picker-caret" aria-hidden="true">- <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">- <polyline points="6 9 12 15 18 9"/>- </svg>- </span>- </button>- <div class="provider-picker-menu hidden" id="provider-picker-menu" role="listbox" tabindex="-1"></div>- </div>- <span id="status-dot" class="status-dot offline" data-i18n-title="sp.status.disconnected"></span>- </div>- <div class="header-right">+ <div class="header-tools"><div id="language-picker" class="language-picker"><select id="language-select" class="language-select-native" tabindex="-1" aria-hidden="true"></select><button type="button" id="language-picker-btn" class="language-picker-btn" aria-haspopup="listbox" aria-expanded="false" aria-controls="language-picker-menu" data-i18n-aria-label="sp.btn.language">@@ -207,6 +190,22 @@</svg></button></div>+ <div class="conversation-action-group header-conversation">+ <button id="btn-history" aria-haspopup="dialog" aria-controls="history-popover" aria-expanded="false" class="conversation-action" type="button" data-i18n-title="sp.btn.history_short" data-i18n-aria-label="sp.btn.history_short">+ <svg data-icon="history" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/>+ <path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>+ </svg>+ <span class="conversation-action-label" data-i18n="sp.btn.history_short">History</span>+ </button>+ <div id="history-popover" class="history-popover" popover="auto" role="dialog" aria-label="History" data-i18n-aria-label="sp.btn.history_short"></div>+ <button id="btn-clear" class="conversation-action" type="button" data-i18n-title="sp.btn.clear_short" data-i18n-aria-label="sp.btn.clear_short">+ <svg data-icon="plus" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <path d="M5 12h14"/><path d="M12 5v14"/>+ </svg>+ <span class="conversation-action-label" data-i18n="sp.btn.clear_short">New chat</span>+ </button>+ </div></header></div>@@ -335,22 +334,6 @@<button id="btn-mode-act" class="mode-btn" data-i18n="sp.mode.act" data-i18n-title="sp.mode.act.title"></button><button id="btn-mode-dev" class="mode-btn" data-i18n="sp.mode.dev" data-i18n-title="sp.mode.dev.title"></button></div>- <div class="conversation-action-group">- <button id="btn-history" aria-haspopup="dialog" aria-controls="history-popover" aria-expanded="false" class="conversation-action" type="button" data-i18n-title="sp.btn.history_short" data-i18n-aria-label="sp.btn.history_short">- <svg data-icon="history" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">- <path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/>- <path d="M3 3v5h5"/><path d="M12 7v5l4 2"/>- </svg>- <span class="conversation-action-label" data-i18n="sp.btn.history_short">History</span>- </button>- <div id="history-popover" class="history-popover" popover="auto" role="dialog" aria-label="History" data-i18n-aria-label="sp.btn.history_short"></div>- <button id="btn-clear" class="conversation-action" type="button" data-i18n-title="sp.btn.clear_short" data-i18n-aria-label="sp.btn.clear_short">- <svg data-icon="plus" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">- <path d="M5 12h14"/><path d="M12 5v14"/>- </svg>- <span class="conversation-action-label" data-i18n="sp.btn.clear_short">New chat</span>- </button>- </div></div><div id="queued-messages" class="queued-messages hidden" role="list" aria-live="polite"></div><div id="slash-command-menu" class="slash-command-menu hidden" role="listbox" data-i18n-aria-label="sp.slash.commands_label"></div>@@ -358,28 +341,46 @@<input type="file" id="file-attach-input" accept="image/*,application/pdf,application/json,text/plain,text/csv,text/markdown,video/mp4,video/quicktime,video/webm,.json,.txt,.csv,.md,.mp4,.m4v,.mov,.webm" multiple hidden><div id="input-wrapper">- <button id="btn-attach" data-i18n-title="sp.btn.attach">- <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round">- <path d="m16 6-8.4 8.6a2 2 0 0 0 2.8 2.8l8.4-8.6a4 4 0 0 0-5.6-5.6l-8.4 8.6a6 6 0 0 0 8.5 8.5l8.4-8.6"/>- </svg>- </button><div id="input-text-layer"><div id="input-highlight" aria-hidden="true"></div><textarea id="user-input" data-i18n-placeholder="sp.input.ask_placeholder" rows="1"></textarea></div>- <button id="btn-mic" data-i18n-title="sp.btn.mic">- <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round">- <path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z"/>- <path d="M19 10v2a7 7 0 0 1-14 0v-2"/>- <path d="M12 19v3"/>- <path d="M8 22h8"/>- </svg>- </button>- <button id="btn-send" data-i18n-title="sp.btn.send">- <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor">- <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/>- </svg>- </button>+ <div class="composer-toolbar">+ <button id="btn-attach" data-i18n-title="sp.btn.attach">+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round">+ <path d="m16 6-8.4 8.6a2 2 0 0 0 2.8 2.8l8.4-8.6a4 4 0 0 0-5.6-5.6l-8.4 8.6a6 6 0 0 0 8.5 8.5l8.4-8.6"/>+ </svg>+ </button>+ <div class="provider-picker" id="provider-picker">+ <!-- Native select kept as the value source for existing handlers.+ Closed button is text-only; brand icons show only in the open menu. -->+ <select id="provider-select" class="provider-select-native" title="LLM Provider" tabindex="-1" aria-hidden="true"></select>+ <button type="button" id="provider-picker-btn" class="provider-picker-btn" aria-haspopup="listbox" aria-expanded="false" aria-controls="provider-picker-menu" aria-label="LLM Provider">+ <span class="provider-picker-label" id="provider-picker-label"></span>+ <span class="provider-picker-caret" aria-hidden="true">+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">+ <polyline points="6 9 12 15 18 9"/>+ </svg>+ </span>+ </button>+ <div class="provider-picker-menu hidden" id="provider-picker-menu" role="listbox" tabindex="-1"></div>+ </div>+ <span id="status-dot" class="status-dot offline" data-i18n-title="sp.status.disconnected"></span>+ <span class="composer-toolbar-spacer" aria-hidden="true"></span>+ <button id="btn-mic" data-i18n-title="sp.btn.mic">+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round">+ <path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3z"/>+ <path d="M19 10v2a7 7 0 0 1-14 0v-2"/>+ <path d="M12 19v3"/>+ <path d="M8 22h8"/>+ </svg>+ </button>+ <button id="btn-send" data-i18n-title="sp.btn.send">+ <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor">+ <path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"/>+ </svg>+ </button>+ </div></div></div></div>diff --git a/src/firefox/src/ui/sidepanel.js b/src/firefox/src/ui/sidepanel.jsindex 2c3cfa1ea..886e3ca14 100644--- a/src/firefox/src/ui/sidepanel.js+++ b/src/firefox/src/ui/sidepanel.js@@ -1127,10 +1127,11 @@ let currentAssistantEl = null;let verboseMode = false;let compactProgressVisible = true;let agentMode = 'ask'; // 'ask' | 'act' | 'dev'-// Settings β Mode selection. In Automatic the toggle is hidden, the composer-// sends "auto" and the agent routes each turn (src/*/src/agent/auto-mode.js);-// slash commands and the mode shortcuts choose a mode for one message.-let autoModeSelection = false;+// Settings β Mode selection, Automatic unless set to Manual. In Automatic the+// toggle is hidden, the composer sends "auto" and the agent routes each turn+// (src/*/src/agent/auto-mode.js); slash commands and the mode shortcuts+// choose a mode for one message. The standalone window always stays in Ask.+let autoModeSelection = !isStandaloneWindow;let abortRequested = false;const awaitingPlanReviewTabs = new Set();const processingTabs = new Set();@@ -1991,7 +1992,7 @@ browser.storage.onChanged.addListener((changes, area) => {});function applyModeSelection(value) {- autoModeSelection = value === 'auto' && !isStandaloneWindow;+ autoModeSelection = value !== 'manual' && !isStandaloneWindow;document.documentElement.dataset.modeSelection = autoModeSelection ? 'auto' : 'manual';// A mode pinned before switching to Automatic must not linger in the// composer styling; Automatic chooses per turn.@@ -15463,10 +15464,17 @@ historyBtn?.addEventListener('click', async () => {if (historyPopover.matches(':popover-open')) { historyPopover.hidePopover(); return; }const request = ++historyPopoverRequest;const tabId = currentTabId;+ // History sits in the header: open below it, end-aligned with the button.+ // The rect is in zoomed pixels, while the popover's own lengths are not.+ const zoom = uiScaleZoom();const anchor = historyBtn.getBoundingClientRect();- historyPopover.style.left = `${Math.max(8, Math.min(anchor.right - 320, window.innerWidth - 328))}px`;- historyPopover.style.bottom = `${window.innerHeight - anchor.top + 8}px`;- historyPopover.style.maxHeight = `${Math.max(60, Math.min(420, anchor.top - 16))}px`;+ const width = 320 * zoom;+ const left = Math.max(8, Math.min(anchor.right - width, window.innerWidth - width - 8));+ const top = anchor.bottom + 8;+ historyPopover.style.left = `${left / zoom}px`;+ historyPopover.style.top = `${top / zoom}px`;+ historyPopover.style.bottom = 'auto';+ historyPopover.style.maxHeight = `${Math.max(60, Math.min(420, (window.innerHeight - top - 8) / zoom))}px`;historyPopover.replaceChildren();const status = document.createElement('p');status.textContent = t('sp.history.loading');diff --git a/src/firefox/src/ui/theme-bootstrap.js b/src/firefox/src/ui/theme-bootstrap.jsindex ecfdaf816..e1d6a7cbe 100644--- a/src/firefox/src/ui/theme-bootstrap.js+++ b/src/firefox/src/ui/theme-bootstrap.js@@ -13,15 +13,9 @@try {var params = new URLSearchParams(window.location.search);if (params.get('standalone') === 'true') {+ // Standalone chat has no History; its stylesheet hides History and+ // the pop-out button and keeps New chat in the header.document.documentElement.setAttribute('data-standalone', 'true');- // Standalone chat has no History strip. Reuse the existing New chat- // button so its confirmation and event wiring remain unchanged.- window.addEventListener('DOMContentLoaded', function () {- var headerActions = document.querySelector('#header .header-right');- var newChat = document.getElementById('btn-clear');- var expand = document.getElementById('btn-expand');- if (headerActions && newChat) headerActions.insertBefore(newChat, expand);- }, { once: true });}} catch (_) { /* ignore */ }diff --git a/src/firefox/styles/sidepanel.css b/src/firefox/styles/sidepanel.cssindex 80c5d4baf..4bc75c659 100644--- a/src/firefox/styles/sidepanel.css+++ b/src/firefox/styles/sidepanel.css@@ -704,23 +704,19 @@ html[data-ui-scale-ready="false"] body { visibility: hidden; }flex-shrink: 0;}-.header-left {- display: flex;- align-items: center;- gap: 6px;- flex: 1;- min-width: 0;- /* Keep the status-dot glued to the provider picker β don't let the- picker stretch across the header and park the dot next to language. */-}--.header-right {+/* Display tools (language, scale, Settings, pop-out) sit at the start of the+ header and the conversation actions (History, New chat) at its end. */+.header-tools {display: flex;align-items: center;gap: 2px;flex-shrink: 0;}+.header-conversation {+ margin-inline-start: auto;+}+.ui-scale-menu {position: relative;}@@ -729,9 +725,10 @@ html[data-ui-scale-ready="false"] body { visibility: hidden; }position: absolute;z-index: 30;top: calc(100% + 7px);- /* Logical, so the popover opens inward from the trigger in RTL locales+ /* The trigger sits at the start of the header: align the popover to the+ trigger's start edge (logical, so RTL locales also open it inward)instead of off the panel edge. */- inset-inline-end: 0;+ inset-inline-start: 0;display: flex;align-items: center;gap: 5px;@@ -745,9 +742,9 @@ html[data-ui-scale-ready="false"] body { visibility: hidden; }.ui-scale-popover.hidden { display: none; }-/* Two ids: the generic `#header .header-right button:not(...)` rule below is+/* Two ids: the generic `#header .header-tools button:not(...)` rule below ismore specific than a class-based selector, and these chips live inside- .header-right. */+ .header-tools. */#header #ui-scale-popover button {min-width: 28px;min-height: 28px;@@ -759,7 +756,7 @@ html[data-ui-scale-ready="false"] body { visibility: hidden; }font: inherit;}-/* The base rule above (two ids) outranks the generic `.header-right+/* The base rule above (two ids) outranks the generic `.header-toolsbutton:hover`, so these chips need their own hover to react at all. */#header #ui-scale-popover button:hover:not(:disabled) { background: var(--accent-dim); }#header #ui-scale-popover button:disabled { opacity: 0.45; cursor: default; }@@ -1016,9 +1013,9 @@ html[data-ui-scale-ready="false"] body { visibility: hidden; }flex: 0 0 auto;}-/* Two selectors deep: the generic `#header .header-right button:not(...)` rule- below outranks a bare class selector, and this trigger lives in .header-right. */-#header .header-right button.language-picker-btn[aria-expanded="true"] {+/* Two selectors deep: the generic `#header .header-tools button:not(...)` rule+ below outranks a bare class selector, and this trigger lives in .header-tools. */+#header .header-tools button.language-picker-btn[aria-expanded="true"] {color: var(--text-primary);background: var(--accent-dim);}@@ -1036,15 +1033,22 @@ html[data-ui-scale-ready="false"] body { visibility: hidden; }background: var(--bg-input);}+/* Opens inward from the start of the header. The menu itself is always+ LTR, so its side follows the document direction explicitly. */.language-picker-menu {- right: 0;- left: auto;+ left: 0;+ right: auto;min-width: 224px;max-width: min(272px, calc(100vw / var(--ui-scale-zoom, 1) - 16px));max-height: min(352px, calc(60vh / var(--ui-scale-zoom, 1)));direction: ltr;}+html[dir="rtl"] .language-picker-menu {+ left: auto;+ right: 0;+}+.language-picker-option {direction: ltr;text-align: left;@@ -1114,9 +1118,9 @@ html[data-ui-scale-ready="false"] body { visibility: hidden; }background: var(--border);}-/* Icon buttons in the header-right cluster only. The language trigger is one+/* Icon buttons in the header tools cluster only. The language trigger is oneof them; its menu options keep their own option styling. */-#header .header-right button:not(.language-picker-option) {+#header .header-tools button:not(.language-picker-option) {background: none;border: none;color: var(--text-secondary);@@ -1128,12 +1132,12 @@ html[data-ui-scale-ready="false"] body { visibility: hidden; }transition: color 0.2s, background 0.2s;}-#header .header-right button:not(.language-picker-option):hover {+#header .header-tools button:not(.language-picker-option):hover {color: var(--text-primary);background: var(--accent-dim);}-#header .header-right button:not(.language-picker-option).active {+#header .header-tools button:not(.language-picker-option).active {color: var(--accent);background: var(--accent-dim);}@@ -2868,15 +2872,8 @@ html[data-standalone="true"] #header #btn-expand {display: none;}-html[data-standalone="true"] #header #btn-clear {- width: 26px;- min-width: 26px;- height: 26px;- padding: 0;- justify-content: center;-}--html[data-standalone="true"] #header #btn-clear .conversation-action-label {+/* Standalone chat has no History; New chat stays in the header. */+html[data-standalone="true"] #header #btn-history {display: none;}@@ -2887,16 +2884,12 @@ html[data-standalone="true"] #header #btn-clear .conversation-action-label {margin-bottom: 8px;}-/* Settings -> Mode selection: Automatic. The agent routes each turn, so the- Ask/Act/Dev toggle is hidden and the conversation actions keep the row. */-html[data-mode-selection="auto"] #mode-toggle {+/* Settings -> Mode selection is Automatic unless set to Manual. The agent+ routes each turn, so the Ask/Act/Dev row shows only in Manual. */+html:not([data-mode-selection="manual"]) .composer-control-row {display: none;}-html[data-mode-selection="auto"] .composer-control-row {- justify-content: flex-end;-}-#mode-toggle {display: flex;flex: 1 1 auto;@@ -3044,17 +3037,60 @@ html[data-ui-scale="175"] .conversation-action-label {flex-shrink: 0;}+/* Two rows: the message on top, then attach, the model picker and its+ status, and mic and send at the end. */#input-wrapper {display: flex;- align-items: center;- gap: 8px;+ flex-direction: column;+ align-items: stretch;+ gap: 4px;background: var(--bg-input);border: 1px solid var(--border);border-radius: var(--radius);- padding: 6px 8px;+ padding: 8px 8px 6px;transition: border-color 0.2s;}+.composer-toolbar {+ display: flex;+ align-items: center;+ gap: 6px;+ min-width: 0;+}++.composer-toolbar-spacer {+ flex: 1 1 0;+}++/* The model picker stays quiet until hovered; its menu opens upward. */+.composer-toolbar .provider-picker {+ max-width: 220px;+}++.composer-toolbar .provider-picker-btn {+ background: transparent;+ border-color: transparent;+ color: var(--text-secondary);+ padding: 4px 6px;+}++.composer-toolbar .provider-picker-btn:hover,+.composer-toolbar .provider-picker-btn[aria-expanded="true"] {+ background: var(--bg-secondary);+ border-color: var(--border);+ color: var(--text-primary);+}++.composer-toolbar .provider-picker-menu {+ top: auto;+ bottom: calc(100% + 6px);+}++html[dir="rtl"] .composer-toolbar .provider-picker-menu {+ left: auto;+ right: 0;+}+#input-wrapper:focus-within {border-color: var(--accent);}@@ -3269,8 +3305,8 @@ html[data-ui-scale="175"] .conversation-action-label {}#input-text-layer {- flex: 1;display: grid;+ padding-inline: 4px;min-width: 0;position: relative;}diff --git a/test/auto-mode.mjs b/test/auto-mode.mjsindex 654bbcb6f..f4cba51b5 100644--- a/test/auto-mode.mjs+++ b/test/auto-mode.mjs@@ -622,11 +622,26 @@ for (const build of BUILDS) {assert.deepEqual([...context.keys.auto], [context.keys.ask[0], 'sp.input.act_placeholder', ...context.keys.ask.slice(1)], 'Automatic keeps each build\'s Ask tips');});- test(`${build}: Automatic hides the toggle through the document mode-selection state`, () => {+ test(`${build}: Automatic is the default and hides the mode row through the document state`, () => {const css = readFileSync(new URL(`../src/${build}/styles/sidepanel.css`, import.meta.url), 'utf8');- assert.match(css, /html\[data-mode-selection="auto"\] #mode-toggle \{\s*display: none;/);- assert.match(panel, /document\.documentElement\.dataset\.modeSelection = autoModeSelection \? 'auto' : 'manual';/);+ // Hidden until the panel knows the setting is Manual, so Automatic never flashes the row.+ assert.match(css, /html:not\(\[data-mode-selection="manual"\]\) \.composer-control-row \{\s*display: none;/);+ assert.match(panel, /let autoModeSelection = !isStandaloneWindow;/);assert.match(panel, /storage\.local\.get\('modeSelection'\)/);+ const dataset = {};+ const context = vm.createContext({+ isStandaloneWindow: false, autoModeSelection: true, agentMode: 'ask', processingTabs: new Set(),+ devDiagnosticsDrainDeferred: false, document: { documentElement: { dataset } },+ setMode() {}, updateActWarning() {}, resetInputPlaceholderRotation() {},+ });+ vm.runInContext(extract(panel, 'applyModeSelection'), context);+ for (const [stored, expected] of [[undefined, 'auto'], ['auto', 'auto'], ['manual', 'manual'], ['anything', 'auto']]) {+ context.applyModeSelection(stored);+ assert.deepEqual([dataset.modeSelection, context.autoModeSelection], [expected, expected === 'auto'], String(stored));+ }+ context.isStandaloneWindow = true;+ context.applyModeSelection(undefined);+ assert.deepEqual([dataset.modeSelection, context.autoModeSelection], ['manual', false], 'the standalone window stays in Ask');});test(`${build}: the background restarts a hand-off under the same request and reports the routed mode`, () => {@@ -651,14 +666,15 @@ for (const build of BUILDS) {assert.equal(journal.get(5).mode, 'act');});- test(`${build}: Mode selection is a portable setting, Manual by default, in every language`, async () => {+ test(`${build}: Mode selection is a portable setting, Automatic by default, in every language`, async () => {const settingsHtml = source(build, 'ui/settings.html');- assert.match(settingsHtml, /<select id="select-mode-selection"[^>]*>\s*<option value="manual"[^>]*><\/option>\s*<option value="auto"[^>]*><\/option>/);+ assert.match(settingsHtml, /<select id="select-mode-selection"[^>]*>\s*<option value="auto"[^>]*><\/option>\s*<option value="manual"[^>]*><\/option>/);const settingsJs = source(build, 'ui/settings.js');- assert.match(settingsJs, /modeSelectionSelect\.value = stored\.modeSelection === 'auto' \? 'auto' : 'manual';/);+ assert.match(settingsJs, /modeSelectionSelect\.value = stored\.modeSelection === 'manual' \? 'manual' : 'auto';/);+ assert.match(settingsJs, /const modeSelection = modeSelectionSelect\.value === 'manual' \? 'manual' : 'auto';/);assert.match(settingsJs, /storage\.local\.set\(\{ modeSelection \}\)/);const config = await import(`../src/${build}/src/config-transfer.js`);- assert.equal(config.DEFAULT_CONFIG_SETTINGS.modeSelection, 'manual');+ assert.equal(config.DEFAULT_CONFIG_SETTINGS.modeSelection, 'auto');assert.ok(config.CONFIG_STORAGE_KEYS.includes('modeSelection'));const directory = new URL(`../src/${build}/src/ui/locales/`, import.meta.url);const english = (await import(new URL('en.js', directory))).default;diff --git a/test/history-recovery.mjs b/test/history-recovery.mjsindex 4329fa35e..dadcd6029 100644--- a/test/history-recovery.mjs+++ b/test/history-recovery.mjs@@ -60,7 +60,7 @@ for (const build of ['chrome', 'firefox']) {});await page.goto('http://history.test/');await page.addStyleTag({ content: await readFile(`src/${build}/styles/sidepanel.css`, 'utf8') });- await page.addStyleTag({ content: '#btn-history { position: fixed; bottom: 100px; right: 30px; }' });+ await page.addStyleTag({ content: '#btn-history { position: fixed; top: 10px; right: 30px; }' });await page.addScriptTag({ type: 'module', content: `import * as store from '/src/ui/chat-history-store.js'; window.store = store;` });await page.waitForFunction(() => window.store);const abortResult = await page.evaluate(async () => {@@ -135,6 +135,7 @@ for (const build of ['chrome', 'firefox']) {const historyPopover = document.getElementById('history-popover');const historyBtn = document.getElementById('btn-history');let historyPopoverRequest = 0, currentTabId = 42;+ const uiScaleZoom = () => 1;const t = key => ({'sp.history.recover':'Recover','sp.history.recent':'Recent conversations for this URL','sp.providers.more':'Moreβ¦'}[key] || key), getLocale = () => 'en';const sameTabId = (a,b) => a === b;const getTabInfoForHistory = async () => ({url: 'https://example.com/page'});@@ -147,6 +148,12 @@ for (const build of ['chrome', 'firefox']) {await page.click('#btn-history');await page.waitForFunction(() => document.querySelectorAll('.history-popover-record').length === 5);assert.deepEqual(await page.locator('.history-popover-record strong').allTextContents(), [7,6,5,4,3].map(n => 'Conversation ' + n));+ const placement = await page.evaluate(() => {+ const button = document.querySelector('#btn-history').getBoundingClientRect();+ const popover = document.querySelector('#history-popover').getBoundingClientRect();+ return { below: popover.top >= button.bottom, inside: popover.left >= 0 && popover.right <= window.innerWidth, endAligned: Math.abs(popover.right - button.right) <= 1 };+ });+ assert.deepEqual(placement, { below: true, inside: true, endAligned: true }, 'History in the header opens below its button, end-aligned and inside the panel');if (process.env.HISTORY_SCREENSHOT && build === 'chrome') await page.screenshot({ path: process.env.HISTORY_SCREENSHOT });await page.locator('.history-popover-record button').first().click();assert.deepEqual(await page.evaluate(() => window.recovered), ['7',42,'https://example.com/page']);diff --git a/test/run.js b/test/run.jsindex 453980bb6..16bb96ace 100644--- a/test/run.js+++ b/test/run.js@@ -43348,35 +43348,46 @@ test('sidepanel language picker uses the provider-style accessible listbox with}});-test('sidepanel separates mode navigation from compact composer conversation actions', () => {+test('sidepanel keeps display tools and conversation actions in the header and the model picker in the composer', () => {for (const [label, prefix] of [['chrome', 'src/chrome'],['firefox', 'src/firefox'],]) {const html = fs.readFileSync(path.join(ROOT, prefix, 'src/ui/sidepanel.html'), 'utf8');const css = fs.readFileSync(path.join(ROOT, prefix, 'styles/sidepanel.css'), 'utf8');+ const panel = fs.readFileSync(path.join(ROOT, prefix, 'src/ui/sidepanel.js'), 'utf8');const header = html.match(/<header id="header">[\s\S]*?<\/header>/)?.[0] || '';const inputStart = html.indexOf('<div id="input-area">');const inputEnd = html.indexOf('<div id="queued-messages"', inputStart);const controls = html.slice(inputStart, inputEnd);+ const tools = header.match(/<div class="header-tools">[\s\S]*?\n <\/div>\n/)?.[0] || '';+ const conversation = header.slice(header.indexOf('class="conversation-action-group header-conversation"'));for (const id of ['btn-expand', 'btn-ui-scale', 'btn-settings']) {- assert.match(header, new RegExp(`id="${id}"`), `${label}: ${id} should remain in the primary header`);+ assert.match(tools, new RegExp(`id="${id}"`), `${label}: ${id} should stay with the header display tools`);}- assert.match(header, /id="language-picker"[\s\S]*?id="btn-ui-scale"[\s\S]*?id="btn-settings"[\s\S]*?id="btn-expand"/, `${label}: primary actions should run the display preferences, then Settings, then pop-out`);- assert.doesNotMatch(header, /id="btn-(?:clear|history)"/, `${label}: conversation actions should leave the primary header`);+ assert.match(tools, /id="language-picker"[\s\S]*?id="btn-ui-scale"[\s\S]*?id="btn-settings"[\s\S]*?id="btn-expand"/, `${label}: the display tools should run the display preferences, then Settings, then pop-out`);+ assert.ok(header.indexOf('class="header-tools"') < header.indexOf('header-conversation'), `${label}: the display tools should lead the header and the conversation actions close it`);+ assert.match(conversation, /id="btn-history"[\s\S]*?id="history-popover"[\s\S]*?id="btn-clear"/, `${label}: History and New chat should close the header, with the creation action at its edge`);+ assert.doesNotMatch(header, /id="provider-picker"|id="mode-toggle"/, `${label}: the model picker and the modes should leave the header`);assert.doesNotMatch(html, /class="conversation-actions"/, `${label}: conversation actions should no longer float over chat content`);- assert.match(controls, /class="composer-control-row"[\s\S]*?id="mode-toggle"[\s\S]*?id="btn-mode-ask"[\s\S]*?id="btn-mode-act"[\s\S]*?id="btn-mode-dev"[\s\S]*?class="conversation-action-group"[\s\S]*?id="btn-history"[\s\S]*?id="btn-clear"/, `${label}: segmented modes should precede distinct History and New chat buttons, with the creation action at the row edge`);- assert.match(controls, /id="btn-clear"[\s\S]*?data-i18n-title="sp\.btn\.clear_short"[\s\S]*?data-i18n-aria-label="sp\.btn\.clear_short"[\s\S]*?data-icon="plus"[\s\S]*?sp\.btn\.clear_short/, `${label}: New chat should have a plus icon, short tooltip, accessible name, and localized wide label`);- assert.match(controls, /id="btn-history"[\s\S]*?data-i18n-title="sp\.btn\.history_short"[\s\S]*?data-i18n-aria-label="sp\.btn\.history_short"[\s\S]*?data-icon="history"[\s\S]*?sp\.btn\.history_short/, `${label}: History should have a native-theme icon, short tooltip, accessible name, and localized wide label`);- assert.match(css, /\.composer-control-row \{[\s\S]*?display: flex;[\s\S]*?gap: 6px;[\s\S]*?margin-bottom: 8px;/, `${label}: modes and conversation actions should share one compact row with visible group separation`);+ assert.match(controls, /class="composer-control-row"[\s\S]*?id="mode-toggle"[\s\S]*?id="btn-mode-ask"[\s\S]*?id="btn-mode-act"[\s\S]*?id="btn-mode-dev"/, `${label}: Manual keeps the segmented modes above the composer`);+ assert.doesNotMatch(controls, /id="btn-(?:clear|history)"/, `${label}: the mode row should not repeat the conversation actions`);+ const composer = html.slice(html.indexOf('<div id="input-wrapper">'), html.indexOf('<button id="selection-ask-action"'));+ assert.match(composer, /id="input-text-layer"[\s\S]*?class="composer-toolbar"[\s\S]*?id="btn-attach"[\s\S]*?id="provider-picker"[\s\S]*?id="provider-picker-menu"[\s\S]*?id="status-dot"[\s\S]*?id="btn-mic"[\s\S]*?id="btn-send"/, `${label}: the composer should put the message first, then attach, the model picker and its status, mic and send`);+ assert.match(css, /\.composer-toolbar \.provider-picker-menu \{\s*top: auto;\s*bottom: calc\(100% \+ 6px\);/, `${label}: the composer model menu should open upward`);+ assert.match(css, /#input-wrapper \{[\s\S]*?flex-direction: column;/, `${label}: the composer should stack the message above its toolbar`);+ assert.match(conversation, /id="btn-clear"[\s\S]*?data-i18n-title="sp\.btn\.clear_short"[\s\S]*?data-i18n-aria-label="sp\.btn\.clear_short"[\s\S]*?data-icon="plus"[\s\S]*?sp\.btn\.clear_short/, `${label}: New chat should have a plus icon, short tooltip, accessible name, and localized wide label`);+ assert.match(conversation, /id="btn-history"[\s\S]*?data-i18n-title="sp\.btn\.history_short"[\s\S]*?data-i18n-aria-label="sp\.btn\.history_short"[\s\S]*?data-icon="history"[\s\S]*?sp\.btn\.history_short/, `${label}: History should have a native-theme icon, short tooltip, accessible name, and localized wide label`);+ assert.match(panel, /historyBtn\?\.addEventListener\('click'[\s\S]*?const top = anchor\.bottom \+ 8;[\s\S]*?historyPopover\.style\.top = `\$\{top \/ zoom\}px`;/, `${label}: History in the header should open its popover below the button`);+ assert.match(css, /\.composer-control-row \{[\s\S]*?display: flex;[\s\S]*?gap: 6px;[\s\S]*?margin-bottom: 8px;/, `${label}: the Manual mode row should keep its compact spacing`);assert.match(css, /#mode-toggle \{[\s\S]*?flex: 1 1 auto;[\s\S]*?min-width: 0;[\s\S]*?background: var\(--bg-input\);[\s\S]*?border: 1px solid var\(--border\);/, `${label}: Ask, Act, and Dev should remain one segmented control`);assert.match(css, /\.conversation-action-group \{[\s\S]*?gap: 4px;[\s\S]*?flex: 0 0 auto;/, `${label}: History and New chat should remain separate utility buttons`);assert.match(css, /\.conversation-action \{[\s\S]*?height: 30px;[\s\S]*?border: 1px solid var\(--border\);[\s\S]*?background: var\(--bg-input\);/, `${label}: utility actions should use standalone button chrome rather than segmented navigation styling`);assert.match(css, /@media \(max-width: 430px\) \{[\s\S]*?\.conversation-action \{[\s\S]*?width: 30px;[\s\S]*?\.conversation-action-label \{[\s\S]*?display: none;/, `${label}: narrow sidebars should reduce New chat and History to tooltip-backed icon buttons`);assert.match(css, /html\[data-ui-scale="150"\] \.conversation-action,[\s\S]*?html\[data-ui-scale="175"\] \.conversation-action[\s\S]*?width: 30px;[\s\S]*?html\[data-ui-scale="175"\] \.conversation-action-label[\s\S]*?display: none;/, `${label}: high supported UI scales should keep localized utility labels from clipping the composer row`);- assert.doesNotMatch(css, /@media \(max-width: 380px\) \{[\s\S]*?\.header-right \{ gap: 0; \}/, `${label}: narrow panels should preserve the normal spacing between the three primary icons`);- assert.doesNotMatch(css, /@media \(max-width: 380px\) \{[\s\S]*?#header \.header-right button[^\n]*padding-inline: 2px;/, `${label}: narrow panels should preserve the normal primary-icon padding`);+ assert.doesNotMatch(css, /@media \(max-width: 380px\) \{[\s\S]*?\.header-tools \{ gap: 0; \}/, `${label}: narrow panels should preserve the normal spacing between the primary icons`);+ assert.doesNotMatch(css, /@media \(max-width: 380px\) \{[\s\S]*?#header \.header-tools button[^\n]*padding-inline: 2px;/, `${label}: narrow panels should preserve the normal primary-icon padding`);if (label === 'chrome') {assert.match(html, /id="inspection-banner"[\s\S]*?id="recording-banner"[\s\S]*?class="recording-label"[\s\S]*?id="recording-timer"[\s\S]*?id="btn-recording-stop"[\s\S]*?id="scheduled-jobs"/, 'chrome: recording should return to its independent in-flow status bar');@@ -47020,10 +47031,11 @@ test('sidepanel UI scale controls are available, persistent, and localized', asyassert.match(sidepanelJs, /if \(closeUiScalePopover\(\)\) \{[\s\S]*?return;[\s\S]*?if \(isProcessing\)[\s\S]*?abortRun\(\)/, `${label}: Escape should close the scale popover instead of aborting the active run`);assert.match(sidepanelJs, /await setSidepanelUiScale\(scaleAction\)\.catch\(\(\) => \{\}\)/, `${label}: keyboard scale steps should not reject unhandled when the write fails`);assert.match(sidepanelCss, /#header #ui-scale-popover button \{/, `${label}: popover chips should outrank the generic header icon button rule`);- assert.match(sidepanelCss, /#header \.header-right button\.language-picker-btn\[aria-expanded="true"\] \{/, `${label}: the open language trigger should outrank the generic header icon button rule`);- assert.match(sidepanelCss, /\.ui-scale-popover \{[\s\S]*?inset-inline-end: 0;/, `${label}: the scale popover should be offset logically so RTL locales open it inward`);+ assert.match(sidepanelCss, /#header \.header-tools button\.language-picker-btn\[aria-expanded="true"\] \{/, `${label}: the open language trigger should outrank the generic header icon button rule`);+ assert.match(sidepanelCss, /\.ui-scale-popover \{[\s\S]*?inset-inline-start: 0;/, `${label}: the scale popover should be offset logically so RTL locales open it inward from the header start`);+ assert.match(sidepanelCss, /\.language-picker-menu \{\s*left: 0;\s*right: auto;[\s\S]*?html\[dir="rtl"\] \.language-picker-menu \{\s*left: auto;\s*right: 0;/, `${label}: the always-LTR language menu should open inward from the header start in both directions`);assert.ok(- sidepanelCss.indexOf('@media (max-width: 380px)') > sidepanelCss.lastIndexOf('#header .header-right button:not(.language-picker-option).active'),+ sidepanelCss.indexOf('@media (max-width: 380px)') > sidepanelCss.lastIndexOf('#header .header-tools button:not(.language-picker-option).active'),`${label}: the narrow-panel header overrides must follow the header button rules they override`,);assert.doesNotMatch(sidepanelCss, /max-height: min\(320px, 50vh\)/, `${label}: viewport clamps inside the zoomed body should divide the zoom back out`);@@ -51874,10 +51886,10 @@ test('standalone window transport, sizing, and translations are mirrored', asyncassert.doesNotMatch(markup, /id="btn-expand"[\s\S]*?M9 21H3v-6[\s\S]*?M3 21l7-7/, `${label}: standalone launcher still uses the maximize icon`);assert.match(bootstrap, /params\.get\('standalone'\) === 'true'[\s\S]*?setAttribute\('data-standalone', 'true'\)/, `${label}: standalone mode is not marked before first paint`);assert.match(css, /html\[data-standalone="true"\] \.composer-control-row \{\s*display: none;/, `${label}: standalone window still shows the History control bar`);- assert.match(bootstrap, /params\.get\('standalone'\) === 'true'[\s\S]*?window\.addEventListener\('DOMContentLoaded'[\s\S]*?document\.querySelector\('#header \.header-right'\)[\s\S]*?document\.getElementById\('btn-clear'\)[\s\S]*?headerActions\.insertBefore\(newChat, expand\);/, `${label}: standalone New chat control is not moved to the header before interaction`);- assert.match(css, /html\[data-standalone="true"\] #header #btn-expand \{\s*display: none;/, `${label}: standalone header still reserves the far-right position for its redundant launcher`);- assert.match(css, /html\[data-standalone="true"\] #header #btn-clear \{[\s\S]*?width: 26px;[\s\S]*?height: 26px;[\s\S]*?justify-content: center;/, `${label}: standalone New chat should be a compact header icon`);- assert.match(css, /html\[data-standalone="true"\] #header #btn-clear \.conversation-action-label \{\s*display: none;/, `${label}: standalone New chat should not retain its wide text label`);+ assert.match(markup.match(/<header id="header">[\s\S]*?<\/header>/)?.[0] || '', /id="btn-clear"/, `${label}: standalone New chat control is not in the header`);+ assert.doesNotMatch(bootstrap, /insertBefore\(newChat/, `${label}: New chat already lives in the header and should not be moved at load`);+ assert.match(css, /html\[data-standalone="true"\] #header #btn-expand \{\s*display: none;/, `${label}: standalone header still shows its redundant launcher`);+ assert.match(css, /html\[data-standalone="true"\] #header #btn-history \{\s*display: none;/, `${label}: standalone header should not offer History`);assert.match(panel, /function normalizeAgentMode\(mode\) \{\s*if \(isStandaloneWindow\) return 'ask';/, `${label}: standalone mode is not pinned to Ask`);assert.match(panel, /function setMode\(mode\) \{\s*mode = normalizeAgentMode\(mode\);/, `${label}: visible mode changes bypass the standalone Ask boundary`);assert.match(panel, /function modeForMessageText\(text\) \{\s*if \(isStandaloneWindow\) return 'ask';/, `${label}: slash commands can change standalone mode`);