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): the update pill waits while any conversation has a run going or a recording is on, since a reload ends them all; an unpacked copy looks for a rewritten folder whenever the panel opens or gets focus, because the Bridge restarts before it rewrites it; Firefox skips the update check it does not have; and a fourth version number counts
Shahriar0194ace8f989
diff --git a/docs/guide/install.md b/docs/guide/install.mdindex 6eed480..943eb37 100644--- a/docs/guide/install.md+++ b/docs/guide/install.md@@ -124,7 +124,7 @@ detail.| What | How it updates || --- | --- || The extension from the Chrome Web Store or Edge Add-ons | The browser downloads it when it checks (every few hours), or as soon as the Bridge is newer than the extension; then the side panel says the new version is ready above the prompt; press **Update**. A browser restart installs it too |-| The Firefox add-on | Firefox downloads it about once a day, or as soon as the Bridge is newer; then the side panel says the new version is ready above the prompt; press **Update**. `about:addons` → the gear → **Check for Updates** checks now |+| The Firefox add-on | Firefox downloads it about once a day; then the side panel says the new version is ready above the prompt; press **Update**. `about:addons` → the gear → **Check for Updates** checks now || Browsentic Bridge, from an app | The app offers each release on its Overview tab; one press updates the app and the Bridge || Browsentic Bridge, from `npx` | `npx browsentic@latest update` || An unpacked copy | `browsentic update` rewrites the folder in place; press **Update** in the side panel, or ↻ on its card |@@ -168,9 +168,8 @@ yet, Mozilla is still signing that version; it appears within minutes, occasiona**2. Enter the pairing code** in the popup and press **Connect**.-Firefox checks for a newer signed build about once a day, and sooner once the Bridge is newer. When-it has one, the side panel says so above the prompt; press **Update**, or let the next Firefox start-install it. There is no ↻ step.+Firefox checks for a newer signed build about once a day. When it has one, the side panel says so+above the prompt; press **Update**, or let the next Firefox start install it. There is no ↻ step.Nine tools that need Chrome's debugger (the trusted click, the captcha, diagnostics and page-codetools) do not exist on Firefox, and the agent there is not offered them. [Limits](limits.md) hasdiff --git a/docs/guide/maintenance.md b/docs/guide/maintenance.mdindex f9b842c..19ea13c 100644--- a/docs/guide/maintenance.md+++ b/docs/guide/maintenance.md@@ -14,7 +14,7 @@ working whether it updates first or last.| What | How || --- | --- || The extension from the Chrome Web Store or Edge Add-ons | The browser downloads the update when it checks, every few hours, or as soon as the Bridge is newer than the extension. It holds it until the extension restarts, so the side panel says the new version is ready above the prompt; press **Update**. Restarting the browser installs it too |-| The Firefox add-on | Every release publishes a signed `.xpi` and an `updates.json` beside it. Firefox polls that file about once a day, or as soon as the Bridge is newer, and **Check for Updates** in `about:addons` polls it now. The update then waits for **Update** in the side panel, or the next Firefox start |+| The Firefox add-on | Every release publishes a signed `.xpi` and an `updates.json` beside it. Firefox polls that file about once a day, and **Check for Updates** in `about:addons` polls it now. The update then waits for **Update** in the side panel, or the next Firefox start || Browsentic Bridge, from the Mac or Windows app | The app's **Update now** card ([macOS](mac-app.md#updating), [Windows](windows-app.md#updating)) || Browsentic Bridge, from `npx` or `npm` | `browsentic update`, below || An unpacked copy | `browsentic update` rewrites the folder, then press **Update** in the side panel, or ↻ on its card |diff --git a/docs/internals/extension.md b/docs/internals/extension.mdindex 3bca707..6cea29a 100644--- a/docs/internals/extension.md+++ b/docs/internals/extension.md@@ -520,7 +520,8 @@ by the browser, until the next browser start. Chrome records this in `Secure Pre`extension-update.ts` holds the update for the panel instead. `runtime.onUpdateAvailable` gives theheld version, which goes to `storage.session` under `browsentic/waitingUpdate`. The panel shows the-pill above the prompt while that version is newer than the one running and no run is going.+pill above the prompt while that version is newer than the one running, and while no conversation+has a run going and nothing is being recorded, since a reload ends them all.**Update** calls `runtime.reload()`, which installs the held update at once (Chromium's`ExtensionRegistrar` finishes a delayed install on reload). A reload closes the side panel andevery extension page, and clears `storage.session`.@@ -533,12 +534,14 @@ store names a version, before the download, so the pill waits for `onUpdateAvailtrusting that answer. A Bridge-only release finds nothing and shows nothing.Firefox applies an update at once when nothing listens to `onUpdateAvailable`, mid-run included.-The listener makes it wait for the pill too.+The listener makes it wait for the pill too. Firefox has no `requestUpdateCheck`, so it finds an+update only on its own daily check.An unpacked copy has no store. Its files are read from the folder the Bridge rewrites, so on anewer Bridge the worker fetches `/manifest.json`, which reports the version on disk, not the oneloaded. If that is newer, it is held the same way, and **Update** reloads the extension from the-folder.+folder. `browsentic update` and the apps restart the Bridge before they rewrite the folder, so the+welcome often comes too early; the panel reads the manifest again whenever it opens or gets focus.---diff --git a/src/extension/entrypoints/sidepanel/App.tsx b/src/extension/entrypoints/sidepanel/App.tsxindex a723bc0..8633078 100644--- a/src/extension/entrypoints/sidepanel/App.tsx+++ b/src/extension/entrypoints/sidepanel/App.tsx@@ -474,7 +474,7 @@ export default function App() {{tab === 'chat' && (<footer className="shrink-0 border-t border-line p-3">- {update.version && !run.running && (+ {update.version && runningCount === 0 && !run.recording && (<UpdatePill version={update.version} onUpdate={update.restart} onLater={update.later} />)}{blockedHere && <BlockedSiteNote pattern={blockedHere} />}diff --git a/src/lib/bridge/extension-update.test.ts b/src/lib/bridge/extension-update.test.tsindex 9b8501f..1bb93e0 100644--- a/src/lib/bridge/extension-update.test.ts+++ b/src/lib/bridge/extension-update.test.ts@@ -1,6 +1,6 @@-import { beforeEach, describe, expect, it, vi } from 'vitest';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { fakeBrowser } from 'wxt/testing';-import { WAITING_UPDATE_KEY, asWaitingVersion, followBridge, serveExtensionUpdates } from './extension-update';+import { WAITING_UPDATE_KEY, asWaitingVersion, followBridge, lookForRebuild, serveExtensionUpdates } from './extension-update';const RUNNING = '0.8.2';@@ -19,7 +19,10 @@ beforeEach(() => {vi.spyOn(fakeBrowser.runtime, 'requestUpdateCheck').mockImplementation(checkForUpdate);vi.spyOn(fakeBrowser.management, 'getSelf').mockImplementation(async () => ({ installType }) as never);vi.stubGlobal('fetch', async () => new Response(JSON.stringify({ version: onDisk })));+ // WXT's test plugin passes build flags as strings, and "false" is truthy.+ vi.stubEnv('FIREFOX', '');});+afterEach(() => vi.unstubAllEnvs());describe('an update the browser has downloaded', () => {it('is held for the panel instead of waiting for the extension to go idle', async () => {@@ -61,6 +64,12 @@ describe('a store copy following a newer Bridge', () => {checkForUpdate.mockRejectedValue(new Error('updates disabled'));await expect(followBridge('0.8.3')).resolves.toBeUndefined();});++ it('leaves Firefox to its own timer, since it has no check to ask for', async () => {+ vi.stubEnv('FIREFOX', 'true');+ await expect(followBridge('0.8.3')).resolves.toBeUndefined();+ expect(checkForUpdate).not.toHaveBeenCalled();+ });});describe('an unpacked copy following a newer Bridge', () => {@@ -78,4 +87,19 @@ describe('an unpacked copy following a newer Bridge', () => {await followBridge('0.8.3');expect(await waiting()).toBeUndefined();});++ it('finds a folder the Bridge rewrote after its welcome when the panel looks again', async () => {+ await followBridge('0.8.3');+ onDisk = '0.8.3';+ await lookForRebuild();+ expect(await waiting()).toBe('0.8.3');+ });+});++describe('a store copy when the panel looks for a rebuilt folder', () => {+ it('reads nothing from disk, since a store build never changes there', async () => {+ onDisk = '0.8.3';+ await lookForRebuild();+ expect(await waiting()).toBeUndefined();+ });});diff --git a/src/lib/bridge/extension-update.ts b/src/lib/bridge/extension-update.tsindex 0a5dc47..f096b96 100644--- a/src/lib/bridge/extension-update.ts+++ b/src/lib/bridge/extension-update.ts@@ -27,12 +27,8 @@ export function serveExtensionUpdates(): void {export async function followBridge(daemonVersion: string): Promise<void> {if (!isNewer(daemonVersion, runningVersion())) return;- const { installType } = await browser.management.getSelf();- if (installType === 'development') {- const rebuilt = asWaitingVersion(await unpackedVersion());- if (rebuilt) await hold(rebuilt);- return;- }+ if (await isUnpacked()) return holdRebuild();+ if (import.meta.env.FIREFOX) return;// The browser grants one check every few hours, so each newer Bridge spends it once.const checked = await browser.storage.session.get(CHECKED_FOR_KEY);if (checked[CHECKED_FOR_KEY] === daemonVersion) return;@@ -40,6 +36,18 @@ export async function followBridge(daemonVersion: string): Promise<void> {await browser.runtime.requestUpdateCheck().catch(() => undefined);}+/** The Bridge restarts before it rewrites an unpacked folder, so its welcome can come too early to see the new build. */+export async function lookForRebuild(): Promise<void> {+ if (await isUnpacked()) await holdRebuild();+}++const isUnpacked = async () => (await browser.management.getSelf()).installType === 'development';++async function holdRebuild(): Promise<void> {+ const rebuilt = asWaitingVersion(await unpackedVersion());+ if (rebuilt) await hold(rebuilt);+}+/** An unpacked copy reads its files from the folder the Bridge rewrites, so the manifest there names the build a reload loads. */async function unpackedVersion(): Promise<string | null> {try {diff --git a/src/lib/bridge/use-waiting-update.ts b/src/lib/bridge/use-waiting-update.tsindex e4b29ef..558096b 100644--- a/src/lib/bridge/use-waiting-update.ts+++ b/src/lib/bridge/use-waiting-update.ts@@ -1,6 +1,6 @@import { useEffect, useState } from 'react';import { browser } from 'wxt/browser';-import { WAITING_UPDATE_KEY, asWaitingVersion, restartIntoUpdate } from './extension-update';+import { WAITING_UPDATE_KEY, asWaitingVersion, lookForRebuild, restartIntoUpdate } from './extension-update';export interface WaitingUpdateView {version: string | null;@@ -22,9 +22,13 @@ export function useWaitingUpdate(): WaitingUpdateView {if (WAITING_UPDATE_KEY in changes) setWaiting(asWaitingVersion(changes[WAITING_UPDATE_KEY].newValue));};browser.storage.session.onChanged.addListener(listener);+ const look = () => void lookForRebuild();+ look();+ window.addEventListener('focus', look);return () => {live = false;browser.storage.session.onChanged.removeListener(listener);+ window.removeEventListener('focus', look);};}, []);diff --git a/src/lib/version.test.ts b/src/lib/version.test.tsindex bec402d..d71f278 100644--- a/src/lib/version.test.ts+++ b/src/lib/version.test.ts@@ -13,6 +13,10 @@ describe('comparing versions', () => {['0.7.0-rc.1', '0.7.0', false],['0.7.0-rc.2', '0.7.0-rc.1', true],['0.7.0-rc.1', '0.6.2', true],+ ['0.8.2.1', '0.8.2', true],+ ['0.8.2.2', '0.8.2.1', true],+ ['0.8.2.0', '0.8.2', false],+ ['0.8.2', '0.8.2.1', false],];for (const [candidate, current, newer] of cases) {test(`${candidate} is ${newer ? '' : 'not '}newer than ${current}`, () => {diff --git a/src/lib/version.ts b/src/lib/version.tsindex 0aa6ba6..67a2147 100644--- a/src/lib/version.ts+++ b/src/lib/version.ts@@ -1,7 +1,7 @@export function isNewer(candidate: string, current: string): boolean {const release = (version: string) => version.split('-')[0].split('.').map((part) => Number.parseInt(part, 10) || 0);const [a, b] = [release(candidate), release(current)];- for (let i = 0; i < 3; i++) if ((a[i] ?? 0) !== (b[i] ?? 0)) return (a[i] ?? 0) > (b[i] ?? 0);+ for (let i = 0; i < Math.max(a.length, b.length); i++) if ((a[i] ?? 0) !== (b[i] ?? 0)) return (a[i] ?? 0) > (b[i] ?? 0);// Same release: a final beats the prerelease that led to it, and two prereleases fall back// to string order, which is right for the -rc.1 / -rc.2 shape this project actually uses.