browser: legacy CDP opt-in + gentle native-zap poll
Firefox no longer dials the dead ws://:9223/cdp bridge by default (it error-looped); it's opt-in via globalThis.HANZO_LEGACY_CDP, matching Chrome's native-ZAP-only default. And the ZAP native-host reconnect goes 3s -> 30s: with no MCP client there's no router, so hammering (and re-launching the host) every 3s was pure noise — a live consumer is still picked up within one interval. Pairs with zapd host connect-only.
This commit is contained in:
@@ -110,7 +110,11 @@ class HanzoFirefoxExtension {
|
||||
|
||||
constructor() {
|
||||
console.log('[Hanzo] Firefox extension initializing...');
|
||||
this.connect();
|
||||
// Legacy ws://:9223 CDP bridge is OPT-IN (globalThis.HANZO_LEGACY_CDP). The
|
||||
// default (and only) transport is the ZAP native host — see
|
||||
// discoverZapServers() at EOF — matching Chrome. Without a bridge server the
|
||||
// WS just error-looped, so it no longer runs unless explicitly enabled.
|
||||
if ((globalThis as { HANZO_LEGACY_CDP?: boolean }).HANZO_LEGACY_CDP) this.connect();
|
||||
}
|
||||
|
||||
private connect(): void {
|
||||
|
||||
@@ -63,7 +63,11 @@ export interface NativeZapState {
|
||||
|
||||
export type Dispatch = (method: string, params: any) => Promise<any> | any;
|
||||
|
||||
const RECONNECT_MS = 3000;
|
||||
// Gentle safe poll: with no MCP client running there is no router to reach, so
|
||||
// the host connects-then-exits; probe every 30s instead of hammering (and
|
||||
// re-launching the native host) every 3s. A live consumer is picked up within
|
||||
// one interval.
|
||||
const RECONNECT_MS = 30_000;
|
||||
|
||||
/** Connect to zapd via the native host, register as a browser provider, and
|
||||
* dispatch inbound ROUTE commands to the browser. Self-heals on disconnect. */
|
||||
|
||||
Reference in New Issue
Block a user