From 21ac34bc6a93874027a8e22572e37b3531616b12 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 20 Dec 2025 19:16:49 +0000 Subject: [PATCH] fix(gateway): start browser control server --- .../Clawdis/GatewayLaunchAgentManager.swift | 2 -- src/gateway/server.ts | 14 ++++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/apps/macos/Sources/Clawdis/GatewayLaunchAgentManager.swift b/apps/macos/Sources/Clawdis/GatewayLaunchAgentManager.swift index e0a302088..bbcdaa083 100644 --- a/apps/macos/Sources/Clawdis/GatewayLaunchAgentManager.swift +++ b/apps/macos/Sources/Clawdis/GatewayLaunchAgentManager.swift @@ -78,8 +78,6 @@ enum GatewayLaunchAgentManager { PATH \(preferredPath) - CLAWDIS_SKIP_BROWSER_CONTROL_SERVER - 1 CLAWDIS_IMAGE_BACKEND sips diff --git a/src/gateway/server.ts b/src/gateway/server.ts index 8fa47ba71..e21b694be 100644 --- a/src/gateway/server.ts +++ b/src/gateway/server.ts @@ -144,14 +144,12 @@ let stopBrowserControlServerIfStarted: (() => Promise) | null = null; async function startBrowserControlServerIfEnabled(): Promise { if (process.env.CLAWDIS_SKIP_BROWSER_CONTROL_SERVER === "1") return; - // Lazy import to keep optional heavyweight deps (playwright/electron) out of - // embedded/daemon builds. - const spec = - process.env.CLAWDIS_BROWSER_CONTROL_MODULE ?? - // Intentionally not a static string literal so bun bundling can omit it. - // (The embedded gateway sets CLAWDIS_SKIP_BROWSER_CONTROL_SERVER=1.) - ["..", "browser", "server.js"].join("/"); - const mod = await import(spec); + // Lazy import: keeps startup fast, but still bundles for the embedded + // gateway (bun --compile) via the static specifier path. + const override = process.env.CLAWDIS_BROWSER_CONTROL_MODULE?.trim(); + const mod = override + ? await import(override) + : await import("../browser/server.js"); stopBrowserControlServerIfStarted = mod.stopBrowserControlServer; await mod.startBrowserControlServerFromConfig(defaultRuntime); }