nstbrowser-ai-agent 0.0.12 → 0.0.14
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 +187 -415
- package/bin/nstbrowser-ai-agent-darwin-arm64 +0 -0
- package/bin/nstbrowser-ai-agent-darwin-x64 +0 -0
- package/bin/nstbrowser-ai-agent-linux-arm64 +0 -0
- package/bin/nstbrowser-ai-agent-linux-x64 +0 -0
- package/bin/nstbrowser-ai-agent-win32-x64.exe +0 -0
- package/dist/actions.js +14 -1
- package/dist/actions.js.map +1 -1
- package/dist/browser-profile-resolver.d.ts +9 -0
- package/dist/browser-profile-resolver.d.ts.map +1 -1
- package/dist/browser-profile-resolver.js +24 -3
- package/dist/browser-profile-resolver.js.map +1 -1
- package/dist/browser.d.ts +6 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +25 -2
- package/dist/browser.js.map +1 -1
- package/dist/constants.d.ts +2 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -1
- package/dist/constants.js.map +1 -1
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +5 -2
- package/dist/daemon.js.map +1 -1
- package/dist/nstbrowser-actions.js +59 -34
- package/dist/nstbrowser-actions.js.map +1 -1
- package/dist/nstbrowser-client.d.ts.map +1 -1
- package/dist/nstbrowser-client.js +38 -16
- package/dist/nstbrowser-client.js.map +1 -1
- package/dist/nstbrowser-types.d.ts +1 -0
- package/dist/nstbrowser-types.d.ts.map +1 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +31 -2
- package/dist/protocol.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/skills/nstbrowser-ai-agent/SKILL.md +175 -335
- package/skills/nstbrowser-ai-agent/skill.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
# nstbrowser-ai-agent
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Browser automation CLI for Nstbrowser workflows. Fast Rust CLI with a Node.js daemon backend.
|
|
4
|
+
|
|
5
|
+
## Fast Start
|
|
6
|
+
|
|
7
|
+
If you only need the shortest path to a working setup:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g nstbrowser-ai-agent
|
|
11
|
+
nstbrowser-ai-agent config set key YOUR_API_KEY
|
|
12
|
+
nstbrowser-ai-agent nst status
|
|
13
|
+
nstbrowser-ai-agent profile list
|
|
14
|
+
nstbrowser-ai-agent verify --profile YOUR_PROFILE
|
|
15
|
+
nstbrowser-ai-agent --profile YOUR_PROFILE open https://example.com
|
|
16
|
+
nstbrowser-ai-agent --profile YOUR_PROFILE snapshot -i
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Important:
|
|
20
|
+
- Start the Nstbrowser desktop client first.
|
|
21
|
+
- Generate refs with `snapshot` or `screenshot --annotate` before using `@e1`, `@e2`, and similar refs.
|
|
22
|
+
- Keep ref-based commands in the same browser context.
|
|
23
|
+
- If you are not using `--session`, repeat the same `--profile` on every related browser command.
|
|
24
|
+
- If you are using `--session`, changing `--profile` in that same session switches the daemon to the newly requested profile.
|
|
4
25
|
|
|
5
26
|
## Installation
|
|
6
27
|
|
|
@@ -131,11 +152,6 @@ pnpm link --global # Makes nstbrowser-ai-agent available globally
|
|
|
131
152
|
|
|
132
153
|
The CLI automatically checks for updates once every 24 hours and notifies you when a new version is available.
|
|
133
154
|
|
|
134
|
-
**Disable automatic checks:**
|
|
135
|
-
```bash
|
|
136
|
-
export NSTBROWSER_AI_AGENT_NO_UPDATE_CHECK=1
|
|
137
|
-
```
|
|
138
|
-
|
|
139
155
|
### Manual Update Check
|
|
140
156
|
|
|
141
157
|
Check for updates manually:
|
|
@@ -167,11 +183,11 @@ npm install nstbrowser-ai-agent@latest
|
|
|
167
183
|
|
|
168
184
|
The tool uses Nstbrowser by default, which handles browser management automatically. No additional dependencies are required.
|
|
169
185
|
|
|
170
|
-
##
|
|
186
|
+
## Common Workflows
|
|
171
187
|
|
|
172
188
|
### Using Temporary Browser (Fastest)
|
|
173
189
|
|
|
174
|
-
|
|
190
|
+
Use this only for throwaway work that does not need profile persistence:
|
|
175
191
|
|
|
176
192
|
```bash
|
|
177
193
|
# Start temporary browser
|
|
@@ -183,8 +199,8 @@ nstbrowser-ai-agent open https://example.com
|
|
|
183
199
|
# Take a snapshot
|
|
184
200
|
nstbrowser-ai-agent snapshot -i
|
|
185
201
|
|
|
186
|
-
#
|
|
187
|
-
nstbrowser-ai-agent
|
|
202
|
+
# Stop the temporary browser
|
|
203
|
+
nstbrowser-ai-agent browser stop-all
|
|
188
204
|
```
|
|
189
205
|
|
|
190
206
|
**Note:** Temporary browsers don't save session state.
|
|
@@ -200,18 +216,18 @@ nstbrowser-ai-agent profile list
|
|
|
200
216
|
# Create a new profile (if needed)
|
|
201
217
|
nstbrowser-ai-agent profile create my-profile
|
|
202
218
|
|
|
203
|
-
#
|
|
204
|
-
|
|
219
|
+
# Verify that the profile is healthy
|
|
220
|
+
nstbrowser-ai-agent verify --profile my-profile
|
|
205
221
|
|
|
206
222
|
# Open browser (auto-starts with profile)
|
|
207
|
-
nstbrowser-ai-agent open https://example.com
|
|
223
|
+
nstbrowser-ai-agent --profile my-profile open https://example.com
|
|
208
224
|
|
|
209
225
|
# Interact with page
|
|
210
|
-
nstbrowser-ai-agent snapshot -i
|
|
211
|
-
nstbrowser-ai-agent click @e1
|
|
226
|
+
nstbrowser-ai-agent --profile my-profile snapshot -i
|
|
227
|
+
nstbrowser-ai-agent --profile my-profile click @e1
|
|
212
228
|
|
|
213
|
-
#
|
|
214
|
-
nstbrowser-ai-agent
|
|
229
|
+
# Stop browser for that profile
|
|
230
|
+
nstbrowser-ai-agent browser stop my-profile
|
|
215
231
|
```
|
|
216
232
|
|
|
217
233
|
### Profile Specification for Browser Actions
|
|
@@ -291,31 +307,32 @@ nstbrowser-ai-agent open https://example.com --profile "abc-123-def-456-789"
|
|
|
291
307
|
# Start a browser with a profile
|
|
292
308
|
nstbrowser-ai-agent open https://example.com --profile "my-profile"
|
|
293
309
|
|
|
294
|
-
# Later commands
|
|
310
|
+
# Later commands should keep using the same profile value
|
|
295
311
|
nstbrowser-ai-agent click "#button" --profile "my-profile"
|
|
296
|
-
#
|
|
312
|
+
# Reuse is automatic when the command stays on the same profile
|
|
297
313
|
```
|
|
298
314
|
|
|
299
|
-
##
|
|
315
|
+
## Nstbrowser Workflow
|
|
300
316
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
### Using Nstbrowser (Default)
|
|
317
|
+
nstbrowser-ai-agent is designed around **Nstbrowser**. In normal usage, you just point it at your Nstbrowser profiles and run commands.
|
|
304
318
|
|
|
305
319
|
```bash
|
|
306
320
|
# Set your API key (required for Nstbrowser)
|
|
307
321
|
export NST_API_KEY="your-api-key"
|
|
308
322
|
|
|
309
|
-
#
|
|
310
|
-
nstbrowser-ai-agent
|
|
311
|
-
nstbrowser-ai-agent
|
|
312
|
-
nstbrowser-ai-agent click @e2 # Click by ref from snapshot
|
|
313
|
-
nstbrowser-ai-agent fill @e3 "test@example.com" # Fill by ref
|
|
314
|
-
nstbrowser-ai-agent get text @e1 # Get text by ref
|
|
315
|
-
nstbrowser-ai-agent screenshot page.png
|
|
316
|
-
nstbrowser-ai-agent close
|
|
323
|
+
# Verify a healthy profile first
|
|
324
|
+
nstbrowser-ai-agent profile list
|
|
325
|
+
nstbrowser-ai-agent verify --profile my-profile
|
|
317
326
|
|
|
318
|
-
#
|
|
327
|
+
# Launch browser through Nstbrowser
|
|
328
|
+
nstbrowser-ai-agent --profile my-profile open example.com
|
|
329
|
+
nstbrowser-ai-agent --profile my-profile snapshot -i
|
|
330
|
+
nstbrowser-ai-agent --profile my-profile click @e1
|
|
331
|
+
nstbrowser-ai-agent --profile my-profile get text @e1
|
|
332
|
+
nstbrowser-ai-agent --profile my-profile screenshot page.png
|
|
333
|
+
nstbrowser-ai-agent browser stop my-profile
|
|
334
|
+
|
|
335
|
+
# Nstbrowser management
|
|
319
336
|
nstbrowser-ai-agent profile list # List profiles
|
|
320
337
|
nstbrowser-ai-agent profile create my-profile # Create profile
|
|
321
338
|
nstbrowser-ai-agent browser list # List running browsers
|
|
@@ -402,7 +419,13 @@ nstbrowser-ai-agent find last <sel> <action> [value] # Last match
|
|
|
402
419
|
nstbrowser-ai-agent find nth <n> <sel> <action> [value] # Nth match
|
|
403
420
|
```
|
|
404
421
|
|
|
405
|
-
**
|
|
422
|
+
**Common actions:** `click`, `fill`, `check`, `hover`, `text`
|
|
423
|
+
|
|
424
|
+
Action support depends on locator type:
|
|
425
|
+
- `role`, `text`, `alt`, `title`: `click`, `hover`
|
|
426
|
+
- `label`, `placeholder`: `click`, `fill`, `check`
|
|
427
|
+
- `testid`: `click`, `fill`, `check`, `hover`
|
|
428
|
+
- `first`, `last`, `nth`: `click`, `fill`, `check`, `hover`, `text`
|
|
406
429
|
|
|
407
430
|
**Options:** `--name <name>` (filter role by accessible name), `--exact` (require exact text match)
|
|
408
431
|
|
|
@@ -553,9 +576,6 @@ Run multiple isolated browser instances:
|
|
|
553
576
|
nstbrowser-ai-agent --session agent1 open site-a.com
|
|
554
577
|
nstbrowser-ai-agent --session agent2 open site-b.com
|
|
555
578
|
|
|
556
|
-
# Or via environment variable
|
|
557
|
-
NSTBROWSER_AI_AGENT_SESSION=agent1 nstbrowser-ai-agent click "#btn"
|
|
558
|
-
|
|
559
579
|
# List active sessions
|
|
560
580
|
nstbrowser-ai-agent session list
|
|
561
581
|
# Output:
|
|
@@ -597,9 +617,7 @@ nstbrowser-ai-agent config get key
|
|
|
597
617
|
nstbrowser-ai-agent config unset key
|
|
598
618
|
```
|
|
599
619
|
|
|
600
|
-
Configuration is stored in `~/.nst-ai-agent/config.json
|
|
601
|
-
|
|
602
|
-
**Priority order:** Config file > Environment variables > Defaults
|
|
620
|
+
Configuration is stored in `~/.nst-ai-agent/config.json`.
|
|
603
621
|
|
|
604
622
|
### Check NST Agent Status
|
|
605
623
|
|
|
@@ -615,65 +633,21 @@ nstbrowser-ai-agent nst status --json
|
|
|
615
633
|
|
|
616
634
|
This command uses the `/api/agent/agent/info` endpoint to verify the NST service is accessible.
|
|
617
635
|
|
|
618
|
-
## Persistent Profiles
|
|
619
|
-
|
|
620
|
-
By default, browser state (cookies, localStorage, login sessions) is ephemeral and lost when the browser closes. Use `--profile` to persist state across browser restarts:
|
|
621
|
-
|
|
622
|
-
```bash
|
|
623
|
-
# Use a persistent profile directory
|
|
624
|
-
nstbrowser-ai-agent --profile ~/.myapp-profile open myapp.com
|
|
625
|
-
|
|
626
|
-
# Login once, then reuse the authenticated session
|
|
627
|
-
nstbrowser-ai-agent --profile ~/.myapp-profile open myapp.com/dashboard
|
|
628
|
-
|
|
629
|
-
# Or via environment variable
|
|
630
|
-
NSTBROWSER_AI_AGENT_PROFILE=~/.myapp-profile nstbrowser-ai-agent open myapp.com
|
|
631
|
-
```
|
|
632
|
-
|
|
633
|
-
The profile directory stores:
|
|
634
|
-
- Cookies and localStorage
|
|
635
|
-
- IndexedDB data
|
|
636
|
-
- Service workers
|
|
637
|
-
- Browser cache
|
|
638
|
-
- Login sessions
|
|
639
|
-
|
|
640
|
-
**Tip**: Use different profile paths for different projects to keep their browser state isolated.
|
|
641
|
-
|
|
642
636
|
## Session Persistence
|
|
643
637
|
|
|
644
|
-
|
|
638
|
+
Use `--session-name` to automatically save and restore cookies and storage across browser restarts while continuing to use Nstbrowser:
|
|
645
639
|
|
|
646
640
|
```bash
|
|
647
|
-
# Auto-save/load state for
|
|
648
|
-
nstbrowser-ai-agent --session-name
|
|
641
|
+
# Auto-save/load state for one persistent profile workflow
|
|
642
|
+
nstbrowser-ai-agent --session-name myapp --profile my-profile open https://example.com
|
|
649
643
|
|
|
650
644
|
# Login once, then state persists automatically
|
|
651
645
|
# State files stored in ~/.nstbrowser-ai-agent/sessions/
|
|
652
|
-
|
|
653
|
-
# Or via environment variable
|
|
654
|
-
export NSTBROWSER_AI_AGENT_SESSION_NAME=twitter
|
|
655
|
-
nstbrowser-ai-agent open twitter.com
|
|
656
|
-
```
|
|
657
|
-
|
|
658
|
-
### State Encryption
|
|
659
|
-
|
|
660
|
-
Encrypt saved session data at rest with AES-256-GCM:
|
|
661
|
-
|
|
662
|
-
```bash
|
|
663
|
-
# Generate key: openssl rand -hex 32
|
|
664
|
-
export NSTBROWSER_AI_AGENT_ENCRYPTION_KEY=<64-char-hex-key>
|
|
665
|
-
|
|
666
|
-
# State files are now encrypted automatically
|
|
667
|
-
nstbrowser-ai-agent --session-name secure open example.com
|
|
668
646
|
```
|
|
669
647
|
|
|
670
648
|
| Variable | Description |
|
|
671
649
|
|----------|-------------|
|
|
672
|
-
| `
|
|
673
|
-
| `NSTBROWSER_AI_AGENT_ENCRYPTION_KEY` | 64-char hex key for AES-256-GCM encryption |
|
|
674
|
-
| `NSTBROWSER_AI_AGENT_STATE_EXPIRE_DAYS` | Auto-delete states older than N days (default: 30) |
|
|
675
|
-
| `NSTBROWSER_AI_AGENT_PROVIDER` | Browser provider (default: nst) |
|
|
676
|
-
| `NST_API_KEY` | Nstbrowser API key (required for nst provider, default provider) |
|
|
650
|
+
| `NST_API_KEY` | Nstbrowser API key |
|
|
677
651
|
| `NST_HOST` | Nstbrowser API host (default: localhost) |
|
|
678
652
|
| `NST_PORT` | Nstbrowser API port (default: 8848) |
|
|
679
653
|
|
|
@@ -681,7 +655,7 @@ nstbrowser-ai-agent --session-name secure open example.com
|
|
|
681
655
|
|
|
682
656
|
nstbrowser-ai-agent includes security features for safe AI agent deployments. All features are opt-in -- existing workflows are unaffected until you explicitly enable a feature:
|
|
683
657
|
|
|
684
|
-
- **Authentication Vault** -- Store credentials locally (always encrypted), reference by name. The LLM never sees passwords
|
|
658
|
+
- **Authentication Vault** -- Store credentials locally (always encrypted), reference by name. The LLM never sees passwords: `echo "pass" | nstbrowser-ai-agent auth save github --url https://github.com/login --username user --password-stdin` then `nstbrowser-ai-agent auth login github`
|
|
685
659
|
- **Content Boundary Markers** -- Wrap page output in delimiters so LLMs can distinguish tool output from untrusted content: `--content-boundaries`
|
|
686
660
|
- **Domain Allowlist** -- Restrict navigation to trusted domains (wildcards like `*.example.com` also match the bare domain): `--allowed-domains "example.com,*.example.com"`. Sub-resource requests (scripts, images, fetch) and WebSocket/EventSource connections to non-allowed domains are also blocked. Include any CDN domains your target pages depend on (e.g., `*.cdn.example.com`).
|
|
687
661
|
- **Action Policy** -- Gate destructive actions with a static policy file: `--action-policy ./policy.json`
|
|
@@ -690,19 +664,10 @@ nstbrowser-ai-agent includes security features for safe AI agent deployments. Al
|
|
|
690
664
|
|
|
691
665
|
| Variable | Description |
|
|
692
666
|
|----------|-------------|
|
|
693
|
-
| `
|
|
694
|
-
| `NSTBROWSER_AI_AGENT_MAX_OUTPUT` | Max characters for page output |
|
|
695
|
-
| `NSTBROWSER_AI_AGENT_ALLOWED_DOMAINS` | Comma-separated allowed domain patterns |
|
|
696
|
-
| `NSTBROWSER_AI_AGENT_ACTION_POLICY` | Path to action policy JSON file |
|
|
697
|
-
| `NSTBROWSER_AI_AGENT_CONFIRM_ACTIONS` | Action categories requiring confirmation |
|
|
698
|
-
| `NSTBROWSER_AI_AGENT_CONFIRM_INTERACTIVE` | Enable interactive confirmation prompts |
|
|
699
|
-
| `NSTBROWSER_AI_AGENT_PROVIDER` | Browser provider (default: nst) |
|
|
700
|
-
| `NST_API_KEY` | Nstbrowser API key (required for nst provider, default provider) |
|
|
667
|
+
| `NST_API_KEY` | Nstbrowser API key |
|
|
701
668
|
| `NST_HOST` | Nstbrowser API host (default: localhost) |
|
|
702
669
|
| `NST_PORT` | Nstbrowser API port (default: 8848) |
|
|
703
670
|
|
|
704
|
-
See the Security section below for details on environment variable handling.
|
|
705
|
-
|
|
706
671
|
## Snapshot Options
|
|
707
672
|
|
|
708
673
|
The `snapshot` command supports filtering to reduce output size:
|
|
@@ -746,39 +711,38 @@ nstbrowser-ai-agent screenshot --annotate ./page.png
|
|
|
746
711
|
nstbrowser-ai-agent click @e2 # Click the "Home" link labeled [2]
|
|
747
712
|
```
|
|
748
713
|
|
|
714
|
+
Important: refs are session-scoped and order-dependent. Generate them with `snapshot` or `screenshot --annotate`, then use them in later commands within the same session.
|
|
715
|
+
|
|
749
716
|
This is useful for multimodal AI models that can reason about visual layout, unlabeled icon buttons, canvas elements, or visual state that the text accessibility tree cannot capture.
|
|
750
717
|
|
|
751
718
|
## Options
|
|
752
719
|
|
|
753
720
|
| Option | Description |
|
|
754
721
|
|--------|------------------------------------------------------------------------------------------------------------------|
|
|
755
|
-
| `--session <name>` | Use isolated session
|
|
756
|
-
| `--session-name <name>` | Auto-save/restore session state
|
|
757
|
-
| `--profile <
|
|
758
|
-
| `--state <path>` | Load storage state from JSON file
|
|
722
|
+
| `--session <name>` | Use isolated session |
|
|
723
|
+
| `--session-name <name>` | Auto-save/restore session state |
|
|
724
|
+
| `--profile <name-or-id>` | Select NSTBrowser profile by name or UUID |
|
|
725
|
+
| `--state <path>` | Load storage state from JSON file |
|
|
759
726
|
| `--headers <json>` | Set HTTP headers scoped to the URL's origin |
|
|
760
|
-
| `--
|
|
761
|
-
| `--
|
|
762
|
-
| `--
|
|
763
|
-
| `--
|
|
764
|
-
| `--proxy <
|
|
765
|
-
| `--proxy-bypass <hosts>` | Hosts to bypass proxy (or `NSTBROWSER_AI_AGENT_PROXY_BYPASS` env) |
|
|
727
|
+
| `--extension <path>` | Load browser extension (repeatable) |
|
|
728
|
+
| `--args <args>` | Browser launch args, comma or newline separated |
|
|
729
|
+
| `--user-agent <ua>` | Custom User-Agent string |
|
|
730
|
+
| `--proxy <url>` | Proxy server URL with optional auth |
|
|
731
|
+
| `--proxy-bypass <hosts>` | Hosts to bypass proxy |
|
|
766
732
|
| `--ignore-https-errors` | Ignore HTTPS certificate errors (useful for self-signed certs) |
|
|
767
|
-
| `--allow-file-access` | Allow file:// URLs to access local files (Chromium only) |
|
|
768
|
-
| `-p, --provider <name>` | Browser provider: `nst` (default), `local` (or `NSTBROWSER_AI_AGENT_PROVIDER` env) |
|
|
769
733
|
| `--json` | JSON output (for agents) |
|
|
770
734
|
| `--full, -f` | Full page screenshot |
|
|
771
|
-
| `--annotate` | Annotated screenshot with numbered element labels
|
|
772
|
-
| `--color-scheme <scheme>` | Color scheme: `dark`, `light`, `no-preference`
|
|
773
|
-
| `--download-path <path>` | Default download directory
|
|
774
|
-
| `--content-boundaries` | Wrap page output in boundary markers for LLM safety
|
|
775
|
-
| `--max-output <chars>` | Truncate page output to N characters
|
|
776
|
-
| `--allowed-domains <list>` | Comma-separated allowed domain patterns
|
|
777
|
-
| `--action-policy <path>` | Path to action policy JSON file
|
|
778
|
-
| `--confirm-actions <list>` | Action categories requiring confirmation
|
|
779
|
-
| `--confirm-interactive` | Interactive confirmation prompts; auto-denies if stdin is not a TTY
|
|
780
|
-
| `--native` | [Experimental] Use native Rust daemon instead of Node.js
|
|
781
|
-
| `--config <path>` | Use a custom config file
|
|
735
|
+
| `--annotate` | Annotated screenshot with numbered element labels |
|
|
736
|
+
| `--color-scheme <scheme>` | Color scheme: `dark`, `light`, `no-preference` |
|
|
737
|
+
| `--download-path <path>` | Default download directory |
|
|
738
|
+
| `--content-boundaries` | Wrap page output in boundary markers for LLM safety |
|
|
739
|
+
| `--max-output <chars>` | Truncate page output to N characters |
|
|
740
|
+
| `--allowed-domains <list>` | Comma-separated allowed domain patterns |
|
|
741
|
+
| `--action-policy <path>` | Path to action policy JSON file |
|
|
742
|
+
| `--confirm-actions <list>` | Action categories requiring confirmation |
|
|
743
|
+
| `--confirm-interactive` | Interactive confirmation prompts; auto-denies if stdin is not a TTY |
|
|
744
|
+
| `--native` | [Experimental] Use native Rust daemon instead of Node.js |
|
|
745
|
+
| `--config <path>` | Use a custom config file |
|
|
782
746
|
| `--debug` | Debug output |
|
|
783
747
|
|
|
784
748
|
## Configuration
|
|
@@ -791,8 +755,7 @@ Create an `nstbrowser-ai-agent.json` file to set persistent defaults instead of
|
|
|
791
755
|
|
|
792
756
|
1. `~/.nstbrowser-ai-agent/config.json` -- user-level defaults
|
|
793
757
|
2. `./nstbrowser-ai-agent.json` -- project-level overrides (in working directory)
|
|
794
|
-
3.
|
|
795
|
-
4. CLI flags override everything
|
|
758
|
+
3. CLI flags override everything
|
|
796
759
|
|
|
797
760
|
**Example `nstbrowser-ai-agent.json`:**
|
|
798
761
|
|
|
@@ -800,20 +763,19 @@ Create an `nstbrowser-ai-agent.json` file to set persistent defaults instead of
|
|
|
800
763
|
{
|
|
801
764
|
"headed": true,
|
|
802
765
|
"proxy": "http://localhost:8080",
|
|
803
|
-
"profile": "
|
|
766
|
+
"profile": "twitter",
|
|
804
767
|
"userAgent": "my-agent/1.0",
|
|
805
768
|
"ignoreHttpsErrors": true
|
|
806
769
|
}
|
|
807
770
|
```
|
|
808
771
|
|
|
809
|
-
Use `--config <path>`
|
|
772
|
+
Use `--config <path>` to load a specific config file instead of the defaults:
|
|
810
773
|
|
|
811
774
|
```bash
|
|
812
775
|
nstbrowser-ai-agent --config ./ci-config.json open example.com
|
|
813
|
-
NSTBROWSER_AI_AGENT_CONFIG=./ci-config.json nstbrowser-ai-agent open example.com
|
|
814
776
|
```
|
|
815
777
|
|
|
816
|
-
All options from the table above can be set in the config file using camelCase keys (
|
|
778
|
+
All options from the table above can be set in the config file using camelCase keys (for example, `--proxy-bypass` becomes `"proxyBypass"`). Unknown keys are ignored for forward compatibility.
|
|
817
779
|
|
|
818
780
|
Boolean flags accept an optional `true`/`false` value to override config settings. For example, `--headed false` disables `"headed": true` from config. A bare `--headed` is equivalent to `--headed true`.
|
|
819
781
|
|
|
@@ -821,57 +783,12 @@ Auto-discovered config files that are missing are silently ignored. If `--config
|
|
|
821
783
|
|
|
822
784
|
> **Tip:** If your project-level `nstbrowser-ai-agent.json` contains environment-specific values (paths, proxies), consider adding it to `.gitignore`.
|
|
823
785
|
|
|
824
|
-
### Environment Variables via .env Files
|
|
825
|
-
|
|
826
|
-
You can store environment variables in `.env` files for easier configuration management:
|
|
827
|
-
|
|
828
|
-
**Supported files (in priority order):**
|
|
829
|
-
|
|
830
|
-
1. `.nstbrowser-ai-agent.env` -- project-specific configuration (highest priority)
|
|
831
|
-
2. `.env` -- standard environment file
|
|
832
|
-
|
|
833
|
-
**Example `.nstbrowser-ai-agent.env`:**
|
|
834
|
-
|
|
835
|
-
```bash
|
|
836
|
-
# Nstbrowser configuration
|
|
837
|
-
NST_API_KEY=your-api-key-here
|
|
838
|
-
NST_HOST=api.nstbrowser.io
|
|
839
|
-
NST_PORT=443
|
|
840
|
-
|
|
841
|
-
# Agent configuration
|
|
842
|
-
NSTBROWSER_AI_AGENT_DEBUG=1
|
|
843
|
-
NSTBROWSER_AI_AGENT_DEFAULT_TIMEOUT=30000
|
|
844
|
-
```
|
|
845
|
-
|
|
846
|
-
The `.env` files are loaded automatically when you run any command. Variables set in `.nstbrowser-ai-agent.env` take priority over `.env`.
|
|
847
|
-
|
|
848
|
-
> **Security Note:** Never commit `.env` files containing API keys to version control. Add them to `.gitignore`.
|
|
849
|
-
|
|
850
|
-
**Example `.gitignore`:**
|
|
851
|
-
|
|
852
|
-
```
|
|
853
|
-
.env
|
|
854
|
-
.nstbrowser-ai-agent.env
|
|
855
|
-
nstbrowser-ai-agent.json
|
|
856
|
-
```
|
|
857
|
-
|
|
858
786
|
## Default Timeout
|
|
859
787
|
|
|
860
788
|
The default Playwright timeout for standard operations (clicks, waits, fills, etc.) is 25 seconds. This is intentionally below the CLI's 30-second IPC read timeout so that Playwright returns a proper error instead of the CLI timing out with EAGAIN.
|
|
861
789
|
|
|
862
|
-
Override the default timeout via environment variable:
|
|
863
|
-
|
|
864
|
-
```bash
|
|
865
|
-
# Set a longer timeout for slow pages (in milliseconds)
|
|
866
|
-
export NSTBROWSER_AI_AGENT_DEFAULT_TIMEOUT=45000
|
|
867
|
-
```
|
|
868
|
-
|
|
869
790
|
> **Note:** Setting this above 30000 (30s) may cause EAGAIN errors on slow operations because the CLI's read timeout will expire before Playwright responds. The CLI retries transient errors automatically, but response times will increase.
|
|
870
791
|
|
|
871
|
-
| Variable | Description |
|
|
872
|
-
|----------|-------------|
|
|
873
|
-
| `NSTBROWSER_AI_AGENT_DEFAULT_TIMEOUT` | Default Playwright timeout in ms (default: 25000) |
|
|
874
|
-
|
|
875
792
|
## Selectors
|
|
876
793
|
|
|
877
794
|
### Refs (Recommended for AI)
|
|
@@ -937,31 +854,31 @@ nstbrowser-ai-agent is visible @e2 --json
|
|
|
937
854
|
|
|
938
855
|
```bash
|
|
939
856
|
# 1. Navigate and get snapshot
|
|
940
|
-
nstbrowser-ai-agent open example.com
|
|
941
|
-
nstbrowser-ai-agent snapshot -i --json
|
|
857
|
+
nstbrowser-ai-agent --profile my-profile open example.com
|
|
858
|
+
nstbrowser-ai-agent --profile my-profile snapshot -i --json
|
|
942
859
|
|
|
943
860
|
# 2. AI identifies target refs from snapshot
|
|
944
861
|
# 3. Execute actions using refs
|
|
945
|
-
nstbrowser-ai-agent click @e2
|
|
946
|
-
nstbrowser-ai-agent fill @e3 "input text"
|
|
862
|
+
nstbrowser-ai-agent --profile my-profile click @e2
|
|
863
|
+
nstbrowser-ai-agent --profile my-profile fill @e3 "input text"
|
|
947
864
|
|
|
948
865
|
# 4. Get new snapshot if page changed
|
|
949
|
-
nstbrowser-ai-agent snapshot -i --json
|
|
866
|
+
nstbrowser-ai-agent --profile my-profile snapshot -i --json
|
|
950
867
|
```
|
|
951
868
|
|
|
952
869
|
### Command Chaining
|
|
953
870
|
|
|
954
|
-
Commands can be chained with `&&`
|
|
871
|
+
Commands can be chained with `&&` when every command stays on the same browser context. In practice, that usually means repeating the same `--profile`:
|
|
955
872
|
|
|
956
873
|
```bash
|
|
957
874
|
# Open, wait for load, and snapshot in one call
|
|
958
|
-
nstbrowser-ai-agent open example.com && nstbrowser-ai-agent wait --load networkidle && nstbrowser-ai-agent snapshot -i
|
|
875
|
+
nstbrowser-ai-agent --profile my-profile open example.com && nstbrowser-ai-agent --profile my-profile wait --load networkidle && nstbrowser-ai-agent --profile my-profile snapshot -i
|
|
959
876
|
|
|
960
877
|
# Chain multiple interactions
|
|
961
|
-
nstbrowser-ai-agent fill @e1 "user@example.com" && nstbrowser-ai-agent fill @e2 "pass" && nstbrowser-ai-agent click @e3
|
|
878
|
+
nstbrowser-ai-agent --profile my-profile fill @e1 "user@example.com" && nstbrowser-ai-agent --profile my-profile fill @e2 "pass" && nstbrowser-ai-agent --profile my-profile click @e3
|
|
962
879
|
|
|
963
880
|
# Navigate and screenshot
|
|
964
|
-
nstbrowser-ai-agent open example.com && nstbrowser-ai-agent wait --load networkidle && nstbrowser-ai-agent screenshot page.png
|
|
881
|
+
nstbrowser-ai-agent --profile my-profile open example.com && nstbrowser-ai-agent --profile my-profile wait --load networkidle && nstbrowser-ai-agent --profile my-profile screenshot page.png
|
|
965
882
|
```
|
|
966
883
|
|
|
967
884
|
Use `&&` when you don't need intermediate output. Run commands separately when you need to parse output first (e.g., snapshot to discover refs before interacting).
|
|
@@ -1011,72 +928,11 @@ For global headers (all domains), use `set headers`:
|
|
|
1011
928
|
nstbrowser-ai-agent set headers '{"X-Custom-Header": "value"}'
|
|
1012
929
|
```
|
|
1013
930
|
|
|
1014
|
-
## Custom Browser Executable
|
|
1015
|
-
|
|
1016
|
-
Use a custom browser executable instead of the bundled Chromium. This is useful for:
|
|
1017
|
-
- **Serverless deployment**: Use lightweight Chromium builds like `@sparticuz/chromium` (~50MB vs ~684MB)
|
|
1018
|
-
- **System browsers**: Use an existing Chrome/Chromium installation
|
|
1019
|
-
- **Custom builds**: Use modified browser builds
|
|
1020
|
-
|
|
1021
|
-
### CLI Usage
|
|
1022
|
-
|
|
1023
|
-
```bash
|
|
1024
|
-
# Via flag
|
|
1025
|
-
nstbrowser-ai-agent --executable-path /path/to/chromium open example.com
|
|
1026
|
-
|
|
1027
|
-
# Via environment variable
|
|
1028
|
-
NSTBROWSER_AI_AGENT_EXECUTABLE_PATH=/path/to/chromium nstbrowser-ai-agent open example.com
|
|
1029
|
-
```
|
|
1030
|
-
|
|
1031
|
-
### Serverless Example (AWS Lambda)
|
|
1032
|
-
|
|
1033
|
-
```typescript
|
|
1034
|
-
import chromium from '@sparticuz/chromium';
|
|
1035
|
-
import { BrowserManager } from 'nstbrowser-ai-agent';
|
|
1036
|
-
|
|
1037
|
-
export async function handler() {
|
|
1038
|
-
const browser = new BrowserManager();
|
|
1039
|
-
await browser.launch({
|
|
1040
|
-
executablePath: await chromium.executablePath(),
|
|
1041
|
-
headless: true,
|
|
1042
|
-
});
|
|
1043
|
-
// ... use browser
|
|
1044
|
-
}
|
|
1045
|
-
```
|
|
1046
|
-
|
|
1047
|
-
## Local Files
|
|
1048
|
-
|
|
1049
|
-
Open and interact with local files (PDFs, HTML, etc.) using `file://` URLs:
|
|
1050
|
-
|
|
1051
|
-
```bash
|
|
1052
|
-
# Enable file access (required for JavaScript to access local files)
|
|
1053
|
-
nstbrowser-ai-agent --allow-file-access open file:///path/to/document.pdf
|
|
1054
|
-
nstbrowser-ai-agent --allow-file-access open file:///path/to/page.html
|
|
1055
|
-
|
|
1056
|
-
# Take screenshot of a local PDF
|
|
1057
|
-
nstbrowser-ai-agent --allow-file-access open file:///Users/me/report.pdf
|
|
1058
|
-
nstbrowser-ai-agent screenshot report.png
|
|
1059
|
-
```
|
|
1060
|
-
|
|
1061
|
-
The `--allow-file-access` flag adds Chromium flags (`--allow-file-access-from-files`, `--allow-file-access`) that allow `file://` URLs to:
|
|
1062
|
-
- Load and render local files
|
|
1063
|
-
- Access other local files via JavaScript (XHR, fetch)
|
|
1064
|
-
- Load local resources (images, scripts, stylesheets)
|
|
1065
|
-
|
|
1066
|
-
**Note:** This flag only works with Chromium. For security, it's disabled by default.
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
931
|
Stream the browser viewport via WebSocket for live preview or "pair browsing" where a human can watch and interact alongside an AI agent.
|
|
1070
932
|
|
|
1071
933
|
### Enable Streaming
|
|
1072
934
|
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
```bash
|
|
1076
|
-
NSTBROWSER_AI_AGENT_STREAM_PORT=9223 nstbrowser-ai-agent open example.com
|
|
1077
|
-
```
|
|
1078
|
-
|
|
1079
|
-
This starts a WebSocket server on the specified port that streams the browser viewport and accepts input events.
|
|
935
|
+
Start the CLI with streaming enabled by your deployment configuration. This starts a WebSocket server that streams the browser viewport and accepts input events.
|
|
1080
936
|
|
|
1081
937
|
### WebSocket Protocol
|
|
1082
938
|
|
|
@@ -1191,12 +1047,7 @@ The native daemon is a pure Rust implementation that communicates with Chrome di
|
|
|
1191
1047
|
### Enabling Native Mode
|
|
1192
1048
|
|
|
1193
1049
|
```bash
|
|
1194
|
-
# Via flag
|
|
1195
1050
|
nstbrowser-ai-agent --native open example.com
|
|
1196
|
-
|
|
1197
|
-
# Via environment variable (recommended for persistent use)
|
|
1198
|
-
export NSTBROWSER_AI_AGENT_NATIVE=1
|
|
1199
|
-
nstbrowser-ai-agent open example.com
|
|
1200
1051
|
```
|
|
1201
1052
|
|
|
1202
1053
|
Or add to your config file (`nstbrowser-ai-agent.json`):
|
|
@@ -1233,39 +1084,15 @@ Or add to your config file (`nstbrowser-ai-agent.json`):
|
|
|
1233
1084
|
|
|
1234
1085
|
## Usage with AI Agents
|
|
1235
1086
|
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
The simplest approach -- just tell your agent to use it:
|
|
1239
|
-
|
|
1240
|
-
```
|
|
1241
|
-
Use nstbrowser-ai-agent to test the login flow. Run nstbrowser-ai-agent --help to see available commands.
|
|
1242
|
-
```
|
|
1243
|
-
|
|
1244
|
-
The `--help` output is comprehensive and most agents can figure it out from there.
|
|
1245
|
-
|
|
1246
|
-
### AI Coding Assistants (recommended)
|
|
1247
|
-
|
|
1248
|
-
Add the skill to your AI coding assistant for richer context:
|
|
1249
|
-
|
|
1250
|
-
```bash
|
|
1251
|
-
npx skills add nstbrowser/nstbrowser-ai-agent
|
|
1252
|
-
```
|
|
1253
|
-
|
|
1254
|
-
This works with Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Goose, OpenCode, and Windsurf. The skill is fetched from the repository, so it stays up to date automatically -- do not copy `SKILL.md` from `node_modules` as it will become stale.
|
|
1255
|
-
|
|
1256
|
-
### Claude Code
|
|
1257
|
-
|
|
1258
|
-
Install as a Claude Code skill:
|
|
1087
|
+
For coding assistants and terminal agents, install the skill:
|
|
1259
1088
|
|
|
1260
1089
|
```bash
|
|
1261
1090
|
npx skills add nstbrowser/nstbrowser-ai-agent
|
|
1262
1091
|
```
|
|
1263
1092
|
|
|
1264
|
-
This
|
|
1093
|
+
This works with Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Goose, OpenCode, and Windsurf. The skill is fetched from the repository, so it stays up to date automatically.
|
|
1265
1094
|
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
For more consistent results, add to your project or global instructions file:
|
|
1095
|
+
For more consistent results, add guidance like this to `AGENTS.md` or `CLAUDE.md`:
|
|
1269
1096
|
|
|
1270
1097
|
```markdown
|
|
1271
1098
|
## Browser Automation
|
|
@@ -1280,170 +1107,110 @@ Core workflow:
|
|
|
1280
1107
|
5. Re-snapshot after page changes
|
|
1281
1108
|
```
|
|
1282
1109
|
|
|
1283
|
-
## Nstbrowser
|
|
1110
|
+
## Nstbrowser Reference
|
|
1284
1111
|
|
|
1285
|
-
|
|
1112
|
+
Use these as the main Nstbrowser-specific management commands. When you want the
|
|
1113
|
+
full CLI reference for a category, run:
|
|
1286
1114
|
|
|
1287
|
-
|
|
1115
|
+
```bash
|
|
1116
|
+
nstbrowser-ai-agent profile --help
|
|
1117
|
+
nstbrowser-ai-agent browser --help
|
|
1118
|
+
nstbrowser-ai-agent verify --help
|
|
1119
|
+
nstbrowser-ai-agent repair --help
|
|
1120
|
+
```
|
|
1288
1121
|
|
|
1289
|
-
|
|
1122
|
+
### Profile Commands
|
|
1290
1123
|
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1124
|
+
- `profile list`
|
|
1125
|
+
Best for: picking a profile name before browser automation.
|
|
1126
|
+
Parameters: none by default, or `--verbose` for the full NST profile object.
|
|
1127
|
+
Result: human-readable mode prints profile name, short ID, platform, proxy IP, group, and tags when available.
|
|
1294
1128
|
|
|
1295
|
-
|
|
1129
|
+
- `profile list-cursor --page-size <size> [--cursor <token>] [--direction next|prev]`
|
|
1130
|
+
Best for: large profile collections where `profile list` is too broad.
|
|
1131
|
+
Parameters:
|
|
1132
|
+
`--page-size` controls how many profiles come back in one page.
|
|
1133
|
+
`--cursor` continues from a cursor returned by the previous page.
|
|
1134
|
+
`--direction` chooses whether that cursor is used as the next page or previous page anchor.
|
|
1135
|
+
Result: human-readable mode prints `Profiles page (N):` plus `Next cursor` / `Prev cursor` when available.
|
|
1296
1136
|
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
export NST_API_KEY="your-api-key"
|
|
1300
|
-
export NST_HOST="localhost" # Optional, default: localhost
|
|
1301
|
-
export NST_PORT="8848" # Optional, default: 8848
|
|
1137
|
+
- `profile show <name-or-id>`
|
|
1138
|
+
Best for: confirming one profile's group, proxy, tags, platform, and last launch info before using it.
|
|
1302
1139
|
|
|
1303
|
-
|
|
1304
|
-
|
|
1140
|
+
- `profile create <name> [--platform <Windows|macOS|Linux>] [--kernel <version>] [--group-id <id>]`
|
|
1141
|
+
Best for: creating a clean profile for a new task.
|
|
1142
|
+
`--kernel` requests a preferred kernel milestone; NST may normalize it to a currently supported version.
|
|
1143
|
+
Extra proxy parameters:
|
|
1144
|
+
`--proxy-host <host>`, `--proxy-port <port>`, `--proxy-type <http|https|socks5>`, `--proxy-username <user>`, `--proxy-password <pass>`.
|
|
1145
|
+
Result: returns the created profile and its `profileId`.
|
|
1305
1146
|
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
nstbrowser-ai-agent open https://example.com
|
|
1147
|
+
- `profile proxy show <name-or-id>`
|
|
1148
|
+
Best for: checking saved proxy configuration and the most recent proxy result.
|
|
1309
1149
|
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
```
|
|
1150
|
+
- `profile proxy update <name-or-id> --host <host> --port <port> [--type <type>] [--username <user>] [--password <pass>]`
|
|
1151
|
+
Best for: changing proxy settings without recreating the profile.
|
|
1313
1152
|
|
|
1314
|
-
|
|
1153
|
+
- `profile proxy reset <name-or-id> [name-or-id...]`
|
|
1154
|
+
Best for: removing custom proxy settings and returning to local/default routing.
|
|
1315
1155
|
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
export NST_PROFILE="my-profile"
|
|
1320
|
-
nstbrowser-ai-agent open https://example.com
|
|
1321
|
-
```
|
|
1156
|
+
- `profile tags list`, `profile tags create`, `profile tags update`, `profile tags clear`
|
|
1157
|
+
Best for: organizing profiles for agent workflows such as `qa`, `smoke`, `proxy`, or `signup`.
|
|
1158
|
+
`profile tags create` automatically assigns a default tag color so you only need to provide the tag name.
|
|
1322
1159
|
|
|
1323
|
-
|
|
1160
|
+
- `profile groups list`, `profile groups change <group-id> <name-or-id> [name-or-id...]`
|
|
1161
|
+
Best for: finding valid group IDs and moving profiles into the right NST group.
|
|
1324
1162
|
|
|
1325
|
-
|
|
1326
|
-
# With default NST provider (NST_API_KEY set), no 'nst' prefix needed:
|
|
1327
|
-
nstbrowser-ai-agent profile list # List all profiles
|
|
1328
|
-
nstbrowser-ai-agent profile create myprofile \ # Create new profile
|
|
1329
|
-
--proxy-host 127.0.0.1 --proxy-port 1080 --proxy-enabled
|
|
1163
|
+
### Browser Commands
|
|
1330
1164
|
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
nstbrowser-ai-agent nst profile create myprofile \
|
|
1334
|
-
--proxy-host 127.0.0.1 --proxy-port 1080 --proxy-enabled
|
|
1165
|
+
- `browser list`
|
|
1166
|
+
Best for: seeing which profile browsers or temporary browsers are already running.
|
|
1335
1167
|
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1168
|
+
- `browser start <name-or-id> [--headless] [--auto-close]`
|
|
1169
|
+
Best for: starting a known profile explicitly before automation.
|
|
1170
|
+
`--headless` requests headless launch.
|
|
1171
|
+
`--auto-close` asks NST to close that browser automatically when the owner exits.
|
|
1339
1172
|
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
nstbrowser-ai-agent profile tags list
|
|
1173
|
+
- `browser pages <name-or-id>`
|
|
1174
|
+
Best for: listing debuggable pages for one running browser.
|
|
1343
1175
|
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
nstbrowser-ai-agent profile groups change group-id profile-123
|
|
1176
|
+
- `browser debugger <name-or-id>`
|
|
1177
|
+
Best for: getting the debugger port and browser WebSocket endpoint.
|
|
1347
1178
|
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
nstbrowser-ai-agent profile list-cursor --cursor "token" --page-size 50
|
|
1179
|
+
- `browser cdp-url <name-or-id>`
|
|
1180
|
+
Best for: fetching only the browser-level CDP WebSocket URL.
|
|
1351
1181
|
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
nstbrowser-ai-agent profile cookies clear profile-123
|
|
1182
|
+
- `browser connect <name-or-id>`
|
|
1183
|
+
Best for: starting a browser if needed and immediately returning connection details.
|
|
1355
1184
|
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
```
|
|
1185
|
+
- `browser start-once [--platform <platform>] [--kernel <kernel>] [--headless] [--auto-close]`
|
|
1186
|
+
Best for: throwaway work that should not reuse a saved profile.
|
|
1359
1187
|
|
|
1360
|
-
|
|
1188
|
+
- `browser cdp-url-once`
|
|
1189
|
+
Best for: getting the temporary browser CDP WebSocket URL without first naming a profile.
|
|
1361
1190
|
|
|
1362
|
-
|
|
1191
|
+
- `browser connect-once [--platform <platform>] [--kernel <kernel>]`
|
|
1192
|
+
Best for: one command that creates a temporary browser and returns connection details.
|
|
1363
1193
|
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
nstbrowser-ai-agent --profile my-profile open example.com
|
|
1367
|
-
nstbrowser-ai-agent browser start proxy_ph
|
|
1194
|
+
- `browser stop <name-or-id>` and `browser stop-all`
|
|
1195
|
+
Best for: cleanup when a profile browser or once browser should be stopped.
|
|
1368
1196
|
|
|
1369
|
-
|
|
1370
|
-
nstbrowser-ai-agent --profile ef2b083a-8f77-4a7f-8441-a8d56bbd832b open example.com
|
|
1371
|
-
nstbrowser-ai-agent browser start ef2b083a-8f77-4a7f-8441-a8d56bbd832b
|
|
1197
|
+
### Environment and Repair Commands
|
|
1372
1198
|
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
```
|
|
1199
|
+
- `nst status`
|
|
1200
|
+
Best for: checking whether the local Nstbrowser service is reachable at all.
|
|
1376
1201
|
|
|
1377
|
-
|
|
1202
|
+
- `verify <name-or-id>` or `verify --profile <name-or-id>`
|
|
1203
|
+
Best for: smoke-testing one profile before a real task.
|
|
1204
|
+
Result: verifies NST reachability, profile resolution, browser start, and a simple navigation path.
|
|
1378
1205
|
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
nstbrowser-ai-agent browser debugger profile-123 # Get debugger URL
|
|
1388
|
-
nstbrowser-ai-agent browser cdp-url profile-123 # Get CDP WebSocket URL
|
|
1389
|
-
nstbrowser-ai-agent browser cdp-url-once # Get CDP URL for temp browser
|
|
1390
|
-
nstbrowser-ai-agent browser connect profile-123 # Connect and get CDP URL
|
|
1391
|
-
nstbrowser-ai-agent browser connect-once # Connect to temp browser
|
|
1392
|
-
|
|
1393
|
-
# Traditional explicit syntax still works:
|
|
1394
|
-
nstbrowser-ai-agent nst browser list
|
|
1395
|
-
nstbrowser-ai-agent nst browser start profile-123
|
|
1396
|
-
nstbrowser-ai-agent nst browser stop profile-123
|
|
1397
|
-
nstbrowser-ai-agent nst browser stop-all
|
|
1398
|
-
```
|
|
1399
|
-
|
|
1400
|
-
**Environment Variables:**
|
|
1401
|
-
|
|
1402
|
-
<table>
|
|
1403
|
-
<thead>
|
|
1404
|
-
<tr>
|
|
1405
|
-
<th>Variable</th>
|
|
1406
|
-
<th>Description</th>
|
|
1407
|
-
<th>Default</th>
|
|
1408
|
-
</tr>
|
|
1409
|
-
</thead>
|
|
1410
|
-
<tbody>
|
|
1411
|
-
<tr>
|
|
1412
|
-
<td><code>NST_API_KEY</code></td>
|
|
1413
|
-
<td>Nstbrowser API key (required)</td>
|
|
1414
|
-
<td>(none)</td>
|
|
1415
|
-
</tr>
|
|
1416
|
-
<tr>
|
|
1417
|
-
<td><code>NST_HOST</code></td>
|
|
1418
|
-
<td>Nstbrowser API host</td>
|
|
1419
|
-
<td><code>localhost</code></td>
|
|
1420
|
-
</tr>
|
|
1421
|
-
<tr>
|
|
1422
|
-
<td><code>NST_PORT</code></td>
|
|
1423
|
-
<td>Nstbrowser API port</td>
|
|
1424
|
-
<td><code>8848</code></td>
|
|
1425
|
-
</tr>
|
|
1426
|
-
|
|
1427
|
-
</tbody>
|
|
1428
|
-
</table>
|
|
1429
|
-
|
|
1430
|
-
**Features:**
|
|
1431
|
-
|
|
1432
|
-
- **Advanced Fingerprinting**: Customize browser fingerprints to avoid detection
|
|
1433
|
-
- **Profile Management**: Create and manage multiple browser profiles with different configurations
|
|
1434
|
-
- **Proxy Support**: Configure proxies per profile with authentication
|
|
1435
|
-
- **Tag System**: Organize profiles with tags for easy management
|
|
1436
|
-
- **Group Management**: Organize profiles into groups
|
|
1437
|
-
- **Local Execution**: Runs locally on your machine, no cloud dependency
|
|
1438
|
-
- **Batch Operations**: Perform operations on multiple profiles simultaneously
|
|
1439
|
-
|
|
1440
|
-
**Requirements:**
|
|
1441
|
-
|
|
1442
|
-
- Nstbrowser client must be installed and running
|
|
1443
|
-
- API key from Nstbrowser dashboard
|
|
1444
|
-
- Local network access to Nstbrowser API (default: localhost:8848)
|
|
1445
|
-
|
|
1446
|
-
When enabled, nstbrowser-ai-agent connects to your local Nstbrowser instance via CDP. All standard nstbrowser-ai-agent commands work identically, with the added benefit of Nstbrowser's anti-detection features.
|
|
1206
|
+
- `repair`
|
|
1207
|
+
Best for: recovering from stale or inconsistent NST state.
|
|
1208
|
+
Result: runs automatic cleanup and returns a task-by-task result map.
|
|
1209
|
+
|
|
1210
|
+
Important:
|
|
1211
|
+
- `--profile` accepts either a profile name or UUID.
|
|
1212
|
+
- A new profile name can be auto-created on first browser use.
|
|
1213
|
+
- Only `NST_API_KEY`, `NST_HOST`, and `NST_PORT` are documented for NST connectivity.
|
|
1447
1214
|
|
|
1448
1215
|
## Troubleshooting
|
|
1449
1216
|
|
|
@@ -1451,11 +1218,16 @@ If you encounter issues:
|
|
|
1451
1218
|
|
|
1452
1219
|
**Quick Diagnostic Commands:**
|
|
1453
1220
|
```bash
|
|
1454
|
-
#
|
|
1455
|
-
nstbrowser-ai-agent
|
|
1221
|
+
# Check NST desktop connection
|
|
1222
|
+
nstbrowser-ai-agent nst status
|
|
1223
|
+
|
|
1224
|
+
# Confirm profile access
|
|
1225
|
+
nstbrowser-ai-agent profile list
|
|
1456
1226
|
|
|
1457
1227
|
# Test browser functionality
|
|
1458
|
-
nstbrowser-ai-agent verify [
|
|
1228
|
+
nstbrowser-ai-agent verify [name-or-id]
|
|
1229
|
+
# Also supported:
|
|
1230
|
+
nstbrowser-ai-agent verify --profile <name-or-id>
|
|
1459
1231
|
|
|
1460
1232
|
# Attempt automatic fixes
|
|
1461
1233
|
nstbrowser-ai-agent repair
|