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
feat(panel): an agent reply flows in word by word at a steady pace, each word blurring in, however the agent chunks it, and finishes its held-back words after the run ends; a reply read back from history shows whole
Shahriare31fe654e204
diff --git a/src/extension/assets/globals.css b/src/extension/assets/globals.cssindex 17a3bf6..c71f278 100644--- a/src/extension/assets/globals.css+++ b/src/extension/assets/globals.css@@ -363,13 +363,11 @@@keyframes browsentic-token {from {opacity: 0;- filter: blur(4px);- transform: translateY(2px);+ filter: blur(5px);}to {opacity: 1;filter: blur(0);- transform: none;}}@@ -462,7 +460,7 @@}[data-stream] .tok {- animation: browsentic-token 0.42s var(--ease-out-expo) both;+ animation: browsentic-token 0.6s cubic-bezier(0.33, 1, 0.68, 1) both;}/* The caret rides the end of whatever block the reply is still growing. */diff --git a/src/extension/components/markdown.tsx b/src/extension/components/markdown.tsxindex ca91205..32267e0 100644--- a/src/extension/components/markdown.tsx+++ b/src/extension/components/markdown.tsx@@ -1,12 +1,15 @@-import { memo, useMemo, useRef, type ReactNode } from 'react';+import { memo, useEffect, useMemo, useRef, useState, type ReactNode } from 'react';+import { paced, wordEnd } from '@/lib/reveal';import { cn } from '@/lib/utils';/*- * `streaming` marks the reply that is still arriving: every word mounts with a- * blur-in and a caret trails the last block. The marker stays on as `done`- * afterwards so the words still in flight when the run ends finish settling- * rather than snapping. A reply read back from a transcript never gets it.+ * `streaming` marks the reply that is still arriving. However the agent chunks+ * it, the words are let in at a steady pace, each with a blur-in, and a caret+ * trails the last block; a reply that ends with words still held back keeps+ * flowing until it has shown them all. The marker stays on as `done` afterwards+ * so the last words finish settling rather than snapping. A reply read back+ * from a transcript never gets it.** Blocks are memoized on their own shape, so a delta only re-renders the block* it lands in.@@ -23,13 +26,17 @@ export function Markdown({const arrivedLive = useRef(false);if (streaming) arrivedLive.current = true;+ const shown = useReveal(text, Boolean(streaming));+ const visible = text.slice(0, shown);+ const flowing = streaming || shown < text.length;+const blocks = useMemo(- () => parseBlocks(text).map((block) => ({ block, sig: JSON.stringify(block) })),- [text],+ () => parseBlocks(visible).map((block) => ({ block, sig: JSON.stringify(block) })),+ [visible],);return (<div- data-stream={streaming ? 'live' : arrivedLive.current ? 'done' : undefined}+ data-stream={flowing ? 'live' : arrivedLive.current ? 'done' : undefined}className={cn('flex min-w-0 flex-col gap-2', className)}>{blocks.map(({ block, sig }, index) => (@@ -39,6 +46,35 @@ export function Markdown({);}+function useReveal(text: string, streaming: boolean): number {+ const progress = useRef(streaming ? 0 : text.length);+ const latest = useRef(text);+ latest.current = text;+ const [shown, setShown] = useState(() => (streaming ? wordEnd(text, 0) : text.length));+ const behind = shown < text.length;++ useEffect(() => {+ if (!behind) return;+ if (matchMedia('(prefers-reduced-motion: reduce)').matches) {+ setShown(latest.current.length);+ return;+ }+ let frame = 0;+ let last = performance.now();+ const tick = (now: number) => {+ const full = latest.current;+ progress.current = paced(full, progress.current, (now - last) / 1000);+ last = now;+ setShown(wordEnd(full, progress.current));+ frame = requestAnimationFrame(tick);+ };+ frame = requestAnimationFrame(tick);+ return () => cancelAnimationFrame(frame);+ }, [behind]);++ return Math.min(shown, text.length);+}+const MemoBlock = memo(({ block }: { block: Block; sig: string }) => renderBlock(block, '0'),(before, after) => before.sig === after.sig,diff --git a/src/lib/reveal.test.ts b/src/lib/reveal.test.tsnew file mode 100644index 0000000..5e4dbdb--- /dev/null+++ b/src/lib/reveal.test.ts@@ -0,0 +1,39 @@+import { describe, expect, it } from 'vitest';++import { paced, wordEnd } from './reveal';++describe('paced', () => {+ it('reveals a short reply at the floor rate', () => {+ expect(paced('x'.repeat(100), 0, 0.1)).toBeCloseTo(30);+ });++ it('drains a large backlog within about a second', () => {+ const text = 'x'.repeat(5_000);+ let progress = 0;+ let seconds = 0;+ while (progress < text.length) {+ progress = paced(text, progress, 1 / 60);+ seconds += 1 / 60;+ }+ expect(seconds).toBeLessThan(4);+ expect(paced(text, 0, 1 / 60)).toBeGreaterThan(5_000 / 0.9 / 60 - 1);+ });++ it('never runs past the text, even when it shrinks', () => {+ expect(paced('abc', 2, 10)).toBe(3);+ expect(paced('abc', 9, 0.1)).toBe(3);+ });+});++describe('wordEnd', () => {+ it('rounds a cut up to the end of the word it lands in', () => {+ expect(wordEnd('hello brave world', 0)).toBe(5);+ expect(wordEnd('hello brave world', 6.2)).toBe(11);+ });++ it('stops at whitespace and reaches the end of an unfinished last word', () => {+ expect(wordEnd('hello world', 5)).toBe(5);+ expect(wordEnd('hello wor', 7)).toBe(9);+ expect(wordEnd('hi', 5)).toBe(2);+ });+});diff --git a/src/lib/reveal.ts b/src/lib/reveal.tsnew file mode 100644index 0000000..15cafc2--- /dev/null+++ b/src/lib/reveal.ts@@ -0,0 +1,16 @@+const FLOOR_CHARS_PER_SECOND = 300;+const CATCH_UP_SECONDS = 0.9;++export function paced(text: string, progress: number, seconds: number): number {+ const backlog = text.length - progress;+ if (backlog <= 0) return text.length;+ const rate = Math.max(FLOOR_CHARS_PER_SECOND, backlog / CATCH_UP_SECONDS);+ return Math.min(text.length, progress + rate * seconds);+}++export function wordEnd(text: string, at: number): number {+ const from = Math.ceil(at);+ if (from >= text.length) return text.length;+ const gap = text.slice(from).search(/\s/);+ return gap < 0 ? text.length : from + gap;+}