chromeflow 0.1.48 → 0.1.50

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.
Files changed (2) hide show
  1. package/dist/ws-bridge.js +16 -14
  2. package/package.json +1 -1
package/dist/ws-bridge.js CHANGED
@@ -1,33 +1,35 @@
1
- import { execSync } from "child_process";
2
1
  import { WebSocketServer, WebSocket } from "ws";
3
- const WS_PORT = 7878;
2
+ const WS_PORT_BASE = 7878;
3
+ const WS_PORT_MAX = 7888;
4
4
  const REQUEST_TIMEOUT_MS = 3e4;
5
5
  class WsBridge {
6
6
  wss;
7
7
  client = null;
8
8
  pending = /* @__PURE__ */ new Map();
9
+ port = WS_PORT_BASE;
9
10
  constructor() {
10
- this.bind();
11
+ this.bind(WS_PORT_BASE);
11
12
  }
12
- bind() {
13
- const wss = new WebSocketServer({ port: WS_PORT });
13
+ bind(tryPort) {
14
+ if (tryPort > WS_PORT_MAX) {
15
+ console.error(
16
+ `[chromeflow] All ports ${WS_PORT_BASE}-${WS_PORT_MAX} are in use. Cannot start MCP server.`
17
+ );
18
+ return;
19
+ }
20
+ const wss = new WebSocketServer({ port: tryPort });
14
21
  wss.on("error", (err) => {
15
22
  if (err.code === "EADDRINUSE") {
16
- console.error(
17
- `[chromeflow] Port ${WS_PORT} in use \u2014 killing stale process and retrying...`
18
- );
19
- try {
20
- execSync(`lsof -ti:${WS_PORT} | xargs kill -9`, { stdio: "ignore" });
21
- } catch {
22
- }
23
- setTimeout(() => this.bind(), 800);
23
+ console.error(`[chromeflow] Port ${tryPort} in use, trying ${tryPort + 1}...`);
24
+ this.bind(tryPort + 1);
24
25
  } else {
25
26
  console.error("[chromeflow] WS server error:", err);
26
27
  }
27
28
  });
28
29
  wss.on("listening", () => {
29
30
  this.wss = wss;
30
- console.error(`[chromeflow] WS bridge listening on ws://localhost:${WS_PORT}`);
31
+ this.port = tryPort;
32
+ console.error(`[chromeflow] WS bridge listening on ws://localhost:${tryPort}`);
31
33
  });
32
34
  wss.on("connection", (ws) => {
33
35
  if (this.client) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chromeflow",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
4
4
  "description": "Browser guidance MCP server for Claude Code — highlights, clicks, fills, and captures from the web so you don't have to.",
5
5
  "type": "module",
6
6
  "bin": {