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); }