open-browser-use 0.1.4 → 0.1.6

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
@@ -10,3 +10,11 @@ obu version
10
10
 
11
11
  The package contains prebuilt Go binaries for macOS, Linux, and Windows on
12
12
  `amd64` and `arm64`.
13
+
14
+ On macOS and Linux, package installation attempts to register the Chrome native
15
+ messaging host automatically for the Chrome Web Store extension. If the Chrome
16
+ extension reports that the native host was not found, repair registration with:
17
+
18
+ ```sh
19
+ open-browser-use install-manifest
20
+ ```
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawnSync } 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
+ if (process.env.OPEN_BROWSER_USE_SKIP_POSTINSTALL === "1") {
20
+ process.exit(0);
21
+ }
22
+
23
+ const platform = platformMap[process.platform];
24
+ const arch = archMap[process.arch];
25
+
26
+ if (!platform || !arch || platform === "windows") {
27
+ console.warn(
28
+ `open-browser-use native host auto-registration is not available for ${process.platform}/${process.arch}.`
29
+ );
30
+ process.exit(0);
31
+ }
32
+
33
+ const __dirname = dirname(fileURLToPath(import.meta.url));
34
+ const executable = process.platform === "win32" ? "open-browser-use.exe" : "open-browser-use";
35
+ const binaryPath = join(__dirname, "..", "native", `${platform}-${arch}`, executable);
36
+
37
+ if (!existsSync(binaryPath)) {
38
+ console.warn(`open-browser-use native binary is missing, skipping native host registration: ${binaryPath}`);
39
+ process.exit(0);
40
+ }
41
+
42
+ const result = spawnSync(binaryPath, ["install-manifest", "--path", binaryPath], {
43
+ stdio: "inherit"
44
+ });
45
+
46
+ if (result.error || result.status !== 0) {
47
+ const detail = result.error ? `: ${result.error.message}` : "";
48
+ console.warn(`open-browser-use native host auto-registration skipped${detail}`);
49
+ console.warn("Run `open-browser-use install-manifest` after installation to repair the Chrome native host manifest.");
50
+ }
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-browser-use",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Open Browser Use native host and CLI binary.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -23,6 +23,7 @@
23
23
  },
24
24
  "homepage": "https://github.com/iFurySt/open-codex-browser-use#readme",
25
25
  "scripts": {
26
+ "postinstall": "node cli/postinstall.js",
26
27
  "prepack": "../../scripts/build-npm-cli-package.sh",
27
28
  "test": "../../scripts/build-npm-cli-package.sh && node cli/open-browser-use.js version"
28
29
  },