claudelink-bridge 0.1.31 → 0.1.32

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/bin/cli.js +9 -9
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -174,16 +174,16 @@ async function checkPortRunning(port) {
174
174
  return new Promise((resolve) => {
175
175
  import('ws').then(({ default: WS }) => {
176
176
  const ws = new WS(`ws://localhost:${port}`);
177
- const t = setTimeout(() => { try { ws.terminate(); } catch {} resolve(false); }, 800);
178
- ws.on('open', () => ws.send(JSON.stringify({ type: 'ping' })));
179
- ws.on('message', (data) => {
180
- try {
181
- if (JSON.parse(data.toString()).type === 'pong') {
182
- clearTimeout(t); ws.terminate(); resolve(true);
183
- }
184
- } catch { resolve(false); }
177
+ const t = setTimeout(() => { try { ws.terminate(); } catch {} resolve(false); }, 1000);
178
+ // Connection opened = our bridge is listening (it closes non-extension origins but still accepts the TCP handshake)
179
+ ws.on('open', () => { clearTimeout(t); ws.terminate(); resolve(true); });
180
+ // Server actively closed = also our bridge (it accepted then rejected)
181
+ ws.on('close', () => { clearTimeout(t); resolve(true); });
182
+ // Connection refused = nothing on this port
183
+ ws.on('error', (err) => {
184
+ clearTimeout(t);
185
+ resolve(err.code !== 'ECONNREFUSED');
185
186
  });
186
- ws.on('error', () => { clearTimeout(t); resolve(false); });
187
187
  }).catch(() => resolve(false));
188
188
  });
189
189
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudelink-bridge",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "Bridge your browser to Claude Code CLI. The local server for the ClaudeLink Chrome extension — send screenshots, page content, and custom commands from any webpage directly to Claude Code.",
5
5
  "type": "module",
6
6
  "bin": {