Skip to content

Commit a4d0a9b

Browse files
committed
feat(extensions): add web-browser extension for browser automation
1 parent a123b49 commit a4d0a9b

13 files changed

Lines changed: 1643 additions & 0 deletions

File tree

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# Web Browser Extension for AgentOS
2+
3+
Browser automation capabilities for AgentOS agents - navigate pages, scrape content, click elements, and capture screenshots.
4+
5+
## Features
6+
7+
- **Navigate**: Go to any URL and get page content
8+
- **Scrape**: Extract content using CSS selectors
9+
- **Click**: Interact with page elements
10+
- **Type**: Fill in forms and input fields
11+
- **Screenshot**: Capture visual snapshots
12+
- **Page Snapshot**: Get accessibility tree for intelligent interaction
13+
14+
## Installation
15+
16+
```bash
17+
npm install @framers/agentos-research-web-browser
18+
```
19+
20+
## Quick Start
21+
22+
```typescript
23+
import { createExtensionPack } from '@framers/agentos-research-web-browser';
24+
import { ExtensionManager } from '@framers/agentos';
25+
26+
const extensionManager = new ExtensionManager();
27+
28+
// Register the browser extension
29+
extensionManager.register(createExtensionPack({
30+
options: {
31+
headless: true,
32+
timeout: 30000,
33+
viewport: { width: 1920, height: 1080 }
34+
},
35+
logger: console
36+
}));
37+
```
38+
39+
## Tools
40+
41+
### browserNavigate
42+
43+
Navigate to a URL and retrieve page content.
44+
45+
```typescript
46+
const result = await gmi.executeTool('browserNavigate', {
47+
url: 'https://example.com',
48+
waitFor: 'networkidle2',
49+
returnText: true
50+
});
51+
// Returns: { url, status, title, text, loadTime }
52+
```
53+
54+
### browserScrape
55+
56+
Extract content using CSS selectors.
57+
58+
```typescript
59+
const result = await gmi.executeTool('browserScrape', {
60+
selector: 'article h2',
61+
limit: 10
62+
});
63+
// Returns: { selector, count, elements: [{ tag, text, html, attributes }] }
64+
```
65+
66+
### browserClick
67+
68+
Click on an element.
69+
70+
```typescript
71+
const result = await gmi.executeTool('browserClick', {
72+
selector: 'button.submit',
73+
waitForNavigation: true
74+
});
75+
// Returns: { success, element, newUrl }
76+
```
77+
78+
### browserType
79+
80+
Type text into an input field.
81+
82+
```typescript
83+
const result = await gmi.executeTool('browserType', {
84+
selector: 'input[name="search"]',
85+
text: 'AgentOS documentation',
86+
clear: true
87+
});
88+
// Returns: { success, element, text }
89+
```
90+
91+
### browserScreenshot
92+
93+
Capture a screenshot.
94+
95+
```typescript
96+
const result = await gmi.executeTool('browserScreenshot', {
97+
fullPage: true,
98+
format: 'png'
99+
});
100+
// Returns: { data (base64), format, width, height, size }
101+
```
102+
103+
### browserSnapshot
104+
105+
Get accessibility tree for intelligent interaction.
106+
107+
```typescript
108+
const result = await gmi.executeTool('browserSnapshot', {});
109+
// Returns: { url, title, elements, links, forms, interactable }
110+
```
111+
112+
## Configuration
113+
114+
| Option | Type | Default | Description |
115+
|--------|------|---------|-------------|
116+
| `headless` | boolean | `true` | Run browser in headless mode |
117+
| `timeout` | number | `30000` | Default timeout (ms) |
118+
| `userAgent` | string | - | Custom user agent |
119+
| `viewport.width` | number | `1920` | Viewport width |
120+
| `viewport.height` | number | `1080` | Viewport height |
121+
| `executablePath` | string | auto | Path to Chrome executable |
122+
123+
## Use Cases
124+
125+
### Web Research Agent
126+
127+
```typescript
128+
// Search and scrape information
129+
await gmi.executeTool('browserNavigate', { url: 'https://google.com' });
130+
await gmi.executeTool('browserType', { selector: 'input[name="q"]', text: 'AI agents 2024' });
131+
await gmi.executeTool('browserClick', { selector: 'input[type="submit"]', waitForNavigation: true });
132+
const results = await gmi.executeTool('browserScrape', { selector: '.g h3' });
133+
```
134+
135+
### Form Automation
136+
137+
```typescript
138+
await gmi.executeTool('browserNavigate', { url: 'https://signup.example.com' });
139+
await gmi.executeTool('browserType', { selector: '#email', text: 'user@example.com' });
140+
await gmi.executeTool('browserType', { selector: '#password', text: 'securepass123' });
141+
await gmi.executeTool('browserClick', { selector: 'button[type="submit"]' });
142+
```
143+
144+
### Visual Verification
145+
146+
```typescript
147+
await gmi.executeTool('browserNavigate', { url: 'https://myapp.com' });
148+
const screenshot = await gmi.executeTool('browserScreenshot', { fullPage: true });
149+
// Send screenshot to vision model for analysis
150+
```
151+
152+
## Dependencies
153+
154+
This extension requires Chrome/Chromium to be installed on the system. It uses `puppeteer-core` which does not bundle a browser.
155+
156+
## License
157+
158+
MIT © Frame.dev
159+
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"$schema": "https://agentos.sh/schemas/extension-manifest-v1.json",
3+
"id": "com.framers.research.web-browser",
4+
"name": "Web Browser Extension",
5+
"version": "1.0.0",
6+
"description": "Browser automation capabilities for AgentOS - navigate pages, scrape content, click links, and capture screenshots",
7+
"author": {
8+
"name": "Frame.dev",
9+
"email": "support@frame.dev",
10+
"url": "https://github.com/framersai"
11+
},
12+
"license": "MIT",
13+
"keywords": ["browser", "scraping", "automation", "puppeteer", "playwright", "web", "navigate"],
14+
"agentosVersion": "^2.0.0",
15+
"categories": ["productivity", "research", "automation"],
16+
"repository": {
17+
"type": "git",
18+
"url": "https://github.com/framersai/agentos-extensions"
19+
},
20+
"extensions": [
21+
{
22+
"kind": "tool",
23+
"id": "browserNavigate",
24+
"displayName": "Navigate to URL",
25+
"description": "Navigate browser to a URL and get page content",
26+
"entry": "./dist/tools/navigate.js"
27+
},
28+
{
29+
"kind": "tool",
30+
"id": "browserScrape",
31+
"displayName": "Scrape Content",
32+
"description": "Extract content from web page using CSS selectors",
33+
"entry": "./dist/tools/scrape.js"
34+
},
35+
{
36+
"kind": "tool",
37+
"id": "browserClick",
38+
"displayName": "Click Element",
39+
"description": "Click on an element in the current page",
40+
"entry": "./dist/tools/click.js"
41+
},
42+
{
43+
"kind": "tool",
44+
"id": "browserScreenshot",
45+
"displayName": "Take Screenshot",
46+
"description": "Capture screenshot of current page or element",
47+
"entry": "./dist/tools/screenshot.js"
48+
},
49+
{
50+
"kind": "tool",
51+
"id": "browserType",
52+
"displayName": "Type Text",
53+
"description": "Type text into an input field",
54+
"entry": "./dist/tools/type.js"
55+
}
56+
],
57+
"configuration": {
58+
"properties": {
59+
"browser.headless": {
60+
"type": "boolean",
61+
"default": true,
62+
"description": "Run browser in headless mode"
63+
},
64+
"browser.timeout": {
65+
"type": "number",
66+
"default": 30000,
67+
"minimum": 5000,
68+
"maximum": 120000,
69+
"description": "Default timeout for browser operations (ms)"
70+
},
71+
"browser.userAgent": {
72+
"type": "string",
73+
"description": "Custom user agent string"
74+
},
75+
"browser.viewport.width": {
76+
"type": "number",
77+
"default": 1920,
78+
"description": "Browser viewport width"
79+
},
80+
"browser.viewport.height": {
81+
"type": "number",
82+
"default": 1080,
83+
"description": "Browser viewport height"
84+
}
85+
}
86+
},
87+
"dependencies": {
88+
"puppeteer-core": "^22.0.0"
89+
}
90+
}
91+
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "@framers/agentos-research-web-browser",
3+
"version": "1.0.0",
4+
"description": "Browser automation extension for AgentOS",
5+
"main": "dist/index.js",
6+
"types": "dist/index.d.ts",
7+
"type": "module",
8+
"exports": {
9+
".": {
10+
"types": "./dist/index.d.ts",
11+
"import": "./dist/index.js"
12+
}
13+
},
14+
"files": [
15+
"dist",
16+
"manifest.json",
17+
"README.md"
18+
],
19+
"scripts": {
20+
"build": "tsc",
21+
"test": "vitest run",
22+
"test:watch": "vitest",
23+
"lint": "eslint src --ext .ts",
24+
"clean": "rm -rf dist"
25+
},
26+
"keywords": [
27+
"agentos",
28+
"extension",
29+
"browser",
30+
"automation",
31+
"scraping",
32+
"puppeteer"
33+
],
34+
"author": "Frame.dev <support@frame.dev>",
35+
"license": "MIT",
36+
"repository": {
37+
"type": "git",
38+
"url": "https://github.com/framersai/agentos-extensions",
39+
"directory": "registry/curated/research/web-browser"
40+
},
41+
"peerDependencies": {
42+
"@framers/agentos": "^2.0.0"
43+
},
44+
"dependencies": {
45+
"puppeteer-core": "^22.0.0",
46+
"cheerio": "^1.0.0-rc.12"
47+
},
48+
"devDependencies": {
49+
"@types/node": "^20.0.0",
50+
"typescript": "^5.4.0",
51+
"vitest": "^1.6.0"
52+
}
53+
}
54+

0 commit comments

Comments
 (0)