@generativereality/browser-automation 0.4.5 → 0.4.7

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "browser-automation",
3
3
  "description": "Daemonless, per-tab-isolated browser automation for Claude Code via the `browser-automation` CLI. Drives one shared headed Chrome (persistent profile + extensions) over per-target CDP — many parallel sessions, no focus stealing, nothing long-lived to crash.",
4
- "version": "0.4.5",
4
+ "version": "0.4.7",
5
5
  "author": {
6
6
  "name": "generativereality"
7
7
  },
package/README.md CHANGED
@@ -35,8 +35,8 @@ long-lived process**:
35
35
 
36
36
  ```bash
37
37
  npm install -g @generativereality/browser-automation
38
- browser-automation launch # start the canonical Chrome on :9223 (idempotent)
39
- browser-automation doctor # verify
38
+ browser-automation launch # start this user's Chrome (idempotent)
39
+ browser-automation doctor # verify (incl. renderer capacity)
40
40
  ```
41
41
 
42
42
  Claude Code skill (so the agent knows how to use it):
@@ -92,8 +92,9 @@ browser-automation bind -s bank -m nordnet # …or adopt it into a session
92
92
 
93
93
  | Command | What it does |
94
94
  |---|---|
95
- | `launch [--status]` | Start the canonical headed Chrome on :9223 (idempotent) |
96
- | `doctor` | Diagnose Node, Chrome, targets, sessions |
95
+ | `launch [--status]` | Start this user's headed Chrome (idempotent) |
96
+ | `doctor` | Diagnose Node, Chrome, targets, sessions — and **renderer capacity** (a browser that can no longer launch renderers passes every other check) |
97
+ | `gc` | Prune stale session bookmarks and dead tabs (`--dry` to preview, `--orphans` to also close unclaimed live tabs) |
97
98
  | `list` | List sessions and every open tab (id, title, url) |
98
99
  | `new -s <s> [url]` | Open a background tab for a session |
99
100
  | `goto (-s\|-m\|-t) <url>` | Navigate (session tab created if needed) |
@@ -106,6 +107,7 @@ browser-automation bind -s bank -m nordnet # …or adopt it into a session
106
107
  | `download (-s\|-m\|-t) (--click <ref>\|--url <href>)` | Capture a file/CSV download, wait for completion, print the path |
107
108
  | `setfiles (-s\|-m\|-t) <ref> <path…>` | Set files on a known `<input type=file>` by ref (fires input/change) |
108
109
  | `upload (-s\|-m\|-t) --click <ref> <path…>` | Upload via a button that opens a file chooser (transient/custom inputs) |
110
+ | `drop (-s\|-m\|-t) [--js] <ref> <path…>` | Drop file(s) onto a drag-and-drop zone by ref (trusted CDP drag by default; `--js` for a synthetic drop) |
109
111
  | `network (-s\|-m\|-t) [--reload\|--click\|--nav] [--filter --headers --body]` | Capture network requests (find the API, headers, response bodies) |
110
112
  | `screenshot (-s\|-m\|-t) [--full] [-o path]` | Save a PNG screenshot (viewport or full page) |
111
113
  | `close (-s\|-m\|-t) [--tab]` | Forget the session (tab stays open); `--tab` also closes the browser tab |
@@ -139,12 +141,38 @@ same one-action-per-snapshot rule as Playwright refs.
139
141
  re-snapshot/screenshot and don't blindly retry:** the file may stage as a row in
140
142
  an attachment *list* (not a single chip), and each successful run adds another
141
143
  attachment, so retrying can silently create duplicates.
144
+ - **Drag-and-drop upload** is a third path, for zones with no `<input type=file>`
145
+ at all — a `drop` listener reading `e.dataTransfer.files` (vocalremover-style
146
+ audio tools, many image/video drop zones). `drop <ref> <path…>` fires a
147
+ genuinely-**trusted** CDP drag (`Input.dispatchDragEvent`) carrying the real
148
+ files from disk: it force-fronts the tab (bringToFront + focus emulation +
149
+ active lifecycle, so the renderer reports focused+visible even when the Chrome
150
+ window is occluded), waits for the zone to be actionable, then
151
+ dragEnter→dragOver→drop — same discipline as `click --trusted`. The force-front
152
+ matters because drop-zone uploaders often act only inside a **user activation**,
153
+ which CDP input can't grant on a tab the renderer considers `hidden`
154
+ (vocalremover.org is the canonical case). `--js` instead dispatches a synthetic
155
+ (isTrusted=false) `DataTransfer` drop without force-fronting/stealing focus, for
156
+ zones that accept synthetic events. The `<ref>` is any snapshot element over the
157
+ drop region — the drop bubbles to the zone/document handler, so a heading or
158
+ button inside the zone works even when the zone div itself isn't
159
+ snapshot-interactive. After dropping, confirm with `read`/`screenshot` and pull
160
+ the result (often a `download --url` endpoint).
142
161
  - `launch` resolves Chrome on macOS/Linux; elsewhere start Chrome manually with
143
- `--remote-debugging-port=9223 --user-data-dir="<profile>"`.
162
+ `--remote-debugging-port=<your port> --user-data-dir="<profile>"` — `browser-automation doctor` prints the port.
144
163
 
145
164
  ## Environment
146
165
 
147
- - `BROWSER_AUTOMATION_CDP` — CDP host (default `http://localhost:9223`).
166
+ - `BROWSER_AUTOMATION_PORT` — the debugging port. **Defaults to one per user**,
167
+ not one per machine: `127.0.0.1` is machine-wide and CDP has no
168
+ authentication, so a single shared port means the first account to launch owns
169
+ it and every other account's automation silently drives *that* account's
170
+ browser — same-looking page loads, in somebody else's signed-in session.
171
+ **Run `browser-automation port` for yours** — the number is derived from your
172
+ uid, and this file deliberately does not restate the formula: prose that
173
+ repeats a rule is a copy of it, and goes stale the same way code does.
174
+ `doctor` prints it too, and warns if another user holds it.
175
+ - `BROWSER_AUTOMATION_CDP` — full CDP host, overriding the port entirely.
148
176
  - `BROWSER_AUTOMATION_PROFILE` — Chrome profile dir for `launch`.
149
177
  - `BAC_SESSION` — default session name for page commands.
150
178