Skip to content

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

fix: accept successful fal.ai generation as completion evidence

Codex release-state test701f1b7d302b
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index c08dab273..c7fd6b070 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -30278,6 +30278,9 @@ If the user has already named or confirmed this exact recipient, do NOT ask agai
_isExecutionMutationEvidence(name, args = {}, capabilities = []) {
if (name === 'chrome_web_store_upload' || name === 'chrome_web_store_publish') return true;
+ // Generation creates paid media; its result verifies that mutation without
+ // opting the tool into the fetch_url/research_url /allow-api override.
+ if (name === 'generate_image') return true;
const mutationCapabilities = new Set([
Capability.NAVIGATE,
Capability.CLICK,
diff --git a/src/chrome/src/background.js b/src/chrome/src/background.js
index f7c714fe6..efecb64a0 100644
--- a/src/chrome/src/background.js
+++ b/src/chrome/src/background.js
@@ -146,7 +146,7 @@ const VISION_OFFSCREEN_URL = chrome.runtime.getURL('src/offscreen/offscreen.html
// eviction registers its in-memory state first; the Traces page can also
// request an immediate scan via WB_TRACE_REPAIR_STALE_RUNS.
const TRACE_REPAIR_STARTUP_DELAY_MS = 15_000;
-setTimeout(() => { void workflowTrace.repairStaleRuns().catch(() => { }); }, TRACE_REPAIR_STARTUP_DELAY_MS);
+setTimeout(() => { void workflowTrace.repairStaleRuns().catch(() => {}); }, TRACE_REPAIR_STARTUP_DELAY_MS);
function normalizeVisionDownloadState(state) {
return {
@@ -186,7 +186,7 @@ async function startExplicitVisionModelDownload() {
total: 0,
error: String(result?.error || 'The local vision model download could not be started.').slice(0, 500),
updatedAt: Date.now(),
- }).catch(() => { });
+ }).catch(() => {});
return result;
}
@@ -232,7 +232,7 @@ agent.setConversationScopeChangeListener((tabId, state) => {
tabId,
type: 'conversation_scope',
data: state,
- }).catch(() => { });
+ }).catch(() => {});
});
const userMemoryStore = createUserMemoryStore(chrome.storage.local);
const memcodeRecall = createMemcodeRecall({ storage: chrome.storage.local, identity: chrome.identity });
@@ -279,7 +279,7 @@ const scheduler = new ScheduledJobManager({
tabId,
type,
data,
- }).catch(() => { });
+ }).catch(() => {});
maybeFlashScheduledTerminalEvent(tabId, type, data);
},
showIndicator: (tabId) => sendIndicatorMessage(tabId, 'WB_SHOW_AGENT_INDICATORS'),
@@ -311,7 +311,7 @@ const cloudRunController = createCloudRunController({
});
alwaysAllowApiMutationsReady
.then(() => cloudRunController.syncBridge())
- .catch(() => { });
+ .catch(() => {});
const MAX_AGENT_STEPS_DEFAULT = 130;
const MAX_AGENT_STEPS_UNLIMITED_SENTINEL = 200;
@@ -428,7 +428,7 @@ const selectionShortcutLocaleReady = chrome.storage.local.get({ wbLocale: '' })
.then((stored) => {
selectionShortcutLocale = resolveStoredSelectionShortcutLocale(stored?.wbLocale);
})
- .catch(() => { });
+ .catch(() => {});
function getContextMenuPromptStore() {
return chrome.storage?.session || chrome.storage?.local || null;
@@ -464,7 +464,7 @@ async function createContextMenus() {
console.warn('[WebBrain] Failed to create context menu:', err.message || err);
}
if (item.id === CONTEXT_MENU_OPEN_PDF_VIEWER_ID) {
- syncPdfContextMenuForActiveTab().catch(() => { });
+ syncPdfContextMenuForActiveTab().catch(() => {});
}
});
};
@@ -545,7 +545,7 @@ async function loadClarifyTimeout() {
updates.clarifyTimeoutSec = CLARIFY_TIMEOUT_OFF_SLIDER;
stored.clarifyTimeoutSec = CLARIFY_TIMEOUT_OFF_SLIDER;
}
- await chrome.storage.local.set(updates).catch(() => { });
+ await chrome.storage.local.set(updates).catch(() => {});
}
agent.clarifyTimeoutSec = normalizeClarifyTimeoutSec(
stored.clarifyTimeoutSec != null ? stored.clarifyTimeoutSec : 60,
@@ -570,7 +570,7 @@ async function loadResearchEscalation() {
agent.researchEscalationEnabled = stored.researchEscalationEnabled === true;
agent.researchEscalationEngine = String(stored.researchEscalationEngine || 'chatgpt');
}
-const researchEscalationReady = loadResearchEscalation().catch(() => { });
+const researchEscalationReady = loadResearchEscalation().catch(() => {});
// Local screenshot redaction (issue #312): when on, screenshots are pixelated
// over DOM-detected PII (form fields + email/phone text) BEFORE leaving the
@@ -579,7 +579,7 @@ async function loadScreenshotRedaction() {
const stored = await chrome.storage.local.get('screenshotRedaction');
if (stored.screenshotRedaction != null) agent.screenshotRedaction = !!stored.screenshotRedaction;
}
-const screenshotRedactionReady = loadScreenshotRedaction().catch(() => { });
+const screenshotRedactionReady = loadScreenshotRedaction().catch(() => {});
// Image budget (issue #311): screenshot quality + how many screenshots the
// agent may capture per turn, and the max image dimension. Defaults preserve
@@ -590,13 +590,13 @@ async function loadImageBudget() {
}
// Retained so handleMessage can await hydration on a cold SW start β€” the first
// chat must not race ahead of the persisted image-budget settings (issue #311).
-const imageBudgetReady = loadImageBudget().catch(() => { });
+const imageBudgetReady = loadImageBudget().catch(() => {});
async function loadStrictSecretMode() {
const stored = await chrome.storage.local.get('strictSecretMode').catch(() => ({}));
agent.strictSecretMode = stored?.strictSecretMode === true;
}
-const strictSecretModeReady = loadStrictSecretMode().catch(() => { });
+const strictSecretModeReady = loadStrictSecretMode().catch(() => {});
async function loadWebMCPEnabled() {
const stored = await chrome.storage.local.get('webMcpEnabled');
@@ -633,7 +633,7 @@ async function syncAgentUserMemoryFromStorage() {
});
return store;
}
-const userMemoryReady = syncAgentUserMemoryFromStorage().catch(() => { });
+const userMemoryReady = syncAgentUserMemoryFromStorage().catch(() => {});
const USER_MEMORY_EXTRACTION_MAX_QUEUE = 10;
const USER_MEMORY_EXTRACTION_DELAY_MS = 1200;
@@ -667,7 +667,7 @@ function recordClarificationMemoryCandidate(tabId, question, answer) {
if (!normalizedAnswer) return;
const normalizedQuestion = normalizeUserMemoryText(question, 500);
if (looksLikeSensitiveMemoryText(normalizedAnswer)
- || (normalizedQuestion && looksLikeSensitiveMemoryText(normalizedQuestion))) {
+ || (normalizedQuestion && looksLikeSensitiveMemoryText(normalizedQuestion))) {
return;
}
const context = getUserMemoryTurnContext(tabId);
@@ -754,7 +754,7 @@ async function isUserMemoryFormCaptureEnabled() {
async function withUserMemoryExtractionQueueLock(task) {
const run = userMemoryExtractionQueueLock.then(task, task);
- userMemoryExtractionQueueLock = run.catch(() => { });
+ userMemoryExtractionQueueLock = run.catch(() => {});
return run;
}
@@ -820,13 +820,13 @@ async function markUserMemoryExtractionJobFailed(jobId) {
async function withUserMemoryStoreLock(task) {
const run = userMemoryStoreLock.then(task, task);
- userMemoryStoreLock = run.catch(() => { });
+ userMemoryStoreLock = run.catch(() => {});
return run;
}
async function withSavedWorkflowStoreLock(task) {
const run = savedWorkflowStoreLock.then(task, task);
- savedWorkflowStoreLock = run.catch(() => { });
+ savedWorkflowStoreLock = run.catch(() => {});
return run;
}
@@ -875,7 +875,7 @@ function notifyUserMemoryCreated() {
chrome.runtime.sendMessage({
target: 'sidepanel',
action: 'user_memory_created',
- }).catch(() => { });
+ }).catch(() => {});
}
function scheduleUserMemoryExtractionDrain(delayMs = USER_MEMORY_EXTRACTION_DELAY_MS) {
@@ -1179,8 +1179,8 @@ chrome.runtime.onInstalled.addListener(async (details) => {
await providerManager.load();
await loadMaxSteps();
await loadClarifyTimeout();
- await syncAgentUserMemoryFromStorage().catch(() => { });
- await cloudRunController.syncBridge().catch(() => { });
+ await syncAgentUserMemoryFromStorage().catch(() => {});
+ await cloudRunController.syncBridge().catch(() => {});
// Chrome registers the manifest handler with enabled=true after install.
// Reconcile now and once more after registration settles so the native
// default cannot overwrite the extension's opt-in default. The in-handler
@@ -1198,8 +1198,8 @@ chrome.runtime.onStartup?.addListener(async () => {
await providerManager.load();
await loadMaxSteps();
await loadClarifyTimeout();
- await syncAgentUserMemoryFromStorage().catch(() => { });
- await cloudRunController.syncBridge().catch(() => { });
+ await syncAgentUserMemoryFromStorage().catch(() => {});
+ await cloudRunController.syncBridge().catch(() => {});
scheduleUserMemoryExtractionDrain(5000);
});
@@ -1212,13 +1212,13 @@ chrome.storage.onChanged.addListener((changes, areaName) => {
}
if (changes.wbLocale) {
selectionShortcutLocale = normalizeSelectionShortcutLocale(changes.wbLocale.newValue);
- createContextMenus().catch(() => { });
+ createContextMenus().catch(() => {});
}
- if (PROFILE_SYNC_DATA_KEYS.some((key) => changes[key])) profileSync.noteChanges(changes).catch(() => { });
- if (changes.providers || changes.activeProvider || changes.helpImproveWebBrain) providerManager.load().catch(() => { });
+ if (PROFILE_SYNC_DATA_KEYS.some((key) => changes[key])) profileSync.noteChanges(changes).catch(() => {});
+ if (changes.providers || changes.activeProvider || changes.helpImproveWebBrain) providerManager.load().catch(() => {});
if (changes.webbrainCloudBridgeEnabled || changes.webbrainCloudBridgeUrl
|| changes.webbrainCloudBridgeToken || changes.webbrainCloudBridgeBrowserId) {
- cloudRunController.syncBridge().catch(() => { });
+ cloudRunController.syncBridge().catch(() => {});
}
if (changes.maxAgentSteps) {
agent.maxSteps = normalizeMaxAgentSteps(changes.maxAgentSteps.newValue);
@@ -1423,7 +1423,7 @@ async function loadPanelTabs() {
} catch (e) { /* session storage not available */ }
}
function savePanelTabs() {
- chrome.storage.session?.set({ [PANEL_TABS_KEY]: Array.from(panelTabs) }).catch(() => { });
+ chrome.storage.session?.set({ [PANEL_TABS_KEY]: Array.from(panelTabs) }).catch(() => {});
}
loadPanelTabs();
@@ -1456,11 +1456,11 @@ async function loadWebBrainGroups() {
function saveWebBrainGroups() {
chrome.storage.session?.set({
[WB_GROUPS_KEY]: Array.from(webBrainGroupByWindow.entries()),
- }).catch(() => { });
+ }).catch(() => {});
}
loadWebBrainGroups();
-chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: false }).catch(() => { });
+chrome.sidePanel.setPanelBehavior({ openPanelOnActionClick: false }).catch(() => {});
// Panel visibility model β€” opt-in per tab (Cmd+T no longer leaks the panel).
//
@@ -1566,8 +1566,8 @@ chrome.runtime.onMessage.addListener((msg, sender) => {
if (tab?.url !== installGuideUrl) return;
panelTabs.add(tab.id);
savePanelTabs();
- ensureWebBrainGroup(tab).catch(() => { });
- }).catch(() => { });
+ ensureWebBrainGroup(tab).catch(() => {});
+ }).catch(() => {});
});
// Tracks the pending 250 ms retry timer per tab so it can be cancelled if the
@@ -1583,10 +1583,10 @@ function notifySidePanelOfContextMenuPrompt(payload) {
prompt: payload,
};
clearTimeout(pendingContextMenuNotifications.get(tabId));
- chrome.runtime.sendMessage(msg).catch(() => { });
+ chrome.runtime.sendMessage(msg).catch(() => {});
const timerId = setTimeout(() => {
pendingContextMenuNotifications.delete(tabId);
- chrome.runtime.sendMessage(msg).catch(() => { });
+ chrome.runtime.sendMessage(msg).catch(() => {});
}, 250);
pendingContextMenuNotifications.set(tabId, timerId);
}
@@ -1601,7 +1601,7 @@ function openSidePanelForContextMenu(tab) {
enabled: true,
});
chrome.sidePanel.open({ tabId: tab.id });
- ensureWebBrainGroup(tab).catch(() => { });
+ ensureWebBrainGroup(tab).catch(() => {});
}
async function handleContextMenuAsk(info, tab) {
@@ -1649,12 +1649,12 @@ async function handleContextMenuAsk(info, tab) {
openSidePanelForContextMenu(tab);
try {
await contextMenuStorage.save(tab.id, payload);
- } catch { }
+ } catch {}
notifySidePanelOfContextMenuPrompt(payload);
}
chrome.contextMenus?.onClicked?.addListener?.((info, tab) => {
- handleContextMenuAsk(info, tab).catch(() => { });
+ handleContextMenuAsk(info, tab).catch(() => {});
});
// Only this instance knows which runs are live in memory, so it owns the
@@ -1712,7 +1712,7 @@ function queueSelectionShortcutPrompt(msg, tab, sendResponse) {
(async () => {
try {
await contextMenuStorage.save(tab.id, payload);
- } catch { }
+ } catch {}
notifySidePanelOfContextMenuPrompt(payload);
return { ok: true, queued: true, requiresManualOpen: false };
})().then(sendResponse).catch((error) => {
@@ -1746,7 +1746,7 @@ chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
// now (stub is enough for setOptions/open), then verify the live tab.
try {
openSidePanelForContextMenu({ id: tabId });
- } catch { }
+ } catch {}
chrome.tabs.get(tabId)
.then(tab => queueSelectionShortcutPrompt(msg, tab, sendResponse))
.catch(error => sendResponse({
@@ -1806,8 +1806,8 @@ function startIndicatorHeartbeat(tabId) {
sendIndicatorMessage(tabId, 'WB_SHOW_AGENT_INDICATORS');
}
})
- .catch(() => { });
- } catch { }
+ .catch(() => {});
+ } catch {}
}, INDICATOR_HEARTBEAT_INTERVAL_MS);
indicatorHeartbeatTimers.set(tabId, timer);
}
@@ -1843,7 +1843,7 @@ chrome.tabs.onUpdated.addListener((tabId, changeInfo) => {
// discard the entry it just recorded. trackPdfResponse() already replaces
// the entry on the next main-frame response, and onRemoved clears it.
if (changeInfo?.url || changeInfo?.status) {
- syncPdfContextMenuForActiveTab().catch(() => { });
+ syncPdfContextMenuForActiveTab().catch(() => {});
}
if (changeInfo?.status === 'complete') {
reassertIndicatorIfActive(tabId);
@@ -1853,7 +1853,7 @@ chrome.tabs.onUpdated.addListener((tabId, changeInfo) => {
chrome.tabs.onRemoved.addListener((tabId) => {
activeIndicatorTabs.delete(tabId);
stopIndicatorHeartbeat(tabId);
- withTeacherSessionStoreLock(() => teacherSessionStore.clear(tabId)).catch(() => { });
+ withTeacherSessionStoreLock(() => teacherSessionStore.clear(tabId)).catch(() => {});
});
const RUN_UI_PREFIX = 'runUi:';
@@ -1893,7 +1893,7 @@ function persistRunUiSnapshot(tabId, snapshot) {
runUiPersistenceQueues.set(tabId, write);
write.finally(() => {
if (runUiPersistenceQueues.get(tabId) === write) runUiPersistenceQueues.delete(tabId);
- }).catch(() => { });
+ }).catch(() => {});
return write;
}
@@ -2013,7 +2013,7 @@ async function getRunUiSnapshot(tabId) {
if (snapshot && typeof snapshot === 'object') {
return runUiJournal.restore(tabId, snapshot);
}
- } catch { }
+ } catch {}
return null;
}
@@ -2022,11 +2022,11 @@ function clearRunUiSnapshot(tabId) {
runUiJournal.clear(tabId);
runUiPersistenceFailures.delete(tabId);
const previous = runUiPersistenceQueues.get(tabId) || Promise.resolve();
- const removal = previous.catch(() => { }).then(() => chrome.storage.session?.remove(RUN_UI_PREFIX + tabId));
+ const removal = previous.catch(() => {}).then(() => chrome.storage.session?.remove(RUN_UI_PREFIX + tabId));
runUiPersistenceQueues.set(tabId, removal);
removal.finally(() => {
if (runUiPersistenceQueues.get(tabId) === removal) runUiPersistenceQueues.delete(tabId);
- }).catch(() => { });
+ }).catch(() => {});
}
function sendAgentUpdate(tabId, requestId, type, data) {
@@ -2041,7 +2041,7 @@ function sendAgentUpdate(tabId, requestId, type, data) {
seq: event?.seq || null,
type,
data: event?.data ?? data,
- }).catch(() => { });
+ }).catch(() => {});
}
function assertNoActiveTabRun(tabId) {
@@ -2133,7 +2133,7 @@ async function stopActiveRunBeforeConversationClear(tabId) {
// first leaves the per-tab run guard active while the UI already looks like
// a fresh chat, so the next send fails with "run already in progress".
if (activeStart?.promise) {
- await activeStart.promise.catch(() => { });
+ await activeStart.promise.catch(() => {});
}
// Direct chat/chat_stream callers do not have a detached-start promise.
// Do not clear their conversation until processMessage's finally block has
@@ -2160,8 +2160,8 @@ function acquireRunKeepalive() {
let released = false;
const touch = () => {
try {
- chrome.runtime.getPlatformInfo().catch(() => { });
- } catch { }
+ chrome.runtime.getPlatformInfo().catch(() => {});
+ } catch {}
};
touch();
const timer = setInterval(touch, RUN_KEEPALIVE_INTERVAL_MS);
@@ -2247,7 +2247,7 @@ async function sendAgentRunComplete(tabId, snapshot = null) {
flashTabAttention({
tabId,
success: liveStatus === 'completed' && snapshot.runSucceeded === true,
- }).catch(() => { });
+ }).catch(() => {});
}
const submittedTurnDurable = snapshot.kind === 'continue'
|| await agent.hasDurableSubmittedTurn(
@@ -2284,7 +2284,7 @@ async function sendAgentRunComplete(tabId, snapshot = null) {
submittedTurnDurable,
attachmentDeliveryState,
},
- }).catch(() => { });
+ }).catch(() => {});
}
// Stop button on the page β†’ abort the agent run for that tab. Mirrors
@@ -2326,7 +2326,7 @@ chrome.action.onClicked.addListener((tab) => {
// before the user can switch tabs. Async β€” we already lost the user-
// gesture window for sidePanel.open, but ensureWebBrainGroup doesn't
// need it.
- ensureWebBrainGroup(tab).catch(() => { });
+ ensureWebBrainGroup(tab).catch(() => {});
});
// (Was: chrome.tabs.onActivated + chrome.tabs.onUpdated listeners that
@@ -2364,11 +2364,11 @@ chrome.tabs.onRemoved.addListener((tabId) => {
clearTimeout(pendingContextMenuNotifications.get(tabId));
pendingContextMenuNotifications.delete(tabId);
contextMenuStorage.cleanup(tabId);
- tabChatHandoff.clear(tabId).catch(() => { });
- clearStagedScreenshots(chrome.storage.local, tabId).catch(() => { });
+ tabChatHandoff.clear(tabId).catch(() => {});
+ clearStagedScreenshots(chrome.storage.local, tabId).catch(() => {});
savePanelTabs();
- scheduler.cancelForTab(tabId).catch(() => { });
- agent.clearDevCssPatchesForTab(tabId).catch(() => { });
+ scheduler.cancelForTab(tabId).catch(() => {});
+ agent.clearDevCssPatchesForTab(tabId).catch(() => {});
try { agent._cleanupTab(tabId); } catch { /* ignore */ }
});
@@ -2383,7 +2383,7 @@ function invalidateContextMenuForTab(tabId) {
target: 'sidepanel',
action: 'context_menu_tab_navigated',
tabId,
- }).catch(() => { });
+ }).catch(() => {});
}
// SPA navigation tracking. Many sites change route via History API without
@@ -2402,7 +2402,7 @@ function recordNav(tabId, type, url, { resetTypeIdentity = true } = {}) {
}
function recordTeacherNavigation(tabId, url, options) {
- teacherRunInterlock.navigation(tabId, url, options).catch(() => { });
+ teacherRunInterlock.navigation(tabId, url, options).catch(() => {});
}
const TEACHER_EXPLICIT_NAVIGATION_TYPES = new Set([
@@ -2411,26 +2411,26 @@ const TEACHER_EXPLICIT_NAVIGATION_TYPES = new Set([
chrome.webNavigation?.onHistoryStateUpdated?.addListener((details) => {
if (details.frameId !== 0) return;
- agent.observeCloudflareManagedChallengeNavigation(details).catch(() => { });
+ agent.observeCloudflareManagedChallengeNavigation(details).catch(() => {});
recordNav(details.tabId, 'history', details.url);
recordTeacherNavigation(details.tabId, details.url);
invalidateContextMenuForTab(details.tabId);
});
chrome.webNavigation?.onReferenceFragmentUpdated?.addListener((details) => {
if (details.frameId !== 0) return;
- agent.observeCloudflareManagedChallengeNavigation(details).catch(() => { });
+ agent.observeCloudflareManagedChallengeNavigation(details).catch(() => {});
recordNav(details.tabId, 'fragment', details.url);
invalidateContextMenuForTab(details.tabId);
});
chrome.webNavigation?.onCommitted?.addListener((details) => {
if (details.frameId !== 0) return;
- agent.observeCloudflareManagedChallengeNavigation(details).catch(() => { });
+ agent.observeCloudflareManagedChallengeNavigation(details).catch(() => {});
recordNav(details.tabId, 'committed', details.url);
recordTeacherNavigation(details.tabId, details.url, {
force: TEACHER_EXPLICIT_NAVIGATION_TYPES.has(details.transitionType),
});
invalidateContextMenuForTab(details.tabId);
- agent.clearDevCssPatchesForTab(details.tabId).catch(() => { });
+ agent.clearDevCssPatchesForTab(details.tabId).catch(() => {});
});
chrome.webNavigation?.onCompleted?.addListener((details) => {
if (details.frameId === 0) {
@@ -2444,11 +2444,11 @@ chrome.webNavigation?.onCompleted?.addListener((details) => {
// detection and embedded widgets may use the same managed endpoint.
const observeCloudflareManagedChallengeResponse = details => {
trackPdfResponse(details);
- syncPdfContextMenuForActiveTab().catch(() => { });
- agent.observeCloudflareManagedChallengeResponse(details).catch(() => { });
+ syncPdfContextMenuForActiveTab().catch(() => {});
+ agent.observeCloudflareManagedChallengeResponse(details).catch(() => {});
};
const observeCloudflareChallengePlatformRequest = details => {
- agent.observeCloudflareChallengePlatformRequest(details).catch(() => { });
+ agent.observeCloudflareChallengePlatformRequest(details).catch(() => {});
};
chrome.webRequest?.onHeadersReceived?.addListener?.(
observeCloudflareManagedChallengeResponse,
@@ -2510,7 +2510,7 @@ function extractApiReplayBody(requestBody) {
const text = params.toString();
return text.length <= API_REPLAY_BODY_LIMIT ? text : null;
}
- } catch (_) { }
+ } catch (_) {}
return null;
}
@@ -2677,7 +2677,7 @@ async function showCompletionNotification(tabId, success) {
if (!notificationId) return resolve();
setTimeout(() => {
completionNotificationFocusHandlers.delete(notificationId);
- chrome.notifications.clear(notificationId, () => { });
+ chrome.notifications.clear(notificationId, () => {});
}, COMPLETION_NOTIFICATION_VISIBLE_MS);
if (Number.isInteger(tabId)) {
completionNotificationFocusHandlers.set(notificationId, async () => {
@@ -2696,11 +2696,11 @@ async function showCompletionNotification(tabId, success) {
chrome.tabs.onActivated.addListener(({ tabId } = {}) => {
flashedBadgeTabs.delete(tabId);
- syncPdfContextMenuForActiveTab().catch(() => { });
+ syncPdfContextMenuForActiveTab().catch(() => {});
// Clear unconditionally: the Set only lives in service-worker memory, but
// a tab-scoped badge survives MV3 worker suspension/restarts. Resetting
// the per-tab override is idempotent and restores any global badge.
- chrome.action.setBadgeText({ tabId, text: '' }).catch(() => { });
+ chrome.action.setBadgeText({ tabId, text: '' }).catch(() => {});
});
// Focusing a window does not fire tabs.onActivated for its already-active
@@ -2906,7 +2906,7 @@ async function handleMessage(msg, sender) {
chrome.runtime.sendMessage({
type: 'apocalypse-mode-state',
enabled: snapshot.enabled === true,
- }).catch(() => { });
+ }).catch(() => {});
if (msg.enabled === true) {
const textModel = await providerManager.enableAndStartWebgpuTextDownload();
return { ...snapshot, textModel };
@@ -3211,9 +3211,9 @@ async function handleMessage(msg, sender) {
const compiled = draft?.conversationId === conversationId
? finalizeSavedWorkflowDraft(draft, { name: msg.name })
: await compileLatestSuccessfulWorkflow(workflowTrace, {
- conversationId,
- name: msg.name,
- });
+ conversationId,
+ name: msg.name,
+ });
if (!compiled.workflow) return { ok: false, ...compiled };
const saved = await withSavedWorkflowStoreLock(() => savedWorkflowStore.put(compiled.workflow));
return { ok: saved.changed, workflow: saved.workflow, warnings: compiled.warnings, reason: saved.reason || '' };
@@ -3655,7 +3655,7 @@ async function handleMessage(msg, sender) {
handoffOwnerId: tabChatClearResult.handoffOwnerId,
handoffGeneration: tabChatClearResult.handoffGeneration,
clearedContextMenuPromptId,
- }).catch(() => { });
+ }).catch(() => {});
}
return { ok: true, clearedContextMenuPromptId };
}
@@ -3884,7 +3884,7 @@ async function handleMessage(msg, sender) {
tabId,
handoffOwnerId: result.handoffOwnerId,
handoffGeneration: result.handoffGeneration,
- }).catch(() => { });
+ }).catch(() => {});
}
return result;
}
@@ -3898,7 +3898,7 @@ async function handleMessage(msg, sender) {
const tabId = msg.tabId || sender.tab?.id || null;
let tab = null;
if (tabId != null) {
- try { tab = await chrome.tabs.get(tabId); } catch { }
+ try { tab = await chrome.tabs.get(tabId); } catch {}
}
return await scheduler.createTaskJob({
tabId,
@@ -3914,7 +3914,7 @@ async function handleMessage(msg, sender) {
const tabId = msg.tabId || sender.tab?.id || null;
let tab = null;
if (tabId != null) {
- try { tab = await chrome.tabs.get(tabId); } catch { }
+ try { tab = await chrome.tabs.get(tabId); } catch {}
}
return await scheduler.createWatchJob({
args: msg.watch || msg.args || {},
@@ -4006,7 +4006,7 @@ async function handleMessage(msg, sender) {
await providerManager.load();
} catch (error) {
if (previousEnabled !== msg.enabled) {
- await chrome.storage.local.set({ helpImproveWebBrain: previousEnabled }).catch(() => { });
+ await chrome.storage.local.set({ helpImproveWebBrain: previousEnabled }).catch(() => {});
}
throw error;
}
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index ed3bfd4f2..8e0a708bf 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -27897,6 +27897,9 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
_isExecutionMutationEvidence(name, args = {}, capabilities = []) {
if (name === 'chrome_web_store_upload' || name === 'chrome_web_store_publish') return true;
+ // Generation creates paid media; its result verifies that mutation without
+ // opting the tool into the fetch_url/research_url /allow-api override.
+ if (name === 'generate_image') return true;
const mutationCapabilities = new Set([
Capability.NAVIGATE,
Capability.CLICK,
diff --git a/src/firefox/src/background.js b/src/firefox/src/background.js
index f5c47871e..97ec36c61 100644
--- a/src/firefox/src/background.js
+++ b/src/firefox/src/background.js
@@ -127,7 +127,7 @@ let emergencyDownloads = null;
// eviction registers its in-memory state first; the Traces page can also
// request an immediate scan via WB_TRACE_REPAIR_STALE_RUNS.
const TRACE_REPAIR_STARTUP_DELAY_MS = 15_000;
-setTimeout(() => { void workflowTrace.repairStaleRuns().catch(() => { }); }, TRACE_REPAIR_STARTUP_DELAY_MS);
+setTimeout(() => { void workflowTrace.repairStaleRuns().catch(() => {}); }, TRACE_REPAIR_STARTUP_DELAY_MS);
function emergencyDownloadController() {
if (!emergencyDownloads) {
@@ -172,7 +172,7 @@ agent.setConversationScopeChangeListener((tabId, state) => {
tabId,
type: 'conversation_scope',
data: state,
- }).catch(() => { });
+ }).catch(() => {});
});
const userMemoryStore = createUserMemoryStore(browser.storage.local);
const memcodeRecall = createMemcodeRecall({ storage: browser.storage.local, identity: browser.identity });
@@ -207,7 +207,7 @@ const scheduler = new ScheduledJobManager({
tabId,
type,
data,
- }).catch(() => { });
+ }).catch(() => {});
maybeFlashScheduledTerminalEvent(tabId, type, data);
},
showIndicator: (tabId) => sendIndicatorMessage(tabId, 'WB_SHOW_AGENT_INDICATORS'),
@@ -229,7 +229,7 @@ const cloudRunController = createCloudRunController({
});
alwaysAllowApiMutationsReady
.then(() => cloudRunController.syncBridge())
- .catch(() => { });
+ .catch(() => {});
const MAX_AGENT_STEPS_DEFAULT = 130;
const MAX_AGENT_STEPS_UNLIMITED_SENTINEL = 200;
@@ -253,7 +253,7 @@ const selectionShortcutLocaleReady = browser.storage.local.get({ wbLocale: '' })
.then((stored) => {
selectionShortcutLocale = resolveStoredSelectionShortcutLocale(stored?.wbLocale);
})
- .catch(() => { });
+ .catch(() => {});
function getContextMenuApi() {
return browser.contextMenus || browser.menus || null;
@@ -408,7 +408,7 @@ async function createContextMenus() {
};
try {
- await Promise.resolve(api.removeAll()).catch(() => { });
+ await Promise.resolve(api.removeAll()).catch(() => {});
create();
} catch {
create();
@@ -453,7 +453,7 @@ async function loadClarifyTimeout() {
updates.clarifyTimeoutSec = CLARIFY_TIMEOUT_OFF_SLIDER;
stored.clarifyTimeoutSec = CLARIFY_TIMEOUT_OFF_SLIDER;
}
- await browser.storage.local.set(updates).catch(() => { });
+ await browser.storage.local.set(updates).catch(() => {});
}
agent.clarifyTimeoutSec = normalizeClarifyTimeoutSec(
stored.clarifyTimeoutSec != null ? stored.clarifyTimeoutSec : 60,
@@ -478,13 +478,13 @@ async function loadResearchEscalation() {
agent.researchEscalationEnabled = stored.researchEscalationEnabled === true;
agent.researchEscalationEngine = String(stored.researchEscalationEngine || 'chatgpt');
}
-const researchEscalationReady = loadResearchEscalation().catch(() => { });
+const researchEscalationReady = loadResearchEscalation().catch(() => {});
async function loadStrictSecretMode() {
const stored = await browser.storage.local.get('strictSecretMode').catch(() => ({}));
agent.strictSecretMode = stored?.strictSecretMode === true;
}
-const strictSecretModeReady = loadStrictSecretMode().catch(() => { });
+const strictSecretModeReady = loadStrictSecretMode().catch(() => {});
async function loadProfile() {
const stored = await browser.storage.local.get(['profileEnabled', 'profileText']);
@@ -500,7 +500,7 @@ async function loadScreenshotRedaction() {
const stored = await browser.storage.local.get('screenshotRedaction');
if (stored.screenshotRedaction != null) agent.screenshotRedaction = !!stored.screenshotRedaction;
}
-const screenshotRedactionReady = loadScreenshotRedaction().catch(() => { });
+const screenshotRedactionReady = loadScreenshotRedaction().catch(() => {});
// Image budget (issue #311): screenshot quality + how many screenshots the
// agent may capture per turn, and the max image dimension. Defaults preserve
@@ -509,7 +509,7 @@ async function loadImageBudget() {
const stored = await browser.storage.local.get(['imageDetail', 'maxScreenshotsPerTurn', 'maxImageDimension']);
agent.applyImageBudgetFromStorage(stored);
}
-const imageBudgetReady = loadImageBudget().catch(() => { });
+const imageBudgetReady = loadImageBudget().catch(() => {});
async function syncAgentUserMemoryFromStorage() {
const [store, settings] = await Promise.all([
@@ -526,7 +526,7 @@ async function syncAgentUserMemoryFromStorage() {
});
return store;
}
-const userMemoryReady = syncAgentUserMemoryFromStorage().catch(() => { });
+const userMemoryReady = syncAgentUserMemoryFromStorage().catch(() => {});
const USER_MEMORY_EXTRACTION_MAX_QUEUE = 10;
const USER_MEMORY_EXTRACTION_DELAY_MS = 1200;
@@ -560,7 +560,7 @@ function recordClarificationMemoryCandidate(tabId, question, answer) {
if (!normalizedAnswer) return;
const normalizedQuestion = normalizeUserMemoryText(question, 500);
if (looksLikeSensitiveMemoryText(normalizedAnswer)
- || (normalizedQuestion && looksLikeSensitiveMemoryText(normalizedQuestion))) {
+ || (normalizedQuestion && looksLikeSensitiveMemoryText(normalizedQuestion))) {
return;
}
const context = getUserMemoryTurnContext(tabId);
@@ -647,7 +647,7 @@ async function isUserMemoryFormCaptureEnabled() {
async function withUserMemoryExtractionQueueLock(task) {
const run = userMemoryExtractionQueueLock.then(task, task);
- userMemoryExtractionQueueLock = run.catch(() => { });
+ userMemoryExtractionQueueLock = run.catch(() => {});
return run;
}
@@ -713,13 +713,13 @@ async function markUserMemoryExtractionJobFailed(jobId) {
async function withUserMemoryStoreLock(task) {
const run = userMemoryStoreLock.then(task, task);
- userMemoryStoreLock = run.catch(() => { });
+ userMemoryStoreLock = run.catch(() => {});
return run;
}
async function withSavedWorkflowStoreLock(task) {
const run = savedWorkflowStoreLock.then(task, task);
- savedWorkflowStoreLock = run.catch(() => { });
+ savedWorkflowStoreLock = run.catch(() => {});
return run;
}
@@ -768,7 +768,7 @@ function notifyUserMemoryCreated() {
browser.runtime.sendMessage({
target: 'sidepanel',
action: 'user_memory_created',
- }).catch(() => { });
+ }).catch(() => {});
}
function scheduleUserMemoryExtractionDrain(delayMs = USER_MEMORY_EXTRACTION_DELAY_MS) {
@@ -1068,16 +1068,16 @@ browser.runtime.onInstalled.addListener(async (details) => {
await loadMaxSteps();
await loadClarifyTimeout();
await loadAutoScreenshot();
- await syncAgentUserMemoryFromStorage().catch(() => { });
- await cloudRunController.syncBridge().catch(() => { });
+ await syncAgentUserMemoryFromStorage().catch(() => {});
+ await cloudRunController.syncBridge().catch(() => {});
scheduleUserMemoryExtractionDrain(5000);
console.log('[WebBrain] Extension installed, providers loaded.');
});
browser.runtime.onStartup?.addListener?.(async () => {
await createContextMenus();
- syncAgentUserMemoryFromStorage().catch(() => { });
- cloudRunController.syncBridge().catch(() => { });
+ syncAgentUserMemoryFromStorage().catch(() => {});
+ cloudRunController.syncBridge().catch(() => {});
scheduleUserMemoryExtractionDrain(5000);
});
@@ -1085,10 +1085,10 @@ browser.runtime.onStartup?.addListener?.(async () => {
browser.storage.onChanged.addListener((changes) => {
if (changes.wbLocale) {
selectionShortcutLocale = normalizeSelectionShortcutLocale(changes.wbLocale.newValue);
- createContextMenus().catch(() => { });
+ createContextMenus().catch(() => {});
}
- if (PROFILE_SYNC_DATA_KEYS.some((key) => changes[key])) profileSync.noteChanges(changes).catch(() => { });
- if (changes.providers || changes.activeProvider || changes.helpImproveWebBrain) providerManager.load().catch(() => { });
+ if (PROFILE_SYNC_DATA_KEYS.some((key) => changes[key])) profileSync.noteChanges(changes).catch(() => {});
+ if (changes.providers || changes.activeProvider || changes.helpImproveWebBrain) providerManager.load().catch(() => {});
if (changes.maxAgentSteps) {
agent.maxSteps = normalizeMaxAgentSteps(changes.maxAgentSteps.newValue);
}
@@ -1123,7 +1123,7 @@ browser.storage.onChanged.addListener((changes) => {
}
if (changes.webbrainCloudBridgeEnabled || changes.webbrainCloudBridgeUrl
|| changes.webbrainCloudBridgeToken || changes.webbrainCloudBridgeBrowserId) {
- cloudRunController.syncBridge().catch(() => { });
+ cloudRunController.syncBridge().catch(() => {});
}
if (changes.strictSecretMode) {
agent.strictSecretMode = changes.strictSecretMode.newValue === true;
@@ -1251,7 +1251,7 @@ async function loadWebBrainGroups() {
function saveWebBrainGroups() {
browser.storage.session?.set({
[WB_GROUPS_KEY]: Array.from(webBrainGroupByWindow.entries()),
- }).catch(() => { });
+ }).catch(() => {});
}
loadWebBrainGroups();
@@ -1322,8 +1322,8 @@ browser.runtime.onMessage.addListener((msg, sender) => {
browser.tabs.get(tabId).then((tab) => {
if (tab?.url !== installGuideUrl) return;
- ensureWebBrainGroup(tab).catch(() => { });
- }).catch(() => { });
+ ensureWebBrainGroup(tab).catch(() => {});
+ }).catch(() => {});
});
// Tracks the pending 250 ms retry timer per tab so it can be cancelled if the
@@ -1339,21 +1339,21 @@ function notifySidePanelOfContextMenuPrompt(payload) {
prompt: payload,
};
clearTimeout(pendingContextMenuNotifications.get(tabId));
- browser.runtime.sendMessage(msg).catch(() => { });
+ browser.runtime.sendMessage(msg).catch(() => {});
const timerId = setTimeout(() => {
pendingContextMenuNotifications.delete(tabId);
- browser.runtime.sendMessage(msg).catch(() => { });
+ browser.runtime.sendMessage(msg).catch(() => {});
}, 250);
pendingContextMenuNotifications.set(tabId, timerId);
}
function openSidebarForContextMenu(tab) {
if (browser.sidebarAction?.open) {
- browser.sidebarAction.open().catch(() => { });
+ browser.sidebarAction.open().catch(() => {});
} else {
- browser.sidebarAction?.toggle?.().catch(() => { });
+ browser.sidebarAction?.toggle?.().catch(() => {});
}
- if (tab?.id) ensureWebBrainGroup(tab).catch(() => { });
+ if (tab?.id) ensureWebBrainGroup(tab).catch(() => {});
}
async function handleContextMenuAsk(info, tab) {
@@ -1400,12 +1400,12 @@ async function handleContextMenuAsk(info, tab) {
openSidebarForContextMenu(tab);
try {
await contextMenuStorage.save(tab.id, payload);
- } catch { }
+ } catch {}
notifySidePanelOfContextMenuPrompt(payload);
}
getContextMenuApi()?.onClicked?.addListener?.((info, tab) => {
- handleContextMenuAsk(info, tab).catch(() => { });
+ handleContextMenuAsk(info, tab).catch(() => {});
});
getContextMenuApi()?.onShown?.addListener?.((info, tab) => {
const menuApi = getContextMenuApi();
@@ -1416,7 +1416,7 @@ getContextMenuApi()?.onShown?.addListener?.((info, tab) => {
try {
await menuApi?.update?.(CONTEXT_MENU_OPEN_PDF_VIEWER_ID, { visible });
await menuApi?.refresh?.();
- } catch { }
+ } catch {}
})();
});
browser.tabs.onRemoved?.addListener?.((tabId) => pdfResponseTabs.delete(tabId));
@@ -1476,7 +1476,7 @@ function queueFirefoxSelectionShortcutPrompt(msg, tab, sendResponse) {
(async () => {
try {
await contextMenuStorage.save(tab.id, payload);
- } catch { }
+ } catch {}
notifySidePanelOfContextMenuPrompt(payload);
return { ok: true, queued: true, requiresManualOpen: true };
})().then(sendResponse).catch((error) => {
@@ -1540,10 +1540,10 @@ browser.tabs.onRemoved.addListener((tabId) => {
clearTimeout(pendingContextMenuNotifications.get(tabId));
pendingContextMenuNotifications.delete(tabId);
contextMenuStorage.cleanup(tabId);
- tabChatHandoff.clear(tabId).catch(() => { });
- clearStagedScreenshots(browser.storage.local, tabId).catch(() => { });
- scheduler.cancelForTab(tabId).catch(() => { });
- withTeacherSessionStoreLock(() => teacherSessionStore.clear(tabId)).catch(() => { });
+ tabChatHandoff.clear(tabId).catch(() => {});
+ clearStagedScreenshots(browser.storage.local, tabId).catch(() => {});
+ scheduler.cancelForTab(tabId).catch(() => {});
+ withTeacherSessionStoreLock(() => teacherSessionStore.clear(tabId)).catch(() => {});
try { agent._cleanupTab(tabId); } catch { /* ignore */ }
});
@@ -1558,11 +1558,11 @@ function invalidateContextMenuForTab(tabId) {
target: 'sidepanel',
action: 'context_menu_tab_navigated',
tabId,
- }).catch(() => { });
+ }).catch(() => {});
}
function recordTeacherNavigation(tabId, url, options) {
- teacherRunInterlock.navigation(tabId, url, options).catch(() => { });
+ teacherRunInterlock.navigation(tabId, url, options).catch(() => {});
}
const TEACHER_EXPLICIT_NAVIGATION_TYPES = new Set([
@@ -1572,7 +1572,7 @@ const TEACHER_EXPLICIT_NAVIGATION_TYPES = new Set([
browser.webNavigation?.onCommitted?.addListener?.((details) => {
if (details.frameId !== 0) return;
agent.clearLastTypeFieldIdent(details.tabId);
- agent.observeCloudflareManagedChallengeNavigation(details).catch(() => { });
+ agent.observeCloudflareManagedChallengeNavigation(details).catch(() => {});
recordTeacherNavigation(details.tabId, details.url, {
force: TEACHER_EXPLICIT_NAVIGATION_TYPES.has(details.transitionType),
});
@@ -1581,14 +1581,14 @@ browser.webNavigation?.onCommitted?.addListener?.((details) => {
browser.webNavigation?.onHistoryStateUpdated?.addListener?.((details) => {
if (details.frameId !== 0) return;
agent.clearLastTypeFieldIdent(details.tabId);
- agent.observeCloudflareManagedChallengeNavigation(details).catch(() => { });
+ agent.observeCloudflareManagedChallengeNavigation(details).catch(() => {});
recordTeacherNavigation(details.tabId, details.url);
invalidateContextMenuForTab(details.tabId);
});
browser.webNavigation?.onReferenceFragmentUpdated?.addListener?.((details) => {
if (details.frameId !== 0) return;
agent.clearLastTypeFieldIdent(details.tabId);
- agent.observeCloudflareManagedChallengeNavigation(details).catch(() => { });
+ agent.observeCloudflareManagedChallengeNavigation(details).catch(() => {});
invalidateContextMenuForTab(details.tabId);
});
@@ -1598,10 +1598,10 @@ browser.webNavigation?.onReferenceFragmentUpdated?.addListener?.((details) => {
// detection and embedded widgets may use the same managed endpoint.
const observeCloudflareManagedChallengeResponse = details => {
trackPdfResponse(details);
- agent.observeCloudflareManagedChallengeResponse(details).catch(() => { });
+ agent.observeCloudflareManagedChallengeResponse(details).catch(() => {});
};
const observeCloudflareChallengePlatformRequest = details => {
- agent.observeCloudflareChallengePlatformRequest(details).catch(() => { });
+ agent.observeCloudflareChallengePlatformRequest(details).catch(() => {});
};
browser.webRequest?.onHeadersReceived?.addListener?.(
observeCloudflareManagedChallengeResponse,
@@ -1660,7 +1660,7 @@ function extractApiReplayBody(requestBody) {
const text = params.toString();
return text.length <= API_REPLAY_BODY_LIMIT ? text : null;
}
- } catch (_) { }
+ } catch (_) {}
return null;
}
@@ -1786,7 +1786,7 @@ browser.tabs.onRemoved.addListener((tabId) => {
browser.browserAction.onClicked.addListener((tab) => {
browser.sidebarAction.toggle();
// Async β€” sidebar toggle doesn't need to wait on grouping.
- if (tab?.id) ensureWebBrainGroup(tab).catch(() => { });
+ if (tab?.id) ensureWebBrainGroup(tab).catch(() => {});
});
// ────────────────────────────────────────────────────────────────────────
@@ -1833,8 +1833,8 @@ function startIndicatorHeartbeat(tabId) {
sendIndicatorMessage(tabId, 'WB_SHOW_AGENT_INDICATORS');
}
})
- .catch(() => { });
- } catch { }
+ .catch(() => {});
+ } catch {}
}, INDICATOR_HEARTBEAT_INTERVAL_MS);
indicatorHeartbeatTimers.set(tabId, timer);
}
@@ -1922,7 +1922,7 @@ async function showCompletionNotification(tabId, success) {
if (!notificationId) return;
setTimeout(() => {
completionNotificationFocusHandlers.delete(notificationId);
- browser.notifications.clear(notificationId).catch(() => { });
+ browser.notifications.clear(notificationId).catch(() => {});
}, COMPLETION_NOTIFICATION_VISIBLE_MS);
if (Number.isInteger(tabId)) {
completionNotificationFocusHandlers.set(notificationId, async () => {
@@ -1939,7 +1939,7 @@ browser.tabs.onActivated.addListener(({ tabId } = {}) => {
flashedBadgeTabs.delete(tabId);
// Clear unconditionally so badge cleanup never depends on volatile state.
// Resetting the per-tab override is idempotent and restores any global badge.
- browser.browserAction.setBadgeText({ tabId, text: '' }).catch(() => { });
+ browser.browserAction.setBadgeText({ tabId, text: '' }).catch(() => {});
});
// Focusing a window does not fire tabs.onActivated for its already-active
@@ -2085,7 +2085,7 @@ function persistRunUiSnapshot(tabId, snapshot) {
runUiPersistenceQueues.set(tabId, write);
write.finally(() => {
if (runUiPersistenceQueues.get(tabId) === write) runUiPersistenceQueues.delete(tabId);
- }).catch(() => { });
+ }).catch(() => {});
return write;
}
@@ -2205,7 +2205,7 @@ async function getRunUiSnapshot(tabId) {
if (snapshot && typeof snapshot === 'object') {
return runUiJournal.restore(tabId, snapshot);
}
- } catch { }
+ } catch {}
return null;
}
@@ -2214,11 +2214,11 @@ function clearRunUiSnapshot(tabId) {
runUiJournal.clear(tabId);
runUiPersistenceFailures.delete(tabId);
const previous = runUiPersistenceQueues.get(tabId) || Promise.resolve();
- const removal = previous.catch(() => { }).then(() => browser.storage.session?.remove(RUN_UI_PREFIX + tabId));
+ const removal = previous.catch(() => {}).then(() => browser.storage.session?.remove(RUN_UI_PREFIX + tabId));
runUiPersistenceQueues.set(tabId, removal);
removal.finally(() => {
if (runUiPersistenceQueues.get(tabId) === removal) runUiPersistenceQueues.delete(tabId);
- }).catch(() => { });
+ }).catch(() => {});
}
function sendAgentUpdate(tabId, requestId, type, data) {
@@ -2228,7 +2228,7 @@ function sendAgentUpdate(tabId, requestId, type, data) {
target: 'sidepanel', action: 'agent_update', tabId, requestId,
runId: event?.runId || agent.currentRunId.get(tabId) || null,
seq: event?.seq || null, type, data: event?.data ?? data,
- }).catch(() => { });
+ }).catch(() => {});
}
function assertNoActiveTabRun(tabId) {
@@ -2320,7 +2320,7 @@ async function stopActiveRunBeforeConversationClear(tabId) {
// first leaves the per-tab run guard active while the UI already looks like
// a fresh chat, so the next send fails with "run already in progress".
if (activeStart?.promise) {
- await activeStart.promise.catch(() => { });
+ await activeStart.promise.catch(() => {});
}
// Direct chat/chat_stream callers do not have a detached-start promise.
// Do not clear their conversation until processMessage's finally block has
@@ -2347,8 +2347,8 @@ function acquireRunKeepalive() {
let released = false;
const touch = () => {
try {
- browser.runtime.getPlatformInfo().catch(() => { });
- } catch { }
+ browser.runtime.getPlatformInfo().catch(() => {});
+ } catch {}
};
touch();
const timer = setInterval(touch, RUN_KEEPALIVE_INTERVAL_MS);
@@ -2402,7 +2402,7 @@ async function sendAgentRunComplete(tabId, snapshot = null) {
flashTabAttention({
tabId,
success: liveStatus === 'completed' && snapshot.runSucceeded === true,
- }).catch(() => { });
+ }).catch(() => {});
}
const submittedTurnDurable = snapshot.kind === 'continue'
|| await agent.hasDurableSubmittedTurn(
@@ -2439,7 +2439,7 @@ async function sendAgentRunComplete(tabId, snapshot = null) {
submittedTurnDurable,
attachmentDeliveryState,
},
- }).catch(() => { });
+ }).catch(() => {});
}
// Stop button on the page β†’ abort the agent run for that tab. Mirrors
@@ -2727,9 +2727,9 @@ async function handleMessage(msg, sender) {
const compiled = draft?.conversationId === conversationId
? finalizeSavedWorkflowDraft(draft, { name: msg.name })
: await compileLatestSuccessfulWorkflow(workflowTrace, {
- conversationId,
- name: msg.name,
- });
+ conversationId,
+ name: msg.name,
+ });
if (!compiled.workflow) return { ok: false, ...compiled };
const saved = await withSavedWorkflowStoreLock(() => savedWorkflowStore.put(compiled.workflow));
return { ok: saved.changed, workflow: saved.workflow, warnings: compiled.warnings, reason: saved.reason || '' };
@@ -3129,7 +3129,7 @@ async function handleMessage(msg, sender) {
handoffOwnerId: tabChatClearResult.handoffOwnerId,
handoffGeneration: tabChatClearResult.handoffGeneration,
clearedContextMenuPromptId,
- }).catch(() => { });
+ }).catch(() => {});
}
return { ok: true, clearedContextMenuPromptId };
}
@@ -3348,7 +3348,7 @@ async function handleMessage(msg, sender) {
tabId,
handoffOwnerId: result.handoffOwnerId,
handoffGeneration: result.handoffGeneration,
- }).catch(() => { });
+ }).catch(() => {});
}
return result;
}
@@ -3362,7 +3362,7 @@ async function handleMessage(msg, sender) {
const tabId = msg.tabId || sender.tab?.id || null;
let tab = null;
if (tabId != null) {
- try { tab = await browser.tabs.get(tabId); } catch { }
+ try { tab = await browser.tabs.get(tabId); } catch {}
}
return await scheduler.createTaskJob({
tabId,
@@ -3378,7 +3378,7 @@ async function handleMessage(msg, sender) {
const tabId = msg.tabId || sender.tab?.id || null;
let tab = null;
if (tabId != null) {
- try { tab = await browser.tabs.get(tabId); } catch { }
+ try { tab = await browser.tabs.get(tabId); } catch {}
}
return await scheduler.createWatchJob({
args: msg.watch || msg.args || {},
@@ -3478,7 +3478,7 @@ async function handleMessage(msg, sender) {
await providerManager.load();
} catch (error) {
if (previousEnabled !== msg.enabled) {
- await browser.storage.local.set({ helpImproveWebBrain: previousEnabled }).catch(() => { });
+ await browser.storage.local.set({ helpImproveWebBrain: previousEnabled }).catch(() => {});
}
throw error;
}
diff --git a/test/run.js b/test/run.js
index 733579e00..358502839 100644
--- a/test/run.js
+++ b/test/run.js
@@ -29192,7 +29192,7 @@ test('getToolsForMode: mode/tier redesign exposes the intended normal and Dev to
const researchOptions = { researchEscalationEnabled: true };
assert.equal(getTools('act', { tier: 'compact', ...researchOptions }).length, 25, `[${label}] Compact should expose 25 tools after tab-tool removal`);
assert.equal(getTools('act', { tier: 'mid', ...researchOptions }).length, 48, `[${label}] Mid should expose 48 tools including CAPTCHA discovery and answer application`);
- assert.equal(getTools('act', researchOptions).length, label === 'chrome' ? 55 : 54, `[${label}] Full tool count should include opt-in MemCode recall and chat workflow tools`);
+ assert.equal(getTools('act', researchOptions).length, label === 'chrome' ? 56 : 55, `[${label}] Full tool count should include opt-in MemCode recall, chat workflow tools, and fal.ai generation`);
assert.equal(ask.includes('recall_memcode'), true, `[${label}] Ask can read connected MemCode memories`);
assert.equal(compact.includes('recall_memcode'), false, `[${label}] Compact does not expose remote recall`);
assert.equal(compact.includes('research_url'), false, `[${label}] Compact must not gain research_url as a tab-tool replacement`);
@@ -128491,6 +128491,38 @@ test('fal-media connection test only accepts a successful required-auth response
}
});
+test('generate_image success completes state-changing tasks while failed generation cannot', () => {
+ for (const [build, AgentClass, getCapabilities] of [
+ ['chrome', AgentCh, capabilitiesForCh],
+ ['firefox', AgentFx, capabilitiesFor],
+ ]) {
+ const agent = new AgentClass({});
+ const args = { prompt: 'a red apple' };
+ const consequential = agent._isExecutionMutationEvidence('generate_image', args, getCapabilities('generate_image', args));
+ for (const [tabId, result, expectedCount] of [
+ [1, { success: true, url: 'https://v3.fal.media/out.png', model: 'fal-ai/flux/schnell' }, 1],
+ [2, { success: false, error: 'fal.ai rejected the request.' }, 0],
+ [3, { success: false, error: 'fal.ai generation was cancelled.', cancelled: true }, 0],
+ [4, { success: false, error: 'fal.ai generation timed out.' }, 0],
+ ]) {
+ const state = agent._startPlanExecutionGuard(tabId, 'act', {
+ requestKind: 'execute',
+ requiresStateChange: true,
+ requiresSubmission: false,
+ });
+ agent._markPlanExecutionToolCall(tabId, 'generate_image', result, { consequential });
+ assert.equal(state.successfulConsequentialToolCalls, expectedCount, `${build}: generation must count only after success`);
+ assert.equal(agent._executionEvidenceSatisfied(state), expectedCount === 1, `${build}: successful generation must satisfy mutation evidence`);
+ const decision = agent._planOnlyTerminalDecision(tabId, 'Generated the image: https://v3.fal.media/out.png', {
+ viaDone: true,
+ outcome: 'success',
+ });
+ if (expectedCount === 1) assert.equal(decision, null, `${build}: successful generation must finish without a retry`);
+ else assert.equal(decision?.retry, true, `${build}: failed generation must not claim successful completion`);
+ }
+ }
+});
+
test('generate_image tool exists in both builds, full tier only, and settings UI wires the assistive model', async () => {
for (const [build, AgentClass, untrustedTools] of [
['chrome', AgentCh, UNTRUSTED_CONTENT_TOOLS_CH],