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
import { mkdtempSync, realpathSync, rmSync } from 'node:fs';
import { homedir, tmpdir } from 'node:os';
import { join } from 'node:path';
import { afterAll } from 'vitest';
// stateDir and the port list are read once at import and ~/browsentic only moves with HOME, so
// all three have to be in place before a test file imports anything from the daemon.
const realHome = homedir();
const home = realpathSync(mkdtempSync(join(tmpdir(), 'browsentic-test-')));
process.env.HOME = home;
// Windows reads the home directory from USERPROFILE, not HOME.
process.env.USERPROFILE = home;
process.env.BROWSENTIC_HOME = join(home, '.browsentic');
process.env.BROWSENTIC_PORTS = '0';
delete process.env.BROWSENTIC_AGENT_RUN;
if (homedir() === realHome) throw new Error(`the test sandbox did not move HOME away from ${realHome}`);
// An agent CLI installed on PATH can still be answering a readiness probe, writing its own
// ~/.grok or ~/.cursor into this home, while the directory is being removed.
afterAll(() => rmSync(home, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 }));