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
fix: correlate navigation with dispatched page actions
Barack Sokullud3a600e25e5e
diff --git a/docs/page-feedback-monitor.md b/docs/page-feedback-monitor.mdindex c3adaf159..96f56e8ff 100644--- a/docs/page-feedback-monitor.md+++ b/docs/page-feedback-monitor.md@@ -65,6 +65,11 @@ job ID and wait for that job's assistant bubble. Cloud updates expose only eventmetadata and a generic navigation message, in both secret modes. Completion andcancellation remove the monitor and its pending run state.+Click navigation correlation starts with matching page input, rather than the+preparation handshake. Proven undispatched actions release their navigation+marker. Notice IDs capture the consumed batch revision before the asynchronous+page read, so navigation arriving during that read keeps its own persisted note.+## Verification`npm run test:page-feedback` runs the controller/transport/workflow/cloud/schedulerdiff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.jsindex cddf6298b..713a2ef16 100644--- a/src/chrome/src/agent/agent.js+++ b/src/chrome/src/agent/agent.js@@ -33099,7 +33099,7 @@ If the user has already named or confirmed this exact recipient, do NOT ask agaiif (!before?.documentId) {return { success: false, error: 'inject_css: could not identify the current document.' };}- await beforePageAgentDispatch(chrome, tabId, { kind: 'dom' });+ await beforePageAgentDispatch(globalThis.chrome, tabId, { kind: 'dom' });await chrome.scripting.insertCSS({ target: { tabId }, css: injectedCss, origin: 'AUTHOR' });const after = await this._getDevDocumentIdentity(tabId);if (after?.documentId !== before.documentId) {@@ -33190,7 +33190,7 @@ If the user has already named or confirmed this exact recipient, do NOT ask agaierror: `remove_injected_css: patchId "${patchId}" belongs to a document that is no longer loaded.`,};}- await beforePageAgentDispatch(chrome, tabId, { kind: 'dom' });+ await beforePageAgentDispatch(globalThis.chrome, tabId, { kind: 'dom' });await chrome.scripting.removeCSS({ target: { tabId }, css: patch.injectedCss || patch.css, origin: 'AUTHOR' });this._devCssPatches?.delete(patchId);try { await chrome.storage.session.remove(storageKey); } catch {}@@ -33231,7 +33231,7 @@ If the user has already named or confirmed this exact recipient, do NOT ask agai// callers use an explicit `return` for readback instead of having to// squeeze a multi-statement edit into one JavaScript expression.let expression = `(async () => {\n${code}\n})()\n//# sourceURL=webbrain-dev-execute.js`;- const pageGuard = await beforePageAgentDispatch(chrome, tabId, { kind: 'dom' });+ const pageGuard = await beforePageAgentDispatch(globalThis.chrome, tabId, { kind: 'dom' });if (pageGuard) expression = `document.dispatchEvent(new CustomEvent('webbrain-agent-dom-dispatch', { detail: ${JSON.stringify(JSON.stringify(pageGuard))} }));\n${expression}`;dispatched = true;const response = await cdpClient.evaluate(tabId, expression, true, { timeoutMs: 15000 });@@ -35162,7 +35162,7 @@ If the user has already named or confirmed this exact recipient, do NOT ask agaitry {releaseDialogNavigation = cdpClient.authorizeNavigationDialog(tabId, beforeUrl, earlyCdpAbortSignal);- await beforePageAgentDispatch(chrome, tabId, { kind: 'navigate', url: rawUrl });+ await beforePageAgentDispatch(globalThis.chrome, tabId, { kind: 'navigate', url: rawUrl });await chrome.tabs.update(tabId, { url: rawUrl });} catch (e) {removeNavigationListener();@@ -35367,7 +35367,7 @@ If the user has already named or confirmed this exact recipient, do NOT ask agaitry {try {const delta = direction === 'back' ? -steps : steps;- await beforePageAgentDispatch(chrome, tabId, { kind: 'navigate', history: true });+ await beforePageAgentDispatch(globalThis.chrome, tabId, { kind: 'navigate', history: true });historyDispatchArmed = true;dispatched = true;releaseDialogNavigation = cdpClient.authorizeNavigationDialog(tabId, beforeUrl, earlyCdpAbortSignal);@@ -37689,7 +37689,7 @@ If the user has already named or confirmed this exact recipient, do NOT ask agai}if (binding?.token && Number.isInteger(binding.frameId)) {throwIfEarlyCdpAborted();- await beforePageAgentDispatch(chrome, tabId, { kind: 'click', selector, frameId: binding.frameId });+ await beforePageAgentDispatch(globalThis.chrome, tabId, { kind: 'click', selector, frameId: binding.frameId });dispatched = true;markEarlyCdpDispatched();const response = await chrome.tabs.sendMessage(tabId, {@@ -37754,7 +37754,7 @@ If the user has already named or confirmed this exact recipient, do NOT ask agai}const selected = candidates[0];throwIfEarlyCdpAborted();- await beforePageAgentDispatch(chrome, tabId, { kind: 'click', selector, frameId: selected.frameId });+ await beforePageAgentDispatch(globalThis.chrome, tabId, { kind: 'click', selector, frameId: selected.frameId });dispatched = true;markEarlyCdpDispatched();const clicked = await chrome.scripting.executeScript({diff --git a/src/chrome/src/agent/page-feedback.js b/src/chrome/src/agent/page-feedback.jsindex e808a05be..9232949ab 100644--- a/src/chrome/src/agent/page-feedback.js+++ b/src/chrome/src/agent/page-feedback.js@@ -22,6 +22,7 @@ export async function beforePageAgentDispatch(api, tabId, details = {}) {error.code = 'page_feedback_pending';throw error;}+ if (!details.release && details.kind === 'click' && details.navigationCandidate !== false) owner.clearNavigation();if (details.documentToken) {const frameId = owner.frameForDocument(details.documentToken);if (frameId === undefined && !details.release) {@@ -30,7 +31,6 @@ export async function beforePageAgentDispatch(api, tabId, details = {}) {}details = { ...details, ...(frameId === undefined ? {} : { frameId }) };}- owner.dispatched(details);owner.operationFrames.get(owner.operationId)?.add(Number(details.frameId) || 0);let acknowledgement;try {@@ -46,6 +46,8 @@ export async function beforePageAgentDispatch(api, tabId, details = {}) {error.code = 'page_feedback_pending';throw error;}+ // Clicks are correlated by the matching page event, not selector preparation.+ if (!details.release && details.kind === 'navigate') owner.dispatched(details);return acknowledgement?.guard;}@@ -68,10 +70,12 @@ export const pageFeedbackMethods = {this._pageFeedbackRuns.set(tabId, run);dispatchOwners.set(tabId, { runToken: run.token, operationId: '', operationFrames: new Map(),pending: () => this._hasPendingPageFeedback(tabId),+ clearNavigation: () => { run.navigation = null; },frameForDocument: documentToken => [...run.frames].find(([, frame]) => frame.token === documentToken)?.[0],dispatched: details => {- if (details.kind === 'navigate' || (details.kind === 'click' && !details.release && details.navigationCandidate !== false)) {- run.navigation = { at: Date.now(), url: details.url || '', kind: details.kind, history: details.history === true };+ if (details.kind === 'navigate') {+ run.navigation = { at: Date.now(), url: details.url || '', kind: details.kind, history: details.history === true,+ operationId: dispatchOwners.get(tabId)?.operationId || '' };}} });const api = apiFor();@@ -125,7 +129,8 @@ export const pageFeedbackMethods = {|| !['user', 'agent', 'page', 'unknown'].includes(feedback.source)) return { accepted: false, reason: 'invalid-observation' };frame.seq = seq;if (feedback.source === 'agent') {- if (feedback.operation === 'click') run.navigation = { at: Date.now(), url: '', kind: 'click' };+ if (feedback.operation === 'click') run.navigation = { at: Date.now(), url: '', kind: 'click',+ operationId: dispatchOwners.get(tabId)?.operationId || '' };return { accepted: true };}const item = { kind: feedback.kind, source: feedback.source, frameId,@@ -230,6 +235,7 @@ export const pageFeedbackMethods = {const run = this._pageFeedbackRuns?.get(tabId);if (!run || this._checkAbort(tabId)) return false;const events = [...run.events.values()];+ const batchRevision = run.revision;run.events.clear();let page;try {@@ -247,7 +253,7 @@ export const pageFeedbackMethods = {+ 'You may return to a previous page if the task requires it.]\n'+ wrap('page_feedback', { events, currentUrl: url, page: this._limitToolResult ? this._limitToolResult(page) : page }) });run.latestObservation = messages.at(-1).content;- const id = `${run.token}:${run.revision}`;+ const id = `${run.token}:${batchRevision}`;const navigation = events.filter(event => event.kind === 'navigation' && event.frameId === 0).at(-1);onUpdate('page_feedback', { id, kinds: [...new Set(events.map(event => event.kind))],source: navigation?.source || events[0]?.source || 'unknown',@@ -285,6 +291,7 @@ export function installPageFeedback(Agent) {const owner = dispatchOwners.get(tabId);const previousOperation = owner?.operationId;const operationId = run && mutation ? token() : '';+ let noDispatch = false;if (run && mutation && owner) {owner.operationId = operationId;owner.operationFrames.set(operationId, new Set([0]));@@ -294,10 +301,12 @@ export function installPageFeedback(Agent) {try {if (run && mutation && this._hasPendingPageFeedback(tabId)) return pageFeedbackPendingResult();const result = await execute.call(this, tabId, name, args, onUpdate, executionContext);+ noDispatch = result?.noDispatch === true || result?.dispatched === false;if (run && mutation && this._hasPendingPageFeedback(tabId) && result?.noDispatch === true&& !result.denied && !result.cancelled && !result.outcomeUnknown) return { ...result, pageFeedbackPending: true };return result;} catch (error) {+ noDispatch = !dispatchState.started;if (error?.code === 'page_feedback_pending') {if (!dispatchState.started) return pageFeedbackPendingResult();const interrupted = { success: false, dispatched: true, outcomeUnknown: true, retryable: false,@@ -307,6 +316,7 @@ export function installPageFeedback(Agent) {throw error;} finally {if (run && mutation && owner) {+ if (noDispatch && run.navigation?.operationId === operationId) run.navigation = null;owner.operationId = previousOperation;const frames = owner.operationFrames.get(operationId) || new Set([0]);owner.operationFrames.delete(operationId);diff --git a/src/chrome/src/cdp/cdp-client.js b/src/chrome/src/cdp/cdp-client.jsindex eff8b2154..8043b778b 100644--- a/src/chrome/src/cdp/cdp-client.js+++ b/src/chrome/src/cdp/cdp-client.js@@ -412,7 +412,7 @@ export class CDPClient {let target = {};try { target = await this._pageAgentInputTarget(tabId, method, params, sessionId); }catch (error) { if (!release) throw error; } // Always allow held input to be released after navigation.- await beforePageAgentDispatch(chrome, tabId, {+ await beforePageAgentDispatch(globalThis.chrome, tabId, {kind: method === 'Input.dispatchMouseEvent' ? (params.type === 'mouseWheel' ? 'scroll' : 'click') : 'input',nativeWheel: params.type === 'mouseWheel',navigationCandidate: params.type === 'mousePressed',@@ -2505,7 +2505,7 @@ export class CDPClient {*/async setFileInputFiles(tabId, objectId, filePaths, options = {}) {const target = hasPageAgentDispatchOwner(tabId) ? await this._pageAgentObjectTarget(tabId, objectId) : {};- await beforePageAgentDispatch(chrome, tabId, { kind: 'input', eventTypes: ['input', 'change'], ...target });+ await beforePageAgentDispatch(globalThis.chrome, tabId, { kind: 'input', eventTypes: ['input', 'change'], ...target });options.beforeDispatch?.();await this.sendCommand(tabId, 'DOM.setFileInputFiles', {objectId,@@ -2533,7 +2533,7 @@ export class CDPClient {await this.sendCommand(tabId, 'Runtime.enable');throwIfAborted();const target = hasPageAgentDispatchOwner(tabId) ? await this._pageAgentObjectTarget(tabId, objectId) : {};- await beforePageAgentDispatch(chrome, tabId, { kind: 'input', eventTypes: ['input', 'change'], ...target });+ await beforePageAgentDispatch(globalThis.chrome, tabId, { kind: 'input', eventTypes: ['input', 'change'], ...target });throwIfAborted();if (typeof options?.beforeDispatch === 'function') options.beforeDispatch();const res = await this.sendCommand(tabId, 'Runtime.callFunctionOn', {@@ -3688,7 +3688,7 @@ export class CDPClient {let lastResult = null;for (let i = 0; i <= retries; i++) {deadline.throwIfExpired();- await beforePageAgentDispatch(chrome, tabId, { kind: 'scroll', selector, scrollIntoView: true });+ await beforePageAgentDispatch(globalThis.chrome, tabId, { kind: 'scroll', selector, scrollIntoView: true });const result = await this._resolveSelectorOnce(tabId, selector, options);deadline.throwIfExpired();// Found and usable → done.@@ -4471,7 +4471,7 @@ export class CDPClient {const priorDispatchAttempted = dispatchAttempted;const validation = await authorizeDispatch({ x: info.x, y: info.y, tag: info.tag });if (validation.success !== true) return validation;- await beforePageAgentDispatch(chrome, tabId, { kind: 'click', selector, x: info.x, y: info.y });+ await beforePageAgentDispatch(globalThis.chrome, tabId, { kind: 'click', selector, x: info.x, y: info.y });dispatchAttempted = true;const clicked = await this.sendCommand(tabId, 'Runtime.callFunctionOn', {objectId,@@ -4529,7 +4529,7 @@ export class CDPClient {const fallbackValidation = await authorizeDispatch({ x: info.x, y: info.y, tag: info.tag });if (fallbackValidation.success !== true) return fallbackValidation;const priorDispatchAttempted = dispatchAttempted;- await beforePageAgentDispatch(chrome, tabId, { kind: 'click', selector, x: info.x, y: info.y });+ await beforePageAgentDispatch(globalThis.chrome, tabId, { kind: 'click', selector, x: info.x, y: info.y });dispatchAttempted = true;const fb = await this.evaluate(tabId, `(() => {@@ -5440,7 +5440,7 @@ export class CDPClient {* Scroll page.*/async scrollPage(tabId, direction, amount = 500) {- await beforePageAgentDispatch(chrome, tabId, { kind: 'scroll' });+ await beforePageAgentDispatch(globalThis.chrome, tabId, { kind: 'scroll' });const scrollCode = {down: `window.scrollBy(0, ${amount})`,up: `window.scrollBy(0, -${amount})`,diff --git a/src/chrome/src/content/page-monitor.js b/src/chrome/src/content/page-monitor.jsindex 51cb1713b..aaffa0687 100644--- a/src/chrome/src/content/page-monitor.js+++ b/src/chrome/src/content/page-monitor.js@@ -262,6 +262,9 @@if (!op) return;const marker = { userAt: op.userAt };agentTurn = marker;+ if (op.navigationCandidate && ['click', 'pointerdown'].includes(event.type)) {+ send({ kind: 'activity', source: 'agent', operation: 'click' });+ }// Native listeners have microtask checkpoints between callbacks. Keep this// exact input's attribution through its page handlers, until the next task.setTimeout(() => { if (agentTurn === marker) agentTurn = null; }, 0);@@ -376,6 +379,7 @@if (!params.release) op.eventTypes = Array.isArray(params.eventTypes) ? new Set(params.eventTypes) : null;op.focused = params.kind === 'input'; op.kind = params.kind;op.nativeWheel = params.nativeWheel === true;+ if (!params.release) op.navigationCandidate = params.kind === 'click' && params.navigationCandidate !== false;op.scrollAncestors = new Set();if (params.scrollIntoView || params.nativeWheel || ['input', 'click'].includes(params.kind)) {for (let node = op.target?.parentElement; node; node = node.parentElement) op.scrollAncestors.add(node);@@ -384,8 +388,6 @@op.kinds = new Set([params.kind, 'dom', ...(params.kind === 'input' ? ['selection'] : []), 'scroll']);op.until = Date.now() + 1500; op.dispatched = true;operations.set(op.operationId, op);- // Background navigation correlation needs the actual content dispatch as well as CDP/BiDi.- if (params.kind === 'click' && params.navigationCandidate !== false) send({ kind: 'activity', source: 'agent', operation: 'click' });}const localMutations = new Set(['click', 'click_ax', 'type', 'type_ax', 'set_field', 'set_checked', 'press_keys', 'scroll','hover', 'drag_drop', 'patch_element', 'revert_patch', 'highlight_element', 'execute_js',diff --git a/src/chrome/src/ui/locales/ar.js b/src/chrome/src/ui/locales/ar.jsindex b6de43053..9da7f8c28 100644--- a/src/chrome/src/ui/locales/ar.js+++ b/src/chrome/src/ui/locales/ar.js@@ -1201,4 +1201,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "تغيّرت الصفحة أثناء تنفيذ المهمة ({before} → {after}). جارٍ متابعة المهمة.",};diff --git a/src/chrome/src/ui/locales/bn.js b/src/chrome/src/ui/locales/bn.jsindex 62b5197c9..775ff9ca4 100644--- a/src/chrome/src/ui/locales/bn.js+++ b/src/chrome/src/ui/locales/bn.js@@ -1200,4 +1200,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "কাজ চলার সময় পৃষ্ঠা বদলেছে ({before} → {after})। কাজ চলতে থাকবে।",};diff --git a/src/chrome/src/ui/locales/de.js b/src/chrome/src/ui/locales/de.jsindex cbd7e6218..4e0972b73 100644--- a/src/chrome/src/ui/locales/de.js+++ b/src/chrome/src/ui/locales/de.js@@ -1173,4 +1173,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "Die Seite hat sich während der Aufgabe geändert ({before} → {after}). Die Aufgabe wird fortgesetzt.",};diff --git a/src/chrome/src/ui/locales/es.js b/src/chrome/src/ui/locales/es.jsindex a2727fcc2..a70f65a71 100644--- a/src/chrome/src/ui/locales/es.js+++ b/src/chrome/src/ui/locales/es.js@@ -1201,4 +1201,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "La página cambió mientras se ejecutaba la tarea ({before} → {after}). La tarea continúa.",};diff --git a/src/chrome/src/ui/locales/fa.js b/src/chrome/src/ui/locales/fa.jsindex 104c10ea6..5a626637b 100644--- a/src/chrome/src/ui/locales/fa.js+++ b/src/chrome/src/ui/locales/fa.js@@ -1200,4 +1200,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "صفحه هنگام اجرای کار تغییر کرد ({before} → {after}). کار ادامه مییابد.",};diff --git a/src/chrome/src/ui/locales/fr.js b/src/chrome/src/ui/locales/fr.jsindex 7d800a8ce..4b869d880 100644--- a/src/chrome/src/ui/locales/fr.js+++ b/src/chrome/src/ui/locales/fr.js@@ -1201,4 +1201,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "La page a changé pendant la tâche ({before} → {after}). La tâche continue.",};diff --git a/src/chrome/src/ui/locales/he.js b/src/chrome/src/ui/locales/he.jsindex 257819d5d..7d47f6502 100644--- a/src/chrome/src/ui/locales/he.js+++ b/src/chrome/src/ui/locales/he.js@@ -1160,4 +1160,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "הדף השתנה בזמן שהמשימה פעלה ({before} → {after}). ממשיכים במשימה.",};diff --git a/src/chrome/src/ui/locales/hi.js b/src/chrome/src/ui/locales/hi.jsindex 92209525a..294cd41d2 100644--- a/src/chrome/src/ui/locales/hi.js+++ b/src/chrome/src/ui/locales/hi.js@@ -1200,4 +1200,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "काम चलने के दौरान पेज बदल गया ({before} → {after})। काम जारी है।",};diff --git a/src/chrome/src/ui/locales/id.js b/src/chrome/src/ui/locales/id.jsindex 206ec1998..10e12f3a7 100644--- a/src/chrome/src/ui/locales/id.js+++ b/src/chrome/src/ui/locales/id.js@@ -1201,4 +1201,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "Halaman berubah saat tugas berjalan ({before} → {after}). Tugas dilanjutkan.",};diff --git a/src/chrome/src/ui/locales/ja.js b/src/chrome/src/ui/locales/ja.jsindex 295a63600..966e097f7 100644--- a/src/chrome/src/ui/locales/ja.js+++ b/src/chrome/src/ui/locales/ja.js@@ -1201,4 +1201,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "タスク実行中にページが変わりました({before} → {after})。タスクを続行します。",};diff --git a/src/chrome/src/ui/locales/ko.js b/src/chrome/src/ui/locales/ko.jsindex accede10a..b45bde184 100644--- a/src/chrome/src/ui/locales/ko.js+++ b/src/chrome/src/ui/locales/ko.js@@ -1201,4 +1201,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "작업 실행 중 페이지가 변경되었습니다({before} → {after}). 작업을 계속합니다.",};diff --git a/src/chrome/src/ui/locales/ms.js b/src/chrome/src/ui/locales/ms.jsindex 9217b5d8a..0834fba33 100644--- a/src/chrome/src/ui/locales/ms.js+++ b/src/chrome/src/ui/locales/ms.js@@ -1201,4 +1201,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "Halaman berubah semasa tugas berjalan ({before} → {after}). Tugas diteruskan.",};diff --git a/src/chrome/src/ui/locales/nl.js b/src/chrome/src/ui/locales/nl.jsindex d7b1ec4a3..cc20bcd7d 100644--- a/src/chrome/src/ui/locales/nl.js+++ b/src/chrome/src/ui/locales/nl.js@@ -1153,4 +1153,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "De pagina is gewijzigd terwijl de taak actief was ({before} → {after}). De taak wordt voortgezet.",};diff --git a/src/chrome/src/ui/locales/pl.js b/src/chrome/src/ui/locales/pl.jsindex 6cbf747b2..66ef01ab8 100644--- a/src/chrome/src/ui/locales/pl.js+++ b/src/chrome/src/ui/locales/pl.js@@ -1162,4 +1162,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "Strona zmieniła się podczas wykonywania zadania ({before} → {after}). Zadanie jest kontynuowane.",};diff --git a/src/chrome/src/ui/locales/pt.js b/src/chrome/src/ui/locales/pt.jsindex d7284beef..d80a04319 100644--- a/src/chrome/src/ui/locales/pt.js+++ b/src/chrome/src/ui/locales/pt.js@@ -1200,4 +1200,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "A página mudou enquanto a tarefa estava em execução ({before} → {after}). A tarefa continua.",};diff --git a/src/chrome/src/ui/locales/ru.js b/src/chrome/src/ui/locales/ru.jsindex a3c78ea10..4959130aa 100644--- a/src/chrome/src/ui/locales/ru.js+++ b/src/chrome/src/ui/locales/ru.js@@ -1201,4 +1201,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "Страница изменилась во время выполнения задачи ({before} → {after}). Задача продолжается.",};diff --git a/src/chrome/src/ui/locales/th.js b/src/chrome/src/ui/locales/th.jsindex 58bfc54d5..1c0571199 100644--- a/src/chrome/src/ui/locales/th.js+++ b/src/chrome/src/ui/locales/th.js@@ -1201,4 +1201,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "หน้าเว็บเปลี่ยนระหว่างที่งานกำลังทำงาน ({before} → {after}) งานจะดำเนินต่อ",};diff --git a/src/chrome/src/ui/locales/tl.js b/src/chrome/src/ui/locales/tl.jsindex 03ee6e1f8..1452aeb53 100644--- a/src/chrome/src/ui/locales/tl.js+++ b/src/chrome/src/ui/locales/tl.js@@ -1201,4 +1201,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "Nagbago ang pahina habang tumatakbo ang gawain ({before} → {after}). Nagpapatuloy ang gawain.",};diff --git a/src/chrome/src/ui/locales/uk.js b/src/chrome/src/ui/locales/uk.jsindex 340477d07..aac4e0206 100644--- a/src/chrome/src/ui/locales/uk.js+++ b/src/chrome/src/ui/locales/uk.js@@ -1201,4 +1201,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "Сторінка змінилася під час виконання завдання ({before} → {after}). Завдання продовжується.",};diff --git a/src/chrome/src/ui/locales/vi.js b/src/chrome/src/ui/locales/vi.jsindex 3784f019f..ed5b9e0ab 100644--- a/src/chrome/src/ui/locales/vi.js+++ b/src/chrome/src/ui/locales/vi.js@@ -1200,4 +1200,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "Trang đã thay đổi khi tác vụ đang chạy ({before} → {after}). Tiếp tục tác vụ.",};diff --git a/src/chrome/src/ui/locales/zh.js b/src/chrome/src/ui/locales/zh.jsindex 108a77f32..6edcab735 100644--- a/src/chrome/src/ui/locales/zh.js+++ b/src/chrome/src/ui/locales/zh.js@@ -1201,4 +1201,5 @@ export default {'st.providers.webgpu_download.resume': 'Resume','st.providers.webgpu_download.stop': 'Stop & remove','st.providers.webgpu_download.activate_blocked': 'Download the selected model before choosing WebGPU for chat.',+ 'sp.monitor.navigation': "任务运行期间页面发生了变化({before} → {after})。正在继续任务。",};diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.jsindex f97bcefae..c72f34e4b 100644--- a/src/firefox/src/agent/agent.js+++ b/src/firefox/src/agent/agent.js@@ -32124,7 +32124,7 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout dreturn { before };})()`;- await beforePageAgentDispatch(chrome, tabId, { kind: 'navigate', history: true });+ await beforePageAgentDispatch(globalThis.browser || globalThis.chrome, tabId, { kind: 'navigate', history: true });historyDispatchArmed = true;dispatched = true;const results = await browser.tabs.executeScript(tabId, { code });diff --git a/src/firefox/src/agent/page-feedback.js b/src/firefox/src/agent/page-feedback.jsindex e808a05be..9232949ab 100644--- a/src/firefox/src/agent/page-feedback.js+++ b/src/firefox/src/agent/page-feedback.js@@ -22,6 +22,7 @@ export async function beforePageAgentDispatch(api, tabId, details = {}) {error.code = 'page_feedback_pending';throw error;}+ if (!details.release && details.kind === 'click' && details.navigationCandidate !== false) owner.clearNavigation();if (details.documentToken) {const frameId = owner.frameForDocument(details.documentToken);if (frameId === undefined && !details.release) {@@ -30,7 +31,6 @@ export async function beforePageAgentDispatch(api, tabId, details = {}) {}details = { ...details, ...(frameId === undefined ? {} : { frameId }) };}- owner.dispatched(details);owner.operationFrames.get(owner.operationId)?.add(Number(details.frameId) || 0);let acknowledgement;try {@@ -46,6 +46,8 @@ export async function beforePageAgentDispatch(api, tabId, details = {}) {error.code = 'page_feedback_pending';throw error;}+ // Clicks are correlated by the matching page event, not selector preparation.+ if (!details.release && details.kind === 'navigate') owner.dispatched(details);return acknowledgement?.guard;}@@ -68,10 +70,12 @@ export const pageFeedbackMethods = {this._pageFeedbackRuns.set(tabId, run);dispatchOwners.set(tabId, { runToken: run.token, operationId: '', operationFrames: new Map(),pending: () => this._hasPendingPageFeedback(tabId),+ clearNavigation: () => { run.navigation = null; },frameForDocument: documentToken => [...run.frames].find(([, frame]) => frame.token === documentToken)?.[0],dispatched: details => {- if (details.kind === 'navigate' || (details.kind === 'click' && !details.release && details.navigationCandidate !== false)) {- run.navigation = { at: Date.now(), url: details.url || '', kind: details.kind, history: details.history === true };+ if (details.kind === 'navigate') {+ run.navigation = { at: Date.now(), url: details.url || '', kind: details.kind, history: details.history === true,+ operationId: dispatchOwners.get(tabId)?.operationId || '' };}} });const api = apiFor();@@ -125,7 +129,8 @@ export const pageFeedbackMethods = {|| !['user', 'agent', 'page', 'unknown'].includes(feedback.source)) return { accepted: false, reason: 'invalid-observation' };frame.seq = seq;if (feedback.source === 'agent') {- if (feedback.operation === 'click') run.navigation = { at: Date.now(), url: '', kind: 'click' };+ if (feedback.operation === 'click') run.navigation = { at: Date.now(), url: '', kind: 'click',+ operationId: dispatchOwners.get(tabId)?.operationId || '' };return { accepted: true };}const item = { kind: feedback.kind, source: feedback.source, frameId,@@ -230,6 +235,7 @@ export const pageFeedbackMethods = {const run = this._pageFeedbackRuns?.get(tabId);if (!run || this._checkAbort(tabId)) return false;const events = [...run.events.values()];+ const batchRevision = run.revision;run.events.clear();let page;try {@@ -247,7 +253,7 @@ export const pageFeedbackMethods = {+ 'You may return to a previous page if the task requires it.]\n'+ wrap('page_feedback', { events, currentUrl: url, page: this._limitToolResult ? this._limitToolResult(page) : page }) });run.latestObservation = messages.at(-1).content;- const id = `${run.token}:${run.revision}`;+ const id = `${run.token}:${batchRevision}`;const navigation = events.filter(event => event.kind === 'navigation' && event.frameId === 0).at(-1);onUpdate('page_feedback', { id, kinds: [...new Set(events.map(event => event.kind))],source: navigation?.source || events[0]?.source || 'unknown',@@ -285,6 +291,7 @@ export function installPageFeedback(Agent) {const owner = dispatchOwners.get(tabId);const previousOperation = owner?.operationId;const operationId = run && mutation ? token() : '';+ let noDispatch = false;if (run && mutation && owner) {owner.operationId = operationId;owner.operationFrames.set(operationId, new Set([0]));@@ -294,10 +301,12 @@ export function installPageFeedback(Agent) {try {if (run && mutation && this._hasPendingPageFeedback(tabId)) return pageFeedbackPendingResult();const result = await execute.call(this, tabId, name, args, onUpdate, executionContext);+ noDispatch = result?.noDispatch === true || result?.dispatched === false;if (run && mutation && this._hasPendingPageFeedback(tabId) && result?.noDispatch === true&& !result.denied && !result.cancelled && !result.outcomeUnknown) return { ...result, pageFeedbackPending: true };return result;} catch (error) {+ noDispatch = !dispatchState.started;if (error?.code === 'page_feedback_pending') {if (!dispatchState.started) return pageFeedbackPendingResult();const interrupted = { success: false, dispatched: true, outcomeUnknown: true, retryable: false,@@ -307,6 +316,7 @@ export function installPageFeedback(Agent) {throw error;} finally {if (run && mutation && owner) {+ if (noDispatch && run.navigation?.operationId === operationId) run.navigation = null;owner.operationId = previousOperation;const frames = owner.operationFrames.get(operationId) || new Set([0]);owner.operationFrames.delete(operationId);diff --git a/src/firefox/src/content/page-monitor.js b/src/firefox/src/content/page-monitor.jsindex 51cb1713b..aaffa0687 100644--- a/src/firefox/src/content/page-monitor.js+++ b/src/firefox/src/content/page-monitor.js@@ -262,6 +262,9 @@if (!op) return;const marker = { userAt: op.userAt };agentTurn = marker;+ if (op.navigationCandidate && ['click', 'pointerdown'].includes(event.type)) {+ send({ kind: 'activity', source: 'agent', operation: 'click' });+ }// Native listeners have microtask checkpoints between callbacks. Keep this// exact input's attribution through its page handlers, until the next task.setTimeout(() => { if (agentTurn === marker) agentTurn = null; }, 0);@@ -376,6 +379,7 @@if (!params.release) op.eventTypes = Array.isArray(params.eventTypes) ? new Set(params.eventTypes) : null;op.focused = params.kind === 'input'; op.kind = params.kind;op.nativeWheel = params.nativeWheel === true;+ if (!params.release) op.navigationCandidate = params.kind === 'click' && params.navigationCandidate !== false;op.scrollAncestors = new Set();if (params.scrollIntoView || params.nativeWheel || ['input', 'click'].includes(params.kind)) {for (let node = op.target?.parentElement; node; node = node.parentElement) op.scrollAncestors.add(node);@@ -384,8 +388,6 @@op.kinds = new Set([params.kind, 'dom', ...(params.kind === 'input' ? ['selection'] : []), 'scroll']);op.until = Date.now() + 1500; op.dispatched = true;operations.set(op.operationId, op);- // Background navigation correlation needs the actual content dispatch as well as CDP/BiDi.- if (params.kind === 'click' && params.navigationCandidate !== false) send({ kind: 'activity', source: 'agent', operation: 'click' });}const localMutations = new Set(['click', 'click_ax', 'type', 'type_ax', 'set_field', 'set_checked', 'press_keys', 'scroll','hover', 'drag_drop', 'patch_element', 'revert_patch', 'highlight_element', 'execute_js',diff --git a/src/firefox/src/ui/locales/ar.js b/src/firefox/src/ui/locales/ar.jsindex e79185f35..d01ff130a 100644--- a/src/firefox/src/ui/locales/ar.js+++ b/src/firefox/src/ui/locales/ar.js@@ -1149,4 +1149,5 @@ export default {"st.sync.consent.legacy": "هل تريد تفعيل المزامنة المشفرة؟ سيرسل WebBrain نسخة مشفرة من طرف إلى طرف من ذكرياتك، والملء التلقائي لملفك الشخصي، وإعدادات موفر مفتاح واجهة برمجة التطبيقات (API) إلى WebBrain Compass. لا تتم مزامنة سجل الدردشة وتسجيلات الدخول عبر OAuth.","st.sync.consent.denied": "لم يتم منح إذن المزامنة المشفرة.",'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat.',+ 'sp.monitor.navigation': "تغيّرت الصفحة أثناء تنفيذ المهمة ({before} → {after}). جارٍ متابعة المهمة.",};diff --git a/src/firefox/src/ui/locales/bn.js b/src/firefox/src/ui/locales/bn.jsindex 9b5277800..19671d662 100644--- a/src/firefox/src/ui/locales/bn.js+++ b/src/firefox/src/ui/locales/bn.js@@ -1170,4 +1170,5 @@ export default {"st.sync.consent.legacy": "এনক্রিপ্ট করা সিঙ্ক চালু করবেন? WebBrain আপনার স্মৃতি, প্রোফাইল অটোফিল এবং API-কী প্রদানকারী সেটিংসের একটি এন্ড-টু-এন্ড এনক্রিপ্টেড কপি WebBrain Compass-এ প্রেরণ করবে। চ্যাট ইতিহাস এবং OAuth সাইন-ইন সিঙ্ক করা হয় না।","st.sync.consent.denied": "এনক্রিপ্ট করা সিঙ্ক অনুমতি দেওয়া হয়নি।",'st.providers.webgpu_note.body': '{modelLink} কোনো API এন্ডপয়েন্ট ছাড়াই সম্পূর্ণভাবে Chrome-এ চলে। এটি Settings > Providers > WebGPU বা Apocalypse Mode থেকে ডাউনলোড করুন, তারপর standalone chat-এ nuclear control ব্যবহার করুন।',+ 'sp.monitor.navigation': "কাজ চলার সময় পৃষ্ঠা বদলেছে ({before} → {after})। কাজ চলতে থাকবে।",};diff --git a/src/firefox/src/ui/locales/de.js b/src/firefox/src/ui/locales/de.jsindex 589536394..9a67b6107 100644--- a/src/firefox/src/ui/locales/de.js+++ b/src/firefox/src/ui/locales/de.js@@ -1143,4 +1143,5 @@ export default {"st.sync.consent.legacy": "Verschlüsselte Synchronisierung aktivieren? WebBrain überträgt eine Ende-zu-Ende-verschlüsselte Kopie Ihrer Erinnerungen, des automatischen Ausfüllens Ihres Profils und der Einstellungen des API-Schlüsselanbieters an die WebBrain Compass. Chatverlauf und OAuth-Anmeldungen werden nicht synchronisiert.","st.sync.consent.denied": "Die Berechtigung zur verschlüsselten Synchronisierung wurde nicht erteilt.",'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat.',+ 'sp.monitor.navigation': "Die Seite hat sich während der Aufgabe geändert ({before} → {after}). Die Aufgabe wird fortgesetzt.",};diff --git a/src/firefox/src/ui/locales/es.js b/src/firefox/src/ui/locales/es.jsindex fb9705077..a842ab52d 100644--- a/src/firefox/src/ui/locales/es.js+++ b/src/firefox/src/ui/locales/es.js@@ -1149,4 +1149,5 @@ export default {"st.sync.consent.legacy": "¿Activar sincronización cifrada? WebBrain transmitirá una copia cifrada de extremo a extremo de sus recuerdos, el autocompletado de perfiles y la configuración del proveedor de claves API a WebBrain Compass. El historial de chat y los inicios de sesión de OAuth no están sincronizados.","st.sync.consent.denied": "No se concedió el permiso de sincronización cifrada.",'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat.',+ 'sp.monitor.navigation': "La página cambió mientras se ejecutaba la tarea ({before} → {after}). La tarea continúa.",};diff --git a/src/firefox/src/ui/locales/fa.js b/src/firefox/src/ui/locales/fa.jsindex dcddf7410..6342ee25c 100644--- a/src/firefox/src/ui/locales/fa.js+++ b/src/firefox/src/ui/locales/fa.js@@ -1170,4 +1170,5 @@ export default {"st.sync.consent.legacy": "همگام سازی رمزگذاری شده روشن شود؟ WebBrain یک نسخه رمزگذاری شده سرتاسر از خاطرات، تکمیل خودکار نمایه و تنظیمات ارائه دهنده کلید API شما را به WebBrain Compass منتقل می کند. سابقه گپ و ورود به سیستم OAuth همگام سازی نمی شوند.","st.sync.consent.denied": "مجوز همگامسازی رمزگذاری شده داده نشد.",'st.providers.webgpu_note.body': '{modelLink} بدون هیچ نقطهٔ پایانی API کاملاً در Chrome اجرا میشود. آن را در Settings > Providers > WebGPU یا حالت Apocalypse دانلود کنید، سپس از کنترل nuclear در standalone chat استفاده کنید.',+ 'sp.monitor.navigation': "صفحه هنگام اجرای کار تغییر کرد ({before} → {after}). کار ادامه مییابد.",};diff --git a/src/firefox/src/ui/locales/fr.js b/src/firefox/src/ui/locales/fr.jsindex 8bdcf68b8..ea4311fcf 100644--- a/src/firefox/src/ui/locales/fr.js+++ b/src/firefox/src/ui/locales/fr.js@@ -1149,4 +1149,5 @@ export default {"st.sync.consent.legacy": "Activer la synchronisation chiffrée ? WebBrain transmettra une copie cryptée de bout en bout de vos souvenirs, du remplissage automatique de votre profil et des paramètres du fournisseur de clé API à WebBrain Compass. L'historique des discussions et les connexions OAuth ne sont pas synchronisés.","st.sync.consent.denied": "L'autorisation de synchronisation chiffrée n'a pas été accordée.",'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat.',+ 'sp.monitor.navigation': "La page a changé pendant la tâche ({before} → {after}). La tâche continue.",};diff --git a/src/firefox/src/ui/locales/he.js b/src/firefox/src/ui/locales/he.jsindex f8e255da1..2e2f73c07 100644--- a/src/firefox/src/ui/locales/he.js+++ b/src/firefox/src/ui/locales/he.js@@ -1102,4 +1102,5 @@ export default {"st.sync.consent.legacy": "להפעיל סנכרון מוצפן? WebBrain ישדר עותק מוצפן מקצה לקצה של הזיכרונות, המילוי האוטומטי של הפרופיל והגדרות ספק מפתח ה-API שלך ל-WebBrain Compass. היסטוריית הצ'אט וכניסות OAuth אינן מסונכרנות.","st.sync.consent.denied": "הרשאת סנכרון מוצפן לא ניתנה.",'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat.',+ 'sp.monitor.navigation': "הדף השתנה בזמן שהמשימה פעלה ({before} → {after}). ממשיכים במשימה.",};diff --git a/src/firefox/src/ui/locales/hi.js b/src/firefox/src/ui/locales/hi.jsindex 007693817..e3e91fbb2 100644--- a/src/firefox/src/ui/locales/hi.js+++ b/src/firefox/src/ui/locales/hi.js@@ -1170,4 +1170,5 @@ export default {"st.sync.consent.legacy": "एन्क्रिप्टेड सिंक चालू करें? WebBrain आपकी यादों, प्रोफ़ाइल ऑटोफ़िल और API-कुंजी प्रदाता सेटिंग्स की एंड-टू-एंड एन्क्रिप्टेड कॉपी WebBrain Compass को भेजेगा। चैट इतिहास और OAuth साइन-इन सिंक नहीं किए जाते।","st.sync.consent.denied": "एन्क्रिप्टेड सिंक अनुमति नहीं दी गई थी.",'st.providers.webgpu_note.body': '{modelLink} बिना किसी API एंडपॉइंट के पूरी तरह Chrome में चलता है। इसे Settings > Providers > WebGPU या Apocalypse Mode में डाउनलोड करें, फिर standalone chat में nuclear control का उपयोग करें।',+ 'sp.monitor.navigation': "काम चलने के दौरान पेज बदल गया ({before} → {after})। काम जारी है।",};diff --git a/src/firefox/src/ui/locales/id.js b/src/firefox/src/ui/locales/id.jsindex 189a0bf0c..430e383fb 100644--- a/src/firefox/src/ui/locales/id.js+++ b/src/firefox/src/ui/locales/id.js@@ -1149,4 +1149,5 @@ export default {"st.sync.consent.legacy": "Aktifkan sinkronisasi terenkripsi? WebBrain akan mengirimkan salinan memori Anda yang terenkripsi ujung ke ujung, pengisian otomatis profil, dan pengaturan penyedia kunci API ke WebBrain Compass. Riwayat obrolan dan proses masuk OAuth tidak disinkronkan.","st.sync.consent.denied": "Izin sinkronisasi terenkripsi tidak diberikan.",'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat.',+ 'sp.monitor.navigation': "Halaman berubah saat tugas berjalan ({before} → {after}). Tugas dilanjutkan.",};diff --git a/src/firefox/src/ui/locales/ja.js b/src/firefox/src/ui/locales/ja.jsindex ebbf692c0..a1cf8e3b2 100644--- a/src/firefox/src/ui/locales/ja.js+++ b/src/firefox/src/ui/locales/ja.js@@ -1149,4 +1149,5 @@ export default {"st.sync.consent.legacy": "暗号化された同期をオンにしますか? WebBrain は、エンドツーエンドで暗号化された思い出、プロファイルの自動入力、API キー プロバイダー設定のコピーを WebBrain Compass に送信します。チャット履歴と OAuth サインインは同期されません。","st.sync.consent.denied": "暗号化された同期権限が付与されませんでした。",'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat.',+ 'sp.monitor.navigation': "タスク実行中にページが変わりました({before} → {after})。タスクを続行します。",};diff --git a/src/firefox/src/ui/locales/ko.js b/src/firefox/src/ui/locales/ko.jsindex 622f7f278..a904840d1 100644--- a/src/firefox/src/ui/locales/ko.js+++ b/src/firefox/src/ui/locales/ko.js@@ -1149,4 +1149,5 @@ export default {"st.sync.consent.legacy": "암호화된 동기화를 사용하시겠습니까? WebBrain은 추억, 프로필 자동 완성 및 API 키 제공자 설정의 엔드 투 엔드 암호화 사본을 WebBrain Compass로 전송합니다. 채팅 기록과 OAuth 로그인은 동기화되지 않습니다.","st.sync.consent.denied": "암호화된 동기화 권한이 부여되지 않았습니다.",'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat.',+ 'sp.monitor.navigation': "작업 실행 중 페이지가 변경되었습니다({before} → {after}). 작업을 계속합니다.",};diff --git a/src/firefox/src/ui/locales/ms.js b/src/firefox/src/ui/locales/ms.jsindex d840e9cc3..a0410b83b 100644--- a/src/firefox/src/ui/locales/ms.js+++ b/src/firefox/src/ui/locales/ms.js@@ -1149,4 +1149,5 @@ export default {"st.sync.consent.legacy": "Hidupkan penyegerakan yang disulitkan? WebBrain akan menghantar salinan memori anda yang disulitkan hujung ke hujung, autolengkap profil dan tetapan pembekal kunci API ke WebBrain Compass. Sejarah sembang dan log masuk OAuth tidak disegerakkan.","st.sync.consent.denied": "Kebenaran penyegerakan yang disulitkan tidak diberikan.",'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat.',+ 'sp.monitor.navigation': "Halaman berubah semasa tugas berjalan ({before} → {after}). Tugas diteruskan.",};diff --git a/src/firefox/src/ui/locales/nl.js b/src/firefox/src/ui/locales/nl.jsindex e373ff6af..3acca4269 100644--- a/src/firefox/src/ui/locales/nl.js+++ b/src/firefox/src/ui/locales/nl.js@@ -1123,4 +1123,5 @@ export default {"st.sync.consent.legacy": "Versleutelde synchronisatie inschakelen? WebBrain verzendt een end-to-end gecodeerde kopie van uw herinneringen, automatisch aanvullen van profielen en API-sleutelproviderinstellingen naar WebBrain Compass. Chatgeschiedenis en OAuth-aanmeldingen worden niet gesynchroniseerd.","st.sync.consent.denied": "Er is geen versleutelde synchronisatietoestemming verleend.",'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat.',+ 'sp.monitor.navigation': "De pagina is gewijzigd terwijl de taak actief was ({before} → {after}). De taak wordt voortgezet.",};diff --git a/src/firefox/src/ui/locales/pl.js b/src/firefox/src/ui/locales/pl.jsindex bf3a6faa6..0fffc3e14 100644--- a/src/firefox/src/ui/locales/pl.js+++ b/src/firefox/src/ui/locales/pl.js@@ -1110,4 +1110,5 @@ export default {"st.sync.consent.legacy": "Włączyć szyfrowaną synchronizację? WebBrain prześle kompleksowo zaszyfrowaną kopię Twoich wspomnień, autouzupełniania profilu i ustawień dostawcy klucza API do WebBrain Compass. Historia czatów i logowania OAuth nie są synchronizowane.","st.sync.consent.denied": "Nie przyznano zezwolenia na szyfrowaną synchronizację.",'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat.',+ 'sp.monitor.navigation': "Strona zmieniła się podczas wykonywania zadania ({before} → {after}). Zadanie jest kontynuowane.",};diff --git a/src/firefox/src/ui/locales/pt.js b/src/firefox/src/ui/locales/pt.jsindex 2a4c6202c..58878b238 100644--- a/src/firefox/src/ui/locales/pt.js+++ b/src/firefox/src/ui/locales/pt.js@@ -1170,4 +1170,5 @@ export default {"st.sync.consent.legacy": "Ativar a sincronização criptografada? O WebBrain transmitirá uma cópia criptografada de ponta a ponta de suas memórias, preenchimento automático de perfil e configurações do provedor de chave API para o WebBrain Compass. O histórico de bate-papo e os logins do OAuth não são sincronizados.","st.sync.consent.denied": "A permissão de sincronização criptografada não foi concedida.",'st.providers.webgpu_note.body': '{modelLink} é executado inteiramente no Chrome, sem endpoint de API. Baixe-o em Settings > Providers > WebGPU ou no Modo Apocalipse e use o controle nuclear no standalone chat.',+ 'sp.monitor.navigation': "A página mudou enquanto a tarefa estava em execução ({before} → {after}). A tarefa continua.",};diff --git a/src/firefox/src/ui/locales/ru.js b/src/firefox/src/ui/locales/ru.jsindex 595b6cf2e..363ff7fbb 100644--- a/src/firefox/src/ui/locales/ru.js+++ b/src/firefox/src/ui/locales/ru.js@@ -1149,4 +1149,5 @@ export default {"st.sync.consent.legacy": "Включить шифрованную синхронизацию? WebBrain передаст сквозную зашифрованную копию ваших воспоминаний, автозаполнение профиля и настройки поставщика ключей API в WebBrain Compass. История чата и входы по OAuth не синхронизируются.","st.sync.consent.denied": "Разрешение на зашифрованную синхронизацию не предоставлено.",'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat.',+ 'sp.monitor.navigation': "Страница изменилась во время выполнения задачи ({before} → {after}). Задача продолжается.",};diff --git a/src/firefox/src/ui/locales/th.js b/src/firefox/src/ui/locales/th.jsindex fafdf40b5..ef87d9a4e 100644--- a/src/firefox/src/ui/locales/th.js+++ b/src/firefox/src/ui/locales/th.js@@ -1149,4 +1149,5 @@ export default {"st.sync.consent.legacy": "เปิดการซิงค์ที่เข้ารหัสไหม WebBrain จะส่งสำเนาความทรงจำของคุณ การกรอกโปรไฟล์อัตโนมัติ และการตั้งค่าผู้ให้บริการคีย์ API ที่เข้ารหัสจากต้นทางถึงปลายทางไปยัง WebBrain Compass ประวัติการแชทและการลงชื่อเข้าใช้ OAuth จะไม่ซิงค์กัน","st.sync.consent.denied": "ไม่ได้รับสิทธิ์การซิงค์ที่เข้ารหัส",'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat.',+ 'sp.monitor.navigation': "หน้าเว็บเปลี่ยนระหว่างที่งานกำลังทำงาน ({before} → {after}) งานจะดำเนินต่อ",};diff --git a/src/firefox/src/ui/locales/tl.js b/src/firefox/src/ui/locales/tl.jsindex 75085af6b..1406f8f47 100644--- a/src/firefox/src/ui/locales/tl.js+++ b/src/firefox/src/ui/locales/tl.js@@ -1149,4 +1149,5 @@ export default {"st.sync.consent.legacy": "I-on ang naka-encrypt na pag-sync? Magpapadala ang WebBrain ng end-to-end na naka-encrypt na kopya ng iyong mga alaala, profile autofill, at API-key na mga setting ng provider sa WebBrain Compass. Hindi naka-sync ang history ng chat at OAuth sign-in.","st.sync.consent.denied": "Hindi ibinigay ang naka-encrypt na pahintulot sa pag-sync.",'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat.',+ 'sp.monitor.navigation': "Nagbago ang pahina habang tumatakbo ang gawain ({before} → {after}). Nagpapatuloy ang gawain.",};diff --git a/src/firefox/src/ui/locales/uk.js b/src/firefox/src/ui/locales/uk.jsindex 47a3e1842..8fb48a88d 100644--- a/src/firefox/src/ui/locales/uk.js+++ b/src/firefox/src/ui/locales/uk.js@@ -1149,4 +1149,5 @@ export default {"st.sync.consent.legacy": "Увімкнути зашифровану синхронізацію? WebBrain передасть наскрізну зашифровану копію ваших спогадів, автозаповнення профілю та налаштувань постачальника ключа API до WebBrain Compass. Історія чату та вхід OAuth не синхронізуються.","st.sync.consent.denied": "Дозвіл на зашифровану синхронізацію не надано.",'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat.',+ 'sp.monitor.navigation': "Сторінка змінилася під час виконання завдання ({before} → {after}). Завдання продовжується.",};diff --git a/src/firefox/src/ui/locales/vi.js b/src/firefox/src/ui/locales/vi.jsindex 0b85ee83e..d8df55235 100644--- a/src/firefox/src/ui/locales/vi.js+++ b/src/firefox/src/ui/locales/vi.js@@ -1170,4 +1170,5 @@ export default {"st.sync.consent.legacy": "Bật đồng bộ hóa được mã hóa? WebBrain sẽ truyền bản sao được mã hóa nối đầu các ký ức của bạn, tự động điền hồ sơ và cài đặt nhà cung cấp khóa API tới WebBrain Compass. Lịch sử trò chuyện và thông tin đăng nhập OAuth không được đồng bộ hóa.","st.sync.consent.denied": "Quyền đồng bộ hóa được mã hóa không được cấp.",'st.providers.webgpu_note.body': '{modelLink} chạy hoàn toàn trong Chrome mà không cần điểm cuối API. Tải mô hình trong Settings > Providers > WebGPU hoặc Chế độ Apocalypse, rồi dùng nút nuclear trong standalone chat.',+ 'sp.monitor.navigation': "Trang đã thay đổi khi tác vụ đang chạy ({before} → {after}). Tiếp tục tác vụ.",};diff --git a/src/firefox/src/ui/locales/zh.js b/src/firefox/src/ui/locales/zh.jsindex 463171882..c3e619243 100644--- a/src/firefox/src/ui/locales/zh.js+++ b/src/firefox/src/ui/locales/zh.js@@ -1149,4 +1149,5 @@ export default {"st.sync.consent.legacy": "开启加密同步? WebBrain 会将您的记忆、个人资料自动填充和 API 密钥提供商设置的端到端加密副本传输到 WebBrain Compass。聊天历史记录和 OAuth 登录不同步。","st.sync.consent.denied": "未授予加密同步权限。",'st.providers.webgpu_note.body': '{modelLink} runs entirely in Chrome with no API endpoint. Download it in Settings > Providers > WebGPU or Apocalypse Mode, then use the nuclear control in standalone chat.',+ 'sp.monitor.navigation': "任务运行期间页面发生了变化({before} → {after})。正在继续任务。",};diff --git a/test/page-feedback.mjs b/test/page-feedback.mjsindex 1e2285260..86db7b08e 100644--- a/test/page-feedback.mjs+++ b/test/page-feedback.mjs@@ -114,6 +114,26 @@ for (const build of ['chrome', 'firefox']) {} finally { agent._releaseRunEntry(tab); }});+ test(`${build}: navigation arriving during a page read gets its own feedback ID`, async () => {+ const agent = setup(Agent), tab = nextTab++, entered = deferred(), release = deferred();+ const updates = [], messages = [];+ await agent._claimRunEntry(tab, 'interactive');+ try {+ agent.observePageNavigation({ tabId: tab, frameId: 0, url: 'https://example.com/first', transitionType: 'typed' }, 'history');+ agent.executeTool = async () => { entered.resolve(); await release.promise; return { success: true }; };+ const first = agent._applyPendingPageFeedback(tab, messages, (_type, data) => updates.push(data));+ await entered.promise;+ agent.observePageNavigation({ tabId: tab, frameId: 0, url: 'https://example.com/second', transitionType: 'typed' }, 'history');+ release.resolve();+ await first;+ await agent._applyPendingPageFeedback(tab, messages, (_type, data) => updates.push(data));+ assert.equal(updates.length, 2);+ assert.notEqual(updates[0].id, updates[1].id, 'Both navigation notices must survive UI deduplication');+ assert.equal(updates[0].after, 'https://example.com/first');+ assert.equal(updates[1].after, 'https://example.com/second');+ } finally { agent._releaseRunEntry(tab); }+ });+for (const kind of ['interactive', 'cloud', 'scheduled', 'workflow']) {test(`${build}: ${kind} feedback refreshes the page without creating a trusted text correction`, async () => {const agent = setup(Agent), tab = nextTab++, updates = [];@@ -251,6 +271,35 @@ for (const build of ['chrome', 'firefox']) {} finally { agent._releaseRunEntry(tab); }});+ test(`${build}: click preparation and proven no-dispatch navigation do not hide external navigation`, async () => {+ const { installPageFeedback } = await import(`../src/${build}/src/agent/page-feedback.js`);+ class FixtureAgent {+ static STATE_CHANGE_TOOLS = new Set(['click', 'navigate']);+ isRunning() { return true; }+ _checkAbort() { return false; }+ async executeTool(tabId, name) {+ await beforePageAgentDispatch(api, tabId, { kind: name });+ if (name === 'click') {+ this.observePageNavigation({ tabId, frameId: 0, url: 'https://example.com/reloaded', transitionType: 'reload' }, 'committed');+ assert.equal(this._hasPendingPageFeedback(tabId), true, 'Preparation must not arm click navigation correlation');+ }+ return { success: false, dispatched: false, noDispatch: true };+ }+ }+ installPageFeedback(FixtureAgent);+ const agent = new FixtureAgent(), tab = nextTab++;+ await agent._beginPageFeedbackRun(tab, 'interactive');+ try {+ const click = await agent.executeTool(tab, 'click', {});+ assert.equal(click.pageFeedbackPending, true);+ agent._pageFeedbackRuns.get(tab).events.clear();+ await agent.executeTool(tab, 'navigate', {});+ assert.equal(agent._pageFeedbackRuns.get(tab).navigation, null, 'Failed navigation must release its correlation');+ agent.observePageNavigation({ tabId: tab, frameId: 0, url: 'https://example.com/automatic', transitionType: 'reload' }, 'committed');+ assert.equal(agent._hasPendingPageFeedback(tab), true);+ } finally { agent._finishPageFeedbackRun(tab); }+ });+test(`${build}: finishing an action releases attribution in all dispatched frames`, async () => {const { installPageFeedback } = await import(`../src/${build}/src/agent/page-feedback.js`);class FixtureAgent {diff --git a/test/page-monitor-ui.mjs b/test/page-monitor-ui.mjsindex 2f0db4f55..e3f15072f 100644--- a/test/page-monitor-ui.mjs+++ b/test/page-monitor-ui.mjs@@ -154,9 +154,13 @@ for (const [build, engine] of [['chrome', chromium], ['firefox', firefox]]) {deliver('page_monitor_prepare', { operationId: 'agent-click', tool: 'click', selector: '#agent' });deliver('page_monitor_dispatch', { operationId: 'agent-click', kind: 'click', selector: '#agent' });});+ assert.equal((await page.evaluate(() => feedback)).some(event => event.operation === 'click'), false,+ 'A prepared click must not claim navigation before any page input occurs');await page.locator('#agent').click();await page.waitForTimeout(200);const own = await page.evaluate(() => feedback);+ assert.ok(own.some(event => event.source === 'agent' && event.operation === 'click'),+ 'The actual matching click must supply navigation correlation');assert.equal(own.some(event => event.source !== 'agent'), false, JSON.stringify(own));await page.locator('#agent').click();assert.ok((await page.evaluate(() => feedback)).some(event => event.kind === 'click' && event.source === 'user'diff --git a/test/run.js b/test/run.jsindex 67383aff1..6c1336632 100644--- a/test/run.js+++ b/test/run.js@@ -8037,7 +8037,7 @@ test('message recipient dispatch binding detects composer and active-thread race);assert.match(pressBranch,- /if \(actionDeadlineExpired\(\)\) return deadlineFailure\(\);\s*dispatched = true;\s*target\.dispatchEvent\(down\);[\s\S]*const expiredAfterKeydown = actionDeadlineExpired\(\);\s*target\.dispatchEvent\(up\);\s*if \(expiredAfterKeydown\) return deadlineFailure\(\);/,+ /if \(actionDeadlineExpired\(\)\) return deadlineFailure\(\);\s*window\.__wbPageMonitor\?\.beforeLocalDispatch\(\);\s*dispatched = true;\s*target\.dispatchEvent\(down\);[\s\S]*const expiredAfterKeydown = actionDeadlineExpired\(\);\s*target\.dispatchEvent\(up\);\s*if \(expiredAfterKeydown\) return deadlineFailure\(\);/,`${label}: press_keys must guard keydown and classify deadline-only keyup cleanup as a partial dispatch`,);assert.match(@@ -49532,7 +49532,7 @@ test('clarify tool auto-timeout is configurable and mirrored across browsers', ();assert.match(scheduler,- /const jobScopedUpdate = type === 'clarify'\s*\|\| type === 'clarify_timeout_extended'\s*\|\| type === 'clarify_auto'/,+ /const jobScopedUpdate = type === 'page_feedback'\s*\|\| type === 'clarify'\s*\|\| type === 'clarify_timeout_extended'\s*\|\| type === 'clarify_auto'/,`${label}: scheduled clarify deadline updates should carry scheduledJobId`,);assert.match(scheduler, /type === 'clarify_timeout_extended'[\s\S]*?pendingClarify:[\s\S]*?deadlineTs:/, `${label}: scheduled clarifies should persist renewed deadlines`);@@ -64736,9 +64736,9 @@ test('Chrome Dev patch handlers keep page-local undo state and avoid MV3 eval',const agentSource = fs.readFileSync(path.join(ROOT, 'src/chrome/src/agent/agent.js'), 'utf8');assert.match(source, /const devPatchRegistry = new Map\(\)/);assert.match(source, /name: change\.name, expected: change\.after, current/);- assert.match(source, /'patch_element': \(\) => patchDevElement/);- assert.match(source, /'revert_patch': \(\) => revertDevElementPatch/);- assert.match(source, /'highlight_element': \(\) => highlightDevElement/);+ assert.match(source, /'patch_element': \(\) => \{[\s\S]*?beforeLocalDispatch\(\); return patchDevElement/);+ assert.match(source, /'revert_patch': \(\) => \{[\s\S]*?beforeLocalDispatch\(\); return revertDevElementPatch/);+ assert.match(source, /'highlight_element': \(\) => \{[\s\S]*?beforeLocalDispatch\(\); return highlightDevElement/);assert.doesNotMatch(source, /new Function\(msg\.params\.code\)/);assert.match(agentSource, /chrome\.scripting\.insertCSS\(\{ target: \{ tabId \}, css: injectedCss, origin: 'AUTHOR' \}\)/);assert.match(agentSource, /chrome\.scripting\.removeCSS\(\{ target: \{ tabId \}, css: patch\.injectedCss \|\| patch\.css, origin: 'AUTHOR' \}\)/);@@ -81122,6 +81122,7 @@ test('set_field submit chooses exactly one native or page-owned commit path', as${block}return { nativeSubmitAttempted, submissionOutcomeUnknown };}`, {+ window: {},setTimeout: callback => callback(),KeyboardEvent: class KeyboardEvent {constructor(type, init = {}) {@@ -106567,7 +106568,7 @@ test('Chrome click paths suppress native file choosers and redirect to upload_fiassert.deepEqual(chromeInjections[0], {target: { tabId: 42 },world: 'MAIN',- files: ['src/content/file-picker-guard-page.js'],+ files: ['src/content/page-monitor-shadow.js', 'src/content/file-picker-guard-page.js'],});assert.ok(chromeInjections[1].files.includes('src/content/content.js'),@@ -106589,6 +106590,8 @@ test('Chrome click paths suppress native file choosers and redirect to upload_ficonst agent = Object.create(AgentFx.prototype);await agent._injectCoreContentScripts(43);assert.deepEqual(firefoxInjections.map(injection => injection.file), [+ 'src/content/page-monitor-shadow-loader.js',+ 'src/content/page-monitor.js','src/content/file-picker-guard-loader.js','src/content/rich-text-toolbar-heuristic.js','src/content/accessibility-tree.js',@@ -112657,7 +112660,7 @@ test('content-script actions have a bounded unknown-outcome timeout', async () =);assert.match(pressKeysSource,- /if \(actionDeadlineExpired\(\)\) return deadlineFailure\(\);\s*dispatched = true;\s*target\.dispatchEvent\(down\);[\s\S]*const expiredAfterKeydown = actionDeadlineExpired\(\);\s*target\.dispatchEvent\(up\);\s*if \(expiredAfterKeydown\) return deadlineFailure\(\);/,+ /if \(actionDeadlineExpired\(\)\) return deadlineFailure\(\);\s*window\.__wbPageMonitor\?\.beforeLocalDispatch\(\);\s*dispatched = true;\s*target\.dispatchEvent\(down\);[\s\S]*const expiredAfterKeydown = actionDeadlineExpired\(\);\s*target\.dispatchEvent\(up\);\s*if \(expiredAfterKeydown\) return deadlineFailure\(\);/,`${label}: press_keys does not guard dispatch while guaranteeing keyup cleanup`,);const contentClickStart = contentSource.indexOf('function clickElement(params,');@@ -112856,7 +112859,7 @@ test('content-script actions have a bounded unknown-outcome timeout', async () =assert.ok(fallbackScrollStart >= 0 && fallbackScrollEnd > fallbackScrollStart, `${label}: fallback scroll deadline boundary missing`);assert.match(fallbackScroll,- /if \(actionDeadlineExpired\(\)\) return deadlineFailure\(\);\s*dispatched = true;\s*scrollElementInstant/,+ /if \(actionDeadlineExpired\(\)\) return deadlineFailure\(\);\s*window\.__wbPageMonitor\?\.beforeLocalDispatch\(\);\s*dispatched = true;\s*scrollElementInstant/,`${label}: fallback container scrolling can start after its deadline`,);assert.match(@@ -113134,7 +113137,8 @@ test('Chrome upload_file deadline distinguishes preparation from file-input disp}return { objectIds: ['input-1'], objectGroup: 'upload-deadline' };};- cdpClientCh.setFileInputFiles = async () => {+ cdpClientCh.setFileInputFiles = async (_tabId, _objectId, _paths, options) => {+ options.beforeDispatch();fileInputDispatches += 1;if (stallStage === 'dispatch') {markStageStarted();