@generativereality/browser-automation 0.4.7 → 0.4.9

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.7",
4
+ "version": "0.4.9",
5
5
  "author": {
6
6
  "name": "generativereality"
7
7
  },
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import updateNotifier from "update-notifier";
2
3
  import { cli, define } from "gunshi";
3
4
  import { consola } from "consola";
4
5
  import { homedir } from "node:os";
@@ -7,8 +8,63 @@ import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, s
7
8
  import { execFileSync, spawnSync } from "node:child_process";
8
9
  import { fileURLToPath } from "node:url";
9
10
  //#region package.json
10
- var version = "0.4.7";
11
+ var name = "@generativereality/browser-automation";
12
+ var version = "0.4.9";
11
13
  var description = "Daemonless, per-tab-isolated browser automation CLI for Claude Code. Drives one shared headed Chrome (persistent profile + extensions) over per-target CDP — many parallel sessions, no focus stealing, nothing long-lived to crash.";
14
+ var package_default = {
15
+ name,
16
+ version,
17
+ description,
18
+ type: "module",
19
+ bin: { "browser-automation": "dist/index.js" },
20
+ files: [
21
+ "dist",
22
+ ".claude-plugin",
23
+ "skills",
24
+ "scripts"
25
+ ],
26
+ scripts: {
27
+ "dev": "bun run ./src/index.ts",
28
+ "build": "tsdown",
29
+ "typecheck": "tsc --noEmit",
30
+ "check": "npm run typecheck && bash scripts/check-one-port.sh && npm run build",
31
+ "release": "bumpp && npm publish",
32
+ "sync-plugin": "bash scripts/sync-plugin.sh",
33
+ "prepack": "npm run build"
34
+ },
35
+ keywords: [
36
+ "claude-code",
37
+ "browser-automation",
38
+ "cdp",
39
+ "chrome-devtools-protocol",
40
+ "playwright-alternative",
41
+ "ai-agents"
42
+ ],
43
+ author: "motin",
44
+ license: "MIT",
45
+ repository: {
46
+ "type": "git",
47
+ "url": "git+https://github.com/generativereality/browser-automation.git"
48
+ },
49
+ homepage: "https://github.com/generativereality/browser-automation",
50
+ engines: { "node": ">=22.0.0" },
51
+ publishConfig: {
52
+ "registry": "https://registry.npmjs.org",
53
+ "access": "public"
54
+ },
55
+ dependencies: {
56
+ "consola": "^3.4.0",
57
+ "gunshi": "^0.23.0",
58
+ "update-notifier": "^7.3.1"
59
+ },
60
+ devDependencies: {
61
+ "@types/node": "^22.0.0",
62
+ "@types/update-notifier": "^6.0.8",
63
+ "bumpp": "^9.11.1",
64
+ "tsdown": "^0.12.0",
65
+ "typescript": "^5.8.0"
66
+ }
67
+ };
12
68
  //#endregion
13
69
  //#region src/core/session.ts
14
70
  const DIR = join(homedir(), ".browser-automation", "sessions");
@@ -2227,6 +2283,12 @@ process.stdout.on("error", (err) => {
2227
2283
  if (err.code === "EPIPE") process.exit(0);
2228
2284
  throw err;
2229
2285
  });
