open-browser-use 0.1.4

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 ADDED
@@ -0,0 +1,12 @@
1
+ # Open Browser Use CLI
2
+
3
+ This npm package installs the `open-browser-use` native host and CLI binary.
4
+ It also exposes the short `obu` command.
5
+
6
+ ```sh
7
+ npm install -g open-browser-use
8
+ obu version
9
+ ```
10
+
11
+ The package contains prebuilt Go binaries for macOS, Linux, and Windows on
12
+ `amd64` and `arm64`.
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from "node:child_process";
4
+ import { existsSync } from "node:fs";
5
+ import { dirname, join } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+
8
+ const platformMap = {
9
+ darwin: "darwin",
10
+ linux: "linux",
11
+ win32: "windows"
12
+ };
13
+
14
+ const archMap = {
15
+ arm64: "arm64",
16
+ x64: "amd64"
17
+ };
18
+
19
+ const platform = platformMap[process.platform];
20
+ const arch = archMap[process.arch];
21
+
22
+ if (!platform || !arch) {
23
+ console.error(`open-browser-use does not ship a binary for ${process.platform}/${process.arch}`);
24
+ process.exit(1);
25
+ }
26
+
27
+ const __dirname = dirname(fileURLToPath(import.meta.url));
28
+ const executable = process.platform === "win32" ? "open-browser-use.exe" : "open-browser-use";
29
+ const binaryPath = join(__dirname, "..", "native", `${platform}-${arch}`, executable);
30
+
31
+ if (!existsSync(binaryPath)) {
32
+ console.error(`open-browser-use binary is missing for ${process.platform}/${process.arch}: ${binaryPath}`);
33
+ process.exit(1);
34
+ }
35
+
36
+ const child = spawn(binaryPath, process.argv.slice(2), {
37
+ stdio: "inherit"
38
+ });
39
+
40
+ child.on("error", (error) => {
41
+ console.error(error.message);
42
+ process.exit(1);
43
+ });
44
+
45
+ child.on("exit", (code, signal) => {
46
+ if (signal) {
47
+ process.kill(process.pid, signal);
48
+ return;
49
+ }
50
+ process.exit(code ?? 0);
51
+ });
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "open-browser-use",
3
+ "version": "0.1.4",
4
+ "description": "Open Browser Use native host and CLI binary.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "open-browser-use": "cli/open-browser-use.js",
9
+ "obu": "cli/open-browser-use.js"
10
+ },
11
+ "files": [
12
+ "cli/",
13
+ "native/",
14
+ "README.md"
15
+ ],
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/iFurySt/open-codex-browser-use.git",
19
+ "directory": "packages/open-browser-use-cli"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/iFurySt/open-codex-browser-use/issues"
23
+ },
24
+ "homepage": "https://github.com/iFurySt/open-codex-browser-use#readme",
25
+ "scripts": {
26
+ "prepack": "../../scripts/build-npm-cli-package.sh",
27
+ "test": "../../scripts/build-npm-cli-package.sh && node cli/open-browser-use.js version"
28
+ },
29
+ "engines": {
30
+ "node": ">=18"
31
+ }
32
+ }