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.

feat(extension): a star request after a clean turn — a Star us on GitHub pill floats above the composer when an agent finishes a turn in the conversation on screen; Star opens the repository beside the current tab and retires it for good, and closing it skips the rest of that conversation, then two conversations after a second close, then three

Shahriar24c0b3c270be
diff --git a/docs/guide/features/conversations.md b/docs/guide/features/conversations.md
index f885f59..f0e9c20 100644
--- a/docs/guide/features/conversations.md
+++ b/docs/guide/features/conversations.md
@@ -135,6 +135,15 @@ Every action appears as it happens, with what it targeted and what came back.
| `external` | Came from an [MCP client](../mcp-clients.md), not from this panel |
| An approval card | The run is paused, waiting on you — see [Approvals](../approvals.md) |
+### The star request
+
+When an agent finishes a turn cleanly, a small **Star us on GitHub** pill can float above the
+composer. **Star** opens the repository in a tab beside the one you are on, and the pill never comes
+back. **×** puts it away for the rest of that conversation; it asks again in the next one, and after
+a second close it waits out two conversations, then three after every close from there on. A
+stopped, failed or instant-command turn never raises it, and neither does a run in a tab you are not
+looking at.
+
---
## See also
diff --git a/docs/internals/state.md b/docs/internals/state.md
index eefdbd2..8073278 100644
--- a/docs/internals/state.md
+++ b/docs/internals/state.md
@@ -81,6 +81,10 @@ browser shows (`browsentic/contextMenu`, both on when absent).
**Blocked sites** are `browsentic/blockedSites` in `storage.local` — a list of patterns, up to 500, that
the daemon never receives. Removing the extension removes it; each browser keeps its own.
+**The star request** is `browsentic/starNudge` in `storage.local`: whether its star was clicked, how
+many times it was closed and in which conversation, and up to four conversation ids counted since.
+It never leaves the browser.
+
**The theme** is config.json's `theme`, mirrored into `storage.local` under `browsentic/theme` so a
page paints before any socket is up. `browsentic/theme.unsynced` marks a pick the daemon has not heard
yet, handed over at the next connect. So do **diagnostics buffers** (`browsentic/diagnostics`), monitors and
diff --git a/src/extension/components/star-badge.tsx b/src/extension/components/star-badge.tsx
new file mode 100644
index 0000000..1e38ad2
--- /dev/null
+++ b/src/extension/components/star-badge.tsx
@@ -0,0 +1,40 @@
+import { Star, X } from 'lucide-react';
+
+import { STAR_ASK } from '@/lib/about';
+import { cn } from '@/lib/utils';
+
+const GITHUB_MARK =
+ 'M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z';
+
+const PART = 'flex h-full cursor-pointer items-center outline-none transition-colors hover:bg-brand/15 focus-visible:bg-brand/15';
+
+export function StarBadge({ onStar, onClose }: { onStar: () => void; onClose: () => void }) {
+ return (
+ <div className="enters glow-brand absolute bottom-3 left-1/2 h-8 -translate-x-1/2 overflow-hidden rounded-full border border-brand/45 bg-ground/85 backdrop-blur">
+ <div className="flex h-full items-center bg-brand/10">
+ <button
+ type="button"
+ onClick={onStar}
+ title={STAR_ASK}
+ className={cn(PART, 'gap-2 pr-2.5 pl-3 text-xs font-medium whitespace-nowrap text-brand')}
+ >
+ <svg viewBox="0 0 16 16" aria-hidden="true" className="size-4 shrink-0 fill-current">
+ <path d={GITHUB_MARK} />
+ </svg>
+ <span className="neon-text">Star us on GitHub</span>
+ <Star className="size-3.5 shrink-0 fill-amber text-amber" />
+ </button>
+ <span aria-hidden="true" className="h-4 w-px bg-brand/30" />
+ <button
+ type="button"
+ onClick={onClose}
+ title="Not now"
+ aria-label="Not now — close the star request"
+ className={cn(PART, 'pr-3 pl-2 text-ink-dim hover:text-ink focus-visible:text-ink')}
+ >
+ <X className="size-3.5" />
+ </button>
+ </div>
+ </div>
+ );
+}
diff --git a/src/extension/entrypoints/sidepanel/App.tsx b/src/extension/entrypoints/sidepanel/App.tsx
index b42cb52..eaa5de3 100644
--- a/src/extension/entrypoints/sidepanel/App.tsx
+++ b/src/extension/entrypoints/sidepanel/App.tsx
@@ -24,6 +24,7 @@ import { SessionList } from '@/extension/components/session-list';
import { SessionRail } from '@/extension/components/session-rail';
import { SiteMapReview } from '@/extension/components/site-map-review';
import { SkillsPanel } from '@/extension/components/skills-panel';
+import { StarBadge } from '@/extension/components/star-badge';
import { TaskPanel } from '@/extension/components/task-panel';
import type { TaskSeed } from '@/extension/components/task-editor';
import { StatusPill, describeStatus } from '@/extension/components/status-pill';
@@ -41,6 +42,7 @@ import { closeSidePanel } from '@/lib/bridge/side-panel';
import { startHandsFree } from '@/lib/bridge/panel-view';
import { usePanelCollapsed, usePanelTab } from '@/lib/bridge/use-panel-view';
import { useRun } from '@/lib/bridge/use-run';
+import { useStarNudge } from '@/lib/bridge/use-star-nudge';
import { useStoredFiles } from '@/lib/bridge/use-stored-files';
import { useStoredRecordings } from '@/lib/bridge/use-stored-recordings';
import { useStoredSessions } from '@/lib/bridge/use-stored-sessions';
@@ -60,6 +62,7 @@ const DETACH_STUCK_MS = 1_500;
export default function App() {
const daemon = useDaemonState();
const run = useRun();
+ const star = useStarNudge(run.completed, run.sessionId);
const [voiceEnabled, setVoiceEnabled] = useVoiceEnabled();
const handsFree = useHandsFreeSupported();
const storedFiles = useStoredFiles();
@@ -114,6 +117,7 @@ export default function App() {
});
const status = describeStatus(daemon, { running: run.running, listening: voice.listening });
+ const starShown = star.raised && tab === 'chat' && !run.running;
useEffect(() => {
if (!connected || daemon?.skillCatalog) return;
@@ -142,7 +146,7 @@ export default function App() {
if (!pinned || tab !== 'chat') return;
const element = viewport.current;
if (element) element.scrollTop = element.scrollHeight;
- }, [run.items, run.running, pinned, tab]);
+ }, [run.items, run.running, pinned, tab, starShown]);
function goToLatest() {
const element = viewport.current;
@@ -437,19 +441,21 @@ export default function App() {
onRemove={(id) => void removeRecording(id)}
/>
)}
- <div className="h-3" />
+ <div className={starShown ? 'h-14' : 'h-3'} />
</ScrollArea>
{tab === 'chat' && !pinned && run.items.length > 0 && (
<Button
size="sm"
variant="outline"
- className="enters absolute bottom-3 left-1/2 -translate-x-1/2 backdrop-blur"
+ className={cn('enters absolute left-1/2 -translate-x-1/2 backdrop-blur', starShown ? 'bottom-14' : 'bottom-3')}
onClick={goToLatest}
>
<ArrowDown className="size-3" /> Latest
</Button>
)}
+
+ {starShown && <StarBadge onStar={star.star} onClose={star.close} />}
</div>
{showTools && (
diff --git a/src/lib/bridge/star-nudge.test.ts b/src/lib/bridge/star-nudge.test.ts
new file mode 100644
index 0000000..007cf13
--- /dev/null
+++ b/src/lib/bridge/star-nudge.test.ts
@@ -0,0 +1,117 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+import { fakeBrowser } from 'wxt/testing';
+import { LINKS } from '@/lib/about';
+import {
+ STAR_NUDGE_KEY,
+ UNASKED,
+ asStarNudge,
+ isDue,
+ noteClosed,
+ noteFinishedTurn,
+ noteStarred,
+ openRepositoryBeside,
+ withClose,
+ withFinishedTurn,
+ withStar,
+ type StarNudge,
+} from './star-nudge';
+
+/** Plays turns finishing in each conversation in order, and lists the conversations that raised the ask. */
+function raisedAcross(start: StarNudge, conversations: string[]): string[] {
+ const raised: string[] = [];
+ conversations.reduce((nudge, conversation) => {
+ const next = withFinishedTurn(nudge, conversation);
+ if (isDue(next, conversation)) raised.push(conversation);
+ return next;
+ }, start);
+ return raised;
+}
+
+const closedIn = (...conversations: string[]): StarNudge => conversations.reduce(withClose, UNASKED);
+
+const stored = async () => (await fakeBrowser.storage.local.get(STAR_NUDGE_KEY))[STAR_NUDGE_KEY];
+
+describe('when the star ask is raised', () => {
+ it('asks after the very first turn that finishes', () => {
+ expect(raisedAcross(UNASKED, ['a'])).toEqual(['a']);
+ });
+
+ it('never asks again once the star was clicked', () => {
+ expect(raisedAcross(withStar(UNASKED), ['a', 'b', 'c', 'd', 'e', 'f'])).toEqual([]);
+ expect(raisedAcross(withStar(closedIn('a', 'b', 'c')), ['d', 'e', 'f', 'g', 'h'])).toEqual([]);
+ });
+
+ it('after a first close, sits out the rest of that conversation and asks in the next', () => {
+ expect(raisedAcross(closedIn('a'), ['a', 'a', 'b'])).toEqual(['b']);
+ });
+
+ it('after a second close, sits out two conversations and asks in the third', () => {
+ expect(raisedAcross(closedIn('a', 'b'), ['b', 'c', 'd', 'e'])).toEqual(['e']);
+ });
+
+ it('after a third close and every one after it, sits out three conversations', () => {
+ expect(raisedAcross(closedIn('a', 'b', 'c'), ['d', 'e', 'f', 'g'])).toEqual(['g']);
+ expect(raisedAcross(closedIn('a', 'b', 'c', 'g'), ['h', 'i', 'j', 'k'])).toEqual(['k']);
+ });
+
+ it('counts a conversation once, however many turns finish in it', () => {
+ expect(raisedAcross(closedIn('a', 'b'), ['c', 'c', 'c', 'd', 'd', 'e'])).toEqual(['e']);
+ });
+
+ it('keeps asking in any new conversation until it is answered, holding no more than it needs', () => {
+ const ignored = ['b', 'c', 'd', 'e', 'f'].reduce(withFinishedTurn, closedIn('a', 'b'));
+ expect(ignored.finishedIn).toEqual(['c', 'd', 'e']);
+ expect(isDue(withFinishedTurn(ignored, 'z'), 'z')).toBe(true);
+ });
+});
+
+describe('the stored star ask', () => {
+ beforeEach(() => fakeBrowser.reset());
+
+ it('reads anything unexpected as never asked', () => {
+ expect(asStarNudge(undefined)).toEqual(UNASKED);
+ expect(asStarNudge('starred')).toEqual(UNASKED);
+ expect(asStarNudge({ starred: 'yes', closes: -2, closedIn: 4, finishedIn: ['a', 7] })).toEqual({
+ ...UNASKED,
+ finishedIn: ['a'],
+ });
+ });
+
+ it('records each finished turn, each close and the star', async () => {
+ expect(isDue(await noteFinishedTurn('a'), 'a')).toBe(true);
+ expect(await stored()).toEqual({ starred: false, closes: 0, finishedIn: ['a'] });
+
+ await noteClosed('a');
+ expect(isDue(await noteFinishedTurn('a'), 'a')).toBe(false);
+ expect(isDue(await noteFinishedTurn('b'), 'b')).toBe(true);
+
+ await noteStarred();
+ expect(isDue(await noteFinishedTurn('c'), 'c')).toBe(false);
+ expect(await stored()).toMatchObject({ starred: true, closes: 1, closedIn: 'a' });
+ });
+
+ it('leaves storage alone when a turn changes nothing', async () => {
+ await noteStarred();
+ const write = vi.spyOn(fakeBrowser.storage.local, 'set');
+ await noteFinishedTurn('a');
+ expect(write).not.toHaveBeenCalled();
+ });
+});
+
+describe('opening the repository', () => {
+ beforeEach(() => fakeBrowser.reset());
+
+ it('opens it in a new tab right after the one in front', async () => {
+ vi.spyOn(fakeBrowser.tabs, 'query').mockResolvedValue([{ id: 41, index: 3 }] as never);
+ const create = vi.spyOn(fakeBrowser.tabs, 'create');
+ await openRepositoryBeside();
+ expect(create).toHaveBeenCalledWith({ url: LINKS.repository, index: 4, openerTabId: 41 });
+ });
+
+ it('still opens it when no tab is in front', async () => {
+ vi.spyOn(fakeBrowser.tabs, 'query').mockResolvedValue([]);
+ const create = vi.spyOn(fakeBrowser.tabs, 'create');
+ await openRepositoryBeside();
+ expect(create).toHaveBeenCalledWith({ url: LINKS.repository, index: undefined, openerTabId: undefined });
+ });
+});
diff --git a/src/lib/bridge/star-nudge.ts b/src/lib/bridge/star-nudge.ts
new file mode 100644
index 0000000..4f9a33d
--- /dev/null
+++ b/src/lib/bridge/star-nudge.ts
@@ -0,0 +1,75 @@
+import { browser } from 'wxt/browser';
+import { LINKS } from '@/lib/about';
+
+export const STAR_NUDGE_KEY = 'browsentic/starNudge';
+
+const CONVERSATIONS_SKIPPED_BY_CLOSES = [0, 0, 2, 3];
+
+export interface StarNudge {
+ starred: boolean;
+ closes: number;
+ closedIn?: string;
+ finishedIn: string[];
+}
+
+export const UNASKED: StarNudge = { starred: false, closes: 0, finishedIn: [] };
+
+const isText = (value: unknown): value is string => typeof value === 'string';
+
+export function asStarNudge(value: unknown): StarNudge {
+ if (typeof value !== 'object' || value === null) return UNASKED;
+ const held = value as Partial<Record<keyof StarNudge, unknown>>;
+ return {
+ starred: held.starred === true,
+ closes: typeof held.closes === 'number' && held.closes > 0 ? Math.floor(held.closes) : 0,
+ closedIn: isText(held.closedIn) ? held.closedIn : undefined,
+ finishedIn: Array.isArray(held.finishedIn) ? held.finishedIn.filter(isText) : [],
+ };
+}
+
+export const conversationsSkipped = (closes: number): number =>
+ CONVERSATIONS_SKIPPED_BY_CLOSES[Math.min(closes, CONVERSATIONS_SKIPPED_BY_CLOSES.length - 1)];
+
+const waitedOut = (nudge: StarNudge): boolean => nudge.finishedIn.length > conversationsSkipped(nudge.closes);
+
+export const isDue = (nudge: StarNudge, sessionId: string): boolean =>
+ !nudge.starred && sessionId !== nudge.closedIn && waitedOut(nudge);
+
+export function withFinishedTurn(nudge: StarNudge, sessionId: string): StarNudge {
+ const uncounted =
+ !nudge.starred && sessionId !== nudge.closedIn && !nudge.finishedIn.includes(sessionId) && !waitedOut(nudge);
+ return uncounted ? { ...nudge, finishedIn: [...nudge.finishedIn, sessionId] } : nudge;
+}
+
+export const withClose = (nudge: StarNudge, sessionId: string): StarNudge => ({
+ starred: false,
+ closes: nudge.closes + 1,
+ closedIn: sessionId,
+ finishedIn: [],
+});
+
+export const withStar = (nudge: StarNudge): StarNudge => ({ ...nudge, starred: true });
+
+async function update(change: (nudge: StarNudge) => StarNudge): Promise<StarNudge> {
+ const stored = await browser.storage.local.get(STAR_NUDGE_KEY);
+ const current = asStarNudge(stored[STAR_NUDGE_KEY]);
+ const next = change(current);
+ if (next !== current) await browser.storage.local.set({ [STAR_NUDGE_KEY]: next });
+ return next;
+}
+
+export const noteFinishedTurn = (sessionId: string): Promise<StarNudge> =>
+ update((nudge) => withFinishedTurn(nudge, sessionId));
+
+export const noteClosed = (sessionId: string): Promise<StarNudge> => update((nudge) => withClose(nudge, sessionId));
+
+export const noteStarred = (): Promise<StarNudge> => update(withStar);
+
+export async function openRepositoryBeside(): Promise<void> {
+ const [current] = await browser.tabs.query({ active: true, currentWindow: true });
+ await browser.tabs.create({
+ url: LINKS.repository,
+ index: current ? current.index + 1 : undefined,
+ openerTabId: current?.id,
+ });
+}
diff --git a/src/lib/bridge/use-extension-settings.ts b/src/lib/bridge/use-extension-settings.ts
index 170f035..70c5300 100644
--- a/src/lib/bridge/use-extension-settings.ts
+++ b/src/lib/bridge/use-extension-settings.ts
@@ -6,7 +6,7 @@ import { CONTEXT_MENU_KEY, asContextMenuChoice, type ContextMenuChoice } from '.
import { brandFrom } from './identity';
import { PUSH_TO_TALK_KEY } from './panel-view';
-function useLocalSetting<T>(key: string, parse: (value: unknown) => T): [T, (next: T) => void] {
+export function useLocalSetting<T>(key: string, parse: (value: unknown) => T): [T, (next: T) => void] {
const [value, setValue] = useState(() => parse(undefined));
useEffect(() => {
diff --git a/src/lib/bridge/use-run.ts b/src/lib/bridge/use-run.ts
index b8e223f..d1cd796 100644
--- a/src/lib/bridge/use-run.ts
+++ b/src/lib/bridge/use-run.ts
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { browser, type Browser } from 'wxt/browser';
-import type { FocusedElement } from '@/lib/actions/protocol';
+import type { FocusedElement, RunEvent } from '@/lib/actions/protocol';
import type { MonitorState } from '@/lib/monitor/events';
import type { RecordingState } from '@/lib/recordings/events';
import { SITE_MAPPER_SKILL, type SiteMapDraft } from '@/lib/skills/site-map';
@@ -27,11 +27,20 @@ export interface SendOptions {
liveTools?: boolean;
}
+export interface CompletedTurn {
+ sessionId: string;
+ runId: string;
+}
+
+const finishedCleanly = (event: RunEvent): boolean => event.kind === 'done' && event.stopReason === 'end_turn';
+
export interface Run {
items: RunItem[];
running: boolean;
sessionId: string | null;
sessions: TabSession[];
+ /** The latest turn an agent saw through to the end, in any conversation, as it happened — never from a replay. */
+ completed: CompletedTurn | null;
send: (text: string, opts?: SendOptions) => void;
cancel: () => void;
decide: (toolId: string, allow: boolean, remember?: boolean) => void;
@@ -72,6 +81,7 @@ export function useRun(): Run {
const [tools, setTools] = useState<SavedToolMeta[]>([]);
const [autoRunReady, setAutoRunReady] = useState(false);
const [bySession, setBySession] = useState<Record<string, RunItem[]>>({});
+ const [completed, setCompleted] = useState<CompletedTurn | null>(null);
const port = useRef<Browser.runtime.Port | null>(null);
const tab = useActiveTab();
@@ -143,7 +153,9 @@ export function useRun(): Run {
} else if (runMessage.op === 'close') {
window.close();
} else {
- write(runMessage.sessionId ?? EXTERNAL_VIEW, (items) => reduce(items, runMessage.event));
+ const { sessionId: owner, runId, event } = runMessage;
+ if (owner && finishedCleanly(event)) setCompleted({ sessionId: owner, runId });
+ write(owner ?? EXTERNAL_VIEW, (items) => reduce(items, event));
}
});
@@ -238,6 +250,7 @@ export function useRun(): Run {
running: displayed?.runId != null,
sessionId,
sessions,
+ completed,
send,
draft,
mapSite: useCallback(() => send(`@${SITE_MAPPER_SKILL} map this site`), [send]),
diff --git a/src/lib/bridge/use-star-nudge.ts b/src/lib/bridge/use-star-nudge.ts
new file mode 100644
index 0000000..9a2d67d
--- /dev/null
+++ b/src/lib/bridge/use-star-nudge.ts
@@ -0,0 +1,43 @@
+import { useEffect, useRef, useState } from 'react';
+import { STAR_NUDGE_KEY, asStarNudge, isDue, noteClosed, noteFinishedTurn, noteStarred, openRepositoryBeside } from './star-nudge';
+import { useLocalSetting } from './use-extension-settings';
+import type { CompletedTurn } from './use-run';
+
+export interface StarNudgeView {
+ raised: boolean;
+ star: () => void;
+ close: () => void;
+}
+
+/** Raised by a turn that finished cleanly in the conversation on screen, and only there. */
+export function useStarNudge(completed: CompletedTurn | null, onScreen: string | null): StarNudgeView {
+ const [nudge] = useLocalSetting(STAR_NUDGE_KEY, asStarNudge);
+ const [raisedIn, setRaisedIn] = useState<string | null>(null);
+ const watching = useRef(onScreen);
+
+ useEffect(() => {
+ watching.current = onScreen;
+ }, [onScreen]);
+
+ useEffect(() => {
+ if (!completed || completed.sessionId !== watching.current) return;
+ let live = true;
+ void noteFinishedTurn(completed.sessionId).then((next) => {
+ if (live && isDue(next, completed.sessionId)) setRaisedIn(completed.sessionId);
+ });
+ return () => {
+ live = false;
+ };
+ }, [completed]);
+
+ return {
+ raised: raisedIn !== null && raisedIn === onScreen && isDue(nudge, raisedIn),
+ star: () => {
+ void openRepositoryBeside();
+ void noteStarred();
+ },
+ close: () => {
+ if (raisedIn) void noteClosed(raisedIn);
+ },
+ };
+}