nstbrowser-ai-agent 0.0.4 → 0.0.6
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 +80 -57
- 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 +9 -9
- package/dist/actions.js.map +1 -1
- package/dist/browser-profile-resolver.d.ts +16 -16
- package/dist/browser-profile-resolver.d.ts.map +1 -1
- package/dist/browser-profile-resolver.js +47 -43
- package/dist/browser-profile-resolver.js.map +1 -1
- package/dist/browser.d.ts +5 -7
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +58 -42
- package/dist/browser.js.map +1 -1
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +5 -0
- package/dist/daemon.js.map +1 -1
- package/dist/nstbrowser-client.d.ts +4 -0
- package/dist/nstbrowser-client.d.ts.map +1 -1
- package/dist/nstbrowser-client.js +15 -0
- package/dist/nstbrowser-client.js.map +1 -1
- package/dist/types.d.ts +1 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/update-checker.d.ts +29 -0
- package/dist/update-checker.d.ts.map +1 -0
- package/dist/update-checker.js +230 -0
- package/dist/update-checker.js.map +1 -0
- package/package.json +1 -1
- package/skills/nstbrowser-ai-agent/SECURITY.md +72 -0
- package/skills/nstbrowser-ai-agent/SKILL.md +94 -56
- package/skills/nstbrowser-ai-agent/skill.json +60 -0
package/README.md
CHANGED
|
@@ -46,6 +46,9 @@ export NST_API_KEY="YOUR_API_KEY"
|
|
|
46
46
|
Test your configuration:
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
|
+
# Check if NST agent is running
|
|
50
|
+
nstbrowser-ai-agent nst status
|
|
51
|
+
|
|
49
52
|
# Check CLI version
|
|
50
53
|
nstbrowser-ai-agent --version
|
|
51
54
|
|
|
@@ -82,7 +85,6 @@ For projects that want to pin the version in `package.json`:
|
|
|
82
85
|
|
|
83
86
|
```bash
|
|
84
87
|
npm install nstbrowser-ai-agent
|
|
85
|
-
npx nstbrowser-ai-agent install
|
|
86
88
|
```
|
|
87
89
|
|
|
88
90
|
Then use via `npx` or `package.json` scripts:
|
|
@@ -112,11 +114,6 @@ You can also download pre-built binaries directly from [GitHub Releases](https:/
|
|
|
112
114
|
sudo mv nstbrowser-ai-agent-* /usr/local/bin/nstbrowser-ai-agent
|
|
113
115
|
```
|
|
114
116
|
|
|
115
|
-
4. Download Chromium:
|
|
116
|
-
```bash
|
|
117
|
-
nstbrowser-ai-agent install
|
|
118
|
-
```
|
|
119
|
-
|
|
120
117
|
### From Source
|
|
121
118
|
|
|
122
119
|
```bash
|
|
@@ -126,18 +123,50 @@ pnpm install
|
|
|
126
123
|
pnpm build
|
|
127
124
|
pnpm build:native # Requires Rust (https://rustup.rs)
|
|
128
125
|
pnpm link --global # Makes nstbrowser-ai-agent available globally
|
|
129
|
-
nstbrowser-ai-agent install
|
|
130
126
|
```
|
|
131
127
|
|
|
132
|
-
|
|
128
|
+
## Updates
|
|
129
|
+
|
|
130
|
+
### Automatic Update Checks
|
|
133
131
|
|
|
134
|
-
|
|
132
|
+
The CLI automatically checks for updates once every 24 hours and notifies you when a new version is available.
|
|
135
133
|
|
|
134
|
+
**Disable automatic checks:**
|
|
136
135
|
```bash
|
|
137
|
-
|
|
138
|
-
# or manually: npx playwright install-deps chromium
|
|
136
|
+
export NSTBROWSER_AI_AGENT_NO_UPDATE_CHECK=1
|
|
139
137
|
```
|
|
140
138
|
|
|
139
|
+
### Manual Update Check
|
|
140
|
+
|
|
141
|
+
Check for updates manually:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Human-readable output
|
|
145
|
+
nstbrowser-ai-agent update check
|
|
146
|
+
|
|
147
|
+
# JSON output
|
|
148
|
+
nstbrowser-ai-agent update check --json
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Updating
|
|
152
|
+
|
|
153
|
+
When an update is available:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# If installed globally
|
|
157
|
+
npm install -g nstbrowser-ai-agent@latest
|
|
158
|
+
|
|
159
|
+
# If using npx
|
|
160
|
+
npx nstbrowser-ai-agent@latest
|
|
161
|
+
|
|
162
|
+
# If installed locally in project
|
|
163
|
+
npm install nstbrowser-ai-agent@latest
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Linux Dependencies
|
|
167
|
+
|
|
168
|
+
The tool uses Nstbrowser by default, which handles browser management automatically. No additional dependencies are required.
|
|
169
|
+
|
|
141
170
|
## Quick Start Examples
|
|
142
171
|
|
|
143
172
|
### Using Temporary Browser (Fastest)
|
|
@@ -210,42 +239,33 @@ When you specify a profile for a browser action, the system follows these rules:
|
|
|
210
239
|
- Otherwise creates a new temporary browser
|
|
211
240
|
- Temporary browsers don't persist session data
|
|
212
241
|
|
|
213
|
-
####
|
|
242
|
+
#### UUID Format Auto-Detection
|
|
214
243
|
|
|
215
|
-
|
|
244
|
+
**Important:** The system automatically detects UUID format in profile names and treats them as profile IDs.
|
|
216
245
|
|
|
217
|
-
**1. Environment Variables (Global Default)**
|
|
218
246
|
```bash
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
export NST_PROFILE_ID="abc-123-def" # Use profile ID
|
|
222
|
-
|
|
223
|
-
# All browser actions will use this profile
|
|
224
|
-
nstbrowser-ai-agent open https://example.com
|
|
225
|
-
nstbrowser-ai-agent click "#button"
|
|
247
|
+
# UUID format is automatically detected and treated as profile ID:
|
|
248
|
+
nstbrowser-ai-agent open https://example.com --profile "ef2b083a-8f77-4a7f-8441-a8d56bbd832b"
|
|
226
249
|
```
|
|
227
250
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
251
|
+
This means:
|
|
252
|
+
- You can use `--profile` with either names or IDs
|
|
253
|
+
- UUID format (8-4-4-4-12 hex digits) is automatically recognized
|
|
254
|
+
- Case-insensitive: both lowercase and uppercase UUIDs work
|
|
255
|
+
- Prevents accidental profile creation when you meant to use an ID
|
|
233
256
|
|
|
234
|
-
|
|
235
|
-
nstbrowser-ai-agent open https://example.com --nst-profile-id "abc-123-def"
|
|
236
|
-
nstbrowser-ai-agent fill "#email" "test@test.com" --nst-profile-id "abc-123-def"
|
|
237
|
-
```
|
|
257
|
+
#### Specifying Profiles
|
|
238
258
|
|
|
239
|
-
|
|
240
|
-
```bash
|
|
241
|
-
# Set default profile
|
|
242
|
-
export NST_PROFILE="default-profile"
|
|
259
|
+
Use the `--profile` flag to specify which profile to use:
|
|
243
260
|
|
|
244
|
-
|
|
245
|
-
|
|
261
|
+
```bash
|
|
262
|
+
# By profile name
|
|
263
|
+
nstbrowser-ai-agent open https://example.com --profile "my-profile"
|
|
264
|
+
nstbrowser-ai-agent click "#button" --profile "my-profile"
|
|
246
265
|
|
|
247
|
-
#
|
|
248
|
-
nstbrowser-ai-agent
|
|
266
|
+
# By profile ID (UUID format auto-detected)
|
|
267
|
+
nstbrowser-ai-agent open https://example.com --profile "ef2b083a-8f77-4a7f-8441-a8d56bbd832b"
|
|
268
|
+
nstbrowser-ai-agent fill "#email" "test@test.com" --profile "abc-123-def-456"
|
|
249
269
|
```
|
|
250
270
|
|
|
251
271
|
#### Examples
|
|
@@ -253,8 +273,8 @@ nstbrowser-ai-agent click "#button" --nst-profile "other-profile"
|
|
|
253
273
|
**Auto-create profile on first use:**
|
|
254
274
|
```bash
|
|
255
275
|
# This will create "test-profile" if it doesn't exist
|
|
256
|
-
nstbrowser-ai-agent open https://example.com --
|
|
257
|
-
nstbrowser-ai-agent click "#login" --
|
|
276
|
+
nstbrowser-ai-agent open https://example.com --profile "test-profile"
|
|
277
|
+
nstbrowser-ai-agent click "#login" --profile "test-profile"
|
|
258
278
|
```
|
|
259
279
|
|
|
260
280
|
**Use existing profile by ID:**
|
|
@@ -262,17 +282,17 @@ nstbrowser-ai-agent click "#login" --nst-profile "test-profile"
|
|
|
262
282
|
# List profiles to find ID
|
|
263
283
|
nstbrowser-ai-agent profile list
|
|
264
284
|
|
|
265
|
-
# Use specific profile ID
|
|
266
|
-
nstbrowser-ai-agent open https://example.com --
|
|
285
|
+
# Use specific profile ID (UUID format auto-detected)
|
|
286
|
+
nstbrowser-ai-agent open https://example.com --profile "abc-123-def-456-789"
|
|
267
287
|
```
|
|
268
288
|
|
|
269
289
|
**Reuse running browser:**
|
|
270
290
|
```bash
|
|
271
291
|
# Start a browser with a profile
|
|
272
|
-
nstbrowser-ai-agent open https://example.com --
|
|
292
|
+
nstbrowser-ai-agent open https://example.com --profile "my-profile"
|
|
273
293
|
|
|
274
294
|
# Later commands automatically connect to the same running browser
|
|
275
|
-
nstbrowser-ai-agent click "#button" --
|
|
295
|
+
nstbrowser-ai-agent click "#button" --profile "my-profile"
|
|
276
296
|
# No restart needed - uses existing browser!
|
|
277
297
|
```
|
|
278
298
|
|
|
@@ -522,13 +542,6 @@ nstbrowser-ai-agent forward # Go forward
|
|
|
522
542
|
nstbrowser-ai-agent reload # Reload page
|
|
523
543
|
```
|
|
524
544
|
|
|
525
|
-
### Setup
|
|
526
|
-
|
|
527
|
-
```bash
|
|
528
|
-
nstbrowser-ai-agent install # Download Chromium browser
|
|
529
|
-
nstbrowser-ai-agent install --with-deps # Also install system deps (Linux)
|
|
530
|
-
```
|
|
531
|
-
|
|
532
545
|
## Sessions
|
|
533
546
|
|
|
534
547
|
Run multiple isolated browser instances:
|
|
@@ -586,6 +599,20 @@ Configuration is stored in `~/.nst-ai-agent/config.json` and takes priority over
|
|
|
586
599
|
|
|
587
600
|
**Priority order:** Config file > Environment variables > Defaults
|
|
588
601
|
|
|
602
|
+
### Check NST Agent Status
|
|
603
|
+
|
|
604
|
+
Verify that NST agent is running and responsive:
|
|
605
|
+
|
|
606
|
+
```bash
|
|
607
|
+
# Check NST agent status
|
|
608
|
+
nstbrowser-ai-agent nst status
|
|
609
|
+
|
|
610
|
+
# JSON output
|
|
611
|
+
nstbrowser-ai-agent nst status --json
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
This command uses the `/api/agent/agent/info` endpoint to verify the NST service is accessible.
|
|
615
|
+
|
|
589
616
|
## Persistent Profiles
|
|
590
617
|
|
|
591
618
|
By default, browser state (cookies, localStorage, login sessions) is ephemeral and lost when the browser closes. Use `--profile` to persist state across browser restarts:
|
|
@@ -1244,7 +1271,7 @@ For more consistent results, add to your project or global instructions file:
|
|
|
1244
1271
|
Use `nstbrowser-ai-agent` for web automation. Run `nstbrowser-ai-agent --help` for all commands.
|
|
1245
1272
|
|
|
1246
1273
|
Core workflow:
|
|
1247
|
-
1.
|
|
1274
|
+
1. Use profile: `--profile "my-profile"` or use `browser start-once` for temporary browser
|
|
1248
1275
|
2. `nstbrowser-ai-agent open <url>` - Navigate to page
|
|
1249
1276
|
3. `nstbrowser-ai-agent snapshot -i` - Get interactive elements with refs (@e1, @e2)
|
|
1250
1277
|
4. `nstbrowser-ai-agent click @e1` / `fill @e2 "text"` - Interact using refs
|
|
@@ -1396,11 +1423,7 @@ nstbrowser-ai-agent nst browser stop-all
|
|
|
1396
1423
|
<td>Nstbrowser API port</td>
|
|
1397
1424
|
<td><code>8848</code></td>
|
|
1398
1425
|
</tr>
|
|
1399
|
-
|
|
1400
|
-
<td><code>NST_PROFILE</code></td>
|
|
1401
|
-
<td>Profile name for provider=nst launch</td>
|
|
1402
|
-
<td>(none)</td>
|
|
1403
|
-
</tr>
|
|
1426
|
+
|
|
1404
1427
|
</tbody>
|
|
1405
1428
|
</table>
|
|
1406
1429
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/actions.js
CHANGED
|
@@ -138,15 +138,11 @@ export async function executeCommand(command, browser) {
|
|
|
138
138
|
*/
|
|
139
139
|
async function ensureBrowserWithProfile(command, browser) {
|
|
140
140
|
const cmdWithProfile = command;
|
|
141
|
-
// Check if command has profile
|
|
142
|
-
const hasProfileSpec = !!cmdWithProfile.
|
|
143
|
-
!!cmdWithProfile.nstProfileId ||
|
|
144
|
-
!!process.env.NST_PROFILE ||
|
|
145
|
-
!!process.env.NST_PROFILE_ID;
|
|
141
|
+
// Check if command has profile specification
|
|
142
|
+
const hasProfileSpec = !!cmdWithProfile.profile;
|
|
146
143
|
// Only proceed with profile resolution if:
|
|
147
144
|
// 1. Profile is explicitly specified in the command OR
|
|
148
|
-
// 2.
|
|
149
|
-
// 3. We're using NST provider (default or explicit)
|
|
145
|
+
// 2. We're using NST provider (default or explicit)
|
|
150
146
|
const provider = process.env.NSTBROWSER_AI_AGENT_PROVIDER;
|
|
151
147
|
const isNstProvider = !provider || provider === 'nst'; // Default is NST
|
|
152
148
|
if (!hasProfileSpec && !isNstProvider) {
|
|
@@ -182,8 +178,7 @@ async function ensureBrowserWithProfile(command, browser) {
|
|
|
182
178
|
id: command.id,
|
|
183
179
|
action: 'launch',
|
|
184
180
|
provider: 'nst',
|
|
185
|
-
|
|
186
|
-
nstProfileName: resolved.profileName,
|
|
181
|
+
profile: cmdWithProfile.profile,
|
|
187
182
|
});
|
|
188
183
|
}
|
|
189
184
|
catch (error) {
|
|
@@ -193,6 +188,11 @@ async function ensureBrowserWithProfile(command, browser) {
|
|
|
193
188
|
throw error;
|
|
194
189
|
}
|
|
195
190
|
}
|
|
191
|
+
// CRITICAL FIX: After launching NST browser, ensure at least one page exists
|
|
192
|
+
// NST browsers may connect with 0 pages initially, so we need to create one
|
|
193
|
+
if (!browser.hasPages()) {
|
|
194
|
+
await browser.ensurePage();
|
|
195
|
+
}
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
198
198
|
* Dispatch a command to its handler after policy checks have passed.
|