codex-browser-use 4.8.3 → 4.9.0
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 +5 -5
- package/bin/browser-use.js +67 -11
- package/extension/background.js +419 -137
- package/extension/manifest.json +2 -10
- package/package.json +2 -2
- package/rules/browser_use.md +6 -20
- package/skill/SKILL.md +7 -7
- package/skill/references/cookbook.md +3 -3
- package/src/ax-tree.js +63 -35
- package/src/backend-discovery.js +15 -8
- package/src/backend-native-driver.js +38 -12
- package/src/backend-tabs.js +93 -7
- package/src/backend-transport.js +3 -3
- package/src/bridge-browser.js +383 -113
- package/src/config.js +44 -11
- package/src/content-extractor.js +53 -19
- package/src/extension.js +6 -1
- package/src/install.js +243 -19
- package/src/locators.js +259 -36
- package/src/read-only.js +254 -52
- package/src/script-runner.js +199 -48
- package/src/server.js +64 -26
package/README.md
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
[](LICENSE)
|
|
14
14
|
[](https://www.npmjs.com/package/codex-browser-use)
|
|
15
15
|
[](https://codex-browser-use.vercel.app)
|
|
16
|
-
[](#quick-start)
|
|
17
|
+
[](#why-its-better)
|
|
18
|
+
[](#quick-start)
|
|
19
19
|
[](https://github.com/khanhle1406/codex-browser-use/stargazers)
|
|
20
20
|
|
|
21
21
|
[Website](https://codex-browser-use.vercel.app) · [Quick start](#quick-start) · [How it works](#how-it-works) · [What you can do](#what-you-can-do) · [Why it's better](#why-its-better) · [FAQ](#faq) · [Documentation](#documentation)
|
|
@@ -42,7 +42,7 @@ Setup takes one command. It installs a small Chrome extension, registers the loc
|
|
|
42
42
|
|
|
43
43
|
## Quick start
|
|
44
44
|
|
|
45
|
-
You need **Node.js
|
|
45
|
+
You need **Node.js 22 or newer**, npm, and Chrome (or Chromium, Edge, or Brave).
|
|
46
46
|
|
|
47
47
|
### Set up your agent
|
|
48
48
|
|
|
@@ -68,7 +68,7 @@ node mcp-server/bin/browser-use.js install --client antigravity --write --skill
|
|
|
68
68
|
node mcp-server/bin/browser-use.js doctor --json
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
`install --skill` copies the Chrome extension (`v0.
|
|
71
|
+
`install --skill` copies the Chrome extension (`v0.7.0`), registers the local Chrome Native Messaging host, writes your client's MCP config (saving a `.bak` backup first), installs the full skill bundle (`skill/SKILL.md` + `skill/references/cookbook.md` + `skill/references/tools.md`), and automatically installs the always-on rules file (`rules/browser_use.md`, or `.cursor/rules/browser_use.mdc` for Cursor) when supported (pass `--no-rules` to skip, or `--rules` standalone).
|
|
72
72
|
|
|
73
73
|
<details>
|
|
74
74
|
<summary><strong>Supported clients & tool profiles (<code>--profile auto | compact | standard | full</code>)</strong></summary>
|
package/bin/browser-use.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { realpathSync } from "node:fs";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { lstat, mkdir, unlink, writeFile } from "node:fs/promises";
|
|
4
|
+
import { access, lstat, mkdir, readFile, unlink, writeFile } from "node:fs/promises";
|
|
5
|
+
import { constants } from "node:fs";
|
|
5
6
|
import path from "node:path";
|
|
6
7
|
import { discoverEngine } from "../src/engine-discovery.js";
|
|
7
|
-
import { defaultBridgeFile, readBackend } from "../src/backend-discovery.js";
|
|
8
|
+
import { defaultBridgeFile, isSocketAlive, readBackend } from "../src/backend-discovery.js";
|
|
8
9
|
import { buildConfig, codexToml, normalizeClient } from "../src/config.js";
|
|
9
|
-
import { EXTENSION_ID } from "../src/extension.js";
|
|
10
|
-
import { configureClient, installExtension, installNativeHost, installRules, installSkill } from "../src/install.js";
|
|
10
|
+
import { EXTENSION_ID, EXTENSION_VERSION, HOST_NAME, installedExtensionDir, nativeHostLauncher } from "../src/extension.js";
|
|
11
|
+
import { configureClient, installExtension, installNativeHost, installRules, installSkill, nativeMessagingDirs, resolveRuntimePaths } from "../src/install.js";
|
|
11
12
|
|
|
12
13
|
export { buildConfig };
|
|
13
14
|
|
|
@@ -115,10 +116,21 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
115
116
|
const bridgeFile = path.resolve(options.bridgeFile ?? defaultBridgeFile());
|
|
116
117
|
|
|
117
118
|
if (options.command === "install") {
|
|
119
|
+
const runtime = await resolveRuntimePaths();
|
|
118
120
|
const extension = await installExtension();
|
|
119
|
-
const nativeHost = await installNativeHost({
|
|
121
|
+
const nativeHost = await installNativeHost({
|
|
122
|
+
extensionId: options.extensionId ?? EXTENSION_ID,
|
|
123
|
+
bridgeFile,
|
|
124
|
+
nativeHostPath: runtime.nativeHostEntry,
|
|
125
|
+
});
|
|
120
126
|
const client = options.client
|
|
121
|
-
? await configureClient({
|
|
127
|
+
? await configureClient({
|
|
128
|
+
client: options.client,
|
|
129
|
+
bridgeFile,
|
|
130
|
+
serverPath: runtime.serverPath,
|
|
131
|
+
profile: options.profile,
|
|
132
|
+
write: options.write,
|
|
133
|
+
})
|
|
122
134
|
: null;
|
|
123
135
|
const skill = options.skill
|
|
124
136
|
? await installSkill({ client: options.client ?? "generic" })
|
|
@@ -129,6 +141,7 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
129
141
|
: null;
|
|
130
142
|
const report = {
|
|
131
143
|
ok: true,
|
|
144
|
+
stagedRuntime: runtime.staged,
|
|
132
145
|
extension: { ...extension, loadUnpackedPath: extension.path },
|
|
133
146
|
nativeHost,
|
|
134
147
|
bridgeFile,
|
|
@@ -157,7 +170,12 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
157
170
|
if (client) {
|
|
158
171
|
if (client.written) process.stdout.write(`Updated ${client.file}\n`);
|
|
159
172
|
else {
|
|
160
|
-
|
|
173
|
+
const rendered = client.config
|
|
174
|
+
? (normalizeClient(options.client) === "codex"
|
|
175
|
+
? codexToml(client.config)
|
|
176
|
+
: `${JSON.stringify(client.config, null, 2)}\n`)
|
|
177
|
+
: "";
|
|
178
|
+
process.stdout.write(rendered);
|
|
161
179
|
process.stdout.write("Merge this fragment into the client's MCP settings.\n");
|
|
162
180
|
}
|
|
163
181
|
}
|
|
@@ -167,16 +185,54 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
167
185
|
}
|
|
168
186
|
|
|
169
187
|
if (options.command === "doctor") {
|
|
188
|
+
const checks = { extension: null, launcher: null, nativeManifests: [] };
|
|
189
|
+
try {
|
|
190
|
+
const extManifest = JSON.parse(await readFile(path.join(installedExtensionDir(), "manifest.json"), "utf8"));
|
|
191
|
+
checks.extension = {
|
|
192
|
+
installed: true,
|
|
193
|
+
version: extManifest.version ?? null,
|
|
194
|
+
matchesBundled: extManifest.version === EXTENSION_VERSION,
|
|
195
|
+
path: installedExtensionDir(),
|
|
196
|
+
};
|
|
197
|
+
} catch {
|
|
198
|
+
checks.extension = { installed: false, version: null, matchesBundled: false, path: installedExtensionDir() };
|
|
199
|
+
}
|
|
200
|
+
try {
|
|
201
|
+
await access(nativeHostLauncher(), constants.X_OK);
|
|
202
|
+
checks.launcher = { exists: true, path: nativeHostLauncher() };
|
|
203
|
+
} catch {
|
|
204
|
+
checks.launcher = { exists: false, path: nativeHostLauncher() };
|
|
205
|
+
}
|
|
206
|
+
for (const dir of nativeMessagingDirs()) {
|
|
207
|
+
const file = path.join(dir, `${HOST_NAME}.json`);
|
|
208
|
+
try {
|
|
209
|
+
await access(file);
|
|
210
|
+
checks.nativeManifests.push(file);
|
|
211
|
+
} catch {
|
|
212
|
+
// Skip absent browser dirs.
|
|
213
|
+
}
|
|
214
|
+
}
|
|
170
215
|
try {
|
|
171
216
|
const engine = options.enginePath ? await discoverEngine({ enginePath: options.enginePath }) : undefined;
|
|
172
|
-
const
|
|
173
|
-
const
|
|
174
|
-
|
|
217
|
+
const socketPath = await readBackend(bridgeFile);
|
|
218
|
+
const alive = await isSocketAlive(socketPath);
|
|
219
|
+
if (!alive) {
|
|
220
|
+
throw new Error(`Browser bridge socket exists at ${socketPath} but is not responding (stale socket — reload the Chrome extension).`);
|
|
221
|
+
}
|
|
222
|
+
const bridge = { descriptor: bridgeFile, socketPath, alive };
|
|
223
|
+
const report = {
|
|
224
|
+
ready: true,
|
|
225
|
+
node: process.version,
|
|
226
|
+
...(engine ? { engine } : {}),
|
|
227
|
+
bridge,
|
|
228
|
+
checks,
|
|
229
|
+
scope: "The bridge socket accepted a live connection. Browser actions and provider permissions are not checked.",
|
|
230
|
+
};
|
|
175
231
|
process.stdout.write(options.json ? `${JSON.stringify(report, null, 2)}\n` : `${report.scope}\n`);
|
|
176
232
|
return 0;
|
|
177
233
|
} catch (error) {
|
|
178
234
|
if (!options.json) throw error;
|
|
179
|
-
process.stdout.write(`${JSON.stringify({ ready: false, node: process.version, error: error.message }, null, 2)}\n`);
|
|
235
|
+
process.stdout.write(`${JSON.stringify({ ready: false, node: process.version, checks, error: error.message }, null, 2)}\n`);
|
|
180
236
|
return 1;
|
|
181
237
|
}
|
|
182
238
|
}
|