@browsercash/chase 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +14 -0
- package/.dockerignore +34 -0
- package/README.md +256 -0
- package/api-1 (3).json +831 -0
- package/dist/browser-cash.js +128 -0
- package/dist/claude-runner.js +285 -0
- package/dist/cli-install.js +104 -0
- package/dist/cli.js +503 -0
- package/dist/codegen/bash-generator.js +104 -0
- package/dist/config.js +112 -0
- package/dist/errors/error-classifier.js +351 -0
- package/dist/hooks/capture-hook.js +57 -0
- package/dist/index.js +180 -0
- package/dist/iterative-tester.js +407 -0
- package/dist/logger/command-log.js +38 -0
- package/dist/prompts/agentic-prompt.js +78 -0
- package/dist/prompts/fix-prompt.js +477 -0
- package/dist/prompts/helpers.js +214 -0
- package/dist/prompts/system-prompt.js +282 -0
- package/dist/script-runner.js +429 -0
- package/dist/server.js +1934 -0
- package/dist/types/iteration-history.js +139 -0
- package/openapi.json +1131 -0
- package/package.json +44 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(npm run build:*)",
|
|
5
|
+
"Bash(gcloud builds submit:*)",
|
|
6
|
+
"Bash(curl -s -X POST \"https://claude-gen-api-264851422957.us-central1.run.app/test-cdp\" -H \"Content-Type: application/json\" -d '{\n \"\"cdpUrl\"\": \"\"wss://gcp-usc1-1.milan-taurine.tera.space/v1/consumer/jk6j34n0icbmyrzz1sjd7ggnvg5i9twdpv4dfi9arn1e1hm5kbm0ao3kp53isjvox7ljf5ahq3gcigk65uwhb8hr2dq83e1vjgrl0utt7y8zyamhmdd3b42yzzw1gblz/devtools/browser/808e04d3-3a45-4ab5-9bf6-708f041215a2\"\",\n \"\"testNavigation\"\": true,\n \"\"testUrl\"\": \"\"https://example.com\"\"\n }')",
|
|
7
|
+
"Bash(jq:*)",
|
|
8
|
+
"Bash(curl:*)",
|
|
9
|
+
"Bash(agent-browser --cdp \"wss://gcp-usc1-1.milan-taurine.tera.space/v1/consumer/somxj7wg0agpocfvgmdgtsns1vfxdhexcok8yhq67az49ytz53csrfbs6r7f20orqawv6vtjo10mi9qhpxhvjgnfn529ohs6d3fj4asoc3341j8322x9ucakbggihmlb/devtools/browser/ae79b267-9445-45f4-9e74-6cab0e302bfd\" open \"https://example.com\")",
|
|
10
|
+
"WebFetch(domain:www.stainless.com)",
|
|
11
|
+
"Bash(gcloud run services logs read:*)"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
package/.dockerignore
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules
|
|
3
|
+
|
|
4
|
+
# Source files (we copy compiled dist/)
|
|
5
|
+
src/
|
|
6
|
+
|
|
7
|
+
# Development files
|
|
8
|
+
*.md
|
|
9
|
+
.env
|
|
10
|
+
.env.*
|
|
11
|
+
.git
|
|
12
|
+
.gitignore
|
|
13
|
+
tsconfig.json
|
|
14
|
+
|
|
15
|
+
# Generated output (create fresh in container)
|
|
16
|
+
generated/
|
|
17
|
+
sessions/
|
|
18
|
+
|
|
19
|
+
# IDE
|
|
20
|
+
.vscode/
|
|
21
|
+
.idea/
|
|
22
|
+
|
|
23
|
+
# OS
|
|
24
|
+
.DS_Store
|
|
25
|
+
Thumbs.db
|
|
26
|
+
|
|
27
|
+
# Test files
|
|
28
|
+
*.test.ts
|
|
29
|
+
*.spec.ts
|
|
30
|
+
__tests__/
|
|
31
|
+
|
|
32
|
+
# Logs
|
|
33
|
+
*.log
|
|
34
|
+
npm-debug.log*
|
package/README.md
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# Chase
|
|
2
|
+
|
|
3
|
+
AI-powered browser automation - extract data from any website using natural language.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Natural Language Automation**: Describe what you want in plain English
|
|
8
|
+
- **Agentic Mode**: AI performs tasks directly and returns structured results
|
|
9
|
+
- **Script Generation**: Generate reusable bash scripts for repeated tasks
|
|
10
|
+
- **MCP Integration**: Works with Claude Desktop, Cursor, and other MCP clients
|
|
11
|
+
- **CLI Tool**: Full-featured command-line interface
|
|
12
|
+
- **Claude Code Skill**: Seamless integration with Claude Code
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
### Option 1: CLI (Recommended)
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Install globally
|
|
20
|
+
npm install -g chase-browser
|
|
21
|
+
|
|
22
|
+
# Set your API key
|
|
23
|
+
export BROWSER_CASH_API_KEY="your-key"
|
|
24
|
+
|
|
25
|
+
# Run automation
|
|
26
|
+
chase automate "Get the top 10 stories from Hacker News"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Option 2: Claude Code Skill
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# One-line install
|
|
33
|
+
curl -fsSL https://raw.githubusercontent.com/alexander-spring/chase/main/skill/install.sh | bash
|
|
34
|
+
|
|
35
|
+
# Set your API key
|
|
36
|
+
export BROWSER_CASH_API_KEY="your-key"
|
|
37
|
+
|
|
38
|
+
# Then just ask Claude to extract data from any website!
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Option 3: MCP Server
|
|
42
|
+
|
|
43
|
+
Add to Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json`):
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
"chase": {
|
|
49
|
+
"transport": "http",
|
|
50
|
+
"url": "https://chase-api-gth2quoxyq-uc.a.run.app/mcp",
|
|
51
|
+
"headers": {
|
|
52
|
+
"x-api-key": "YOUR_API_KEY"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Get an API Key
|
|
60
|
+
|
|
61
|
+
Get your Browser.cash API key at: **https://browser.cash**
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## CLI Usage
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
chase <command> [options]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
| Command | Description |
|
|
72
|
+
|---------|-------------|
|
|
73
|
+
| `automate <task>` | Perform a one-off browser automation task |
|
|
74
|
+
| `generate <task>` | Generate a reusable automation script |
|
|
75
|
+
| `scripts` | List your saved scripts |
|
|
76
|
+
| `run <script-id>` | Run a saved script |
|
|
77
|
+
| `tasks` | List your recent tasks |
|
|
78
|
+
| `task <task-id>` | Get details of a specific task |
|
|
79
|
+
| `help` | Show help message |
|
|
80
|
+
|
|
81
|
+
### Examples
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# One-off automation
|
|
85
|
+
chase automate "Go to example.com and get the page title"
|
|
86
|
+
chase automate "Extract the top 10 stories from Hacker News"
|
|
87
|
+
chase automate "Get the price of PlayStation 5 on Best Buy"
|
|
88
|
+
|
|
89
|
+
# With options
|
|
90
|
+
chase automate "Get products from amazon.de" --country DE --adblock
|
|
91
|
+
|
|
92
|
+
# Generate reusable scripts
|
|
93
|
+
chase generate "Scrape product prices from amazon.com"
|
|
94
|
+
|
|
95
|
+
# List and run saved scripts
|
|
96
|
+
chase scripts
|
|
97
|
+
chase run script-abc123
|
|
98
|
+
|
|
99
|
+
# Check task status
|
|
100
|
+
chase tasks
|
|
101
|
+
chase task task-xyz789
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### CLI Options
|
|
105
|
+
|
|
106
|
+
| Option | Description |
|
|
107
|
+
|--------|-------------|
|
|
108
|
+
| `--country <code>` | Use browser from specific country (US, DE, JP, etc.) |
|
|
109
|
+
| `--adblock` | Enable ad-blocking |
|
|
110
|
+
| `--captcha` | Enable CAPTCHA solving |
|
|
111
|
+
| `--quiet` | Reduce output verbosity |
|
|
112
|
+
| `--skip-test` | Skip script testing (generate only) |
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## HTTP API
|
|
117
|
+
|
|
118
|
+
Base URL: `https://chase-api-gth2quoxyq-uc.a.run.app`
|
|
119
|
+
|
|
120
|
+
### Endpoints
|
|
121
|
+
|
|
122
|
+
| Endpoint | Method | Description |
|
|
123
|
+
|----------|--------|-------------|
|
|
124
|
+
| `/health` | GET | Health check |
|
|
125
|
+
| `/automate/stream` | POST | One-off browser automation (SSE) |
|
|
126
|
+
| `/generate/stream` | POST | Generate reusable script (SSE) |
|
|
127
|
+
| `/scripts` | GET | List saved scripts |
|
|
128
|
+
| `/scripts/:id` | GET | Get script details |
|
|
129
|
+
| `/scripts/:id/run` | POST | Run a saved script (SSE) |
|
|
130
|
+
| `/tasks` | GET | List recent tasks |
|
|
131
|
+
| `/tasks/:id` | GET | Get task status |
|
|
132
|
+
| `/mcp` | POST | MCP HTTP endpoint |
|
|
133
|
+
|
|
134
|
+
### Authentication
|
|
135
|
+
|
|
136
|
+
| Endpoint Type | Method |
|
|
137
|
+
|---------------|--------|
|
|
138
|
+
| POST endpoints | Include `browserCashApiKey` in request body |
|
|
139
|
+
| GET endpoints | Use `x-api-key` header or `apiKey` query param |
|
|
140
|
+
|
|
141
|
+
### Example: Automate Task
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
curl -N -X POST "https://chase-api-gth2quoxyq-uc.a.run.app/automate/stream" \
|
|
145
|
+
-H "Content-Type: application/json" \
|
|
146
|
+
-d '{
|
|
147
|
+
"task": "Go to example.com and get the page title",
|
|
148
|
+
"browserCashApiKey": "your-api-key"
|
|
149
|
+
}'
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Browser Options
|
|
153
|
+
|
|
154
|
+
```json
|
|
155
|
+
{
|
|
156
|
+
"browserCashApiKey": "your-key",
|
|
157
|
+
"browserOptions": {
|
|
158
|
+
"country": "US",
|
|
159
|
+
"adblock": true,
|
|
160
|
+
"captchaSolver": true
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## MCP Server
|
|
168
|
+
|
|
169
|
+
### Hosted HTTP (Recommended)
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
claude mcp add --transport http chase https://chase-api-gth2quoxyq-uc.a.run.app/mcp -H "x-api-key: YOUR_KEY"
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Local stdio
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
git clone https://github.com/alexander-spring/chase.git
|
|
179
|
+
cd chase/mcp-server && npm install && npm run build
|
|
180
|
+
claude mcp add chase node ./dist/index.js -e BROWSER_CASH_API_KEY=YOUR_KEY
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Available MCP Tools
|
|
184
|
+
|
|
185
|
+
| Tool | Description |
|
|
186
|
+
|------|-------------|
|
|
187
|
+
| `browser_automate` | Perform one-off browser automation |
|
|
188
|
+
| `generate_script` | Generate reusable automation scripts |
|
|
189
|
+
| `list_scripts` | List saved scripts |
|
|
190
|
+
| `get_script` | Get script by ID |
|
|
191
|
+
| `run_script` | Execute a saved script |
|
|
192
|
+
| `get_task` | Get task status |
|
|
193
|
+
| `list_tasks` | List recent tasks |
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Local Development
|
|
198
|
+
|
|
199
|
+
### Prerequisites
|
|
200
|
+
|
|
201
|
+
- Node.js 20+
|
|
202
|
+
- [agent-browser](https://github.com/anthropics/agent-browser) CLI
|
|
203
|
+
- [Claude CLI](https://github.com/anthropics/claude-code)
|
|
204
|
+
|
|
205
|
+
### Setup
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
git clone https://github.com/alexander-spring/chase.git
|
|
209
|
+
cd chase
|
|
210
|
+
npm install
|
|
211
|
+
npm run build
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Local Script Generation
|
|
215
|
+
|
|
216
|
+
For local development with your own browser:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# Start a browser with CDP enabled
|
|
220
|
+
agent-browser daemon
|
|
221
|
+
|
|
222
|
+
# Generate a script locally
|
|
223
|
+
CDP_URL="ws://localhost:9222/devtools/browser/..." npx chase-local "Go to example.com"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Run API Server Locally
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
npm run start:server
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Deployment
|
|
235
|
+
|
|
236
|
+
### Google Cloud Run
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
# Set project
|
|
240
|
+
export PROJECT_ID=your-project
|
|
241
|
+
|
|
242
|
+
# Enable APIs
|
|
243
|
+
gcloud services enable cloudbuild.googleapis.com run.googleapis.com containerregistry.googleapis.com secretmanager.googleapis.com
|
|
244
|
+
|
|
245
|
+
# Create Anthropic API key secret
|
|
246
|
+
echo -n "your-anthropic-key" | gcloud secrets create anthropic-api-key --data-file=-
|
|
247
|
+
|
|
248
|
+
# Deploy
|
|
249
|
+
gcloud builds submit --config cloudbuild.yaml
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## License
|
|
255
|
+
|
|
256
|
+
MIT
|