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(android): the Windows app gets the same Android tab, words from src/lib/phone/copy.ts, plus the USB driver page Windows phones often need; the Bridge also finds the adb winget unpacks

Shahriar6172a27bc740
diff --git a/docs/guide/windows-app.md b/docs/guide/windows-app.md
index 4209379..3b76506 100644
--- a/docs/guide/windows-app.md
+++ b/docs/guide/windows-app.md
@@ -57,13 +57,14 @@ its shell commands through.
## The window
-The tabs float at the top; Ctrl+1 to Ctrl+8 switch between them. Ctrl+Shift+D turns the Bridge
+The tabs float at the top; Ctrl+1 to Ctrl+9 switch between them. Ctrl+Shift+D turns the Bridge
on or off, Ctrl+Shift+R restarts it, and Ctrl+Shift+P gets a new pairing code.
| Tab | What you do there |
| --- | --- |
| **Overview** | Turn Browsentic Bridge on and off with the power button, restart it, see its address and version. One row per browser: where its extension comes from, whether it is connected, and a button that adds it from the store. The unpacked folder sits behind **Load it unpacked instead** |
| **Browsers** | Get a [pairing code](pair.md) with a live countdown, see every paired browser and the store its extension came from, unpair one or all |
+| **Android** | Whether a phone is ready to drive from the side panel: adb, the phone, USB debugging, Chrome, Chrome open and the screen, one row each, the same checks `browsentic android` prints. A row that fails says what to do, with **Open Chrome on the phone**, **Get Chrome**, the `winget` command that installs adb, or the page of phone makers' USB drivers, which many phones need before Windows shows them to adb. **Set up your phone** has the steps. The Bridge looks for phones only while this tab is open |
| **Agents** | See which agent CLIs are ready, [switch](agents.md) between them, pick a model, install a missing one, or let Browsentic fix what one still needs |
| **Skills** | Every [skill](features/skills.md) the router can see and which folder it came from |
| **Activity** | Your standing [approvals](approvals.md), forgettable per site, and the downloads agents captured |
diff --git a/src/daemon/android/adb.test.ts b/src/daemon/android/adb.test.ts
index e13f322..cd7df09 100644
--- a/src/daemon/android/adb.test.ts
+++ b/src/daemon/android/adb.test.ts
@@ -28,14 +28,19 @@ describe('where adb is looked for', () => {
]);
});
- test('Windows: adb.exe on PATH however the variable is spelled, then the SDK under LOCALAPPDATA', () => {
+ test('Windows: adb.exe on PATH however the variable is spelled, the SDK under LOCALAPPDATA, then where winget unpacks it', () => {
expect(
adbCandidates({
platform: 'win32',
home: 'C:\\Users\\me',
env: { Path: '"C:\\Tools";C:\\Windows', LOCALAPPDATA: 'C:\\Users\\me\\AppData\\Local' },
}),
- ).toEqual(['C:\\Tools\\adb.exe', 'C:\\Windows\\adb.exe', 'C:\\Users\\me\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe']);
+ ).toEqual([
+ 'C:\\Tools\\adb.exe',
+ 'C:\\Windows\\adb.exe',
+ 'C:\\Users\\me\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe',
+ 'C:\\Users\\me\\AppData\\Local\\Microsoft\\WinGet\\Packages\\Google.PlatformTools_Microsoft.Winget.Source_8wekyb3d8bbwe\\platform-tools\\adb.exe',
+ ]);
});
test('Linux: the SDK Android Studio makes in the home directory', () => {
diff --git a/src/daemon/android/adb.ts b/src/daemon/android/adb.ts
index 2c75337..0a3bdff 100644
--- a/src/daemon/android/adb.ts
+++ b/src/daemon/android/adb.ts
@@ -5,6 +5,8 @@ import { posix, win32 } from 'node:path';
import { spawnCli, stopTree, variable } from '../agent/runners/command';
const VERSION_TIMEOUT_MS = 5_000;
+/** `winget install Google.PlatformTools` unpacks here and puts the folder on PATH, which a Bridge started earlier does not see. */
+const WINGET_PLATFORM_TOOLS = 'Google.PlatformTools_Microsoft.Winget.Source_8wekyb3d8bbwe';
const START_SERVER_TIMEOUT_MS = 15_000;
export interface AdbFound {
@@ -26,11 +28,12 @@ export function adbCandidates({ configured, env = process.env, platform = proces
const windows = platform === 'win32';
const path = windows ? win32 : posix;
const exe = windows ? 'adb.exe' : 'adb';
+ const localAppData = variable(env, 'LOCALAPPDATA') ?? path.join(home, 'AppData', 'Local');
const sdkRoots = [
variable(env, 'ANDROID_HOME'),
variable(env, 'ANDROID_SDK_ROOT'),
platform === 'darwin' ? path.join(home, 'Library', 'Android', 'sdk') : undefined,
- windows ? path.join(variable(env, 'LOCALAPPDATA') ?? path.join(home, 'AppData', 'Local'), 'Android', 'Sdk') : undefined,
+ windows ? path.join(localAppData, 'Android', 'Sdk') : undefined,
platform === 'linux' ? path.join(home, 'Android', 'Sdk') : undefined,
];
const candidates = [
@@ -41,7 +44,7 @@ export function adbCandidates({ configured, env = process.env, platform = proces
.filter(Boolean)
.map((dir) => path.join(dir, exe)),
...sdkRoots.filter((root): root is string => !!root).map((root) => path.join(root, 'platform-tools', exe)),
- ...(windows ? [] : ['/opt/homebrew/bin/adb', '/usr/local/bin/adb']),
+ ...(windows ? [path.join(localAppData, 'Microsoft', 'WinGet', 'Packages', WINGET_PLATFORM_TOOLS, 'platform-tools', exe)] : ['/opt/homebrew/bin/adb', '/usr/local/bin/adb']),
];
return [...new Set(candidates.filter((candidate): candidate is string => !!candidate))];
}
diff --git a/src/daemon/android/readiness.ts b/src/daemon/android/readiness.ts
index 80dba0a..596c539 100644
--- a/src/daemon/android/readiness.ts
+++ b/src/daemon/android/readiness.ts
@@ -1,10 +1,9 @@
+import { PLATFORM_TOOLS_URL } from '@/lib/phone/copy';
import type { AndroidDevice, AndroidProblem, AndroidState } from '@/lib/phone/types';
import type { AdbFound } from './adb';
import type { TrackedDevice } from './devices';
import type { PhoneFacts } from './phone-facts';
-export const PLATFORM_TOOLS_URL = 'https://developer.android.com/tools/releases/platform-tools';
-
const INSTALL_ADB: Partial<Record<NodeJS.Platform, string>> = {
darwin: 'brew install --cask android-platform-tools',
win32: 'winget install Google.PlatformTools',
diff --git a/src/lib/phone/copy.ts b/src/lib/phone/copy.ts
new file mode 100644
index 0000000..80badd1
--- /dev/null
+++ b/src/lib/phone/copy.ts
@@ -0,0 +1,19 @@
+/** The Android tab's words in both apps. The Windows app imports these; the Mac app's `AndroidCopy` repeats them and must match. */
+export const PHONE_TAB_COPY = {
+ title: 'Drive Chrome on your Android phone',
+ subtitle: "Browsentic Bridge reaches Chrome on your phone through adb, Android's debugging tool. Nothing is installed on the phone.",
+ phoneCard: 'Your phone',
+ guideCard: 'Set up your phone',
+ guideSubtitle: 'Once per phone. After that, plug it in and open Chrome.',
+ checkAgain: 'Check again',
+ openChrome: 'Open Chrome on the phone',
+ getChrome: 'Get Chrome',
+ copyInstall: 'Copy install command',
+ downloadTools: 'Download platform-tools',
+ usbDrivers: "Find your phone's USB driver",
+ offline: 'Phone checks',
+ androidEleven: 'Android 11 or later',
+} as const;
+
+export const PLATFORM_TOOLS_URL = 'https://developer.android.com/tools/releases/platform-tools';
+export const OEM_USB_DRIVERS_URL = 'https://developer.android.com/studio/run/oem-usb';
diff --git a/src/mac/Sources/Browsentic/Views/AndroidView.swift b/src/mac/Sources/Browsentic/Views/AndroidView.swift
index 808466d..f780dd9 100644
--- a/src/mac/Sources/Browsentic/Views/AndroidView.swift
+++ b/src/mac/Sources/Browsentic/Views/AndroidView.swift
@@ -1,7 +1,7 @@
import AppKit
import SwiftUI
-/// The same words as the Windows app's Android tab (src/windows/ui/views/android.tsx): change both together.
+/// The words of src/lib/phone/copy.ts, which the Windows app imports: change both together.
enum AndroidCopy {
static let title = "Drive Chrome on your Android phone"
static let subtitle = "Browsentic Bridge reaches Chrome on your phone through adb, Android's debugging tool. Nothing is installed on the phone."
diff --git a/src/windows/ui/mock-backend.ts b/src/windows/ui/mock-backend.ts
index 9fd8412..fcb73ad 100644
--- a/src/windows/ui/mock-backend.ts
+++ b/src/windows/ui/mock-backend.ts
@@ -1,4 +1,8 @@
import type { BrowserRow } from '@/daemon/browsers';
+import { judge } from '@/daemon/android/readiness';
+import { androidJson, type AndroidJson } from '@/daemon/android/report';
+import type { PhoneFacts } from '@/daemon/android/phone-facts';
+import type { TrackedDevice } from '@/daemon/android/devices';
import { AGENT_LIST, AGENTS, type AgentKind } from '@/lib/agents/catalog';
import type { GuardrailSettings } from '@/lib/settings/guardrails';
import type { PreferenceChange } from '@/lib/settings/preferences';
@@ -24,6 +28,8 @@ export function mockBackend({ instant = false, fresh = location.hash === '#fresh
const models: Partial<Record<AgentKind, string>> = {};
const listeners = new Set<(event: string) => void>();
let preferences: Preferences = { theme: null, guardrails: guardrails(`${home}\\.browsentic\\config.json`), profile: EMPTY_PROFILE };
+ const phones = phoneStates(home);
+ let phone = -1;
const ok = (stdout: string): CliOutput => ({ ok: true, code: 0, stdout, stderr: '' });
const later = <T>(value: T, ms = 350) => new Promise<T>((resolve) => setTimeout(() => resolve(value), instant ? 0 : ms));
@@ -61,6 +67,10 @@ export function mockBackend({ instant = false, fresh = location.hash === '#fresh
if (typeof set === 'string') active = set as AgentKind;
return { state: agents() };
},
+ android: ({ launch }) => {
+ if (launch) phone = phones.length - 2;
+ return { result: { ok: true, data: phones[Math.max(phone, 0)] } };
+ },
};
const commands: Record<string, (args: string[]) => CliOutput> = {
@@ -81,6 +91,7 @@ export function mockBackend({ instant = false, fresh = location.hash === '#fresh
if (args[1] === 'model') models[args[2] as AgentKind] = args[3];
return ok(JSON.stringify(agents()));
},
+ android: () => ok(JSON.stringify(phones[(phone = (phone + 1) % phones.length)])),
skills: () => ok(JSON.stringify(skills(home))),
approvals: () => ok(JSON.stringify({ grants: [{ action: 'page.submitForm', host: 'github.com', at: ago(2 * 86400) }, { action: 'page.captureDownload', host: 'github.com', at: ago(86400) }, { action: 'page.submitForm', host: 'news.ycombinator.com', at: ago(3600) }] })),
downloads: () => ok(JSON.stringify({ dir: `${home}\\browsentic\\downloads`, downloads: [{ id: 'd1', name: 'invoice-2026-09.pdf', mime: 'application/pdf', size: 48213, url: 'https://example.com/invoice.pdf', host: 'example.com', notes: 'PDF, 47 KB, from example.com', savedTo: `${home}\\browsentic\\downloads\\invoice-2026-09.pdf`, capturedAt: ago(5400) }] })),
@@ -255,3 +266,27 @@ function log() {
`${stamp(30)} agent codex: version probe failed: exited 1`,
].join('\n');
}
+
+/** What `browsentic android --json` says on Windows, one state per "Check again": no adb, no phone, waiting for Allow, Chrome closed, ready. */
+function phoneStates(home: string): AndroidJson[] {
+ const adb = { path: `${home}\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe`, version: '37.0.1-14963125' };
+ const pixel: TrackedDevice = { serial: '38041FDJH00ABC', state: 'ready', adbState: 'device', transport: 'usb', model: 'Pixel 8', transportId: '3' };
+ const facts: PhoneFacts = {
+ booted: true,
+ model: 'Pixel 8',
+ manufacturer: 'Google',
+ android: '16',
+ sdk: 36,
+ screen: { width: 1080, height: 2400, density: 420, awake: true },
+ chrome: { installed: true, version: '150.0.7871.186', running: true, debuggable: true },
+ };
+ const seen = (devices: Parameters<typeof judge>[0]['devices'], found: typeof adb | null = adb) =>
+ androidJson(judge({ enabled: true, platform: 'win32', adb: found, devices }));
+ return [
+ seen([], null),
+ seen([]),
+ seen([{ device: { ...pixel, state: 'unauthorized', adbState: 'unauthorized', model: undefined }, facts: null }]),
+ seen([{ device: pixel, facts: { ...facts, chrome: { ...facts.chrome, running: false, debuggable: false } } }]),
+ seen([{ device: pixel, facts }]),
+ ];
+}
diff --git a/src/windows/ui/model.test.ts b/src/windows/ui/model.test.ts
index f5a0ff0..79945c0 100644
--- a/src/windows/ui/model.test.ts
+++ b/src/windows/ui/model.test.ts
@@ -2,7 +2,7 @@ import { afterEach, describe, expect, it } from 'vitest';
import type { Backend } from './backend';
import { mockBackend } from './mock-backend';
-import { Model, outcome, parseJson, short, type State } from './model';
+import { Model, TABS, outcome, parseJson, short, type State } from './model';
import { splitLine } from './views/logs';
const instantly = () => Promise.resolve();
@@ -180,3 +180,72 @@ describe('the running app', () => {
expect([again.snapshot().appearance, again.snapshot().startDaemonOnLaunch]).toEqual(['dark', false]);
});
});
+
+describe('the Android tab', () => {
+ /** The mock backend, with a hand on its event stream and a record of what reached the control socket. */
+ function phoneBackend() {
+ const backend = mockBackend({ instant: true });
+ const frames: Record<string, unknown>[] = [];
+ let announce: (event: string) => void = () => undefined;
+ return {
+ frames,
+ announce: (event: string) => announce(event),
+ backend: {
+ ...backend,
+ controlRequest: (frame: Record<string, unknown>, timeoutMs?: number) => (frames.push(frame), backend.controlRequest(frame, timeoutMs)),
+ onControlEvent: (listener: (event: string) => void) => ((announce = listener), backend.onControlEvent(listener)),
+ } satisfies Backend,
+ };
+ }
+
+ it('sits after Browsers, so Ctrl+3 opens it and About is Ctrl+9', () => {
+ expect(TABS.indexOf('android')).toBe(2);
+ expect(TABS.at(-1)).toBe('about');
+ expect(TABS.length).toBeLessThanOrEqual(9);
+ });
+
+ it('watches for phones only while it shows, and reads the checklist the CLI prints', async () => {
+ const { backend, frames } = phoneBackend();
+ const model = start(backend);
+ await model.runPreflight();
+ await until(model, (state) => state.daemon === 'on');
+ await model.watchAndroid(true);
+ const android = model.snapshot().android;
+ expect(android?.problem?.code).toBe('ADB_MISSING');
+ expect(android?.report.sections[0].checks[0]).toMatchObject({ label: 'adb', mark: 'failed', fix: 'winget install Google.PlatformTools' });
+ await model.watchAndroid(false);
+ expect(frames.filter((frame) => frame.op === 'android')).toEqual([
+ { op: 'android', watch: true },
+ { op: 'android', watch: false },
+ ]);
+ });
+
+ it('reads the phone again when the Bridge says it changed, and the Windows copy names the USB driver', async () => {
+ const { backend, announce } = phoneBackend();
+ const model = start(backend);
+ await model.runPreflight();
+ await until(model, (state) => state.daemon === 'on');
+ await model.watchAndroid(true);
+ announce('android-changed');
+ await until(model, (state) => state.android?.problem?.code === 'NO_DEVICE');
+ expect(model.snapshot().android?.problem?.message).toMatch(/USB driver/);
+ });
+
+ it('opens Chrome on the phone through the Bridge, and remembers that a phone has been ready', async () => {
+ const { backend, frames } = phoneBackend();
+ const model = start(backend);
+ await model.runPreflight();
+ await until(model, (state) => state.daemon === 'on');
+ await model.watchAndroid(true);
+ for (const code of ['NO_DEVICE', 'DEVICE_UNAUTHORIZED', 'CHROME_NOT_RUNNING']) {
+ await model.loadAndroid();
+ expect(model.snapshot().android?.problem?.code).toBe(code);
+ }
+ expect(model.snapshot().androidReadyOnce).toBe(false);
+ await model.openChrome('38041FDJH00ABC');
+ expect(frames.at(-1)).toEqual({ op: 'android', launch: '38041FDJH00ABC' });
+ expect(model.snapshot().android?.ready).toBe(true);
+ expect(model.snapshot().androidReadyOnce).toBe(true);
+ expect(start(mockBackend({ instant: true })).snapshot().androidReadyOnce).toBe(true);
+ });
+});
diff --git a/src/windows/ui/model.ts b/src/windows/ui/model.ts
index 47ccac8..12bd2c0 100644
--- a/src/windows/ui/model.ts
+++ b/src/windows/ui/model.ts
@@ -5,6 +5,7 @@ import type { GuardrailValue } from '@/lib/settings/guardrails';
import type { PreferenceChange } from '@/lib/settings/preferences';
import type { ThemeId } from '@/lib/settings/theme';
import type { BrowserRow } from '@/daemon/browsers';
+import type { AndroidJson } from '@/daemon/android/report';
import type {
AgentListing,
AppInfo,
@@ -27,8 +28,8 @@ import type {
export type Phase = 'preflight' | 'main';
export type DaemonPhase = 'off' | 'starting' | 'on' | 'stopping';
-export type Tab = 'overview' | 'browsers' | 'agents' | 'skills' | 'activity' | 'logs' | 'settings' | 'about';
-export const TABS: Tab[] = ['overview', 'browsers', 'agents', 'skills', 'activity', 'logs', 'settings', 'about'];
+export type Tab = 'overview' | 'browsers' | 'android' | 'agents' | 'skills' | 'activity' | 'logs' | 'settings' | 'about';
+export const TABS: Tab[] = ['overview', 'browsers', 'android', 'agents', 'skills', 'activity', 'logs', 'settings', 'about'];
export type CheckId = 'system' | 'node' | 'command' | 'browser' | 'agent';
export const CHECKS: CheckId[] = ['system', 'node', 'command', 'browser', 'agent'];
@@ -73,6 +74,10 @@ export interface State {
sessions: SessionSummary[];
pairing?: PairingCode;
agents?: AgentListing;
+ /** `browsentic android --json` while the Android tab is open; the Bridge looks for phones only then. */
+ android?: AndroidJson;
+ /** A phone has been ready on this computer before, so the setup steps start folded. */
+ androidReadyOnce: boolean;
preferences?: Preferences;
/** The running daemon never answered for its settings: it predates this app and needs a restart. */
preferencesUnsupported: boolean;
@@ -98,6 +103,7 @@ const MINIMUM_NODE = 20;
const FINISH_UPDATE = 'browsentic/finishUpdateOnLaunch';
const APPEARANCE = 'browsentic/appearance';
const START_ON_LAUNCH = 'browsentic/startDaemonOnLaunch';
+const ANDROID_READY_ONCE = 'browsentic/androidReadyOnce';
const CLAUDE_CODE = '@anthropic-ai/claude-code';
const pause = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
@@ -163,6 +169,7 @@ export const initialState = (): State => ({
busy: [],
appearance: (stored(APPEARANCE) as Appearance | null) ?? 'system',
startDaemonOnLaunch: stored(START_ON_LAUNCH) !== 'false',
+ androidReadyOnce: stored(ANDROID_READY_ONCE) === '1',
});
export class Model {
@@ -171,6 +178,7 @@ export class Model {
private poller?: ReturnType<typeof setInterval>;
private updateWatcher?: ReturnType<typeof setInterval>;
private stopEvents?: () => void;
+ private watchingAndroid = false;
private noticeTimer?: ReturnType<typeof setTimeout>;
private noticeCount = 0;
private started = false;
@@ -391,6 +399,7 @@ export class Model {
private startPolling() {
this.stopEvents?.();
this.stopEvents = this.backend.onControlEvent((event) => {
+ if (event === 'android-changed') return void this.loadAndroid();
if (event !== 'settings-changed') return;
void this.loadPreferences();
void this.loadAgents();
@@ -415,7 +424,10 @@ export class Model {
const lock = await this.backend.readLock().catch(() => null);
if (!lock) return this.markOff();
try {
- if (await this.backend.controlConnect()) void this.loadPreferences(true);
+ if (await this.backend.controlConnect()) {
+ void this.loadPreferences(true);
+ if (this.watchingAndroid) void this.watchAndroid(true);
+ }
const status = (await this.control({ op: 'status' })).status as BridgeStatus;
const sessions = (await this.control({ op: 'sessions' })).sessions as SessionSummary[];
const stamp = await this.backend.extensionStamp();
@@ -497,6 +509,34 @@ export class Model {
}
}
+ /** The tab subscribes while it shows and lets go when it leaves, so phones are looked for only while someone is looking at them. */
+ async watchAndroid(on: boolean) {
+ this.watchingAndroid = on;
+ if (this.state.daemon !== 'on') return;
+ await this.control({ op: 'android', watch: on }).catch(() => undefined);
+ if (on) await this.loadAndroid();
+ }
+
+ loadAndroid() {
+ return this.perform('android', async () => this.showAndroid(await this.readAndroid()), true);
+ }
+
+ openChrome(serial: string) {
+ return this.perform(`android:${serial}`, async () => {
+ outcome((await this.control({ op: 'android', launch: serial }, 40_000)).result);
+ this.showAndroid(await this.readAndroid());
+ });
+ }
+
+ private async readAndroid() {
+ return parseJson<AndroidJson>(await this.backend.cli(['android', '--json'], 30), 'android');
+ }
+
+ private showAndroid(android: AndroidJson) {
+ if (android.ready && !this.state.androidReadyOnce) store(ANDROID_READY_ONCE, '1');
+ this.set((state) => ({ android, androidReadyOnce: state.androidReadyOnce || android.ready }));
+ }
+
async loadPreferences(watch = false) {
try {
const reply = await this.control({ op: 'preferences', watch });
diff --git a/src/windows/ui/views/android.tsx b/src/windows/ui/views/android.tsx
new file mode 100644
index 0000000..9f15d1f
--- /dev/null
+++ b/src/windows/ui/views/android.tsx
@@ -0,0 +1,170 @@
+import { useEffect, useState } from 'react';
+import { AppWindow, Cable, ChevronDown, ChevronRight, CircleAlert, CircleArrowDown, CircleCheck, Globe, OctagonX, Play, Power, RotateCw, ShieldCheck, Smartphone, Sun, Terminal, type LucideIcon } from 'lucide-react';
+
+import { OEM_USB_DRIVERS_URL, PHONE_TAB_COPY as COPY, PLATFORM_TOOLS_URL } from '@/lib/phone/copy';
+import type { CheckMark, PhoneCheck } from '@/lib/phone/checks';
+import { cn } from '@/lib/utils';
+import { Card, CopyButton, OfflineHint, Pill, PrimaryButton, QuietButton, SectionTitle, Spinner, Step } from '../components';
+import type { Model, State } from '../model';
+
+const ICONS: Record<string, LucideIcon> = {
+ adb: Terminal,
+ Phone: Smartphone,
+ 'USB debugging': Cable,
+ Chrome: Globe,
+ 'Chrome open': AppWindow,
+ Screen: Sun,
+ Android: Power,
+};
+
+const MARKS: Record<CheckMark, { icon: LucideIcon; className: string }> = {
+ passed: { icon: CircleCheck, className: 'text-lime' },
+ advisory: { icon: CircleAlert, className: 'text-amber' },
+ failed: { icon: OctagonX, className: 'text-destructive' },
+};
+
+export function AndroidView({ model, state }: { model: Model; state: State }) {
+ const on = state.daemon === 'on';
+ const [guideOpen, setGuideOpen] = useState<boolean>();
+ useEffect(() => {
+ if (!on) return;
+ void model.watchAndroid(true);
+ return () => void model.watchAndroid(false);
+ }, [model, on]);
+
+ if (!on) return <OfflineHint what={COPY.offline} model={model} daemonOff={state.daemon === 'off'} />;
+ const { android } = state;
+ if (!android) {
+ return (
+ <div className="flex justify-center p-15">
+ <Spinner />
+ </div>
+ );
+ }
+ const checking = state.busy.includes('android');
+ const firstSerial = android.devices[0]?.serial;
+ const open = guideOpen ?? (android.report.guided || (!state.androidReadyOnce && !android.ready));
+
+ return (
+ <div className="space-y-4.5">
+ <Card>
+ <div className="flex items-start gap-3.5">
+ <div className="min-w-0 flex-1">
+ <SectionTitle title={COPY.title} subtitle={COPY.subtitle} />
+ </div>
+ {checking && <Spinner />}
+ <QuietButton icon={RotateCw} disabled={checking} onClick={() => void model.loadAndroid()}>
+ {COPY.checkAgain}
+ </QuietButton>
+ </div>
+ </Card>
+
+ <Card>
+ <div className="space-y-2.5">
+ <SectionTitle title={COPY.phoneCard} />
+ {android.report.sections.map((section, index) => (
+ <div key={section.serial ?? index} className="space-y-2.5">
+ {section.serial && <p className="pt-1.5 font-mono text-[11.5px] font-semibold text-ink-dim">{section.serial}</p>}
+ {section.checks.map((check) => (
+ <CheckRow key={check.label} check={check} serial={section.serial ?? firstSerial} model={model} state={state} />
+ ))}
+ </div>
+ ))}
+ {android.report.summary && (
+ <p className="flex items-center gap-2 pt-1 text-[12.5px] font-medium text-lime">
+ <ShieldCheck className="size-4" />
+ {android.report.summary}
+ </p>
+ )}
+ </div>
+ </Card>
+
+ {android.guide.length > 0 && (
+ <Card>
+ <div className="space-y-3.5">
+ <button type="button" onClick={() => setGuideOpen(!open)} className="flex w-full items-center gap-3 text-left">
+ <div className="min-w-0 flex-1">
+ <SectionTitle title={COPY.guideCard} subtitle={COPY.guideSubtitle} />
+ </div>
+ {open ? <ChevronDown className="size-4 text-ink-dim" /> : <ChevronRight className="size-4 text-ink-dim" />}
+ </button>
+ {open && (
+ <div className="space-y-3">
+ {android.guide.map((step, index) => (
+ <Step key={step.title} number={index + 1}>
+ <span className="flex items-center gap-2">
+ <span className="text-[13px] font-semibold text-ink">{step.title}</span>
+ {step.platform === 'android11+' && <Pill text={COPY.androidEleven} />}
+ </span>
+ {step.detail}
+ </Step>
+ ))}
+ </div>
+ )}
+ </div>
+ </Card>
+ )}
+ </div>
+ );
+}
+
+function CheckRow({ check, serial, model, state }: { check: PhoneCheck; serial?: string; model: Model; state: State }) {
+ const Icon = ICONS[check.label] ?? Smartphone;
+ const { icon: Mark, className } = MARKS[check.mark];
+ const working = !!serial && state.busy.includes(`android:${serial}`);
+ const failing = check.mark === 'failed';
+ return (
+ <div className={cn('flex items-start gap-3 rounded-[14px] border bg-surface/72 px-3.5 py-2', failing ? 'border-amber/45' : 'border-line')}>
+ <span className="flex size-7.5 shrink-0 items-center justify-center rounded-[9px] bg-ground-2">
+ <Icon className="size-3.5 text-brand" />
+ </span>
+ <div className="min-w-0 flex-1 space-y-1.5">
+ <p className="text-[13px] font-semibold text-ink">{check.label}</p>
+ <p className={cn('text-[11.5px] select-text', failing ? 'text-ink' : 'text-ink-dim')}>{check.value}</p>
+ {check.fix && <p className="rounded-lg bg-ground-2 px-2.5 py-1.5 font-mono text-[11.5px] break-all text-ink select-text">{check.fix}</p>}
+ <Actions check={check} serial={serial} working={working} model={model} />
+ </div>
+ {working && <Spinner />}
+ <span className="flex w-5.5 justify-center">
+ <Mark className={cn('size-4.5', className)} />
+ </span>
+ </div>
+ );
+}
+
+function Actions({ check, serial, working, model }: { check: PhoneCheck; serial?: string; working: boolean; model: Model }) {
+ if (serial && check.action) {
+ const launch = check.action === 'launchChrome';
+ return (
+ <div className="flex gap-2">
+ <PrimaryButton icon={launch ? Play : CircleArrowDown} disabled={working} onClick={() => void model.openChrome(serial)}>
+ {launch ? COPY.openChrome : COPY.getChrome}
+ </PrimaryButton>
+ </div>
+ );
+ }
+ if (check.code === 'ADB_MISSING' && check.fix) {
+ return (
+ <div className="flex gap-2">
+ <CopyButton value={check.fix} label={COPY.copyInstall} />
+ <QuietButton icon={CircleArrowDown} onClick={() => void model.openUrl(PLATFORM_TOOLS_URL)}>
+ {COPY.downloadTools}
+ </QuietButton>
+ </div>
+ );
+ }
+ if (check.code === 'NO_DEVICE') {
+ return (
+ <div className="flex gap-2">
+ <QuietButton icon={Cable} onClick={() => void model.openUrl(OEM_USB_DRIVERS_URL)}>
+ {COPY.usbDrivers}
+ </QuietButton>
+ </div>
+ );
+ }
+ return check.fix ? (
+ <div className="flex gap-2">
+ <CopyButton value={check.fix} />
+ </div>
+ ) : null;
+}
diff --git a/src/windows/ui/views/main.tsx b/src/windows/ui/views/main.tsx
index fb67c45..6c0eb49 100644
--- a/src/windows/ui/views/main.tsx
+++ b/src/windows/ui/views/main.tsx
@@ -1,10 +1,11 @@
-import { AlignLeft, BookOpen, Globe, Info, Power, Settings, ShieldCheck, Sparkles, type LucideIcon } from 'lucide-react';
+import { AlignLeft, BookOpen, Globe, Info, Power, Settings, ShieldCheck, Smartphone, Sparkles, type LucideIcon } from 'lucide-react';
import { cn } from '@/lib/utils';
import { TABS, type Model, type State, type Tab } from '../model';
import { AboutView } from './about';
import { ActivityView } from './activity';
import { AgentsView } from './agents';
+import { AndroidView } from './android';
import { BrowsersView } from './browsers';
import { LogsView } from './logs';
import { OverviewView } from './overview';
@@ -14,6 +15,7 @@ import { SkillsView } from './skills';
const TAB: Record<Tab, { label: string; icon: LucideIcon; view: typeof OverviewView }> = {
overview: { label: 'Overview', icon: Power, view: OverviewView },
browsers: { label: 'Browsers', icon: Globe, view: BrowsersView },
+ android: { label: 'Android', icon: Smartphone, view: AndroidView },
agents: { label: 'Agents', icon: Sparkles, view: AgentsView },
skills: { label: 'Skills', icon: BookOpen, view: SkillsView },
activity: { label: 'Activity', icon: ShieldCheck, view: ActivityView },
@@ -36,7 +38,7 @@ export function MainView({ model, state }: { model: Model; state: State }) {
);
}
-/** The view switcher floats at the top centre, Ctrl+1…Ctrl+8. */
+/** The view switcher floats at the top centre, Ctrl+1…Ctrl+9. */
function TabCapsule({ model, state }: { model: Model; state: State }) {
return (
<nav className="absolute top-1.5 left-1/2 flex -translate-x-1/2 gap-0.5 rounded-full border border-line bg-surface/80 p-1 shadow-[0_6px_18px_rgb(0_0_0/0.25)] backdrop-blur-md">