Skip to content

An agentic browser harness: an AI side panel & orb in your own logged-in Chrome, Edge, Arc, Brave or even Firefox run by the agent/subscription you already use (Claude Code, Codex, Antigravity). Free, open source, no API key. Also an MCP server.

fix(pairing): report the daemon's close reason instead of "no daemon is running"

Shahriar907a3d5a1bd7
diff --git a/lib/bridge/socket.ts b/lib/bridge/socket.ts
index 33233b1..e5e623f 100644
--- a/lib/bridge/socket.ts
+++ b/lib/bridge/socket.ts
@@ -378,9 +378,13 @@ function dial(credential: Credential, portIndex: number, carried?: Refusal): voi
void handle(ws, String(event.data), attempt);
};
- ws.onclose = () => {
+ ws.onclose = (event) => {
clearTimeout(handshakeTimer);
if (socket === ws) socket = null;
+ // A daemon that refuses the handshake outright — a protocol mismatch above all — says why in
+ // the close frame and never sends an `unauthorized`. Without this the walk ends on the generic
+ // "no daemon is running", which sends the user hunting for a process that is running fine.
+ refusal ??= closeRefusal(event);
// Nothing on this port ever proved itself — a squatter, a stale daemon, an empty port — so the
// walk continues instead of pinning the extension to whoever answered first.
if (!welcomed) return dial(credential, portIndex + 1, refusal);
@@ -389,6 +393,16 @@ function dial(credential: Credential, portIndex: number, carried?: Refusal): voi
};
}
+const OWN_CLOSE = new Set(['unproven daemon', '']);
+
+function closeRefusal(event: CloseEvent): Refusal | undefined {
+ const reason = event.reason?.trim();
+ if (!reason || OWN_CLOSE.has(reason)) return undefined;
+ return /protocol version mismatch/i.test(reason)
+ ? { reason: `${reason}. Rebuild and reload the extension — “yarn build”, then Reload at chrome://extensions.`, retryable: false }
+ : { reason, retryable: true };
+}
+
function giveUp(credential: Credential, refusal?: Refusal): void {
if (refusal && !refusal.retryable) {
settlePairing({ ok: false, error: refusal.reason });