An agentic browser harness: an AI side panel & orb in your own logged-in Chrome, Edge, Arc, Brave or even Firefox run by the agent/subscription you already use (Claude Code, Codex, Antigravity). Free, open source, no API key. Also an MCP server.
TypeScript agentic-browseragentic-browsingagy-cliaiai-agentai-browser-extensionai-toolsbrave-extensionbrowser-agentbrowser-automationbrowser-extensionbrowser-usebrowserskillchrome-extensionclaude-codecodexfirefox-addonmcp-servernanobrowserweb-automation
fix(extension): a click on a notice lets Firefox restore a minimized window by focusing it, which keeps it maximized, where state normal would undo that; a notice that repeats keeps its tab however many others came between
Shahriare6686f7b3516
diff --git a/docs/internals/extension.md b/docs/internals/extension.mdindex 896d83e..96b0fcf 100644--- a/docs/internals/extension.md+++ b/docs/internals/extension.md@@ -589,7 +589,9 @@ A finished monitor, scheduled task or reminder first asks `noticeOnDevice()` inWhile no browser window is focused and un-minimized, it sends the notice to the Bridge for theBrowsentic app to show as the computer's own notification; a card on a page nobody is looking athelps no one. When the app takes it, the notice's tab is remembered in `storage.session` under-`browsentic/noticeTabs` (the newest 30), and a click in the app brings that tab to the front. When+`browsentic/noticeTabs` (the newest 30), and a click in the app brings that tab to the front,+restoring a minimized window first in Chromium; Firefox's focus restores it as it was, where its+`state: "normal"` would also undo a maximize. Whenit does not (the browser in front, no app, notifications off, a Bridge before protocol 24), thecaller goes on to its card or the browser's own notification, as before.diff --git a/src/lib/bridge/device-notices.test.ts b/src/lib/bridge/device-notices.test.tsindex dbc33f0..c2710ef 100644--- a/src/lib/bridge/device-notices.test.ts+++ b/src/lib/bridge/device-notices.test.ts@@ -33,6 +33,7 @@ function windows(list: Window[], tabs: { id: number; windowId: number }[] = []):beforeEach(() => {fakeBrowser.reset();+ vi.stubEnv('FIREFOX', '');socket.sendNotice.mockReset();toast.goToTab.mockReset();});@@ -76,6 +77,31 @@ describe('noticeOnDevice', () => {expect(fakeBrowser.windows.update).toHaveBeenNthCalledWith(2, 5, { focused: true });});+ it('leaves Firefox to restore a minimized window as it was, maximized or not, by focusing it', async () => {+ vi.stubEnv('FIREFOX', 'true');+ windows([{ id: 5, focused: false, state: 'minimized' }], [{ id: 7, windowId: 5 }]);+ serveDeviceNotices();+ socket.sendNotice.mockResolvedValue(true);+ await noticeOnDevice(done, 7);++ socket.opened!(done.id);+ await vi.waitFor(() => expect(toast.goToTab).toHaveBeenCalledWith(7));+ expect(vi.mocked(fakeBrowser.windows.update).mock.calls).toEqual([[5, { focused: true }]]);+ });++ it('keeps the tab of a notice that repeats, however many others came between', async () => {+ windows([{ id: 4, focused: false, state: 'normal' }], [{ id: 7, windowId: 4 }]);+ serveDeviceNotices();+ socket.sendNotice.mockResolvedValue(true);+ await noticeOnDevice({ ...done, id: 'timer:t1' }, 99);+ for (let index = 0; index < 29; index++) await noticeOnDevice({ ...done, id: `monitor:m${index}` }, 100 + index);+ await noticeOnDevice({ ...done, id: 'timer:t1' }, 7);+ await noticeOnDevice({ ...done, id: 'monitor:last' }, 200);++ socket.opened!('timer:t1');+ await vi.waitFor(() => expect(toast.goToTab).toHaveBeenCalledWith(7));+ });+it('brings a window forward for a notice that had no tab', async () => {windows([{ id: 4, focused: false, state: 'normal' }]);serveDeviceNotices();diff --git a/src/lib/bridge/device-notices.ts b/src/lib/bridge/device-notices.tsindex 6c73a5d..375bcd0 100644--- a/src/lib/bridge/device-notices.ts+++ b/src/lib/bridge/device-notices.ts@@ -31,14 +31,18 @@ async function noticeTabs(): Promise<Record<string, number>> {}async function rememberTab(noticeId: string, tabId: number): Promise<void> {- const kept = Object.entries({ ...(await noticeTabs()), [noticeId]: tabId }).slice(-NOTICE_TABS_MAX);+ const others = Object.entries(await noticeTabs()).filter(([id]) => id !== noticeId);+ const kept = [...others, [noticeId, tabId] as const].slice(-NOTICE_TABS_MAX);await browser.storage.session.set({ [NOTICE_TABS_KEY]: Object.fromEntries(kept) });}-/** Focus alone leaves a minimized window in the Dock or the taskbar, so it is restored first. */+/**+ * In Chromium, focus alone leaves a minimized window in the Dock or the taskbar, so it is restored+ * first. Firefox's focus restores it as it was, while its "normal" would also undo a maximize.+ */async function restore(windowId: number): Promise<void> {const window = await browser.windows.get(windowId).catch(() => null);- if (window?.state === 'minimized') await browser.windows.update(windowId, { state: 'normal' }).catch(() => undefined);+ if (!import.meta.env.FIREFOX && window?.state === 'minimized') await browser.windows.update(windowId, { state: 'normal' }).catch(() => undefined);await browser.windows.update(windowId, { focused: true }).catch(() => undefined);}