2286
+ const notifier = updateNotifier({ pkg: package_default });
2287
+ notifier.notify();
2288
+ if (notifier.update && notifier.update.latest !== notifier.update.current) {
2289
+ const { current, latest } = notifier.update;
2290
+ process.stdout.write(`[browser-automation] OUTDATED ${current} < ${latest} — run: npm install -g ${name}@latest\n`);
2291
+ }
2230
2292
  run().catch((err) => {
2231
2293
  console.error(err instanceof Error ? err.message : String(err));
2232
2294
  process.exit(1);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@generativereality/browser-automation",
3
- "version": "0.4.7",
4
- "description": "Daemonless, per-tab-isolated browser automation CLI for Claude Code. Drives one shared headed Chrome (persistent profile + extensions) over per-target CDP \u2014 many parallel sessions, no focus stealing, nothing long-lived to crash.",
3
+ "version": "0.4.9",
4
+ "description": "Daemonless, per-tab-isolated browser automation CLI for Claude Code. Drives one shared headed Chrome (persistent profile + extensions) over per-target CDP — many parallel sessions, no focus stealing, nothing long-lived to crash.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "browser-automation": "dist/index.js"
@@ -45,10 +45,12 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "consola": "^3.4.0",
48
- "gunshi": "^0.23.0"
48
+ "gunshi": "^0.23.0",
49
+ "update-notifier": "^7.3.1"
49
50
  },
50
51
  "devDependencies": {
51
52
  "@types/node": "^22.0.0",
53
+ "@types/update-notifier": "^6.0.8",
52
54
  "bumpp": "^9.11.1",
53
55
  "tsdown": "^0.12.0",
54
56
  "typescript": "^5.8.0"
@@ -136,12 +136,47 @@ There's no `state-save`/`state-load` to manage — the profile *is* the auth sto
136
136
 
137
137
  - **Refs go stale after any DOM change**, not just navigation. Snapshot → use
138
138
  those refs for one action → re-snapshot. "ref not found" means re-snapshot.
139
- - **`isTrusted` / synthetic events.** Clicks and fills are JS-dispatched, so a
140
- small number of hard anti-bot or payment widgets that demand trusted events
141
- may ignore them. For fills, pass `--native` to drive character insertion
142
- through CDP `Input.insertText` instead — that fires real (trusted)
143
- `beforeinput`/`input` events. For clicks, escalate to a foregrounded
144
- native-input path or have the user do that one step manually.
139
+ - **`isTrusted` / synthetic events.** Clicks and fills are JS-dispatched by
140
+ default, so widgets that demand trusted events ignore them. **For clicks, pass
141
+ `--trusted`** — it dispatches a real CDP `Input.dispatchMouseEvent`, brings the
142
+ tab to front, waits for it to be focused+visible (CDP input no-ops on a
143
+ backgrounded tab) and waits for the element to be actionable (stable position +
144
+ unoccluded hit-test) before pressing. For fills, pass `--native` to drive
145
+ character insertion through CDP `Input.insertText`, which fires real
146
+ `beforeinput`/`input` events.
147
+ **Reach for `--trusted` the moment a click "succeeds" but nothing happens** —
148
+ the CLI prints `✔ clicked e7` on a dispatched event regardless of whether the
149
+ widget reacted, so a silent no-op is the signature, not an error. Canonical
150
+ cases: LinkedIn artdeco dropdown items, Radix dropdowns/popovers, cmdk
151
+ comboboxes, and **framework-state form widgets whose inputs are `readonly` with
152
+ no `name`** (Viking Line's booking selectors — the visible fields are display
153
+ shells; the real state lives in the framework, so `fill` and DOM value-setting
154
+ do nothing at all).
155
+ **Do NOT hand-roll a raw-CDP trusted click.** Burned 2026-08-22: wrote a
156
+ bespoke `Input.dispatchMouseEvent` helper for exactly this, and it clicked
157
+ stale coordinates (the panel had animated in) — `--trusted` already solves that
158
+ with the actionability wait. Check `browser-automation click --help` before
159
+ building anything.
160
+ **A form can swallow a dispatched click and submit itself the wrong way.**
161
+ npmjs.com's package-settings forms are the case (2026-08-22): a default click
162
+ on the submit button did not reach the framework's handler, so the browser fell
163
+ through to a plain native POST and the tab was replaced by a raw
164
+ `{"message":"Not Found"}` — no error from the CLI, and nothing saved. It looks
165
+ like the server rejected your data; it did not. `--trusted` submitted the same
166
+ form correctly. On any settings page, verify by reloading and re-reading the
167
+ saved state rather than trusting a click that "worked".
168
+ - **WebAuthn / security keys need a genuinely focused, visible tab, and you
169
+ cannot supply the touch.** `navigator.credentials.get()` refuses outright when
170
+ `document.hasFocus()` is false or `visibilityState` is `hidden` — which is the
171
+ normal state while you work in the terminal, since `--trusted` only fronts the
172
+ tab for the instant of the click. The prompt then never opens and the page just
173
+ sits there, so a 2FA step can look like it is waiting for the user when the
174
+ browser has already declined to ask. Measured 2026-08-22 on npm's
175
+ `Use security key` challenge: the form POST returned **200** and the challenge
176
+ was live, but it could only be satisfied once the user brought that Chrome
177
+ window to the front themselves. Check with
178
+ `eval '({f:document.hasFocus(),v:document.visibilityState})'` before concluding
179
+ anything, and hand hardware-2FA steps to the user with the window frontmost.
145
180
  - **Controlled-form state stickiness.** Form libraries that subscribe to React's
146
181
  internal value-setter (React Hook Form, Final Form, Formik with a `Controller`,
147
182
  Blocket/finn.no's `recommerce` editor) sometimes ignore the synthetic `input`