agent-browser 0.8.8 → 0.8.10

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 CHANGED
@@ -77,7 +77,7 @@ agent-browser upload <sel> <files> # Upload files
77
77
  agent-browser screenshot [path] # Take screenshot (--full for full page, saves to a temporary directory if no path)
78
78
  agent-browser pdf <path> # Save as PDF
79
79
  agent-browser snapshot # Accessibility tree with refs (best for AI)
80
- agent-browser eval <js> # Run JavaScript
80
+ agent-browser eval <js> # Run JavaScript (-b for base64, --stdin for piped input)
81
81
  agent-browser connect <port> # Connect to browser via CDP
82
82
  agent-browser close # Close browser (aliases: quit, exit)
83
83
  ```
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  import { spawn } from 'child_process';
12
- import { existsSync } from 'fs';
12
+ import { existsSync, accessSync, chmodSync, constants } from 'fs';
13
13
  import { dirname, join } from 'path';
14
14
  import { fileURLToPath } from 'url';
15
15
  import { platform, arch } from 'os';
@@ -73,6 +73,23 @@ function main() {
73
73
  process.exit(1);
74
74
  }
75
75
 
76
+ // Ensure binary is executable (fixes EACCES on macOS/Linux when postinstall didn't run,
77
+ // e.g., when using bun which blocks lifecycle scripts by default)
78
+ if (platform() !== 'win32') {
79
+ try {
80
+ accessSync(binaryPath, constants.X_OK);
81
+ } catch {
82
+ // Binary exists but isn't executable - fix it
83
+ try {
84
+ chmodSync(binaryPath, 0o755);
85
+ } catch (chmodErr) {
86
+ console.error(`Error: Cannot make binary executable: ${chmodErr.message}`);
87
+ console.error('Try running: chmod +x ' + binaryPath);
88
+ process.exit(1);
89
+ }
90
+ }
91
+ }
92
+
76
93
  // Spawn the native binary with inherited stdio
77
94
  const child = spawn(binaryPath, process.argv.slice(2), {
78
95
  stdio: 'inherit',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-browser",
3
- "version": "0.8.8",
3
+ "version": "0.8.10",
4
4
  "description": "Headless browser automation CLI for AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/daemon.js",
@@ -189,14 +189,21 @@ agent-browser dialog dismiss # Dismiss dialog
189
189
 
190
190
  ```bash
191
191
  agent-browser eval "document.title" # Simple expressions only
192
- agent-browser eval -b "<base64>" # Any JavaScript (recommended)
192
+ agent-browser eval -b "<base64>" # Any JavaScript (base64 encoded)
193
+ agent-browser eval --stdin # Read script from stdin
193
194
  ```
194
195
 
195
- Use `-b`/`--base64` for reliable execution. Shell escaping with nested quotes and special characters is error-prone.
196
+ Use `-b`/`--base64` or `--stdin` for reliable execution. Shell escaping with nested quotes and special characters is error-prone.
196
197
 
197
198
  ```bash
198
199
  # Base64 encode your script, then:
199
200
  agent-browser eval -b "ZG9jdW1lbnQucXVlcnlTZWxlY3RvcignW3NyYyo9Il9uZXh0Il0nKQ=="
201
+
202
+ # Or use stdin with heredoc for multiline scripts:
203
+ cat <<'EOF' | agent-browser eval --stdin
204
+ const links = document.querySelectorAll('a');
205
+ Array.from(links).map(a => a.href);
206
+ EOF
200
207
  ```
201
208
 
202
209
  ## State Management