Skip to content

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.

fix(extension): a conversation begun on Browsentic Home in Firefox, which shows a page its own address, is on no site, so the Bridge no longer scopes the run to the extension's id and asks before every site it then visits, and history names no host for it; Home's Customize menu says what a new tab shows with Home off in this browser

Shahriar43d9f5ba9149
diff --git a/src/extension/components/home-customize.tsx b/src/extension/components/home-customize.tsx
index aa49ef1..d307b67 100644
--- a/src/extension/components/home-customize.tsx
+++ b/src/extension/components/home-customize.tsx
@@ -3,6 +3,7 @@ import { Check, SlidersHorizontal } from 'lucide-react';
import { browser } from 'wxt/browser';
import { Switch } from '@/extension/components/ui/switch';
+import { browserOwnNewTab } from '@/lib/bridge/new-tab';
import { useTheme } from '@/lib/bridge/use-theme';
import type { NewTabChoice } from '@/lib/settings/new-tab';
import { THEMES } from '@/lib/settings/theme';
@@ -73,7 +74,14 @@ export function HomeCustomize({
>
<Switch checked={choice.sites} label="Show frequent sites" onChange={(sites) => onChange({ ...choice, sites })} />
</Toggle>
- <Toggle title="Browsentic Home" note="Off, new tabs open the browser’s own page again.">
+ <Toggle
+ title="Browsentic Home"
+ note={
+ browserOwnNewTab()
+ ? 'Off, new tabs open Chrome’s own page again.'
+ : 'Off, new tabs show a plain page of your frequent sites. This browser keeps its own new tab page out of an extension’s reach.'
+ }
+ >
<Switch checked label="Open Browsentic Home on new tabs" onChange={onTurnOff} />
</Toggle>
</div>
diff --git a/src/lib/bridge/run-port.ts b/src/lib/bridge/run-port.ts
index 7e377e9..722f455 100644
--- a/src/lib/bridge/run-port.ts
+++ b/src/lib/bridge/run-port.ts
@@ -91,6 +91,7 @@ import {
remapTab,
sessionForRun,
sessionForTab,
+ siteUrlOf,
type Ensured,
type TabAnchor,
type TabSession,
@@ -618,7 +619,7 @@ async function startTurn(
const current = await browser.tabs.get(session.currentTabId).catch(() => null);
const hidden = await siteBlocked(session.url, ...tabUrls(current), focus?.url);
const runId = sendInstruction(text, {
- url: hidden ? undefined : session.url,
+ url: hidden ? undefined : siteUrlOf(session.url),
tabId: session.currentTabId,
sessionId,
agent: session.agent,
diff --git a/src/lib/bridge/tab-sessions.test.ts b/src/lib/bridge/tab-sessions.test.ts
new file mode 100644
index 0000000..174a1ee
--- /dev/null
+++ b/src/lib/bridge/tab-sessions.test.ts
@@ -0,0 +1,33 @@
+import { beforeEach, describe, expect, test } from 'vitest';
+import { fakeBrowser } from 'wxt/testing';
+import { ensureSessionForTab, hostOf, siteUrlOf } from './tab-sessions';
+
+const FIREFOX_HOME = 'moz-extension://4f1c2a0e-9b7d-4c51-a3e2-0d6f5b8c9e17/newtab.html';
+
+beforeEach(() => fakeBrowser.reset());
+
+describe('a conversation begun on Browsentic Home in Firefox, which shows the page its own address', () => {
+ test('is on no site, so the extension’s id never stands in for a host', async () => {
+ const ensured = await ensureSessionForTab({ tabId: 7, windowId: 1, url: FIREFOX_HOME, title: 'New Tab' });
+ expect(ensured.ok && ensured.session.host).toBeUndefined();
+ expect(hostOf(FIREFOX_HOME)).toBeUndefined();
+ });
+
+ test('reaches the Bridge as nowhere in particular, which a blank tab is too', () => {
+ expect(siteUrlOf(FIREFOX_HOME)).toBeUndefined();
+ expect(siteUrlOf('chrome-extension://abcdefghijklmnopabcdefghijklmnop/newtab.html')).toBeUndefined();
+ expect(siteUrlOf(undefined)).toBeUndefined();
+ });
+});
+
+describe('a conversation on a site', () => {
+ test('keeps its host and its address', () => {
+ expect(hostOf('https://www.github.com/pulls')).toBe('www.github.com');
+ expect(hostOf('http://localhost:5173/')).toBe('localhost:5173');
+ expect(siteUrlOf('https://github.com/pulls')).toBe('https://github.com/pulls');
+ });
+
+ test('on a local file has no host, as before', () => {
+ expect(hostOf('file:///Users/you/notes.html')).toBeUndefined();
+ });
+});
diff --git a/src/lib/bridge/tab-sessions.ts b/src/lib/bridge/tab-sessions.ts
index 87effb3..ebf95db 100644
--- a/src/lib/bridge/tab-sessions.ts
+++ b/src/lib/bridge/tab-sessions.ts
@@ -244,11 +244,16 @@ export function remapTab(from: number, to: number): Promise<void> {
});
}
+/** A site's host. Browsentic's own pages have none: Chrome hides their address, and Firefox shows the extension's id where a host would be. */
export function hostOf(url: string | undefined): string | undefined {
if (!url) return undefined;
try {
- return new URL(url).host || undefined;
+ const { protocol, host } = new URL(url);
+ return /^https?:$/.test(protocol) ? host || undefined : undefined;
} catch {
return undefined;
}
}
+
+/** The page a turn is about, as the Bridge scopes the run: a site, or nowhere in particular, as on a blank tab. */
+export const siteUrlOf = (url: string | undefined): string | undefined => (hostOf(url) ? url : undefined);