How gowtham2036/browser-ai works
Purpose and Runtime
Browser-AI is a cross-platform desktop browser experience with AI-assisted browsing. It combines a React/Vite renderer with a Rust/Tauri desktop host. The application entry points are src/main.tsx for the renderer and src-tauri/src/main.rs / src-tauri/src/lib.rs for the native process.
Desktop Host and Security Boundary
Tauri packages and launches the frontend as a desktop application, owns native-window integration, and applies capability/permission policy. Core host configuration and access boundaries are in:
• src-tauri/tauri.conf.json
• src-tauri/capabilities/default.json
• src-tauri/permissions/app.toml
Rust dependencies and build behavior are defined by src-tauri/Cargo.toml and src-tauri/build.rs.
Application Composition
src/App.tsx is the renderer-level composition root, with global styling in src/App.css and src/index.css. It assembles the browser surface, navigation controls, tab UI, reader mode, settings, and side-panel workflows:
• src/components/BrowserShell.tsx
• src/components/TabBar.tsx
• src/components/Omnibox.tsx
Browser State and UI Control Flow
The browser’s shared client-side state is centered in src/store/browserStore.ts. Browser UI components read and mutate this store to drive navigation, tab selection, panels, reader-mode state, and related application state. Common domain contracts are concentrated in src/types/index.ts, separating UI and agent services from concrete state representations.
AI Agent Pipeline
The AI subsystem is organized as an explicit observe-plan/loop-execute flow. src/services/agent.ts is the service-facing agent entry point; the implementation is divided into:
• src/services/agent/agentLoop.ts — coordinates iterative agent work.
• src/services/agent/observer.ts — derives browser/page context for the agent.
• src/services/agent/actions.ts and src/services/agent/executor.ts — define and perform browser actions.
This is the main control boundary between model-directed intent and mutations to browser/UI state.
AI and Persistence Services
src/services/ai.ts encapsulates AI/model-facing integration, keeping model interaction outside React components and the agent executor. src/services/db.ts provides persistence access behind a frontend service boundary. Shared service-level behavior lives in src/services/utils.ts. External AI and storage providers are not identified in the supplied repository metadata; their concrete configuration should be verified in these service files.
Agent Visibility and User Interaction
The side panel exposes the agent as a user-facing workflow rather than an opaque background process. Its chat, controls, status/timeline, debugging, and intelligence views are split across:
• src/components/sidepanel/SidePanelChat.tsx
• src/components/sidepanel/AgentControls.tsx
• src/components/sidepanel/AgentTimeline.tsx
src/components/sidepanel/AgentDebug.tsx and src/components/sidepanel/IntelPanel.tsx provide observability/context views, while src/components/SidePanel.tsx integrates them with the main browser shell.
Main entry points: browserStore.ts Browser Store · App.tsx App Composition · SidePanel.tsx Side Panel · main.rs Tauri Runtime
Components 22
React Renderer
Browser UI and client-side workflows.
- Renderer Entry
src/main.tsx - App Composition · Assembles the browser experience and primary workflows.
src/App.tsx - Browser Shell
src/components/BrowserShell.tsx - Tabs & Omnibox
src/components/TabBar.tsx - Omnibox
src/components/Omnibox.tsx - Side Panel · Integrates chat, controls, status, debug, and intelligence views.
src/components/SidePanel.tsx - Agent Chat
src/components/sidepanel/SidePanelChat.tsx - Agent Controls
src/components/sidepanel/AgentControls.tsx - Agent Timeline
src/components/sidepanel/AgentTimeline.tsx - Browser Store · Owns navigation, tabs, panels, reader mode, and related browser state.
src/store/browserStore.ts - Domain Contracts
src/types/index.ts
AI Agent Pipeline
Observe, plan, and execute browser actions.
- Agent Service · Service-facing entry point for AI workflows.
src/services/agent.ts - Agent Loop · Coordinates iterative agent work.
src/services/agent/agentLoop.ts - Page Observer · Derives browser and page context.
src/services/agent/observer.ts - AI Service · Keeps model interaction outside React and execution code.
src/services/ai.ts - Agent Actions
src/services/agent/actions.ts - Action Executor · Performs model-directed browser actions.
src/services/agent/executor.ts - Persistence Service · Frontend persistence access boundary.
src/services/db.ts
Tauri Host
Native desktop runtime and security boundary.
- Tauri Runtime · Packages and launches the renderer with native-window integration.
src-tauri/src/main.rs - Host Library
src-tauri/src/lib.rs - Capabilities & Permissions · Defines allowed desktop access.
src-tauri/capabilities/default.json - Tauri Configuration
src-tauri/tauri.conf.json
Connections 25
- Renderer Entry → App Composition: mounts
- App Composition → Browser Shell: composes
- App Composition → Tabs & Omnibox: composes
- App Composition → Omnibox: composes
- App Composition → Side Panel: composes
- Browser Shell → Browser Store: reads and mutates
- Tabs & Omnibox → Browser Store: reads and mutates
- Omnibox → Browser Store: navigates via
- Side Panel → Agent Chat: hosts
- Side Panel → Agent Controls: hosts
- Side Panel → Agent Timeline: hosts
- Side Panel → Agent Service: starts workflows
- Agent Service → Agent Loop: delegates to
- Agent Loop → Page Observer: observes
- Page Observer → Browser Store: reads context
- Agent Loop → AI Service: requests plan
- Agent Loop → Agent Actions: selects
- Agent Actions → Action Executor: defines
- Action Executor → Browser Store: mutates
- Agent Service → Persistence Service: persists data
- Browser Store → Domain Contracts: uses
- Tauri Runtime → Renderer Entry: launches
- Tauri Runtime → Host Library: initializes
- Tauri Runtime → Capabilities & Permissions: enforces
- Tauri Runtime → Tauri Configuration: uses