fix(gateway): start browser control server
parent
c050a82c3a
commit
21ac34bc6a
|
|
@ -78,8 +78,6 @@ enum GatewayLaunchAgentManager {
|
||||||
<dict>
|
<dict>
|
||||||
<key>PATH</key>
|
<key>PATH</key>
|
||||||
<string>\(preferredPath)</string>
|
<string>\(preferredPath)</string>
|
||||||
<key>CLAWDIS_SKIP_BROWSER_CONTROL_SERVER</key>
|
|
||||||
<string>1</string>
|
|
||||||
<key>CLAWDIS_IMAGE_BACKEND</key>
|
<key>CLAWDIS_IMAGE_BACKEND</key>
|
||||||
<string>sips</string>
|
<string>sips</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
|
||||||
|
|
@ -144,14 +144,12 @@ let stopBrowserControlServerIfStarted: (() => Promise<void>) | null = null;
|
||||||
|
|
||||||
async function startBrowserControlServerIfEnabled(): Promise<void> {
|
async function startBrowserControlServerIfEnabled(): Promise<void> {
|
||||||
if (process.env.CLAWDIS_SKIP_BROWSER_CONTROL_SERVER === "1") return;
|
if (process.env.CLAWDIS_SKIP_BROWSER_CONTROL_SERVER === "1") return;
|
||||||
// Lazy import to keep optional heavyweight deps (playwright/electron) out of
|
// Lazy import: keeps startup fast, but still bundles for the embedded
|
||||||
// embedded/daemon builds.
|
// gateway (bun --compile) via the static specifier path.
|
||||||
const spec =
|
const override = process.env.CLAWDIS_BROWSER_CONTROL_MODULE?.trim();
|
||||||
process.env.CLAWDIS_BROWSER_CONTROL_MODULE ??
|
const mod = override
|
||||||
// Intentionally not a static string literal so bun bundling can omit it.
|
? await import(override)
|
||||||
// (The embedded gateway sets CLAWDIS_SKIP_BROWSER_CONTROL_SERVER=1.)
|
: await import("../browser/server.js");
|
||||||
["..", "browser", "server.js"].join("/");
|
|
||||||
const mod = await import(spec);
|
|
||||||
stopBrowserControlServerIfStarted = mod.stopBrowserControlServer;
|
stopBrowserControlServerIfStarted = mod.stopBrowserControlServer;
|
||||||
await mod.startBrowserControlServerFromConfig(defaultRuntime);
|
await mod.startBrowserControlServerFromConfig(defaultRuntime);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue