A TypeScript Electron application built with Bun, featuring an intelligent browser automation SDK powered by Gemini 2.5 Flash AI.
- π€ AI Agent: Gemini-powered intelligent automation that understands natural language commands
- π Enhanced Browser: Playwright wrapper with advanced features and configurations
- π Smart DOM Analysis: Intelligent DOM tree parsing and element identification
- π₯οΈ Electron Desktop App: Modern cross-platform desktop interface for automation control
- π Real-time Progress: Live task execution monitoring and progress updates
- π― Natural Language: Execute complex automation tasks with simple English commands
framework/
βββ src/
β βββ agent/ # AI Agent with Gemini integration
β β βββ Agent.ts # Intelligent automation agent
β βββ browser/ # Enhanced Browser automation
β β βββ Browser.ts # Playwright wrapper with advanced features
β βββ dom/ # DOM analysis and parsing
β β βββ DomTree.ts # Smart DOM tree manipulation
β βββ main.ts # Main Electron process
β βββ preload.ts # Preload script for secure IPC
β βββ index.ts # SDK exports
βββ renderer/
β βββ index.html # Modern automation control UI
βββ recordings/ # Browser session recordings
βββ screenshots/ # Automated screenshots
βββ dist/ # Built application files
βββ package.json # Project configuration
- Bun >= 1.0 (recommended)
- Node.js >= 18 (fallback)
- TypeScript >= 5.0
- Gemini API Key from Google AI Studio
# Install dependencies
bun install
# Install Playwright browsers
bunx playwright install
# Create environment file
echo "GEMINI_API_KEY=your_gemini_api_key_here" > .envIMPORTANT: You need a real Gemini API key for the automation to work.
- Get your API key from Google AI Studio
- Create the .env file:
echo "GEMINI_API_KEY=your_actual_api_key_here" > .env
Before using the UI, test that everything is working:
# Run the comprehensive test
bun quick-test.jsThis will verify:
- β API key is set correctly
- β Browser automation works
- β AI agent can execute tasks
If the test passes, you're ready to use the full application!
# Development - Build and run the app
bun run dev
# Build the application
bun run build:all
# Run the built application
bun run start
# Development with hot reload
bun run electron:dev
# Type checking
bun run typecheck
# Clean build artifacts
bun run cleanbun run dist# macOS
bun run dist:mac
# Windows
bun run dist:win
# Linux
bun run dist:linuxBuilt applications will be available in the release/ directory.
- Gemini 2.5 Flash Integration: Natural language understanding and decision making
- Task Planning: Iterative step-by-step automation execution
- DOM Analysis: Intelligent page structure understanding
- Action Execution: Browser automation with real-time feedback
- Playwright Wrapper: Advanced browser automation capabilities
- Multi-browser Support: Chromium, Firefox, and WebKit
- Recording & Screenshots: Built-in session recording and error capture
- Performance Monitoring: Page metrics and network analysis
- Smart Parsing: Intelligent HTML structure analysis
- Element Detection: Automatic form, button, and link identification
- Content Extraction: Main content and navigation recognition
- Selector Generation: Robust CSS selector creation
- Main Process: Manages automation tasks and browser instances
- Renderer Process: Modern UI for task input and progress monitoring
- Preload Script: Secure IPC communication bridge
The application supports various configuration options through the Config interface:
interface Config {
windowOptions?: {
width?: number;
height?: number;
resizable?: boolean;
};
}-
Launch the Automation UI:
bun run dev
-
Use Natural Language Commands:
- Type in the input field:
"Go to google.com and search for cats" - Press Enter and watch the AI agent work!
- Type in the input field:
"Navigate to github.com and find trending repositories""Go to amazon.com and search for MacBook Pro""Visit linkedin.com and check my notifications""Open reddit.com and browse the front page""Go to wikipedia.org and search for artificial intelligence"
import { Agent, Browser, DomTree, createAgent } from './src/index.js';
// Quick start with default settings
const agent = createAgent({
agentConfig: {
debugMode: true,
maxSteps: 15,
stepDelay: 2000
},
browserConfig: {
headless: false,
timeout: 30000
}
});
// Execute automation task
const result = await agent.executeTask("Go to google.com and search for TypeScript tutorials");
console.log('Task completed:', result);
// Advanced usage with individual components
const browser = new Browser({
headless: false,
viewport: { width: 1920, height: 1080 },
recordVideo: true
});
await browser.launch();
await browser.goto('https://example.com');
const html = await browser.getContent();
const domTree = new DomTree(html, 'https://example.com');
const pageStructure = domTree.getPageStructure();
console.log('Interactive elements:', pageStructure.interactiveElements);
await browser.close();This application follows Electron security best practices:
- Context Isolation: Enabled for all renderer processes
- Node Integration: Disabled in renderer processes
- Preload Scripts: Used for secure IPC communication
- CSP Headers: Content Security Policy implemented
- Window Creation: Restricted and controlled
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details.