@delicious233/codex-browser-bridge 0.1.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/bin/codex-browser-bridge +15 -0
- package/package.json +37 -0
- package/scripts/install.js +71 -0
|
@@ -0,0 +1,15 @@
|
|
|
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 not found. Reinstall with: npm i -g @delicious233/codex-browser-bridge");
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const result = spawnSync(exe, process.argv.slice(2), { stdio: "inherit" });
|
|
15
|
+
process.exit(result.status ?? 1);
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@delicious233/codex-browser-bridge",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "MCP server that exposes Codex Desktop's Chrome browser bridge for Claude Code and other agents.",
|
|
6
|
+
"bin": {
|
|
7
|
+
"codex-browser-bridge": "bin/codex-browser-bridge"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"postinstall": "node scripts/install.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"bin/codex-browser-bridge",
|
|
14
|
+
"scripts/install.js"
|
|
15
|
+
],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/DeliciousBuding/codex-browser-bridge.git",
|
|
19
|
+
"directory": "npm"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"codex",
|
|
23
|
+
"chrome",
|
|
24
|
+
"mcp",
|
|
25
|
+
"browser",
|
|
26
|
+
"claude-code",
|
|
27
|
+
"agent",
|
|
28
|
+
"automation",
|
|
29
|
+
"devtools"
|
|
30
|
+
],
|
|
31
|
+
"author": "DeliciousBuding",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18"
|
|
35
|
+
},
|
|
36
|
+
"os": ["win32"]
|
|
37
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const os = require("os");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const crypto = require("crypto");
|
|
7
|
+
const https = require("https");
|
|
8
|
+
|
|
9
|
+
const repo = process.env.CODEX_BRIDGE_REPO || "DeliciousBuding/codex-browser-bridge";
|
|
10
|
+
const binDir = path.join(__dirname, "..", "bin");
|
|
11
|
+
|
|
12
|
+
function requestBuffer(url) {
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
const req = https.get(url, { headers: { "User-Agent": "codex-browser-bridge-npm" }, timeout: 60000 }, (res) => {
|
|
15
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
16
|
+
requestBuffer(res.headers.location).then(resolve, reject);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (res.statusCode !== 200) {
|
|
20
|
+
reject(new Error(`HTTP ${res.statusCode}: ${url}`));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const chunks = [];
|
|
24
|
+
res.on("data", (c) => chunks.push(c));
|
|
25
|
+
res.on("end", () => resolve(Buffer.concat(chunks)));
|
|
26
|
+
}).on("error", reject);
|
|
27
|
+
req.on("timeout", () => { req.destroy(); reject(new Error(`timeout: ${url}`)); });
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function sha256(buf) {
|
|
32
|
+
return crypto.createHash("sha256").update(buf).digest("hex");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function main() {
|
|
36
|
+
if (process.platform !== "win32") {
|
|
37
|
+
console.error("codex-browser-bridge only supports Windows (requires named pipes).");
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const arch = process.arch === "arm64" ? "arm64" : "amd64";
|
|
42
|
+
const exeName = "codex-browser-bridge.exe";
|
|
43
|
+
const asset = arch === "arm64" ? "codex-browser-bridge-arm64.exe" : "codex-browser-bridge.exe";
|
|
44
|
+
|
|
45
|
+
const base = `https://github.com/${repo}/releases/latest/download`;
|
|
46
|
+
|
|
47
|
+
// 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();
|
|
52
|
+
|
|
53
|
+
// Download binary
|
|
54
|
+
console.log(`Downloading codex-browser-bridge (${arch})...`);
|
|
55
|
+
const binary = await requestBuffer(`${base}/${asset}`);
|
|
56
|
+
|
|
57
|
+
// Verify checksum
|
|
58
|
+
const actual = sha256(binary);
|
|
59
|
+
if (actual !== expected) throw new Error(`checksum mismatch: expected ${expected}, got ${actual}`);
|
|
60
|
+
|
|
61
|
+
// Install
|
|
62
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
63
|
+
const target = path.join(binDir, exeName);
|
|
64
|
+
fs.writeFileSync(target, binary);
|
|
65
|
+
console.log(`Installed: ${target}`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
main().catch((err) => {
|
|
69
|
+
console.error(`install failed: ${err.message}`);
|
|
70
|
+
process.exit(1);
|
|
71
|
+
});
|