surf-cli 2.6.0 → 2.7.1
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/README.md +3 -1
- package/dist/content/accessibility-tree.js +8 -8
- package/dist/content/accessibility-tree.js.map +1 -1
- package/dist/content/visual-indicator.js +17 -17
- package/dist/content/visual-indicator.js.map +1 -1
- package/dist/manifest.json +1 -1
- package/dist/service-worker/index.js +27 -27
- package/dist/service-worker/index.js.map +1 -1
- package/native/cli.cjs +12 -0
- package/native/edited.png +0 -0
- package/native/gemini-client.cjs +304 -63
- package/native/host.cjs +51 -0
- package/package.json +8 -8
- package/skills/README.md +2 -2
- package/skills/surf/SKILL.md +40 -10
package/skills/surf/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: surf
|
|
3
|
-
description: Control Chrome browser via CLI for testing, automation, and debugging. Use when the user needs browser automation, screenshots, form filling, page inspection, network/CPU emulation, DevTools streaming, or AI queries via ChatGPT/Gemini/Perplexity/Grok.
|
|
3
|
+
description: Control Chrome browser via CLI for testing, automation, and debugging. Use when the user needs browser automation, screenshots, form filling, page inspection, network/CPU emulation, DevTools streaming, or AI queries via ChatGPT/Gemini/Perplexity/Grok/AI Studio.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Surf Browser Automation
|
|
@@ -87,13 +87,42 @@ surf grok --validate
|
|
|
87
87
|
surf grok --validate --save-models
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
### AI Studio (via aistudio.google.com - requires Google login in Chrome)
|
|
91
|
+
```bash
|
|
92
|
+
surf aistudio "explain quantum computing"
|
|
93
|
+
surf aistudio "redteam this" --with-page # Include current page context
|
|
94
|
+
surf aistudio "quick answer" --model gemini-3-flash-preview # Model selection
|
|
95
|
+
surf aistudio "analyze" --timeout 600 # Custom timeout (default: 300s)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Why AI Studio over Gemini?** AI Studio gives access to less restricted Gemini models. For Gemini 3 Pro the difference can be significant with certain prompts. Downside: aggressive per-day rate limits on Pro and Flash models.
|
|
99
|
+
|
|
100
|
+
**Model selection is best-effort:** Pass any AI Studio model id (e.g. `gemini-3.1-pro-preview`, `gemini-3-flash-preview`, `gemini-flash-lite-latest`). If the model isn't found, AI Studio uses whatever model was last selected in the UI.
|
|
101
|
+
|
|
102
|
+
### AI Studio App Builder
|
|
103
|
+
```bash
|
|
104
|
+
surf aistudio.build "build a portfolio site"
|
|
105
|
+
surf aistudio.build "todo app" --model gemini-3.1-pro-preview # Model override
|
|
106
|
+
surf aistudio.build "crm dashboard" --output ./out # Extract zip to directory
|
|
107
|
+
surf aistudio.build "game" --keep-open --timeout 600 # Keep tab open, 10min timeout
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Automates AI Studio's App Builder at `aistudio.google.com/apps`. Types your prompt, clicks Build, waits for completion, downloads the generated zip, and optionally extracts it.
|
|
111
|
+
|
|
112
|
+
- `--output <dir>` extracts the zip to a directory
|
|
113
|
+
- `--model <id>` overrides the model in Advanced Settings
|
|
114
|
+
- `--timeout <seconds>` build timeout (default: 600s)
|
|
115
|
+
- `--keep-open` leaves the AI Studio tab open after completion
|
|
116
|
+
|
|
117
|
+
Returns `zipPath`, `extractedPath`, `model`, `buildDuration`, and `tookMs`.
|
|
118
|
+
|
|
90
119
|
### AI Tool Troubleshooting
|
|
91
120
|
|
|
92
121
|
When AI queries fail, check these common issues:
|
|
93
122
|
|
|
94
|
-
1. **Not logged in**: The error "login required" means you need to log into the service in Chrome
|
|
123
|
+
1. **Not logged in**: The error "login required" means you need to log into the service in Chrome (chatgpt.com, gemini.google.com, perplexity.ai, x.com, or aistudio.google.com)
|
|
95
124
|
2. **Model selection failed**: The UI may have changed. Run `surf grok --validate` to check
|
|
96
|
-
3. **Response timeout**: Thinking models (ChatGPT o1, Grok thinking) can take 45+ seconds
|
|
125
|
+
3. **Response timeout**: Thinking models (ChatGPT o1, Grok thinking) can take 45+ seconds. AI Studio builds can take several minutes.
|
|
97
126
|
4. **Element not found**: The service's UI changed. Check for surf-cli updates
|
|
98
127
|
|
|
99
128
|
**Debugging workflow for agents:**
|
|
@@ -527,14 +556,15 @@ surf wait.element ".missing" --auto-capture --timeout 2000
|
|
|
527
556
|
3. **JS method for contenteditable** - Modern editors (ChatGPT, Claude, Notion) need `--method js`
|
|
528
557
|
4. **Named tabs for workflows** - `tab.name app` then `tab.switch app`
|
|
529
558
|
5. **Auto-capture for debugging** - `--auto-capture` saves diagnostics on failure
|
|
530
|
-
6. **AI tools use browser session** - Must be logged into the service, no API keys needed
|
|
559
|
+
6. **AI tools use browser session** - Must be logged into the service (ChatGPT, Gemini, Perplexity, Grok, AI Studio), no API keys needed
|
|
531
560
|
7. **Grok validation** - Run `surf grok --validate` if queries fail to check UI changes
|
|
532
|
-
8. **Long timeouts for thinking models** - ChatGPT o1, Grok thinking can take 60+ seconds
|
|
533
|
-
9. **
|
|
534
|
-
10. **
|
|
535
|
-
11. **
|
|
536
|
-
12. **
|
|
537
|
-
13. **
|
|
561
|
+
8. **Long timeouts for thinking models** - ChatGPT o1, Grok thinking can take 60+ seconds. AI Studio builds default to 600s.
|
|
562
|
+
9. **AI Studio for unrestricted Gemini** - `surf aistudio` gives less filtered responses than `surf gemini` for the same models
|
|
563
|
+
10. **Use `surf do` for multi-step tasks** - Reduces token overhead and improves reliability
|
|
564
|
+
11. **Dry-run workflows first** - `surf do '...' --dry-run` validates without executing
|
|
565
|
+
12. **Window isolation** - Use `window.new` + `--window-id` to keep agent work separate from your browsing
|
|
566
|
+
13. **Semantic locators** - `locate.role`, `locate.text`, `locate.label` for more robust element finding
|
|
567
|
+
14. **Frame context** - Use `frame.switch` before interacting with iframe content
|
|
538
568
|
|
|
539
569
|
## Socket API
|
|
540
570
|
|