chrome-bridge-mcp 1.16.0 → 1.16.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.
- package/extension/manifest.json +1 -1
- package/extension/service-worker.js +5 -1
- package/package.json +1 -1
- package/server/protocol.js +1 -1
- package/server/ws-manager.js +15 -5
package/extension/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": 3,
|
|
3
3
|
"name": "Chrome Bridge for Claude Code",
|
|
4
|
-
"version": "1.16.
|
|
4
|
+
"version": "1.16.1",
|
|
5
5
|
"description": "Bridge your browser to Claude Code: 59 token-efficient web-dev automation tools over a local WebSocket. ChromeOS included.",
|
|
6
6
|
"homepage_url": "https://github.com/frsorrentino/chrome-bridge",
|
|
7
7
|
"minimum_chrome_version": "135",
|
|
@@ -2430,7 +2430,11 @@ function handoffBanner(id, message, pick) {
|
|
|
2430
2430
|
if (!el || el === host || host.contains(el)) return;
|
|
2431
2431
|
e.preventDefault(); e.stopPropagation();
|
|
2432
2432
|
const r = el.getBoundingClientRect();
|
|
2433
|
-
|
|
2433
|
+
// Checkbox e radio: il value ("on") non dice niente, l'etichetta sì
|
|
2434
|
+
const labelFor = el.id && document.querySelector(`label[for="${CSS.escape(el.id)}"]`);
|
|
2435
|
+
const isToggle = el.tagName === 'INPUT' && /^(checkbox|radio)$/.test(el.type);
|
|
2436
|
+
const label = (labelFor?.textContent || el.closest('label')?.textContent || el.getAttribute('aria-label') || '').trim().replace(/\s+/g, ' ');
|
|
2437
|
+
const text = (isToggle ? label || el.name : (el.innerText || el.value || el.getAttribute('aria-label') || label || '')).trim().replace(/\s+/g, ' ').slice(0, 80);
|
|
2434
2438
|
finish({ done: true, action: 'picked', picked: { selector: selectorOf(el), tag: el.tagName.toLowerCase(), text, rect: { x: Math.round(r.x), y: Math.round(r.y), width: Math.round(r.width), height: Math.round(r.height) } } });
|
|
2435
2439
|
};
|
|
2436
2440
|
document.addEventListener('mousemove', onMove, true);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chrome-bridge-mcp",
|
|
3
3
|
"mcpName": "io.github.frsorrentino/chrome-bridge",
|
|
4
|
-
"version": "1.16.
|
|
4
|
+
"version": "1.16.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "MCP server with 59 tools for browser automation via Chrome extension. Works on ChromeOS/Crostini.",
|
|
7
7
|
"main": "server/index.js",
|
package/server/protocol.js
CHANGED
package/server/ws-manager.js
CHANGED
|
@@ -16,6 +16,13 @@
|
|
|
16
16
|
import WebSocket, { WebSocketServer } from 'ws';
|
|
17
17
|
import { DEFAULT_PORT, PING_INTERVAL_MS, IDENT_TIMEOUT_MS, PENDING_RELAY_TTL_MS, getTimeout, createCommand, MessageType, VERSION } from './protocol.js';
|
|
18
18
|
|
|
19
|
+
/** Quanto tenere in vita l'attesa di risposta per un comando arrivato da un relay. */
|
|
20
|
+
export function relayExpiry(msg) {
|
|
21
|
+
const asked = Number(msg?.params?.timeout);
|
|
22
|
+
const base = getTimeout(msg?.type);
|
|
23
|
+
return Math.max(PENDING_RELAY_TTL_MS, base, Number.isFinite(asked) && asked > 0 ? asked + 5000 : 0) + 5000;
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
export class WSManager {
|
|
20
27
|
constructor(port = DEFAULT_PORT, opts = {}) {
|
|
21
28
|
this.port = port;
|
|
@@ -377,8 +384,11 @@ export class WSManager {
|
|
|
377
384
|
return;
|
|
378
385
|
}
|
|
379
386
|
|
|
380
|
-
// Traccia quale relay ha inviato questo comando
|
|
381
|
-
|
|
387
|
+
// Traccia quale relay ha inviato questo comando. La scadenza è quella del
|
|
388
|
+
// comando, non un TTL fisso: un handoff di 4 minuti attraverso il relay
|
|
389
|
+
// finiva regolarmente nell'estensione e la risposta veniva scartata qui
|
|
390
|
+
// allo sweep dei 150 s — il chiamante aspettava fino al timeout di trasporto.
|
|
391
|
+
this.pendingRelay.set(msg.id, { ws, ts: Date.now(), expires: Date.now() + relayExpiry(msg) });
|
|
382
392
|
this.client.send(JSON.stringify(msg));
|
|
383
393
|
});
|
|
384
394
|
|
|
@@ -637,10 +647,10 @@ export class WSManager {
|
|
|
637
647
|
timestamp: Date.now(),
|
|
638
648
|
}));
|
|
639
649
|
}
|
|
640
|
-
// Sweep pendingRelay scaduti
|
|
641
|
-
const
|
|
650
|
+
// Sweep pendingRelay scaduti (scadenza per comando, vedi relayExpiry)
|
|
651
|
+
const now = Date.now();
|
|
642
652
|
for (const [id, entry] of this.pendingRelay) {
|
|
643
|
-
if (entry.ts <
|
|
653
|
+
if ((entry.expires ?? entry.ts + PENDING_RELAY_TTL_MS) < now) this.pendingRelay.delete(id);
|
|
644
654
|
}
|
|
645
655
|
}, this.pingIntervalMs);
|
|
646
656
|
}
|