@delicious233/codex-browser-bridge 0.3.0 → 1.5.1

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.
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+ const { spawnSync } = require("child_process");
6
+
7
+ const exe = path.join(__dirname, "codex-browser-bridge.exe");
8
+
9
+ if (!fs.existsSync(exe)) {
10
+ console.error("codex-browser-bridge.exe is missing. Reinstall the package with lifecycle scripts enabled.");
11
+ process.exit(1);
12
+ }
13
+
14
+ const result = spawnSync(exe, process.argv.slice(2), { stdio: "inherit" });
15
+
16
+ if (result.error) {
17
+ console.error(`failed to start codex-browser-bridge.exe: ${result.error.message}`);
18
+ process.exit(1);
19
+ }
20
+
21
+ process.exit(result.status === null ? 1 : result.status);
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@delicious233/codex-browser-bridge",
3
- "version": "0.3.0",
3
+ "version": "1.5.1",
4
4
  "private": false,
5
5
  "description": "MCP server that exposes Codex Desktop's Chrome browser bridge for Claude Code and other agents.",
6
6
  "bin": {
7
- "codex-browser-bridge": "bin/codex-browser-bridge"
7
+ "codex-browser-bridge": "bin/codex-browser-bridge.js"
8
8
  },
9
9
  "scripts": {
10
10
  "postinstall": "node scripts/install.js"
11
11
  },
12
12
  "files": [
13
- "bin/codex-browser-bridge",
13
+ "bin/codex-browser-bridge.js",
14
14
  "scripts/install.js"
15
15
  ],
16
16
  "repository": {
@@ -33,5 +33,6 @@
33
33
  "engines": {
34
34
  "node": ">=18"
35
35
  },
36
- "os": ["win32"]
36
+ "os": ["win32"],
37
+ "cpu": ["x64", "arm64"]
37
38
  }
@@ -8,6 +8,7 @@ const https = require("https");
8
8
 
9
9
  const repo = process.env.CODEX_BRIDGE_REPO || "DeliciousBuding/codex-browser-bridge";
10
10
  const binDir = path.join(__dirname, "..", "bin");
11
+ const packageJson = require("../package.json");
11
12
 
12
13
  function requestBuffer(url) {
13
14
  return new Promise((resolve, reject) => {
@@ -32,31 +33,58 @@ function sha256(buf) {
32
33
  return crypto.createHash("sha256").update(buf).digest("hex");
33
34
  }
34
35
 
36
+ function parseChecksumLine(line) {
37
+ const match = line.trim().match(/^([a-fA-F0-9]{64})\s+[*]?(.+)$/);
38
+ if (!match) return null;
39
+ return {
40
+ hash: match[1].toLowerCase(),
41
+ file: match[2].trim(),
42
+ };
43
+ }
44
+
35
45
  async function main() {
36
46
  if (process.platform !== "win32") {
37
47
  console.error("codex-browser-bridge only supports Windows (requires named pipes).");
38
48
  process.exit(1);
39
49
  }
40
50
 
41
- const arch = process.arch === "arm64" ? "arm64" : "amd64";
51
+ let arch;
52
+ switch (process.arch) {
53
+ case "x64":
54
+ arch = "amd64";
55
+ break;
56
+ case "arm64":
57
+ arch = "arm64";
58
+ break;
59
+ default:
60
+ console.error(`codex-browser-bridge does not ship a Windows binary for ${process.arch}.`);
61
+ process.exit(1);
62
+ }
63
+
64
+ const tag = process.env.CODEX_BRIDGE_TAG || `v${packageJson.version}`;
42
65
  const exeName = "codex-browser-bridge.exe";
43
66
  const asset = arch === "arm64" ? "codex-browser-bridge-arm64.exe" : "codex-browser-bridge.exe";
44
67
 
45
- const base = `https://github.com/${repo}/releases/latest/download`;
68
+ const base = `https://github.com/${repo}/releases/download/${tag}`;
46
69
 
47
70
  // Download checksums
48
- const checksums = await requestBuffer(`${base}/checksums.txt`);
49
- const line = checksums.toString("utf8").split(/\r?\n/).find((l) => l.endsWith(` ${asset}`));
50
- if (!line) throw new Error(`checksum not found for ${asset}`);
51
- const expected = line.split(/\s+/)[0].toLowerCase();
71
+ const checksumsURL = `${base}/checksums.txt`;
72
+ const checksums = await requestBuffer(checksumsURL).catch((err) => {
73
+ throw new Error(`could not download checksums for ${tag}: ${err.message}`);
74
+ });
75
+ const checksum = checksums.toString("utf8")
76
+ .split(/\r?\n/)
77
+ .map(parseChecksumLine)
78
+ .find((entry) => entry && entry.file === asset);
79
+ if (!checksum) throw new Error(`checksum not found for ${asset} in ${checksumsURL}`);
52
80
 
53
81
  // Download binary
54
- console.log(`Downloading codex-browser-bridge (${arch})...`);
82
+ console.log(`Downloading codex-browser-bridge ${tag} (${arch})...`);
55
83
  const binary = await requestBuffer(`${base}/${asset}`);
56
84
 
57
85
  // Verify checksum
58
86
  const actual = sha256(binary);
59
- if (actual !== expected) throw new Error(`checksum mismatch: expected ${expected}, got ${actual}`);
87
+ if (actual !== checksum.hash) throw new Error(`checksum mismatch: expected ${checksum.hash}, got ${actual}`);
60
88
 
61
89
  // Install
62
90
  fs.mkdirSync(binDir, { recursive: true });
Binary file